问:
ChromeDriver using via Tor proxy causing error SocketError: [WinError 10061]
I'm struggling to solve my issue with connection Chrome driver via TOR proxy in order to rotate my IP address every minute.

Here is my script:

```<code>import time

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from stem import Signal
from stem.control import Controller

def create_chrome_driver(use_tor=True):
    chrome_options = Options()

    # Set the location of the ChromeDriver executable
    chrome_driver_path = r'chromedriver'

    # Set the location of the TOR client
    tor_client_path = r'C:\Users\**\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe'

    # Use TOR as the proxy for the ChromeDriver instance
    if use_tor:
        chrome_options.add_argument('--proxy-server=socks5://localhost:9050')

    driver = webdriver.Chrome(
        executable_path=chrome_driver_path,
        options=chrome_options
    )
    return driver

def rotate_ip():
    # Restart the TOR client to rotate the IP address
    with Controller.from_port(port=9051) as controller:
        controller.authenticate()
        controller.signal(Signal.NEWNYM)
    # Print the current IP address
    driver.get('http://checkip.dyndns.org')
    print(driver.find_element_by_tag_name('body').text)

def main():
    # Create the ChromeDriver instance
    driver = create_chrome_driver()

    # Rotate the IP address every 60 seconds
    while True:
        rotate_ip()
        time.sleep(60)

if __name__ == '__main__':
    main()
</code>```

Everytime I run this script I get same error:
SocketError: [WinError 10061] No connection could be made because the target machine actively refused it.

I tried everyting:

actively open Tor connection

checked that Tor is using port 9051 (even manually set localhost port 9051)

firewall is not blocking Tor browser app.

What am I doing wrong?

Thanks for help!

Body:
I'm struggling to solve my issue with connection Chrome driver via TOR proxy in order to rotate my IP address every minute.

Here is my script:

import time

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from stem import Signal
from stem.control import Controller

def create_chrome_driver(use_tor=True):
    chrome_options = Options()

    # Set the location of the ChromeDriver executable
    chrome_driver_path = r'chromedriver'

    # Set the location of the TOR client
    tor_client_path = r'C:\Users\**\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe'

    # Use TOR as the proxy for the ChromeDriver instance
    if use_tor:
        chrome_options.add_argument('--proxy-server=socks5://localhost:9050')

    driver = webdriver.Chrome(
        executable_path=chrome_driver_path,
        options=chrome_options
    )
    return driver

def rotate_ip():
    # Restart the TOR client to rotate the IP address
    with Controller.from_port(port=9051) as controller:
        controller.authenticate()
        controller.signal(Signal.NEWNYM)
    # Print the current IP address
    driver.get('http://checkip.dyndns.org')
    print(driver.find_element_by_tag_name('body').text)

def main():
    # Create the ChromeDriver instance
    driver = create_chrome_driver()

    # Rotate the IP address every 60 seconds
    while True:
        rotate_ip()
        time.sleep(60)

if __name__ == '__main__':
    main()

Everytime I run this script I get same error:
SocketError: [WinError 10061] No connection could be made because the target machine actively refused it.

I tried everyting:

actively open Tor connection

checked that Tor is using port 9051 (even manually set localhost port 9051)

firewall is not blocking Tor browser app.

What am I doing wrong?

Thanks for help!


来源: stackexchange

问:
Idiomatic way of tracing an object through your system with `tracing`?
Context: event-driven system where objects go through a bunch of subsystems (Tokio architecture, communication over channels). I want to have spans that track the object through the system, from start to finish. Is the idiomatic way to do this just attaching a span to the object and entering / exiting it each time it arrives at a different subsystem?</p>

ContentLicense: CC BY-SA 4.0


问:
How to prevent that a draggable widget overflow it's parent in flutter
I'm trying to build a tool to create database models with flutter and I want that when I create a widget (that will be the representation of a table) it could be dragged just inside of it's parent, I don't want that the feedback overflow it's parent.

Here is the code that I have build:

```<code>class CreateTableTool extends StatefulWidget {
  const CreateTableTool({super.key});

  @override
  State<CreateTableTool> createState() => _CreateTableToolState();
}

class _CreateTableToolState extends State<CreateTableTool> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Draggable(
        feedback: Container(
          width: 100,
          height: 100,
          decoration: BoxDecoration(
            color: Colors.white,
            border: Border.all(color: Colors.red, width: 1)
          ),
        ),
        child: Container(
          width: 100,
          height: 100,
          decoration: BoxDecoration(
            color: Colors.white,
            border: Border.all(color: Colors.blue, width: 1)
          ),
        ),
      )
    );
  }
}
</code>```

This is the instance of the widget inside of the Dashboard statefull widget:

```<code>Widget MainControl = CreateTableTool();
</code>```

Here is where the widget is placed:

```<code>Column(
    crossAxisAlignment: CrossAxisAlignment.stretch,
    children: [
        Expanded(child: MainControl)
    ],
),
</code>```

Do you have some idea of how I could implement a camera zoom and movement only inside this widget as well?

Body:
I'm trying to build a tool to create database models with flutter and I want that when I create a widget (that will be the representation of a table) it could be dragged just inside of it's parent, I don't want that the feedback overflow it's parent.

Here is the code that I have build:

class CreateTableTool extends StatefulWidget {
  const CreateTableTool({super.key});

  @override
  State<CreateTableTool> createState() => _CreateTableToolState();
}

class _CreateTableToolState extends State<CreateTableTool> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Draggable(
        feedback: Container(
          width: 100,
          height: 100,
          decoration: BoxDecoration(
            color: Colors.white,
            border: Border.all(color: Colors.red, width: 1)
          ),
        ),
        child: Container(
          width: 100,
          height: 100,
          decoration: BoxDecoration(
            color: Colors.white,
            border: Border.all(color: Colors.blue, width: 1)
          ),
        ),
      )
    );
  }
}

This is the instance of the widget inside of the Dashboard statefull widget:

Widget MainControl = CreateTableTool();

Here is where the widget is placed:

Column(
    crossAxisAlignment: CrossAxisAlignment.stretch,
    children: [
        Expanded(child: MainControl)
    ],
),

Do you have some idea of how I could implement a camera zoom and movement only inside this widget as well?


问:
/etc/zshrc:7: command not found: locale
Every time I open the terminal in my Mac, I get the error
/etc/zshrc:7: command not found: locale .

when I type "printf '%s\n' $path"  i get:

```<code>/condabin
"/opt/homebrew/bin
/opt/homebrew/sbin${PATH+
$PATH}";

</code>```

It is possible that I have somehow totally messed up .zshrc and .zprofile in my system. also the .bash_profile dont even exist in my system

here are the content of these two files:

zprofile:

```<code>
# Setting PATH for Python 3.9
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
export PATHeval $(/opt/homebrew/bin/brew shellenv)

</code>```

zhrc:

```<code>
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/saman/miniforge3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/saman/miniforge3/etc/profile.d/conda.sh" ]; then
        . "/Users/saman/miniforge3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/saman/miniforge3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

</code>```

please help me as i am totally helpless and lost not knowing what any of these files do. There may be other threads that somewhat touch on this topic, but they have not messed up their paths the way i did i guess. thank you so much in advance

Title: /etc/zshrc:7: command not found: locale

Body:
Every time I open the terminal in my Mac, I get the error
/etc/zshrc:7: command not found: locale .

when I type "printf '%s\n' $path"  i get:

/condabin
"/opt/homebrew/bin
/opt/homebrew/sbin${PATH+
$PATH}";

It is possible that I have somehow totally messed up .zshrc and .zprofile in my system. also the .bash_profile dont even exist in my system

here are the content of these two files:

zprofile:

# Setting PATH for Python 3.9
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
export PATHeval $(/opt/homebrew/bin/brew shellenv)

zhrc:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/saman/miniforge3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/saman/miniforge3/etc/profile.d/conda.sh" ]; then
        . "/Users/saman/miniforge3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/saman/miniforge3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

please help me as i am totally helpless and lost not knowing what any of these files do. There may be other threads that somewhat touch on this topic, but they have not messed up their paths the way i did i guess. thank you so much in advance


问:
How to Using Oracle client OO4O in VB6
I have an vb6 application working using Oracle 10g which uses oo4o to connect with database.
Oracle 10g is installed on remote Database server.
But i don't know how to setting on client PC to run vb6 application.
(When I run it, it shows error msg "ora-12154 tns could not resolve service name")

Please help me the way (step by step) to setting on client PC to vb6 application can be connected to oracle database.

Regards

Title: How to Using Oracle client OO4O in VB6


问:
Calculate mean value between two dates
I'm trying to calculate the mean temperature between two dates in different ID groups. In this case, would I calculate the mean temperature from the first bud to the first opening bud, and then the mean temperature from the first opening bud to the first flower in all ID groups.

I have calculated the date for the first flowering event in R. Used this R-code:

```<code>growth <- df1 %>%
  group_by(CameraID) %>%
  filter(!duplicated(Vekst))
</code>```

enter image description here

I think that I have to go back to df1 to calculate the mean temperature from the first event to the next event.

Used this R-code to calculate the mean temperature. But do not know to add r-codes that calculate mean temperature between the first bud to the first opening bud, and then the mean temperature from the first opening bud to the first flower and so on for each group.

```<code>test <- dft%>%
  group_by(CameraID,Vekst) %>%
  summarize(temp_mean=mean(T2_mean,na.rm=T))%>%
  filter(!duplicated(Vekst))
</code>```

Title: Calculate mean value between two dates

Body:
I'm trying to calculate the mean temperature between two dates in different ID groups. In this case, would I calculate the mean temperature from the first bud to the first opening bud, and then the mean temperature from the first opening bud to the first flower in all ID groups.

I have calculated the date for the first flowering event in R. Used this R-code:

growth <- df1 %>%
  group_by(CameraID) %>%
  filter(!duplicated(Vekst))

enter image description here

I think that I have to go back to df1 to calculate the mean temperature from the first event to the next event.

Used this R-code to calculate the mean temperature. But do not know to add r-codes that calculate mean temperature between the first bud to the first opening bud, and then the mean temperature from the first opening bud to the first flower and so on for each group.

test <- dft%>%
  group_by(CameraID,Vekst) %>%
  summarize(temp_mean=mean(T2_mean,na.rm=T))%>%
  filter(!duplicated(Vekst))


问:
Trying to upload data from python to mysql, but the insertion is not commited
I'm trying to upload some rows of data from python to mysql, using django and mysql, as we also want to show data from the database in our webpage.

The connection to the server does work correctly, and so the connection to the database.

The problem comes when we execute the following query to insert data from python to mysql.

def addInfo(request, T, P, A, Rx, Ry, Rz, Ax, Ay, Az, Fecha, Long, Lat, Vel):
"""conexion = mysql.connector.connect(user='root', password='admin', host='localhost',
database='datos', port='3306')
print(conexion)
cursor = conexion.cursor()

```<code>print("T:"+str(T))"""

