问:
Python: Not able to add new row once calculate method is called
whenever i run the code without
self.table.cellChanged.connect(self.calculate_total)i  can add new rows
but when i run the code with abouve code i cant add new row but can do mathematical function.
whats wrong with the code. i want to do both function perform mathematical function and add row .</p>
```<code>def add_row(self):

    # Get the current row count
    row_count = self.table.rowCount()
    # Insert a new row
    self.table.insertRow(row_count)
    # Add items to the new row
    item_cell = QTableWidgetItem("Item " + str(row_count + 1))
    self.table.setItem(row_count, 0, item_cell)
    quantity_cell = QTableWidgetItem("1")
    self.table.setItem(row_count, 1, quantity_cell)
    price_cell = QTableWidgetItem("0.00")
    self.table.setItem(row_count, 2, price_cell)
    # Add the total cell
    total_cell = QTableWidgetItem("0.00")
    self.table.setItem(row_count, 3, total_cell)
    #Recalculate the total
    self.calculate_total()

def calculate_total(self):
    for i in range(self.table.rowCount()):
            quantity = float(self.table.item(i, 1).text())
            price = float(self.table.item(i, 2).text())
            total = quantity * price
            self.table.item(i, 3).setText(f"{total:.2f}")
            # connect the calulate method
            self.table.cellChanged.connect(self.calculate_total)
</code>```

Body:
whenever i run the code without
self.table.cellChanged.connect(self.calculate_total)i  can add new rows
but when i run the code with abouve code i cant add new row but can do mathematical function.
whats wrong with the code. i want to do both function perform mathematical function and add row .

def add_row(self):

    # Get the current row count
    row_count = self.table.rowCount()
    # Insert a new row
    self.table.insertRow(row_count)
    # Add items to the new row
    item_cell = QTableWidgetItem("Item " + str(row_count + 1))
    self.table.setItem(row_count, 0, item_cell)
    quantity_cell = QTableWidgetItem("1")
    self.table.setItem(row_count, 1, quantity_cell)
    price_cell = QTableWidgetItem("0.00")
    self.table.setItem(row_count, 2, price_cell)
    # Add the total cell
    total_cell = QTableWidgetItem("0.00")
    self.table.setItem(row_count, 3, total_cell)
    #Recalculate the total
    self.calculate_total()

def calculate_total(self):
    for i in range(self.table.rowCount()):
            quantity = float(self.table.item(i, 1).text())
            price = float(self.table.item(i, 2).text())
            total = quantity * price
            self.table.item(i, 3).setText(f"{total:.2f}")
            # connect the calulate method
            self.table.cellChanged.connect(self.calculate_total)


来源: stackexchange

问:
Is it possible to change the size of the font in Matplotlib's status bar?
I am working with matplotlib in pyqt5 to create graphs through a graphical interface, but I am wondering if it is possible to modify the size of the reference font that appears when I move the cursor over my graph, I attach an image marking the data to which I want to increase the size

I have not found a solution to the problem of how to modify the size, I only saw some examples to modify this data, but I do not want to modify it, just change its size

ContentLicense: CC BY-SA 4.0


问:
What is the best practice for creating a nested variables in python?
I am working on a python script and I was creating a few variables.  I understand each variable takes up memory. However, if I don't nest, the code can generally be more readable.  In my example below using CV2 methods, does it really save me much memory to nest the variables, or should I keep them separated to be more pythonic?

Just an example below.

Separated Variables

```<code>face_blob = cv2.dnn.blobFromImage(face,1,(100,100),(104,117,123),swapRB=True)
face_blob_squeeze = np.squeeze(face_blob).T
face_blob_rotate = cv2.rotate(face_blob_squeeze,cv2.ROTATE_90_CLOCKWISE)
face_blob_flip = cv2.flip(face_blob_rotate,1)
</code>```

Nested Variables

```<code>face_blob = cv2.flip(cv2.rotate(np.squeeze(cv2.dnn.blobFromImage(face,1,(100,100),(104,117,123),swapRB=True)).T,cv2.ROTATE_90_CLOCKWISE),1)
</code>```

Body:
I am working on a python script and I was creating a few variables.  I understand each variable takes up memory. However, if I don't nest, the code can generally be more readable.  In my example below using CV2 methods, does it really save me much memory to nest the variables, or should I keep them separated to be more pythonic?

Just an example below.

Separated Variables

face_blob = cv2.dnn.blobFromImage(face,1,(100,100),(104,117,123),swapRB=True)
face_blob_squeeze = np.squeeze(face_blob).T
face_blob_rotate = cv2.rotate(face_blob_squeeze,cv2.ROTATE_90_CLOCKWISE)
face_blob_flip = cv2.flip(face_blob_rotate,1)

Nested Variables

face_blob = cv2.flip(cv2.rotate(np.squeeze(cv2.dnn.blobFromImage(face,1,(100,100),(104,117,123),swapRB=True)).T,cv2.ROTATE_90_CLOCKWISE),1)


问:
can you help me to install kivy from vscode?
```<code>error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary
will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion
can be found at https://github.com/pypa/pip/issues/11453
      Collecting setuptools
        Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
      Collecting wheel
        Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
      Collecting cython!=0.27,!=0.27.2,<=0.29.28,>=0.24
        Using cached Cython-0.29.28-py2.py3-none-any.whl (983 kB)
      Collecting kivy_deps.gstreamer_dev~=0.3.3
        Using cached kivy_deps.gstreamer_dev-0.3.3-cp311-cp311-win_amd64.whl (3.9 MB)
      ERROR: Could not find a version that satisfies the requirement kivy_deps.sdl2_dev~=0.4.5 (from versions: 0.5.1)
      ERROR: No matching distribution found for kivy_deps.sdl2_dev~=0.4.5
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip
</code>```

install kivy in vscode from windows

Body:
error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary
will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion
can be found at https://github.com/pypa/pip/issues/11453
      Collecting setuptools
        Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
      Collecting wheel
        Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
      Collecting cython!=0.27,!=0.27.2,<=0.29.28,>=0.24
        Using cached Cython-0.29.28-py2.py3-none-any.whl (983 kB)
      Collecting kivy_deps.gstreamer_dev~=0.3.3
        Using cached kivy_deps.gstreamer_dev-0.3.3-cp311-cp311-win_amd64.whl (3.9 MB)
      ERROR: Could not find a version that satisfies the requirement kivy_deps.sdl2_dev~=0.4.5 (from versions: 0.5.1)
      ERROR: No matching distribution found for kivy_deps.sdl2_dev~=0.4.5
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip

install kivy in vscode from windows


