问:
Monkey Patch 'at_with_coercion' (activesupport) / Handle milliseconds from epoch

Description

We have a Ruby and Rails application with a web frontend and an API to support web calls from outside the frontend. We use the API in one use case to create and update work orders (resource) from calling an web url and sending the parameters as raw JSON data to our API controller (separate controller with separate route).
One attribute of an work order is 'due_date' which is defined in the model as a field of type DateTime (through Mongoid).
While Rails tries to instantiate the new object of a work order in the controller with the given parameters the transformation into the defined database fieldtypes gets done. For DateTime fields this is done internally by calling “at_with_coercion” in rails/activesupport/lib/active_support/core_ext/time/calculations.rb in line  44 (https://github.com/rails/rails/blob/v5.2.6/activesupport/lib/active_support/core_ext/time/calculations.rb#L44).
Because the API is called from outside there is an use case to set the 'due_date' field with an integer number which contains the amount of milliseconds from epoch time (1970-01-01 01:00:00).
Rails can only handle an integer which contains the amount of seconds from epoch time.
So we tried to monkey patch the internal “at_with_coercion” method but ran into some issues.

Steps to reproduce

Model:

include Mongoid::Document
include Mongoid::Timestamps
field :due_date, type: DateTime
```
<p>Controller:</p>
<pre class="lang-rb prettyprint-override"><code>def create
  @work_order = WorkOrder.new(params.require(:work_order).permit(:name, … , :due_date, … ))
  @work_order.save
end
</code>```

Monkey Patches

lib/core_extensions/time.rb:

class Time
  class << self
    remove_method :at_without_coercion
    remove_method :at_with_coercion
    remove_method :at

    # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
    # instances can be used when called with a single argument
    def at_with_coercion(*args)
      return at_without_coercion(*args) if args.size != 1

      # Time.at can be called with a time or numerical value
      time_or_number = args.first

      if time_or_number.is_a?(ActiveSupport::TimeWithZone) || time_or_number.is_a?(DateTime)
        at_without_coercion(time_or_number.to_f).getlocal
      elsif time_or_number.is_a?(Integer) && time_or_number.to_s.length == 13
        time_or_number /= 1000.0
        at_without_coercion(time_or_number)
      else
        at_without_coercion(time_or_number)
      end
    end
    alias at_without_coercion at
    alias at at_with_coercion
  end
end
```
<p>config/initializers/monkey_patches.rb:</p>
<pre class="lang-rb prettyprint-override"><code>Dir[Rails.root.join('lib', 'core_extensions', '*.rb')].sort.each do |f|
  require f
end
</code>```

API call:

URL: {{protocol}}://{{subdomain}}.{{url}}/api/v2/work_orders.json
Parameters (raw JSON): {

"work_order":{
    "name":"Test workorder",
    ... ,
    "due_date":1669105754783,
    ...
    }
}
```

Expected behavior

Rails should use our monkey patched method and return the correct formatted Time value.

Actual behavior

If we don’t remove the existing aliases the calls to “at_without_coercion” leads to the internal Rails method alias and we get a StackLevel too deep exception.
If we override the aliases we end up in an infinity loop following a StackLevel to deep exception because the overriden method calls itself multiple times.

System configuration

Rails version: 5.2.6

Ruby version: 2.5.9p229

Mongoid gem version: 7.3.1

Alternatives

If there is no possibility to monkey patch the internal method is there a possibility so Rails can handle an amount of milliseconds from epoch time?

Body:
Description

We have a Ruby and Rails application with a web frontend and an API to support web calls from outside the frontend. We use the API in one use case to create and update work orders (resource) from calling an web url and sending the parameters as raw JSON data to our API controller (separate controller with separate route).
One attribute of an work order is 'due_date' which is defined in the model as a field of type DateTime (through Mongoid).
While Rails tries to instantiate the new object of a work order in the controller with the given parameters the transformation into the defined database fieldtypes gets done. For DateTime fields this is done internally by calling “at_with_coercion” in rails/activesupport/lib/active_support/core_ext/time/calculations.rb in line  44 (https://github.com/rails/rails/blob/v5.2.6/activesupport/lib/active_support/core_ext/time/calculations.rb#L44).
Because the API is called from outside there is an use case to set the 'due_date' field with an integer number which contains the amount of milliseconds from epoch time (1970-01-01 01:00:00).
Rails can only handle an integer which contains the amount of seconds from epoch time.
So we tried to monkey patch the internal “at_with_coercion” method but ran into some issues.

Steps to reproduce

Model:

include Mongoid::Document
include Mongoid::Timestamps
field :due_date, type: DateTime

Controller:

def create
  @work_order = WorkOrder.new(params.require(:work_order).permit(:name, … , :due_date, … ))
  @work_order.save
end

Monkey Patches

lib/core_extensions/time.rb:

class Time
  class << self
    remove_method :at_without_coercion
    remove_method :at_with_coercion
    remove_method :at

    # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
    # instances can be used when called with a single argument
    def at_with_coercion(*args)
      return at_without_coercion(*args) if args.size != 1

      # Time.at can be called with a time or numerical value
      time_or_number = args.first

      if time_or_number.is_a?(ActiveSupport::TimeWithZone) || time_or_number.is_a?(DateTime)
        at_without_coercion(time_or_number.to_f).getlocal
      elsif time_or_number.is_a?(Integer) && time_or_number.to_s.length == 13
        time_or_number /= 1000.0
        at_without_coercion(time_or_number)
      else
        at_without_coercion(time_or_number)
      end
    end
    alias at_without_coercion at
    alias at at_with_coercion
  end
end

config/initializers/monkey_patches.rb:

Dir[Rails.root.join('lib', 'core_extensions', '*.rb')].sort.each do |f|
  require f
end

API call:

URL: {{protocol}}://{{subdomain}}.{{url}}/api/v2/work_orders.json
Parameters (raw JSON): {

"work_order":{
    "name":"Test workorder",
    ... ,
    "due_date":1669105754783,
    ...
    }
}

Expected behavior

Rails should use our monkey patched method and return the correct formatted Time value.

Actual behavior

If we don’t remove the existing aliases the calls to “at_without_coercion” leads to the internal Rails method alias and we get a StackLevel too deep exception.
If we override the aliases we end up in an infinity loop following a StackLevel to deep exception because the overriden method calls itself multiple times.

System configuration

Rails version: 5.2.6

Ruby version: 2.5.9p229

Mongoid gem version: 7.3.1

Alternatives

If there is no possibility to monkey patch the internal method is there a possibility so Rails can handle an amount of milliseconds from epoch time?


来源: stackexchange

问:
Is there is need to create assetlinks.json file in android project directory for deep linking
Getting error over plays tore
Digital Asset Links JSON file failed
brightness_1
Add a Digital Asset Links JSON file to all the failed domains how to resolve this problem

Digitally i am generating assetlinks.json using **https://developers.google.com/digital-asset-links/tools/generator **

Now what should be next step Is there is need to create assetlinks.json file in android project directory or need to publish app again over google play store

ContentLicense: CC BY-SA 4.0


问:
how to specify the file path for a telegram document send?
Trying to send my log file to my Telegram group when they request it.

File 'log.log' is located in the same directory

```<code>@t_a = ENV['TELEGRAM_API_KEY']

def send_log(chatid)
    file = "log.log"
    url = "https://api.telegram.org"
    u = "#{url}/bot#{@t_a}"
    conn = Faraday.new(
        url: u
    )

    conn.post('sendDocument', {chat_id: chatid, document: file })

end
</code>```

faraday logs

I, [2022-12-13T16:20:25.153221 #6333]  INFO -- : 400     //status

I, [2022-12-13T16:20:25.153473 #6333]  INFO -- :         //headers

{"server"=>"nginx/1.18.0", "date"=>"Tue, 13 Dec 2022 09:20:25 GMT",
"content-type"=>"application/json", "content-length"=>"99",
"connection"=>"keep-alive",
"strict-transport-security"=>"max-age=31536000; includeSubDomains;
preload", "access-control-allow-origin"=>"*",
"access-control-expose-headers"=>"Content-Length,Content-Type,Date,Server,Connection"}

I, [2022-12-13T16:20:25.153624 #6333]  INFO -- :         //body

{"ok":false,"error_code":400,"description":"Bad Request: wrong file
identifier/HTTP URL specified"}

This is another suggested way, send an open file object.

```<code>def send_log(chatid)
        file = File.open("log.log")
        url = "https://api.telegram.org"
        u = "#{url}/bot#{@t_a}"
        conn = Faraday.new(
            url: u
        )
        conn.post('sendDocument', {chat_id: chatid, document: file })
    end
</code>```

I, [2022-12-13T16:25:55.845168 #6625]  INFO -- :

{"ok":false,"error_code":400,"description":"Bad Request: wrong remote
file identifier specified: Wrong character in the string"}

Body:
Trying to send my log file to my Telegram group when they request it.

File 'log.log' is located in the same directory

@t_a = ENV['TELEGRAM_API_KEY']

def send_log(chatid)
    file = "log.log"
    url = "https://api.telegram.org"
    u = "#{url}/bot#{@t_a}"
    conn = Faraday.new(
        url: u
    )

    conn.post('sendDocument', {chat_id: chatid, document: file })

end

faraday logs

I, [2022-12-13T16:20:25.153221 #6333]  INFO -- : 400     //status

I, [2022-12-13T16:20:25.153473 #6333]  INFO -- :         //headers

{"server"=>"nginx/1.18.0", "date"=>"Tue, 13 Dec 2022 09:20:25 GMT",
"content-type"=>"application/json", "content-length"=>"99",
"connection"=>"keep-alive",
"strict-transport-security"=>"max-age=31536000; includeSubDomains;
preload", "access-control-allow-origin"=>"*",
"access-control-expose-headers"=>"Content-Length,Content-Type,Date,Server,Connection"}

I, [2022-12-13T16:20:25.153624 #6333]  INFO -- :         //body

{"ok":false,"error_code":400,"description":"Bad Request: wrong file
identifier/HTTP URL specified"}

This is another suggested way, send an open file object.

def send_log(chatid)
        file = File.open("log.log")
        url = "https://api.telegram.org"
        u = "#{url}/bot#{@t_a}"
        conn = Faraday.new(
            url: u
        )
        conn.post('sendDocument', {chat_id: chatid, document: file })
    end

I, [2022-12-13T16:25:55.845168 #6625]  INFO -- :

{"ok":false,"error_code":400,"description":"Bad Request: wrong remote
file identifier specified: Wrong character in the string"}


问:
Git show incorrect file name on CI/CD pipeline
When i'm pushing new branch to repository i got error that my file didn't exist. It's happens because filename have Cyrillic symbols and git show his like datacenters/\320\246\320\236\320\224\321\213.

How i can change this story??


问:
can't access variables in iteration using pug
I can access pug variable using p #{.pomodoros}

but when I try to loop it using each, it failed and show message "function Pomodoros not defined"

I already try using

```<code>each pomodoro in #{.Pomodoros}
  li= pomodoro
</code>```

but that still not working

Body:
I can access pug variable using p #{.pomodoros}

but when I try to loop it using each, it failed and show message "function Pomodoros not defined"

I already try using

each pomodoro in #{.Pomodoros}
  li= pomodoro

but that still not working


问:
Want to know about authentication error /creational invalid in power BI i call rest API
When i call rest API by using following line of code that time, I'm pass my Power BI desktop username and pass but its showing error

```<code>() =>
let body = [username = "Username", password = "----"],
    Data = Json.Document(Web.Contents("URL", [Headers = [# "Content-Type" = "application/json"], Content = Json.FromValue(body)])),
    result = Record.Field(Data[result] {
        0
    }, "token")
in
result
</code>```

refer this code I'm trying but I found error

Body:
When i call rest API by using following line of code that time, I'm pass my Power BI desktop username and pass but its showing error

() =>
let body = [username = "Username", password = "----"],
    Data = Json.Document(Web.Contents("URL", [Headers = [# "Content-Type" = "application/json"], Content = Json.FromValue(body)])),
    result = Record.Field(Data[result] {
        0
    }, "token")
in
result

refer this code I'm trying but I found error


问:
SwiftUI append data into structured array only if data didn't already inside
I'm trying to add data into a structured array only if data didn't already exist in my array. I do that in a ForEach in my main view.

My code is :

```<code>ForEach(flightLibrary.testFlight.filter({Calendar.current.isDate($0.date, inSameDayAs: date)})) { flight in
    ZStack {
        RoundedRectangle(cornerRadius: 10, style: .continuous)
        NavigationLink(
            destination: {
                // .........
            }, label: {
                LogbookCellView2(flight: flight)
            }).accentColor(.black)

        let nameDepField = flight.depPlace
        let nameArrField = flight.arrPlace

        if !places.filter { $0.name.contains(nameDepField) }{
            let _ = places.append(PointOfInterest(name: nameDepField, latitude: getApLat(ApName: nameDepField) ?? 45, longitude: getApLong(ApName: nameDepField) ?? 15))
        }
        if !places.filter { $0.name.contains(nameArrField) }{
            let _ =  places.append(PointOfInterest(name: nameArrField, latitude: getApLat(ApName: nameArrField) ?? 45, longitude: getApLong(ApName: nameArrField) ?? 15))
        }
    }
}
</code>```

My array is defined as follow :

```<code>var places: [PointOfInterest] = []

struct PointOfInterest: Identifiable {

    let id = UUID()
    let name: String
    let latitude: Double
    let longitude: Double

    var coordinate: CLLocationCoordinate2D {
        CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
    }
}
</code>```

And I would like to check if places.name match with nameDepField or nameArrField and if there is no match : add my new value.

But with my code where I used : if !places.filter { $0.name.contains(nameDepField) } xCode give me : The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions in my var body: some View line.

I don't see how to manage this ...

Body:
I'm trying to add data into a structured array only if data didn't already exist in my array. I do that in a ForEach in my main view.

My code is :

ForEach(flightLibrary.testFlight.filter({Calendar.current.isDate($0.date, inSameDayAs: date)})) { flight in
    ZStack {
        RoundedRectangle(cornerRadius: 10, style: .continuous)
        NavigationLink(
            destination: {
                // .........
            }, label: {
                LogbookCellView2(flight: flight)
            }).accentColor(.black)

        let nameDepField = flight.depPlace
        let nameArrField = flight.arrPlace

        if !places.filter { $0.name.contains(nameDepField) }{
            let _ = places.append(PointOfInterest(name: nameDepField, latitude: getApLat(ApName: nameDepField) ?? 45, longitude: getApLong(ApName: nameDepField) ?? 15))
        }
        if !places.filter { $0.name.contains(nameArrField) }{
            let _ =  places.append(PointOfInterest(name: nameArrField, latitude: getApLat(ApName: nameArrField) ?? 45, longitude: getApLong(ApName: nameArrField) ?? 15))
        }
    }
}

My array is defined as follow :

var places: [PointOfInterest] = []

struct PointOfInterest: Identifiable {

    let id = UUID()
    let name: String
    let latitude: Double
    let longitude: Double

    var coordinate: CLLocationCoordinate2D {
        CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
    }
}

And I would like to check if places.name match with nameDepField or nameArrField and if there is no match : add my new value.

But with my code where I used : if !places.filter { $0.name.contains(nameDepField) } xCode give me : The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions in my var body: some View line.

I don't see how to manage this ...


问:
Is it possible to view a postgresql table using Pandas?
```<code>def connectxmlDb(dbparams):
conn_string = "host='{}' dbname='{}' user='{}' password='{}' port='{}'"\
.format(dbparams['HOST'], dbparams['DB'], dbparams['USERNAME'], dbparams['PASSWORD'], dbparams['PORT'])
try:
    conn = psycopg2.connect(conn_string)
    pass
except Exception as err:
    print('Connection to Database Failed : ERR : {}'.format(err))
    return False
print('Connection to Database Success')
return conn

dbconn = connectxmlDb(params['DATABASE'])
</code>```

The above mentioned is the code I use to connect to postgresql database

```<code>sql_statement = """ select a.slno, a.clientid, a.filename, a.user1_id, b.username, a.user2_id, c.username as username2, a.uploaded_ts, a.status_id
                    from masterdb.xmlform_joblist a
                    left outer join masterdb.auth_user b
                    on a.user1_id = b.id
                    left outer join masterdb.auth_user c
                    on a.user2_id = c.id
                    """
cursor.execute(sql_statement)

result = cursor.fetchall()

</code>```

This is my code to extract data from a postgres table using python.
I want to know if it is possible to view this data using Pandas

This is the code I used:

```<code>
df = pd.read_sql_query(sql_statement, dbconn)
print(df.head(10))

</code>```

but it is showing error.

```<code>C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-

packages\pandas\io\sql.py:762: UserWarning: pandas only support SQLAlchemy connectable(engine/connection) ordatabase string URI or sqlite3 DBAPI2 connectionother DBAPI2 objects are not tested, please consider using SQLAlchemy
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 2023, in execute
    cur.execute(*args, **kwargs)
psycopg2.errors.SyntaxError: syntax error at or near ";"
LINE 1: ...ELECT name FROM sqlite_master WHERE type='table' AND name=?;
                                                                      ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\Users\Lukmana\Desktop\user_count\usercount.py", line 55, in <module>
    df = pd.read_sql_table(result, dbconn)
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 286, in read_sql_table
    if not pandas_sql.has_table(table_name):
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 2200, in has_table
    return len(self.execute(query, [name]).fetchall()) > 0
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 2035, in execute
    raise ex from exc
pandas.io.sql.DatabaseError: Execution failed on sql 'SELECT name FROM sqlite_master WHERE type='table' AND name=?;': syntax error at or near ";"
LINE 1: ...ELECT name FROM sqlite_master WHERE type='table' AND name=?;
</code>```

Body:
def connectxmlDb(dbparams):
conn_string = "host='{}' dbname='{}' user='{}' password='{}' port='{}'"\
.format(dbparams['HOST'], dbparams['DB'], dbparams['USERNAME'], dbparams['PASSWORD'], dbparams['PORT'])
try:
    conn = psycopg2.connect(conn_string)
    pass
except Exception as err:
    print('Connection to Database Failed : ERR : {}'.format(err))
    return False
print('Connection to Database Success')
return conn

dbconn = connectxmlDb(params['DATABASE'])

The above mentioned is the code I use to connect to postgresql database

sql_statement = """ select a.slno, a.clientid, a.filename, a.user1_id, b.username, a.user2_id, c.username as username2, a.uploaded_ts, a.status_id
                    from masterdb.xmlform_joblist a
                    left outer join masterdb.auth_user b
                    on a.user1_id = b.id
                    left outer join masterdb.auth_user c
                    on a.user2_id = c.id
                    """
cursor.execute(sql_statement)

result = cursor.fetchall()

This is my code to extract data from a postgres table using python.
I want to know if it is possible to view this data using Pandas

This is the code I used:

df = pd.read_sql_query(sql_statement, dbconn)
print(df.head(10))

but it is showing error.

C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-

packages\pandas\io\sql.py:762: UserWarning: pandas only support SQLAlchemy connectable(engine/connection) ordatabase string URI or sqlite3 DBAPI2 connectionother DBAPI2 objects are not tested, please consider using SQLAlchemy
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 2023, in execute
    cur.execute(*args, **kwargs)
psycopg2.errors.SyntaxError: syntax error at or near ";"
LINE 1: ...ELECT name FROM sqlite_master WHERE type='table' AND name=?;
                                                                      ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\Users\Lukmana\Desktop\user_count\usercount.py", line 55, in <module>
    df = pd.read_sql_table(result, dbconn)
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 286, in read_sql_table
    if not pandas_sql.has_table(table_name):
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 2200, in has_table
    return len(self.execute(query, [name]).fetchall()) > 0
  File "C:\Users\Lukmana\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\sql.py", line 2035, in execute
    raise ex from exc
pandas.io.sql.DatabaseError: Execution failed on sql 'SELECT name FROM sqlite_master WHERE type='table' AND name=?;': syntax error at or near ";"
LINE 1: ...ELECT name FROM sqlite_master WHERE type='table' AND name=?;


问:
Heroku New button not working or is there any error prompt
anybody can explain what's issue or steps needs to be done before I create new server/dyno? Last used to reset github connection after the data breach. The new button simply does not work or respond.

enter image description here

Pretty much, all I can access at the moment is my existing apps. Features of existing app is accessible as usual.


问:
AOSP build error of "AID "vendor_qti_diag" must be prefixed with a partition name"
When I try to build AOSP, I have met the erros as the follows:

`Environment variable DIST was set, regenerating...
[  0% 397/86637] build out/target/product/kalama/obj/KERNEL_OBJ/usr
ninja: outputs should be files, not directories: out/target/product/kalama/obj/KERNEL_OBJ/usr
[  0% 462/86637] build out/target/product/kalama/obj/ETC/_fs_config_dirs_system_dlkm_intermediates/_fs_config_dirs_system_dlkm
FAILED: out/target/product/kalama/obj/ETC/_fs_config_dirs_system_dlkm_intermediates/_fs_config_dirs_system_dlkm
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition system_dlkm

--dirs        --out_file out/target/product/kalama/obj/ETC/_fs_config_dirs_system_dlkm_intermediates/_fs_config_dirs_system_dlkm      device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
[  0% 463/86637] build out/target/product/kalama/obj/ETC/_fs_config_dirs_vendor_intermediates/_fs_config_dirs_vendor
FAILED: out/target/product/kalama/obj/ETC/_fs_config_dirs_vendor_intermediates/_fs_config_dirs_vendor
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition vendor      --dirs
--out_file out/target/product/kalama/obj/ETC/_fs_config_dirs_vendor_intermediates/_fs_config_dirs_vendor        device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
[  0% 464/86637] build out/target/product/kalama/obj/ETC/_fs_config_dirs_vendor_dlkm_intermediates/_fs_config_dirs_vendor_dlkm
FAILED: out/target/product/kalama/obj/ETC/_fs_config_dirs_vendor_dlkm_intermediates/_fs_config_dirs_vendor_dlkm
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition vendor_dlkm

--dirs        --out_file out/target/product/kalama/obj/ETC/_fs_config_dirs_vendor_dlkm_intermediates/_fs_config_dirs_vendor_dlkm      device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
[  0% 465/86637] build out/target/product/kalama/obj/ETC/_fs_config_files_odm_intermediates/_fs_config_files_odm
FAILED: out/target/product/kalama/obj/ETC/_fs_config_files_odm_intermediates/_fs_config_files_odm
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition odm     --files
--out_file out/target/product/kalama/obj/ETC/_fs_config_files_odm_intermediates/_fs_config_files_odm        device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
[  0% 466/86637] build out/target/product/kalama/obj/ETC/_fs_config_files_system_dlkm_intermediates/_fs_config_files_system_dlkm
FAILED: out/target/product/kalama/obj/ETC/_fs_config_files_system_dlkm_intermediates/_fs_config_files_system_dlkm
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition system_dlkm

--files       --out_file out/target/product/kalama/obj/ETC/_fs_config_files_system_dlkm_intermediates/_fs_config_files_system_dlkm        device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
[  0% 467/86637] build out/target/product/kalama/obj/ETC/_fs_config_files_vendor_intermediates/_fs_config_files_vendor
FAILED: out/target/product/kalama/obj/ETC/_fs_config_files_vendor_intermediates/_fs_config_files_vendor
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition vendor      --files
--out_file out/target/product/kalama/obj/ETC/_fs_config_files_vendor_intermediates/_fs_config_files_vendor      device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
[  0% 468/86637] build out/target/product/kalama/obj/ETC/otacerts.recovery_intermediates/otacerts.zip
/bin/bash: f: command not found
[  0% 481/86637] build out/target/product/kalama/obj/ETC/_fs_config_dirs_odm_intermediates/_fs_config_dirs_odm
FAILED: out/target/product/kalama/obj/ETC/_fs_config_dirs_odm_intermediates/_fs_config_dirs_odm
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition odm     --dirs
--out_file out/target/product/kalama/obj/ETC/_fs_config_dirs_odm_intermediates/_fs_config_dirs_odm      device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
[  0% 482/86637] build out/target/product/kalama/obj/ETC/_fs_config_files_vendor_dlkm_intermediates/_fs_config_files_vendor_dlkm
FAILED: out/target/product/kalama/obj/ETC/_fs_config_files_vendor_dlkm_intermediates/_fs_config_files_vendor_dlkm
/bin/bash -c "build/make/tools/fs_config/fs_config_generator.py fsconfig       --aid-header system/core/libcutils/include/private/android_filesystem_config.h      --capability-header bionic/libc/kernel/uapi/linux/capability.h      --partition vendor_dlkm

--files       --out_file out/target/product/kalama/obj/ETC/_fs_config_files_vendor_dlkm_intermediates/_fs_config_files_vendor_dlkm        device/qcom/common/config.fs"
AID "vendor_qti_diag" must be prefixed with a partition name
01:15:41 ninja failed with: exit status 1

failed to build some targets (39:22 (mm:ss))

`


问:
The parallel kth smallest algorithm with OpenMP selecting wrong number
I am working on a parallelized algorithm finding the k-th smallest number in an array using OpenMP. Basically, I have a sequential algorithm that is based on quicksort and it works just fine.

```<code>//K'th smallest element in arr[l..r]
int kthSmallest(int arr[], int l, int r, int k)
{

    if (k > 0 && k <= r - l + 1) {
        int pos = partition(arr, l, r);

    if (pos - l == k - 1)
        return arr[pos];
    if (pos - l > k - 1) {
        return kthSmallest(arr, l, pos - 1, k);
        } else {
                return kthSmallest(arr, pos + 1, r, k - pos + l - 1);
                }
    }
    return INT_MAX;
}

void swap(int* a, int* b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
}

int partition(int arr[], int l, int r)
{
    int x = arr[r], i = l;
    for (int j = l; j <= r - 1; j++) {
    if (arr[j] <= x) {
        swap(&arr[i], &arr[j]);
    i++;
    }
    }

    swap(&arr[i], &arr[r]);
    return i;
}
</code>```

I am new to OpenMP. At first, I tried to parallelize the area of the function call itself in driver, unfortunately, it didn't work. The number drawn was correct, but it wasn't faster than sequential.

```<code>int main()
{
    omp_set_num_threads(8);
    double start_time, run_time;
    int *data = (int *)malloc(N * sizeof(int));
    clock_t start, end;

    printf("Creating the array.......\n");
    randomArray(data, N);
    printf("Created the array........\n");

    //start = clock();
    start_time = omp_get_wtime();
    #pragma omp parallel
    {

        #pragma omp single nowait

        printf("\nKth [%d] value is %d\n", K,
            kthSmallest(data, 0, N - 1, K));
    }
    //end = clock();
    run_time = omp_get_wtime() - start_time;
</code>```

When trying to parallelize the partition function itself, the timing improves, but the selected number is different each time.

```<code>int partition(int arr[], int l, int r)
{
    int j;
    int x = arr[r], i = l;
    #pragma omp parallel for shared(arr, l, r) private(j) schedule(static)
    for ( j = l; j <= r - 1; j++) {
        if (arr[j] <= x) {
        swap(&arr[i], &arr[j]);
        i++;
    }
    }

    swap(&arr[i], &arr[r]);
    return i;
}
</code>```

What's wrong with my idea, how could I parallelize this algorithm correctly?

Body:
I am working on a parallelized algorithm finding the k-th smallest number in an array using OpenMP. Basically, I have a sequential algorithm that is based on quicksort and it works just fine.

//K'th smallest element in arr[l..r]
int kthSmallest(int arr[], int l, int r, int k)
{

    if (k > 0 && k <= r - l + 1) {
        int pos = partition(arr, l, r);

    if (pos - l == k - 1)
        return arr[pos];
    if (pos - l > k - 1) {
        return kthSmallest(arr, l, pos - 1, k);
        } else {
                return kthSmallest(arr, pos + 1, r, k - pos + l - 1);
                }
    }
    return INT_MAX;
}

void swap(int* a, int* b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
}

int partition(int arr[], int l, int r)
{
    int x = arr[r], i = l;
    for (int j = l; j <= r - 1; j++) {
    if (arr[j] <= x) {
        swap(&arr[i], &arr[j]);
    i++;
    }
    }

    swap(&arr[i], &arr[r]);
    return i;
}

I am new to OpenMP. At first, I tried to parallelize the area of the function call itself in driver, unfortunately, it didn't work. The number drawn was correct, but it wasn't faster than sequential.

int main()
{
    omp_set_num_threads(8);
    double start_time, run_time;
    int *data = (int *)malloc(N * sizeof(int));
    clock_t start, end;

    printf("Creating the array.......\n");
    randomArray(data, N);
    printf("Created the array........\n");

    //start = clock();
    start_time = omp_get_wtime();
    #pragma omp parallel
    {

        #pragma omp single nowait

        printf("\nKth [%d] value is %d\n", K,
            kthSmallest(data, 0, N - 1, K));
    }
    //end = clock();
    run_time = omp_get_wtime() - start_time;

When trying to parallelize the partition function itself, the timing improves, but the selected number is different each time.

int partition(int arr[], int l, int r)
{
    int j;
    int x = arr[r], i = l;
    #pragma omp parallel for shared(arr, l, r) private(j) schedule(static)
    for ( j = l; j <= r - 1; j++) {
        if (arr[j] <= x) {
        swap(&arr[i], &arr[j]);
        i++;
    }
    }

    swap(&arr[i], &arr[r]);
    return i;
}

What's wrong with my idea, how could I parallelize this algorithm correctly?


问:
Display an option set for a field based on selection of previous field
I have a option set column called "Business Unit" in Micrsoft Dynamics CRM and the options are

```<code>"Edge"
"Core"
"Cloud"
</code>```

Then I have another option set column called "Business category" and the options are

```<code>"Hardware"
"Software"
"Services"
</code>```

If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"

For eg:-

If I select "Edge", then only "Hardware" should pop up

If I select "Core" then "Hardware" and "Software" should pop up

If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up

We are trying with JScript in CRM, but it is showing some error. Can anyone help me out how to write a script to achieve this process. I have to do this on priority.

If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"

For eg:-

If I select "Edge", then only "Hardware" should pop up

If I select "Core" then "Hardware" and "Software" should pop up

If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up

I tried writing using array but its showing error.

My code: -

```<code>var B_line_arr = window.B_line_arr || {};

(function() {

   this.formOnLoad = function (executionContext){

   var formContext = executionContext.getFormContext();

var businessarea = formContext.getAttribute("new_buniessarea21").getText();

var businessline = formContext.getAttribute("new_buniessline21")

if(businessarea=="Edge")

{

  var arr = [{value: 100000000, text: 'Hardware'},

  {value: 100000001, text: 'Software'},

  {value: 100000002, text: 'Services'}];

      for(var i=0;i<=arr.length;i++)

  {

  businessline.clearOptions();

  businessline.addOption({value: arr[0].value, text: arr[0].text});
  }
}
}
}).call(B_line_arr)
```
```

Body:
I have a option set column called "Business Unit" in Micrsoft Dynamics CRM and the options are

"Edge"
"Core"
"Cloud"

Then I have another option set column called "Business category" and the options are

"Hardware"
"Software"
"Services"

If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"

For eg:-

If I select "Edge", then only "Hardware" should pop up

If I select "Core" then "Hardware" and "Software" should pop up

If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up

We are trying with JScript in CRM, but it is showing some error. Can anyone help me out how to write a script to achieve this process. I have to do this on priority.

If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"

For eg:-

If I select "Edge", then only "Hardware" should pop up

If I select "Core" then "Hardware" and "Software" should pop up

If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up

I tried writing using array but its showing error.

My code: -

var B_line_arr = window.B_line_arr || {};

(function() {

   this.formOnLoad = function (executionContext){

   var formContext = executionContext.getFormContext();

var businessarea = formContext.getAttribute("new_buniessarea21").getText();

var businessline = formContext.getAttribute("new_buniessline21")

if(businessarea=="Edge")

{

  var arr = [{value: 100000000, text: 'Hardware'},

  {value: 100000001, text: 'Software'},

  {value: 100000002, text: 'Services'}];

      for(var i=0;i<=arr.length;i++)

  {

  businessline.clearOptions();

  businessline.addOption({value: arr[0].value, text: arr[0].text});
  }
}
}
}).call(B_line_arr)
```


问:
vb.net run exe but not create output
I Use code in vb.net to run EXE file (EXE From node.js) it open normally but not create output I use this code

```<code>System.Diagnostics.Process.Start("D:\app5-win.exe")
</code>```

but when I run the exe file without vb.net it created output normally
so i'don't know what wrong

Title: vb.net run exe but not create output

Body:
I Use code in vb.net to run EXE file (EXE From node.js) it open normally but not create output I use this code

System.Diagnostics.Process.Start("D:\app5-win.exe")

but when I run the exe file without vb.net it created output normally
so i'don't know what wrong


问:
how to run my main extension function on all tabs when I click a button?
I have a function to parse some tags in websites by using Chrome extension. Now it works only on the current tab. I want to parse DOM(outerHTML) of all other tabs in current Chrome window. I want to apply my function to other tabs simultaneusly when I click button in my extension popup. How can I run it? And how can I get DOM (document.outerHTML) of other tabs by tabId?

I have tried chrome.scripting.executeScript(tabId, {...}) but I could not get it. I would appreciate any help.

EDIT

How can I execute certain function in my content.js file in background.js if I need to iterate through all tabs and execute file content.js? In chrome.scripting.executeScript(tabId, file: [content.js]) it is running the whole file, but I need to run certain function in content.js?


问:
Antd Select causing scroll in antd Drawer on iphone
I have been using Antd Select for sidebar (Antd Drawer), but it will cause page scroll effect on iPhone when clicking on Select component, I've tried with android also, it's working fine

scroll height image

I wonder whether it's about height 100vh,
I tried not setting height but it still causes the scroll effect.

version

{
  "antd": "^4.2.5",
  "react": "^16.13.1",
  "react-dom": "^16.13.1",
}
```
<p>I've tried putting the Select in to parent container ant setting prop</p>
<p><code>getPopupContainer = {triggerNode => triggerNode.parentElement}</code></p>
<p>or</p>
<p><code>getPopupContainer = {() => document.getElementById('id')}</code></p>
<p>But it seems not working</p>
<p>Here is my code that I tried to reproduce this problem</p>
<pre class="lang-js prettyprint-override"><code>
const DrawerPage = () => {
  const [open, setOpen] = useState(false);

  const showDrawer = () => {
    setOpen(true);
  };

  const onClose = () => {
    setOpen(false);
  };

  return (
    <div style={{ overflow: "hidden", height: "100vh" }}>
      <Button type="primary" onClick={showDrawer} style={{ position: "fixed" }}>
        Open
      </Button>
      {new Array(200).fill().map((_, i) => (
        <div key={i}>Content</div>
      ))}
      <Drawer
        placement="left"
        closable={false}
        onClose={onClose}
        open={open}
        width="70%"
      >
        <div>
          <Select
            placeholder="test"
            dropdownMatchSelectWidth={false}
            bordered={false}
            listItemHeight={32}
            listHeight={96}
            autoFocus={false}
            virtual={false}
            dropdownAlign={[0, 0]}
            getPopupContainer={(trigger) => trigger.parentNode}
          >
            <Option value="1">1</Option>
            <Option value="2">2</Option>
            <Option value="3">3</Option>
          </Select>
        </div>
        {new Array(20).fill().map((_, i) => (
          <div key={i}>Content</div>
        ))}
        <div>
          <Select
            placeholder="test"
            dropdownMatchSelectWidth={false}
            bordered={false}
            listItemHeight={32}
            listHeight={96}
            autoFocus={false}
            virtual={false}
            dropdownAlign={[0, 0]}
            getPopupContainer={(trigger) => trigger.parentNode}
          >
            <Option value="1">1</Option>
            <Option value="2">2</Option>
            <Option value="3">3</Option>
          </Select>
        </div>
      </Drawer>
    </div>
  );
};

</code>```

Body:
I have been using Antd Select for sidebar (Antd Drawer), but it will cause page scroll effect on iPhone when clicking on Select component, I've tried with android also, it's working fine

scroll height image

I wonder whether it's about height 100vh,
I tried not setting height but it still causes the scroll effect.

version

{
  "antd": "^4.2.5",
  "react": "^16.13.1",
  "react-dom": "^16.13.1",
}

I've tried putting the Select in to parent container ant setting prop

getPopupContainer = {triggerNode => triggerNode.parentElement}

or

getPopupContainer = {() => document.getElementById('id')}

But it seems not working

Here is my code that I tried to reproduce this problem

const DrawerPage = () => {
  const [open, setOpen] = useState(false);

  const showDrawer = () => {
    setOpen(true);
  };

  const onClose = () => {
    setOpen(false);
  };

  return (

      <Button type="primary" onClick={showDrawer} style={{ position: "fixed" }}>
        Open
      </Button>
      {new Array(200).fill().map((_, i) => (

Content

      ))}
      <Drawer
        placement="left"
        closable={false}
        onClose={onClose}
        open={open}
        width="70%"
      >

          <Select
            placeholder="test"
            dropdownMatchSelectWidth={false}
            bordered={false}
            listItemHeight={32}
            listHeight={96}
            autoFocus={false}
            virtual={false}
            dropdownAlign={[0, 0]}
            getPopupContainer={(trigger) => trigger.parentNode}
          >
            <Option value="1">1</Option>
            <Option value="2">2</Option>
            <Option value="3">3</Option>
          </Select>

        {new Array(20).fill().map((_, i) => (

Content

        ))}

          <Select
            placeholder="test"
            dropdownMatchSelectWidth={false}
            bordered={false}
            listItemHeight={32}
            listHeight={96}
            autoFocus={false}
            virtual={false}
            dropdownAlign={[0, 0]}
            getPopupContainer={(trigger) => trigger.parentNode}
          >
            <Option value="1">1</Option>
            <Option value="2">2</Option>
            <Option value="3">3</Option>
          </Select>

      </Drawer>

  );
};


问:
how to save a dataframe in a parquet file with a given row or size limit?
I have a large 20GB dataset stored in RAM as a Pandas dataframe and I need to save it as parquet.

I know I can use pyarrow and the pandas pd.to_parquet() methods but I need to split my large 20GB file into many parquet files (for later ingestion by Athena on a s3 bucket)

My constraint is that I need to limit the number of rows written in each parquet file as well as the maximum size of the individual parquet files.

How to implement both constraints with pd.to_parquet()?

Thanks!


问:
How to set a control id for the field in python?
it's my first post so you can tell me how to improve my posts.

Today I have problem with Python and winspy, I have code an interface python with the library Tkinter, I wish to have the control id of field with app winspy but the control id is 0
how to set an control id with python or others

```<code>import tkinter as tk

# create window
window = tk.Tk()

# set window size and title

window.geometry("400x400")
window.title("Project Champ")

# create function to show username and password
def show_username_password():
    username = username_entry.get()
    password = password_entry.get()
    new_label = tk.Label(window, text="Username: " + username + " Password: " + password)
    new_label.pack()

# Create label and entry for username
username_label = tk.Label(window, text="Username")
username_label.pack()

username_entry = tk.Entry(window)
username_entry.pack()

# Create label and entry for password
password_label = tk.Label(window, text="Password")
password_label.pack()

password_entry = tk.Entry(window, show="*")
password_entry.pack()

# Create button to validate username and password
validate_button = tk.Button(window, text="Valider", command=show_username_password)
validate_button.pack()

# Launch window
window.mainloop()
</code>```

I have try in the code with different method like stringVar() and validate and validatecommand in my entry.

Body:
it's my first post so you can tell me how to improve my posts.

Today I have problem with Python and winspy, I have code an interface python with the library Tkinter, I wish to have the control id of field with app winspy but the control id is 0
how to set an control id with python or others

import tkinter as tk

# create window
window = tk.Tk()

# set window size and title

window.geometry("400x400")
window.title("Project Champ")

# create function to show username and password
def show_username_password():
    username = username_entry.get()
    password = password_entry.get()
    new_label = tk.Label(window, text="Username: " + username + " Password: " + password)
    new_label.pack()

# Create label and entry for username
username_label = tk.Label(window, text="Username")
username_label.pack()

username_entry = tk.Entry(window)
username_entry.pack()

# Create label and entry for password
password_label = tk.Label(window, text="Password")
password_label.pack()

password_entry = tk.Entry(window, show="*")
password_entry.pack()

# Create button to validate username and password
validate_button = tk.Button(window, text="Valider", command=show_username_password)
validate_button.pack()

# Launch window
window.mainloop()

I have try in the code with different method like stringVar() and validate and validatecommand in my entry.


问:
Can I add local authentication to my html/php login page on flutter webview
I have created a website with html/php script and hosted it on a live server after then I converted the site into mobile application using flutter webview, the application works  perfectly on mobile device.
In the website there's a login and signup page which I have created in html, now I want to add local authentication so that user can use his fingerprint to login instead of typing the password

I have tried looking for a way to embed the html login page to flutter dart file to see if it could work


问:
Laravel Mail not working in reportable callback
I have tested sending mail  isolatedly  Mail::to('some@gmail.com')->send(new ExceptionMail()); its working. Its laravel veriosn 9

But in case if i want to send an mail when any exception occurs its not working.

```<code>namespace App\Exceptions;

use App\Mail\Exception\ExceptionMail;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];

    /**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {

        $this->reportable(function (Throwable $e) {
            Mail::to('some@gmail.com')->send(new ExceptionMail());
        });
    }
}
</code>```

Body:
I have tested sending mail  isolatedly  Mail::to('some@gmail.com')->send(new ExceptionMail()); its working. Its laravel veriosn 9

But in case if i want to send an mail when any exception occurs its not working.

namespace App\Exceptions;

use App\Mail\Exception\ExceptionMail;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'current_password',
        'password',
        'password_confirmation',
    ];

    /**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {

        $this->reportable(function (Throwable $e) {
            Mail::to('some@gmail.com')->send(new ExceptionMail());
        });
    }
}


问:
Tier Progression manner in Kaggle
Kaggle has five tiers, from Novice to Grandmaster.
As you know, the tiers increase according to the color and number of medals obtained.
I have two questions about the Tier.

Medals and tiers for Code in competitions
Competitions have a Knowledge one, not a prize one, and the notes on them say the following.
"Tiers This competition does not count toward tiers".
Does this mean that in competitions annotated in this way, no matter how many Up votes a submitted code receives and how many medals it wins, the Tier does not increase?

Medals and Tiers for Code in Datasets
In Datasets, there is no note about Tiers as mentioned above. Up votes does not affect to a Tier as well?

I have been following the medal history of some expats, and it seems to me that the tier increases even with Q1 and Q2 above, so I am not sure about the rules.
Thank you in advance for your help.

Title: Tier Progression manner in Kaggle


问:
ACCESS SQL IIf Statement doesn't include SUM
I've an IIf-Statement as a new Column Vergleich, which should compare the column Summe_Teile_SAB and Import_Einzelstueckliste.Bedarfsmenge. But I can't include the column Summe_Teile_SAB in the IIf statement as this column is a SUM() within the SELECT SUM(SAB_Teile.Anzahl) AS Summe_Teile_SAB.
Therefore it doesn't compare the numbers of the Teilenummer from Import_Einzelstueckliste.Bedarfsmenge with the sum of the same Teilenummer from SAB_Teile.Anzahl.

Erstentnahme
Teilenummer
Summe_Teile_SAB
Bedarfsmenge
Vergleich

E
1308713
1
1

E
1308715
2
2

E
1309059
4
4
Differenz

E
1309061
1
1

```<code>INSERT INTO Import_Einzelstueckliste ( Teilenummer, Teilenummer, Teilenummer, Teilenummer, Teilenummer, Teilenummer )
SELECT SAB_Teile.Erstentnahme, SAB_Teile.Teilenummer, SAB_Teile.Bezeichnung, SUM(SAB_Teile.Anzahl) AS Summe_Teile_SAB, Import_Einzelstueckliste.Bedarfsmenge, IIf([SAB_Teile.Anzahl]=[Import_Einzelstueckliste.Bedarfsmenge],"","Differenz") AS Vergleich
FROM Import_Einzelstueckliste INNER JOIN SAB_Teile ON Import_Einzelstueckliste.Teilenummer = SAB_Teile.Teilenummer
GROUP BY SAB_Teile.Erstentnahme, SAB_Teile.Teilenummer, SAB_Teile.Bezeichnung, Import_Einzelstueckliste.Bedarfsmenge,  IIf([SAB_Teile.Anzahl]=[Import_Einzelstueckliste.Bedarfsmenge],"","Differenz")
HAVING (((SAB_Teile.Erstentnahme) Like "E") AND ((SAB_Teile.Teilenummer)<>""))
ORDER BY SAB_Teile.Teilenummer;
</code>```

I expected by changing the first condition of the IIf statement SAB_Teile.Anzahl to SAB_Teile.Summe_Teile_SAB it would work, but it didn't .

Body:
I've an IIf-Statement as a new Column Vergleich, which should compare the column Summe_Teile_SAB and Import_Einzelstueckliste.Bedarfsmenge. But I can't include the column Summe_Teile_SAB in the IIf statement as this column is a SUM() within the SELECT SUM(SAB_Teile.Anzahl) AS Summe_Teile_SAB.
Therefore it doesn't compare the numbers of the Teilenummer from Import_Einzelstueckliste.Bedarfsmenge with the sum of the same Teilenummer from SAB_Teile.Anzahl.

Erstentnahme
Teilenummer
Summe_Teile_SAB
Bedarfsmenge
Vergleich

E
1308713
1
1

E
1308715
2
2

E
1309059
4
4
Differenz

E
1309061
1
1

INSERT INTO Import_Einzelstueckliste ( Teilenummer, Teilenummer, Teilenummer, Teilenummer, Teilenummer, Teilenummer )
SELECT SAB_Teile.Erstentnahme, SAB_Teile.Teilenummer, SAB_Teile.Bezeichnung, SUM(SAB_Teile.Anzahl) AS Summe_Teile_SAB, Import_Einzelstueckliste.Bedarfsmenge, IIf([SAB_Teile.Anzahl]=[Import_Einzelstueckliste.Bedarfsmenge],"","Differenz") AS Vergleich
FROM Import_Einzelstueckliste INNER JOIN SAB_Teile ON Import_Einzelstueckliste.Teilenummer = SAB_Teile.Teilenummer
GROUP BY SAB_Teile.Erstentnahme, SAB_Teile.Teilenummer, SAB_Teile.Bezeichnung, Import_Einzelstueckliste.Bedarfsmenge,  IIf([SAB_Teile.Anzahl]=[Import_Einzelstueckliste.Bedarfsmenge],"","Differenz")
HAVING (((SAB_Teile.Erstentnahme) Like "E") AND ((SAB_Teile.Teilenummer)<>""))
ORDER BY SAB_Teile.Teilenummer;

I expected by changing the first condition of the IIf statement SAB_Teile.Anzahl to SAB_Teile.Summe_Teile_SAB it would work, but it didn't .


问:
How to write AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to configuration in package.json?
I have that:

```<code> "publish": [
{
  "provider": "s3",
  // This is where I need to write tokens and other data?
}
</code>```

]

and I have that:

```<code>autoUpdater.setFeedURL({
  provider: 's3',
   // This is where I need to write tokens and other data?
});
</code>```

Help pls!

Body:
I have that:

 "publish": [
{
  "provider": "s3",
  // This is where I need to write tokens and other data?
}

]

and I have that:

autoUpdater.setFeedURL({
  provider: 's3',
   // This is where I need to write tokens and other data?
});

Help pls!


问:
I have a Timeline with a function for my slide, but it is still Frame-Dependent
I try to make a slide using a timeline but it always results in something frame-dependent. If I slide with 60 frames/s, I go way less far than with 300FPS. Here is my timeline and blueprint, please help :/

Timeline + Function

Inside the timeline. There is a function so it should be time-dependent.

Inside the function. I already try to disconnect almost everything, except the “Set Velocity”; it is still frame-dependent.

I tried to disconnect EVERYTHING except the Set Velocity, with a fix value [1000, 0, 0] and even like this, it applies my velocity in relation with framerate. So I don't think that calculations made in the function are the problem.


问:
Powershell 5.1 cannot use [System.Web.HttpUtility] inside class method
When using powershell 5.1.19041.1682, I cannot use [System.Web.HttpUtility] inside a class method:

```<code>Add-Type -AssemblyName System.Web

# This works fine
[System.Web.HttpUtility]::UrlEncode("foo")

class Test {
  [void] Doit() {
    # This creates the error below
    [System.Web.HttpUtility]::UrlEncode("bar")
  }
}

$d = [Test]::new()
$d.Doit()
</code>```

Here is the output:

```<code>At C:\doit.ps1:7 char:6
+     [System.Web.HttpUtility]::UrlEncode("bar")
+      ~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Web.HttpUtility].
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TypeNotFound
</code>```

On the latest powershell (7.3) this problem does not happen.

If I comment the call inside Doit() it correctly prints "foo".

Can someone explain what is going on with 5.1? Is there a way around it?

Body:
When using powershell 5.1.19041.1682, I cannot use [System.Web.HttpUtility] inside a class method:

Add-Type -AssemblyName System.Web

# This works fine
[System.Web.HttpUtility]::UrlEncode("foo")

class Test {
  [void] Doit() {
    # This creates the error below
    [System.Web.HttpUtility]::UrlEncode("bar")
  }
}

$d = [Test]::new()
$d.Doit()

Here is the output:

At C:\doit.ps1:7 char:6
+     [System.Web.HttpUtility]::UrlEncode("bar")
+      ~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Web.HttpUtility].
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TypeNotFound

On the latest powershell (7.3) this problem does not happen.

If I comment the call inside Doit() it correctly prints "foo".

Can someone explain what is going on with 5.1? Is there a way around it?


问:
HTML Image Request Isn't getting any data
I've set up an API where you can upload images. In the event the image is a HEIC

```<code>        heif = pillow_heif.read_heif(file)
        temp = Image.frombytes(
            heif.mode,
            heif.size,
            heif.data,
            "raw")
        jpeg_file = SpooledTemporaryFile()
        temp.save(jpeg_file, format='JPEG')
        image = Image.open(jpeg_file)
</code>```

The images are uploaded to an S3 bucket. Late on an API generates a presigned url for the image and provides it to an HTTP client.

For some reason, whenever it's a HEIF/HEIC image that was uploaded, the client doesn't download any information from the url. If I manually enter the URL in the browser, it downloads correctly and I can open it fine.

I've checked the image.format/format_description/mode of the images, and after the HEIC transformation the HEIC and non-HEIC images have the same values, so I don't think it's there. When looking at the requests the client makes both have the same headers. HOWEVER- Under the network->preview tab in the inspector, I noticed that the non-heic images at the bottom say "size kB | width x height | aspect ratio | binary/octet-stream". The HEIC requests however just say "0 kB ||| binary/octet-stream". It's getting a 200 response though which is adding to my confusion.

Additionally, if I try to download the file directly from the URL and then reupload the generated jpg it still refuses to work, which makes me believe something about my file transformation is going wrong- but I can't see what.

Is there something that I'm missing that is causing the HEIC files to behave differently after my transformation? I'm somewhat overwhelmed trying to figure out if this has to do with the client request to U3 url, if it's how I'm transforming them, if it's something else I'm missing, or what is going on here.

Any advice would be appriciated.

Body:
I've set up an API where you can upload images. In the event the image is a HEIC

        heif = pillow_heif.read_heif(file)
        temp = Image.frombytes(
            heif.mode,
            heif.size,
            heif.data,
            "raw")
        jpeg_file = SpooledTemporaryFile()
        temp.save(jpeg_file, format='JPEG')
        image = Image.open(jpeg_file)

The images are uploaded to an S3 bucket. Late on an API generates a presigned url for the image and provides it to an HTTP client.

For some reason, whenever it's a HEIF/HEIC image that was uploaded, the client doesn't download any information from the url. If I manually enter the URL in the browser, it downloads correctly and I can open it fine.

I've checked the image.format/format_description/mode of the images, and after the HEIC transformation the HEIC and non-HEIC images have the same values, so I don't think it's there. When looking at the requests the client makes both have the same headers. HOWEVER- Under the network->preview tab in the inspector, I noticed that the non-heic images at the bottom say "size kB | width x height | aspect ratio | binary/octet-stream". The HEIC requests however just say "0 kB ||| binary/octet-stream". It's getting a 200 response though which is adding to my confusion.

Additionally, if I try to download the file directly from the URL and then reupload the generated jpg it still refuses to work, which makes me believe something about my file transformation is going wrong- but I can't see what.

Is there something that I'm missing that is causing the HEIC files to behave differently after my transformation? I'm somewhat overwhelmed trying to figure out if this has to do with the client request to U3 url, if it's how I'm transforming them, if it's something else I'm missing, or what is going on here.

Any advice would be appriciated.


问:
Why getline function in my C++ program is not working as expected
My c++ program is mentioned below.

```<code>int choice;
while(choice!=2){
    cin>>choice;
}
string name;
string pass;
cout<<"Username: ";
getline(cin, name);
cout<<"Password: ";
getline(cin, pass);
</code>```

I want my program to work like until I enter 2, it keeps on asking me input number. And when I enter 2 it prompts me for username and password. Starting program is working fine but the problem is that I have used getline function to take string input but it is asking separate input for username and password. It is only asking input in one line like USERNAME: PASWORD:
OUTPUT:

Body:
My c++ program is mentioned below.

int choice;
while(choice!=2){
    cin>>choice;
}
string name;
string pass;
cout<<"Username: ";
getline(cin, name);
cout<<"Password: ";
getline(cin, pass);

I want my program to work like until I enter 2, it keeps on asking me input number. And when I enter 2 it prompts me for username and password. Starting program is working fine but the problem is that I have used getline function to take string input but it is asking separate input for username and password. It is only asking input in one line like USERNAME: PASWORD:
OUTPUT:


问:
Does a lots of update in an ElasticSearch index can cause issues?
I'm concerned about doing a lot of update in an ES INDEX.
I have the following index :

15M (millions) of documents

3GB

3 shards

heap size of 6GB

1 master and 2 replicas

This index contains ~300k products.
A snapshot of a product is :

```<code>"_source": { -
      "row_id": "123456",
      "entity_id": "123456",
      "attribute_set_id": "1000",
      "type_id": "simple",
      "sku": "10000",
      "created_at": "2022-10-27 15:59:34",
      "updated_at": "2022-12-12 18:28:38",
      "visibility": "4",
      "etc..."
      "store_prices": [ -
        { -
          "store_prices_id": 10000,
          "product_id": 123456,
          "store": 1,
          "type": "PRO"
          "visibility": 1,
          "label": "In Stock",
          "price": "12.0000",
          "special_price": "10.0000"
          etc... about 20 mores informations
        },
        { -
          "store_prices_id": 10001,
          "product_id": 123456,
          "store": 1,
          "type": "NOT_PRO"
          "visibility": 1,
          "label": "In stock",
          "price": "11.0000",
          "special_price": "9.0000"
          etc... about 20 mores informations
        },
        etc... I have 40 stores meaning 40 times the previous couple of "PRO" / "NOT_PRO"
}
</code>```

As said previously there is ~300k product and 40 stores (we could consider 80 with "PRO" / "NOT PRO") per product.
Then we receive a lot of "store_prices" update.
Right now, we re-create our index from time to time to have updated prices.
But we would like fresher prices displayed.

One update equals to one "store_prices" that has a change (the price, special_price or one of the 20 other informations has a change).
However, I think I can't really distinguish what is the real modification so the update would be an entire "stores_prices_id" and not only the data that has really changed in this peculiar "stores_prices_id".

Let's say that at 1:00 pm we receive 1M (million) of "store_prices" in a queue.
It is wise (or even possible) to smash this index over and over to update the "store_prices" and decrease this queue until it's done (the faster the better) ?

If is possible to update a nested field like that using the "store_prices_id" as a match ?

If we do no bulk update, it means that we have made 1 millions of update.
If we use bulk update, I think it means that we have made 1 millions of update but bulked by a batch_size of X.
Lastly, there would be 20 processes unstacking the queue, meaning we could potentially have at the same time an update on the same product.

Could it make the index crash or things like that ?
Also, the index is obviously used during the course of the day, could it create lags / deadlocks ?

FYI, I did some tests to update a field that is not nested and is a float, it takes 1800 seconds (30 minutes) for 130k products meaning 14ms per product with bulked update of 1000. This test was done by a single process.

Thank you in advance :) !

Body:
I'm concerned about doing a lot of update in an ES INDEX.
I have the following index :

15M (millions) of documents

3GB

3 shards

heap size of 6GB

1 master and 2 replicas

This index contains ~300k products.
A snapshot of a product is :

"_source": { -
      "row_id": "123456",
      "entity_id": "123456",
      "attribute_set_id": "1000",
      "type_id": "simple",
      "sku": "10000",
      "created_at": "2022-10-27 15:59:34",
      "updated_at": "2022-12-12 18:28:38",
      "visibility": "4",
      "etc..."
      "store_prices": [ -
        { -
          "store_prices_id": 10000,
          "product_id": 123456,
          "store": 1,
          "type": "PRO"
          "visibility": 1,
          "label": "In Stock",
          "price": "12.0000",
          "special_price": "10.0000"
          etc... about 20 mores informations
        },
        { -
          "store_prices_id": 10001,
          "product_id": 123456,
          "store": 1,
          "type": "NOT_PRO"
          "visibility": 1,
          "label": "In stock",
          "price": "11.0000",
          "special_price": "9.0000"
          etc... about 20 mores informations
        },
        etc... I have 40 stores meaning 40 times the previous couple of "PRO" / "NOT_PRO"
}

As said previously there is ~300k product and 40 stores (we could consider 80 with "PRO" / "NOT PRO") per product.
Then we receive a lot of "store_prices" update.
Right now, we re-create our index from time to time to have updated prices.
But we would like fresher prices displayed.

One update equals to one "store_prices" that has a change (the price, special_price or one of the 20 other informations has a change).
However, I think I can't really distinguish what is the real modification so the update would be an entire "stores_prices_id" and not only the data that has really changed in this peculiar "stores_prices_id".

Let's say that at 1:00 pm we receive 1M (million) of "store_prices" in a queue.
It is wise (or even possible) to smash this index over and over to update the "store_prices" and decrease this queue until it's done (the faster the better) ?

If is possible to update a nested field like that using the "store_prices_id" as a match ?

If we do no bulk update, it means that we have made 1 millions of update.
If we use bulk update, I think it means that we have made 1 millions of update but bulked by a batch_size of X.
Lastly, there would be 20 processes unstacking the queue, meaning we could potentially have at the same time an update on the same product.

Could it make the index crash or things like that ?
Also, the index is obviously used during the course of the day, could it create lags / deadlocks ?

FYI, I did some tests to update a field that is not nested and is a float, it takes 1800 seconds (30 minutes) for 130k products meaning 14ms per product with bulked update of 1000. This test was done by a single process.

Thank you in advance :) !


问:
How to translate PARTITION BY with a FIRST_VALUE() in linq?
It should resolve with a group by, in all rows of the result must load the first value, that will repeat in each group

I tried with a group by


问:
How to prevent entire list from reloading, when lazy loading new items?
Assalamualaikum!

Note: This is not related to a bug, but is related to the logic of lazy loading and optimum rebuilding of the ListView.

I have a scenario, where a big list of around 300 items is being loaded and displayed using a ListView.separated. In the beginning, I was rebuilding the ListView with 300 items, all at once, and it resulted in jank, so I had to implement lazy loading.

I'm using get for state management.

Code Structure

Widget

I have wrappedListView.separated inside of a GetBuilder. The list being displayed in the ListView is named displayList.

```<code>GetBuilder<CustomController>(
                         id: GetBuilderIds.updateInternalTransfersList,
                         builder: (customController) {
                            return CustomListViewSeparated(
                                itemSeparator:
                                    AppPlaceHolders.sizeFieldLargePlaceHolder,
                                itemCount: customController
                                        .displayList.length +
                                    (customController.hasMore
                                        ? 1
                                        : 0),
                                itemBuilder: (buildContext, index) {
                                  log(" List Index $index");
                                  if (customController.hasMore) {
                                    if (customController
                                            .displayList.length ==
                                        index) {
                                      return const Align(
                                        child: OrderCard(
                                            isLoading: true),
                                      );
                                    }
                                  }
                                  return OrderCard(
                                    value: customController.displayList[index],
                                  );
                                });})
</code>```

Lazy Loading Logic

```<code>  incrementDisplayList() {
      List<InternalTransfer> sourceList = [];

      final difference = sourceList.length - displayList.length;

      if (displayList.length == sourceList.length) {
         hasMore = false;
      } else {
         displayList.addAll(
         sourceList.lazyLoadedDisplayList(displayList.length, difference));
         hasMore = true;
      }

      update([GetBuilderIds.updateList]);  }
</code>```

Flow

A list of 300 items is loaded into a list variable named allList and only the first 40 of those 300 are assigned to displayList.

The ListView.separated is rebuilt by calling update([GetBuilderId]).

When the user scrolls to the bottom of the list, I add the next 20 items from allList to displayList and update GetBuilder using id.

Problem

In 3rd step, the entire ListView is rebuilt. I understand that this is the expected behavior, but I'm wondering if there's a way to not rebuild the entire ListView.

Body:
Assalamualaikum!

Note: This is not related to a bug, but is related to the logic of lazy loading and optimum rebuilding of the ListView.

I have a scenario, where a big list of around 300 items is being loaded and displayed using a ListView.separated. In the beginning, I was rebuilding the ListView with 300 items, all at once, and it resulted in jank, so I had to implement lazy loading.

I'm using get for state management.

Code Structure

Widget

I have wrappedListView.separated inside of a GetBuilder. The list being displayed in the ListView is named displayList.

GetBuilder<CustomController>(
                         id: GetBuilderIds.updateInternalTransfersList,
                         builder: (customController) {
                            return CustomListViewSeparated(
                                itemSeparator:
                                    AppPlaceHolders.sizeFieldLargePlaceHolder,
                                itemCount: customController
                                        .displayList.length +
                                    (customController.hasMore
                                        ? 1
                                        : 0),
                                itemBuilder: (buildContext, index) {
                                  log(" List Index $index");
                                  if (customController.hasMore) {
                                    if (customController
                                            .displayList.length ==
                                        index) {
                                      return const Align(
                                        child: OrderCard(
                                            isLoading: true),
                                      );
                                    }
                                  }
                                  return OrderCard(
                                    value: customController.displayList[index],
                                  );
                                });})

Lazy Loading Logic

  incrementDisplayList() {
      List<InternalTransfer> sourceList = [];

      final difference = sourceList.length - displayList.length;

      if (displayList.length == sourceList.length) {
         hasMore = false;
      } else {
         displayList.addAll(
         sourceList.lazyLoadedDisplayList(displayList.length, difference));
         hasMore = true;
      }

      update([GetBuilderIds.updateList]);  }

Flow

A list of 300 items is loaded into a list variable named allList and only the first 40 of those 300 are assigned to displayList.

The ListView.separated is rebuilt by calling update([GetBuilderId]).

When the user scrolls to the bottom of the list, I add the next 20 items from allList to displayList and update GetBuilder using id.

Problem

In 3rd step, the entire ListView is rebuilt. I understand that this is the expected behavior, but I'm wondering if there's a way to not rebuild the entire ListView.


问:
WCFM issue in send mail in second language
our website has English & Arabic interface ,we use WCFM and WPML plugins our , website default languge Englih
our issue as following
when customer use arabic interface and create new order WCFM send Store new order email to vendor this email
language is English
this is happened for all mails send from WCFM
kindly we need to fix it ,thanks

change vendor lang to arabic but same issue
chnage custmer lang to arabic but same issue
change wpml default lang to arabic it sent correct arabic emails but when create order in english it sent emails in arabic too


问:
How to make html widgets display properly on 3d globe
using threejs here is a screenshot

as you see here the news widget is not displaying properly within the label, what can I do to get it to display properly?
here is my code

```<code>#info{
  position: absolute;
  bottom: 1vh;
  color: teal;
  width: 100%;
  font-family: Monospace;
  text-align: center;
}
iframe:focus {
  outline: none;
}

  iframe[seamless] {
    /*width:230px;
    height: 348px;*/
    background: none;
    display: block;
    position: absolute;
    border: none;

  }

/*#markerLabel {
  --baseColor: rgb(255, 250, 250);*/
/*#markerLabel {
  --baseColor: rgb(255, 250, 250);
  width: 20px;
  height: 30px;
  color: var(--baseColor);
  /*font-family: Monospace;
  font-size: 14px;
  font-weight: 700;
  /*padding: 2px;*/
  /*background: none;
  /*border: 2px solid var(--baseColor);
  border-radius: 5px;*/
  //*margin-top: -25px
  */
  /*overflow: hidden;*/
  /*padding: 0px;*/
}*/
#markerLabel {
  position: "static";
    object-fit: contain;
    font-family: 'Space Mono', monospace;
    transition: 0.3s;
    background: transparent;
    width: 290px;
    border: 4px solid  rgb(0, 107, 63) ;
    border-radius: 10px;
    z-index: 2;
    margin: 0;
    padding: 0;
}
#idNum {
  width:120px;
  height:240px;
  display: block;
}
.hidden{
  display: none;
}

.text {
  /*margin-left: 4px;*/
}

#closeButton{
  position: absolute;
  right: 0px;
  top: 0px;
  font-family: Arial;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  border: 1px solid gray;
  border-radius: 3px;
  background: transparent;
  color: white;
}

    </style>