query = "use datos; INSERT INTO datos(Temperatura, Presion, Altitud, RotacionX, RotacionY, RotacionZ, AceleracionX, AceleracionY, AceleracionZ, Fecha, Longitud, Latitud, Velocidad) VALUES ('"+T+"','"+P+"','"+A+"','"+Rx+"','"+Ry+"','"+Rz+"','"+Ax+"','"+Ay+"','"+Az+"','"+Fecha+"','"+Long+"', '"+Lat+"', '"+Vel+"');"

print(query)

cursor.execute(query)

documento = """<!DOCTYPE html>
<html>
<head>
--HTML PART IS OMITTED--
</html>"""
print(cursor)
cursor.close()
return HttpResponse(documento)
</code>```

When we execute this code, database does not update rows, but when we execute manually in mysql, it does work and the id auto-increments as if we had uploaded the previous query. (but the previous row doesn't appear )

Body:
I'm trying to upload some rows of data from python to mysql, using django and mysql, as we also want to show data from the database in our webpage.

The connection to the server does work correctly, and so the connection to the database.

The problem comes when we execute the following query to insert data from python to mysql.

def addInfo(request, T, P, A, Rx, Ry, Rz, Ax, Ay, Az, Fecha, Long, Lat, Vel):
"""conexion = mysql.connector.connect(user='root', password='admin', host='localhost',
database='datos', port='3306')
print(conexion)
cursor = conexion.cursor()

print("T:"+str(T))"""

query = "use datos; INSERT INTO datos(Temperatura, Presion, Altitud, RotacionX, RotacionY, RotacionZ, AceleracionX, AceleracionY, AceleracionZ, Fecha, Longitud, Latitud, Velocidad) VALUES ('"+T+"','"+P+"','"+A+"','"+Rx+"','"+Ry+"','"+Rz+"','"+Ax+"','"+Ay+"','"+Az+"','"+Fecha+"','"+Long+"', '"+Lat+"', '"+Vel+"');"

print(query)

cursor.execute(query)

documento = """<!DOCTYPE html>

--HTML PART IS OMITTED--
"""
print(cursor)
cursor.close()
return HttpResponse(documento)

When we execute this code, database does not update rows, but when we execute manually in mysql, it does work and the id auto-increments as if we had uploaded the previous query. (but the previous row doesn't appear )


问:
LSTM Code Array Error: ValueError: cannot reshape array of size 64971 into shape (3609,2,9)
enter image description here

I am executing this code on python 3.x spyder enviroment but getting the same error from last month. Could anyone please check and guide me what I am doing wrong here? and how to remove this Array reshape error?


问:
Lucene 4.8 facets usage
I have difficulties understanding this example on how to use facets :
https://lucenenet.apache.org/docs/4.8.0-beta00008/api/Lucene.Net.Demo/Lucene.Net.Demo.Facet.SimpleFacetsExample.html

My goal is to create an index in which each document field have a facet, so that at search time i can choose which facets use to navigate data.

What i am confused about is setup of facets in index creation, to
summarize my question :  is index with facets compatibile with
ReferenceManager?

Need DirectoryTaxonomyWriter to be actually    written and persisted
on disk or it will embedded into the index    itself and is just
temporary? I mean given the code

indexWriter.AddDocument(config.Build(taxoWriter, doc)); of the

example i expect it's temporary and will be embedded into the index (but then the example also show you need the Taxonomy to drill down facet). So can the Taxonomy be tangled in some way with the index so that the are handled althogeter with ReferenceManager?

If is not may i just use the same    folder i use for storing index?

Here is a more detailed list of point that confuse me :

In my scenario i am indexing the document asyncrhonously (background process) and then fetching the indext ASAP throught ReferenceManager in ASP.NET application. I hope this way to fetch the index is compatibile with DirectoryTaxonomyWriter needed by facets.

Then i modified the code i write introducing the taxonomy writer as indicated in the example, but i am a bit confused, seems like i can't store DirectoryTaxonomyWriter into the same folder of index because the folder is locked, need i to persist it or it will be embedded into the index (so a RAMDirectory is enougth)? if i need to persist it in a different direcotry, can i safely persist it into subdirectory?

Here the code i am actually using :

```<code>    private static void BuildIndex (IndexEntry entry)
    {
        string targetFolder = ConfigurationManager.AppSettings["IndexFolder"] ?? string.Empty;

        //** LOG
        if (System.IO.Directory.Exists(targetFolder) == false)
        {
            string message = @"Index folder not found";
            _fileLogger.Error(message);
            _consoleLogger.Error(message);

            return;
        }

        var metadata = JsonConvert.DeserializeObject<IndexMetadata>(File.ReadAllText(entry.MetdataPath) ?? "{}");

        string[] header = new string[0];
        List<dynamic> csvRecords = new List<dynamic>();

        using (var reader = new StreamReader(entry.DataPath))
        {
            CsvConfiguration csvConfiguration = new CsvConfiguration(CultureInfo.InvariantCulture);
            csvConfiguration.AllowComments = false;
            csvConfiguration.CountBytes = false;
            csvConfiguration.Delimiter = ",";
            csvConfiguration.DetectColumnCountChanges = false;
            csvConfiguration.Encoding = Encoding.UTF8;
            csvConfiguration.HasHeaderRecord = true;
            csvConfiguration.IgnoreBlankLines = true;
            csvConfiguration.HeaderValidated = null;
            csvConfiguration.MissingFieldFound = null;
            csvConfiguration.TrimOptions = CsvHelper.Configuration.TrimOptions.None;
            csvConfiguration.BadDataFound = null;

            using (var csvReader = new CsvReader(reader, csvConfiguration))
            {
                csvReader.Read();
                csvReader.ReadHeader();
                csvReader.Read();
                header = csvReader.HeaderRecord;
                csvRecords = csvReader.GetRecords<dynamic>().ToList();
            }
        }

        string targetDirectory = Path.Combine(targetFolder, "Index__" + metadata.Boundle + "__" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "__" + Path.GetRandomFileName().Substring(0, 6));

        System.IO.Directory.CreateDirectory(targetDirectory);
        //** LOG
        {
            string message = @"..creating index : {0}";
            _fileLogger.Information(message, targetDirectory);
            _consoleLogger.Information(message, targetDirectory);
        }

        using (var dir = FSDirectory.Open(targetDirectory))
        {
            using (DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir))
            {
                Analyzer analyzer = metadata.GetAnalyzer();

                var indexConfig = new IndexWriterConfig(LuceneVersion.LUCENE_48, analyzer);

                using (IndexWriter writer = new IndexWriter(dir, indexConfig))
                {
                    long entryNumber = csvRecords.Count();
                    long index = 0;
                    long lastPercentage = 0;
                    foreach (dynamic csvEntry in csvRecords)
                    {
                        Document doc = new Document();
                        IDictionary<string, object> dynamicCsvEntry = (IDictionary<string, object>)csvEntry;
                        var indexedMetadataFiled = metadata.IdexedFields;

                        foreach (string headField in header)
                        {
                            if (indexedMetadataFiled.ContainsKey(headField) == false || (indexedMetadataFiled[headField].NeedToBeIndexed == false && indexedMetadataFiled[headField].NeedToBeStored == false))
                                continue;

                            var field = new Field(headField,
                                                    ((string)dynamicCsvEntry[headField] ?? string.Empty).ToLower(),
                                                    indexedMetadataFiled[headField].NeedToBeStored ? Field.Store.YES : Field.Store.NO,
                                                    indexedMetadataFiled[headField].NeedToBeIndexed ? Field.Index.ANALYZED : Field.Index.NO
                                                  );

                            doc.Add(field);

                            var facetField = new FacetField(headField, (string)dynamicCsvEntry[headField]);
                            doc.Add(facetField);
                        }

                        long percentage = (long)(((decimal)index / (decimal)entryNumber) * 100m);
                        if (percentage > lastPercentage && percentage % 10 == 0)
                        {
                            _consoleLogger.Information($"..indexing {percentage}%..");
                            lastPercentage = percentage;
                        }

                        writer.AddDocument(doc);
                        index++;
                    }

                    writer.Commit();
                }
            }
        }

        //** LOG
        {
            string message = @"Index Created : {0}";
            _fileLogger.Information(message, targetDirectory);
            _consoleLogger.Information(message, targetDirectory);
        }
    }