问:
Creating my own counting sort algorithm but it's making 1 mistake at the end
I am currently creating my own counting sort algorithm and I believe ive done everything correct so far. It is doing the count as expected and incrementing the correct position (so for instance if you have an array of [0, 3, 1, 1] the algorithm should return a new array with the values [0,3,1,1] using the index position of the numbers to indicate the frequency that it appears in the array

Now I know there are other solutions online but I want to do it my particular way and I'm positive there is just a small issue with my code. here is the output Im getting and the expected output

mine -

```<code>"2 0 1 0 0 1 1 1 1 0 0 1 3 2 2 0 4 4 1 1 0 0 0 0 3 0 0 1 0 1 2 0 1 2 2 3 0 2 0 0 1 0 1 1 0 0 1 1 0 2 0 0 1 1 1 0 1 0 1 1 2 3 0 1 2 0 1 2 1 1 4 1 0 1 1 3 0 0 2 1 2 3 2 2 2 0 0 1 0 0 0 0 0 0 2 0 1 3 1"
</code>```

expected -

```<code>"2 0 1 0 0 1 1 1 1 0 0 1 3 2 2 0 4 4 1 1 0 0 0 0 3 0 0 1 0 1 2 0 1 2 2 3 0 2 0 0 1 0 1 1 0 0 1 1 0 2 0 0 1 1 1 0 1 0 1 1 2 3 0 1 2 0 1 2 1 1 4 1 0 1 1 3 0 0 2 1 2 3 2 2 2 0 0 1 0 0 0 0 0 0 2 0 1 3 1 0"
</code>```

as you can see it is incrementing the number 99 as "0" right at the end when it shouldn't be which is the only difference between our outputs. Now I know why this is happening, which is because ive set the length of the new array to be +1 of the maximum number within the list but if I remove that element of it it creates an out of bound error

Can anyone help me figure out how I can adjust it to make this work? I want to work with my own method, I do not want to copy anyone else's idea!

The numbers being added to the list are: "63 54 17 78 43 70 32 97 16 94 74 18 60 61 35 83 13 56 75 52 70 12 24 37 17 0 16 64 34 81 82 24 69 2 30 61 83 37 97 16 70 53 0 61 12 17 97 67 33 30 49 70 11 40 67 94 84 60 35 58 19 81 16 14 68 46 42 81 75 87 13 84 33 34 14 96 7 59 17 98 79 47 71 75 8 27 73 66 64 12 29 35 80 78 80 6 5 24 49 82"

```<code>
        int tempValue = 0;

        //finding the range of the array. so if the highest number was 99 the new array will go from 0 - 99
        for(int i = 0; i < arr.size(); i++){
            if(arr.get(i) > tempValue){
                tempValue = arr.get(i);
            }
        }

        //initializing a new array with 0's the length of the maximum value
        int[] newArray = new int[tempValue+1];

        List<Integer> checking = new ArrayList<>();
        List<Integer> returnThis = new ArrayList<>(); //the list I will eventually return

        //looking for duplicates
        for(int i = 0; i < arr.size(); i++){
            if(!checking.contains(arr.get(i))){
                for(int b = 0; b < arr.size(); b++){
                    if(arr.get(i) == arr.get(b)){
                        int findPosition = arr.get(i); //using the number im currently checking for duplicates for and incrementing
                        newArray[findPosition]++; //that position in the new array since it's a counting sort
                    }
                }
            }

            checking.add(arr.get(i));
        }

        //adding the array into a list becuase it needs to return a list
        for(int i = 0; i < newArray.length; i++){
            returnThis.add(newArray[i]);
        }

        return returnThis;
</code>```

Body:
I am currently creating my own counting sort algorithm and I believe ive done everything correct so far. It is doing the count as expected and incrementing the correct position (so for instance if you have an array of [0, 3, 1, 1] the algorithm should return a new array with the values [0,3,1,1] using the index position of the numbers to indicate the frequency that it appears in the array

Now I know there are other solutions online but I want to do it my particular way and I'm positive there is just a small issue with my code. here is the output Im getting and the expected output

mine -

"2 0 1 0 0 1 1 1 1 0 0 1 3 2 2 0 4 4 1 1 0 0 0 0 3 0 0 1 0 1 2 0 1 2 2 3 0 2 0 0 1 0 1 1 0 0 1 1 0 2 0 0 1 1 1 0 1 0 1 1 2 3 0 1 2 0 1 2 1 1 4 1 0 1 1 3 0 0 2 1 2 3 2 2 2 0 0 1 0 0 0 0 0 0 2 0 1 3 1"

expected -

"2 0 1 0 0 1 1 1 1 0 0 1 3 2 2 0 4 4 1 1 0 0 0 0 3 0 0 1 0 1 2 0 1 2 2 3 0 2 0 0 1 0 1 1 0 0 1 1 0 2 0 0 1 1 1 0 1 0 1 1 2 3 0 1 2 0 1 2 1 1 4 1 0 1 1 3 0 0 2 1 2 3 2 2 2 0 0 1 0 0 0 0 0 0 2 0 1 3 1 0"

as you can see it is incrementing the number 99 as "0" right at the end when it shouldn't be which is the only difference between our outputs. Now I know why this is happening, which is because ive set the length of the new array to be +1 of the maximum number within the list but if I remove that element of it it creates an out of bound error

Can anyone help me figure out how I can adjust it to make this work? I want to work with my own method, I do not want to copy anyone else's idea!

The numbers being added to the list are: "63 54 17 78 43 70 32 97 16 94 74 18 60 61 35 83 13 56 75 52 70 12 24 37 17 0 16 64 34 81 82 24 69 2 30 61 83 37 97 16 70 53 0 61 12 17 97 67 33 30 49 70 11 40 67 94 84 60 35 58 19 81 16 14 68 46 42 81 75 87 13 84 33 34 14 96 7 59 17 98 79 47 71 75 8 27 73 66 64 12 29 35 80 78 80 6 5 24 49 82"

        int tempValue = 0;

        //finding the range of the array. so if the highest number was 99 the new array will go from 0 - 99
        for(int i = 0; i < arr.size(); i++){
            if(arr.get(i) > tempValue){
                tempValue = arr.get(i);
            }
        }

        //initializing a new array with 0's the length of the maximum value
        int[] newArray = new int[tempValue+1];

        List<Integer> checking = new ArrayList<>();
        List<Integer> returnThis = new ArrayList<>(); //the list I will eventually return

        //looking for duplicates
        for(int i = 0; i < arr.size(); i++){
            if(!checking.contains(arr.get(i))){
                for(int b = 0; b < arr.size(); b++){
                    if(arr.get(i) == arr.get(b)){
                        int findPosition = arr.get(i); //using the number im currently checking for duplicates for and incrementing
                        newArray[findPosition]++; //that position in the new array since it's a counting sort
                    }
                }
            }

            checking.add(arr.get(i));
        }

        //adding the array into a list becuase it needs to return a list
        for(int i = 0; i < newArray.length; i++){
            returnThis.add(newArray[i]);
        }

        return returnThis;


问:
WebSocket connection to 'ws://localhost:8000/ws/' failed: in djangorest
```<code>(index):77 WebSocket connection to 'ws://localhost:8000/ws/' failed:
</code>```

(anonymous) @ (index):77
2127.0.0.1/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received

i want to make websoket in my app and i always get this errror i installed djangorestchannel and redis-channel and still erorr found
image of errorhere

Body:
(index):77 WebSocket connection to 'ws://localhost:8000/ws/' failed:

(anonymous) @ (index):77
2127.0.0.1/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received

i want to make websoket in my app and i always get this errror i installed djangorestchannel and redis-channel and still erorr found
image of errorhere


问:
Unable to use record
Completely new to graal-native-image, trying to familiarize with that.
According to documentation I'm using tests and agent to create explicit metadata. It discovered reflection and and even some c libraries and it works. But java record does not. I have it fully covered by tests, so agent stepped on everything. Record instance is created by JacksonMapper, and even that flow is covered by tests.

record looks like this:

```<code>record Issue(String a, String b, String c, String d) {}
</code>```

generated metadata contains (I'm selecting interesting parts):

```<code>{
  "name":"a.b.c.D$Issue",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true,
  "queryAllDeclaredConstructors":true,
  "methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","java.lang.String"] }]
}

...

{
  "name":"java.lang.Record",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true
}

...

{
  "name":"java.lang.reflect.RecordComponent",
  "methods":[
    {"name":"getName","parameterTypes":[] },
    {"name":"getType","parameterTypes":[] }
  ]
}
</code>```

but still, during build of native image I'm getting:

```<code>Caused by: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public java.lang.String a.b.c.D$Issue.d()
</code>```

IIUC it means, that compiller found call to d(), which weren't discovered before (am I right?), but:

why isn't it 'auto-discovered'? It's not reflection or anything that hard to understand.

why is it considered as new if (as far as I understand) covered by explicit metadata?

what am I overlooking? Trivial replace with static inner class is working workaround, but I would like to understand why records does not work...

Title: Unable to use record

Body:
Completely new to graal-native-image, trying to familiarize with that.
According to documentation I'm using tests and agent to create explicit metadata. It discovered reflection and and even some c libraries and it works. But java record does not. I have it fully covered by tests, so agent stepped on everything. Record instance is created by JacksonMapper, and even that flow is covered by tests.

record looks like this:

record Issue(String a, String b, String c, String d) {}

generated metadata contains (I'm selecting interesting parts):

{
  "name":"a.b.c.D$Issue",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true,
  "queryAllDeclaredConstructors":true,
  "methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","java.lang.String"] }]
}

...

{
  "name":"java.lang.Record",
  "allDeclaredFields":true,
  "queryAllDeclaredMethods":true
}

...

{
  "name":"java.lang.reflect.RecordComponent",
  "methods":[
    {"name":"getName","parameterTypes":[] },
    {"name":"getType","parameterTypes":[] }
  ]
}

but still, during build of native image I'm getting:

Caused by: com.oracle.svm.core.util.VMError$HostedError: New Method or Constructor found as reachable after static analysis: public java.lang.String a.b.c.D$Issue.d()

IIUC it means, that compiller found call to d(), which weren't discovered before (am I right?), but:

why isn't it 'auto-discovered'? It's not reflection or anything that hard to understand.

why is it considered as new if (as far as I understand) covered by explicit metadata?

what am I overlooking? Trivial replace with static inner class is working workaround, but I would like to understand why records does not work...


问:
vscode is not working when I try to access data from yfinance api
I am new to vscode.
I want to pip install data from a yfinance api. This code works in replit, but does not work on vscode. How can I fix this? These are the 2 files I am using. see screenshot here (https://i.stack.imgur.com/b7uk5.jpg)

```<code>#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# yfinance - market data downloader
# https://github.com/ranaroussi/yfinance

"""
Sanity check for most common library uses all working
- Stock: Microsoft
- ETF: Russell 2000 Growth
- Mutual fund: Vanguard 500 Index fund
- Index: S&P500
- Currency BTC-USD
"""

import yfinance as yf
import unittest
import ticker

symbols = ['MSFT', 'IWO', 'VFINX', '^GSPC', 'BTC-USD', 'TSLA', 'VOW3.DE', 'AAPL', ticker]
tickers = [yf.Ticker(symbol) for symbol in symbols]

class TestTicker(unittest.TestCase):
    def test_info_history(self):
        for ticker in tickers:
            # always should have info and history for valid symbols
            assert(ticker.info is not None and ticker.info != {})
            history = ticker.history(period="max")
            assert(history.empty is False and history is not None)

    def test_attributes(self):
        for ticker in tickers:
            ticker.isin
            ticker.major_holders
            ticker.institutional_holders
            ticker.mutualfund_holders
            ticker.dividends
            ticker.splits
            ticker.actions
            ticker.shares
            ticker.info
            ticker.calendar
            ticker.recommendations
            ticker.earnings
            ticker.quarterly_earnings
            ticker.income_stmt
            ticker.quarterly_income_stmt
            ticker.balance_sheet
            ticker.quarterly_balance_sheet
            ticker.cashflow
            ticker.quarterly_cashflow
            ticker.recommendations_summary
            ticker.analyst_price_target
            ticker.revenue_forecasts
            ticker.sustainability
            ticker.options
            ticker.news
            ticker.earnings_trend
            ticker.earnings_dates
            ticker.earnings_forecasts

    def test_holders(self):
        for ticker in tickers:
            assert(ticker.info is not None and ticker.info != {})
            assert(ticker.major_holders is not None)
            assert(ticker.institutional_holders is not None)

if __name__ == '__main__':
    unittest.main()
</code>```
```<code>
pip install yfinance
import yfinance as yf

ticker = str(input("What ticker would you like to view?"))
msft = yf.Ticker(ticker)

# get stock info
msft.info

# get historical market data
hist = msft.history(period="max")

# show meta information about the history (requires history() to be called first)
msft.history_metadata

# show actions (dividends, splits, capital gains)
msft.actions

# show dividends
print(msft.dividends)

# show splits
msft.splits

# show capital gains (for mutual funds & etfs)
msft.capital_gains

# show share count
msft.shares

# show financials:
# - income statement
# print(msft.income_stmt)
msft.quarterly_income_stmt
# - balance sheet
msft.balance_sheet
msft.quarterly_balance_sheet
# - cash flow statement
msft.cashflow
msft.quarterly_cashflow
# see `Ticker.get_income_stmt()` for more options

# show major holders
msft.major_holders

# show institutional holders
msft.institutional_holders

# show mutualfund holders
msft.mutualfund_holders

# show earnings
msft.earnings
msft.quarterly_earnings

# show sustainability
msft.sustainability

# show analysts recommendations
msft.recommendations
msft.recommendations_summary
# show analysts other work
msft.analyst_price_target
msft.revenue_forecasts
msft.earnings_forecasts
msft.earnings_trend

# show next event (earnings, etc)
msft.calendar

# Show future and historic earnings dates, returns at most next 4 quarters and last 8 quarters by default.
# Note: If more are needed use msft.get_earnings_dates(limit=XX) with increased limit argument.
# print(msft.earnings_dates)

# show ISIN code - *experimental*
# ISIN = International Securities Identification Number
msft.isin

# show options expirations
msft.options

# show news
msft.news

# get option chain for specific expiration
opt = msft.option_chain('YYYY-MM-DD')
# data available via: opt.calls, opt.puts
</code>```

I tried running the code, and expected it to print the stock ticker's earnings date (worked correctly in replit) however it does not work in vscode.

Body:
I am new to vscode.
I want to pip install data from a yfinance api. This code works in replit, but does not work on vscode. How can I fix this? These are the 2 files I am using. see screenshot here (https://i.stack.imgur.com/b7uk5.jpg)

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# yfinance - market data downloader
# https://github.com/ranaroussi/yfinance

"""
Sanity check for most common library uses all working
- Stock: Microsoft
- ETF: Russell 2000 Growth
- Mutual fund: Vanguard 500 Index fund
- Index: S&P500
- Currency BTC-USD
"""

import yfinance as yf
import unittest
import ticker

symbols = ['MSFT', 'IWO', 'VFINX', '^GSPC', 'BTC-USD', 'TSLA', 'VOW3.DE', 'AAPL', ticker]
tickers = [yf.Ticker(symbol) for symbol in symbols]

class TestTicker(unittest.TestCase):
    def test_info_history(self):
        for ticker in tickers:
            # always should have info and history for valid symbols
            assert(ticker.info is not None and ticker.info != {})
            history = ticker.history(period="max")
            assert(history.empty is False and history is not None)

    def test_attributes(self):
        for ticker in tickers:
            ticker.isin
            ticker.major_holders
            ticker.institutional_holders
            ticker.mutualfund_holders
            ticker.dividends
            ticker.splits
            ticker.actions
            ticker.shares
            ticker.info
            ticker.calendar
            ticker.recommendations
            ticker.earnings
            ticker.quarterly_earnings
            ticker.income_stmt
            ticker.quarterly_income_stmt
            ticker.balance_sheet
            ticker.quarterly_balance_sheet
            ticker.cashflow
            ticker.quarterly_cashflow
            ticker.recommendations_summary
            ticker.analyst_price_target
            ticker.revenue_forecasts
            ticker.sustainability
            ticker.options
            ticker.news
            ticker.earnings_trend
            ticker.earnings_dates
            ticker.earnings_forecasts

    def test_holders(self):
        for ticker in tickers:
            assert(ticker.info is not None and ticker.info != {})
            assert(ticker.major_holders is not None)
            assert(ticker.institutional_holders is not None)

if __name__ == '__main__':
    unittest.main()

pip install yfinance
import yfinance as yf

ticker = str(input("What ticker would you like to view?"))
msft = yf.Ticker(ticker)

# get stock info
msft.info

# get historical market data
hist = msft.history(period="max")

# show meta information about the history (requires history() to be called first)
msft.history_metadata

# show actions (dividends, splits, capital gains)
msft.actions

# show dividends
print(msft.dividends)

# show splits
msft.splits

# show capital gains (for mutual funds & etfs)
msft.capital_gains

# show share count
msft.shares

# show financials:
# - income statement
# print(msft.income_stmt)
msft.quarterly_income_stmt
# - balance sheet
msft.balance_sheet
msft.quarterly_balance_sheet
# - cash flow statement
msft.cashflow
msft.quarterly_cashflow
# see `Ticker.get_income_stmt()` for more options

# show major holders
msft.major_holders

# show institutional holders
msft.institutional_holders

# show mutualfund holders
msft.mutualfund_holders

# show earnings
msft.earnings
msft.quarterly_earnings

# show sustainability
msft.sustainability

# show analysts recommendations
msft.recommendations
msft.recommendations_summary
# show analysts other work
msft.analyst_price_target
msft.revenue_forecasts
msft.earnings_forecasts
msft.earnings_trend

# show next event (earnings, etc)
msft.calendar

# Show future and historic earnings dates, returns at most next 4 quarters and last 8 quarters by default.
# Note: If more are needed use msft.get_earnings_dates(limit=XX) with increased limit argument.
# print(msft.earnings_dates)

# show ISIN code - *experimental*
# ISIN = International Securities Identification Number
msft.isin

# show options expirations
msft.options

# show news
msft.news

# get option chain for specific expiration
opt = msft.option_chain('YYYY-MM-DD')
# data available via: opt.calls, opt.puts

I tried running the code, and expected it to print the stock ticker's earnings date (worked correctly in replit) however it does not work in vscode.


问:
Android - How to Draw beveled Shapes on the Canvas
I'm working on a UI and I want to add bevel/depth to a path that is drawn on the canvas. I see that the EmbossFilterMask is no longer supported which seemed like the easiest way to implement. Does anyone have any suggestions on how to give a stroke some depth similar to the image below?


问:
Update npm packages without creating dependency issues
I've run into the scenario where running npm install no longer works for my project as some of the packages in my project no longer have the required dependencies.

Are there any tools that will essentially run an npm update but will first check the dependencies of packages in your package.json file so that packages aren't updated to versions that won't work with other packages you have installed?


问:
how to apply localization and Internationalization approach using spring framework with elasticsearch backend?
I am using Spring framework with elasticsearch as the backend to store results such as item description, price, expert notes, etc. It is working perfectly for the English domain. I need to add additional language support for this. I have added the properties file for button labels and all the HTML markup except for the data in elasticsearch. I have the corresponding translation for the elasticsearch data. My question is how can I use this translated data? So far I have come up with the following options:

Create separate elasticsearch index for the translated data and query the required field from this index for showing the translated text.

Store the translated data in database and query that data at runtime for translation.

Store the translated data in properties file and read these properties for translation.

Has anyone done this before? Are there any other options I didn't mention? What approach did you take?


问:
Why can I only see the background of my image buttons in my horizontal scroll view and grid layout?
All the problem is in the title, and here is the code. The beer on the pict is an Image view and not an Image button and it works. Thanks for your help.

XML :

```<code><HorizontalScrollView
        android:id="@+id/HSVDrinks"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="30dp"
        android:layout_marginEnd="30dp"
        android:layout_marginBottom="30dp"
        android:background="@drawable/drinks_background"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <GridLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:columnCount="5">

            <ImageButton
                android:id="@+id/imageButton1"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:scaleType="fitXY"
                tools:layout_editor_absoluteX="29dp"
                tools:layout_editor_absoluteY="92dp"
                tools:srcCompat="@drawable/beer" />

            <ImageButton
                android:id="@+id/imageButton2"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:scaleType="fitXY"
                tools:layout_editor_absoluteX="29dp"
                tools:layout_editor_absoluteY="92dp"
                tools:srcCompat="@tools:sample/avatars" />

                 etc,...

                <ImageView
                android:id="@+id/imageView"
                android:layout_width="100dp"
                android:layout_height="100dp"
                app:srcCompat="@drawable/beer" />

        </GridLayout>
    </HorizontalScrollView>

</code>```

I tried to reduce the size and the background but no result.

Body:
All the problem is in the title, and here is the code. The beer on the pict is an Image view and not an Image button and it works. Thanks for your help.

XML :

<HorizontalScrollView
        android:id="@+id/HSVDrinks"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="30dp"
        android:layout_marginEnd="30dp"
        android:layout_marginBottom="30dp"
        android:background="@drawable/drinks_background"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <GridLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:columnCount="5">

            <ImageButton
                android:id="@+id/imageButton1"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:scaleType="fitXY"
                tools:layout_editor_absoluteX="29dp"
                tools:layout_editor_absoluteY="92dp"
                tools:srcCompat="@drawable/beer" />

            <ImageButton
                android:id="@+id/imageButton2"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:scaleType="fitXY"
                tools:layout_editor_absoluteX="29dp"
                tools:layout_editor_absoluteY="92dp"
                tools:srcCompat="@tools:sample/avatars" />

                 etc,...

                <ImageView
                android:id="@+id/imageView"
                android:layout_width="100dp"
                android:layout_height="100dp"
                app:srcCompat="@drawable/beer" />

        </GridLayout>
    </HorizontalScrollView>

I tried to reduce the size and the background but no result.


问:
Adding Google Chat cards_v2
I've been working on setting up a Google Chat App that produces a dialog to users when a command is invoked and then from that dialog based on the text entered it should produce a card into the thread that it originated from. That part seems to be passing in my code however I'm stuck on where to add the "cards_v2" type functionality within the code. There are several files for this bot, this one pertains to the actual command for the bot I'm unsure if this should be added here somewhere or if it should go within my MessageRouter.go code</p>
```<code>package bot

import (
    "encoding/json"
    "log"
    "net/http"

    chat "google.golang.org/api/chat/v1"
)

// DwnCommand News the URL to the current thread
type DwnCommand struct {
    Event  ChatEvent
    Writer http.ResponseWriter
}

// Help Returns detailed help about the command
func (a DwnCommand) Help() string {
    return a.Synopsis() + "\nUsage: new --help"
}

// Synopsis Returns a simple message about the command
func (a DwnCommand) Synopsis() string {
    return "A list of resources that one can create."
}

// Run Runs the dwn command.
func (a DwnCommand) Run(args []string) int {
    // Create Form Action
    form := &chat.OpenLink{
        Type: "FORM",
        Parameters: []*chat.OpenLinkParameter{
            {
                DisplayName: "Field 1",
                Name: "field1",
                Required: true,
            },
            {
                DisplayName: "Field 2",
                Name: "field2",
                Required: true,
            },
            {
                DisplayName: "Field 3",
                Name: "field3",
                Required: true,
            },
        },
    }
    writeNewMessage(a.Writer, "Please fill in the dialog", form)
    return 0
}

</code>```

Title: Adding Google Chat cards_v2

Body:
I've been working on setting up a Google Chat App that produces a dialog to users when a command is invoked and then from that dialog based on the text entered it should produce a card into the thread that it originated from. That part seems to be passing in my code however I'm stuck on where to add the "cards_v2" type functionality within the code. There are several files for this bot, this one pertains to the actual command for the bot I'm unsure if this should be added here somewhere or if it should go within my MessageRouter.go code

package bot

import (
    "encoding/json"
    "log"
    "net/http"

    chat "google.golang.org/api/chat/v1"
)

// DwnCommand News the URL to the current thread
type DwnCommand struct {
    Event  ChatEvent
    Writer http.ResponseWriter
}

// Help Returns detailed help about the command
func (a DwnCommand) Help() string {
    return a.Synopsis() + "\nUsage: new --help"
}

// Synopsis Returns a simple message about the command
func (a DwnCommand) Synopsis() string {
    return "A list of resources that one can create."
}

// Run Runs the dwn command.
func (a DwnCommand) Run(args []string) int {
    // Create Form Action
    form := &chat.OpenLink{
        Type: "FORM",
        Parameters: []*chat.OpenLinkParameter{
            {
                DisplayName: "Field 1",
                Name: "field1",
                Required: true,
            },
            {
                DisplayName: "Field 2",
                Name: "field2",
                Required: true,
            },
            {
                DisplayName: "Field 3",
                Name: "field3",
                Required: true,
            },
        },
    }
    writeNewMessage(a.Writer, "Please fill in the dialog", form)
    return 0
}


问:
Linphone Xamarin.iOS sample app with NuGET package build issue
I am trying to use the Linphone Xamarin sample app with their self-hosted NuGet package (LinphoneSDK.Xamarin version 5.2.8) I have it working with Android, but for iOS, after removing the native package assemblies and adding the NuGET package to the project, I get errors when trying to build the project. I think these are the relevant lines from the build output:

```<code>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -stdlib=libc++ -gdwarf-2 -std=c++14 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=9.0 -arch x86_64 -c -o /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.o -x objective-c++ -D MONOTOUCH -D DEBUG /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.m
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -framework CoreFoundation -framework Security -framework CFNetwork -framework QuickLook -framework SceneKit -framework OpenGLES -framework MediaPlayer -framework ImageIO -framework GLKit -framework WebKit -framework Foundation -framework CoreText -framework CoreSpotlight -framework CoreGraphics -framework CoreData -framework QuartzCore -framework CloudKit -framework UIKit -framework GSS -weak_framework Intents -weak_framework linphone /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.o /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libxamarin-debug.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmono-native-compat.a -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libapp.a -Wl,-pie -arch x86_64 -gdwarf-2 -std=c++14 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=9.0 -lz -liconv -lz -o /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/bin/iPhoneSimulator/Debug/LinphoneXamarin.iOS.app/LinphoneXamarin.iOS -u _SystemNative_ConvertErrorPlatformToPal -u _SystemNative_ConvertErrorPalToPlatform -u _SystemNative_StrErrorR -u _SystemNative_GetNonCryptographicallySecureRandomBytes -u _SystemNative_GetReadDirRBufferSize -u _SystemNative_ReadLink -u _SystemNative_Stat2 -u _SystemNative_LStat2 -u _SystemNative_Symlink -u _SystemNative_CopyFile -u _SystemNative_GetEGid -u _SystemNative_GetEUid -u _SystemNative_Link -u _SystemNative_MkDir -u _SystemNative_Rename -u _SystemNative_Unlink -u _SystemNative_OpenDir -u _SystemNative_ReadDirR -u _SystemNative_CloseDir -u _xamarin_timezone_get_local_name -u _xamarin_timezone_get_data -u _xamarin_GetFolderPath -u _xamarin_log -u _NetSecurityNative_ReleaseGssBuffer -u _NetSecurityNative_DisplayMinorStatus -u _NetSecurityNative_DisplayMajorStatus -u _NetSecurityNative_ImportUserName -u _NetSecurityNative_ImportPrincipalName -u _NetSecurityNative_ReleaseName -u _NetSecurityNative_InitiateCredSpNego -u _NetSecurityNative_InitiateCredWithPassword -u _NetSecurityNative_ReleaseCred -u _NetSecurityNative_InitSecContext -u _NetSecurityNative_DeleteSecContext -u _xamarin_start_wwan -u _xamarin_release_managed_ref -u _xamarin_set_gchandle_with_flags_safe -u _xamarin_UIApplicationMain -u _xamarin_find_protocol_wrapper_type -u _xamarin_release_block_on_main_thread -u _xamarin_get_block_descriptor -u _xamarin_IntPtr_objc_msgSend_IntPtr_exception -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_exception -u _mono_pmip -u _xamarin_dyn_objc_msgSend -u _xamarin_dyn_objc_msgSendSuper -u _xamarin_dyn_objc_msgSend_stret -u _xamarin_dyn_objc_msgSendSuper_stret
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -framework CoreFoundation -framework Security -framework CFNetwork -framework QuickLook -framework SceneKit -framework OpenGLES -framework MediaPlayer -framework ImageIO -framework GLKit -framework WebKit -framework Foundation -framework CoreText -framework CoreSpotlight -framework CoreGraphics -framework CoreData -framework QuartzCore -framework CloudKit -framework UIKit -framework GSS -weak_framework Intents -weak_framework linphone /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.o /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libxamarin-debug.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmono-native-compat.a -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libapp.a -Wl,-pie -arch x86_64 -gdwarf-2 -std=c++14 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=9.0 -lz -liconv -lz -o /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/bin/iPhoneSimulator/Debug/LinphoneXamarin.iOS.app/LinphoneXamarin.iOS -u _SystemNative_ConvertErrorPlatformToPal -u _SystemNative_ConvertErrorPalToPlatform -u _SystemNative_StrErrorR -u _SystemNative_GetNonCryptographicallySecureRandomBytes -u _SystemNative_GetReadDirRBufferSize -u _SystemNative_ReadLink -u _SystemNative_Stat2 -u _SystemNative_LStat2 -u _SystemNative_Symlink -u _SystemNative_CopyFile -u _SystemNative_GetEGid -u _SystemNative_GetEUid -u _SystemNative_Link -u _SystemNative_MkDir -u _SystemNative_Rename -u _SystemNative_Unlink -u _SystemNative_OpenDir -u _SystemNative_ReadDirR -u _SystemNative_CloseDir -u _xamarin_timezone_get_local_name -u _xamarin_timezone_get_data -u _xamarin_GetFolderPath -u _xamarin_log -u _NetSecurityNative_ReleaseGssBuffer -u _NetSecurityNative_DisplayMinorStatus -u _NetSecurityNative_DisplayMajorStatus -u _NetSecurityNative_ImportUserName -u _NetSecurityNative_ImportPrincipalName -u _NetSecurityNative_ReleaseName -u _NetSecurityNative_InitiateCredSpNego -u _NetSecurityNative_InitiateCredWithPassword -u _NetSecurityNative_ReleaseCred -u _NetSecurityNative_InitSecContext -u _NetSecurityNative_DeleteSecContext -u _xamarin_start_wwan -u _xamarin_release_managed_ref -u _xamarin_set_gchandle_with_flags_safe -u _xamarin_UIApplicationMain -u _xamarin_find_protocol_wrapper_type -u _xamarin_release_block_on_main_thread -u _xamarin_get_block_descriptor -u _xamarin_IntPtr_objc_msgSend_IntPtr_exception -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_exception -u _mono_pmip -u _xamarin_dyn_objc_msgSend -u _xamarin_dyn_objc_msgSendSuper -u _xamarin_dyn_objc_msgSend_stret -u _xamarin_dyn_objc_msgSendSuper_stret
ld: framework not found linphone
clang : error : linker command failed with exit code 1 (use -v to see invocation)
...
clang : error : linker command failed with exit code 1 (use -v to see invocation)
error MT5209 : Native linking error : framework not found linphone
MTOUCH : error MT5202: Native linking failed. Please review the build log.
3 Warning(s)
3 Error(s)
</code>```

I tried setting the Linker behaviour to 'Don't Link' and it built, but when I ran the app on the iPhone simulator, I received this exception:
System.DllNotFoundException: linphone.framework/linphone assembly: type: member:(null)

Anyone know how to get this project to run?

Body:
I am trying to use the Linphone Xamarin sample app with their self-hosted NuGet package (LinphoneSDK.Xamarin version 5.2.8) I have it working with Android, but for iOS, after removing the native package assemblies and adding the NuGET package to the project, I get errors when trying to build the project. I think these are the relevant lines from the build output:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -stdlib=libc++ -gdwarf-2 -std=c++14 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=9.0 -arch x86_64 -c -o /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.o -x objective-c++ -D MONOTOUCH -D DEBUG /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.m
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -framework CoreFoundation -framework Security -framework CFNetwork -framework QuickLook -framework SceneKit -framework OpenGLES -framework MediaPlayer -framework ImageIO -framework GLKit -framework WebKit -framework Foundation -framework CoreText -framework CoreSpotlight -framework CoreGraphics -framework CoreData -framework QuartzCore -framework CloudKit -framework UIKit -framework GSS -weak_framework Intents -weak_framework linphone /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.o /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libxamarin-debug.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmono-native-compat.a -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libapp.a -Wl,-pie -arch x86_64 -gdwarf-2 -std=c++14 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=9.0 -lz -liconv -lz -o /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/bin/iPhoneSimulator/Debug/LinphoneXamarin.iOS.app/LinphoneXamarin.iOS -u _SystemNative_ConvertErrorPlatformToPal -u _SystemNative_ConvertErrorPalToPlatform -u _SystemNative_StrErrorR -u _SystemNative_GetNonCryptographicallySecureRandomBytes -u _SystemNative_GetReadDirRBufferSize -u _SystemNative_ReadLink -u _SystemNative_Stat2 -u _SystemNative_LStat2 -u _SystemNative_Symlink -u _SystemNative_CopyFile -u _SystemNative_GetEGid -u _SystemNative_GetEUid -u _SystemNative_Link -u _SystemNative_MkDir -u _SystemNative_Rename -u _SystemNative_Unlink -u _SystemNative_OpenDir -u _SystemNative_ReadDirR -u _SystemNative_CloseDir -u _xamarin_timezone_get_local_name -u _xamarin_timezone_get_data -u _xamarin_GetFolderPath -u _xamarin_log -u _NetSecurityNative_ReleaseGssBuffer -u _NetSecurityNative_DisplayMinorStatus -u _NetSecurityNative_DisplayMajorStatus -u _NetSecurityNative_ImportUserName -u _NetSecurityNative_ImportPrincipalName -u _NetSecurityNative_ReleaseName -u _NetSecurityNative_InitiateCredSpNego -u _NetSecurityNative_InitiateCredWithPassword -u _NetSecurityNative_ReleaseCred -u _NetSecurityNative_InitSecContext -u _NetSecurityNative_DeleteSecContext -u _xamarin_start_wwan -u _xamarin_release_managed_ref -u _xamarin_set_gchandle_with_flags_safe -u _xamarin_UIApplicationMain -u _xamarin_find_protocol_wrapper_type -u _xamarin_release_block_on_main_thread -u _xamarin_get_block_descriptor -u _xamarin_IntPtr_objc_msgSend_IntPtr_exception -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_exception -u _mono_pmip -u _xamarin_dyn_objc_msgSend -u _xamarin_dyn_objc_msgSendSuper -u _xamarin_dyn_objc_msgSend_stret -u _xamarin_dyn_objc_msgSendSuper_stret
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -framework CoreFoundation -framework Security -framework CFNetwork -framework QuickLook -framework SceneKit -framework OpenGLES -framework MediaPlayer -framework ImageIO -framework GLKit -framework WebKit -framework Foundation -framework CoreText -framework CoreSpotlight -framework CoreGraphics -framework CoreData -framework QuartzCore -framework CloudKit -framework UIKit -framework GSS -weak_framework Intents -weak_framework linphone /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/main.o /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libxamarin-debug.a /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libmono-native-compat.a -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/lib/libapp.a -Wl,-pie -arch x86_64 -gdwarf-2 -std=c++14 -I/Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/SDKs/MonoTouch.iphonesimulator.sdk/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -Qunused-arguments -fobjc-legacy-dispatch -fobjc-abi-version=2 -mios-simulator-version-min=9.0 -lz -liconv -lz -o /Users/user/Documents/linphone-xamarin/Xamarin/Xamarin/Xamarin.iOS/bin/iPhoneSimulator/Debug/LinphoneXamarin.iOS.app/LinphoneXamarin.iOS -u _SystemNative_ConvertErrorPlatformToPal -u _SystemNative_ConvertErrorPalToPlatform -u _SystemNative_StrErrorR -u _SystemNative_GetNonCryptographicallySecureRandomBytes -u _SystemNative_GetReadDirRBufferSize -u _SystemNative_ReadLink -u _SystemNative_Stat2 -u _SystemNative_LStat2 -u _SystemNative_Symlink -u _SystemNative_CopyFile -u _SystemNative_GetEGid -u _SystemNative_GetEUid -u _SystemNative_Link -u _SystemNative_MkDir -u _SystemNative_Rename -u _SystemNative_Unlink -u _SystemNative_OpenDir -u _SystemNative_ReadDirR -u _SystemNative_CloseDir -u _xamarin_timezone_get_local_name -u _xamarin_timezone_get_data -u _xamarin_GetFolderPath -u _xamarin_log -u _NetSecurityNative_ReleaseGssBuffer -u _NetSecurityNative_DisplayMinorStatus -u _NetSecurityNative_DisplayMajorStatus -u _NetSecurityNative_ImportUserName -u _NetSecurityNative_ImportPrincipalName -u _NetSecurityNative_ReleaseName -u _NetSecurityNative_InitiateCredSpNego -u _NetSecurityNative_InitiateCredWithPassword -u _NetSecurityNative_ReleaseCred -u _NetSecurityNative_InitSecContext -u _NetSecurityNative_DeleteSecContext -u _xamarin_start_wwan -u _xamarin_release_managed_ref -u _xamarin_set_gchandle_with_flags_safe -u _xamarin_UIApplicationMain -u _xamarin_find_protocol_wrapper_type -u _xamarin_release_block_on_main_thread -u _xamarin_get_block_descriptor -u _xamarin_IntPtr_objc_msgSend_IntPtr_exception -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_exception -u _mono_pmip -u _xamarin_dyn_objc_msgSend -u _xamarin_dyn_objc_msgSendSuper -u _xamarin_dyn_objc_msgSend_stret -u _xamarin_dyn_objc_msgSendSuper_stret
ld: framework not found linphone
clang : error : linker command failed with exit code 1 (use -v to see invocation)
...
clang : error : linker command failed with exit code 1 (use -v to see invocation)
error MT5209 : Native linking error : framework not found linphone
MTOUCH : error MT5202: Native linking failed. Please review the build log.
3 Warning(s)
3 Error(s)

I tried setting the Linker behaviour to 'Don't Link' and it built, but when I ran the app on the iPhone simulator, I received this exception:
System.DllNotFoundException: linphone.framework/linphone assembly: type: member:(null)

Anyone know how to get this project to run?


问:
How can I run Docker inside a GitHub runner using a container?
I've been working on a GitHub workflow that uses a container, one of the steps runs a server within another container, however I'm unable to access that server from within the GitHub runner container.

Below is a stripped down workflow that demonstrates the problem:

name: Reproduce Error

on:
  push:
    branches:
      - "main"

  workflow_dispatch:

jobs:
  reproduce_error:
    runs-on: 'ubuntu-22.04'
    container:
      image: 'ubuntu:22.04'
    steps:
      - name: install dependencies
        run: |
          apt-get update -y

          # install docker following https://docs.docker.com/engine/install/ubuntu/
          apt-get install -y \
            ca-certificates \
            curl \
            gnupg \
            lsb-release
          mkdir -p /etc/apt/keyrings
          curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
          echo \
            "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
            $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
          apt-get update -y
          apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

          apt-get install -y jq
      - name: reproduce error
        run: |
          docker run -d --rm --name tmp -p 8080:8080 hashicorp/http-echo -listen=0.0.0.0:8080 -text="hello world"
          docker container inspect tmp | jq -r '.[0].NetworkSettings.Networks.bridge.IPAddress'
          set -x
          # localhost
          curl -sS localhost:8080 || true
          # docker host
          curl -sS tmp:8080 || true
          # docker ip
          curl -sS $(docker container inspect tmp | jq -r '.[0].NetworkSettings.Networks.bridge.IPAddress'):8080 || true
          docker ps
          docker stop tmp
          set +x
```

In the above workflow, I try 3 endpoints localhost:8080, tmp:8080, <server ip>:8080, but none of them seem to work I get the following errors:

localhost:8080 Failed to connect to localhost port 8080 after 0 ms: Connection refused

tmp:8080 curl: (6) Could not resolve host: tmp

<server ip>:8080 curl: (28) Failed to connect to 172.17.0.2 port 8080 after 130350 ms: Connection timed out

The way I understand things is:
There are 3 layers:

The GitHub runner (non-container actions run all their steps directly on the runner)

The GitHub runner container (this is the level my steps are using, e.g. dependencies are being installed into this machine)

The hashicorp/http-echo server (this just runs a server listening on port 8080)

The container forwards ports to the server (in the docker run ... line) so I'd expect to access it via localhost:8080 but that doesn't work.
So I thought maybe there's some weirdness with mounting the docker socket to the container (by the runner) so containers aren't children but more like peers, in that case tmp:8080 or <server ip>:8080 (if the docker network doesn't support dns) would work (the fact I don't need to start a docker daemon in the container would suggest there is some weirdness here, but I don't know exactly what's going on or if this should even affect what I'm trying to do).

How can I access the hashicorp/http-echo server from within the GitHub runner container (where the rest of the steps run)?

Body:
I've been working on a GitHub workflow that uses a container, one of the steps runs a server within another container, however I'm unable to access that server from within the GitHub runner container.

Below is a stripped down workflow that demonstrates the problem:

name: Reproduce Error

on:
  push:
    branches:
      - "main"

  workflow_dispatch:

jobs:
  reproduce_error:
    runs-on: 'ubuntu-22.04'
    container:
      image: 'ubuntu:22.04'
    steps:
      - name: install dependencies
        run: |
          apt-get update -y

          # install docker following https://docs.docker.com/engine/install/ubuntu/
          apt-get install -y \
            ca-certificates \
            curl \
            gnupg \
            lsb-release
          mkdir -p /etc/apt/keyrings
          curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
          echo \
            "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
            $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
          apt-get update -y
          apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

          apt-get install -y jq
      - name: reproduce error
        run: |
          docker run -d --rm --name tmp -p 8080:8080 hashicorp/http-echo -listen=0.0.0.0:8080 -text="hello world"
          docker container inspect tmp | jq -r '.[0].NetworkSettings.Networks.bridge.IPAddress'
          set -x
          # localhost
          curl -sS localhost:8080 || true
          # docker host
          curl -sS tmp:8080 || true
          # docker ip
          curl -sS $(docker container inspect tmp | jq -r '.[0].NetworkSettings.Networks.bridge.IPAddress'):8080 || true
          docker ps
          docker stop tmp
          set +x

In the above workflow, I try 3 endpoints localhost:8080, tmp:8080, <server ip>:8080, but none of them seem to work I get the following errors:

localhost:8080 Failed to connect to localhost port 8080 after 0 ms: Connection refused

tmp:8080 curl: (6) Could not resolve host: tmp

<server ip>:8080 curl: (28) Failed to connect to 172.17.0.2 port 8080 after 130350 ms: Connection timed out

The way I understand things is:
There are 3 layers:

The GitHub runner (non-container actions run all their steps directly on the runner)

The GitHub runner container (this is the level my steps are using, e.g. dependencies are being installed into this machine)

The hashicorp/http-echo server (this just runs a server listening on port 8080)

The container forwards ports to the server (in the docker run ... line) so I'd expect to access it via localhost:8080 but that doesn't work.
So I thought maybe there's some weirdness with mounting the docker socket to the container (by the runner) so containers aren't children but more like peers, in that case tmp:8080 or <server ip>:8080 (if the docker network doesn't support dns) would work (the fact I don't need to start a docker daemon in the container would suggest there is some weirdness here, but I don't know exactly what's going on or if this should even affect what I'm trying to do).

How can I access the hashicorp/http-echo server from within the GitHub runner container (where the rest of the steps run)?


问:
Cannot start SQLEXPRESS service
I'm using Visual Studio 2022 and with EF 6.0.12 I'm trying a code first approach to create a database schema.

I've installed SQL SERVER EXPRESS 2019 LocalDB with Visual Studio Installer and it is showed on the individual components list.

Using SQL Server Object Explorer I tried to connect to MSSQQLLocalDB which has appeared in the list.

```<code>ServerName: (localdb)\MSSQLLocalDB
Authentication: Windows Authentication
</code>```

But when I clicked on connect this error appears:

TITLE: Error

A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 50 - Local Database Runtime error occurred.
Errore durante l'avvio dell'istanza di Local DB: avvio del processo di
SQL Server non riuscito. ) (Microsoft SQL Server, Error: -1983577846)

WHAT I'VE TRIED SO FAR:

I've run services.msc, selected SQL Server (SQLEXPRESS) service and checked ```Local System Account" under Log On and tried to start manually the service.</li>
</ol>
<p><strong>Output: ERROR 1067: The process terminated unexpetctedly</strong></p>
<ol start="2">
<li>Using SQL server configuration manager -> SQL Server Network Configuration -> Protocols for SQLEXPRESS I've enabled the TCP/IP option and set IpAll -> TCP PORT to 1433.</li>
</ol>
<p>But after a restart the service is not starting.</p>
<ol start="3">
<li>I've tried to uninstall SQL SERVER EXPRESS LOCALDB 2019 with Visual Studio and manually install it downloading from the Windows website.</li>
</ol>
<p>But the installation crashed and in the log folder I found this:</p>
```2023-01-11 19:46:21.42 spid10s     There have been 256 misaligned log IOs which required falling back to synchronous IO.  The current IO is on file C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS01\MSSQL\Template Data\master.mdf.
```
<p>Tbh I think my system is far beyond the requirements, so I really don't get why I have encountered so many problems for a simple local installation.</p>
<hr />
<p>EDIT:</p>
<p>THis is the log from the Event Viewer</p>
<blockquote>
<p>Faulting application name: sqlservr.exe, version: 0.0.0.0, time stamp:
0x00000000 Faulting module name: unknown, version: 0.0.0.0, time
stamp: 0x00000000 Exception code: 0xc0000005 Fault offset:
0x00007fffc3bf0093 Faulting process id: 0x0x3B08 Faulting application
start time: 0x0x1D925FC511425F6 Faulting application path: C:\Program
Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\Binn\sqlservr.exe
Faulting module path: unknown Report Id:
48180913-b884-47ae-9396-470014ebcbc4 Faulting package full name:
Faulting package-relative application ID:</p>
</blockquote>
<p>EDIT 2:</p>
<p><strong>fsutil fsinfo sectorinfo C:</strong> command result</p>
```LogicalBytesPerSector :                                 512
PhysicalBytesPerSectorForAtomicity :                    4096
PhysicalBytesPerSectorForPerformance :                  16384
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
Device Alignment :                                      Aligned (0x000)
Partition alignment on device :                         Aligned (0x000)
No Seek Penalty
Trim Supported
Not DAX capable
Not Thinly-Provisioned
```

PARTIALLY RESOLVED :

I've installed SQL SERVER on another memory.

The original memory was a Crucial P2 CT500P2SSD8 SSD

Title: Cannot start SQLEXPRESS service

Body:
I'm using Visual Studio 2022 and with EF 6.0.12 I'm trying a code first approach to create a database schema.

I've installed SQL SERVER EXPRESS 2019 LocalDB with Visual Studio Installer and it is showed on the individual components list.

Using SQL Server Object Explorer I tried to connect to MSSQQLLocalDB which has appeared in the list.

ServerName: (localdb)\MSSQLLocalDB
Authentication: Windows Authentication

But when I clicked on connect this error appears:

TITLE: Error

A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 50 - Local Database Runtime error occurred.
Errore durante l'avvio dell'istanza di Local DB: avvio del processo di
SQL Server non riuscito. ) (Microsoft SQL Server, Error: -1983577846)

WHAT I'VE TRIED SO FAR:

I've run services.msc, selected SQL Server (SQLEXPRESS) service and checked ```Local System Account" under Log On and tried to start manually the service.

Output: ERROR 1067: The process terminated unexpetctedly

Using SQL server configuration manager -> SQL Server Network Configuration -> Protocols for SQLEXPRESS I've enabled the TCP/IP option and set IpAll -> TCP PORT to 1433.

But after a restart the service is not starting.

I've tried to uninstall SQL SERVER EXPRESS LOCALDB 2019 with Visual Studio and manually install it downloading from the Windows website.

But the installation crashed and in the log folder I found this:

2023-01-11 19:46:21.42 spid10s     There have been 256 misaligned log IOs which required falling back to synchronous IO.  The current IO is on file C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS01\MSSQL\Template Data\master.mdf.

Tbh I think my system is far beyond the requirements, so I really don't get why I have encountered so many problems for a simple local installation.

EDIT:

THis is the log from the Event Viewer

Faulting application name: sqlservr.exe, version: 0.0.0.0, time stamp:
0x00000000 Faulting module name: unknown, version: 0.0.0.0, time
stamp: 0x00000000 Exception code: 0xc0000005 Fault offset:
0x00007fffc3bf0093 Faulting process id: 0x0x3B08 Faulting application
start time: 0x0x1D925FC511425F6 Faulting application path: C:\Program
Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\Binn\sqlservr.exe
Faulting module path: unknown Report Id:
48180913-b884-47ae-9396-470014ebcbc4 Faulting package full name:
Faulting package-relative application ID:

EDIT 2:

fsutil fsinfo sectorinfo C: command result

LogicalBytesPerSector :                                 512
PhysicalBytesPerSectorForAtomicity :                    4096
PhysicalBytesPerSectorForPerformance :                  16384
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
Device Alignment :                                      Aligned (0x000)
Partition alignment on device :                         Aligned (0x000)
No Seek Penalty
Trim Supported
Not DAX capable
Not Thinly-Provisioned

PARTIALLY RESOLVED :

I've installed SQL SERVER on another memory.

The original memory was a Crucial P2 CT500P2SSD8 SSD


问:
How should I block all requests except those whose host headers match a regex?
I have a cloudfront distribution with two DNS names that I use to access it, as well as the *.cloudfront.net one that Amazon creates.

I'd like to block all these requests to *.cloudfront.net (we're getting lots of drivebys looking for Wordpress admin panels and it causes worrying looking 502s), and come to think of it I'd really prefer to only-allow those requests that are using my host headers.

My DefaultAction is set to Allow and I don't want to change that.

So I can create a AWS::WAFv2::RegexPatternSet:

```<code>  WebACLBlockededHostHeaderList
    Type: AWS::WAFv2::RegexPatternSet
    Properties:
      Description: !Sub ${AWS::StackName} WebACL allowed host headers
      RegularExpressionList:
        - '\.(mymaindomain\.net|myotherdomain\.com)$'
      Scope: CLOUDFRONT
</code>```

But my WebACL's DefaultAction is Allow, so to use this in a rule I need to either invert this match or put it in a context where the DefaultAction is block and this can create an exception; I can't think of a way to just invert that match using the Regex functions in AWS.

Reading the docs on RuleGroups:

https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-groups.html

I think I should be able to create a RuleGroup that blocks by default, and use this Rule to Allow those requests that match the rule:

Rule groups don't have default actions. In a web ACL, you set a default action for each rule or rule group that you include. Each individual rule inside a rule group or web ACL has an action defined.

But the docs for a WebACL rule suggest that I don't set the default Action, I can only override the action in the rule:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-webacl-rule.html#cfn-wafv2-webacl-rule-overrideaction

And cfn-lint agrees with the WebACL docs. So I think the rightest way here is probably to have two Rules in my RuleGroup, one which blocks everything, and another which allows those requests that match these regexes.

This feels like a really roundabout way to do this (I was expecting just a single rule). Am I missing something?

Body:
I have a cloudfront distribution with two DNS names that I use to access it, as well as the *.cloudfront.net one that Amazon creates.

I'd like to block all these requests to *.cloudfront.net (we're getting lots of drivebys looking for Wordpress admin panels and it causes worrying looking 502s), and come to think of it I'd really prefer to only-allow those requests that are using my host headers.

