问:
Validating XML against local DTD. Problems with EntityResolver2
I have to validate some XML files against a local DTD file. The XML could be without DOCTYPE. Here is the body of my main method:

```<code>XMLReader reader;
    DTDManipulator dtdhandler;
    XMLValidationEvendHandler errorhandler = new XMLValidationEvendHandler();
    try {
        dtdhandler = new DTDManipulator();
        dtdhandler.setDTDentity("file:///Users/hp/Desktop/BOX/A/Ordinanze.dtd");
        reader = XMLReaderFactory.createXMLReader();
        reader.setErrorHandler(errorhandler);
        reader.setEntityResolver(dtdhandler);
        //reader.setFeature("http://xml.org/sax/features/use-entity-resolver2", true);
        reader.setFeature("http://xml.org/sax/features/validation",true);

        reader.parse(new InputSource("OT201011120071_045NODTD.xml"));
        if(errorhandler.isNoerrors()) {
            System.out.println("SUCCESS!");
        }
    } catch (SAXException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ParserConfigurationException e) {
        e.printStackTrace();
    }
    for(int i=0; i<errorhandler.getExceptionOccurred().length; i++) System.out.println(errorhandler.getExceptionOccurred()[i].getMessage());
    System.exit(0);
</code>```

DTD implements EntityResolver2:

```<code>public class DTDManipulator implements EntityResolver2 {

private String dtd;

public void setDTDentity(String entity) {
    System.out.println("DTDManipulator.setDTDentity:");
    System.out.println(" - entity = "+entity);
    dtd = entity;
}

@Override
public InputSource resolveEntity(String publicId, String systemId)
        throws SAXException, IOException {
    System.out.println("DTDManipulator.resolveEntity:");
    System.out.println(" - publicId = "+publicId);
    System.out.println(" - systemId = "+systemId);
    System.out.println(" - get back = "+"");
    return new InputSource(dtd);
}

@Override
public InputSource getExternalSubset(String name, String baseURI)
        throws SAXException, IOException {
    System.out.println("DTDManipulator.getExternalSubset:");
    System.out.println(" - name = "+name);
    System.out.println(" - baseURI = "+baseURI);
    System.out.println(" - get back = "+dtd);
    return new InputSource(dtd);
}

@Override
public InputSource resolveEntity(String name, String publicId,
        String baseURI, String systemId) throws SAXException, IOException {
    System.out.println("DTDManipulator.resolveEntity:");
    System.out.println(" - name = "+name);
    System.out.println(" - publicId = "+publicId);
    System.out.println(" - baseURI = "+baseURI);
    System.out.println(" - systemId = "+systemId);
    System.out.println(" - get back = "+dtd);
    return new InputSource(dtd);
}
</code>```

}

}

When I try to validate an XML whitout DTD references inside i got an unexpected behavior: no DOCTYPE is added before the document root, the method getExternalSubset of DTDManipulator is never called.
I can't guess why, what am I missing? Thanks in advance, excuse my english.

Francesco

ContentLicense: CC BY-SA 3.0

Body:
I have to validate some XML files against a local DTD file. The XML could be without DOCTYPE. Here is the body of my main method:

XMLReader reader;
    DTDManipulator dtdhandler;
    XMLValidationEvendHandler errorhandler = new XMLValidationEvendHandler();
    try {
        dtdhandler = new DTDManipulator();
        dtdhandler.setDTDentity("file:///Users/hp/Desktop/BOX/A/Ordinanze.dtd");
        reader = XMLReaderFactory.createXMLReader();
        reader.setErrorHandler(errorhandler);
        reader.setEntityResolver(dtdhandler);
        //reader.setFeature("http://xml.org/sax/features/use-entity-resolver2", true);
        reader.setFeature("http://xml.org/sax/features/validation",true);

        reader.parse(new InputSource("OT201011120071_045NODTD.xml"));
        if(errorhandler.isNoerrors()) {
            System.out.println("SUCCESS!");
        }
    } catch (SAXException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ParserConfigurationException e) {
        e.printStackTrace();
    }
    for(int i=0; i<errorhandler.getExceptionOccurred().length; i++) System.out.println(errorhandler.getExceptionOccurred()[i].getMessage());
    System.exit(0);

DTD implements EntityResolver2:

public class DTDManipulator implements EntityResolver2 {

private String dtd;

public void setDTDentity(String entity) {
    System.out.println("DTDManipulator.setDTDentity:");
    System.out.println(" - entity = "+entity);
    dtd = entity;
}

@Override
public InputSource resolveEntity(String publicId, String systemId)
        throws SAXException, IOException {
    System.out.println("DTDManipulator.resolveEntity:");
    System.out.println(" - publicId = "+publicId);
    System.out.println(" - systemId = "+systemId);
    System.out.println(" - get back = "+"");
    return new InputSource(dtd);
}

@Override
public InputSource getExternalSubset(String name, String baseURI)
        throws SAXException, IOException {
    System.out.println("DTDManipulator.getExternalSubset:");
    System.out.println(" - name = "+name);
    System.out.println(" - baseURI = "+baseURI);
    System.out.println(" - get back = "+dtd);
    return new InputSource(dtd);
}

@Override
public InputSource resolveEntity(String name, String publicId,
        String baseURI, String systemId) throws SAXException, IOException {
    System.out.println("DTDManipulator.resolveEntity:");
    System.out.println(" - name = "+name);
    System.out.println(" - publicId = "+publicId);
    System.out.println(" - baseURI = "+baseURI);
    System.out.println(" - systemId = "+systemId);
    System.out.println(" - get back = "+dtd);
    return new InputSource(dtd);
}

}

}

When I try to validate an XML whitout DTD references inside i got an unexpected behavior: no DOCTYPE is added before the document root, the method getExternalSubset of DTDManipulator is never called.
I can't guess why, what am I missing? Thanks in advance, excuse my english.

Francesco


来源: stackexchange

问:
serve static content with nginx proxypass
I have a python application with a folder of static css and js elements, which I want to serve with nginx. The app works and does the proxypass to localhost:3000 where I have my app running, but it's unstyled because it doesn't load the jss and css elements.
This is my nginx configuration, in nginx/conf/example.conf:

```<code>server {
    listen       443 ssl http2;
    listen  [::]:443 ssl http2;

    server_name  example.com;

    #access_log  /var/log/nginx/example.access.log  main;
    error_log  /var/log/nginx/example.error.log  error;

    ssl_certificate /path/example.crt;
    ssl_certificate_key /path/example.key;
    ssl_trusted_certificate /path/example.pem;
    include nginx/conf.d/ssl.conf;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}
</code>```

I get the following error in the browser:

Refused to apply style from 'https://example.com/static/path/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

And in the python application log I get the following error as well:

Method Not Allowed (GET): /static/path/style.css

I have tried to introduce another new location like the following, but it gives me a 404 for static files:

```<code>    location /static/ {
        root /path_app;
    }

</code>```

I have also tried this:

```<code>    location /static/ {
        alias /path_app/static;
    }

</code>```

Any solution to be able to allow these requests in nginx proxy server? Or how can I serve the static content?
thanks to the community

Serve static content through nginx with proxy pass to a python application on my server

ContentLicense: CC BY-SA 4.0

Body:
I have a python application with a folder of static css and js elements, which I want to serve with nginx. The app works and does the proxypass to localhost:3000 where I have my app running, but it's unstyled because it doesn't load the jss and css elements.
This is my nginx configuration, in nginx/conf/example.conf:

server {
    listen       443 ssl http2;
    listen  [::]:443 ssl http2;

    server_name  example.com;

    #access_log  /var/log/nginx/example.access.log  main;
    error_log  /var/log/nginx/example.error.log  error;

    ssl_certificate /path/example.crt;
    ssl_certificate_key /path/example.key;
    ssl_trusted_certificate /path/example.pem;
    include nginx/conf.d/ssl.conf;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

I get the following error in the browser:

Refused to apply style from 'https://example.com/static/path/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

And in the python application log I get the following error as well:

Method Not Allowed (GET): /static/path/style.css

I have tried to introduce another new location like the following, but it gives me a 404 for static files:

    location /static/ {
        root /path_app;
    }

I have also tried this:

    location /static/ {
        alias /path_app/static;
    }

Any solution to be able to allow these requests in nginx proxy server? Or how can I serve the static content?
thanks to the community

Serve static content through nginx with proxy pass to a python application on my server


问:
BadImageFormatException during compilation - System.Xml.XDocument namespace
Had some hard disk corruption issue. Hence moved my solution directory from HDD to SSD. Not sure if the below error is due to this movement. But post this movement, i get the below error while building my solution. The only thing I could understand from this is that there exists some issue while loading System.Xml.XDocument. I see this reference is by default added to the web application solution. I am targetting to project to framework 4.8.

I checked for the presence of the DLL C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.8\System.Xml.dll. It does exists. But I am not sure if the name space that is throwing this error is present in this DLL and I am looking at the right place for this DLL. Also not sure why this problem comes up all of a sudden without a major change.

```<code>Severity    Code    Description Project File    Line    Suppression State
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.VisitNamespace(NamespaceSymbol symbol)    ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CompileImpl(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) ITPortal
Error       Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'System.Xml.XDocument, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The file or directory is corrupted and unreadable. (Exception from HRESULT: 0x80070570)  ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.VisitNamedType(NamedTypeSymbol symbol)    ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.WriteDocumentationCommentXml(CSharpCompilation compilation, String assemblyName, Stream xmlDocStream, DiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree filterTree, Nullable`1 filterSpanWithinTree) ITPortal
Error       at Microsoft.CodeAnalysis.Compilation.Emit(EmitStreamProvider peStreamProvider, EmitStreamProvider pdbStreamProvider, EmitStreamProvider xmlDocumentationStreamProvider, EmitStreamProvider win32ResourcesStreamProvider, IEnumerable`1 manifestResources, EmitOptions options, CompilationTestData testData, Func`1 getHostDiagnostics, CancellationToken cancellationToken)   ITPortal
Error       at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken)    ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.<>c__DisplayClass1_0.<Run>b__0(TextWriter textWriterOut, TextWriter _) ITPortal
Error       at Microsoft.CodeAnalysis.BuildTasks.BuildClient.RunWithConsoleOutput(String[] args, String clientDir, String workingDir, String sdkDir, IAnalyzerAssemblyLoader analyzerLoader, RequestLanguage language, Func`5 fallbackCompiler) ITPortal
Error       at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken) ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.VisitNamespace(NamespaceSymbol symbol)    ITPortal
Error       at Microsoft.CodeAnalysis.Compilation.Compile(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken)  ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)    ITPortal
Error       at Roslyn.Utilities.ConsoleUtil.RunWithEncoding[T](Encoding encoding, Func`3 func)  ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.DefaultVisit(Symbol symbol)   ITPortal

</code>```

Kindly help..

Thanks & Regards,
S. Sudharsan

Body:
Had some hard disk corruption issue. Hence moved my solution directory from HDD to SSD. Not sure if the below error is due to this movement. But post this movement, i get the below error while building my solution. The only thing I could understand from this is that there exists some issue while loading System.Xml.XDocument. I see this reference is by default added to the web application solution. I am targetting to project to framework 4.8.

I checked for the presence of the DLL C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.8\System.Xml.dll. It does exists. But I am not sure if the name space that is throwing this error is present in this DLL and I am looking at the right place for this DLL. Also not sure why this problem comes up all of a sudden without a major change.

Severity    Code    Description Project File    Line    Suppression State
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.VisitNamespace(NamespaceSymbol symbol)    ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CompileImpl(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) ITPortal
Error       Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'System.Xml.XDocument, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The file or directory is corrupted and unreadable. (Exception from HRESULT: 0x80070570)  ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.VisitNamedType(NamedTypeSymbol symbol)    ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.WriteDocumentationCommentXml(CSharpCompilation compilation, String assemblyName, Stream xmlDocStream, DiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree filterTree, Nullable`1 filterSpanWithinTree) ITPortal
Error       at Microsoft.CodeAnalysis.Compilation.Emit(EmitStreamProvider peStreamProvider, EmitStreamProvider pdbStreamProvider, EmitStreamProvider xmlDocumentationStreamProvider, EmitStreamProvider win32ResourcesStreamProvider, IEnumerable`1 manifestResources, EmitOptions options, CompilationTestData testData, Func`1 getHostDiagnostics, CancellationToken cancellationToken)   ITPortal
Error       at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken)    ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.<>c__DisplayClass1_0.<Run>b__0(TextWriter textWriterOut, TextWriter _) ITPortal
Error       at Microsoft.CodeAnalysis.BuildTasks.BuildClient.RunWithConsoleOutput(String[] args, String clientDir, String workingDir, String sdkDir, IAnalyzerAssemblyLoader analyzerLoader, RequestLanguage language, Func`5 fallbackCompiler) ITPortal
Error       at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken) ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.VisitNamespace(NamespaceSymbol symbol)    ITPortal
Error       at Microsoft.CodeAnalysis.Compilation.Compile(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, Boolean emittingPdb, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken)  ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args)    ITPortal
Error       at Roslyn.Utilities.ConsoleUtil.RunWithEncoding[T](Encoding encoding, Func`3 func)  ITPortal
Error       at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.DefaultVisit(Symbol symbol)   ITPortal

Kindly help..

Thanks & Regards,
S. Sudharsan


问:
How can I use apply() function to compare two dataframes?
I have two pandas dataframes that i'd like to compare. One dataframe is large and is an inventory list. I'd like to take a row from df and compare it to every row in df_inventory and repeat the process for every row in df.

```<code>df.head()

   item
0  paintbrush
1  mop #2
2  red bucket
3  o-light flashlight

df_inventory.head()

   item_desc
0  broom
1  mop
2  bucket
3  flashlight
</code>```

I'm trying a single apply() function which is resulting in a ValueError, should i be using a nested apply() to have both dataframes go through each row?

```<code>test = pd.DataFrame({'item':['example']})
test['similarity'] = test['item'].apply(lambda x: fuzz.ratio(x,df_inventory['item_desc'])
</code>```

Body:
I have two pandas dataframes that i'd like to compare. One dataframe is large and is an inventory list. I'd like to take a row from df and compare it to every row in df_inventory and repeat the process for every row in df.

df.head()

   item
0  paintbrush
1  mop #2
2  red bucket
3  o-light flashlight

df_inventory.head()

   item_desc
0  broom
1  mop
2  bucket
3  flashlight

I'm trying a single apply() function which is resulting in a ValueError, should i be using a nested apply() to have both dataframes go through each row?