</code>```

Title: Lucene 4.8 facets usage

Body:
I have difficulties understanding this example on how to use facets :
https://lucenenet.apache.org/docs/4.8.0-beta00008/api/Lucene.Net.Demo/Lucene.Net.Demo.Facet.SimpleFacetsExample.html

My goal is to create an index in which each document field have a facet, so that at search time i can choose which facets use to navigate data.

What i am confused about is setup of facets in index creation, to
summarize my question :  is index with facets compatibile with
ReferenceManager?

Need DirectoryTaxonomyWriter to be actually    written and persisted
on disk or it will embedded into the index    itself and is just
temporary? I mean given the code

indexWriter.AddDocument(config.Build(taxoWriter, doc)); of the

example i expect it's temporary and will be embedded into the index (but then the example also show you need the Taxonomy to drill down facet). So can the Taxonomy be tangled in some way with the index so that the are handled althogeter with ReferenceManager?

If is not may i just use the same    folder i use for storing index?

Here is a more detailed list of point that confuse me :

In my scenario i am indexing the document asyncrhonously (background process) and then fetching the indext ASAP throught ReferenceManager in ASP.NET application. I hope this way to fetch the index is compatibile with DirectoryTaxonomyWriter needed by facets.

Then i modified the code i write introducing the taxonomy writer as indicated in the example, but i am a bit confused, seems like i can't store DirectoryTaxonomyWriter into the same folder of index because the folder is locked, need i to persist it or it will be embedded into the index (so a RAMDirectory is enougth)? if i need to persist it in a different direcotry, can i safely persist it into subdirectory?

Here the code i am actually using :

    private static void BuildIndex (IndexEntry entry)
    {
        string targetFolder = ConfigurationManager.AppSettings["IndexFolder"] ?? string.Empty;

        //** LOG
        if (System.IO.Directory.Exists(targetFolder) == false)
        {
            string message = @"Index folder not found";
            _fileLogger.Error(message);
            _consoleLogger.Error(message);

            return;
        }

        var metadata = JsonConvert.DeserializeObject<IndexMetadata>(File.ReadAllText(entry.MetdataPath) ?? "{}");

        string[] header = new string[0];
        List<dynamic> csvRecords = new List<dynamic>();

        using (var reader = new StreamReader(entry.DataPath))
        {
            CsvConfiguration csvConfiguration = new CsvConfiguration(CultureInfo.InvariantCulture);
            csvConfiguration.AllowComments = false;
            csvConfiguration.CountBytes = false;
            csvConfiguration.Delimiter = ",";
            csvConfiguration.DetectColumnCountChanges = false;
            csvConfiguration.Encoding = Encoding.UTF8;
            csvConfiguration.HasHeaderRecord = true;
            csvConfiguration.IgnoreBlankLines = true;
            csvConfiguration.HeaderValidated = null;
            csvConfiguration.MissingFieldFound = null;
            csvConfiguration.TrimOptions = CsvHelper.Configuration.TrimOptions.None;
            csvConfiguration.BadDataFound = null;

            using (var csvReader = new CsvReader(reader, csvConfiguration))
            {
                csvReader.Read();
                csvReader.ReadHeader();
                csvReader.Read();
                header = csvReader.HeaderRecord;
                csvRecords = csvReader.GetRecords<dynamic>().ToList();
            }
        }

        string targetDirectory = Path.Combine(targetFolder, "Index__" + metadata.Boundle + "__" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "__" + Path.GetRandomFileName().Substring(0, 6));

        System.IO.Directory.CreateDirectory(targetDirectory);
        //** LOG
        {
            string message = @"..creating index : {0}";
            _fileLogger.Information(message, targetDirectory);
            _consoleLogger.Information(message, targetDirectory);
        }

        using (var dir = FSDirectory.Open(targetDirectory))
        {
            using (DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(dir))
            {
                Analyzer analyzer = metadata.GetAnalyzer();

                var indexConfig = new IndexWriterConfig(LuceneVersion.LUCENE_48, analyzer);

                using (IndexWriter writer = new IndexWriter(dir, indexConfig))
                {
                    long entryNumber = csvRecords.Count();
                    long index = 0;
                    long lastPercentage = 0;
                    foreach (dynamic csvEntry in csvRecords)
                    {
                        Document doc = new Document();
                        IDictionary<string, object> dynamicCsvEntry = (IDictionary<string, object>)csvEntry;
                        var indexedMetadataFiled = metadata.IdexedFields;

                        foreach (string headField in header)
                        {
                            if (indexedMetadataFiled.ContainsKey(headField) == false || (indexedMetadataFiled[headField].NeedToBeIndexed == false && indexedMetadataFiled[headField].NeedToBeStored == false))
                                continue;

                            var field = new Field(headField,
                                                    ((string)dynamicCsvEntry[headField] ?? string.Empty).ToLower(),
                                                    indexedMetadataFiled[headField].NeedToBeStored ? Field.Store.YES : Field.Store.NO,
                                                    indexedMetadataFiled[headField].NeedToBeIndexed ? Field.Index.ANALYZED : Field.Index.NO
                                                  );

                            doc.Add(field);

                            var facetField = new FacetField(headField, (string)dynamicCsvEntry[headField]);
                            doc.Add(facetField);
                        }

                        long percentage = (long)(((decimal)index / (decimal)entryNumber) * 100m);
                        if (percentage > lastPercentage && percentage % 10 == 0)
                        {
                            _consoleLogger.Information($"..indexing {percentage}%..");
                            lastPercentage = percentage;
                        }

                        writer.AddDocument(doc);
                        index++;
                    }

                    writer.Commit();
                }
            }
        }

        //** LOG
        {
            string message = @"Index Created : {0}";
            _fileLogger.Information(message, targetDirectory);
            _consoleLogger.Information(message, targetDirectory);
        }
    }


问:
Setting locale error with i18n in converse.js
i have built the converse.js files according to the steps in option 3 in this link: https://conversejs.org/docs/html/quickstart.html
Then i had the JavaScript and CSS files in Dist directory. I saved the dist directory in my webpage root directory.
Then i added the JavaScript and CSS filed to the head section of the index page. I also initialized the converse.js in the bottom section of the index page. Everything worked perfect with this integration.

I also changed the locale to different languages which can be found in '/dist/locale' directory. I am able to change the
locale to all the 39 languages except one: 'ug'. This is a new language which i have translated recently.

When i set i18n to 'ug', the converse.js is in English which is failure in the setting. Then i looked at
the browser console to see if there is any errors. I found the following errors for the issue:

```<code> FATAL: Cannot find module './ug.js' log.js:68:19
    log log.js:68
    fatal log.js:93
    initialize index.js:121
    initialize core.js:574
    initialize converse.js:53
    initialize entry.js:31
    <anonymous> index.html:57
</code>```

can anybody knows how to solve the issue? Thanks

I expect to see the converse.js in Uyghur lanugage.

Body:
i have built the converse.js files according to the steps in option 3 in this link: https://conversejs.org/docs/html/quickstart.html
Then i had the JavaScript and CSS files in Dist directory. I saved the dist directory in my webpage root directory.
Then i added the JavaScript and CSS filed to the head section of the index page. I also initialized the converse.js in the bottom section of the index page. Everything worked perfect with this integration.

I also changed the locale to different languages which can be found in '/dist/locale' directory. I am able to change the
locale to all the 39 languages except one: 'ug'. This is a new language which i have translated recently.

When i set i18n to 'ug', the converse.js is in English which is failure in the setting. Then i looked at
the browser console to see if there is any errors. I found the following errors for the issue:

 FATAL: Cannot find module './ug.js' log.js:68:19
    log log.js:68
    fatal log.js:93
    initialize index.js:121
    initialize core.js:574
    initialize converse.js:53
    initialize entry.js:31
    <anonymous> index.html:57

can anybody knows how to solve the issue? Thanks

I expect to see the converse.js in Uyghur lanugage.


问:
Why is the height of the component the same as the scene, but the button at the bottom of the component is blocked?
I wrote a javafx program(use maven + java17 + javafx17.0.1 + jfoenix9.0.10), which generates a window 1035 wide and 680 high. I made a black box on the left side of the window. The black box is a ButtonsBox component, and the height of the component is 680, too. But when I tried to add a button at the bottom of the component, the button was blocked by the window. Why is the height of the component the same as that of the scene, but the button was blocked by the window ?

Here are the codes of drawing class. When the application starts, the "start" method in the main class will call the "draw" method in "Draw" class.

```<code>
package io.github.ctimet.lieinbedapp.gui;

import io.github.ctimet.lieinbedapp.gui.ui.ButtonsBox;
import io.github.ctimet.lieinbedapp.gui.util.CSSStyle;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URI;
import java.util.Objects;
import java.util.Optional;

public class Draw {
    private static final Logger logger = LoggerFactory.getLogger(Draw.class);

    private static final AnchorPane pane = new AnchorPane();

    public static void draw(Stage stage) {
        ButtonsBox box = new ButtonsBox(0, 0, 162, 680)
                .setSidesSpace(0)
                .setTopSpace(5)
                .setDownSpace(5)
                .setChildrenHeight(48)
                .setEachSpace(5)
                .setTextFill(Color.valueOf("#f5f5f5"))
                .setButtonStyle("/node.css", "button")
                .addTopButton("label", null, event -> {
                    System.out.println("Label");
                })
                .addTopButton("label2", null, event -> {
                    System.out.println("Label2");
                })
                .addDownButton("label3", null, event -> {
                    System.out.println("1");
                });
        CSSStyle.addDefaultStyle(box, "box");

        pane.getChildren().add(box);

        pane.setStyle("-fx-background-color: #f5f5f5;");

        Scene scene = new Scene(pane, 1035, 680);
        stage.setScene(scene);
        stage.setTitle("Lie In Bed");

        Image icon = new Image(Objects.requireNonNull(Draw.class.getResourceAsStream("/icon.png")));
        stage.getIcons().add(icon);
        stage.show();
    }

}
</code>```

And here are the codes of ButtonsBox class

```<code>package io.github.ctimet.lieinbedapp.gui.ui;

import com.jfoenix.controls.JFXButton;
import io.github.ctimet.lieinbedapp.gui.util.CSSStyle;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;

public class ButtonsBox extends Pane {
    private double childrenHeight;
    private double sidesSpace;
    private double topSpace;
    private double downSpace;
    private double eachSpace;
    private String cssFile;
    private String cssClass;

    private Paint textFill = Color.WHITE;
    private int topButtonsQuantity = 0;
    private int downButtonsQuantity = 0;

    public ButtonsBox(double layoutX, double layoutY, double prefWidth, double prefHeight) {
        setLayoutX(layoutX);
        setLayoutY(layoutY);
        setPrefWidth(prefWidth);
        setPrefHeight(prefHeight);
    }

    public ButtonsBox setTopSpace(double topSpace) {
        this.topSpace = topSpace;
        return this;
    }

    public ButtonsBox setDownSpace(double downSpace) {
        this.downSpace = downSpace;
        return this;
    }

    public ButtonsBox setChildrenHeight(double childrenHeight) {
        this.childrenHeight = childrenHeight;
        return this;
    }

    public ButtonsBox setSidesSpace(double sidesSpace) {
        this.sidesSpace = sidesSpace;
        return this;
    }

    public ButtonsBox setEachSpace(double eachSpace) {
        this.eachSpace = eachSpace;
        return this;
    }

    public ButtonsBox setTextFill(Paint paint) {
        this.textFill = paint;
        return this;
    }

    public ButtonsBox setButtonStyle(String cssFile, String cssClass) {
        this.cssFile = cssFile;
        this.cssClass = cssClass;
        return this;
    }

    public ButtonsBox addTopButton(String label, Node graphic, EventHandler<ActionEvent> handler) {
        JFXButton child = new JFXButton(label);
        child.setLayoutX(getLayoutX() + sidesSpace);
        child.setLayoutY(topButtonsQuantity * (childrenHeight + eachSpace) + topSpace);
        child.setPrefWidth(getPrefWidth() - 2*sidesSpace);
        child.setPrefHeight(childrenHeight);
        child.setTextFill(textFill);
        child.setCursor(Cursor.HAND);
        if (graphic != null)
            child.setGraphic(graphic);
        if (cssClass != null && cssFile != null)
            CSSStyle.addStyle(child, cssClass, cssFile);
        child.setOnAction(handler);

        getChildren().add(child);
        topButtonsQuantity += 1;
        return this;
    }

    public ButtonsBox addDownButton(String label, Node graphic, EventHandler<ActionEvent> handler)  {
        JFXButton child = new JFXButton(label);
        child.setLayoutX(getLayoutX() + sidesSpace);
        System.out.println(getPrefHeight() - downButtonsQuantity * (childrenHeight + eachSpace) - downSpace);
        child.setLayoutY(getPrefHeight() - downButtonsQuantity * (childrenHeight + eachSpace) - downSpace);
        child.setPrefWidth(getPrefWidth() - 2*sidesSpace);
        child.setPrefHeight(childrenHeight);
        child.setTextFill(textFill);
        child.setCursor(Cursor.HAND);
        if (graphic != null)
            child.setGraphic(graphic);
        if (cssFile != null && cssClass != null)
            CSSStyle.addStyle(child, cssClass, cssFile);
        child.setOnAction(handler);

        getChildren().add(child);
        downButtonsQuantity += 1;
        return this;
    }
}