My DefaultAction is set to Allow and I don't want to change that.

So I can create a AWS::WAFv2::RegexPatternSet:

  WebACLBlockededHostHeaderList
    Type: AWS::WAFv2::RegexPatternSet
    Properties:
      Description: !Sub ${AWS::StackName} WebACL allowed host headers
      RegularExpressionList:
        - '\.(mymaindomain\.net|myotherdomain\.com)$'
      Scope: CLOUDFRONT

But my WebACL's DefaultAction is Allow, so to use this in a rule I need to either invert this match or put it in a context where the DefaultAction is block and this can create an exception; I can't think of a way to just invert that match using the Regex functions in AWS.

Reading the docs on RuleGroups:

https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-groups.html

I think I should be able to create a RuleGroup that blocks by default, and use this Rule to Allow those requests that match the rule:

Rule groups don't have default actions. In a web ACL, you set a default action for each rule or rule group that you include. Each individual rule inside a rule group or web ACL has an action defined.

But the docs for a WebACL rule suggest that I don't set the default Action, I can only override the action in the rule:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-webacl-rule.html#cfn-wafv2-webacl-rule-overrideaction

And cfn-lint agrees with the WebACL docs. So I think the rightest way here is probably to have two Rules in my RuleGroup, one which blocks everything, and another which allows those requests that match these regexes.