test = pd.DataFrame({'item':['example']})
test['similarity'] = test['item'].apply(lambda x: fuzz.ratio(x,df_inventory['item_desc'])


问:
Creating date counter using javascript in django
For every order, I have a functioning Javascript counter. so when I load the data using a for loop, it should work in each counter for every order. However, only one counter seems to work. What should I change? Here is my code.

The HTML:

    {% for order in orders %}

Application: {{ order.orderdetail }}

Ordered Time: {{ order.date }}

Delivery Time: {{ order.delivery_time }}

Remaining Time: 0000

                {% endfor %}
```

The orders with counters:

Body:
For every order, I have a functioning Javascript counter. so when I load the data using a for loop, it should work in each counter for every order. However, only one counter seems to work. What should I change? Here is my code.

The HTML:

    {% for order in orders %}

Application: {{ order.orderdetail }}

Ordered Time: {{ order.date }}

Delivery Time: {{ order.delivery_time }}

Remaining Time: 0000

                {% endfor %}

The orders with counters:


问:
How can I set hotkey for Windows Context Menu item?
I use PasteIntoFile software to paste image from clipboard to file.
The software registers a menu item in Windows Context Menu: "Paste Into File"

I would like to assign a hotkey (for example CTRL+Y) to activate this function.
How can I do this in the registry? Thanks!


问:
Azure Devops Server 2019 - Powershell@2 task does not run when Start-Process cmdlet is used with -Credential option
I use Azure Devops Server 2019 ( On prem). I have a YAML build pipeline where I need to execute a command (mycmd.exe) as a different user than the one running the Azure agent. I use the PowerShell@2 task  and tried the following using -Credential option of start-process

```<code>$runasUser = "user1@mydomain.com"

$password = "mypassWord"

$runasPassword = "$password"  | ConvertTo-SecureString -AsPlainText -Force

$runAsCredential = New-Object System.Management.Automation.PSCredential ( $runasUser, $runasPassword )

Start-Process mycmd.exe -ArgumentList $params -Credential $runAsCredential -WorkingDirectory "$binaryPath" -NoNewWindow -Wait -RedirectStandardOutput "$binaryPath\stdOut.txt" -RedirectStandardError "$binaryPath\stdErrorOut.txt"
</code>```

The process seems to exit without performing any task. I see the  redirects files stdOut.txt and stdErrorOut.txt are both empty.

I tried to use Wait-Process cmdlet instead of -Wait (as mentioned here Start-Process hangs when used with -Credential ) but that did not work either.

```<code>Start-Process mycmd.exe -ArgumentList $params -Credential $runAsCredential -WorkingDirectory "$binaryPath" -NoNewWindow -PassThru -RedirectStandardOutput "$binaryPath\stdOut.txt" -RedirectStandardError "$binaryPath\stdErrorOut.txt" | Wait-Process
</code>```

I saw this post as well Azure Pipelines: Start-Process with credentials not working but unfortunately I do not have the privilege of running the process as a scheduled task on the agent server

Any help is much appreciated

Body:
I use Azure Devops Server 2019 ( On prem). I have a YAML build pipeline where I need to execute a command (mycmd.exe) as a different user than the one running the Azure agent. I use the PowerShell@2 task  and tried the following using -Credential option of start-process

$runasUser = "user1@mydomain.com"

$password = "mypassWord"

$runasPassword = "$password"  | ConvertTo-SecureString -AsPlainText -Force

$runAsCredential = New-Object System.Management.Automation.PSCredential ( $runasUser, $runasPassword )

Start-Process mycmd.exe -ArgumentList $params -Credential $runAsCredential -WorkingDirectory "$binaryPath" -NoNewWindow -Wait -RedirectStandardOutput "$binaryPath\stdOut.txt" -RedirectStandardError "$binaryPath\stdErrorOut.txt"

The process seems to exit without performing any task. I see the  redirects files stdOut.txt and stdErrorOut.txt are both empty.

I tried to use Wait-Process cmdlet instead of -Wait (as mentioned here Start-Process hangs when used with -Credential ) but that did not work either.

Start-Process mycmd.exe -ArgumentList $params -Credential $runAsCredential -WorkingDirectory "$binaryPath" -NoNewWindow -PassThru -RedirectStandardOutput "$binaryPath\stdOut.txt" -RedirectStandardError "$binaryPath\stdErrorOut.txt" | Wait-Process

I saw this post as well Azure Pipelines: Start-Process with credentials not working but unfortunately I do not have the privilege of running the process as a scheduled task on the agent server

Any help is much appreciated


问:
Is django data migration immediately applied?
I read the following text on docs:
"""
Django’s default behavior is to run in autocommit mode. Each query is immediately committed to the database, unless a transaction is active. See below for details.
"""

and I'm running the following data migration:

def fill_query(apps, schema_editor):
    Result = apps.get_model('monitoring', 'Result')
    for r in Result.objects.all():
         r.query = r.monitored_search.query
         r.user_id = r.monitored_search.user_id
         r.save()

class Migration(migrations.Migration):

    dependencies = [
        ('monitoring', '0006_searchresult_user_id'),
    ]

    operations = [
        migrations.RunPython(fill_query),
    ]
```

But when I try to find objects from Result I found that all still have query and user_id as null. And my data migration keep running (more than 2 millions registers on database)

maybe the changes will be applied when data migration stop running or my data migration is not working?

Body:
I read the following text on docs:
"""
Django’s default behavior is to run in autocommit mode. Each query is immediately committed to the database, unless a transaction is active. See below for details.
"""

and I'm running the following data migration:

def fill_query(apps, schema_editor):
    Result = apps.get_model('monitoring', 'Result')
    for r in Result.objects.all():
         r.query = r.monitored_search.query
         r.user_id = r.monitored_search.user_id
         r.save()

class Migration(migrations.Migration):

    dependencies = [
        ('monitoring', '0006_searchresult_user_id'),
    ]

    operations = [
        migrations.RunPython(fill_query),
    ]

But when I try to find objects from Result I found that all still have query and user_id as null. And my data migration keep running (more than 2 millions registers on database)

maybe the changes will be applied when data migration stop running or my data migration is not working?


问:
how to build parent-subdepartment data table in excel?
I have data in below format

I need this to be realigned indicating the top most parent level department for every departm

In the screenshot below, the topmost parent dept for Europe is Accounts & Payments. Can anyone please help me to realign with Macro

Realigned screenshot

I am new to Excel macro, so i couldn't find the way to get it doen

Can anyone please me on this ?


问:
UWP app typeof returns null in Release build
After upgrading an Windows Store App from win 8.1 to 10, we are having trouble using simple reflection in our app. In my application i have a type MyMobile.ViewModels.ShellViewModel, but calling typeof(ShellViewModel) returns null on application start.

I suspect this has something to do with following:
The "Compile with .NET Native tool chain" is enabled i project properties, and we have the following content Runtime Directive (Default.rd.xml).

```<code><Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
  <Application>
    <!--
      An Assembly element with Name="*Application*" applies to all assemblies in
      the application package. The asterisks are not wildcards.
    -->
    <Assembly Name="*Application*" Dynamic="Required All" />
  </Application>
</Directives>
</code>```

Which is the default runtime directive file added when creating the UWP project. As per my understanding this should be enough to run "typeof" on types in your own assembly?

Body:
After upgrading an Windows Store App from win 8.1 to 10, we are having trouble using simple reflection in our app. In my application i have a type MyMobile.ViewModels.ShellViewModel, but calling typeof(ShellViewModel) returns null on application start.

I suspect this has something to do with following:
The "Compile with .NET Native tool chain" is enabled i project properties, and we have the following content Runtime Directive (Default.rd.xml).

<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
  <Application>

    <Assembly Name="*Application*" Dynamic="Required All" />
  </Application>
</Directives>

Which is the default runtime directive file added when creating the UWP project. As per my understanding this should be enough to run "typeof" on types in your own assembly?


问:
How can I tell when exactly a certain sound threshold is passed?
I'm trying to create a script that records video samples from a live stream, labels, and stores them.
the end goal for this task, is to generate annotated data for lip reading.
it means I have to know exactly when a word was started, and when it was ended.

I'm using speech detection library for that purpose.
I thought maybe I should start recording whenever a threshold is passed in sound.

any idea how do I extract the exact time of that event?
or otherwise, if there's is a way to separate between words in a sentence?

this is my code:

```<code>import speech_recognition as sr
r = sr.Recognizer()

def callback(recognizer, audio1):
    # received audio data, now we'll recognize it using Google Speech Recognition
    try:
        # for testing purposes, we're just using the default API key
        # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")`
        # instead of `r.recognize_google(audio)`
        print("Google Speech Recognition thinks you said " + recognizer.recognize_google(audio1))
    except sr.UnknownValueError:
        print("Google Speech Recognition could not understand audio")
    except sr.RequestError as e:
        print("Could not request results from Google Speech Recognition service; {0}".format(e))

r.energy_threshold = 50
r.dynamic_energy_threshold = False
m = sr.Microphone()
# with m as source:
#     r.adjust_for_ambient_noise(source)  # we only need to calibrate once, before we start listening
#     print("Say something!")
#     audio = r.listen(source)

# start listening in the background (note that we don't have to do this inside a `with` statement)
stop_listening = r.listen_in_background(m, callback)

print("listening")

stop_listening(wait_for_stop=False)
print("stopeed listening")

</code>```

Body:
I'm trying to create a script that records video samples from a live stream, labels, and stores them.
the end goal for this task, is to generate annotated data for lip reading.
it means I have to know exactly when a word was started, and when it was ended.

I'm using speech detection library for that purpose.
I thought maybe I should start recording whenever a threshold is passed in sound.

any idea how do I extract the exact time of that event?
or otherwise, if there's is a way to separate between words in a sentence?

this is my code:

import speech_recognition as sr
r = sr.Recognizer()

def callback(recognizer, audio1):
    # received audio data, now we'll recognize it using Google Speech Recognition
    try:
        # for testing purposes, we're just using the default API key
        # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")`
        # instead of `r.recognize_google(audio)`
        print("Google Speech Recognition thinks you said " + recognizer.recognize_google(audio1))
    except sr.UnknownValueError:
        print("Google Speech Recognition could not understand audio")
    except sr.RequestError as e:
        print("Could not request results from Google Speech Recognition service; {0}".format(e))

r.energy_threshold = 50
r.dynamic_energy_threshold = False
m = sr.Microphone()
# with m as source:
#     r.adjust_for_ambient_noise(source)  # we only need to calibrate once, before we start listening
#     print("Say something!")
#     audio = r.listen(source)

# start listening in the background (note that we don't have to do this inside a `with` statement)
stop_listening = r.listen_in_background(m, callback)

print("listening")

stop_listening(wait_for_stop=False)
print("stopeed listening")


问:
Spring Boot service cannot return payload in AWS - unknown 500 status
I have multiple spring boot services, running in Docker on AWS ECS.  Pretty typical: Spring Cloud Server (Eureka), Config Server, Postgres in RDS.  However, I have one GET call that fails every time.  I have logging that shows me the data pulled from the database, logged, and returned.  No error logs in the CloudWatch, but the curl results in

```<code>{"timestamp":"2022-12-15T14:10:22.333+00:00","status":500,"error":"Internal Server Error","path”:”/person/aab3f9c6-bcf0-48f9-93f1-9c0b67bb5a39"}
</code>```

And here is the value retrieved from the db:

```<code>Person person = Person(personId=3, internalId=64ffc6b8-ccd9-4c6c-89d3-411729aa8155, recordIndicator=null, personType=RESIDENT, firstName=Annabeth Jones, lastName=Smith, lastFourSSN=1234, gender=Female, race=null, ethnicity=White, blood=A+, imagePath=null, activationDate=2020-06-07, deactivationDate=null, dateOfBirth=1966-08-26, address=Address(addressId=10, addressLine1=1234 Maple Lane, addressLine2=, city=Colorado Springs, state=CO, zip=77777-1234, latitude=null, longitude=null), subscriptionDate=null, subscriptionId=null, officeInternalId=null)
</code>```

which is then returned this way:

```<code> ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(person);
</code>```

There are no errors in the logs, and all other similar calls work correctly.  I am not sure where to look to try and find the problem.

Body:
I have multiple spring boot services, running in Docker on AWS ECS.  Pretty typical: Spring Cloud Server (Eureka), Config Server, Postgres in RDS.  However, I have one GET call that fails every time.  I have logging that shows me the data pulled from the database, logged, and returned.  No error logs in the CloudWatch, but the curl results in

{"timestamp":"2022-12-15T14:10:22.333+00:00","status":500,"error":"Internal Server Error","path”:”/person/aab3f9c6-bcf0-48f9-93f1-9c0b67bb5a39"}

And here is the value retrieved from the db:

Person person = Person(personId=3, internalId=64ffc6b8-ccd9-4c6c-89d3-411729aa8155, recordIndicator=null, personType=RESIDENT, firstName=Annabeth Jones, lastName=Smith, lastFourSSN=1234, gender=Female, race=null, ethnicity=White, blood=A+, imagePath=null, activationDate=2020-06-07, deactivationDate=null, dateOfBirth=1966-08-26, address=Address(addressId=10, addressLine1=1234 Maple Lane, addressLine2=, city=Colorado Springs, state=CO, zip=77777-1234, latitude=null, longitude=null), subscriptionDate=null, subscriptionId=null, officeInternalId=null)

which is then returned this way:

 ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(person);

There are no errors in the logs, and all other similar calls work correctly.  I am not sure where to look to try and find the problem.


问:
ValueError: shapes (2,1000) and (2,2,1000) not aligned: 1000 (dim 1) != 2 (dim 1)
I'm implementing a MLP to test a simple NN architecture, hoping to scale up to a bigger network with a larger dataset. My end goal is making a working phone recognizer for TIMIT data, as part of my internship.
To build the MLP, I used the suggestions of this video: https://www.youtube.com/watch?v=Z97XGNUUx9o.
And the proposal of my teacher to use the following inputs:

```<code>X = np.random.rand(5,1000)
y = X[4:5,:]
</code>```

The error message is the following:

```<code>ValueError                                Traceback (most recent call last)
Cell In [63], line 7
      5 build_model()
      6 mlp = MLP(1000, [1000], 1000)
----> 7 mlp.train(inputs,targets, 50, 0.1)
      8 output = mlp.forward_propagate(input)

Cell In [62], line 117, in MLP.train(self, inputs, targets, epochs, learning_rate)
    115 output = self.forward_propagate(input)
    116 error = target - output
--> 117 self.back_propagate(error)
    118 self.gradient_descent(learning_rate=1)
    119 sum_error += self._mse(target,output)

Cell In [62], line 96, in MLP.back_propagate(self, error)
     94     current_activations = self.activations[i]
     95     current_activations_reshaped = current_activations.reshape(current_activations.shape[0], -1)
---> 96     self.derivatives[i] = np.dot(current_activations, delta)
     97     error = np.dot(delta, self.weights[i].T)
     98 return error

File <__array_function__ internals>:180, in dot(*args, **kwargs)

ValueError: shapes (2,1000) and (2,2,1000) not aligned: 1000 (dim 1) != 2 (dim 1)
</code>```

This is the relevant code:

```<code>class MLP(object):
    def __init__(self, num_inputs=3, hidden_layers=[3,3], num_outputs=2):
        self.num_inputs = num_inputs
        self.hidden_layers = hidden_layers
        self.num_outputs = num_outputs
        layers = [num_inputs] + hidden_layers + [num_outputs]
        weights = []
        for i in range(len(layers) - 1):
            w = np.random.rand(layers[i], layers[i + 1])
            weights.append(w)
        self.weights = weights
        activations = []
        for i in range(len(layers)):
            a = np.zeros(layers[i])
            activations.append(a)
        self.activations = activations
        derivatives = []
        for i in range(len(layers) - 1):
            d = np.zeros((layers[i], layers[i+1]))
            derivatives.append(d)
        self.derivatives = derivatives
    def forward_propagate(self,inputs):
        activations = inputs
        self.activations[0] = inputs
        for i in range(len(self.weights)):
            net_inputs = np.dot(activations,self.weights)
            activations = self._sigmoid(net_inputs)
            self.activations[i+1] = activations
        return activations
    def back_propagate(self, error):
        for i in reversed(range(len(self.derivatives))):
            activations = self.activations[i+1]
            delta = error * self._sigmoid_derivative(activations)
            delta_reshaped = delta.reshape(delta.shape[0], -1).T
            current_activations = self.activations[i]
            current_activations_reshaped = current_activations.reshape(current_activations.shape[0], -1)
            self.derivatives[i] = np.dot(current_activations, delta)
            error = np.dot(delta, self.weights[i].T)
        return error
    def _sigmoid_derivative(self,x):
        return x * (1.0 - x)
    def _sigmoid(self,x):
        y = 1.0 / (1+np.exp(-x))
        return y
    def gradient_descent(self, learning_rate):
        for i in range(len(self.weights)):
            weights = self.weights[i]
            derivatives = self.derivatives[i]
            weights += derivatives + learning_rate
    def _mse(self,target,output):
         return np.average((target-output)**2)
    def train(self,inputs,targets,epochs,learning_rate):
        for i in range(epochs):
            sum_error = 0
            for input,target in zip(inputs,targets):
                output = self.forward_propagate(input)
                error = target - output
                self.back_propagate(error)
                self.gradient_descent(learning_rate=1)
                sum_error += self._mse(target,output)
            print("Error: {} at epoch {}".format(sum_error/len(inputs), i))
</code>```

And this is how I ran it:

```<code>if __name__ == "__main__":
    X, y = load_dataset()
    inputs = X
    targets = y
    build_model()
    mlp = MLP(1000, [1000], 1000)
    mlp.train(inputs,targets, 50, 0.1)
    output = mlp.forward_propagate(input)
</code>```

Thanks in advance!

I tried to do what the video said, to set up an MLP, as was the suggestion of the teacher, but I don't know how to solve the shape error.

Body:
I'm implementing a MLP to test a simple NN architecture, hoping to scale up to a bigger network with a larger dataset. My end goal is making a working phone recognizer for TIMIT data, as part of my internship.
To build the MLP, I used the suggestions of this video: https://www.youtube.com/watch?v=Z97XGNUUx9o.
And the proposal of my teacher to use the following inputs:

X = np.random.rand(5,1000)
y = X[4:5,:]

The error message is the following:

ValueError                                Traceback (most recent call last)
Cell In [63], line 7
      5 build_model()
      6 mlp = MLP(1000, [1000], 1000)
----> 7 mlp.train(inputs,targets, 50, 0.1)
      8 output = mlp.forward_propagate(input)

Cell In [62], line 117, in MLP.train(self, inputs, targets, epochs, learning_rate)
    115 output = self.forward_propagate(input)
    116 error = target - output
--> 117 self.back_propagate(error)
    118 self.gradient_descent(learning_rate=1)
    119 sum_error += self._mse(target,output)

Cell In [62], line 96, in MLP.back_propagate(self, error)
     94     current_activations = self.activations[i]
     95     current_activations_reshaped = current_activations.reshape(current_activations.shape[0], -1)
---> 96     self.derivatives[i] = np.dot(current_activations, delta)
     97     error = np.dot(delta, self.weights[i].T)
     98 return error

File <__array_function__ internals>:180, in dot(*args, **kwargs)

ValueError: shapes (2,1000) and (2,2,1000) not aligned: 1000 (dim 1) != 2 (dim 1)

This is the relevant code:

class MLP(object):
    def __init__(self, num_inputs=3, hidden_layers=[3,3], num_outputs=2):
        self.num_inputs = num_inputs
        self.hidden_layers = hidden_layers
        self.num_outputs = num_outputs
        layers = [num_inputs] + hidden_layers + [num_outputs]
        weights = []
        for i in range(len(layers) - 1):
            w = np.random.rand(layers[i], layers[i + 1])
            weights.append(w)
        self.weights = weights
        activations = []
        for i in range(len(layers)):
            a = np.zeros(layers[i])
            activations.append(a)
        self.activations = activations
        derivatives = []
        for i in range(len(layers) - 1):
            d = np.zeros((layers[i], layers[i+1]))
            derivatives.append(d)
        self.derivatives = derivatives
    def forward_propagate(self,inputs):
        activations = inputs
        self.activations[0] = inputs
        for i in range(len(self.weights)):
            net_inputs = np.dot(activations,self.weights)
            activations = self._sigmoid(net_inputs)
            self.activations[i+1] = activations
        return activations
    def back_propagate(self, error):
        for i in reversed(range(len(self.derivatives))):
            activations = self.activations[i+1]
            delta = error * self._sigmoid_derivative(activations)
            delta_reshaped = delta.reshape(delta.shape[0], -1).T
            current_activations = self.activations[i]
            current_activations_reshaped = current_activations.reshape(current_activations.shape[0], -1)
            self.derivatives[i] = np.dot(current_activations, delta)
            error = np.dot(delta, self.weights[i].T)
        return error
    def _sigmoid_derivative(self,x):
        return x * (1.0 - x)
    def _sigmoid(self,x):
        y = 1.0 / (1+np.exp(-x))
        return y
    def gradient_descent(self, learning_rate):
        for i in range(len(self.weights)):
            weights = self.weights[i]
            derivatives = self.derivatives[i]
            weights += derivatives + learning_rate
    def _mse(self,target,output):
         return np.average((target-output)**2)
    def train(self,inputs,targets,epochs,learning_rate):
        for i in range(epochs):
            sum_error = 0
            for input,target in zip(inputs,targets):
                output = self.forward_propagate(input)
                error = target - output
                self.back_propagate(error)
                self.gradient_descent(learning_rate=1)
                sum_error += self._mse(target,output)
            print("Error: {} at epoch {}".format(sum_error/len(inputs), i))

And this is how I ran it:

if __name__ == "__main__":
    X, y = load_dataset()
    inputs = X
    targets = y
    build_model()
    mlp = MLP(1000, [1000], 1000)
    mlp.train(inputs,targets, 50, 0.1)
    output = mlp.forward_propagate(input)

Thanks in advance!

I tried to do what the video said, to set up an MLP, as was the suggestion of the teacher, but I don't know how to solve the shape error.


问:
prolog, probably some race condition
just to practice prolog, I am solving a few puzzles using it and I ran into some very weird behavior of prolog.

The full code may be found here https://github.com/bibiki/AdventOfCode2022/blob/main/day14/solution.pl

The interesting part is this

```<code>start_a_grid( Xlength, Ylength, Result ) :-
  give_me( Ylength, air, Row ),
  give_me( Xlength, Row, Result ).

give_me( 0, V, [] ).
give_me( N, V, [V|Rest] ) :-
    write(N), nl,
    N1 is N - 1,
    give_me(N1, V, Rest).
</code>```

Now, if I run start_a_grid(535, 169, Grid) it works fine, I get a Grid. If, I however, run start_a_grid(535, 169, Cave), input(Lines), init(Lines, Cave, Initialized). then N in my give_me predicate goes below 0. From my experiemnts, it is the inclusion of init predicate in my query that causes the problem.

start_a_grid(13, 11, Cave), sample_lines(Lines), init(Lines, Cave, Initialized) works perfectly fine.

My swipl version is 'SWI-Prolog version 8.4.2 for x86_64-linux'. Am I missing something or is this rather a bug in my swipl version? Thanks in advance for your answers.

Title: prolog, probably some race condition

Body:
just to practice prolog, I am solving a few puzzles using it and I ran into some very weird behavior of prolog.

The full code may be found here https://github.com/bibiki/AdventOfCode2022/blob/main/day14/solution.pl

The interesting part is this

start_a_grid( Xlength, Ylength, Result ) :-
  give_me( Ylength, air, Row ),
  give_me( Xlength, Row, Result ).

give_me( 0, V, [] ).
give_me( N, V, [V|Rest] ) :-
    write(N), nl,
    N1 is N - 1,
    give_me(N1, V, Rest).

Now, if I run start_a_grid(535, 169, Grid) it works fine, I get a Grid. If, I however, run start_a_grid(535, 169, Cave), input(Lines), init(Lines, Cave, Initialized). then N in my give_me predicate goes below 0. From my experiemnts, it is the inclusion of init predicate in my query that causes the problem.

start_a_grid(13, 11, Cave), sample_lines(Lines), init(Lines, Cave, Initialized) works perfectly fine.

My swipl version is 'SWI-Prolog version 8.4.2 for x86_64-linux'. Am I missing something or is this rather a bug in my swipl version? Thanks in advance for your answers.


问:
Debug Liquid for Shopify New Order Notification
I am trying to show within a New Order notification whether an item is possible of being shipped next day or not. The customer should have to choose next day shipping first for this to even trigger at all but if they do then each line item should display Next-Day item or Not Next-Day item dependent on whether each product is tagged with Next-Day or not. The below mechanics work in Shopify Flow but not in this notification and I suspect the variables are worded incorrectly. Please help debug the below.

```<code>{% if order.shippingLine.title contains "Next Day" %}
{% for line_item in order.line_items %}
<br><br>
<span class="muted" style="text-align: left; font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 1px; font-weight: normal; text-transform: none; color: #e62026;">{% if line_item.variant.product.tags contains "Next-Day" %}Next-Day item{% else %}Not Next-Day item{% endif %}</span>
<br>
{% endfor %}
{% endif %}
</code>```

When I try this it doesn't output anything on the notification. I expect this to output either 'Next-Day item' or 'Not Next-Day item' on each line item dependent on the product tag for each variant line item but only if "Next Day" is within the overall order shipping line title.

Body:
I am trying to show within a New Order notification whether an item is possible of being shipped next day or not. The customer should have to choose next day shipping first for this to even trigger at all but if they do then each line item should display Next-Day item or Not Next-Day item dependent on whether each product is tagged with Next-Day or not. The below mechanics work in Shopify Flow but not in this notification and I suspect the variables are worded incorrectly. Please help debug the below.

{% if order.shippingLine.title contains "Next Day" %}
{% for line_item in order.line_items %}

{% if line_item.variant.product.tags contains "Next-Day" %}Next-Day item{% else %}Not Next-Day item{% endif %}

{% endfor %}
{% endif %}

When I try this it doesn't output anything on the notification. I expect this to output either 'Next-Day item' or 'Not Next-Day item' on each line item dependent on the product tag for each variant line item but only if "Next Day" is within the overall order shipping line title.


问:
Instrumented Firebase Test Lab test are failing
While lauching Test Lab for performing an instrumented test, some tests fails due to this kind of error:

```<code>java.lang.SecurityException: Permission Denial: package=com.mypkg.xx.yy.zz.test does not belong to uid=12345
at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3696)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1723)
at androidx.test.runner.MonitoringInstrumentation.execStartActivity(MonitoringInstrumentation.java:603)
at android.app.ContextImpl.startActivity(ContextImpl.java:1023)
at android.app.ContextImpl.startActivity(ContextImpl.java:994)
at com.mypkg.xx.yy.ExampleInstrumentedTest.testName(ExampleInstrumentedTest.kt:1917)
... 27 trimmed
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.ActivityTaskManagerService.assertPackageMatchesCallingUid(ActivityTaskManagerService.java:2594)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1077)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1068)
at com.android.server.wm.ActivityTaskManagerService.startActivity(ActivityTaskManagerService.java:1043)
at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:1422)
</code>```

any suggeston about why I'm receiving this error and how to solve it?

I tried shifting the test class under (AndroidTest) instead of (test) section, errors still there.
I tried configuind TestDistribution adding the mypkg.test pakage, errors still there.
I tried locally and test seems to run correctly

Body:
While lauching Test Lab for performing an instrumented test, some tests fails due to this kind of error:

java.lang.SecurityException: Permission Denial: package=com.mypkg.xx.yy.zz.test does not belong to uid=12345
at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3696)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1723)
at androidx.test.runner.MonitoringInstrumentation.execStartActivity(MonitoringInstrumentation.java:603)
at android.app.ContextImpl.startActivity(ContextImpl.java:1023)
at android.app.ContextImpl.startActivity(ContextImpl.java:994)
at com.mypkg.xx.yy.ExampleInstrumentedTest.testName(ExampleInstrumentedTest.kt:1917)
... 27 trimmed
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.ActivityTaskManagerService.assertPackageMatchesCallingUid(ActivityTaskManagerService.java:2594)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1077)
at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1068)
at com.android.server.wm.ActivityTaskManagerService.startActivity(ActivityTaskManagerService.java:1043)
at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:1422)