</code>```

When I start this Application, It will show
this.
As you can see. The Button "Label3" does not appear in the window.But when I maximize the window, the button Label3 appears in the lower left corner of the window.
this

What should I do to make the button Label3 display normally instead of being blocked?

I tried to set the width and height of the stage manually, but it didn't work. Only when I change the height of ButtonsBox, can the button be displayed normally, but I don't understand why the height of ButtonsBox is the same as that of scene, but the button Label3 is blocked.

I hope the button Label3 can be displayed normally, and I also want to know why the button Label3 is blocked

Body:
I wrote a javafx program(use maven + java17 + javafx17.0.1 + jfoenix9.0.10), which generates a window 1035 wide and 680 high. I made a black box on the left side of the window. The black box is a ButtonsBox component, and the height of the component is 680, too. But when I tried to add a button at the bottom of the component, the button was blocked by the window. Why is the height of the component the same as that of the scene, but the button was blocked by the window ?

Here are the codes of drawing class. When the application starts, the "start" method in the main class will call the "draw" method in "Draw" class.

package io.github.ctimet.lieinbedapp.gui;

import io.github.ctimet.lieinbedapp.gui.ui.ButtonsBox;
import io.github.ctimet.lieinbedapp.gui.util.CSSStyle;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URI;
import java.util.Objects;
import java.util.Optional;

public class Draw {
    private static final Logger logger = LoggerFactory.getLogger(Draw.class);

    private static final AnchorPane pane = new AnchorPane();

    public static void draw(Stage stage) {
        ButtonsBox box = new ButtonsBox(0, 0, 162, 680)
                .setSidesSpace(0)
                .setTopSpace(5)
                .setDownSpace(5)
                .setChildrenHeight(48)
                .setEachSpace(5)
                .setTextFill(Color.valueOf("#f5f5f5"))
                .setButtonStyle("/node.css", "button")
                .addTopButton("label", null, event -> {
                    System.out.println("Label");
                })
                .addTopButton("label2", null, event -> {
                    System.out.println("Label2");
                })
                .addDownButton("label3", null, event -> {
                    System.out.println("1");
                });
        CSSStyle.addDefaultStyle(box, "box");

        pane.getChildren().add(box);

        pane.setStyle("-fx-background-color: #f5f5f5;");

        Scene scene = new Scene(pane, 1035, 680);
        stage.setScene(scene);
        stage.setTitle("Lie In Bed");

        Image icon = new Image(Objects.requireNonNull(Draw.class.getResourceAsStream("/icon.png")));
        stage.getIcons().add(icon);
        stage.show();
    }

}

And here are the codes of ButtonsBox class

package io.github.ctimet.lieinbedapp.gui.ui;

import com.jfoenix.controls.JFXButton;
import io.github.ctimet.lieinbedapp.gui.util.CSSStyle;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;

public class ButtonsBox extends Pane {
    private double childrenHeight;
    private double sidesSpace;
    private double topSpace;
    private double downSpace;
    private double eachSpace;
    private String cssFile;
    private String cssClass;

    private Paint textFill = Color.WHITE;
    private int topButtonsQuantity = 0;
    private int downButtonsQuantity = 0;

    public ButtonsBox(double layoutX, double layoutY, double prefWidth, double prefHeight) {
        setLayoutX(layoutX);
        setLayoutY(layoutY);
        setPrefWidth(prefWidth);
        setPrefHeight(prefHeight);
    }

    public ButtonsBox setTopSpace(double topSpace) {
        this.topSpace = topSpace;
        return this;
    }

    public ButtonsBox setDownSpace(double downSpace) {
        this.downSpace = downSpace;
        return this;
    }

    public ButtonsBox setChildrenHeight(double childrenHeight) {
        this.childrenHeight = childrenHeight;
        return this;
    }

    public ButtonsBox setSidesSpace(double sidesSpace) {
        this.sidesSpace = sidesSpace;
        return this;
    }

    public ButtonsBox setEachSpace(double eachSpace) {
        this.eachSpace = eachSpace;
        return this;
    }

    public ButtonsBox setTextFill(Paint paint) {
        this.textFill = paint;
        return this;
    }

    public ButtonsBox setButtonStyle(String cssFile, String cssClass) {
        this.cssFile = cssFile;
        this.cssClass = cssClass;
        return this;
    }

    public ButtonsBox addTopButton(String label, Node graphic, EventHandler<ActionEvent> handler) {
        JFXButton child = new JFXButton(label);
        child.setLayoutX(getLayoutX() + sidesSpace);
        child.setLayoutY(topButtonsQuantity * (childrenHeight + eachSpace) + topSpace);
        child.setPrefWidth(getPrefWidth() - 2*sidesSpace);
        child.setPrefHeight(childrenHeight);
        child.setTextFill(textFill);
        child.setCursor(Cursor.HAND);
        if (graphic != null)
            child.setGraphic(graphic);
        if (cssClass != null && cssFile != null)
            CSSStyle.addStyle(child, cssClass, cssFile);
        child.setOnAction(handler);

        getChildren().add(child);
        topButtonsQuantity += 1;
        return this;
    }

    public ButtonsBox addDownButton(String label, Node graphic, EventHandler<ActionEvent> handler)  {
        JFXButton child = new JFXButton(label);
        child.setLayoutX(getLayoutX() + sidesSpace);
        System.out.println(getPrefHeight() - downButtonsQuantity * (childrenHeight + eachSpace) - downSpace);
        child.setLayoutY(getPrefHeight() - downButtonsQuantity * (childrenHeight + eachSpace) - downSpace);
        child.setPrefWidth(getPrefWidth() - 2*sidesSpace);
        child.setPrefHeight(childrenHeight);
        child.setTextFill(textFill);
        child.setCursor(Cursor.HAND);
        if (graphic != null)
            child.setGraphic(graphic);
        if (cssFile != null && cssClass != null)
            CSSStyle.addStyle(child, cssClass, cssFile);
        child.setOnAction(handler);

        getChildren().add(child);
        downButtonsQuantity += 1;
        return this;
    }
}

When I start this Application, It will show
this.
As you can see. The Button "Label3" does not appear in the window.But when I maximize the window, the button Label3 appears in the lower left corner of the window.
this

What should I do to make the button Label3 display normally instead of being blocked?

I tried to set the width and height of the stage manually, but it didn't work. Only when I change the height of ButtonsBox, can the button be displayed normally, but I don't understand why the height of ButtonsBox is the same as that of scene, but the button Label3 is blocked.

I hope the button Label3 can be displayed normally, and I also want to know why the button Label3 is blocked


问:
python manipulate parent class attribute when instance is deleted
I am trying to make self contained data persistent class that will save the instance into a pickle or json file, i have analagize my code,

class Base:
    stack = []

    def __init__(self, name):
        self.name = name

    def __new__(cls, *args, **kwargs):
        self = super().__new__(cls)
        cls.stack.append(self)
        return self

class A(Base):
    def __init__(self, name):
        super(A, self).__init__(name)

    def __del__(self):
        Base.stack.remove(self)

class B(Base):
    def __init__(self, name):
        super(B, self).__init__(name)

print(Base.stack)
a = A('test 1')
b = B('test 2')
print(Base.stack)
a = None # Have also tried del a, so that __del__ is invoked.
print(Base.stack)

```
<p>here i'll persist the stack list in some way which i havent implemented in the psuedo code, but i had it under main code,</p>
<p>when the subclass instance is created it should be added in the base class attribute which is right now a list
and when the subclass instance is deleted it should be deleted from there.
i had changed the <strong>del</strong> method, but it seems not to work.</p>
<p>why the results is this:</p>
```[]

[<__main__.A object at 0x000001D549A59910>, <__main__.B object at 0x000001D549A5AC10>]

[<__main__.A object at 0x000001D549A59910>, <__main__.B object at 0x000001D549A5AC10>]
```
<p>and not this:</p>
```[]

[<__main__.A object at 0x000001D549A59910>, <__main__.B object at 0x000001D549A5AC10>]

[<__main__.B object at 0x000001D549A5AC10>]
```

i know del is the finalizer which will be invoked by garbage collector when reference to that isntance is zero, and thats what i did.

Body:
I am trying to make self contained data persistent class that will save the instance into a pickle or json file, i have analagize my code,

class Base:
    stack = []

    def __init__(self, name):
        self.name = name

    def __new__(cls, *args, **kwargs):
        self = super().__new__(cls)
        cls.stack.append(self)
        return self

class A(Base):
    def __init__(self, name):
        super(A, self).__init__(name)

    def __del__(self):
        Base.stack.remove(self)

class B(Base):
    def __init__(self, name):
        super(B, self).__init__(name)

print(Base.stack)
a = A('test 1')
b = B('test 2')
print(Base.stack)
a = None # Have also tried del a, so that __del__ is invoked.
print(Base.stack)

here i'll persist the stack list in some way which i havent implemented in the psuedo code, but i had it under main code,

when the subclass instance is created it should be added in the base class attribute which is right now a list
and when the subclass instance is deleted it should be deleted from there.
i had changed the del method, but it seems not to work.

why the results is this:

[]

[<__main__.A object at 0x000001D549A59910>, <__main__.B object at 0x000001D549A5AC10>]

[<__main__.A object at 0x000001D549A59910>, <__main__.B object at 0x000001D549A5AC10>]

and not this:

[]

[<__main__.A object at 0x000001D549A59910>, <__main__.B object at 0x000001D549A5AC10>]

[<__main__.B object at 0x000001D549A5AC10>]

i know del is the finalizer which will be invoked by garbage collector when reference to that isntance is zero, and thats what i did.


问:
craco don't work with react-scripts@^5.0.1
it shows me this error:

yarn start                                                          ✔  27s 
yarn run v1.22.19
$ craco start
Failed to compile.

For the selected environment is no default script chunk format available:
JSONP Array push can be chosen when 'document' or 'importScripts' is available.
CommonJs exports can be chosen when 'require' or node builtins are available.
Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively, specify the 'output.chunkFormat' directly.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

And this is my Package.json

```<code>{
  "name": "fly-with-zoki",
  "version": "1.10.0",
  "private": true,
  "main": "dist/index.js",
  "dependencies": {
    "@babel/helper-define-polyfill-provider": "^0.3.2",
    "@date-io/date-fns": "^1.3.13",
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@fontsource/roboto": "^4.5.8",
    "@material-ui/core": "^4.12.4",
    "@material-ui/icons": "4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.61",
    "@material-ui/pickers": "^3.3.10",
    "@mui/icons-material": "^5.10.16",
    "@mui/lab": "^5.0.0-alpha.114",
    "@mui/material": "^5.10.17",
    "@mui/styled-engine-sc": "^5.10.16",
    "@reduxjs/toolkit": "^1.8.0",
    "@stripe/react-stripe-js": "^1.8.0-0",
    "@stripe/stripe-js": "^1.29.0",
    "@types/dotenv": "^8.2.0",
    "amadeus": "^7.1.0",
    "axios": "^0.27.1",
    "bootstrap": "^4.6.1",
    "chartist": "0.10.1",
    "classnames": "2.3.1",
    "date-fns": "^2.28.0",
    "dom-lib": "^3.1.5",
    "font-awesome": "^4.7.0",
    "history": "5.0.0",
    "jquery": "^3.6.0",
    "json-schema-to-typescript": "^11.0.2",
    "lib": "^4.3.3",
    "material-ui-dropzone": "^3.5.0",
    "moment": "^2.29.3",
    "node": "^16.13.0",
    "notistack": "^1.0.10",
    "perfect-scrollbar": "1.5.1",
    "popper.js": "^1.16.1",
    "prop-types": "15.7.2",
    "react": "^18.2.0",
    "react-chartist": "0.14.4",
    "react-dom": "17.0.2",
    "react-image-gallery": "^1.2.8",
    "react-moment": "^1.1.2",
    "react-redux": "^7.2.8",
    "react-responsive-carousel": "^3.2.23",
    "react-router-dom": "5.2.0",
    "react-scripts": "^5.0.1",
    "react-select": "^5.3.2",
    "react-swipeable-views": "^0.14.0",
    "redux": "^4.1.2",
    "redux-devtools-extension": "^2.13.9",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.1",
    "styled-components": "^5.3.6"
  },
  "scripts": {
    "lint": "eslint src",
    "dev": "cross-env NODE_OPTIONS= next dev",
    "start": "craco start",
    "build": "craco build",
    "test": "craco test",
    "eject": "react-scripts eject",
    "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
    "lint:check": "eslint . --ext=js,jsx;  exit 0",
    "lint:fix": "eslint . --ext=js,jsx --fix;  exit 0",
    "build-package-css": "cp src/assets/css/material-dashboard-react.css dist/material-dashboard-react.css",
    "build-package": "npm run build-package-css && babel src --out-dir dist"
  },
  "keywords": [],
  "optionalDependencies": {
    "@babel/core": "7.14.0",
    "typescript": "4.2.4"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.19.1",
    "@babel/preset-react": "^7.18.6",
    "@craco/craco": "^7.0.0",
    "autoprefixer": "^10.4.13",
    "eslint-plugin-react": "^7.31.11",
    "eslint-plugin-react-hooks": "^4.6.0",
    "gulp": "4.0.2",
    "gulp-append-prepend": "1.0.9",
    "postcss": "^8.4.21",
    "react-error-overlay": "6.0.9",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": []
  },
  "resolutions": {
    "react-error-overlay": "6.0.9"
  }
}
</code>```