This feels like a really roundabout way to do this (I was expecting just a single rule). Am I missing something?


问:
Why does my server automatically serve routes with trailing "/api"
I have a very strange observation working on a project.

I have a server.js file with express.js code:

```<code>const express = require('express')
const app = express()
const port = 3000

app.get('/abc', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.lhttps://runkit.com/embed/saveog(`Example app listening on port ${port}`)
})
</code>```

Locally, it worked just fine, meaning that I got the response by going to "localhost:3001/abc". However, when I pushed it to the ec2 server, somehow, when I tried to access the URL on the browser by typing "xxx.com/abc", I got 404 not found. But when I type "xxx.com/api/abc", I got the "Hello World!" response, I wonder why this is happening.

I tried finding the settings of the server base URL but I couldn't find relevant information

I am helping a NGO to maintain their server and website developed by a vendor so I am not sure what configurations they added to the server

Body:
I have a very strange observation working on a project.

I have a server.js file with express.js code:

const express = require('express')
const app = express()
const port = 3000

app.get('/abc', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.lhttps://runkit.com/embed/saveog(`Example app listening on port ${port}`)
})

Locally, it worked just fine, meaning that I got the response by going to "localhost:3001/abc". However, when I pushed it to the ec2 server, somehow, when I tried to access the URL on the browser by typing "xxx.com/abc", I got 404 not found. But when I type "xxx.com/api/abc", I got the "Hello World!" response, I wonder why this is happening.