</code>```

code for the label:

```<code>// <Label>
let labelDiv = document.getElementById("markerLabel");
let closeBtn = document.getElementById("closeButton");
closeBtn.addEventListener("pointerdown", event => {
  labelDiv.classList.add("hidden");
})
let label = new CSS2DObject(labelDiv);
label.userData = {
  cNormal: new THREE.Vector3(),
  cPosition: new THREE.Vector3(),
  mat4: new THREE.Matrix4(),
  trackVisibility: () => { // the closer to the edge, the less opacity
    let ud = label.userData;
    ud.cNormal.copy(label.position).normalize().applyMatrix3(globe.normalMatrix);
    ud.cPosition.copy(label.position).applyMatrix4(ud.mat4.multiplyMatrices(camera.matrixWorldInverse, globe.matrixWorld));
    let d = ud.cPosition.negate().normalize().dot(ud.cNormal);
    d = smoothstep(0.2, 0.7, d);
    label.element.style.opacity = d;

    // https://github.com/gre/smoothstep/blob/master/index.js
    function smoothstep (min, max, value) {
      var x = Math.max(0, Math.min(1, (value-min)/(max-min)));
      return x*x*(3 - 2*x);
    };
  }
}
scene.add(label);
// </Label>

// <Interaction>
let pointer = new THREE.Vector2();
let raycaster = new THREE.Raycaster();
let intersections;
let divID = document.getElementById("idNum");
//let divMag = document.getElementById("magnitude");
//let divCrd = document.getElementById("coordinates");
window.addEventListener("pointerdown", event => {
  pointer.x = ( event.clientX / window.innerWidth ) * 2 - 1;
    pointer.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
  raycaster.setFromCamera(pointer, camera);
  intersections = raycaster.intersectObject(markers).filter(m => {
    return (m.uv.subScalar(0.5).length() * 2) < 0.25; // check, if we're in the central circle only
  });
  //console.log(intersections);
  if (intersections.length > 0) {
    let iid = intersections[0].instanceId;
    let mi = markerInfo[iid];
    divID.innerHTML = `<iframe frameborder="0" allowfullscreen="true" sandbox="allow-same-origin allow-scripts allow-popups allow-forms allow-modals allow-popups-to-escape-sandbox" loading="eager" src="https://rss.app/embed/v1/wall/t0OXjFMGzjEUhPqm"></iframe>
          <link rel="stylesheet" href="input.css"> <!--Copy this line of code-->
         `;
    /*divMag.innerHTML = `Mag: <b>${mi.mag}</b>`;
    divCrd.innerHTML = `X: <b>${mi.crd.x.toFixed(2)}</b>; Y: <b>${mi.crd.y.toFixed(2)}</b>; Z: <b>${mi.crd.z.toFixed(2)}</b>`;*/
    label.position.copy(mi.crd);
    /*label.element.animate([
      {width: "0px", height: "0px", marginTop: "0px", marginLeft: "0px"},
      {width: "230px", height: "50px", marginTop: "-25px", marginLeft: "120px"}
    ],{
      duration: 250
    });*/
    label.element.classList.remove("hidden");
  }

})
</code>```

I've tried chaning the position to absolute and the height to 348px but the widget doesnt display
I think its related to the iframe element which is the element im displaying, on the iframe website the background is set to transparent but here it is set to transparent.

Body:
using threejs here is a screenshot

as you see here the news widget is not displaying properly within the label, what can I do to get it to display properly?
here is my code

#info{
  position: absolute;
  bottom: 1vh;
  color: teal;
  width: 100%;
  font-family: Monospace;
  text-align: center;
}
iframe:focus {
  outline: none;
}

  iframe[seamless] {
    /*width:230px;
    height: 348px;*/
    background: none;
    display: block;
    position: absolute;
    border: none;

  }

/*#markerLabel {
  --baseColor: rgb(255, 250, 250);*/
/*#markerLabel {
  --baseColor: rgb(255, 250, 250);
  width: 20px;
  height: 30px;
  color: var(--baseColor);
  /*font-family: Monospace;
  font-size: 14px;
  font-weight: 700;
  /*padding: 2px;*/
  /*background: none;
  /*border: 2px solid var(--baseColor);
  border-radius: 5px;*/
  //*margin-top: -25px
  */
  /*overflow: hidden;*/
  /*padding: 0px;*/
}*/
#markerLabel {
  position: "static";
    object-fit: contain;
    font-family: 'Space Mono', monospace;
    transition: 0.3s;
    background: transparent;
    width: 290px;
    border: 4px solid  rgb(0, 107, 63) ;
    border-radius: 10px;
    z-index: 2;
    margin: 0;
    padding: 0;
}
#idNum {
  width:120px;
  height:240px;
  display: block;
}
.hidden{
  display: none;
}

.text {
  /*margin-left: 4px;*/
}

#closeButton{
  position: absolute;
  right: 0px;
  top: 0px;
  font-family: Arial;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  border: 1px solid gray;
  border-radius: 3px;
  background: transparent;
  color: white;
}

    </style>

code for the label:

//
let labelDiv = document.getElementById("markerLabel");
let closeBtn = document.getElementById("closeButton");
closeBtn.addEventListener("pointerdown", event => {
  labelDiv.classList.add("hidden");
})
let label = new CSS2DObject(labelDiv);
label.userData = {
  cNormal: new THREE.Vector3(),
  cPosition: new THREE.Vector3(),
  mat4: new THREE.Matrix4(),
  trackVisibility: () => { // the closer to the edge, the less opacity
    let ud = label.userData;
    ud.cNormal.copy(label.position).normalize().applyMatrix3(globe.normalMatrix);
    ud.cPosition.copy(label.position).applyMatrix4(ud.mat4.multiplyMatrices(camera.matrixWorldInverse, globe.matrixWorld));
    let d = ud.cPosition.negate().normalize().dot(ud.cNormal);
    d = smoothstep(0.2, 0.7, d);
    label.element.style.opacity = d;

    // https://github.com/gre/smoothstep/blob/master/index.js
    function smoothstep (min, max, value) {
      var x = Math.max(0, Math.min(1, (value-min)/(max-min)));
      return x*x*(3 - 2*x);
    };
  }
}
scene.add(label);
//

// <Interaction>
let pointer = new THREE.Vector2();
let raycaster = new THREE.Raycaster();
let intersections;
let divID = document.getElementById("idNum");
//let divMag = document.getElementById("magnitude");
//let divCrd = document.getElementById("coordinates");
window.addEventListener("pointerdown", event => {
  pointer.x = ( event.clientX / window.innerWidth ) * 2 - 1;
    pointer.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
  raycaster.setFromCamera(pointer, camera);
  intersections = raycaster.intersectObject(markers).filter(m => {
    return (m.uv.subScalar(0.5).length() * 2) < 0.25; // check, if we're in the central circle only
  });
  //console.log(intersections);
  if (intersections.length > 0) {
    let iid = intersections[0].instanceId;
    let mi = markerInfo[iid];
    divID.innerHTML = `
          <link rel="stylesheet" href="input.css">
         `;
    /*divMag.innerHTML = `Mag: <b>${mi.mag}</b>`;
    divCrd.innerHTML = `X: <b>${mi.crd.x.toFixed(2)}</b>; Y: <b>${mi.crd.y.toFixed(2)}</b>; Z: <b>${mi.crd.z.toFixed(2)}</b>`;*/
    label.position.copy(mi.crd);
    /*label.element.animate([
      {width: "0px", height: "0px", marginTop: "0px", marginLeft: "0px"},
      {width: "230px", height: "50px", marginTop: "-25px", marginLeft: "120px"}
    ],{
      duration: 250
    });*/
    label.element.classList.remove("hidden");
  }

})

I've tried chaning the position to absolute and the height to 348px but the widget doesnt display
I think its related to the iframe element which is the element im displaying, on the iframe website the background is set to transparent but here it is set to transparent.


问:
HttpClient.SendAsync throwing nullreference exception on http 204
In a .Net 4.7.1 targeted application I am using HttpClient to perform Http requests.

When performing a GET request for a URL that returns a Http 204 result (no content), this results in a System.NullReferenceException: 'Object reference not set to an instance of an object.'.

On top of that, the exception is not caught by the try catch, which I think has something to do with the async call, as specified in this question: Why can't I catch an exception from async code?, but I want to focus on not getting the exception in the first place.

The same request was tested in a .Net Core application using IHttpClientFactory where it works as expected.

```<code>protected async Task<HttpResponseMessage> GetResponse(string path, Dictionary<string, string> headers)

    {

        HttpResponseMessage responseMessage = null;
        var request = new HttpRequestMessage(HttpMethod.Get, path);

        if (headers != null)
        {
            foreach (var header in headers)
            {
                request.Headers.Add(header.Key, header.Value);
            }
        }

            var proxy = new WebProxy
            {
                Address = new Uri($"http://{ProxyHost}:{ProxyPort}"),
                BypassProxyOnLocal = false,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(userName: ProxyUser, password: ProxyPW)
            };

            // create a client handler which uses that proxy

            var httpClientHandler = new HttpClientHandler
            {
                Proxy = proxy
            };

            var httpclient = new HttpClient(httpClientHandler);

            try
            {
                responseMessage = await httpclient.SendAsync(request);
            }
            catch (Exception ex)
            {
                // handle error …
            }

        return responseMessage;

    }