I have tried to upgrade my react-scripts by using

```<code>npm ugdate react-scripts
npm upgrade react-scripts
yarn update react-scripts
yarn upgrade react-scripts
</code>```

But no changes were applied :(

Body:
it shows me this error:

yarn start                                                          ✔  27s 
yarn run v1.22.19
$ craco start
Failed to compile.

For the selected environment is no default script chunk format available:
JSONP Array push can be chosen when 'document' or 'importScripts' is available.
CommonJs exports can be chosen when 'require' or node builtins are available.
Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively, specify the 'output.chunkFormat' directly.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

And this is my Package.json

{
  "name": "fly-with-zoki",
  "version": "1.10.0",
  "private": true,
  "main": "dist/index.js",
  "dependencies": {
    "@babel/helper-define-polyfill-provider": "^0.3.2",
    "@date-io/date-fns": "^1.3.13",
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@fontsource/roboto": "^4.5.8",
    "@material-ui/core": "^4.12.4",
    "@material-ui/icons": "4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.61",
    "@material-ui/pickers": "^3.3.10",
    "@mui/icons-material": "^5.10.16",
    "@mui/lab": "^5.0.0-alpha.114",
    "@mui/material": "^5.10.17",
    "@mui/styled-engine-sc": "^5.10.16",
    "@reduxjs/toolkit": "^1.8.0",
    "@stripe/react-stripe-js": "^1.8.0-0",
    "@stripe/stripe-js": "^1.29.0",
    "@types/dotenv": "^8.2.0",
    "amadeus": "^7.1.0",
    "axios": "^0.27.1",
    "bootstrap": "^4.6.1",
    "chartist": "0.10.1",
    "classnames": "2.3.1",
    "date-fns": "^2.28.0",
    "dom-lib": "^3.1.5",
    "font-awesome": "^4.7.0",
    "history": "5.0.0",
    "jquery": "^3.6.0",
    "json-schema-to-typescript": "^11.0.2",
    "lib": "^4.3.3",
    "material-ui-dropzone": "^3.5.0",
    "moment": "^2.29.3",
    "node": "^16.13.0",
    "notistack": "^1.0.10",
    "perfect-scrollbar": "1.5.1",
    "popper.js": "^1.16.1",
    "prop-types": "15.7.2",
    "react": "^18.2.0",
    "react-chartist": "0.14.4",
    "react-dom": "17.0.2",
    "react-image-gallery": "^1.2.8",
    "react-moment": "^1.1.2",
    "react-redux": "^7.2.8",
    "react-responsive-carousel": "^3.2.23",
    "react-router-dom": "5.2.0",
    "react-scripts": "^5.0.1",
    "react-select": "^5.3.2",
    "react-swipeable-views": "^0.14.0",
    "redux": "^4.1.2",
    "redux-devtools-extension": "^2.13.9",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.1",
    "styled-components": "^5.3.6"
  },
  "scripts": {
    "lint": "eslint src",
    "dev": "cross-env NODE_OPTIONS= next dev",
    "start": "craco start",
    "build": "craco build",
    "test": "craco test",
    "eject": "react-scripts eject",
    "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
    "lint:check": "eslint . --ext=js,jsx;  exit 0",
    "lint:fix": "eslint . --ext=js,jsx --fix;  exit 0",
    "build-package-css": "cp src/assets/css/material-dashboard-react.css dist/material-dashboard-react.css",
    "build-package": "npm run build-package-css && babel src --out-dir dist"
  },
  "keywords": [],
  "optionalDependencies": {
    "@babel/core": "7.14.0",
    "typescript": "4.2.4"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.19.1",
    "@babel/preset-react": "^7.18.6",
    "@craco/craco": "^7.0.0",
    "autoprefixer": "^10.4.13",
    "eslint-plugin-react": "^7.31.11",
    "eslint-plugin-react-hooks": "^4.6.0",
    "gulp": "4.0.2",
    "gulp-append-prepend": "1.0.9",
    "postcss": "^8.4.21",
    "react-error-overlay": "6.0.9",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": []
  },
  "resolutions": {
    "react-error-overlay": "6.0.9"
  }
}

I have tried to upgrade my react-scripts by using

npm ugdate react-scripts
npm upgrade react-scripts
yarn update react-scripts
yarn upgrade react-scripts

But no changes were applied :(


问:
How to deal with non-English characters and spaces in filename in python?
I want to download some files from gdrive with a python script. Files contain spaces and nonEnglish characters and I want to save them exactly with the same names. I try to create a similar file with spaces and special characters, but python gives me always
OSError: [Errno 22] Invalid argument::

```<code>from urllib.request import urlopen
from urllib import request
from urllib.parse import unquote
import os

base_dir = os.getcwd()
print(base_dir)
url = 'https://drive.google.com/u/0/uc?id=1KD3dIMaJU6SY8NX38jOW3DWQYjPGN-9A&export=download'
resource = request.urlopen(request.Request(url))

content = resource.getheader('Content-Disposition')

filename = content.split('*=')[1]
filename = unquote(filename.split("''")[1])
filepath = os.path.join(base_dir, filename)

with urlopen(url) as file:
    file_content = file.read()

# Save to file
with open(filepath, "w") as f:
    f.write(file_content)
</code>```

This is the full message:

```<code>Traceback (most recent call last):
File "C:\Users\user\Downloads\Telegram Desktop\ChatExport_2023-01-07\gdrive_links.py", line 26, in <module>
with open(filepath, "w") as f:

 OSError: [Errno 22] Invalid argument:
'C:\\Users\\user\\Downloads\\Telegram Desktop\\ChatExport_2023-01-07\\DilKoçu1 (BEN KİMİM? SİSTEMİMİZ NASIL İŞLİYOR?).mp4'
</code>```

I am using python 3.10.4 on Windows 11

Body:
I want to download some files from gdrive with a python script. Files contain spaces and nonEnglish characters and I want to save them exactly with the same names. I try to create a similar file with spaces and special characters, but python gives me always
OSError: [Errno 22] Invalid argument::

from urllib.request import urlopen
from urllib import request
from urllib.parse import unquote
import os

base_dir = os.getcwd()
print(base_dir)
url = 'https://drive.google.com/u/0/uc?id=1KD3dIMaJU6SY8NX38jOW3DWQYjPGN-9A&export=download'
resource = request.urlopen(request.Request(url))

content = resource.getheader('Content-Disposition')

filename = content.split('*=')[1]
filename = unquote(filename.split("''")[1])
filepath = os.path.join(base_dir, filename)

with urlopen(url) as file:
    file_content = file.read()

# Save to file
with open(filepath, "w") as f:
    f.write(file_content)

This is the full message:

Traceback (most recent call last):
File "C:\Users\user\Downloads\Telegram Desktop\ChatExport_2023-01-07\gdrive_links.py", line 26, in <module>
with open(filepath, "w") as f:

 OSError: [Errno 22] Invalid argument:
'C:\\Users\\user\\Downloads\\Telegram Desktop\\ChatExport_2023-01-07\\DilKoçu1 (BEN KİMİM? SİSTEMİMİZ NASIL İŞLİYOR?).mp4'

I am using python 3.10.4 on Windows 11


问:
Setting range for confusion matrix
I would like to ask how to set the acceptable range on my predicted data for a confusion matrix.

```<code>ID <- c('a', 'b', 'c', 'd')
observed <- c(20, 30, 40, 50)
exam.df <- as.data.frame(ID, observed)
exam.df$predict <-c(21,33,11,55)
</code>```

How can I set a 70% acceptance range for the predicted value. For example, if the "predict" value for "a" is +-6 different from the "observed" then it will be as 1, if not then 0.

Then I would like to ask how can I turn it into a confusion matrix?

Title: Setting range for confusion matrix

Body:
I would like to ask how to set the acceptable range on my predicted data for a confusion matrix.

ID <- c('a', 'b', 'c', 'd')
observed <- c(20, 30, 40, 50)
exam.df <- as.data.frame(ID, observed)
exam.df$predict <-c(21,33,11,55)

How can I set a 70% acceptance range for the predicted value. For example, if the "predict" value for "a" is +-6 different from the "observed" then it will be as 1, if not then 0.

Then I would like to ask how can I turn it into a confusion matrix?


问:
ClassCast Error trying to read UploadTask$TaskSnapshot
I'm trying to upload multiple images to Firebase storage and get the DownloadURL of each. But I get a ClassCast error in the addOnSuccessListener method

```<code>   val tasks = mutableListOf<UploadTask>()

    listImg.forEach {
        if(bitmap!!.byteCount != it.byteCount) {
            val bitmap = it
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos)
            val data = baos.toByteArray()
            var uploadTask = spaceRef.putBytes(data)

            tasks.add(uploadTask)
        }
    }

    Tasks.whenAllSuccess<UploadTask>(tasks).addOnSuccessListener { taskSnapshot ->
        taskSnapshot!!.forEach {
            Log.d("ELEMENT", it.toString())
        }
    }
</code>```

java.lang.ClassCastException: com.google.firebase.storage.UploadTask$TaskSnapshot cannot be cast to com.google.firebase.storage.UploadTask

Body:
I'm trying to upload multiple images to Firebase storage and get the DownloadURL of each. But I get a ClassCast error in the addOnSuccessListener method

   val tasks = mutableListOf<UploadTask>()

    listImg.forEach {
        if(bitmap!!.byteCount != it.byteCount) {
            val bitmap = it
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos)
            val data = baos.toByteArray()
            var uploadTask = spaceRef.putBytes(data)

            tasks.add(uploadTask)
        }
    }

    Tasks.whenAllSuccess<UploadTask>(tasks).addOnSuccessListener { taskSnapshot ->
        taskSnapshot!!.forEach {
            Log.d("ELEMENT", it.toString())
        }
    }

java.lang.ClassCastException: com.google.firebase.storage.UploadTask$TaskSnapshot cannot be cast to com.google.firebase.storage.UploadTask


问:
Rust - borrowed value does not live long enough
I am trying to implement method which generates some data (i32 in this case) and returns reference to this data. How can I make this code compilable:

```<code>  fn parent_func<'a>(x: i32) -> &'a i32 {
    let a = 5 + x;
    let res: &'a i32 = &a; // TODO - borrowed value does not live long enough
    res
  }

  fn child_func<'b>() -> &'b i32 {
    let x = 2;
    let res = parent_func(x);
    res
  }

  fn main() {
    let x = child_func();
    assert_eq!(*x, 7);
  }
</code>```

I tried to put return type to Box<> but it did not helped. Thanks a lot.

Body:
I am trying to implement method which generates some data (i32 in this case) and returns reference to this data. How can I make this code compilable:

  fn parent_func<'a>(x: i32) -> &'a i32 {
    let a = 5 + x;
    let res: &'a i32 = &a; // TODO - borrowed value does not live long enough
    res
  }

  fn child_func<'b>() -> &'b i32 {
    let x = 2;
    let res = parent_func(x);
    res
  }

  fn main() {
    let x = child_func();
    assert_eq!(*x, 7);
  }

I tried to put return type to Box<> but it did not helped. Thanks a lot.


问:
When is it appropriate to use tensor-based DBs (e.g Marqo) instead of keyword based (e.g Elasticsearch)?
I'm implementing end user search for an e-commerce website. The catalogue contains images, text, prices of different items. LLMs are all the hype at the moment but I'm not sure how well proven the performance is in comparison to keyword based for e-commerce.

I've tried tensor based search and it appears to perform well but its hard to benchmark search against relevance so I'm not sure of putting it into production.

What frameworks are people using to determine when you use tensor/vector based search vs keyword based?


问:
import in npm package
i want to use one vue sfc in another project. I have project1 with componet and make npm package, publish it to own gitlab package registry and use it via npm install. Everything work great, but...
The sfc Foo.vue in FooProject import another one, like: import ChildFooComponent from '@/components/ChildFooComponent.vue'. if i run (npm run dev or build) FooProject, evrything works. But if i make npm package via npm publish and want to use it at BarProject as import Foo from '@FooProject/src/Foo' (FooProject with Foo already is in node_modules)
the build say: cant find module '@/components/ChildFooComponent.vue' in Foo. when i change the import in FooProject in Foo.vue to import FooChildComponent from './components/ChildFooComponent.vue' then every thing works as i expected. i know that @ poitns to src folder of actual project, in this case src folder of BarProject, right? but how to tell npm that if @ is in FooProject use the src folder of FooProject not BarProject?</p>

Title: import in npm package


问:
image is not loading and being blocked by CORB
I am getting a data with an image link and I want to show those images by using the link in my img tag. I have disabled CORS on my chrome and I am receiving the data successfully but when I try to render the image it gives me an error "Cross-Origin Read Blocking (CORB) blocked cross-origin response https://commons.wikimedia.org/wiki/File:A_Conversation_With_Oscar_Wilde_-_London_-_240404.jpg with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details"

Can you please help on how can I bypass this. I am using axios for to make the fetch request and React to render the image.

```<code>async function getData(location) {
  try {
    // Make API call to get coordinates of location
    const geonameResponse = await axios.get(`https://api.opentripmap.com/0.1/en/places/geoname?name=${location}&apikey=${API_KEY}`)
    //console.log(geonameResponse)
    // Make API call to get features within 1000 meter radius of location
    const radiusResponse =  await axios.get(
      `https://api.opentripmap.com/0.1/en/places/radius?radius=1000&lon=${geonameResponse.data.lon}&lat=${geonameResponse.data.lat}&limit=10&apikey=${API_KEY}`)

    //console.log(radiusResponse)

    // Make API call for each feature to get more detailed information
    // Make API call for each feature to get more detailed information

    const xidResponses = await Promise.all(
    radiusResponse.data.features.map(async (item) => {
    return new Promise((resolve) => {
      setTimeout(async () => {
        resolve(await axios.get(
          `https://api.opentripmap.com/0.1/en/places/xid/${item.properties.xid}?apikey=${API_KEY}`
        ));
      }, 2000);
    });
  })
);

    // Set data to array of xidResponses
    setData(xidResponses);
  } catch (error) {
    console.error(error);
  }
}
</code>```

Body:
I am getting a data with an image link and I want to show those images by using the link in my img tag. I have disabled CORS on my chrome and I am receiving the data successfully but when I try to render the image it gives me an error "Cross-Origin Read Blocking (CORB) blocked cross-origin response https://commons.wikimedia.org/wiki/File:A_Conversation_With_Oscar_Wilde_-_London_-_240404.jpg with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details"

Can you please help on how can I bypass this. I am using axios for to make the fetch request and React to render the image.

async function getData(location) {
  try {
    // Make API call to get coordinates of location
    const geonameResponse = await axios.get(`https://api.opentripmap.com/0.1/en/places/geoname?name=${location}&apikey=${API_KEY}`)
    //console.log(geonameResponse)
    // Make API call to get features within 1000 meter radius of location
    const radiusResponse =  await axios.get(
      `https://api.opentripmap.com/0.1/en/places/radius?radius=1000&lon=${geonameResponse.data.lon}&lat=${geonameResponse.data.lat}&limit=10&apikey=${API_KEY}`)

    //console.log(radiusResponse)

    // Make API call for each feature to get more detailed information
    // Make API call for each feature to get more detailed information

    const xidResponses = await Promise.all(
    radiusResponse.data.features.map(async (item) => {
    return new Promise((resolve) => {
      setTimeout(async () => {
        resolve(await axios.get(
          `https://api.opentripmap.com/0.1/en/places/xid/${item.properties.xid}?apikey=${API_KEY}`
        ));
      }, 2000);
    });
  })
);

    // Set data to array of xidResponses
    setData(xidResponses);
  } catch (error) {
    console.error(error);
  }
}


