问:
ASP.Net FormAuthentication response.redirect to IIS Virtual Directory
Have a LoginForm and default asp.net with to buttons on default asp.net. My Target is to after sucssefully Login redirect to default.aspx and by button click connect to IIS Virtual directory.
Login is working fine but the Problem is that i get after button click LoginForm again to authenticate.What should i do to be able to be redirected to virtual directory without authenticate again.

MY LoginForm CodeBehind

```<code>protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
       {

           string UserName = Login1.UserName;
           string Password = Login1.Password;
           bool RememberMe = Login1.RememberMeSet;

           string adPath = ConfigurationManager.ConnectionStrings["AD"].ConnectionString;
           string DomainFQDN = ConfigurationManager.AppSettings["DomainFQDN"];
           string PermitedLoginGroup = ConfigurationManager.AppSettings["PermitiedLoginGroup"];
           string DomainNetBiosName = ConfigurationManager.AppSettings["DomainNetBiosName"];

           try
           {
               LdapAuthentication adAuth = new LdapAuthentication(adPath);
               if (true == adAuth.Authenticate(UserName, Password, DomainNetBiosName))
               {
                   Session["UserName"] = UserName;
                   FormsAuthenticationTicket tkt;
                   string cookiestr;
                   HttpCookie ck;
                   tkt = new FormsAuthenticationTicket(1, UserName, DateTime.Now,
                   DateTime.Now.AddMinutes(30), Login1.RememberMeSet, "your custom data");
                   cookiestr = FormsAuthentication.Encrypt(tkt);
                   ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr);
                   string ckName = ck.Name;
                   if (Login1.RememberMeSet)
                       ck.Expires = tkt.Expiration;
                   ck.Path = FormsAuthentication.FormsCookiePath;
                   Response.Cookies.Add(ck);

                   string strRedirect;
                   strRedirect = Request["ReturnUrl"];
                   if (strRedirect == null)
                       strRedirect = "Default2.aspx";
                   FormsAuthentication.RedirectFromLoginPage(UserName, RememberMe);
                   Response.Redirect(strRedirect, true);

               }

           }
           catch (Exception ex)
           {

           }

       }
</code>```

Default2.aspx

```<code><%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="LoginForm.Default2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Button ID="ButtonProd" runat="server" OnClick="ButtonProd_Click" Text="Prod" />
    <asp:Button ID="ButtonTest" runat="server" OnClick="ButtonTest_Click" Text="Test" />
</asp:Content>
</code>```

I am trying to do somthing like this in button click method but i am redirecting again to LoginForm and if i give my credentials again i am able to access Virtual Directory on IIS

```<code>protected void ButtonTest_Click(object sender, EventArgs e)
        {
            HttpCookie ck = (Request.Cookies[".ASPXAUTH"]);
            Response.Cookies.Add(ck);

           Response.Redirect("Response.Redirect("http://webserver.ad.com/VirtualDirectory",false);
        }
</code>```

Could someone give me some tips...Thanks in advance....

Body:
Have a LoginForm and default asp.net with to buttons on default asp.net. My Target is to after sucssefully Login redirect to default.aspx and by button click connect to IIS Virtual directory.
Login is working fine but the Problem is that i get after button click LoginForm again to authenticate.What should i do to be able to be redirected to virtual directory without authenticate again.

MY LoginForm CodeBehind

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
       {

           string UserName = Login1.UserName;
           string Password = Login1.Password;
           bool RememberMe = Login1.RememberMeSet;

           string adPath = ConfigurationManager.ConnectionStrings["AD"].ConnectionString;
           string DomainFQDN = ConfigurationManager.AppSettings["DomainFQDN"];
           string PermitedLoginGroup = ConfigurationManager.AppSettings["PermitiedLoginGroup"];
           string DomainNetBiosName = ConfigurationManager.AppSettings["DomainNetBiosName"];

           try
           {
               LdapAuthentication adAuth = new LdapAuthentication(adPath);
               if (true == adAuth.Authenticate(UserName, Password, DomainNetBiosName))
               {
                   Session["UserName"] = UserName;
                   FormsAuthenticationTicket tkt;
                   string cookiestr;
                   HttpCookie ck;
                   tkt = new FormsAuthenticationTicket(1, UserName, DateTime.Now,
                   DateTime.Now.AddMinutes(30), Login1.RememberMeSet, "your custom data");
                   cookiestr = FormsAuthentication.Encrypt(tkt);
                   ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr);
                   string ckName = ck.Name;
                   if (Login1.RememberMeSet)
                       ck.Expires = tkt.Expiration;
                   ck.Path = FormsAuthentication.FormsCookiePath;
                   Response.Cookies.Add(ck);

                   string strRedirect;
                   strRedirect = Request["ReturnUrl"];
                   if (strRedirect == null)
                       strRedirect = "Default2.aspx";
                   FormsAuthentication.RedirectFromLoginPage(UserName, RememberMe);
                   Response.Redirect(strRedirect, true);

               }

           }
           catch (Exception ex)
           {

           }

       }

Default2.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="LoginForm.Default2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Button ID="ButtonProd" runat="server" OnClick="ButtonProd_Click" Text="Prod" />
    <asp:Button ID="ButtonTest" runat="server" OnClick="ButtonTest_Click" Text="Test" />
</asp:Content>

I am trying to do somthing like this in button click method but i am redirecting again to LoginForm and if i give my credentials again i am able to access Virtual Directory on IIS