any suggeston about why I'm receiving this error and how to solve it?

I tried shifting the test class under (AndroidTest) instead of (test) section, errors still there.
I tried configuind TestDistribution adding the mypkg.test pakage, errors still there.
I tried locally and test seems to run correctly


问:
MINIO Server Image URL Access in Production Always Expires
My MinIO, self-hosted object storage server, is up and running, w/ working access key.  Programming in Ruby on Rails.  In development mode/env, use of that remote server works for uploading and loading images on browser, as call "image.url" creates full URL w/ access parameters like below.  In production mode/env, using same access key, upload of image to server still works and proven by seeing the image exists in bucket browsing and Rails console call to "image.url" & pasted directly to browser works.

But rendered page's image URL always expires, as I see that HTTP status accessing using curl.

Does anyone know why on front end/view level, in Rails code, the URL is still expired while other ways can still access fine?

mydomain.com/mybucket/item.jpg?X-Amz-Expires=3600&X-Amz-Date=20221215T140231Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=omv9834pbcse6%2F20221215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=sjjk89jbkj2398bp


问:
Dynamic Chart Range based on Date
enter image description hereChart currently

Hi all,

I have looked up several videos on YouTube but cannot find the specifics of what I am looking for. I am trying to adjust the chart so that it only shows the months selected. The months selected runs off a formula resulting in TRUE and the Forecast is then multiplied by this to give £££ or £0.