问:
can i use code(like python,js,ts) to auto generate image in .figma format?
can i use code(like python,js,ts) to auto generate image in .figma format?

i konw they have a plugin api reference,they have the api example like

```<code>const rect = figma.createRectangle()
// Move to (50, 50)
rect.x = 50
rect.y = 50
// Set size to 200 x 100
rect.resize(200, 100)
// Set solid red fill
rect.fills = [{ type: 'SOLID', color: { r: 1, g: 0, b: 0 } }]
</code>```

but it seems that the api is call in the client of the user,but i want call the api in my server and generate a image in .figma format

Body:
can i use code(like python,js,ts) to auto generate image in .figma format?

i konw they have a plugin api reference,they have the api example like

const rect = figma.createRectangle()
// Move to (50, 50)
rect.x = 50
rect.y = 50
// Set size to 200 x 100
rect.resize(200, 100)
// Set solid red fill
rect.fills = [{ type: 'SOLID', color: { r: 1, g: 0, b: 0 } }]

but it seems that the api is call in the client of the user,but i want call the api in my server and generate a image in .figma format


问:
SWC typescript is not affect fast reload
I'm trying to improve nodemon server/start speed.

my script command in package.json is

installed npm install --save-dev ts-node @swc/core @swc/helpers regenerator-runtime

```<code>scripts: {
        "dev": "nodemon --watch src server.ts"
    }
</code>```

and tsconfig.json  is

```<code>{
  "compilerOptions": {
    "baseUrl": ".",
    "target": "ES6",
    "module": "commonjs",
    "removeComments": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "types": [
      "node",
      "bytebuffer"
    ],
    "moduleResolution": "node",
    "pretty": true,
    "sourceMap": true,
    "skipLibCheck": true,
    "suppressImplicitAnyIndexErrors": true,
    // "noImplicitAny": false,
    "resolveJsonModule": true,
    "outDir": "./build",
    "typeRoots": [
      "./src/interfaces/index.d.ts",
      "node_modules/@types"
    ],
    "paths": {
      "@config/*": [
        "./src/config/*"
      ],
      "@controllers/*": [
        "./src/controllers/*"
      ],
      "@dao/*": [
        "./src/dao/*"
      ],
      "@json/*": [
        "./src/json/*"
      ],
      "@lib/*": [
        "./src/lib/*"
      ],
      "@mappers/*": [
        "./src/mappers/*"
      ],
      "@models/*": [
        "./src/models/*"
      ],
      "@plugins/*": [
        "./src/plugins/*"
      ],
      "@routes/*": [
        "./src/routes/*"
      ],
      "@utils/*": [
        "./src/utils/*"
      ]
    }
  },
  "ts-node": {
    "swc": true
  },
  "filesGlob": [
    "./src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "src/lib/customTypings"
  ]
}
</code>```

and mainly also mentioned in tsconfig.json file

```<code>ts-node: {
    "swc": true
  }
</code>```

after Configuring all the steps still nodemon server taking 2 min to restart after changes.

Are there any changes that need to do to the current setup? and I followed this question

I did all the changes still it is not effect in speed of compile

Body:
I'm trying to improve nodemon server/start speed.

my script command in package.json is

installed npm install --save-dev ts-node @swc/core @swc/helpers regenerator-runtime

scripts: {
        "dev": "nodemon --watch src server.ts"
    }

and tsconfig.json  is

{
  "compilerOptions": {
    "baseUrl": ".",
    "target": "ES6",
    "module": "commonjs",
    "removeComments": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "types": [
      "node",
      "bytebuffer"
    ],
    "moduleResolution": "node",
    "pretty": true,
    "sourceMap": true,
    "skipLibCheck": true,
    "suppressImplicitAnyIndexErrors": true,
    // "noImplicitAny": false,
    "resolveJsonModule": true,
    "outDir": "./build",
    "typeRoots": [
      "./src/interfaces/index.d.ts",
      "node_modules/@types"
    ],
    "paths": {
      "@config/*": [
        "./src/config/*"
      ],
      "@controllers/*": [
        "./src/controllers/*"
      ],
      "@dao/*": [
        "./src/dao/*"
      ],
      "@json/*": [
        "./src/json/*"
      ],
      "@lib/*": [
        "./src/lib/*"
      ],
      "@mappers/*": [
        "./src/mappers/*"
      ],
      "@models/*": [
        "./src/models/*"
      ],
      "@plugins/*": [
        "./src/plugins/*"
      ],
      "@routes/*": [
        "./src/routes/*"
      ],
      "@utils/*": [
        "./src/utils/*"
      ]
    }
  },
  "ts-node": {
    "swc": true
  },
  "filesGlob": [
    "./src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "src/lib/customTypings"
  ]
}

and mainly also mentioned in tsconfig.json file

ts-node: {
    "swc": true
  }

after Configuring all the steps still nodemon server taking 2 min to restart after changes.

Are there any changes that need to do to the current setup? and I followed this question

I did all the changes still it is not effect in speed of compile


问:
Why conditional ranking in Excel doesn't work?
Here's my dataset