protected void ButtonTest_Click(object sender, EventArgs e)
        {
            HttpCookie ck = (Request.Cookies[".ASPXAUTH"]);
            Response.Cookies.Add(ck);

           Response.Redirect("Response.Redirect("http://webserver.ad.com/VirtualDirectory",false);
        }

Could someone give me some tips...Thanks in advance....


来源: stackexchange

问:
How should I format a date to always respect the specified format?
I have a Go API that is supposed to return a timestamp in the following format (Java notation but should be understandable):

```<code>yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'
</code>```

My Go API will build this timestamp as follows:

```<code>func ParseToTimestamp(duration string, systemTime time.Time) (string, error) {
    parsedDuration, err := time.ParseDuration(duration)
    if err != nil {
        return "", err
    }
    validity := systemTime.Add(parsedDuration)
    return validity.Format("2006-01-02T15:04:05.999999Z"), nil
}
</code>```

I've noticed, however, that this formatted string is not always respecting the wished format. For example, if I pass a date which has 0 nano-seconds:

```<code>duration := "10m"
systemTime := time.Date(1990, time.January, 24, 0, 0, 0, 0, time.UTC) //no nano-seconds
timestamp, _ := fxcash.ParseToTimestamp(duration, systemTime)
fmt.Println(timestamp)
>> 1990-01-24T00:10:00Z
</code>```

However, if I pass a date which has 120k nano-seconds:

```<code>duration := "10m"
systemTime := time.Date(1990, time.January, 24, 0, 0, 0, 120000, time.UTC) //120k nano-seconds
timestamp, _ := fxcash.ParseToTimestamp(duration, systemTime)
fmt.Println(timestamp)
>> 1990-01-24T00:10:00.00012Z
</code>```

Generally speaking, this causes an issue because the service that consumes my Go output expects to have exactly 6 nano-seconds, even if they were only zeros .000000Z.

Is there a way to do that without heavy parsing/ugly splitting using standard Go Libraries?

Sorry if this question is basic but I'm very new to Go, I've looked for examples on the web but couldn't find any.

ContentLicense: CC BY-SA 4.0

Body:
I have a Go API that is supposed to return a timestamp in the following format (Java notation but should be understandable):

yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'

My Go API will build this timestamp as follows:

func ParseToTimestamp(duration string, systemTime time.Time) (string, error) {
    parsedDuration, err := time.ParseDuration(duration)
    if err != nil {
        return "", err
    }
    validity := systemTime.Add(parsedDuration)
    return validity.Format("2006-01-02T15:04:05.999999Z"), nil
}

I've noticed, however, that this formatted string is not always respecting the wished format. For example, if I pass a date which has 0 nano-seconds:

duration := "10m"
systemTime := time.Date(1990, time.January, 24, 0, 0, 0, 0, time.UTC) //no nano-seconds
timestamp, _ := fxcash.ParseToTimestamp(duration, systemTime)
fmt.Println(timestamp)
>> 1990-01-24T00:10:00Z

However, if I pass a date which has 120k nano-seconds:

duration := "10m"
systemTime := time.Date(1990, time.January, 24, 0, 0, 0, 120000, time.UTC) //120k nano-seconds
timestamp, _ := fxcash.ParseToTimestamp(duration, systemTime)
fmt.Println(timestamp)
>> 1990-01-24T00:10:00.00012Z

Generally speaking, this causes an issue because the service that consumes my Go output expects to have exactly 6 nano-seconds, even if they were only zeros .000000Z.

Is there a way to do that without heavy parsing/ugly splitting using standard Go Libraries?

Sorry if this question is basic but I'm very new to Go, I've looked for examples on the web but couldn't find any.


问:
Updating /** autocomplete in Eclipse
When using /** in Eclipse (or in my case OnSemi IDE -- based on Eclipse), it will autocomplete when pressing enter to create a comment that (with Doxygen and Javadocs enabled) fills in the Javadoc tags to look something like:

```<code>/**
 * @brief
 *
 * @param a
 * @param b
 */
void foo(int a, bool b)
</code>```

What I have been unable to figure out is how to update this autocomplete to add "border" to the comment. The goal would look like:

```<code>/******************************************************************************
 * @brief
 *
 * @param a
 * @param b
 ******************************************************************************/
void foo(int a, bool b)
</code>```

Note: I would hope these "borders" would ONLY occur when applied to method comments, rather than internal comments within code (when adding a large, multi-line comment, we use /** for this occasionally).

I've tried going to Window->Preferences->C/C++->Code Style->Code Templates and adjusting the comments templates without success.

Title: Updating /** autocomplete in Eclipse

Body:
When using /** in Eclipse (or in my case OnSemi IDE -- based on Eclipse), it will autocomplete when pressing enter to create a comment that (with Doxygen and Javadocs enabled) fills in the Javadoc tags to look something like:

/**
 * @brief
 *
 * @param a
 * @param b
 */
void foo(int a, bool b)

What I have been unable to figure out is how to update this autocomplete to add "border" to the comment. The goal would look like:

/******************************************************************************
 * @brief
 *
 * @param a
 * @param b
 ******************************************************************************/
void foo(int a, bool b)

Note: I would hope these "borders" would ONLY occur when applied to method comments, rather than internal comments within code (when adding a large, multi-line comment, we use /** for this occasionally).

I've tried going to Window->Preferences->C/C++->Code Style->Code Templates and adjusting the comments templates without success.


问:
SQLFluff Lint not working for multilevel subdirectory sql file
we are trying to use SQLFluff in our project to avoid sql parser errors before deployment.
in our case we have subdirectories which contains sql files.
During Development we are running command sqlfluff lint command in root directory, we found that  lint command is working for one level subdirectory sql path like below,

sqlfluff lint demo/complexquery.sql   --dialect snowflake

But when we try for 2 level subdirectory sql file path, lint command is not working and giving error as below. could you please let me know whether iam missing syntax.

sqlfluff lint SQLScript/demo/complexquery.sql   --dialect snowflake

Traceback (most recent call last):
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\toml\decoder.py", line 395, in loads
value, vtype = decoder.load_value(multilinestr)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\toml\decoder.py", line 849, in load_value
raise ValueError("Found tokens after a closed " +
ValueError: Found tokens after a closed string. Invalid TOML.

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\ar\AppData\Roaming\Python\Python310\Scripts\sqlfluff.exe_main.py", line 7, in
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\cli\commands.py", line 549, in lint
config = get_config(
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\cli\commands.py", line 361, in get_config
return FluffConfig.from_root(
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\core\config.py", line 613, in from_root
c = loader.load_config_up_to_path(
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\core\config.py", line 414, in load_config_up_to_path
[self.load_config_at_path(p) for p in config_paths]
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\core\config.py", line 414, in
[self.load_config_at_path(p) for p in config_paths]
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\core\config.py", line 338, in load_config_at_path
configs = self.load_config_file(p, fname, configs=configs)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\core\config.py", line 305, in load_config_file
elems = self._get_config_elems_from_toml(file_path)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\sqlfluff\core\config.py", line 191, in _get_config_elems_from_toml
config = toml.load(fpath)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\toml\decoder.py", line 134, in load
return loads(ffile.read(), _dict, decoder)
File "C:\Users\ar\AppData\Roaming\Python\Python310\site-packages\toml\decoder.py", line 397, in loads
raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Found tokens after a closed string. Invalid TOML. (line 54 column 1 char 4192)


问:
Google Domain Forwarding - with Content-Type JSON
I have a domain foo.com registered with google domains. I have configured it to forward to myfoo.com (including path forwarding, etc.).

When HTTP requests are sent, it successfully forwards

foo.com --> myfoo.com

foo.com/abcd --> myfoo.com/abcd

But when the HTTP requests include JSON data (Content-Type JSON), I cant see the data on myfoo.com. I do see that the forwarding to myfoo.com happens. But there is no data. Does this involve some configuration on my server side or something on google domain forwarding? PS: I have made sure that my server side can handle JSON data. When I directly reach myfoo.com/something with Content-Type JSON, I can handle it.


问:
Send Data to every client connected in dgram server
I've been struggling with this for the past few days, I've been looking for a way to send data to every connected client to my UDP node.js server.

```<code>var dgram = require("dgram");
var port = 3000;

var server = dgram.createSocket("udp4");

var sockets = [];
var players = [];
playerID = 0;
count = 0;
server.on("message",function(msg, rinfo)
{
    console.log("data: " + String(msg));
    data = String(msg);
    if (data.includes("Client:Connected")){
        count = 0;
        playerID+=1;

        rinfo.ID = playerID;
        players.push(rinfo.ID);
        sockets.push(rinfo.port, rinfo.address);
        console.table(sockets);

        console.log(rinfo.address + " has connected with ID " + playerID);

        players.forEach(() => {
            for (var i = 0; i < sockets.length; i += 1) {
                server.send("Player:Connected" + rinfo.ID, sockets[i], sockets[i]);
            }
        });

    }
});

server.bind(port);

</code>```

This is the current code, as you can see I attempted to use a for loop with arrays to store each individual client but that doesn't work, any help and suggestions would be greatly appreciated!

I attempted to use a for loop with arrays to store each individual client but that doesn't work

Body:
I've been struggling with this for the past few days, I've been looking for a way to send data to every connected client to my UDP node.js server.

var dgram = require("dgram");
var port = 3000;

var server = dgram.createSocket("udp4");

var sockets = [];
var players = [];
playerID = 0;
count = 0;
server.on("message",function(msg, rinfo)
{
    console.log("data: " + String(msg));
    data = String(msg);
    if (data.includes("Client:Connected")){
        count = 0;
        playerID+=1;

        rinfo.ID = playerID;
        players.push(rinfo.ID);
        sockets.push(rinfo.port, rinfo.address);
        console.table(sockets);

        console.log(rinfo.address + " has connected with ID " + playerID);

        players.forEach(() => {
            for (var i = 0; i < sockets.length; i += 1) {
                server.send("Player:Connected" + rinfo.ID, sockets[i], sockets[i]);
            }
        });

    }
});

server.bind(port);

This is the current code, as you can see I attempted to use a for loop with arrays to store each individual client but that doesn't work, any help and suggestions would be greatly appreciated!

I attempted to use a for loop with arrays to store each individual client but that doesn't work


问:
Heroku CLI not killing the postgres connections
Postgres db provisioned at Heroku runs out of DB connections very frequently which hinders debugging the application on local system.

While try killing the connection via Heroku CLI, nothing happens. It pops "Not Found" message. It seems the command is not able to locate the db within the heroku app.

Need some help on killing postgre DB connections, so as to debug the application.

I tried executing

```<code>heroku pg:info -a heroku-sizing-roi-dev
</code>```

It returns

But the database is provisioned already with DB schema and tables created. I can browse the DB on heroku dashboard and connect it via Java application.

Body:
Postgres db provisioned at Heroku runs out of DB connections very frequently which hinders debugging the application on local system.

While try killing the connection via Heroku CLI, nothing happens. It pops "Not Found" message. It seems the command is not able to locate the db within the heroku app.

Need some help on killing postgre DB connections, so as to debug the application.

I tried executing

heroku pg:info -a heroku-sizing-roi-dev

It returns

But the database is provisioned already with DB schema and tables created. I can browse the DB on heroku dashboard and connect it via Java application.


问:
How to override a Model field without saving in Django
Suppose I have a model below :

```<code>class Post(MainProcess, TimeStampedModel, SoftDeletionModel, models.Model):

    """Post model."""
    slug = models.SlugField(default=uuid.uuid4(), unique=True, max_length=100)
    uuid = models.UUIDField(unique=True, max_length=500,
                            default=uuid.uuid4,
                            editable=False,
                            db_index=True, blank=False, null=False)
    title = models.CharField(_('Title'), max_length=100, blank=False,
                             null=False)
    image = models.ImageField(_('Image'), upload_to='blog_images', null=True,
                              max_length=900, blank=True)
</code>```

I wanted to override the image field values without using the save() function, what is the best approach here which will be efficient.

Body:
Suppose I have a model below :

class Post(MainProcess, TimeStampedModel, SoftDeletionModel, models.Model):

    """Post model."""
    slug = models.SlugField(default=uuid.uuid4(), unique=True, max_length=100)
    uuid = models.UUIDField(unique=True, max_length=500,
                            default=uuid.uuid4,
                            editable=False,
                            db_index=True, blank=False, null=False)
    title = models.CharField(_('Title'), max_length=100, blank=False,
                             null=False)
    image = models.ImageField(_('Image'), upload_to='blog_images', null=True,
                              max_length=900, blank=True)

I wanted to override the image field values without using the save() function, what is the best approach here which will be efficient.


问:
How to call fetch_feed function from plugin in functions.php (wordpress)
I'm using the 'RSS Feed Block (Gutenberg)' plugin on my wordpress site, which I use to display a feed. However, if I update the feed, the plugin only shows the updates the next day. I would like the plugin to refresh the feed instantly, or at least more than once a day.

The plugin comes with a few hooks, for instance:

```<code>grf_before_items -- called before displaying the feed on your site.

grf_before_item -- called before each feed entry.
</code>```

In the code I find a function that is used to fetch the feed:

```<code>class GRF_Helper {

    /**
     * The main method used for fetching a feed.
     *
     * @param string $url
     * @return object
     */
    static function fetch_feed($url) {
        return fetch_feed($url);
    }
}
</code>```

So I tried:

```<code>add_action('grf_before_items', 'GRF_Helper');
</code>```

in functions.php. But that doesn't work. Can anyone help me out or give some pointers on where to search for?

(code from plugin: https://plugins.trac.wordpress.org/browser/rss-feed-block/)

Body:
I'm using the 'RSS Feed Block (Gutenberg)' plugin on my wordpress site, which I use to display a feed. However, if I update the feed, the plugin only shows the updates the next day. I would like the plugin to refresh the feed instantly, or at least more than once a day.

The plugin comes with a few hooks, for instance:

grf_before_items -- called before displaying the feed on your site.

grf_before_item -- called before each feed entry.

In the code I find a function that is used to fetch the feed:

class GRF_Helper {

    /**
     * The main method used for fetching a feed.
     *
     * @param string $url
     * @return object
     */
    static function fetch_feed($url) {
        return fetch_feed($url);
    }
}

So I tried:

add_action('grf_before_items', 'GRF_Helper');

in functions.php. But that doesn't work. Can anyone help me out or give some pointers on where to search for?

(code from plugin: https://plugins.trac.wordpress.org/browser/rss-feed-block/)


问:
How to extract metrics from the app running an native image by GraalVM
I have been exploring the native-image with one of my applications. In the current architecture of my application, it's an akka-grpc powered java app that publishes messages to Kafka. I have been using the apache-kafka library as a Kafka producer client. My application has a large memory footprint, so I've been exploring the native-image feature from GraalVM. With native image, my new application requires 1/8th of resources than the previous version - this a great win for me. But... I'm losing metrics.

I've been using cinnamon, a Lightbend's telemetry metrics tool which provides me observability for the grpc, the JMX provides me metrics for the GC and Dispatchers [i.e. number of loaded class, number of thread running, etc.] and I also get metrics for apache-kafka client (i.e. success and error rate for message publishing, message bytes size, latency, retries, apache-kafka queue size, etc.)

I cannot get any of the metrics with the new version of my application, i.e., with the native image. I reckon for JMX to work it requires JVM and Java bytecode which is no longer present in the native executable. I can sacrifice some of the metrics from JMX but is there a way I can get the Kafka and the grpc metrics?

Would anyone be kind enough to point me to some tools I can use to get the above metrics?


问:
Precompiling static library in Android NDK - sources in separate directory tree
I am trying to precompile a static library using the Android NDK. This precompiled static library will later be linked with JNI code in other projects. I do not have an Eclipse project associated with the library so I set up a skeleton Android JNI directory structure within the library's project root directory.
The directory structure is as follows:

<root>/
       Android/
               jni/
                   Android.mk
                   Application.mk
       iOS/
           <other stuff here>
       src/

```

<p>This is the <code>Application.mk</code> file:</p>

<pre class="lang-none prettyprint-override"><code>APP_PLATFORM := android-8
APP_ABI := armeabi-v7a
</code>```

And this is the Android.mk file:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := imajilib
LOCAL_CFLAGS := -DANDROID_NDK
MY_FILES := $(wildcard $(LOCAL_PATH)/../../src/*.c)
LOCAL_SRC_FILES := $(MY_FILES:$(LOCAL_PATH)/%=%)
LOCAL_LDLIBS := -lGLESv2 -llog
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := ignore_this_imajilib
LOCAL_STATIC_LIBRARIES := imajilib
include $(BUILD_SHARED_LIBRARY)
```

<p>The <code>ignore_this_imajilib</code> shared library module is a dependency trick I picked up from href="https://stackoverflow.com/questions/5811009/how-to-write-debug-android-mk-for-ndk-static-library">here.</p>

<p>I compile the library by cd'ing to the <code>jni/</code> directory and running the following command:</p>

<pre class="lang-none prettyprint-override"><code>~/path/to/ndk-build NDK_PROJECT_PATH=/path/to/<root> -B V=1
</code>```

The compilation succeeds with no issues. I now have new directories libs/ and obj/ under the jni/ directory.

The structure of the libs/ directory is:

libs/
     armeabi-v7a/
                 libignore_this_imajilib.so
```

<p>This is okay but ideally I would like to see <code>libimajilib.a</code> here as well.</p>

<p>The structure of the <code>obj/</code> directory is:</p>

<pre class="lang-none prettyprint-override"><code>obj/
    local/
          armeabi-v7a/
                      libignore_this_imajilib.so
                      libimajilib.a
                      objs/
                           imajilib/
                                    <this directory is empty>
                      src/
                          bunch of *.o and *.o.d files>
</code>```

The problem is with the location of the *.o and *.o.d files. I suspect the build process is placing them there because of the ../../src/*.c that I have in the Android.mk file, and so it is going to obj/local/armeabi-v7a/objs/imajilib/../../src whereas I would like to see them in obj/local/armeabi-v7a/objs/imajilib. I see no way around this other than to copy and paste the source files from src/ to the jni/ directory, but I don't want to do this as the src/ directory is shared among multiple platforms.

ContentLicense: CC BY-SA 3.0

Body:
I am trying to precompile a static library using the Android NDK. This precompiled static library will later be linked with JNI code in other projects. I do not have an Eclipse project associated with the library so I set up a skeleton Android JNI directory structure within the library's project root directory.
The directory structure is as follows:

<root>/
       Android/
               jni/
                   Android.mk
                   Application.mk
       iOS/
           <other stuff here>
       src/

This is the Application.mk file:

APP_PLATFORM := android-8
APP_ABI := armeabi-v7a

And this is the Android.mk file:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := imajilib
LOCAL_CFLAGS := -DANDROID_NDK
MY_FILES := $(wildcard $(LOCAL_PATH)/../../src/*.c)
LOCAL_SRC_FILES := $(MY_FILES:$(LOCAL_PATH)/%=%)
LOCAL_LDLIBS := -lGLESv2 -llog
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := ignore_this_imajilib
LOCAL_STATIC_LIBRARIES := imajilib
include $(BUILD_SHARED_LIBRARY)

The ignore_this_imajilib shared library module is a dependency trick I picked up from here.

I compile the library by cd'ing to the jni/ directory and running the following command:

~/path/to/ndk-build NDK_PROJECT_PATH=/path/to/<root> -B V=1

The compilation succeeds with no issues. I now have new directories libs/ and obj/ under the jni/ directory.

The structure of the libs/ directory is:

libs/
     armeabi-v7a/
                 libignore_this_imajilib.so

This is okay but ideally I would like to see libimajilib.a here as well.

The structure of the obj/ directory is:

obj/
    local/
          armeabi-v7a/
                      libignore_this_imajilib.so
                      libimajilib.a
                      objs/
                           imajilib/
                                    <this directory is empty>
                      src/

The problem is with the location of the *.o and *.o.d files. I suspect the build process is placing them there because of the ../../src/*.c that I have in the Android.mk file, and so it is going to obj/local/armeabi-v7a/objs/imajilib/../../src whereas I would like to see them in obj/local/armeabi-v7a/objs/imajilib. I see no way around this other than to copy and paste the source files from src/ to the jni/ directory, but I don't want to do this as the src/ directory is shared among multiple platforms.


问:
Calculate price of array services based on multiple onlick using vuejs
I have a problem as can be show on the picture balow.On the right I have a list of services which when clicked affects the final price of services on the right.
I have written a code unfortunately it does not work when I click any service on the left.

Array of services:

```<code>AdditionalServices: [
                {
                    name: 'Web Development',
                    price: 300,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: true
                },
                {
                    name: 'Design',
                    price: 400,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: false
                },
                {
                    name: 'Integration',
                    price: 250,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: false
                },
                {
                    name: 'Training',
                    price: 220,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: false
                }
            ],
</code>```

The html code for user interface

```<code><div class="rc-orderform__row rc-orderform__row--additional-features">
   <div class="rc-orderform__feature-heading" data-testid="orderform-additionalServicesTitle">Additional services</div>
   <div class="rc-orderform__feature-body rc-orderform__feature-body--add-features">
      <div class="rc-orderform__feature-body--add-features__item" v-for="service in AdditionalServices">
         <div class="rc-validation-representer valid" data-invalid="false">
            <div class="AdditionalFeature__checkbox filled" data-testid="smartPaperControl">
               <label class="UICheckbox UICheckbox--theme-default">
                  <input id="smart_paper" type="checkbox" class="UICheckbox__checkbox UICheckbox__checkbox--theme-default UICheckbox__checkbox--native" name="smart_paper" v-on:click="toggleActive(service)" v-bind:class="{ 'active' : service.active }" />
                  <div class="UICheckbox__checkbox UICheckbox__checkbox--theme-default UICheckbox__checkbox--faux" tabindex="0"></div>
                  <div class="UICheckbox__label UICheckbox__label--theme--default" for="smart_paper">
                     <div class="AdditionalFeature__label">
                        <div class="AdditionalFeature__header">
                           <div class="AdditionalFeature__title" data-testid="additionalFeature-title">{{service.name}}</div>
                           <div class="AdditionalFeature__price" data-testid="additionalFeature-price"><span>{{service.price}}</span></div>
                        </div>
                        <p class="AdditionalFeature__subtitle" data-testid="additionalFeature-subtitle">{{service.short_description}}</p>
                        <p class="AdditionalFeature__description" data-testid="additionalFeature-description">
                           {{service.long_description}}
                        </p>
                     </div>
                  </div>
               </label>
            </div>
         </div>
      </div>
   </div>
</div>
</code>```

The status toggle method for multiple/single checkbox/The checkbox toggle function

```<code>toggleActive: function(s) {
            s.active = !s.active;
        },
</code>```

The method for calculating cost based on checkbox clicked.Based on the array of prices listed above

```<code>calculateTotalAdditionalService() {
            var total = 0;

            //var additional_services=this.AdditionalServices;
            for(let i=0;i<=this.AdditionalServices.length; i++){
                if (i.active){
                    total += i.price;
                }

            }

            return total;
        },
</code>```

The overall method for calculating overall cost of service

```<code>calculateTotal : function (){

               var additional_services =this.calculateTotalAdditionalService();

                var unit_price=Number(parseFloat( additional_services ));

                var amount =(unit_price);

                var sub_total =(amount);

                var total= sub_total;

                return total;

        },
</code>```

Body:
I have a problem as can be show on the picture balow.On the right I have a list of services which when clicked affects the final price of services on the right.
I have written a code unfortunately it does not work when I click any service on the left.

Array of services:

AdditionalServices: [
                {
                    name: 'Web Development',
                    price: 300,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: true
                },
                {
                    name: 'Design',
                    price: 400,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: false
                },
                {
                    name: 'Integration',
                    price: 250,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: false
                },
                {
                    name: 'Training',
                    price: 220,
                    short_description:"Detailed comments on the key writing aspects of your paper",
                    long_description:"Get your paper with comprehensive explanations of structure, formatting, and so on, along with precise guidelines for your own writing.",

                    active: false
                }
            ],

The html code for user interface

Additional services

                  <input id="smart_paper" type="checkbox" class="UICheckbox__checkbox UICheckbox__checkbox--theme-default UICheckbox__checkbox--native" name="smart_paper" v-on:click="toggleActive(service)" v-bind:class="{ 'active' : service.active }" />

{{service.name}}

{{service.price}}

{{service.short_description}}

                           {{service.long_description}}

The status toggle method for multiple/single checkbox/The checkbox toggle function

toggleActive: function(s) {
            s.active = !s.active;
        },

The method for calculating cost based on checkbox clicked.Based on the array of prices listed above

calculateTotalAdditionalService() {
            var total = 0;

            //var additional_services=this.AdditionalServices;
            for(let i=0;i<=this.AdditionalServices.length; i++){
                if (i.active){
                    total += i.price;
                }

            }

            return total;
        },

The overall method for calculating overall cost of service

calculateTotal : function (){

               var additional_services =this.calculateTotalAdditionalService();

                var unit_price=Number(parseFloat( additional_services ));

                var amount =(unit_price);

                var sub_total =(amount);

                var total= sub_total;

                return total;

        },


问:
How to show tkinter buttons in mac touch bar 2020
```<code>from tkinter import *
import PyTouchBar
PyTouchBar.set_customization_identifier("com.madrau.PyTouchBar.touchbar")

root = Tk()
starter = PyTouchBar.TouchBarItems.Button(title='играть', color=(PyTouchBar.Color.green))
PyTouchBar.set_touchbar([starter])
PyTouchBar.prepare_tk_windows(root)

root.mainloop()

</code>```

Used lyb PyTouchBar/tkinter

Code open new modal white widnow 'kt'
And nothing happened on the touchbar. It may be issue with touchbar, i have with physical 'esc' button. How possible to fix it?

changed python v.
PyTouchBar works just with 3+ i using 3.11

apple m1 pro 2020

Body:
from tkinter import *
import PyTouchBar
PyTouchBar.set_customization_identifier("com.madrau.PyTouchBar.touchbar")

root = Tk()
starter = PyTouchBar.TouchBarItems.Button(title='играть', color=(PyTouchBar.Color.green))
PyTouchBar.set_touchbar([starter])
PyTouchBar.prepare_tk_windows(root)

root.mainloop()

Used lyb PyTouchBar/tkinter

Code open new modal white widnow 'kt'
And nothing happened on the touchbar. It may be issue with touchbar, i have with physical 'esc' button. How possible to fix it?

changed python v.
PyTouchBar works just with 3+ i using 3.11

apple m1 pro 2020


问:
Net 6.0 Hamburger menu Bootstrap
Hi I have an issue with a bootstrap hamburger menu the menu expands, however when I try to collapse the menu it just will not work, the data target class is correct, is there something I am doing wrong here or have I over looked something. Thanks</p>
```<code> <nav class="navbar  navbar-expand-sm navbar-toggleable-sm navbar-light bg-info border-bottom box-shadow mb-3">
            <div class="container-fluid">
                <a class="navbar-brand text-light" asp-area="" asp-controller="Home" asp-action="Index">PobalScoil</a>
            <button class="navbar-toggler text-light" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
                <ul class="navbar-nav flex-grow-1">
                    <li class="nav-item">
                        <a class="nav-link text-light bg-info" asp-area="" asp-controller="Home" asp-action="About_Us">About  |</a>
                    </li>
</code>```

Title: Net 6.0 Hamburger menu Bootstrap

Body:
Hi I have an issue with a bootstrap hamburger menu the menu expands, however when I try to collapse the menu it just will not work, the data target class is correct, is there something I am doing wrong here or have I over looked something. Thanks

                PobalScoil
            <button class="navbar-toggler text-light" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">

            </button>

                        About  |


问:
Azure-quantum: problems with jobs submission
I use pyquil for azure quantum, and submit jobs with run_batch method of AzureQuantumComputer class. For batches with up to 10 circuits there are no problems, but larger batches result in an error below.

```<code>
</code>```
```<code>Traceback (most recent call last):
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1180, in rest_key_extractor
return working_data.get(key)
AttributeError: 'str' object has no attribute 'get'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1509, in failsafe_deserialize
return self(target_obj, data, content_type=content_type)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1376, in __call__
return self._deserialize(target_obj, data)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1454, in _deserialize
raise_with_traceback(DeserializationError, msg, err)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\exceptions.py", line
51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1180, in rest_key_extractor
return working_data.get(key)
azure.core.exceptions.DeserializationError: ("Unable to deserialize to object: type,
AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no
attribute 'get'"))
Traceback (most recent call last):
File "C:\Users\Enter\PycharmProjects\QREM_pipline_development\pyquil_experiments.py", line
209, in <module>
unprocessed_results_now = pyquil_utilities.run_batches_parametric(backend_name=backend_name,
File
</code>```

"C:\Users\Enter\PycharmProjects\QREM_SECRET_DEVELOPMENT_LOC\backends_support\pyquil\pyquil_utiliti
es.py", line 415, in run_batches_parametric
results = backend_instance.run_batch(executable,
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\pyquil_for_azure_quantum_init_.py", line 141, in run_batch
return qam.run_batch(executable, memory_map)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\pyquil_for_azure_quantum_init_.py", line 336, in run_batch
job = self._target.submit(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\quantum\target\rigetti\target.py", line 183, in submit
return super().submit(input_data, name, input_params, **kwargs)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-

packages\azure\quantum\target\target.py", line 141, in submit
return Job.from_input_data(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\quantum\job\base_job.py",
line 117, in from_input_data
return cls.from_storage_uri(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-

packages\azure\quantum\job\base_job.py",

line 207, in from_storage_uri
job.submit()
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\azure\quantum\job\job.py",

line 45, in submit
job = self.workspace.submit_job(self)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\azure\quantum\workspace.py",

line 265, in submit_job
details = client.create(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\core\tracing\decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\quantum_client\operations_jobs_operations.py", line 387, in create
raise HttpResponseError(response=response, model=error)
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
Content:
403 Forbidden

403 Forbidden

Microsoft-Azure-Application-Gateway/v2

```<code>
</code>```

I tried to run different circuits, it seems to only depend on the number of circuits in a batch, not the structure of a circuit. Programs are compiled to native quil locally.

Body:
I use pyquil for azure quantum, and submit jobs with run_batch method of AzureQuantumComputer class. For batches with up to 10 circuits there are no problems, but larger batches result in an error below.

Traceback (most recent call last):
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1180, in rest_key_extractor
return working_data.get(key)
AttributeError: 'str' object has no attribute 'get'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1509, in failsafe_deserialize
return self(target_obj, data, content_type=content_type)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1376, in __call__
return self._deserialize(target_obj, data)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1454, in _deserialize
raise_with_traceback(DeserializationError, msg, err)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\exceptions.py", line
51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1436, in _deserialize
found_value = key_extractor(attr, attr_desc, data)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\msrest\serialization.py",
line 1180, in rest_key_extractor
return working_data.get(key)
azure.core.exceptions.DeserializationError: ("Unable to deserialize to object: type,
AttributeError: 'str' object has no attribute 'get'", AttributeError("'str' object has no
attribute 'get'"))
Traceback (most recent call last):
File "C:\Users\Enter\PycharmProjects\QREM_pipline_development\pyquil_experiments.py", line
209, in <module>
unprocessed_results_now = pyquil_utilities.run_batches_parametric(backend_name=backend_name,
File

"C:\Users\Enter\PycharmProjects\QREM_SECRET_DEVELOPMENT_LOC\backends_support\pyquil\pyquil_utiliti
es.py", line 415, in run_batches_parametric
results = backend_instance.run_batch(executable,
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\pyquil_for_azure_quantum_init_.py", line 141, in run_batch
return qam.run_batch(executable, memory_map)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\pyquil_for_azure_quantum_init_.py", line 336, in run_batch
job = self._target.submit(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\quantum\target\rigetti\target.py", line 183, in submit
return super().submit(input_data, name, input_params, **kwargs)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-

packages\azure\quantum\target\target.py", line 141, in submit
return Job.from_input_data(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\quantum\job\base_job.py",
line 117, in from_input_data
return cls.from_storage_uri(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-

packages\azure\quantum\job\base_job.py",

line 207, in from_storage_uri
job.submit()
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\azure\quantum\job\job.py",

line 45, in submit
job = self.workspace.submit_job(self)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-packages\azure\quantum\workspace.py",

line 265, in submit_job
details = client.create(
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\core\tracing\decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "C:\Users\Enter\anaconda3\envs\qiskit_env\lib\site-
packages\azure\quantum_client\operations_jobs_operations.py", line 387, in create
raise HttpResponseError(response=response, model=error)
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
Content:
403 Forbidden

403 Forbidden

Microsoft-Azure-Application-Gateway/v2

I tried to run different circuits, it seems to only depend on the number of circuits in a batch, not the structure of a circuit. Programs are compiled to native quil locally.


问:
Jetson nano could not install PyQt5
I am trying hard to install PyQt5 in my Jetson nano. However, there is one thing always annoys me.
here's the feedback message.

```<code> note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for sip
      Failed to build sip
      ERROR: Could not build wheels for sip, which is required to install pyproject.toml-based projects
      [end of output]

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

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

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

</code>```

I've tried sudo pip3 install pyqt5 and it gave me

```<code>compilation terminated.
            error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for sip
      Failed to build sip
      ERROR: Could not build wheels for sip, which is required to install pyproject.toml-based projects
      [end of output]

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

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

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

I also tried sudo apt-get install python3-pyqt5. It worked but when I imported PyQt5 by from pyqtgraph.Qt import QtCore, QtGui or from PyQt5.QtCore import QObject, pyqtSignal, it gave me

```<code>Traceback (most recent call last):
  File "/home/llw/Desktop/project/ture file/save_pointcloud.py", line 16, in <module>
    from pyqtgraph.Qt import QtCore, QtGui
  File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/__init__.py", line 17, in <module>
    from .colors import palette
  File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/colors/palette.py", line 1, in <module>
    from ..Qt import QtGui
  File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/Qt/__init__.py", line 155, in <module>
    import PyQt5.QtCore
ModuleNotFoundError: No module named 'PyQt5.QtCore
</code>```

How do I fix this problem? Any suggestions or ideas could be a help.

Thank you.

Title: Jetson nano could not install PyQt5

Body:
I am trying hard to install PyQt5 in my Jetson nano. However, there is one thing always annoys me.
here's the feedback message.

 note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for sip
      Failed to build sip
      ERROR: Could not build wheels for sip, which is required to install pyproject.toml-based projects
      [end of output]

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

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

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

I've tried sudo pip3 install pyqt5 and it gave me

compilation terminated.
            error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for sip
      Failed to build sip
      ERROR: Could not build wheels for sip, which is required to install pyproject.toml-based projects
      [end of output]

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

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

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

I also tried sudo apt-get install python3-pyqt5. It worked but when I imported PyQt5 by from pyqtgraph.Qt import QtCore, QtGui or from PyQt5.QtCore import QObject, pyqtSignal, it gave me

Traceback (most recent call last):
  File "/home/llw/Desktop/project/ture file/save_pointcloud.py", line 16, in <module>
    from pyqtgraph.Qt import QtCore, QtGui
  File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/__init__.py", line 17, in <module>
    from .colors import palette
  File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/colors/palette.py", line 1, in <module>
    from ..Qt import QtGui
  File "/usr/local/lib/python3.7/dist-packages/pyqtgraph/Qt/__init__.py", line 155, in <module>
    import PyQt5.QtCore
ModuleNotFoundError: No module named 'PyQt5.QtCore

How do I fix this problem? Any suggestions or ideas could be a help.

Thank you.


问:
Correlated subquery in SQLAlchemy
I have the following query:

```<code>SELECT ID, (SELECT SUM(AMOUNT) FROM PURCHASE_PAYMENTS WHERE PURCHASE_PAYMENTS.PURCHASE_ID
= PURCHASES.ID) AS PAID
-> FROM PURCHASES;
</code>```

which works as I expect. I have problems translating this to SQLAlchemy. My mapped classes are ( I only show the fields of interest):

```<code>class Purchase(Base):

    __tablename__ = 'purchases'

    id = Column(Integer, primary_key=True)

 class PurchasePayment(Base):

    __tablename__ = 'purchase_payments'

    id = Column(Integer, primary_key=True)

    purchase_id = Column(Integer, ForeignKey('purchases.id'))
    amount = Column(Numeric(19, 4), nullable=False)
</code>```

Also, I need the results to be like,

```<code> (models.db.Purchase object at  0x0000021DD3683D..., Decimal('1234'))
</code>```

I tried unsuccessfully to follow this post Can we make correlated queries with SQLAlchemy.

Any help?

Title: Correlated subquery in SQLAlchemy

Body:
I have the following query:

SELECT ID, (SELECT SUM(AMOUNT) FROM PURCHASE_PAYMENTS WHERE PURCHASE_PAYMENTS.PURCHASE_ID
= PURCHASES.ID) AS PAID
-> FROM PURCHASES;

which works as I expect. I have problems translating this to SQLAlchemy. My mapped classes are ( I only show the fields of interest):

class Purchase(Base):

    __tablename__ = 'purchases'

    id = Column(Integer, primary_key=True)

 class PurchasePayment(Base):

    __tablename__ = 'purchase_payments'

    id = Column(Integer, primary_key=True)

    purchase_id = Column(Integer, ForeignKey('purchases.id'))
    amount = Column(Numeric(19, 4), nullable=False)

Also, I need the results to be like,

 (models.db.Purchase object at  0x0000021DD3683D..., Decimal('1234'))

I tried unsuccessfully to follow this post Can we make correlated queries with SQLAlchemy.

Any help?


问:
Smoothing of a 3d-geometry
```<code>figure
isovals = shiftdim(xPhys,2);
isovals = smooth3(isovals,'box',1);
patch(isosurface(isovals,0.8),'FaceColor',[0 0 1],'EdgeColor','none'); % blue
patch(isocaps(isovals,0.8),'FaceColor',[1 0 0],'EdgeColor','none');    % red
view(3); axis equal tight off; camlight;
</code>```

The above code transforms this 3d-geometry
in this geometry

xPhys (variable in the second line of the code) is a 3d matrix whose elements indicate the density of a square, zero means the square is empty, one means it is completely filled with material. And in between there are infinitely different intermediate levels.

I have created a code that causes there to be only one intermediate value (e.g. 0.5), this can be seen here as light grey.

I would like to rewrite the code so that the last geometry shown is smoothed, but one should be able to distinguish the light grey from the black areas. In the code above, no distinction is made, all squares get the colour blue.

What can i do to achieve this goal?

Title: Smoothing of a 3d-geometry

Body:
figure
isovals = shiftdim(xPhys,2);
isovals = smooth3(isovals,'box',1);
patch(isosurface(isovals,0.8),'FaceColor',[0 0 1],'EdgeColor','none'); % blue
patch(isocaps(isovals,0.8),'FaceColor',[1 0 0],'EdgeColor','none');    % red
view(3); axis equal tight off; camlight;

The above code transforms this 3d-geometry
in this geometry

xPhys (variable in the second line of the code) is a 3d matrix whose elements indicate the density of a square, zero means the square is empty, one means it is completely filled with material. And in between there are infinitely different intermediate levels.

I have created a code that causes there to be only one intermediate value (e.g. 0.5), this can be seen here as light grey.

I would like to rewrite the code so that the last geometry shown is smoothed, but one should be able to distinguish the light grey from the black areas. In the code above, no distinction is made, all squares get the colour blue.

What can i do to achieve this goal?


问:
Updating / writing to sqlite3 is extremely slow (using Python)
I have a local SQLite database with about 5m rows (approx. 500mb).

It has the following schema:

```<code>index: integer
URL: text
date_added: text
date_updated: text
target: text
response_code: text
</code>```

Now I am using the following query to update entries (simplified):

```<code>for result in results:
        c.execute("UPDATE websites SET target = ?, response_code = ?, date_updated = ? WHERE url = ?", (result[1], result[2], result[3], result[0]))
</code>```

It works fine but is insanely slow (i.e., as it queries the entire database every time), making "just updating" my database the absolute bottleneck of my entire Python script.

What would you suggest to me to substantially increase the speed of writing to the database?

Making URL a primary key did not improve speed by a lot.

Should I instead load the entire SQLite db into a pandas data frame, update the values in the data frame and then update the entire SQlite db from the data frame at once?

Body:
I have a local SQLite database with about 5m rows (approx. 500mb).

It has the following schema:

index: integer
URL: text
date_added: text
date_updated: text
target: text
response_code: text

Now I am using the following query to update entries (simplified):

for result in results:
        c.execute("UPDATE websites SET target = ?, response_code = ?, date_updated = ? WHERE url = ?", (result[1], result[2], result[3], result[0]))

It works fine but is insanely slow (i.e., as it queries the entire database every time), making "just updating" my database the absolute bottleneck of my entire Python script.

What would you suggest to me to substantially increase the speed of writing to the database?

Making URL a primary key did not improve speed by a lot.

Should I instead load the entire SQLite db into a pandas data frame, update the values in the data frame and then update the entire SQlite db from the data frame at once?


问:
Keyboard navigation on multilevel dropdown using React
Okay so I'm trying to make some custom dropdown or Select component (kinda), I get the idea of navigating using ArrowUp and ArrowDown on keydown event when it came to one level dropdown, but I'm struggling on multilevel dropdown.

Here's the code:

```<code>// this function that makes dynamic submenu work
const SelectSubMenus = (props) => {
  return (
    <SelectMenuWrapper sub>
      {props.submenus.map((sub, i) => (
        <SelectItem key={i} {...sub} />
      ))}
    </SelectMenuWrapper>
  );
};

// select menu items
const SelectItem = ({ sub: subMenus, level, index: i, ...props }) => {
  const [isSubMenuOpen, setIsSubMenuOpen] = useState(false);
  const _menus = useRef();
  level += 1;

  // Show submenu
  const onMouseOverHandler = (e) => {
    clearTimeout(_menus.current);
    _menus.current = setTimeout(() => {
      setIsSubMenuOpen(true);
    }, 300);
  };

  // Hide sub menu
  const onMouseOutHandler = (e) => {
    clearTimeout(_menus.current);
    _menus.current = setTimeout(() => {
      setIsSubMenuOpen(false);
    }, 300);
  };

  return (
    <SelectMenuItem tabIndex={0} {...props}>
      {subMenus ? (
        <>
          {props.text}
          <SelectItemHints>
            {props.hint && <span>{props.hint}</span>}
            {subMenus && <span>></span>}
          </SelectItemHints>
          {isSubMenuOpen && (
            <SelectSubMenus level={level} submenus={subMenus} />
          )}
        </>
      ) : (
        <span>{props.text}</span>
      )}
    </SelectMenuItem>
  );
};

// main button and toggle
export const Select = (props) => {
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
  const [hoveredIndex, setHoveredIndex] = useState(-1);
  const _toggle = useRef(null);

  const onToggleClickHandler = (e) => {
    setIsDropdownOpen(!isDropdownOpen);
    // _toggle.current?.focus();
  };

  const onKeyDownHandler = (e) => {
    switch (e.key) {
      case "Down":
      case "ArrowDown":
        setHoveredIndex((prevState) =>
          prevState + 1 === props.options.length ? 0 : prevState + 1
        );
        break;
      case "Up":
      case "ArrowUp":
        setHoveredIndex((prevState) =>
          prevState <= 0 ? props.options.length : prevState - 1
        );
        break;
      default:
        break;
    }
  };

  return (
    <SelectWrapper>
      <button
        type="button"
        onClick={onToggleClickHandler}
        onKeyDown={onKeyDownHandler}
      >
        Show dropdown menu
      </button>
      {isDropdownOpen && (
        <SelectMenuWrapper ref={_toggle} tabIndex={0}>
          {props.options.map((option, i) => {
            const level = 0;
            return (
              <SelectItem
                tabIndex={0}
                key={i}
                level={level}
                {...(i === hoveredIndex && { className: "hovered" })}
                {...option}
              />
            );
          })}
        </SelectMenuWrapper>
      )}
    </SelectWrapper>
  );
};
</code>```

And here's the codesandbox demo

I've been trying using forwardRef to make sure navigating on level 1 dropdown works, but even on the level 1 dropdown, navigation doesn't work (the increment kinda odd because of multiple render).

Body:
Okay so I'm trying to make some custom dropdown or Select component (kinda), I get the idea of navigating using ArrowUp and ArrowDown on keydown event when it came to one level dropdown, but I'm struggling on multilevel dropdown.

Here's the code:

// this function that makes dynamic submenu work
const SelectSubMenus = (props) => {
  return (
    <SelectMenuWrapper sub>
      {props.submenus.map((sub, i) => (
        <SelectItem key={i} {...sub} />
      ))}
    </SelectMenuWrapper>
  );
};

// select menu items
const SelectItem = ({ sub: subMenus, level, index: i, ...props }) => {
  const [isSubMenuOpen, setIsSubMenuOpen] = useState(false);
  const _menus = useRef();
  level += 1;

  // Show submenu
  const onMouseOverHandler = (e) => {
    clearTimeout(_menus.current);
    _menus.current = setTimeout(() => {
      setIsSubMenuOpen(true);
    }, 300);
  };

  // Hide sub menu
  const onMouseOutHandler = (e) => {
    clearTimeout(_menus.current);
    _menus.current = setTimeout(() => {
      setIsSubMenuOpen(false);
    }, 300);
  };

  return (
    <SelectMenuItem tabIndex={0} {...props}>
      {subMenus ? (
        <>
          {props.text}
          <SelectItemHints>
            {props.hint && {props.hint}}
            {subMenus && >}
          </SelectItemHints>
          {isSubMenuOpen && (
            <SelectSubMenus level={level} submenus={subMenus} />
          )}
        </>
      ) : (
        {props.text}
      )}
    </SelectMenuItem>
  );
};

// main button and toggle
export const Select = (props) => {
  const [isDropdownOpen, setIsDropdownOpen] = useState(false);
  const [hoveredIndex, setHoveredIndex] = useState(-1);
  const _toggle = useRef(null);

  const onToggleClickHandler = (e) => {
    setIsDropdownOpen(!isDropdownOpen);
    // _toggle.current?.focus();
  };

  const onKeyDownHandler = (e) => {
    switch (e.key) {
      case "Down":
      case "ArrowDown":
        setHoveredIndex((prevState) =>
          prevState + 1 === props.options.length ? 0 : prevState + 1
        );
        break;
      case "Up":
      case "ArrowUp":
        setHoveredIndex((prevState) =>
          prevState <= 0 ? props.options.length : prevState - 1
        );
        break;
      default:
        break;
    }
  };

  return (
    <SelectWrapper>
      <button
        type="button"
        onClick={onToggleClickHandler}
        onKeyDown={onKeyDownHandler}
      >
        Show dropdown menu
      </button>
      {isDropdownOpen && (
        <SelectMenuWrapper ref={_toggle} tabIndex={0}>
          {props.options.map((option, i) => {
            const level = 0;
            return (
              <SelectItem
                tabIndex={0}
                key={i}
                level={level}
                {...(i === hoveredIndex && { className: "hovered" })}
                {...option}
              />
            );
          })}
        </SelectMenuWrapper>
      )}
    </SelectWrapper>
  );
};

And here's the codesandbox demo

I've been trying using forwardRef to make sure navigating on level 1 dropdown works, but even on the level 1 dropdown, navigation doesn't work (the increment kinda odd because of multiple render).


问:
Recyclerview not showing any data and errors in logcat
I don't know why my recyclerview not showing and data.
println in MainActivity is working corectly

\ files/code

MainActivity file

```<code>fun retriveDataFromDatabase() : ArrayList<Users> {

    databaseRefrence.addValueEventListener(object : ValueEventListener{
        override fun onDataChange(snapshot: DataSnapshot) {

            userList.clear()

            for (eachUser in snapshot.children) {
                val user = eachUser.getValue(Users::class.java)

                if (user != null) {
                    println("user name: ${user.name}")
                    println("user email: ${user.email}")
                    println("user Id: ${user.userId}")
                    println("***************************")

                    userList.add(user)
                }

            }
            println("In fun: $userList")
        }

        override fun onCancelled(error: DatabaseError) {
            TODO("Not yet implemented")
        }
    })

    return userList
}
</code>```

UserAdapter file

User.kt code

data class Users(val userId : String = "",
val name : String = "",
val email : String = "") {
}

Body:
I don't know why my recyclerview not showing and data.
println in MainActivity is working corectly

\ files/code

MainActivity file

fun retriveDataFromDatabase() : ArrayList<Users> {

    databaseRefrence.addValueEventListener(object : ValueEventListener{
        override fun onDataChange(snapshot: DataSnapshot) {

            userList.clear()

            for (eachUser in snapshot.children) {
                val user = eachUser.getValue(Users::class.java)

                if (user != null) {
                    println("user name: ${user.name}")
                    println("user email: ${user.email}")
                    println("user Id: ${user.userId}")
                    println("***************************")

                    userList.add(user)
                }

            }
            println("In fun: $userList")
        }

        override fun onCancelled(error: DatabaseError) {
            TODO("Not yet implemented")
        }
    })

    return userList
}

UserAdapter file

User.kt code

data class Users(val userId : String = "",
val name : String = "",
val email : String = "") {
}


问:
Run firebase database operations in the background in onMessageReceives
I need to perform some realtime-database operation as soon as firebase onMessageReceived(...) method gets called.

I am able to retrieve the data, however performing a DB operation like read or even update doesn't work when the app is in the background, it only works when its on the foreground.

```<code>@Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
  super.onMessageReceived(remoteMessage);

  //some CRUD operation for instance
  FirebaseDatabase.getInstance()
      .getReference("test_node")
      .child("test_child")
      .get() //I've tried replacing this with other CRUDs operation like setValue(...) still doesn't work
      ...
</code>```

Body:
I need to perform some realtime-database operation as soon as firebase onMessageReceived(...) method gets called.

I am able to retrieve the data, however performing a DB operation like read or even update doesn't work when the app is in the background, it only works when its on the foreground.

@Override
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
  super.onMessageReceived(remoteMessage);

  //some CRUD operation for instance
  FirebaseDatabase.getInstance()
      .getReference("test_node")
      .child("test_child")
      .get() //I've tried replacing this with other CRUDs operation like setValue(...) still doesn't work
      ...


问:
Go version returns unknown, gccgo fails
I installed gccgo using:

sudo pacman -S gcc-go
```
<p>When I tried building my code using <code>go build -buildvcs=false -compiler gccgo .</code>, the following error was returned:</p>
<pre class="lang-bash prettyprint-override"><code># github.com/CompeyDev/nemo/prisma/db
gccgo: fatal error: Killed signal terminated program go1
compilation terminated.
note: module requires Go 1.19
</code>```

So, I ran go version which returned go version unknown linux/amd64; note the "unknown". I have no clue how the version can return unknown.

Thanks to @JimB pointing out how the arch gcc-go package was compatible with version 1.18 only, I was able to downgrade go, and this fixed the compilation issue. However, now I have a new error:

# github.com/CompeyDev/nemo/prisma/db
gccgo: fatal error: Killed signal terminated program go1
compilation terminated.
```

Title: Go version returns unknown, gccgo fails

Body:
I installed gccgo using:

sudo pacman -S gcc-go

When I tried building my code using go build -buildvcs=false -compiler gccgo ., the following error was returned:

# github.com/CompeyDev/nemo/prisma/db
gccgo: fatal error: Killed signal terminated program go1
compilation terminated.
note: module requires Go 1.19

So, I ran go version which returned go version unknown linux/amd64; note the "unknown". I have no clue how the version can return unknown.

Thanks to @JimB pointing out how the arch gcc-go package was compatible with version 1.18 only, I was able to downgrade go, and this fixed the compilation issue. However, now I have a new error:

# github.com/CompeyDev/nemo/prisma/db
gccgo: fatal error: Killed signal terminated program go1
compilation terminated.


问:
How to run specific test suite in readyapi using ant tool from jenkins
We have a pipeline script in jenkins which is used to trigger build.xml of readyapi using ant as build tool. In this way its running all the test suites in sequence but now we want to run only particular test suite. Tried to used below code but its not working. can anyone please suggest some solutions?

Tried below

```<code>stage()
{
sh ''
 SoapUIPro ( pathToTestrunner: 'SmartBear/ReadyAPI-3.42.1.0/bin/testrunner.sh', pathToProjectFile: 'ReadyAPI-Projects/sample-soapui-test.xml', testSuite: '', testCase: '', testSuiteTags: '(tag1 || tag2) && !tag3', projectPassword: '', environment: '' )
}
</code>```

Body:
We have a pipeline script in jenkins which is used to trigger build.xml of readyapi using ant as build tool. In this way its running all the test suites in sequence but now we want to run only particular test suite. Tried to used below code but its not working. can anyone please suggest some solutions?

Tried below

stage()
{
sh ''
 SoapUIPro ( pathToTestrunner: 'SmartBear/ReadyAPI-3.42.1.0/bin/testrunner.sh', pathToProjectFile: 'ReadyAPI-Projects/sample-soapui-test.xml', testSuite: '', testCase: '', testSuiteTags: '(tag1 || tag2) && !tag3', projectPassword: '', environment: '' )
}


问:
Migrate H2 database 1.4.200 > 2.1.214 in my Spring Batch Application
For security purpose I have to migrate my H2 library from 1.4.200 to 2.1.214 in my Spring Batch application

In 1.4.200 version, all my Junit test are OK but with new version, start of the application failed :

```<code>Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "BATCH_JOB_INSTANCE" not found (this database is empty); SQL statement:
SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ? [42104-214]
</code>```

I have juste change H2 version in my pom.xml

Spring Batch application use Spring Boot 2.1.11.RELEASE dependencies.

Do you know why this tables aren't find ?

```<code> spring:
    application:
        name: myBatch
    cache:
        type: simple
    datasource:
        type: com.zaxxer.hikari.HikariDataSource
        url: jdbc:h2:mem:myBatch;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
        name:
        username:
        password:
        hikari:
            auto-commit: false
</code>```

Body:
For security purpose I have to migrate my H2 library from 1.4.200 to 2.1.214 in my Spring Batch application

In 1.4.200 version, all my Junit test are OK but with new version, start of the application failed :

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "BATCH_JOB_INSTANCE" not found (this database is empty); SQL statement:
SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ? [42104-214]

I have juste change H2 version in my pom.xml

Spring Batch application use Spring Boot 2.1.11.RELEASE dependencies.

Do you know why this tables aren't find ?

 spring:
    application:
        name: myBatch
    cache:
        type: simple
    datasource:
        type: com.zaxxer.hikari.HikariDataSource
        url: jdbc:h2:mem:myBatch;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
        name:
        username:
        password:
        hikari:
            auto-commit: false


问:
The presented password is invalid LDAP Symfony 6.*
i want to Authenticat against an LDAP server , i managed to connect with the ldap server and also i managed to bind with the ldap user provider but i face a problem when i want to login

SERVICE.YAML

```<code>Symfony\Component\Ldap\Ldap:
    arguments: ['@Symfony\Component\Ldap\Adapter\ExtLdap\Adapter']
    tags:
        - ldap
Symfony\Component\Ldap\Adapter\ExtLdap\Adapter:
    arguments:
        -   host: ldap.forumsys.com
            port: 389
            #encryption: tls
            options:
                protocol_version: 3
                referrals: false
</code>```

SECURITY.YAML

```<code>    providers:
        # used to reload user from session & other features (e.g. switch_user)
        my_ldap:
            ldap:
                service: Symfony\Component\Ldap\Ldap
                base_dn: DC=example,DC=com
                search_dn: "CN=read-only-admin,DC=example,DC=com"
                search_password: password
                default_roles: ROLE_USER
                uid_key: uid
        app_user_provider:
            id: App\Security\UserProvider
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            lazy: true
            provider: my_ldap
            custom_authenticator: App\Security\LdapAuthenticator
            form_login_ldap:
                login_path: app_login
                check_path: app_login
                service: Symfony\Component\Ldap\Ldap
                dn_string: 'uid={user_identifier},dc=example,dc=com'
            entry_point: form_login_ldap
            logout:
                path: app_logout
</code>```

Log file

```<code>[2022-12-08T15:01:57.363017+01:00] request.INFO: Matched route "app_login". {"route":"app_login","route_parameters":{"_route":"app_login","_controller":"App\\Controller\\LdapController::login"},"request_uri":"https://127.0.0.1:8000/login","method":"POST"} []
[2022-12-08T15:01:57.373679+01:00] security.DEBUG: Checking for authenticator support. {"firewall_name":"main","authenticators":2} []
[2022-12-08T15:01:57.373737+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:57.375104+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"Symfony\\Component\\Ldap\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:57.993780+01:00] security.INFO: Authenticator failed. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException(code: 0): The presented password is invalid 1. at C:\\xampp\\htdocs\\LdapFinal\\vendor\\symfony\\security-http\\EventListener\\CheckCredentialsListener.php:69)","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.002159+01:00] security.DEBUG: The "App\Security\LdapAuthenticator" authenticator set the failure response. {"authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.010708+01:00] security.DEBUG: The "App\Security\LdapAuthenticator" authenticator set the response. Any later authenticator will not be called {"authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.101859+01:00] request.INFO: Matched route "app_login". {"route":"app_login","route_parameters":{"_route":"app_login","_controller":"App\\Controller\\LdapController::login"},"request_uri":"https://127.0.0.1:8000/login","method":"GET"} []
[2022-12-08T15:01:58.108085+01:00] security.DEBUG: Checking for authenticator support. {"firewall_name":"main","authenticators":2} []
[2022-12-08T15:01:58.108178+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.108209+01:00] security.DEBUG: Authenticator does not support the request. {"firewall_name":"main","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.108232+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"Symfony\\Component\\Ldap\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.108260+01:00] security.DEBUG: Authenticator does not support the request. {"firewall_name":"main","authenticator":"Symfony\\Component\\Ldap\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.248350+01:00] request.INFO: Matched route "_wdt". {"route":"_wdt","route_parameters":{"_route":"_wdt","_controller":"web_profiler.controller.profiler::toolbarAction","token":"1fdb80"},"request_uri":"https://127.0.0.1:8000/_wdt/1fdb80","method":"GET"} []

</code>```

i want Authenticat against an LDAP server in my symfony 6 app
this is my project : https://drive.google.com/file/d/1dsxJdI7ESwfY21AMA3CgwV1bEroHmCON/view?usp=sharing
this is the ldap online server : https://www.forumsys.com/2022/05/10/online-ldap-test-server/

Body:
i want to Authenticat against an LDAP server , i managed to connect with the ldap server and also i managed to bind with the ldap user provider but i face a problem when i want to login

SERVICE.YAML

Symfony\Component\Ldap\Ldap:
    arguments: ['@Symfony\Component\Ldap\Adapter\ExtLdap\Adapter']
    tags:
        - ldap
Symfony\Component\Ldap\Adapter\ExtLdap\Adapter:
    arguments:
        -   host: ldap.forumsys.com
            port: 389
            #encryption: tls
            options:
                protocol_version: 3
                referrals: false

SECURITY.YAML

    providers:
        # used to reload user from session & other features (e.g. switch_user)
        my_ldap:
            ldap:
                service: Symfony\Component\Ldap\Ldap
                base_dn: DC=example,DC=com
                search_dn: "CN=read-only-admin,DC=example,DC=com"
                search_password: password
                default_roles: ROLE_USER
                uid_key: uid
        app_user_provider:
            id: App\Security\UserProvider
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            lazy: true
            provider: my_ldap
            custom_authenticator: App\Security\LdapAuthenticator
            form_login_ldap:
                login_path: app_login
                check_path: app_login
                service: Symfony\Component\Ldap\Ldap
                dn_string: 'uid={user_identifier},dc=example,dc=com'
            entry_point: form_login_ldap
            logout:
                path: app_logout

Log file

[2022-12-08T15:01:57.363017+01:00] request.INFO: Matched route "app_login". {"route":"app_login","route_parameters":{"_route":"app_login","_controller":"App\\Controller\\LdapController::login"},"request_uri":"https://127.0.0.1:8000/login","method":"POST"} []
[2022-12-08T15:01:57.373679+01:00] security.DEBUG: Checking for authenticator support. {"firewall_name":"main","authenticators":2} []
[2022-12-08T15:01:57.373737+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:57.375104+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"Symfony\\Component\\Ldap\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:57.993780+01:00] security.INFO: Authenticator failed. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException(code: 0): The presented password is invalid 1. at C:\\xampp\\htdocs\\LdapFinal\\vendor\\symfony\\security-http\\EventListener\\CheckCredentialsListener.php:69)","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.002159+01:00] security.DEBUG: The "App\Security\LdapAuthenticator" authenticator set the failure response. {"authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.010708+01:00] security.DEBUG: The "App\Security\LdapAuthenticator" authenticator set the response. Any later authenticator will not be called {"authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.101859+01:00] request.INFO: Matched route "app_login". {"route":"app_login","route_parameters":{"_route":"app_login","_controller":"App\\Controller\\LdapController::login"},"request_uri":"https://127.0.0.1:8000/login","method":"GET"} []
[2022-12-08T15:01:58.108085+01:00] security.DEBUG: Checking for authenticator support. {"firewall_name":"main","authenticators":2} []
[2022-12-08T15:01:58.108178+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.108209+01:00] security.DEBUG: Authenticator does not support the request. {"firewall_name":"main","authenticator":"App\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.108232+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"Symfony\\Component\\Ldap\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.108260+01:00] security.DEBUG: Authenticator does not support the request. {"firewall_name":"main","authenticator":"Symfony\\Component\\Ldap\\Security\\LdapAuthenticator"} []
[2022-12-08T15:01:58.248350+01:00] request.INFO: Matched route "_wdt". {"route":"_wdt","route_parameters":{"_route":"_wdt","_controller":"web_profiler.controller.profiler::toolbarAction","token":"1fdb80"},"request_uri":"https://127.0.0.1:8000/_wdt/1fdb80","method":"GET"} []

i want Authenticat against an LDAP server in my symfony 6 app
this is my project : https://drive.google.com/file/d/1dsxJdI7ESwfY21AMA3CgwV1bEroHmCON/view?usp=sharing
this is the ldap online server : https://www.forumsys.com/2022/05/10/online-ldap-test-server/


问:
Redirect the login page based on domain URL value on React JS
I have created the Simple React JS with Spring boot JWT authentication application. On my react js application default landing (Index) page was login.js. And I have another login page file named as signin.js.

I want to show the landing pages based on the domain url.

When the user using the domain test.***.com then I needs to show the login.js as landing screen.

if the users using the domain alpha.***.com then I needs to show signin.js as landing screen.

I m new for the reactjs routing.

So anyone kindly assist to achieve my requirement.

Right now I m using simple routes only, I have listed them as follows.

```<code><Routes>
      <Route exact path={"/"} element={<Login />} />
      <Route exact path={"/home"} element={<Home />} />
      <Route exact path="/login" element={<Login />} />
      <Route exact path="/login2" element={<Login_2 />} />
      <Route exact path="/signin" element={<SignIn />} />
      <Route exact path="/register" element={<Register />} />
      <Route exact path="/profile" element={<Profile />} />
      <Route path="/user" element={<BoardUser />} />
      <Route path="/mod" element={<BoardModerator />} />
      <Route path="/admin" element={<BoardAdmin />} />
    </Routes>
</code>```

Thanks in advance

Body:
I have created the Simple React JS with Spring boot JWT authentication application. On my react js application default landing (Index) page was login.js. And I have another login page file named as signin.js.

I want to show the landing pages based on the domain url.

When the user using the domain test.***.com then I needs to show the login.js as landing screen.

if the users using the domain alpha.***.com then I needs to show signin.js as landing screen.

I m new for the reactjs routing.

So anyone kindly assist to achieve my requirement.

Right now I m using simple routes only, I have listed them as follows.

<Routes>
      <Route exact path={"/"} element={<Login />} />
      <Route exact path={"/home"} element={<Home />} />
      <Route exact path="/login" element={<Login />} />
      <Route exact path="/login2" element={<Login_2 />} />
      <Route exact path="/signin" element={<SignIn />} />
      <Route exact path="/register" element={<Register />} />
      <Route exact path="/profile" element={<Profile />} />
      <Route path="/user" element={<BoardUser />} />
      <Route path="/mod" element={<BoardModerator />} />
      <Route path="/admin" element={<BoardAdmin />} />
    </Routes>

Thanks in advance


问:
Vue static file from public folder ends up in Webpack bundle?
In my VUE webproject I like to read a local JSON.
This JSON should not be included in the webpack bundle.

From the Vue Cli help files:

"Any static assets placed in the public folder will simply be copied and not go through webpack. You need to reference them using absolute paths."
https://cli.vuejs.org/guide/html-and-static-assets.html#the-public-folder

I created the Hello-World application from VUE CLI with VUE 3.
Now when I import a static json from the public folder it does get copied as-is to the destination folder, but it get's included in the webpack bundle as well.

```<code>import config from '/public/config.json'
</code>```

Any help is much appreciated!

Body:
In my VUE webproject I like to read a local JSON.
This JSON should not be included in the webpack bundle.

From the Vue Cli help files:

"Any static assets placed in the public folder will simply be copied and not go through webpack. You need to reference them using absolute paths."
https://cli.vuejs.org/guide/html-and-static-assets.html#the-public-folder

I created the Hello-World application from VUE CLI with VUE 3.
Now when I import a static json from the public folder it does get copied as-is to the destination folder, but it get's included in the webpack bundle as well.

import config from '/public/config.json'

Any help is much appreciated!


问:
Call a JavaScript function from an HTML element?
I'm wondering how to implement initialization via JavaScript similar to Ken Wheeler's Slick Carousel.  Using jQuery you can select an element like this: $('.carousel-element').slick();.

Is there any way do something similar using JavaScript?  For example if I have a variable that holds an element, can I use that to call a custom function?

const myElement = document.getElementById('example-1');

myElement.customFunction();```

Thank you in advance!  I was having a lot of trouble figuring out how to word this, so if anyone knows what this technique is called that will help as well.

Body:
I'm wondering how to implement initialization via JavaScript similar to Ken Wheeler's Slick Carousel.  Using jQuery you can select an element like this: $('.carousel-element').slick();.

Is there any way do something similar using JavaScript?  For example if I have a variable that holds an element, can I use that to call a custom function?

const myElement = document.getElementById('example-1');

myElement.customFunction();

Thank you in advance!  I was having a lot of trouble figuring out how to word this, so if anyone knows what this technique is called that will help as well.


问:
Parse in data to return a JSON response in SQL Server 2019 for GET requests?
I am trying to parse a string of an array of objects as an input in SQL Server and return a JSON response from a GET request on a Flask localhost server, however it seems the format of the input data isn't correct as I am receiving a 404 in the server response and an "Expecting value: ..." error on the SQL output query.

I have created a simple Flask endpoint which retrieves a JSON response.

```<code>@app_bp.route("/example", methods=["GET"])
def example() -> Tuple[flask.wrappers.Response, int]:
    try:
        data_out = request.get_data()
        print(data_out)
        data_out = json.loads(data_out)
        print(data_out)
    except Exception as e:
        return jsonify({"Error": f"{e}"}), 404
    else:
        return jsonify(data_out), 200
</code>```

I used the curl library to test out the request in a terminal and retrieved the correct response (200 status code).

```<code>curl -X GET -H "Content-type: application/json" -H "Accept: application/json" -d '[{"test": 101}]' "http://127.0.0.1:3080/api/v1/app/example"
</code>```

Returned:

```<code>[
  {
    "test": 101
  }
]
</code>```

And printed:

```<code>    b'[{"test": 101}]'
    [{"test": 101}]
</code>```

However, doing the same in SQL threw an error and a 404 and doesn`t return anything:

```<code>DECLARE @json_input AS VARCHAR(MAX) = '[{"test": 101}]';

DECLARE @xmlRequestObject INT = 0
DECLARE @urlGet VARCHAR(8000) = 'http://127.0.0.1:3080/api/v1/app/example'
DECLARE @return INT = 0
DECLARE @contentType VARCHAR(8000) = 'application/json'

DROP TABLE IF EXISTS #json_output
CREATE TABLE #json_output ([output] NVARCHAR(MAX))

    --Create the XML request object
EXEC @return = sp_OACreate 'MSXML2.XMLHTTP', @xmlRequestObject OUT;
IF @return <> 0
BEGIN
    RAISERROR('Unable to open HTTP connection.', 10, 1);
    RETURN;
END

--Open the connection
EXEC @return = sp_OAMethod @xmlRequestObject, 'OPEN', NULL, 'GET', @urlGet, 'false';

--Set the request headers
EXEC @return = sp_OAMethod @xmlRequestObject, 'setRequestHeader', NULL, 'Content-Type','application/json; charset=utf-8'
EXEC @return = sp_OAMethod @xmlRequestObject, 'setRequestHeader', NULL, 'Accept','application/json'

--Send the request
EXEC @return = sp_OAMethod @xmlRequestObject, 'SEND', NULL, @json_input

--Handle the repsonse
INSERT INTO #json_output ([output]) EXEC sp_OAGetProperty @xmlRequestObject, 'responseText'
SELECT * FROM #json_output
EXEC sp_OADestroy @xmlRequestObject
SELECT * FROM #json_output

</code>```

Returns:

```<code>b''
"GET /api/v1/app/example HTTP/1.1" 404 -

</code>```

SQL output:

```<code>{   "Error": "Expecting value: line 1 column 1 (char 0)" }
</code>```

I tried different formats of what the input may need to be by going through the documentation however, I am still getting the same error.:
https://learn.microsoft.com/en-us/sql/relational-databases/json/json-data-sql-server?view=sql-server-ver16

Is there a specific format or any missing steps that are required to retrieve a JSON output in the SQL query output?

Body:
I am trying to parse a string of an array of objects as an input in SQL Server and return a JSON response from a GET request on a Flask localhost server, however it seems the format of the input data isn't correct as I am receiving a 404 in the server response and an "Expecting value: ..." error on the SQL output query.

I have created a simple Flask endpoint which retrieves a JSON response.

@app_bp.route("/example", methods=["GET"])
def example() -> Tuple[flask.wrappers.Response, int]:
    try:
        data_out = request.get_data()
        print(data_out)
        data_out = json.loads(data_out)
        print(data_out)
    except Exception as e:
        return jsonify({"Error": f"{e}"}), 404
    else:
        return jsonify(data_out), 200

I used the curl library to test out the request in a terminal and retrieved the correct response (200 status code).

curl -X GET -H "Content-type: application/json" -H "Accept: application/json" -d '[{"test": 101}]' "http://127.0.0.1:3080/api/v1/app/example"

Returned:

[
  {
    "test": 101
  }
]

And printed:

    b'[{"test": 101}]'
    [{"test": 101}]

However, doing the same in SQL threw an error and a 404 and doesn`t return anything:

DECLARE @json_input AS VARCHAR(MAX) = '[{"test": 101}]';

DECLARE @xmlRequestObject INT = 0
DECLARE @urlGet VARCHAR(8000) = 'http://127.0.0.1:3080/api/v1/app/example'
DECLARE @return INT = 0
DECLARE @contentType VARCHAR(8000) = 'application/json'

DROP TABLE IF EXISTS #json_output
CREATE TABLE #json_output ([output] NVARCHAR(MAX))

    --Create the XML request object
EXEC @return = sp_OACreate 'MSXML2.XMLHTTP', @xmlRequestObject OUT;
IF @return <> 0
BEGIN
    RAISERROR('Unable to open HTTP connection.', 10, 1);
    RETURN;
END

--Open the connection
EXEC @return = sp_OAMethod @xmlRequestObject, 'OPEN', NULL, 'GET', @urlGet, 'false';

--Set the request headers
EXEC @return = sp_OAMethod @xmlRequestObject, 'setRequestHeader', NULL, 'Content-Type','application/json; charset=utf-8'
EXEC @return = sp_OAMethod @xmlRequestObject, 'setRequestHeader', NULL, 'Accept','application/json'

--Send the request
EXEC @return = sp_OAMethod @xmlRequestObject, 'SEND', NULL, @json_input

--Handle the repsonse
INSERT INTO #json_output ([output]) EXEC sp_OAGetProperty @xmlRequestObject, 'responseText'
SELECT * FROM #json_output
EXEC sp_OADestroy @xmlRequestObject
SELECT * FROM #json_output

Returns:

b''
"GET /api/v1/app/example HTTP/1.1" 404 -

SQL output:

{   "Error": "Expecting value: line 1 column 1 (char 0)" }

I tried different formats of what the input may need to be by going through the documentation however, I am still getting the same error.:
https://learn.microsoft.com/en-us/sql/relational-databases/json/json-data-sql-server?view=sql-server-ver16

Is there a specific format or any missing steps that are required to retrieve a JSON output in the SQL query output?