Does anyone know how to make this chart dynamic?

Thanks,
Shea

I watched YouTube videos but the way my data is set up is different to every video. Not sure if what I want to do is achievable.

Title: Dynamic Chart Range based on Date


问:
Error in json_decode when receive data via post request
I am accessing an api via php that returns data in json format and after that I use the json_decode() function to transform the returned string to json. The problem is that when I use json decode it doesn't return anything. I have had this problem before, and I know that last time I solved it by changing the way I did this post request to the api, but I don't remember how I did it. Can anyone help me?

NOTE: When I put the returned string inside the json decode it works, but when I put it inside a variable and try json_decode() it breaks.

Post request:

```<code>public static function post($url, $username, $password)
    {
        $params = array(
            'needsNicknamesAudios' => true
        );

        $jsonData = json_encode($params);

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $headers = array(
            'Accept' => 'application/json',
            'Authorization: Basic '. base64_encode("$username:$password")
        );

        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
        $res = curl_exec($ch);
        curl_close($ch);

        logText('result in curl', $res);

        return $res;
    }
</code>```

Log of responses:

snippet where make the request:

```<code>$rs = json_decode(Curl::post(baseUrl . "users/auth/", $cpfOrCnpj, $password));

logText('rs in login', $rs);
</code>```

example of string json returned of API:

```<code>{"auth":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NzExMTQ2MzgsImlhdCI6MTY3MTExMzczOCwic3ViIjoiMTY4MiJ9.8dgJc7gcSk4CINjeI3qOA3evLm3--8iDROPsLRCfuaQ","expInSecs":1671114638},"user":{"id":1682,"document":"44105337000139","name":"Márcio Valim","email":"marciogsvalim@gmail.com","phone":"5524993047304","confirmedEmail":false,"blockMessage":"Esse aparelho foi perdido. Por favor, use as informações de contato abaixo para devolver ao dono.","isCurrentPasswordUsedForLongTime":false,"currentPasswordUseIntervalInMonths":0},"licenses":[{"id":2729,"exp":"2023-12-15T12:55:15.000Z","autoRenewal":false,"type":"single","activated":true,"blocked":false,"device":{"imei":"354476112827609","brand":"Samsung","comercial":"Test model","technical":"Test technical model"},"phone":null,"nicknameAudioUrl":null},{"id":2730,"exp":"2023-12-15T12:55:43.000Z","autoRenewal":false,"type":"single","activated":true,"blocked":false,"device":{"imei":"350812850097258","brand":"Samsung","comercial":"Test model","technical":"Test technical model"},"phone":null,"nicknameAudioUrl":null}]}
</code>```

Body:
I am accessing an api via php that returns data in json format and after that I use the json_decode() function to transform the returned string to json. The problem is that when I use json decode it doesn't return anything. I have had this problem before, and I know that last time I solved it by changing the way I did this post request to the api, but I don't remember how I did it. Can anyone help me?

NOTE: When I put the returned string inside the json decode it works, but when I put it inside a variable and try json_decode() it breaks.

Post request:

public static function post($url, $username, $password)
    {
        $params = array(
            'needsNicknamesAudios' => true
        );

        $jsonData = json_encode($params);

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $headers = array(
            'Accept' => 'application/json',
            'Authorization: Basic '. base64_encode("$username:$password")
        );

        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
        $res = curl_exec($ch);
        curl_close($ch);

        logText('result in curl', $res);

        return $res;
    }

Log of responses:

snippet where make the request:

$rs = json_decode(Curl::post(baseUrl . "users/auth/", $cpfOrCnpj, $password));

logText('rs in login', $rs);

example of string json returned of API:

{"auth":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NzExMTQ2MzgsImlhdCI6MTY3MTExMzczOCwic3ViIjoiMTY4MiJ9.8dgJc7gcSk4CINjeI3qOA3evLm3--8iDROPsLRCfuaQ","expInSecs":1671114638},"user":{"id":1682,"document":"44105337000139","name":"Márcio Valim","email":"marciogsvalim@gmail.com","phone":"5524993047304","confirmedEmail":false,"blockMessage":"Esse aparelho foi perdido. Por favor, use as informações de contato abaixo para devolver ao dono.","isCurrentPasswordUsedForLongTime":false,"currentPasswordUseIntervalInMonths":0},"licenses":[{"id":2729,"exp":"2023-12-15T12:55:15.000Z","autoRenewal":false,"type":"single","activated":true,"blocked":false,"device":{"imei":"354476112827609","brand":"Samsung","comercial":"Test model","technical":"Test technical model"},"phone":null,"nicknameAudioUrl":null},{"id":2730,"exp":"2023-12-15T12:55:43.000Z","autoRenewal":false,"type":"single","activated":true,"blocked":false,"device":{"imei":"350812850097258","brand":"Samsung","comercial":"Test model","technical":"Test technical model"},"phone":null,"nicknameAudioUrl":null}]}


问:
Should I fix random seed for LSTM Network?
I have built an LSTM network on Matlab. I tune the hyperparameters using Bayesian Optimization and Rolling Cross Validation. When I train the network on the optimized hyperparameters, I get a different R2 (coefficient of determination) every time, due to the weights being initialized randomly. I am wondering how I should report my results. SHould I fix a random seed during hyperparameter tuning and use this same seed when I train on the full training set? Thank you</p>


问:
IntelliJ Gradle task execution cannot resolve local build script references
I just understood how buildscript works and I've made a basic script that just puts kotlin inside any subproject with

```<code>`kotlin-conventions`
</code>```

My gradle multiproject is setup like this:

```<code>project
 ├─ acq
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ acs
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ acs-client
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ buildSrc
 |  ├─ src
 |  |  ├─ main
 |  |  |  ├─ kotlin
 |  |  |  |  ├─ containerized-app.gradle.kts
 |  |  |  |  ├─ kotlin-conventions.gradle.kts
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ core
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ sp
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
</code>```

project/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts

```<code>plugins {
    kotlin("jvm")
}

repositories {
    mavenCentral()
}

dependencies {

}

tasks.named<Test>("test") {
    useJUnitPlatform()
}
</code>```

project/buildScr/build.gradle.kts

```<code>plugins {
    `kotlin-dsl`
}

repositories {
    gradlePluginPortal()
    mavenCentral()
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
    implementation("com.google.cloud.tools:jib-gradle-plugin:3.3.1")
}
</code>```

project/acq/build.gradle.kts

```<code>val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project

plugins {
    `kotlin-conventions`
    `containerized-app`
}

group = "be.rm.secu.tp2"
version = "0.0.1"

application {
    mainClass.set("be.rm.secu.tp2.acq.ApplicationKt")
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("ch.qos.logback:logback-classic:$logback_version")
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
}
</code>```

(You can go to the github repository to get the full code, although I cannot promise that the code won't change in the future)

The problem I'm having, is that when I run gradlew from a CLI (WSL 2.0, Java 17.0.5-tem, Gradle 7.4.2), everything is fine and this is the output:

But, when I'm executing the task on IntelliJ, it says that they cannot resolve my buildscript...

I don't really understand why is this happening, I am guessing this is an IntelliJ problem.

I tried searching for a similar case, although I couldn't find anything. I tried invalidating caches, removing caches. Changing environment (CMD, PowerShell, WSL), removing .gradle(s), removing .idea...

I could try working with gradle on CLI and IntelliJ as an IDE, but this is not really efficient, as I will surely rely on the IntelliJ debugger in the future...

Thanks !

Body:
I just understood how buildscript works and I've made a basic script that just puts kotlin inside any subproject with

`kotlin-conventions`

My gradle multiproject is setup like this:

project
 ├─ acq
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ acs
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ acs-client
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ buildSrc
 |  ├─ src
 |  |  ├─ main
 |  |  |  ├─ kotlin
 |  |  |  |  ├─ containerized-app.gradle.kts
 |  |  |  |  ├─ kotlin-conventions.gradle.kts
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ core
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts
 ├─ sp
 |  ├─ build.gradle.kts
 |  ├─ settings.gradle.kts

project/buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts

plugins {
    kotlin("jvm")
}

repositories {
    mavenCentral()
}

dependencies {

}

tasks.named<Test>("test") {
    useJUnitPlatform()
}

project/buildScr/build.gradle.kts

plugins {
    `kotlin-dsl`
}

repositories {
    gradlePluginPortal()
    mavenCentral()
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
    implementation("com.google.cloud.tools:jib-gradle-plugin:3.3.1")
}

project/acq/build.gradle.kts

val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project

plugins {
    `kotlin-conventions`
    `containerized-app`
}

group = "be.rm.secu.tp2"
version = "0.0.1"

application {
    mainClass.set("be.rm.secu.tp2.acq.ApplicationKt")
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("ch.qos.logback:logback-classic:$logback_version")
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
}

(You can go to the github repository to get the full code, although I cannot promise that the code won't change in the future)

The problem I'm having, is that when I run gradlew from a CLI (WSL 2.0, Java 17.0.5-tem, Gradle 7.4.2), everything is fine and this is the output:

But, when I'm executing the task on IntelliJ, it says that they cannot resolve my buildscript...

I don't really understand why is this happening, I am guessing this is an IntelliJ problem.

I tried searching for a similar case, although I couldn't find anything. I tried invalidating caches, removing caches. Changing environment (CMD, PowerShell, WSL), removing .gradle(s), removing .idea...

I could try working with gradle on CLI and IntelliJ as an IDE, but this is not really efficient, as I will surely rely on the IntelliJ debugger in the future...

Thanks !


问:
Fetching data using axios from 2 arrays on same table.(c#)
Actually I have a problem but I do not know where is mistake. Firstly, I am using c#, .net6 and ef first code for backend and database. Task is fetching cities and countries on a page. But I did not get that. How can I get different related datas on the same page. I used Foreign Key.

This is my city class,

```<code>[Table("Cities")]
    public class City
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(30)]
        public string Name { get; set; }

        public int CountryId { get; set; }
        [ForeignKey("CountryId")]
        public Country Country { get; set; }
    }
</code>```

This is my country class,

```<code>[Table("Countries")]
    public class Country
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(30)]
        public string Name { get; set; }

    }
</code>```

And in Vue page,

https://i.stack.imgur.com/dZdqw.png

Data in console is,

https://i.stack.imgur.com/3cb7m.png

(Country values are null, but why ?)

```<code><tr v-for="city in cities"  :key="city.id">
    <td>{{city.countryId}}</td>
    <td>{{city.name}}</td>
    <td>{{city.country}}</td>

</tr>
</code>```

I am trying to access country values from city.

I hope you can understand and help me. Thanks from now!

Body:
Actually I have a problem but I do not know where is mistake. Firstly, I am using c#, .net6 and ef first code for backend and database. Task is fetching cities and countries on a page. But I did not get that. How can I get different related datas on the same page. I used Foreign Key.

This is my city class,

[Table("Cities")]
    public class City
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(30)]
        public string Name { get; set; }

        public int CountryId { get; set; }
        [ForeignKey("CountryId")]
        public Country Country { get; set; }
    }

This is my country class,

[Table("Countries")]
    public class Country
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(30)]
        public string Name { get; set; }

    }

And in Vue page,

https://i.stack.imgur.com/dZdqw.png

Data in console is,

https://i.stack.imgur.com/3cb7m.png

(Country values are null, but why ?)

    {{city.countryId}}
    {{city.name}}
    {{city.country}}

I am trying to access country values from city.

I hope you can understand and help me. Thanks from now!


问:
Angular doesn't send file to API even though formData.has('file') gives "true". The Laravel API receives a file from Postman
On Angular frontend, for Upload File function, I can't send a file to Laravel 9 API. With Postman, everything goes well, the array is not empty, but from Angular - the array is comes empty.

I checked my Angular, FormData.has(file) gives "true" in console.log(). When I test with Postman, everything goes well, the array is not empty. And from Angular - the array is comes empty.
To avoid an error with CORS by using proxy in my Angular. All other POST requests except Upload File in Angular work well.

Response (Angular - Laravel):

```<code>object(Symfony\Component\HttpFoundation\FileBag)#48 (1) {
["parameters":protected]=>
  array(0) {}
}
</code>```

Response (Postman - Laravel):

```<code>object(Symfony\Component\HttpFoundation\FileBag)#48 (1) {
  ["parameters":protected]=>
  array(1) {
    ["file"]=>
    object(Symfony\Component\HttpFoundation\File\UploadedFile)#33 (6) {
      ["test":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      bool(false)
      ["originalName":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      string(20) "contactsImporter.xls"
      ["mimeType":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      string(24) "application/vnd.ms-excel"
      ["error":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      int(0)
      ["pathName":"SplFileInfo":private]=>
      string(45) "C:\Users\dmitr\AppData\Local\Temp\phpF12E.tmp"
      ["fileName":"SplFileInfo":private]=>
      string(11) "phpF12E.tmp"
    }
  }
}
</code>```
```<code>/Laravel/

public function importContact(Request $request){
    var_dump($request->files);exit;

    if (!$request->hasFile('file') && !$request->file('file')->isValid()) {
        return response()->json('{"error": "please provide a file"}');

    }

    //...
}
</code>```
```<code>/Angular/

<form [formGroup]="form" (ngSubmit)="submitForm()">
    <input enctype="multipart/form-data" type="file" (change)="uploadFile($event)">
    <button>Upload</button>
</form>
</code>```
```<code>uploadFile(event: Event) {
    const fileContacts = (event.target as HTMLInputElement)?.files?.[0];
    console.log(fileContacts);
    this.form.patchValue({
          file: fileContacts
    });
}

submitForm() {
    const formData: any = new FormData();
    formData.append('file', this.form.controls['file'].value);
    console.log(formData.has('file'));

    const httpOptions = {
          headers: new HttpHeaders({
                'Content-type': 'multipart/form-data',
                'Accept': 'application/json'
          })
    };

    return this.http.post(this.url+'contacts/importContact', formData, httpOptions)
    .subscribe({
          next: (v) => console.log('success: ', v),
          error: (e) => console.error('error while uploading file', e),
          complete: () => console.info('complete')
    })
}

</code>```

Body:
On Angular frontend, for Upload File function, I can't send a file to Laravel 9 API. With Postman, everything goes well, the array is not empty, but from Angular - the array is comes empty.

I checked my Angular, FormData.has(file) gives "true" in console.log(). When I test with Postman, everything goes well, the array is not empty. And from Angular - the array is comes empty.
To avoid an error with CORS by using proxy in my Angular. All other POST requests except Upload File in Angular work well.