</code>```

The line throwing the exception is:

```<code>responseMessage = await httpclient.SendAsync(request);
</code>```

Visual Studio catches the unhandled exception:

Exception details:

```<code>System.NullReferenceException

  HResult=0x80004003

  Message=Object reference not set to an instance of an object.

  Source=mscorlib

  StackTrace:

   at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)

--- End of stack trace from previous location ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

   at System.Threading.ThreadPoolWorkQueue.Dispatch()

  This exception was originally thrown at this call stack:

    [External Code]
</code>```

An exception with StackTrace is visible in Event Viewer, but it doesn't help me a lot:

```<code>StackTrace:    at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)

   at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)

   at System.Web.LegacyAspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback callback, Object state)

   at System.Web.LegacyAspNetSynchronizationContext.CallCallback(SendOrPostCallback callback, Object state)

   at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

   at System.Threading.ThreadPoolWorkQueue.Dispatch()
</code>```

How can I make HttpClient handle the response correctly?
I have no control over the server sending the Http 204 response.

Body:
In a .Net 4.7.1 targeted application I am using HttpClient to perform Http requests.

When performing a GET request for a URL that returns a Http 204 result (no content), this results in a System.NullReferenceException: 'Object reference not set to an instance of an object.'.

On top of that, the exception is not caught by the try catch, which I think has something to do with the async call, as specified in this question: Why can't I catch an exception from async code?, but I want to focus on not getting the exception in the first place.

The same request was tested in a .Net Core application using IHttpClientFactory where it works as expected.

protected async Task<HttpResponseMessage> GetResponse(string path, Dictionary<string, string> headers)

    {

        HttpResponseMessage responseMessage = null;
        var request = new HttpRequestMessage(HttpMethod.Get, path);

        if (headers != null)
        {
            foreach (var header in headers)
            {
                request.Headers.Add(header.Key, header.Value);
            }
        }

            var proxy = new WebProxy
            {
                Address = new Uri($"http://{ProxyHost}:{ProxyPort}"),
                BypassProxyOnLocal = false,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(userName: ProxyUser, password: ProxyPW)
            };

            // create a client handler which uses that proxy

            var httpClientHandler = new HttpClientHandler
            {
                Proxy = proxy
            };

            var httpclient = new HttpClient(httpClientHandler);

            try
            {
                responseMessage = await httpclient.SendAsync(request);
            }
            catch (Exception ex)
            {
                // handle error …
            }

        return responseMessage;

    }

The line throwing the exception is:

responseMessage = await httpclient.SendAsync(request);

Visual Studio catches the unhandled exception:

Exception details:

System.NullReferenceException

  HResult=0x80004003

  Message=Object reference not set to an instance of an object.

  Source=mscorlib

  StackTrace:

   at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)

--- End of stack trace from previous location ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

   at System.Threading.ThreadPoolWorkQueue.Dispatch()

  This exception was originally thrown at this call stack:

    [External Code]

An exception with StackTrace is visible in Event Viewer, but it doesn't help me a lot:

StackTrace:    at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)

   at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)

   at System.Web.LegacyAspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback callback, Object state)

   at System.Web.LegacyAspNetSynchronizationContext.CallCallback(SendOrPostCallback callback, Object state)

   at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

   at System.Threading.ThreadPoolWorkQueue.Dispatch()

How can I make HttpClient handle the response correctly?
I have no control over the server sending the Http 204 response.


问:
Pyomo - Python - Gurobi - Initialize Variables
I am solving iteratively several MIP models, using pyomo with gurobi. The model at iteration k has certain constraint which is as follows:

use_of_resources <= Rmax[k]

where use_of_resources is a linear function of the variables.
I want to note that Rmax[k] = Rmax[k-1] + 1. Therefore,  in iteration k+1, that constraint is relaxed wrt the iteration before.

I want to add the solution obtained in iteration k, as a starting point for iteration k+1.

The variables of the model are declared like this:

```<code>Model.X = pyo.Var(N0,N0, within = pyo.Binary)
X = Model.X
</code>```

So far, I am doing as follows:

keep the solution at iteration k as follows, after solving model k

```<code>X_sol = {}
for j in N0:
    for k in N0:
        X_sol[j, k] = pyo.value(X[j, k])