```<code>apps_category   app        usage_freq
Tech_Enthusiast mdns          3807967
Gamers          apexlegends      1556
Socialities     chubao       11284180
Gamers          toonblast       92078
Socialities     xl_kaskus      138451
</code>```

What I did
=COUNTIFS($A$2:$A$8431,A2,$C$2:$C$8431,"<"+C2)+1

The Output is

```<code>apps_category   app        usage_freq   Rank
Tech_Enthusiast mdns          3807967   1
Gamers          apexlegends      1556   1
Socialities     chubao       11284180   1
Gamers          toonblast       92078   1
Socialities     xl_kaskus      138451   1
</code>```

There's at least 2 Gamers and Two Socialities there, why everyone rank there

Body:
Here's my dataset

apps_category   app        usage_freq
Tech_Enthusiast mdns          3807967
Gamers          apexlegends      1556
Socialities     chubao       11284180
Gamers          toonblast       92078
Socialities     xl_kaskus      138451

What I did
=COUNTIFS($A$2:$A$8431,A2,$C$2:$C$8431,"<"+C2)+1

The Output is

apps_category   app        usage_freq   Rank
Tech_Enthusiast mdns          3807967   1
Gamers          apexlegends      1556   1
Socialities     chubao       11284180   1
Gamers          toonblast       92078   1
Socialities     xl_kaskus      138451   1

There's at least 2 Gamers and Two Socialities there, why everyone rank there


问:
i can not send an array from a '.map' using navigate in React
I already have a props called 'state' on my First component. and i want to send this state and another array to a Second component. this is a RESUME of the First component:

```<code>const { state = { success: false } } = useLocation();
 const navigate = useNavigate();
useEffect(() => {
    fetch(`http://localhost:3001/api/cnu`)
      .then((x) => x.json())
      .then((y) => {
        const data = y.data;
        const cnuevo = data.find((b) => b.id === Number(id));
        console.log(id, data);
        setCnuevo(cnuevo);
      });
  }, [id]);
{cnuevos && (
        <article className="seccion" key={cnuevos.id}>
          {console.log(cnuevos)}
<p
                    onClick={() =>
                      navigate(`/pago/${cnuevos.id}`, { state1: state, state2: cnuevos})
                    }
                  >
                    Comprar
                  </p>
)}
</code>```

On the First 'cnuevos' is an array and where i console.log is everything ok, but on the Second (RESUME):

```<code>const { state1= { success: false }, state2 } = useLocation();
console.log(state1)
  console.log(state2)
</code>```

state2 is undefined.

i've tryed this on the First:

```<code>     onClick={() =>
       navigate(`/pago/${cnuevos.id}`, { state1: state, state2: JSON.stringify(cnuevos)})
      }>
</code>```

and this on the second:

```<code>const { state1= { success: false }, state2 } = useLocation();
  const cnuevosA = JSON.parse(state2);
</code>```

and everything else i try still undefined.

Body:
I already have a props called 'state' on my First component. and i want to send this state and another array to a Second component. this is a RESUME of the First component:

const { state = { success: false } } = useLocation();
 const navigate = useNavigate();
useEffect(() => {
    fetch(`http://localhost:3001/api/cnu`)
      .then((x) => x.json())
      .then((y) => {
        const data = y.data;
        const cnuevo = data.find((b) => b.id === Number(id));
        console.log(id, data);
        setCnuevo(cnuevo);
      });
  }, [id]);
{cnuevos && (

          {console.log(cnuevos)}

                      navigate(`/pago/${cnuevos.id}`, { state1: state, state2: cnuevos})
                    }
                  >
                    Comprar

)}

On the First 'cnuevos' is an array and where i console.log is everything ok, but on the Second (RESUME):

const { state1= { success: false }, state2 } = useLocation();
console.log(state1)
  console.log(state2)

state2 is undefined.

i've tryed this on the First:

     onClick={() =>
       navigate(`/pago/${cnuevos.id}`, { state1: state, state2: JSON.stringify(cnuevos)})
      }>

and this on the second:

const { state1= { success: false }, state2 } = useLocation();
  const cnuevosA = JSON.parse(state2);

and everything else i try still undefined.


问:
How to show the percentage on screen after pressing the button using Kivy?
I'm trying to create a function that would show the shooting percentage after plotting the touch input data. I created a button and a label for it to display on the screen, but it is not showing up and I am getting an error *_apply_rule
with widget.canvas.before:
AttributeError: 'NoneType' object has no attribute 'before' *

sample code from main.py

```<code>    def on_touch_down(self, touch):
        # Add variables to keep track of shots made and missed
        shots_made = 0
        shots_missed = 0

        d = 10
        if self.collide_point(*touch.pos):
            self.canvas.add(Color(rgb=(46 / 255.0, 172 / 255.0, 88 / 255.0)))
            self.canvas.add(Ellipse(pos=(touch.x - d / 2, touch.y), size=(d, d)))

            # Calculate the pixel location relative to the top-left corner of the image
            x = touch.x - self.pos[0]
            y = self.size[1] - touch.y + self.pos[1]  # modified line

            # Increment the shots made counter
            shots_made += 1

            # Update the shooting percentage label
            self.ids.label_shooting_percentage.text = \
                f"Shooting Percentage: {shots_made / (shots_made + shots_missed):.2f}"
</code>```

sample code from kv file

```<code>BoxLayout:
        size_hint: None, None
        size: area_img.size
        pos_hint: {'center_x': .5, 'center_y': .5}
        Court:
            id: area_img
            source: 'half-court.png'
            size: self.texture_size
            # pos_hint: {'center_x': .5, 'center_y': .5}
            z: 1
        Label:
            id: label_shooting_percentage
            text: "Shooting Percentage: 0.00"
</code>```

I tried fixing the layouts because maybe those were the problem but even if I fix it, it is still the same. Tried changing it into an item in the bottomnavigation.

I'm expecting it to show the shooting percentage on screen after clicking the button "show percentage"

Body:
I'm trying to create a function that would show the shooting percentage after plotting the touch input data. I created a button and a label for it to display on the screen, but it is not showing up and I am getting an error *_apply_rule
with widget.canvas.before:
AttributeError: 'NoneType' object has no attribute 'before' *

sample code from main.py

    def on_touch_down(self, touch):
        # Add variables to keep track of shots made and missed
        shots_made = 0
        shots_missed = 0

        d = 10
        if self.collide_point(*touch.pos):
            self.canvas.add(Color(rgb=(46 / 255.0, 172 / 255.0, 88 / 255.0)))
            self.canvas.add(Ellipse(pos=(touch.x - d / 2, touch.y), size=(d, d)))

            # Calculate the pixel location relative to the top-left corner of the image
            x = touch.x - self.pos[0]
            y = self.size[1] - touch.y + self.pos[1]  # modified line

            # Increment the shots made counter
            shots_made += 1

            # Update the shooting percentage label
            self.ids.label_shooting_percentage.text = \
                f"Shooting Percentage: {shots_made / (shots_made + shots_missed):.2f}"

sample code from kv file

BoxLayout:
        size_hint: None, None
        size: area_img.size
        pos_hint: {'center_x': .5, 'center_y': .5}
        Court:
            id: area_img
            source: 'half-court.png'
            size: self.texture_size
            # pos_hint: {'center_x': .5, 'center_y': .5}
            z: 1
        Label:
            id: label_shooting_percentage
            text: "Shooting Percentage: 0.00"

I tried fixing the layouts because maybe those were the problem but even if I fix it, it is still the same. Tried changing it into an item in the bottomnavigation.

I'm expecting it to show the shooting percentage on screen after clicking the button "show percentage"


问:
How to use Hot Deck Imputation with multivariate feature in Python
I have a data set of retail sales that have both full information and missing information. I came across this link for using Hot Deck imputation to estimate the missing values. I have one column which holds the missing and the other columns are categorial variables.

My question is to how use multivariate and categorial variables in Hot deck imputation?

I came across this link but cannot derive the same approach with categorial variables.


问:
IntersectionObserver works incorrectly when scrolling

let isFooterVisible = false;
$(document).scroll(function() {
  var y = $(this).scrollTop();
  if (y > $('.btn').offset().top && isFooterVisible === false) {
    $('.btn').addClass("fixed");
  } else {
    $('.btn').removeClass("fixed");
  }
});
function isIntoView(entries, obs){
  entries.forEach(entry => {
     if (entry.target.id === 'end'){
       if (entry.isIntersecting === true){
         isFooterVisible = true;
         $('.btn').removeClass("fixed");
       }
       else{
         isFooterVisible = false;
       }
     }
  });
}
let options = {
  root: null,
  rootMargin: '0px',
  threshold: 0
};
let observer = new IntersectionObserver(isIntoView, options);
let target = $('#end')[0];
observer.observe(target);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.info {
  margin: 100px auto;
  text-align: center;
}

.btn {
  width: 200px;
  padding: 12px 50px;
  background-color: blue;
  margin: 0 auto;
  text-align: center;
}

.fixed {
  position: fixed;
  z-index: 99;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, -50%);
}</code>```

info

info

info

info

info

info

info

info

button

info

info

info

info

info

info

info

info

info

info

info

info

info

info
```

I want to make sure that at the moment of scrolling to a specific element, it is fixed on the page and is all the time when scrolling down, and until the moment of crossing another class, it is hidden.

I wrote this code, everything seems to be working, it appears and hides where it is needed, but when the page is scrolled, this fixed element lags wildly.

What could be the problem??

Body:
let isFooterVisible = false;
$(document).scroll(function() {
  var y = $(this).scrollTop();
  if (y > $('.btn').offset().top && isFooterVisible === false) {
    $('.btn').addClass("fixed");
  } else {
    $('.btn').removeClass("fixed");
  }
});
function isIntoView(entries, obs){
  entries.forEach(entry => {
     if (entry.target.id === 'end'){
       if (entry.isIntersecting === true){
         isFooterVisible = true;
         $('.btn').removeClass("fixed");
       }
       else{
         isFooterVisible = false;
       }
     }
  });
}
let options = {
  root: null,
  rootMargin: '0px',
  threshold: 0
};
let observer = new IntersectionObserver(isIntoView, options);
let target = $('#end')[0];
observer.observe(target);

.info {
  margin: 100px auto;
  text-align: center;
}

.btn {
  width: 200px;
  padding: 12px 50px;
  background-color: blue;
  margin: 0 auto;
  text-align: center;
}

.fixed {
  position: fixed;
  z-index: 99;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, -50%);
}

info

info

info

info

info

info

info

info

button

info

info

info

info

info

info

info

info

info

info

info

info

info

info

I want to make sure that at the moment of scrolling to a specific element, it is fixed on the page and is all the time when scrolling down, and until the moment of crossing another class, it is hidden.

I wrote this code, everything seems to be working, it appears and hides where it is needed, but when the page is scrolled, this fixed element lags wildly.

What could be the problem??


问:
LIBUSB_ERROR_NOT_SUPPORTED [-12] nfcpy
Hi I have been trying to run the example script shown on the documentation of the python library nfcpy, yet an error occurs:

this is the code:

```<code>import nfc
import ndef
from threading import Thread

def beam(llc):
    snep_client = nfc.snep.SnepClient(llc)
    snep_client.put_records([ndef.UriRecord('http://nfcpy.org')])

def connected(llc):
    Thread(target=beam, args=(llc,)).start()
    return True

with nfc.ContactlessFrontend('usb') as clf:
    clf.connect(llcp={'on-connect': connected})
</code>```

The error is:
Exception has occurred: USBErrorNotSupported LIBUSB_ERROR_NOT_SUPPORTED [-12] File "C:\Users\Emanuele\Desktop\myown-nfc-reader\main.py", line 13, in <module> with nfc.ContactlessFrontend('usb') as clf:

Does any of you know how I may be able to fix this? (acr122u is the device I'm using to read the cards)

Title: LIBUSB_ERROR_NOT_SUPPORTED [-12] nfcpy

Body:
Hi I have been trying to run the example script shown on the documentation of the python library nfcpy, yet an error occurs:

this is the code:

import nfc
import ndef
from threading import Thread

def beam(llc):
    snep_client = nfc.snep.SnepClient(llc)
    snep_client.put_records([ndef.UriRecord('http://nfcpy.org')])

def connected(llc):
    Thread(target=beam, args=(llc,)).start()
    return True

with nfc.ContactlessFrontend('usb') as clf:
    clf.connect(llcp={'on-connect': connected})

The error is:
Exception has occurred: USBErrorNotSupported LIBUSB_ERROR_NOT_SUPPORTED [-12] File "C:\Users\Emanuele\Desktop\myown-nfc-reader\main.py", line 13, in <module> with nfc.ContactlessFrontend('usb') as clf:

Does any of you know how I may be able to fix this? (acr122u is the device I'm using to read the cards)


问:
How to modify population within for-loop?
I have a for-loop to iterate over my population. For a condition, I want to remove that object from my population. When I run my model, a ConcurrentModificationException occurs. The reason should be, that I cannot modify my population, while iterating over the collection in a for-loop.

Is there any simple way to fix that problem?
I tried using an iterator, but because my code is in an event, which occurs every minute new, it did not really work.

```<code>for (testpop t : testpops) {
    if (dateToTime(t.arrival) <= time()) {
        System.out.println(t.arrival);
        remove_testpops(t);
    }
}
</code>```

Body:
I have a for-loop to iterate over my population. For a condition, I want to remove that object from my population. When I run my model, a ConcurrentModificationException occurs. The reason should be, that I cannot modify my population, while iterating over the collection in a for-loop.

Is there any simple way to fix that problem?
I tried using an iterator, but because my code is in an event, which occurs every minute new, it did not really work.

for (testpop t : testpops) {
    if (dateToTime(t.arrival) <= time()) {
        System.out.println(t.arrival);
        remove_testpops(t);
    }
}


问:
django.urls.exceptions.NoReverseMatch: Reverse for 'watchlist' not found. 'watchlist' is not a valid view function or pattern name
I am building a django (v3.2.5) project called commerce which has an app called auctions.

urls.py for commerce:

```<code>from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path("admin/", admin.site.urls),
    path("", include("auctions.urls"))
]
</code>```

urls.py of auctions: (notice that watchlist path is commented out)

```<code>from django.urls import path

from . import views
app_name = 'auctions'

urlpatterns = [
    path("", views.index, name="index"),
    path("login", views.login_view, name="login"),
    path("logout", views.logout_view, name="logout"),
    path("register", views.register, name="register"),
    path("create", views.create, name='create'),
    path("listing/<int:listing_id>/", views.listing, name='listing'),
    # path("watchlist/", views.watchlist, name='watchlist')
]
</code>```

views.py: (watchlist function is commented out)

```<code>@login_required(login_url='/login')
def listing(request, listing_id):
    if request.method == 'GET':
        listing_data = list(Listing.objects.filter(id = listing_id))
        return render(request, "auctions/listing.html", context={"listings":listing_data})
    else:
        pass

# @login_required(login_url='/login')
# def watchlist(request):
#     pass
</code>```

index.html:

```<code><a href="{% url 'auctions:listing' listing.id %}" class="btn btn-primary">View Listing</a>
</code>```

This is the only tag that points to the listing function/path in views.py. No tag points to the watchlist function/path.

This is the error message when I click on the above tag to go to listing.html
enter image description here

The error points to this particular line of code in views.py:

```<code>return render(request, "auctions/listing.html", context={"listings":listing_data})
</code>```

Whenever I remove the context dictionary, that is put only the request and the template in render(),the code runs perfectly fine and gives me listing.html, but of course without the data.

```<code>return render(request, "auctions/listing.html")
</code>```

The above works perfectly fine and renders.

This code was working fine until I began developing the watchlist feature. Despite watchlist being commented out in urls.py, views.py and the templates, the issue still persisted. I added 'app_name=auctions' in urls.py. I tried using a form instead of an anchor tag.

Body:
I am building a django (v3.2.5) project called commerce which has an app called auctions.

urls.py for commerce:

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path("admin/", admin.site.urls),
    path("", include("auctions.urls"))
]

urls.py of auctions: (notice that watchlist path is commented out)

from django.urls import path

from . import views
app_name = 'auctions'

urlpatterns = [
    path("", views.index, name="index"),
    path("login", views.login_view, name="login"),
    path("logout", views.logout_view, name="logout"),
    path("register", views.register, name="register"),
    path("create", views.create, name='create'),
    path("listing/<int:listing_id>/", views.listing, name='listing'),
    # path("watchlist/", views.watchlist, name='watchlist')
]

views.py: (watchlist function is commented out)

@login_required(login_url='/login')
def listing(request, listing_id):
    if request.method == 'GET':
        listing_data = list(Listing.objects.filter(id = listing_id))
        return render(request, "auctions/listing.html", context={"listings":listing_data})
    else:
        pass

# @login_required(login_url='/login')
# def watchlist(request):
#     pass

index.html:

View Listing

This is the only tag that points to the listing function/path in views.py. No tag points to the watchlist function/path.

This is the error message when I click on the above tag to go to listing.html
enter image description here

The error points to this particular line of code in views.py:

return render(request, "auctions/listing.html", context={"listings":listing_data})

Whenever I remove the context dictionary, that is put only the request and the template in render(),the code runs perfectly fine and gives me listing.html, but of course without the data.

return render(request, "auctions/listing.html")

The above works perfectly fine and renders.

This code was working fine until I began developing the watchlist feature. Despite watchlist being commented out in urls.py, views.py and the templates, the issue still persisted. I added 'app_name=auctions' in urls.py. I tried using a form instead of an anchor tag.


问:
AWS Apigateway can not receive headers from Aws Lambda response
I am trying to send a redirection response from AWS lambda to API gateway resource, But unfortunately, Api gateway can not see the headers of my redirection response. Here is my return statement from java based lambda function

return APIGatewayV2HTTPResponse httpResponse = APIGatewayV2HTTPResponse.builder()                                                   .withHeaders(                                                       Map.of("Location", backEnd, "Code", idToken,                                                           "Content-Type", "application/json"))                                                   .withStatusCode(302)                                                   .build();

Configs in Apigateway
Configs in Apigateway

Is there anything wrong?

I tried to add a mapping template like this

{   "method": "$context.httpMethod",   "body" : $input.json('$'),   "headers": {     #foreach($param in $input.params().header.keySet())     "$param": "$util.escapeJavaScript($input.params().header.get($param))"     #if($foreach.hasNext),#end     #end   } }

but it did not help.


问:
Draw lines from array in pinescript
The code below keeps giving me an out of bounds error for the array.get function, whereby the dynamically referenced index is same as the array size rather than 1 less than the array size.</p>
```<code>// FVG
imbL1 = valuewhen(engBull3, low[1], 0)
imbH1 = valuewhen(engBull3, high[1], 0)
imbL2 = valuewhen(engBear3, low[1], 0)
imbH2 = valuewhen(engBear3, high[1], 0)
fvgFound1 = barssince(engBull3[1] and low > high[2]) < 2 and pLFound
fvgFound2 = barssince(engBear3[1] and high < low[2]) < 2 and pHFound
fvgH1 = valuewhen(fvgFound1, imbH1, 0)
fvgL1 = valuewhen(fvgFound1, imbL1, 0)
fvgH2 = valuewhen(fvgFound2, imbH2, 0)
fvgL2 = valuewhen(fvgFound2, imbL2, 0)
fvgPos1 = count-valuewhen(engBull3, count,0)
fvgPos2 = count-valuewhen(engBear3, count,0)

var int[] fvg1_x1 = array.new_int()
var int[] fvg1_x2 = array.new_int()
var float[] fvg1_y = array.new_float()

if fvgFound1
    array.push(fvg1_x1, bar_index-fvgPos1)
    array.push(fvg1_x2, bar_index)
    array.push(fvg1_y, fvgH1)

for i = 0 to (array.size(fvg1_y) == 0 ? na : array.size(fvg1_y) - 1)
    if low == array.get(fvg1_y,i)
        array.remove(fvg1_y,i)
        array.remove(fvg1_x1,i)
        array.remove(fvg1_x2,i)

for i = 0 to (array.size(fvg1_y) == 0 ? na : array.size(fvg1_y) - 1)
    line.new(array.get(fvg1_x1,i), array.get(fvg1_y,i),array.get(fvg1_x2,i), array.get(fvg1_y,i))
</code>```

Title: Draw lines from array in pinescript

Body:
The code below keeps giving me an out of bounds error for the array.get function, whereby the dynamically referenced index is same as the array size rather than 1 less than the array size.

// FVG
imbL1 = valuewhen(engBull3, low[1], 0)
imbH1 = valuewhen(engBull3, high[1], 0)
imbL2 = valuewhen(engBear3, low[1], 0)
imbH2 = valuewhen(engBear3, high[1], 0)
fvgFound1 = barssince(engBull3[1] and low > high[2]) < 2 and pLFound
fvgFound2 = barssince(engBear3[1] and high < low[2]) < 2 and pHFound
fvgH1 = valuewhen(fvgFound1, imbH1, 0)
fvgL1 = valuewhen(fvgFound1, imbL1, 0)
fvgH2 = valuewhen(fvgFound2, imbH2, 0)
fvgL2 = valuewhen(fvgFound2, imbL2, 0)
fvgPos1 = count-valuewhen(engBull3, count,0)
fvgPos2 = count-valuewhen(engBear3, count,0)

var int[] fvg1_x1 = array.new_int()
var int[] fvg1_x2 = array.new_int()
var float[] fvg1_y = array.new_float()

if fvgFound1
    array.push(fvg1_x1, bar_index-fvgPos1)
    array.push(fvg1_x2, bar_index)
    array.push(fvg1_y, fvgH1)

for i = 0 to (array.size(fvg1_y) == 0 ? na : array.size(fvg1_y) - 1)
    if low == array.get(fvg1_y,i)
        array.remove(fvg1_y,i)
        array.remove(fvg1_x1,i)
        array.remove(fvg1_x2,i)

for i = 0 to (array.size(fvg1_y) == 0 ? na : array.size(fvg1_y) - 1)
    line.new(array.get(fvg1_x1,i), array.get(fvg1_y,i),array.get(fvg1_x2,i), array.get(fvg1_y,i))