Response (Angular - Laravel):

object(Symfony\Component\HttpFoundation\FileBag)#48 (1) {
["parameters":protected]=>
  array(0) {}
}

Response (Postman - Laravel):

object(Symfony\Component\HttpFoundation\FileBag)#48 (1) {
  ["parameters":protected]=>
  array(1) {
    ["file"]=>
    object(Symfony\Component\HttpFoundation\File\UploadedFile)#33 (6) {
      ["test":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      bool(false)
      ["originalName":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      string(20) "contactsImporter.xls"
      ["mimeType":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      string(24) "application/vnd.ms-excel"
      ["error":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
      int(0)
      ["pathName":"SplFileInfo":private]=>
      string(45) "C:\Users\dmitr\AppData\Local\Temp\phpF12E.tmp"
      ["fileName":"SplFileInfo":private]=>
      string(11) "phpF12E.tmp"
    }
  }
}

/Laravel/

public function importContact(Request $request){
    var_dump($request->files);exit;

    if (!$request->hasFile('file') && !$request->file('file')->isValid()) {
        return response()->json('{"error": "please provide a file"}');

    }

    //...
}

/Angular/

<form [formGroup]="form" (ngSubmit)="submitForm()">
    <input enctype="multipart/form-data" type="file" (change)="uploadFile($event)">
    <button>Upload</button>
</form>

uploadFile(event: Event) {
    const fileContacts = (event.target as HTMLInputElement)?.files?.[0];
    console.log(fileContacts);
    this.form.patchValue({
          file: fileContacts
    });
}

submitForm() {
    const formData: any = new FormData();
    formData.append('file', this.form.controls['file'].value);
    console.log(formData.has('file'));

    const httpOptions = {
          headers: new HttpHeaders({
                'Content-type': 'multipart/form-data',
                'Accept': 'application/json'
          })
    };

    return this.http.post(this.url+'contacts/importContact', formData, httpOptions)
    .subscribe({
          next: (v) => console.log('success: ', v),
          error: (e) => console.error('error while uploading file', e),
          complete: () => console.info('complete')
    })
}


问:
QueryDsl and Embeddables with OneToMany | Wierd Generated SQL Select by "."
I am expermenting querydsl with embeddable, on the following set:

```<code>@Entity
Class Ent1 {
   @Embedded
   Embed embed;
}

@Entity
Class Ent2 {
   @ManyToOne
   Ent1 ent1;
}

@Embeddable
Class Embed {
   @OneToMany
   List<Ent2> ent2List;
}
</code>```

When i use following dsl query

```<code>query
        .select(Projections.constructor(Embed.class, QEnt1.qEnt1.ent2List))
        .from(QEnt1.qEnt1)
        .fetch();
</code>```

Generate this sql

```<code>    select
        . as col0,
        ent2.ent1_id as col1
    from
        Ent1 ent1
    inner join
        Ent2 ent2
            on ent1.id=ent2.id
</code>```

following generated line breaks the query

. as col0

Sql works fine without generated dot line, any ideas how to fix ?

Note: Im using oracle sql

Body:
I am expermenting querydsl with embeddable, on the following set:

@Entity
Class Ent1 {
   @Embedded
   Embed embed;
}

@Entity
Class Ent2 {
   @ManyToOne
   Ent1 ent1;
}

@Embeddable
Class Embed {
   @OneToMany
   List<Ent2> ent2List;
}

When i use following dsl query

query
        .select(Projections.constructor(Embed.class, QEnt1.qEnt1.ent2List))
        .from(QEnt1.qEnt1)
        .fetch();

Generate this sql

    select
        . as col0,
        ent2.ent1_id as col1
    from
        Ent1 ent1
    inner join
        Ent2 ent2
            on ent1.id=ent2.id

following generated line breaks the query

. as col0

Sql works fine without generated dot line, any ideas how to fix ?

Note: Im using oracle sql


问:
dockerfile for selenium. 255 driver initialization error
There is a part of django that sends information via an API to be processed by selenium. There are problems with building docker under selenium. 255 selenium error in logs. I've already broken my head. Please tell me what could be the problem. latest version of geckodriver

dockerfile

```<code>FROM python:3.9
LABEL autor="LOADER"
LABEL description="APP"

WORKDIR /usr/src/html_loader/
COPY . /usr/src/html_loader/

RUN apt-get update

RUN echo "Y" | apt-get install alien
RUN echo "Y" | apt-get install gunicorn
RUN echo "Y" | apt-get install memcached
RUN echo "Y" | apt-get install unixodbc
RUN echo "Y" | apt-get install unixodbc-dev
RUN echo "Y" | apt-get install cifs-utils
RUN echo "Y" | apt-get install libgtk-3-dev
RUN echo "Y" | apt-get install libgtk-3-0
RUN echo "Y" | apt-get install libdbus-glib-1-2
RUN echo "Y" | apt-get install xvfb

RUN apt-get install libaio1

RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list
RUN apt-get update
RUN echo "Y" | apt-get install -y --no-install-recommends firefox
RUN apt-get update && apt-get install -y wget bzip2 libxtst6 libgtk-3-0 libx11-xcb-dev libdbus-glib-1-2 libxt6 libpci-dev && rm -rf /var/lib/apt/lists/*

ENV pip=pip3
ENV python=python3
ENV DJANGO_HOST="http://crawlerdjango:4333"

RUN pip install --upgrade pip

COPY requirements.txt .
RUN pip3 install -r requirements.txt

RUN apt-get update --allow-releaseinfo-change
RUN Xvfb &

EXPOSE 4666
EXPOSE 4777
</code>```

It's funny, but two days ago the code worked

Body:
There is a part of django that sends information via an API to be processed by selenium. There are problems with building docker under selenium. 255 selenium error in logs. I've already broken my head. Please tell me what could be the problem. latest version of geckodriver

dockerfile

FROM python:3.9
LABEL autor="LOADER"
LABEL description="APP"

WORKDIR /usr/src/html_loader/
COPY . /usr/src/html_loader/

RUN apt-get update

RUN echo "Y" | apt-get install alien
RUN echo "Y" | apt-get install gunicorn
RUN echo "Y" | apt-get install memcached
RUN echo "Y" | apt-get install unixodbc
RUN echo "Y" | apt-get install unixodbc-dev
RUN echo "Y" | apt-get install cifs-utils
RUN echo "Y" | apt-get install libgtk-3-dev
RUN echo "Y" | apt-get install libgtk-3-0
RUN echo "Y" | apt-get install libdbus-glib-1-2
RUN echo "Y" | apt-get install xvfb

RUN apt-get install libaio1

RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list
RUN apt-get update
RUN echo "Y" | apt-get install -y --no-install-recommends firefox
RUN apt-get update && apt-get install -y wget bzip2 libxtst6 libgtk-3-0 libx11-xcb-dev libdbus-glib-1-2 libxt6 libpci-dev && rm -rf /var/lib/apt/lists/*

ENV pip=pip3
ENV python=python3
ENV DJANGO_HOST="http://crawlerdjango:4333"

RUN pip install --upgrade pip

COPY requirements.txt .
RUN pip3 install -r requirements.txt

RUN apt-get update --allow-releaseinfo-change
RUN Xvfb &

EXPOSE 4666
EXPOSE 4777

It's funny, but two days ago the code worked


问:
Servlet Service Error, IllegalArgumentException
I got a Spring boot application which deployed on aws instance and it uses mysql db. it works as it should but every day randomly it stops and throws the error below.
before that, it was deployed on the digital ocean and we never meet such problems.</p>
```<code>ERROR 10282 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Locale part "/../../../..//////////dev/cmdb/sslvpn" contains invalid characters] with root cause
</code>```

Body:
I got a Spring boot application which deployed on aws instance and it uses mysql db. it works as it should but every day randomly it stops and throws the error below.
before that, it was deployed on the digital ocean and we never meet such problems.

ERROR 10282 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Locale part "/../../../..//////////dev/cmdb/sslvpn" contains invalid characters] with root cause


问:
Rank Loss for News feed / Recommendation problem
How do I use the rank loss (or triplet loss) for a feed ranking or recommendation problem? In other words,  how do we create the training data for rank loss (or triplet loss) model training? Thanks!</p>


问:
Usage of Member Rich Content API
I would like to use Member Rich Content API from LinkedIn, I understand that I have to apply to get access to it, but I have a hard time even finding where to apply.
Also LinkedIn support page redirected me to StackOverflow, so here I am.

Thanks for any advice!

Title: Usage of Member Rich Content API