</code>```

Initialize the variables at iteration k+1 as follows, before solving model k+1

```<code>for j in N0:
    for k in N0:
        X[j,k].value = X_sol[j, k]
</code>```

However, the solver does not seem to take that (feasible) solution at all.

Any idea about what I am doing wrong?

I'd appreciaty any help

Thanks

Fede

Body:
I am solving iteratively several MIP models, using pyomo with gurobi. The model at iteration k has certain constraint which is as follows:

use_of_resources <= Rmax[k]

where use_of_resources is a linear function of the variables.
I want to note that Rmax[k] = Rmax[k-1] + 1. Therefore,  in iteration k+1, that constraint is relaxed wrt the iteration before.

I want to add the solution obtained in iteration k, as a starting point for iteration k+1.

The variables of the model are declared like this:

Model.X = pyo.Var(N0,N0, within = pyo.Binary)
X = Model.X

So far, I am doing as follows:

keep the solution at iteration k as follows, after solving model k

X_sol = {}
for j in N0:
    for k in N0:
        X_sol[j, k] = pyo.value(X[j, k])

Initialize the variables at iteration k+1 as follows, before solving model k+1

for j in N0:
    for k in N0:
        X[j,k].value = X_sol[j, k]

However, the solver does not seem to take that (feasible) solution at all.

Any idea about what I am doing wrong?

I'd appreciaty any help

Thanks

Fede


问:
SUBSTRING parameter and pass it to new declared parameter SQL
I would like to SUBSTRING my parameter and pass the value to a newly declared parameter.

My goal is to - substring the @par_FiscalCalendarYear, where I will always have the values like 2022 P1 up to 2022 P12. So year then space then letter P and then month  e.x 12. In Declare statement I want to substring year and month seperatly, I tried below code but getting an error

Must declare the scalar variable "@FiscalCalendarYear".

```<code>    Alter PROCEDURE [DW].[SP_Fetch_Data] @par_FiscalCalendarYear varchar(10)
AS
BEGIN
    /* DW.SP_Fetch_Data @par_FiscalCalendarYear = 2022, @par_FiscalCalendarMonth = 11 */