I tried finding the settings of the server base URL but I couldn't find relevant information

I am helping a NGO to maintain their server and website developed by a vendor so I am not sure what configurations they added to the server


问:
Promise.all() taking a long time to resolve
Here is my sample code that is making many parallel writes to Firestore.

```<code>const admin = require('firebase-admin');

admin.initializeApp({credential: admin.credential.applicationDefault()});
const db = admin.firestore();

const main = async () => {
    // Gather up documents and write to new app subcollection
    startTimeMs = Date.now();
    let commits = [];
    let doc = {abc: "def"};
    let total = 10;
    for (let i=0; i<total; i++) {
        commits.push(db.collection(`/test`).add(doc));
    }
    const bar = await Promise.all(commits);
    console.log(bar);
    const count = await db.collection(`/test`).count().get();
    console.log("count", count);
};

(async () => {
    await main();
})();

</code>```

I tried total=10, 100, 1000.

When total is small (< 500), this code resolves quickly. However when total>500, this code takes a long time to finish.

In both cases, console.log("count", count); gets executed fairly quickly and shows the right number of documents (doesn't seem like some promises are failing). But when total > 500, the main function takes a lot longer to finish running.

I was expecting for all cases, the function would finish after executing the last line.

Body:
Here is my sample code that is making many parallel writes to Firestore.

const admin = require('firebase-admin');

admin.initializeApp({credential: admin.credential.applicationDefault()});
const db = admin.firestore();

const main = async () => {
    // Gather up documents and write to new app subcollection
    startTimeMs = Date.now();
    let commits = [];
    let doc = {abc: "def"};
    let total = 10;
    for (let i=0; i<total; i++) {
        commits.push(db.collection(`/test`).add(doc));
    }
    const bar = await Promise.all(commits);
    console.log(bar);
    const count = await db.collection(`/test`).count().get();
    console.log("count", count);
};

(async () => {
    await main();
})();

I tried total=10, 100, 1000.

When total is small (< 500), this code resolves quickly. However when total>500, this code takes a long time to finish.

In both cases, console.log("count", count); gets executed fairly quickly and shows the right number of documents (doesn't seem like some promises are failing). But when total > 500, the main function takes a lot longer to finish running.

I was expecting for all cases, the function would finish after executing the last line.


问:
Can you interact with python from R Studio?
Is it possible to mix R with python. I've always have had curiosity for this languaje so it might be interesting to try it too.

Just trying to discover


问:
How to work with Unity and Text Mesh Pro or why are the canvas so huge?
My first steps with a tuturial for Unity and the try to add an UI led me to Text Mesh Pro.

Adding it was quite easy but using it this way can't be intended?!
The Canvas object in the scene view is so huge and can not be adjusted.

To see the text I have to zoom out 100x

How do you work with it? Switching between UI view and game object alone is too cumbersome. Not to mention the non-existent overview of game-objects and UI Text.


问:
Adding a legend using ggplot2 with multiple lines?
I am trying to add a legend to my graph. How would I do this in the case with multiple lines? Calgary would be red, edmonton blue, ect. Thanks.</p>
```<code>library(ggplot2)

Year = c(2018, 2019, 2020, 2021, 2022)
Calgary = c(128, 121, 109, 76, 142)
Edmonton = c(118, 139, 158, 161, 120)
Lethbridge = c(16, 6, 19, 8, 21)
Red_Deer = c(17, 12, 13, 10, 10)
Maskwacis = c(9, 9, 10, 9, 5)
cities <- as.data.frame(cbind(Year,Calgary,Edmonton,Lethbridge,Red_Deer,Maskwacis))
ggplot(cities, aes(Year)) +
  geom_line(aes(y = Calgary),col ="red") +
  geom_line(aes(y = Edmonton),col ="blue")+
  geom_line(aes(y = Lethbridge),col ="yellow")+
  geom_line(aes(y = Red_Deer),col ="green")+
  geom_line(aes(y = Maskwacis),col ="purple")+
  labs(title = "Geographic Distribution", x = "Year", y = "Geographical Area")
</code>```

Body:
I am trying to add a legend to my graph. How would I do this in the case with multiple lines? Calgary would be red, edmonton blue, ect. Thanks.

library(ggplot2)

Year = c(2018, 2019, 2020, 2021, 2022)
Calgary = c(128, 121, 109, 76, 142)
Edmonton = c(118, 139, 158, 161, 120)
Lethbridge = c(16, 6, 19, 8, 21)
Red_Deer = c(17, 12, 13, 10, 10)
Maskwacis = c(9, 9, 10, 9, 5)
cities <- as.data.frame(cbind(Year,Calgary,Edmonton,Lethbridge,Red_Deer,Maskwacis))
ggplot(cities, aes(Year)) +
  geom_line(aes(y = Calgary),col ="red") +
  geom_line(aes(y = Edmonton),col ="blue")+
  geom_line(aes(y = Lethbridge),col ="yellow")+
  geom_line(aes(y = Red_Deer),col ="green")+
  geom_line(aes(y = Maskwacis),col ="purple")+
  labs(title = "Geographic Distribution", x = "Year", y = "Geographical Area")


问:
Vaultwarden in Docker swarm with persistent storage on each worker node, issue
I have 4 nodes - one is manager and three are workers. On my three worker nodes I have configured lsyncd with rsync -u flag (so it is not syncing data if on the remote folder the version of file is newer) and delete=false. The daemon syncs /home/user/mydocker/vaultwarden/data across all worker nodes bidirectional. Syncing works stunning (I also tried with GlusterFS).

My idea is having only one replica on my worker node, and in case of failure Docker swarm gets UP a service on another node, and with synced information I should get the same copy of Vaultwarden with data inside. And it works with one exception - seems that once, for example, when I reboot the node, where service is, Docker redeploys the container on another node and it gets the data from some kinda cache which replaces all the data on my synced folder and since there the data has newer version, lsyncd syncs data to the other nodes. So, in this case I get a clear Vaultwarden without any data or if there was some data before it restores to the previous version. BUT if I manually get up the Vaultwarden with docker compose and then turn off the node (simulate a failure for example) and making the service UP on another node with docker compose, all works like a charm - the data persists and syncs without any problems.

My yaml config for the deploy:

```<code>version: '3'
services:
  vaultwarden:
    image: vaultwarden/server:latest
    environment:
      - ADMIN_TOKEN=XXXXXXXXXXXXX
      - SIGNUPS_ALLOWED=true
    volumes:
       - /home/user/mydocker/vaultwarden/data:/data
    ports:
     - "8877:80"
    deploy:
      placement:
        constraints:
          - "node.role==worker
      mode: replicated
      replicas: 1
</code>```

Body:
I have 4 nodes - one is manager and three are workers. On my three worker nodes I have configured lsyncd with rsync -u flag (so it is not syncing data if on the remote folder the version of file is newer) and delete=false. The daemon syncs /home/user/mydocker/vaultwarden/data across all worker nodes bidirectional. Syncing works stunning (I also tried with GlusterFS).

My idea is having only one replica on my worker node, and in case of failure Docker swarm gets UP a service on another node, and with synced information I should get the same copy of Vaultwarden with data inside. And it works with one exception - seems that once, for example, when I reboot the node, where service is, Docker redeploys the container on another node and it gets the data from some kinda cache which replaces all the data on my synced folder and since there the data has newer version, lsyncd syncs data to the other nodes. So, in this case I get a clear Vaultwarden without any data or if there was some data before it restores to the previous version. BUT if I manually get up the Vaultwarden with docker compose and then turn off the node (simulate a failure for example) and making the service UP on another node with docker compose, all works like a charm - the data persists and syncs without any problems.

My yaml config for the deploy:

version: '3'
services:
  vaultwarden:
    image: vaultwarden/server:latest
    environment:
      - ADMIN_TOKEN=XXXXXXXXXXXXX
      - SIGNUPS_ALLOWED=true
    volumes:
       - /home/user/mydocker/vaultwarden/data:/data
    ports:
     - "8877:80"
    deploy:
      placement:
        constraints:
          - "node.role==worker
      mode: replicated
      replicas: 1


问:
Create multiple onclick events inside a for loop inside style tag
in my code

the length of playersTeam1 is 2

```<code>players = {
    points_id: 'player-points-1',
    assists_id: 'player-assists-1',
    rebounds_id: 'player-rebounds-1',
    fouls_id: 'player-fouls-1',
    points_button: 'button-points-1',
    assists_button: 'button-assists-1',
    rebounds_button: 'button-rebounds-1',
    fouls_button: 'button-fouls-1'
 }
</code>```

html

```<code><% for(var i=0; i < players.length; i++) { %>
   <tr>
       <td>
          <%= i + 1 %>
       </td>
       <td>
          <div class="grid grid-flow-row auto-rows-max pt-3 text-xs">
            <div class="font-bold text-base">
               B. Danialian
           </div>
           <div>
              <span id=<%=players[i].points_id %>>.
             <%=players[i].points %></span> Pts •
            </div>
        </td>
        <td>
           <div class="pt-4 flex justify-start">
              <button class="mr-2 px-10 py-3 bg-blue-900 rounded-lg text-xl flex justify-center text-gray-100"
                 id=<%= players[i].points_button %>>
                   ↑
              </button>

            </div>
         </td>
<% } %>
</code>```

javascript

```<code><script type="module">
  export function inc(id) {
     var g = document.getElementById(id).innerHTML;
     document.getElementById(id).innerHTML = parseInt(g) + 1;
  }

  for (var i = 0; i < playersTeam1.length; i++) {
    document.getElementById("button-points-" + i).onclick = function () {
      inc("player-points-" + i)
    }
  }
</script>
</code>```

Whenever I click the button, somehow the player-points-i is equal to 2, when the playersTeam1 is 2, so the max number should be 1.

What is the reason for this? And is there a way to not have this happen?

Is there another way to create multiple onclick getElementById()s in a for loop. I need a for loop because the amount of players is dynamic depending on the team.

Body:
in my code

the length of playersTeam1 is 2

players = {
    points_id: 'player-points-1',
    assists_id: 'player-assists-1',
    rebounds_id: 'player-rebounds-1',
    fouls_id: 'player-fouls-1',
    points_button: 'button-points-1',
    assists_button: 'button-assists-1',
    rebounds_button: 'button-rebounds-1',
    fouls_button: 'button-fouls-1'
 }

html

<% for(var i=0; i < players.length; i++) { %>

          <%= i + 1 %>

               B. Danialian

              <span id=<%=players[i].points_id %>>.
             <%=players[i].points %> Pts •

              <button class="mr-2 px-10 py-3 bg-blue-900 rounded-lg text-xl flex justify-center text-gray-100"
                 id=<%= players[i].points_button %>>
                   ↑
              </button>

<% } %>

javascript

Whenever I click the button, somehow the player-points-i is equal to 2, when the playersTeam1 is 2, so the max number should be 1.

What is the reason for this? And is there a way to not have this happen?

Is there another way to create multiple onclick getElementById()s in a for loop. I need a for loop because the amount of players is dynamic depending on the team.


问:
SSAS : Errors in the metadata file - error trying to update cube in a system table 'DataSource'
A few days ago, we started having an error with the processing in our cube. The cube is being processed by the job and returns the error:

The following system error occurred: Invalid data. Failed to decrypt
sensitive data. Possibly the encryption key does not match or is
inaccessible due to improper service account change. The current
operation was canceled because another operation on the transaction
failed.    (Microsoft.AnalysisServices.Core)

In this instance we have other cubes working correctly.
We verified that this cube is the only one that does not have credentials. We've already tried to add the credentials by refreshing credentials and via the script, and for the first solution we don't have any errors, but it doesn't continue without changing anything. By the second solution we get the error:

Failed to encrypt sensitive data. Possibly the encryption key is
inaccessible due to improper service account change. An error occurred
while trying to update a row in a system table 'DataSource' in the
metadata database.

Anyone have a similar error?

Thanks in advance.


问:
What is the difference between cc26x0-cc13x0 platform and simplelink platform in Contiki-NG
I am really confused with the contiki-NG platform naming. I am new to contiki-NG so after reading their docummentation i bought the CC2650 LaunchPad.

I decided to build the BLE-IPV6 examples in examples/platform-specific/cc26x0-cc13x0/ble-ipv6 but it doesn't work because it want board -> launchpad/cc2650 and platform -> cc26x0-cc13x0 but at the TI homepage the CC2650 LaunchPad is a simplelink.

The funny thing is if i build the project with

```<code>make TARGET=cc26x0-cc13x0 BOARD=launchpad/cc2650
</code>```

it compiles but doesn't run on the device.

What is the difference between the platform cc26x0-cc13x0 and simplelink ?

Body:
I am really confused with the contiki-NG platform naming. I am new to contiki-NG so after reading their docummentation i bought the CC2650 LaunchPad.

I decided to build the BLE-IPV6 examples in examples/platform-specific/cc26x0-cc13x0/ble-ipv6 but it doesn't work because it want board -> launchpad/cc2650 and platform -> cc26x0-cc13x0 but at the TI homepage the CC2650 LaunchPad is a simplelink.

The funny thing is if i build the project with

make TARGET=cc26x0-cc13x0 BOARD=launchpad/cc2650

it compiles but doesn't run on the device.

What is the difference between the platform cc26x0-cc13x0 and simplelink ?


问:
How to deal 'WSGIRequest' object has no attribute 'Get'
I am a django beginner even programming beginner this issue I have found one day still can not work out

views.py

```<code>from django.shortcuts import render, redirect
from django.template import loader
from .models import Topic
from django.contrib.auth.models import User
from .forms import TopicForm
# Create your views here.
def home(request):

    q = request.Get.get('q')
    topics = Topic.objects.filter(name__icontains=q)
    context = {'topics':topics}
    template = loader.get_template('home.html')
    return render(request, 'home.html', context)

</code>```

models.py

```<code>from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Topic(models.Model):
    name = models.CharField(max_length=200)
    description = models.TextField()
</code>```

home.html

```<code><body>
    {% include 'navbar.html' %}
    <div>
        <div>
            <h3>Topic</h3>
            {% for topic in topics %}

                <a href="{% url 'home' %}?q={{topic.name}}">{{topic.name}}</a>

            {% endfor %}
        </div>
    </div>
</body>
</code>```

I tried if statment still not work

Body:
I am a django beginner even programming beginner this issue I have found one day still can not work out

views.py

from django.shortcuts import render, redirect
from django.template import loader
from .models import Topic
from django.contrib.auth.models import User
from .forms import TopicForm
# Create your views here.
def home(request):

    q = request.Get.get('q')
    topics = Topic.objects.filter(name__icontains=q)
    context = {'topics':topics}
    template = loader.get_template('home.html')
    return render(request, 'home.html', context)

models.py

from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Topic(models.Model):
    name = models.CharField(max_length=200)
    description = models.TextField()

home.html

    {% include 'navbar.html' %}

Topic

            {% for topic in topics %}

                {{topic.name}}

            {% endfor %}

I tried if statment still not work