/*
BALANCE ACCOUNTS
*/
    DECLARE @FiscalCalendarYear int = SELECT SUBSTRING(@par_FiscalCalendarYear,1,4) /* 2022 */
        , @FiscalCalendarMonth int = SELECT SUBSTRING (@par_FiscalCalendarYear,7,10) /* 11 */;
    DECLARE @FiscalCalendarPeriod int = @FiscalCalendarYear * 100 + @FiscalCalendarMonth
</code>```

Body:
I would like to SUBSTRING my parameter and pass the value to a newly declared parameter.

My goal is to - substring the @par_FiscalCalendarYear, where I will always have the values like 2022 P1 up to 2022 P12. So year then space then letter P and then month  e.x 12. In Declare statement I want to substring year and month seperatly, I tried below code but getting an error

Must declare the scalar variable "@FiscalCalendarYear".

    Alter PROCEDURE [DW].[SP_Fetch_Data] @par_FiscalCalendarYear varchar(10)
AS
BEGIN
    /* DW.SP_Fetch_Data @par_FiscalCalendarYear = 2022, @par_FiscalCalendarMonth = 11 */
/*
BALANCE ACCOUNTS
*/
    DECLARE @FiscalCalendarYear int = SELECT SUBSTRING(@par_FiscalCalendarYear,1,4) /* 2022 */
        , @FiscalCalendarMonth int = SELECT SUBSTRING (@par_FiscalCalendarYear,7,10) /* 11 */;
    DECLARE @FiscalCalendarPeriod int = @FiscalCalendarYear * 100 + @FiscalCalendarMonth