问:
React/node build error. Could not find a declaration file for module 'history'. 'node_modules/history/index.js' implicitly has an 'any' type
My project is suddenly having a build error. My current repo still has no problem, it only happens when I clone the repo to a new folder and install the package again then do npm run build.
So I am so scared to update the package right now...

I checked the merge history, I don't think any code merge should cause this issue..

Here is the error message I got:

```<code>$ npm run build

> container-client@2.32.0 build I:\ds\projects\new\container-service\client
> craco build

Creating an optimized production build...
Failed to compile.

I:/ds/projects/new/container-service/client/src/views/add-application/AddApplicationPage.tsx
TypeScript error in I:/ds/projects/new/container-service/client/src/views/add-application/AddApplicationPage.tsx(4,25):
Could not find a declaration file for module 'history'. 'I:/ds/projects/new/container-service/client/node_modules/history/index.js' implicitly has an 'any' type.
  If the 'history' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history`  TS7016

    2 | import './_index.scss';
    3 | import store from '../../store';
  > 4 | import { History } from 'history';
      |                         ^

</code>```

This is the package.json:

```<code>  {
  "private": false,
  "dependencies": {
    "axios": "^0.19.2",
    "bootstrap": "^4.6.0",
    "history": "^4.10.1",
    "identity-obj-proxy": "^3.0.0",
    "react": "~17.0.1",
    "react-app-polyfill": "~2.0.0",
    "react-dom": "~17.0.1",
    "react-router-dom": "~5.2.0"
  },

Looks like the library "history" is causing the problem.

</code>```

I tried:

delete the node_module --> npm install --> npm run build --> same error

clone the project again --> npm install --> npm run build --> same error

clone the older version of the project --> npm install --> npm run build --> same error

Nothing seems to work.

答:
the problem seems to be from the history package that you are using

Could not find a declaration file for module 'history'.

try installing types for the package

 npm i @types/history

if that didn't work, then change the import to require

   const history = require("history")

update

the @types/history is deprecated and since version 5 of history, the type declarations are provided inside the package itself.
updating the package should fix the issue:

```<code>npm install history@latest
</code>```

Body:
My project is suddenly having a build error. My current repo still has no problem, it only happens when I clone the repo to a new folder and install the package again then do npm run build.
So I am so scared to update the package right now...

I checked the merge history, I don't think any code merge should cause this issue..

Here is the error message I got:

$ npm run build

> container-client@2.32.0 build I:\ds\projects\new\container-service\client
> craco build

Creating an optimized production build...
Failed to compile.

I:/ds/projects/new/container-service/client/src/views/add-application/AddApplicationPage.tsx
TypeScript error in I:/ds/projects/new/container-service/client/src/views/add-application/AddApplicationPage.tsx(4,25):
Could not find a declaration file for module 'history'. 'I:/ds/projects/new/container-service/client/node_modules/history/index.js' implicitly has an 'any' type.
  If the 'history' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history`  TS7016

    2 | import './_index.scss';
    3 | import store from '../../store';
  > 4 | import { History } from 'history';
      |                         ^

This is the package.json:

  {
  "private": false,
  "dependencies": {
    "axios": "^0.19.2",
    "bootstrap": "^4.6.0",
    "history": "^4.10.1",
    "identity-obj-proxy": "^3.0.0",
    "react": "~17.0.1",
    "react-app-polyfill": "~2.0.0",
    "react-dom": "~17.0.1",
    "react-router-dom": "~5.2.0"
  },

Looks like the library "history" is causing the problem.

I tried:

delete the node_module --> npm install --> npm run build --> same error

clone the project again --> npm install --> npm run build --> same error

clone the older version of the project --> npm install --> npm run build --> same error

Nothing seems to work.

Body:
the problem seems to be from the history package that you are using

Could not find a declaration file for module 'history'.

try installing types for the package

 npm i @types/history

if that didn't work, then change the import to require

   const history = require("history")

update

the @types/history is deprecated and since version 5 of history, the type declarations are provided inside the package itself.
updating the package should fix the issue:

npm install history@latest


来源: stackexchange

问:
What is alternative function in sql REGEXP_COUNT in SQL Server
Below is the variable in Oracle I need to convert in SQL Server please suggest.</p>
```<code>V_BAD_EMAIL_CNT NUMBER :=  REGEXP_COUNT(pv_bad_emails,',') + 1;
</code>```

答:
This will return the number of comma's in the string + 1 in SQL

```<code> declare @pv_bad_emails varchar(1000);
 set @pv_bad_emails = 'a,b,c,d';
 select len(@pv_bad_emails) - len(replace(@pv_bad_emails, ',', '')) + 1
</code>```

For more reference

How do you count the number of occurrences of a certain substring in a SQL varchar?

ContentLicense: CC BY-SA 4.0

Body:
Below is the variable in Oracle I need to convert in SQL Server please suggest.

V_BAD_EMAIL_CNT NUMBER :=  REGEXP_COUNT(pv_bad_emails,',') + 1;

Body:
This will return the number of comma's in the string + 1 in SQL

 declare @pv_bad_emails varchar(1000);
 set @pv_bad_emails = 'a,b,c,d';
 select len(@pv_bad_emails) - len(replace(@pv_bad_emails, ',', '')) + 1

For more reference

How do you count the number of occurrences of a certain substring in a SQL varchar?


答:
Great question.

```<code>df_resampled = df.resample('W-MON', label='left', closed='left').sum()
</code>```

The parameter closed could work for your question.

ContentLicense: CC BY-SA 3.0

Title: Python Pandas DataFrame resample daily data to week by Mon-Sun weekly definition?

Body:
import pandas as pd
import numpy as np

dates = pd.date_range('20141229',periods=14, name='Day')
df = pd.DataFrame({'Sum1': [1667, 1229, 1360, 9232, 8866, 4083, 3671, 10085, 10005, 8730, 10056, 10176, 3792, 3518],
                   'Sum2': [91, 75, 75, 254, 239, 108, 99, 259, 395, 355, 332, 386, 96, 111],
                   'Sum3': [365.95, 398.97, 285.12, 992.17, 1116.57, 512.11, 504.47, 1190.96, 1753.6, 1646.25, 1344.05, 1582.67, 560.95, 736.44],
                   'Sum4': [5, 5, 1, 5, 8, 8, 2, 10, 12, 16, 16, 6, 6, 3]},index=dates); print(df)

The df produced looks like this:

             Sum1  Sum2     Sum3  Sum4
Day
2014-12-29   1667    91   365.95     5
2014-12-30   1229    75   398.97     5
2014-12-31   1360    75   285.12     1
2015-01-01   9232   254   992.17     5
2015-01-02   8866   239  1116.57     8
2015-01-03   4083   108   512.11     8
2015-01-04   3671    99   504.47     2
2015-01-05  10085   259  1190.96    10
2015-01-06  10005   395  1753.60    12
2015-01-07   8730   355  1646.25    16
2015-01-08  10056   332  1344.05    16
2015-01-09  10176   386  1582.67     6
2015-01-10   3792    96   560.95     6
2015-01-11   3518   111   736.44     3

Let's say I resample the Dataframe to try and sum the daily data into weekly rows:

df_resampled = df.resample('W', how='sum', label='left'); print(df_resampled)

This produces the following:

             Sum1  Sum2     Sum3  Sum4
Day
2014-12-28  30108   941  4175.36    34
2015-01-04  56362  1934  8814.92    69

Question 1: my definition of a week is Mon - Sun.  Since my data starts on 2014-12-29 (a Monday), I want my Day label to also start on that day.  How would I make the Day index label be the date of every Monday instead of every Sunday?

Desired Output:

             Sum1  Sum2     Sum3  Sum4
Day
2014-12-29  30108   941  4175.36    34
2015-01-05  56362  1934  8814.92    69

What have I tried regarding Question 1?

I changed 'W' to 'W-MON' but it produced 3 rows by counting 2014-12-29 in 2014-12-22 row which is not what I want:

             Sum1  Sum2     Sum3  Sum4
Day
2014-12-22   1667    91   365.95     5
2014-12-29  38526  1109  5000.37    39
2015-01-05  46277  1675  7623.96    59

Question 2: how would I format the Day index label to look like a range? Ex:

                         Sum1  Sum2     Sum3  Sum4
Day
2014-12-29 - 2015-01-04  30108   941  4175.36    34
2015-01-05 - 2015-01-11  56362  1934  8814.92    69

Body:
Great question.

df_resampled = df.resample('W-MON', label='left', closed='left').sum()

The parameter closed could work for your question.


问:
Flutter textTheme property is not working, How to replace or fix it?
I am new to flutter. I just created a theme file to define light and dark theme.When I defined light theme, the textTheme:  property which is deprecated is not changing the text title  color of app bar into black.

If I have to create or define textTheme or replace it ?? How should I do it ?

class MyTheme {
  static ThemeData lightTheme(BuildContext context) => ThemeData(
      primarySwatch: Colors.deepPurple,
      fontFamily: GoogleFonts.lato().fontFamily,
      appBarTheme: AppBarTheme(
        color: Colors.white,
        elevation: 0.0,
        iconTheme: IconThemeData(color: Colors.black),

//------
        textTheme: Theme.of(context).textTheme, // Problem is here
//------
      ));

  static ThemeData darkTheme(BuildContext context) =>
      ThemeData(brightness: Brightness.dark);
}

```

答:
Change it to this

```<code>textTheme: Theme.of(context).appBarTheme.textTheme,
</code>```

PS: It's deprecated. try to migrate.

Body:
Change it to this

textTheme: Theme.of(context).appBarTheme.textTheme,

PS: It's deprecated. try to migrate.


问:
Shouldn't we use  element?
I found some good cons here:

The noscript element only detects whether the browser has JavaScript enabled or not. If JavaScript is disabled in the Firewall rather than in the browser then the JavaScript will not run and the content of the noscript element will not be displayed.

Many scripts are dependent on a specific feature or features of the language being supported in order for them to be able to run (for example document.getElementById). Where the required features are not supported the JavaScript is unable to run but since JavaScript itself is supported the noscript content will not be displayed.

The most useful place to use the noscript element is in the head of the page where it would be able to selectively determine what stylesheet and meta elements get applied to the page as the page is loading rather than having to wait until the page is loaded. Unfortunately the noscript element is only valid within the body of the page and so cannot be used in the head.

The noscript element is a block level element and therefore can only be used to display entire blocks of content when JavaScript is disabled. It cannot be used inline.

Ideally, web pages should use HTML for the content, CSS for the appearance, and JavaScript for the behavior. Using the noscript element is applying a behavior from within the HTML rather than applying it from JavaScript.

Source: http://javascript.about.com/od/reference/a/noscriptnomore.htm

I very much agree on last point. Is there a way to make and add an external  file? Should we place  in the ?

答:
Although Tor Valamo has an elegant answer to this problem, there is an issue which may cause you to opt out of using this technique.

The problem is (usually) IE. It has the tendency to load and execute the JS a bit slower than other browsers causing it to sometimes flash the "Please Enable Your Javascript" div for a split second before it then loads the JS and hides the div.

It is annoying and to get around this you can implement the "classic".  redirect approach.

```<code><head>
<noscript><meta http-equiv="refresh" content="0; URL=/NO_SCRIPT_URL/ROUTE_HERE"/></noscript>
</head>
</code>```

This is the most solid technique that I've come across with regards to this little nasty.

Title: Shouldn't we use <noscript> element?

Body:
Although Tor Valamo has an elegant answer to this problem, there is an issue which may cause you to opt out of using this technique.

The problem is (usually) IE. It has the tendency to load and execute the JS a bit slower than other browsers causing it to sometimes flash the "Please Enable Your Javascript" div for a split second before it then loads the JS and hides the div.

It is annoying and to get around this you can implement the "classic". <noscript> redirect approach.

<head>
<noscript><meta http-equiv="refresh" content="0; URL=/NO_SCRIPT_URL/ROUTE_HERE"/></noscript>
</head>

This is the most solid technique that I've come across with regards to this little nasty.


问:
How to use delay in source file omnet++
following is the .ned file

```<code>    simple computer
{
    parameters:

    gates:
        input in1;
        output out1;
        input in2;
        output out2;

}

//
// TODO documentation
//
network Network
{
    @display("bgb=538,302");
    submodules:
        A: computer {
            @display("p=30,88");
        }
        B: computer {
            @display("p=344,96");
        }
        C: computer {
            @display("p=209,199");
        }
    connections:

        A.out1 -->{  delay = 100ms; } --> B.in1;
        B.out1 -->{  delay = 100ms; } --> A.in1;

        A.out2 -->{  delay = 200ms; } --> C.in1;
        C.out1 -->{  delay = 200ms; } --> A.in2;

        C.out2 -->{  delay = 300ms; } --> B.in2;
        B.out2 -->{  delay = 300ms; } --> C.in2;
}

/*
</code>```

* computer.cc
 *
 *  Created on: Sep 29, 2015
 *      Author: Ibrahim
 */

```<code>#include <string.h>
#include <omnetpp.h>
#include <string>

double delay1;

class computer: public cSimpleModule
{
  public:

    virtual void initialize();
    virtual void handleMessage(cMessage *msg);

};
//----------------------------------------------------------------------

Define_Module(computer);

void computer::initialize()
{

cDelayChannel * channel = check_and_cast<cDelayChannel*>(gate("out1")->getChannel());
    delay1 = channel->getDelay().dbl();

    cMessage *msg = new cMessage("tictocMsg");
         cMessage *ww ; ww=msg;

         send(msg, "out1");
         cMessage *copy = (cMessage *) msg->dup();send(copy, "out2");
</code>```

//I pasted them here as well

```<code>}

void computer::handleMessage(cMessage *msg)
{

}
</code>```

my question is that how can I use the delay
computer0.out -->{  delay = 100ms; } --> computer1.in;
in .cc file. Here in source file I have two variables delay1 and delay2. I want to move the delay values (100) in delay1 and delay2 variable. how to do this?

答:
Hi,
in the net file if you make the connection between nodes in two directions for example node 0 and node 1 :

```<code>node[0].gate++ <--> {  delay = 100ms; } <--> node[1].gate++;
</code>```

then  you can try  this code in the cc file :

```<code>  double NodeDelay;

  int n = gateSize("gate");

      for (int i =0;i<n;i++)
     {

     channel = check_and_cast<cDelayChannel*>(gate("gate$o",i)->getChannel());

    NodeDelay = channel->getDelay().dbl();

   EV << "hbi delay = " << NodeDelay << endl;

 }
</code>```

**hope it works   **

Title: How to use delay in source file omnet++

Body:
following is the .ned file

    simple computer
{
    parameters:

    gates:
        input in1;
        output out1;
        input in2;
        output out2;

}

//
// TODO documentation
//
network Network
{
    @display("bgb=538,302");
    submodules:
        A: computer {
            @display("p=30,88");
        }
        B: computer {
            @display("p=344,96");
        }
        C: computer {
            @display("p=209,199");
        }
    connections:

        A.out1 -->{  delay = 100ms; } --> B.in1;
        B.out1 -->{  delay = 100ms; } --> A.in1;

        A.out2 -->{  delay = 200ms; } --> C.in1;
        C.out1 -->{  delay = 200ms; } --> A.in2;

        C.out2 -->{  delay = 300ms; } --> B.in2;
        B.out2 -->{  delay = 300ms; } --> C.in2;
}

/*

* computer.cc
 *
 *  Created on: Sep 29, 2015
 *      Author: Ibrahim
 */

#include <string.h>
#include <omnetpp.h>
#include <string>

double delay1;

class computer: public cSimpleModule
{
  public:

    virtual void initialize();
    virtual void handleMessage(cMessage *msg);

};
//----------------------------------------------------------------------

Define_Module(computer);

void computer::initialize()
{

cDelayChannel * channel = check_and_cast<cDelayChannel*>(gate("out1")->getChannel());
    delay1 = channel->getDelay().dbl();

    cMessage *msg = new cMessage("tictocMsg");
         cMessage *ww ; ww=msg;

         send(msg, "out1");
         cMessage *copy = (cMessage *) msg->dup();send(copy, "out2");

//I pasted them here as well

}

void computer::handleMessage(cMessage *msg)
{

}

my question is that how can I use the delay
computer0.out -->{  delay = 100ms; } --> computer1.in;
in .cc file. Here in source file I have two variables delay1 and delay2. I want to move the delay values (100) in delay1 and delay2 variable. how to do this?

Body:
Hi,
in the net file if you make the connection between nodes in two directions for example node 0 and node 1 :

node[0].gate++ <--> {  delay = 100ms; } <--> node[1].gate++;

then  you can try  this code in the cc file :

  double NodeDelay;

  int n = gateSize("gate");

      for (int i =0;i<n;i++)
     {

     channel = check_and_cast<cDelayChannel*>(gate("gate$o",i)->getChannel());

    NodeDelay = channel->getDelay().dbl();

   EV << "hbi delay = " << NodeDelay << endl;

 }

**hope it works   **


问:
Is There A Technical Reason SystemVerilog Cannot Pass Module Name as Parameter?
I want to do something like this:

```<code>module BusinessLogicVersion_1(clk, rst, d, q);
// Erudite business logic goes here
endmodule

module BusinessLogicVersion_2(clk, rst, d, q);
// Different implementation of same interface.
endmodule

// Then, when instantiating the module that requires an implementation of whatever interface,
// I want to do something like this:
ModuleXyz #(
    .business_logic(BusinessLogicVersion_2) // <--- Pass an implementation of an interface as parameter
) (.clk(clk), .rst(rst), ...);
</code>```

I have tried to find ways to do this, and from what I've read SV does not allow it.

My question is:

Is there a technical reason why this shouldn't be possible?

答:
Technically, nothing is technically impossible in software given enough time, space and money! StackOverflow is not the forum for why kinds of questions.

SystemVerilog has a different approaches that implements what you are looking for. One way is  called a configuration (See section 33. Configuring the contents of a design in the IEEE 1800-2017 SystemVerilog LRM).

For your case, what you would do is compile different versions of same module name ModuleXyz into different libraries and then use either command line options or a config block that selects which version to be selected for different instances. I would look at the LRM for examples.

The other method is using a _generate construct to select different modules you want instantiated. See section 27. Generate constructs. This is simpler, but less flexible since you have to know upfront which versions are available.

```<code>case(VERSION):
1: BusinessLogicVersion_1 inst (clk, rst, d, q);
2: BusinessLogicVersion_2 inst (clk, rst, d, q);
default: $error("Version does not exist");
endcase
</code>```

Body:
I want to do something like this:

module BusinessLogicVersion_1(clk, rst, d, q);
// Erudite business logic goes here
endmodule

module BusinessLogicVersion_2(clk, rst, d, q);
// Different implementation of same interface.
endmodule

// Then, when instantiating the module that requires an implementation of whatever interface,
// I want to do something like this:
ModuleXyz #(
    .business_logic(BusinessLogicVersion_2) // <--- Pass an implementation of an interface as parameter
) (.clk(clk), .rst(rst), ...);

I have tried to find ways to do this, and from what I've read SV does not allow it.

My question is:

Is there a technical reason why this shouldn't be possible?

Body:
Technically, nothing is technically impossible in software given enough time, space and money! StackOverflow is not the forum for why kinds of questions.

SystemVerilog has a different approaches that implements what you are looking for. One way is  called a configuration (See section 33. Configuring the contents of a design in the IEEE 1800-2017 SystemVerilog LRM).

For your case, what you would do is compile different versions of same module name ModuleXyz into different libraries and then use either command line options or a config block that selects which version to be selected for different instances. I would look at the LRM for examples.

The other method is using a _generate construct to select different modules you want instantiated. See section 27. Generate constructs. This is simpler, but less flexible since you have to know upfront which versions are available.

case(VERSION):
1: BusinessLogicVersion_1 inst (clk, rst, d, q);
2: BusinessLogicVersion_2 inst (clk, rst, d, q);
default: $error("Version does not exist");
endcase


问:
Blazor execute code after Login with Microsoft Identity Platform
I´ve created a Blazor Server App with the Microsoft Identity Platform with this tutorial: Blazor Server App Authentication with Azure AD

My application should be a small tool of the company, which is used purely internally.
Users will be able to create and manage events.
Since it is really only used by a handful of people, I planned to store the name or email addresses of the users in the database to display the correct events of the logged in person based on the user id of the database.
To not have to deal with Azure AD any further.

To make this possible, every time someone logs in, I have to query if this email address is already in the database and if not, create a new entry.

My question is where is the best place to do this query.

My first idea was to do this in LoginDisplay.razor

```<code><AuthorizeView>
    <Authorized>
        <a href="MicrosoftIdentity/Account/SignOut">Log out</a>
        Hello, @context.User.Identity?.Name!
    </Authorized>
    <NotAuthorized>
        <a href="MicrosoftIdentity/Account/SignIn">Log in</a>
    </NotAuthorized>
</AuthorizeView>
</code>```

Here I just could add a method that executes, when someone is logged in.
context.User.Identity?.Name gives me the email address that I need.
But if I put this inside of an OnInitializedAsync(), every time I load a page, the check would happen.

With this code on this page: ASP.NET Core Blazor authentication and authorization, I can get the email address everywhere else.

Where would be the best place to query the user?

答:
I think that you can do it in _Host.cshtml.cs:

```<code>using Microsoft.AspNetCore.Mvc.RazorPages;

public void Onget(){
 var email= Request.HttpContext.User.Identity.Name;
 //Your query to the database
}
</code>```

Body:
I´ve created a Blazor Server App with the Microsoft Identity Platform with this tutorial: Blazor Server App Authentication with Azure AD

My application should be a small tool of the company, which is used purely internally.
Users will be able to create and manage events.
Since it is really only used by a handful of people, I planned to store the name or email addresses of the users in the database to display the correct events of the logged in person based on the user id of the database.
To not have to deal with Azure AD any further.

To make this possible, every time someone logs in, I have to query if this email address is already in the database and if not, create a new entry.

My question is where is the best place to do this query.

My first idea was to do this in LoginDisplay.razor

<AuthorizeView>
    <Authorized>
        Log out
        Hello, @context.User.Identity?.Name!
    </Authorized>
    <NotAuthorized>
        Log in
    </NotAuthorized>
</AuthorizeView>

Here I just could add a method that executes, when someone is logged in.
context.User.Identity?.Name gives me the email address that I need.
But if I put this inside of an OnInitializedAsync(), every time I load a page, the check would happen.

With this code on this page: ASP.NET Core Blazor authentication and authorization, I can get the email address everywhere else.

Where would be the best place to query the user?

Body:
I think that you can do it in _Host.cshtml.cs:

using Microsoft.AspNetCore.Mvc.RazorPages;

public void Onget(){
 var email= Request.HttpContext.User.Identity.Name;
 //Your query to the database
}


问:
How to properly mix sequential steps within parallel execution in an Airflow DAG?
I have an Airflow DAG I am writing where step_1 and step_2 run sequentially, and then in parallel kicked off three additional steps: X, Y, Z. Once those three steps completed, they run a final step, step_3. My DAG was written as:

step_1 >> step_2 >> [X, Y, Z] >> step_3

This worked just fine. However, I realized that X actually has two dependencies, we'll call them A and B, that need to run first. What I wanted to do was have those three - A, B, and X - run sequentially within one parallel lane, alongside Y and Z.

I wrote the DAG wiring as:

step_1 >> step_2 >> [A >> B >> X, Y, Z] >> step_3

This does not seem to have the expected results. I wanted A to be kicked off after step_2 ran, but it appears step_2 is still wired directly to X, with A and B just kind of... unlinked to either step_1 or step_2.

Does anyone know of a way to do this?

I know that I could pull A and B out of parallelism:

step_1 >> step_2 >> A >> B >> [X, Y, Z] >> step_3

But if possible I'd like to figure out a better approach. I have also read about subDAGs, but those seem overwrought for the simple tasks these steps are running.

答:
You can also use pools to have operators work in a sequential or parallel way, sequential pool having only 1 slot available.

```<code>airflow pools set "sequential" 1 "pool for non-parallelizable operations"
airflow pools set "parallel" 4 "pool for parallelizable operations"
</code>```

Then assign sequential or parallel pool to each operator accordingly.

Body:
You can also use pools to have operators work in a sequential or parallel way, sequential pool having only 1 slot available.

airflow pools set "sequential" 1 "pool for non-parallelizable operations"
airflow pools set "parallel" 4 "pool for parallelizable operations"

Then assign sequential or parallel pool to each operator accordingly.


问:
Remove whole parent div if contained child div is empty
I'm trying to achieve the following:

I have multiple divs with the class "et_pb_row_inner" that contain two columns each. Each of the columns contain a text container with the class "et_pb_text".

Here's the basic html:

```<code><div class="et_pb_row_inner">
   <div class="et_pb_column"><div class="et_pb_text"></div></div>
   <div class="et_pb_column"><div class="et_pb_text"></div></div>
</div>

<div class="et_pb_row_inner">
   <div class="et_pb_column"><div class="et_pb_text"></div></div>
   <div class="et_pb_column"><div class="et_pb_text"></div></div>
</div>

<div class="et_pb_row_inner">
   <div class="et_pb_column"><div class="et_pb_text"></div></div>
   <div class="et_pb_column"><div class="et_pb_text"></div></div>
</div>

</code>```

I need a way to check if the text in the second column of each row is empty and if so remove the whole row. Like so:

```<code><div class="et_pb_row_inner">
   <div class="et_pb_column"><div class="et_pb_text">HAS TEXT</div></div>
   <div class="et_pb_column"><div class="et_pb_text">HAS TEXT</div></div>
</div>

<div class="et_pb_row_inner"> <!-- second column text empty, remove whole row -->
   <div class="et_pb_column"><div class="et_pb_text">HAS TEXT</div></div>
   <div class="et_pb_column"><div class="et_pb_text">EMPTY</div></div>
</div>

<div class=".et_pb_row_inner"> <!-- second column text empty, remove whole row -->
   <div class="et_pb_column"><div class="et_pb_text">HAS TEXT</div></div>
   <div class="et_pb_column"><div class="et_pb_text">EMPTY</div></div>
</div>

</code>```

I found a code snippet and tried the following:

```<code>$(function() {
    $('.et_pb_row_inner').each(function() {
        if ($('.et_pb_text', this).text() == "" ) {
            $('.et_pb_row_inner').hide();
        }
    });
});
</code>```

It kind of works, but it removes ALL divs with the class "et_pb_row_inner", not just the ones that contain the empty text div.

I guess it's just tweaking the code a little, but I can't get it working.

Any ideas?

答:
try this:

```<code>    $('.et_pb_row_inner').each(function() => {
        if ($('.et_pb_text', this).text() == "") {
            $(this).hide();
        }
    });
</code>```

this should point to the .et_pb_row_inner currently in iteration

Body:
I'm trying to achieve the following:

I have multiple divs with the class "et_pb_row_inner" that contain two columns each. Each of the columns contain a text container with the class "et_pb_text".

Here's the basic html:

I need a way to check if the text in the second column of each row is empty and if so remove the whole row. Like so:

HAS TEXT

HAS TEXT

HAS TEXT

EMPTY

HAS TEXT

EMPTY

I found a code snippet and tried the following:

$(function() {
    $('.et_pb_row_inner').each(function() {
        if ($('.et_pb_text', this).text() == "" ) {
            $('.et_pb_row_inner').hide();
        }
    });
});

It kind of works, but it removes ALL divs with the class "et_pb_row_inner", not just the ones that contain the empty text div.

I guess it's just tweaking the code a little, but I can't get it working.

Any ideas?

Body:
try this:

    $('.et_pb_row_inner').each(function() => {
        if ($('.et_pb_text', this).text() == "") {
            $(this).hide();
        }
    });

this should point to the .et_pb_row_inner currently in iteration


问:
Apache Log4j 2.17 version: ERROR StatusLogger Reconfiguration failed: No configuration found for '277050dc' at 'null' in 'null'
I use Apache Log4j in my java project, in gradle:

```<code>api "org.apache.logging.log4j:log4j-api:2.17.0"
api "org.apache.logging.log4j:log4j-core:2.17.0"
</code>```

I updated Log4j version from 2.8 to 2.17 (https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api)

and in a server log I see an error:

```<code>ERROR StatusLogger Reconfiguration failed: No configuration found for '277050dc' at 'null' in 'null'
</code>```

I found a similar error https://issues.apache.org/jira/browse/LOG4J2-2901
in 2.13 version of Log4j, but any answers didn't help me to solve this problem.

Maybe somebody know-how can fix it problem?

In version 2.8 I didn't have any errors.. I think the problem in the new version 2.17, but I didn't found any think about this problem in 2.17 version of Apache Log4j

答: Hope you found a fix for your problem. There are other, older answers posted on SO for the exact same error message. The issue has to do with the key used to set log4j configuration file. It has been updated from log4j.configuration to log4j2.configurationFile.</p>

Body:
I use Apache Log4j in my java project, in gradle:

api "org.apache.logging.log4j:log4j-api:2.17.0"
api "org.apache.logging.log4j:log4j-core:2.17.0"

I updated Log4j version from 2.8 to 2.17 (https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api)

and in a server log I see an error:

ERROR StatusLogger Reconfiguration failed: No configuration found for '277050dc' at 'null' in 'null'

I found a similar error https://issues.apache.org/jira/browse/LOG4J2-2901
in 2.13 version of Log4j, but any answers didn't help me to solve this problem.

Maybe somebody know-how can fix it problem?

In version 2.8 I didn't have any errors.. I think the problem in the new version 2.17, but I didn't found any think about this problem in 2.17 version of Apache Log4j


问:
Query-string encoding of a JavaScript object
Is there a fast and simple way to encode a JavaScript object into a string that I can pass via a GET request?

No jQuery, no other frameworks—just plain JavaScript :)

答:
Use:

const toQueryString = obj => "?".concat(Object.keys(obj).map(e => `${encodeURIComponent(e)}=${encodeURIComponent(obj[e])}`).join("&"));

const data = {
  offset: 5,
  limit: 10
};

toQueryString(data); // => ?offset=5&limit=10
```
<h3>Or use a predefined feature</h3>
<pre class="lang-js prettyprint-override"><code>const data = {
  offset: 5,
  limit: 10
};

new URLSearchParams(data).toString(); // => ?offset=5&limit=10
</code>```

Note

Both the above methods will set the value as null if not present.
If you want not to set the query parameter if value is null then use:

const toQueryString = obj => "?".concat(Object.keys(obj).map(e => obj[e] ? `${encodeURIComponent(e)}=${encodeURIComponent(obj[e])}` : null).filter(e => !!e).join("&"));

const data = {
  offset: null,
  limit: 10
};

toQueryString(data); // => "?limit=10" else with above methods "?offset=null&limit=10"
```

You can freely use any method.

Body:
Use:

const toQueryString = obj => "?".concat(Object.keys(obj).map(e => `${encodeURIComponent(e)}=${encodeURIComponent(obj[e])}`).join("&"));

const data = {
  offset: 5,
  limit: 10
};

toQueryString(data); // => ?offset=5&limit=10

Or use a predefined feature

const data = {
  offset: 5,
  limit: 10
};

new URLSearchParams(data).toString(); // => ?offset=5&limit=10

Note

Both the above methods will set the value as null if not present.
If you want not to set the query parameter if value is null then use:

const toQueryString = obj => "?".concat(Object.keys(obj).map(e => obj[e] ? `${encodeURIComponent(e)}=${encodeURIComponent(obj[e])}` : null).filter(e => !!e).join("&"));

const data = {
  offset: null,
  limit: 10
};

toQueryString(data); // => "?limit=10" else with above methods "?offset=null&limit=10"

You can freely use any method.


问:
How to delete parent directories without deleting its children directories in git?
I have a git repository that has the file structure of /react-projects/programming-todo-list/programming-todo-list/*

I want to delete the upper directories /react-projects/programming-todo-list so that it ends up looking like this : programming-todo-list/*

Is there a way to delete the upper directories without deleting the children directories?

答:
git mv programming-todo-list ../.. is enough if you don't want to impact your past commits (which would still display programming-todo-list in its former place).

If you can rewrite the history of your repository, then git filter-repo (Python-based, to be installed first) is the right tool, using path-based filtering:

```<code>git filter-repo --path-rename react-projects/programming-todo-list/programming-todo-list:programming-todo-list
</code>```

Body:
git mv programming-todo-list ../.. is enough if you don't want to impact your past commits (which would still display programming-todo-list in its former place).

If you can rewrite the history of your repository, then git filter-repo (Python-based, to be installed first) is the right tool, using path-based filtering:

git filter-repo --path-rename react-projects/programming-todo-list/programming-todo-list:programming-todo-list


问:
How to get a button state to save after signing out and sign back in?
I have a save button that when tapped, will save the text in a label (quoteLabel) to a user account in Firebase. The button will then hide and the unsave button will no longer be hidden so that the user can unsave if desired. Both of these buttons are able to post and delete data as desired, however, if I sign-out of the app and sign back in, the buttons are reset to their original status. How do I get the button to stay in the last state it was set to?  I can't seem to get this to work. Please let me know if more information is needed, I'm still new to all this.

Edit: Updated with suggestions from below. I still can't seem to get this to work properly. When I tap just one button, they all end up being saved as tapped when I sign back in. I added how I assigned a key as well.

```<code>import Foundation
import UIKit
import FirebaseDatabase
import FirebaseAuth

class QuotesCollectionViewCell: UICollectionViewCell {

@IBOutlet weak var quoteLabel: UILabel!
@IBOutlet weak var save: UIButton!
@IBOutlet weak var unsave: UIButton!
@IBAction func saveButton(_ sender: UIButton) {
UserDefaults.standard.set(true, forKey: uuid)

save.isHidden = true
unsave.isHidden = false

var ref: DatabaseReference?
ref = Database.database().reference()

if quoteLabel.text == "The best time to plant a tree was 20 years ago - The next best time is today - Unknown"{

guard let user = Auth.auth().currentUser?.uid else { return }
ref!.child("users").child(Auth.auth().currentUser!.uid).child("Quote").child("Quote1").setValue(quoteLabel.text!)

}

}

@IBAction func UnsaveButton(_ sender: UIButton) {
UserDefaults.standard.set(false, forKey: uuid)

save.isHidden = false
unsave.isHidden = true

var ref: DatabaseReference?
ref = Database.database().reference()

if quoteLabel.text == "The best time to plant a tree was 20 years ago - The next best time is today - Unknown"{
ref!.child("users").child(Auth.auth().currentUser!.uid).child("Quote").child("Quote1").removeValue()

}

}

func setup(with quote: Quotes){
let saveButtonShowing = UserDefaults.standard.bool(forKey: uuid)
if(saveButtonShowing){ // Retrieves the state variable from the hard drive and sets the button visibility accordingly
    save.isHidden = true
    unsave.isHidden = false
} else {
    save.isHidden = false
    unsave.isHidden = true
}

quoteLabel.text = quote.quote

}
}
</code>```

This is how I tried to add a key to each quote:

```<code>import UIKit
import Foundation

let uuid = UUID().uuidString

struct Quotes {
let quote: String
let identifier: String

}

let quotes: [Quotes] = [
Quotes(quote: "The best time to plant a tree was 20 years ago - The next best time is today - Unknown", identifier:  uuid),
                        Quotes(quote:    "Everytime you spend money, you're casting a vote for the type of world you want - Anna Lappe",identifier: uuid),
                        Quotes(quote: "Buy less, choose well, make it last - Vivienne Westwood", identifier: uuid),
                        Quotes(quote: "The future depends on what we do in the present - Mahatma Gandhi", identifier: uuid),
]
</code>```

答:
You need to store the info on local device.
the best way is to store the info on firebase according to the user info.
I think it's no problem to show the code here.</p>

Body:
I have a save button that when tapped, will save the text in a label (quoteLabel) to a user account in Firebase. The button will then hide and the unsave button will no longer be hidden so that the user can unsave if desired. Both of these buttons are able to post and delete data as desired, however, if I sign-out of the app and sign back in, the buttons are reset to their original status. How do I get the button to stay in the last state it was set to?  I can't seem to get this to work. Please let me know if more information is needed, I'm still new to all this.

Edit: Updated with suggestions from below. I still can't seem to get this to work properly. When I tap just one button, they all end up being saved as tapped when I sign back in. I added how I assigned a key as well.

import Foundation
import UIKit
import FirebaseDatabase
import FirebaseAuth

class QuotesCollectionViewCell: UICollectionViewCell {

@IBOutlet weak var quoteLabel: UILabel!
@IBOutlet weak var save: UIButton!
@IBOutlet weak var unsave: UIButton!
@IBAction func saveButton(_ sender: UIButton) {
UserDefaults.standard.set(true, forKey: uuid)

save.isHidden = true
unsave.isHidden = false

var ref: DatabaseReference?
ref = Database.database().reference()

if quoteLabel.text == "The best time to plant a tree was 20 years ago - The next best time is today - Unknown"{

guard let user = Auth.auth().currentUser?.uid else { return }
ref!.child("users").child(Auth.auth().currentUser!.uid).child("Quote").child("Quote1").setValue(quoteLabel.text!)

}

}

@IBAction func UnsaveButton(_ sender: UIButton) {
UserDefaults.standard.set(false, forKey: uuid)

save.isHidden = false
unsave.isHidden = true

var ref: DatabaseReference?
ref = Database.database().reference()

if quoteLabel.text == "The best time to plant a tree was 20 years ago - The next best time is today - Unknown"{
ref!.child("users").child(Auth.auth().currentUser!.uid).child("Quote").child("Quote1").removeValue()

}

}

func setup(with quote: Quotes){
let saveButtonShowing = UserDefaults.standard.bool(forKey: uuid)
if(saveButtonShowing){ // Retrieves the state variable from the hard drive and sets the button visibility accordingly
    save.isHidden = true
    unsave.isHidden = false
} else {
    save.isHidden = false
    unsave.isHidden = true
}

quoteLabel.text = quote.quote

}
}

This is how I tried to add a key to each quote:

import UIKit
import Foundation

let uuid = UUID().uuidString

struct Quotes {
let quote: String
let identifier: String

}

let quotes: [Quotes] = [
Quotes(quote: "The best time to plant a tree was 20 years ago - The next best time is today - Unknown", identifier:  uuid),
                        Quotes(quote:    "Everytime you spend money, you're casting a vote for the type of world you want - Anna Lappe",identifier: uuid),
                        Quotes(quote: "Buy less, choose well, make it last - Vivienne Westwood", identifier: uuid),
                        Quotes(quote: "The future depends on what we do in the present - Mahatma Gandhi", identifier: uuid),
]


答:
Use toolbarTextStyle and titleTextStyle instead of using textTheme inside appBarTheme.

toolbarTextStyle:
    Theme.of(context).appBarTheme.toolbarTextStyle?.copyWith(
          color: Colors.amber,
          ///your config
        ),
titleTextStyle:
    Theme.of(context).appBarTheme.titleTextStyle?.copyWith(
          color: Colors.amber, ///your config
        )
```

More about using theme.

Title: Flutter textTheme property is not working, How to replace or fix it?

Body:
I am new to flutter. I just created a theme file to define light and dark theme.When I defined light theme, the textTheme:  property which is deprecated is not changing the text title  color of app bar into black.

If I have to create or define textTheme or replace it ?? How should I do it ?

class MyTheme {
  static ThemeData lightTheme(BuildContext context) => ThemeData(
      primarySwatch: Colors.deepPurple,
      fontFamily: GoogleFonts.lato().fontFamily,
      appBarTheme: AppBarTheme(
        color: Colors.white,
        elevation: 0.0,
        iconTheme: IconThemeData(color: Colors.black),

//------
        textTheme: Theme.of(context).textTheme, // Problem is here
//------
      ));

  static ThemeData darkTheme(BuildContext context) =>
      ThemeData(brightness: Brightness.dark);
}

Body:
Use toolbarTextStyle and titleTextStyle instead of using textTheme inside appBarTheme.

toolbarTextStyle:
    Theme.of(context).appBarTheme.toolbarTextStyle?.copyWith(
          color: Colors.amber,
          ///your config
        ),
titleTextStyle:
    Theme.of(context).appBarTheme.titleTextStyle?.copyWith(
          color: Colors.amber, ///your config
        )

More about using theme.


问:
Define the selected option with the old input in Laravel / Blade
I have this code:

```<code><select required="required" class="form-control" name="title">
    <option></option>
    @foreach ($titles as $key => $val)
        @if (stristr($key, 'isGroup'))
            <optgroup label="{{ $val }}">
        @else
        <option value="{{ $key }}">{{ $val }}</option>
        @endif
    @endforeach
    </select>
</code>```

So when the form have errors i use the line Redirect::route('xpto')->withInput()->withErrors($v). But i can't re-populate the select fields. Any way to do this without using JavaScript for example?

答:
Improving CodeToLife's answer with error validation implementation like below</p>
```<code><div class="form-group row">
    <label for="person-field" class="col-md-4 col-form-label text-right">First Person</label>
    <div class="col-md-6">
        <select id="person-field" class="custom-select select2 @error('person') is-invalid @enderror" name="person" required>
            <option></option>
            @foreach(\App\User::all() as $user)
                <option value="{{$user->id}}" @if (old('person') == $user->id) selected  @endif>{{$user->name}}
                </option>
            @endforeach
        </select>
        @error('person')
        <span class="invalid-feedback" role="alert">
            <strong>{{ $message }}</strong>
        </span>
        @enderror
    </div>
</div>
</code>```

Body:
I have this code:

<select required="required" class="form-control" name="title">
    <option></option>
    @foreach ($titles as $key => $val)
        @if (stristr($key, 'isGroup'))
            <optgroup label="{{ $val }}">
        @else
        <option value="{{ $key }}">{{ $val }}</option>
        @endif
    @endforeach
    </select>

So when the form have errors i use the line Redirect::route('xpto')->withInput()->withErrors($v). But i can't re-populate the select fields. Any way to do this without using JavaScript for example?

Body:
Improving CodeToLife's answer with error validation implementation like below

<div class="form-group row">
    <label for="person-field" class="col-md-4 col-form-label text-right">First Person</label>
    <div class="col-md-6">
        <select id="person-field" class="custom-select select2 @error('person') is-invalid @enderror" name="person" required>
            <option></option>
            @foreach(\App\User::all() as $user)
                <option value="{{$user->id}}" @if (old('person') == $user->id) selected  @endif>{{$user->name}}
                </option>
            @endforeach
        </select>
        @error('person')
        <span class="invalid-feedback" role="alert">
            <strong>{{ $message }}</strong>
        </span>
        @enderror
    </div>
</div>


问:
How to record mutation and action in "vue js dev tools" beta version?
I'm working on vue3 and managing state using Vuex, but I'm not able to load mutation and actions in the vuejs devtools beta version. Also no recording feature.
Image of my vuejs Devtools</p>

答:
Update

Updated Vue DevTool chrome extension released couple of hours back with support for tracking mutations / actions!!

Looks like Vue Devtool beta for Vue 3 doesn't support recording actions / mutations yet.

The best alternative I have found is to use createLogger() plugin, which will then log all actions and mutations to the console.

```<code>import { createStore, createLogger } from "vuex";
export default createStore({
    state: {},
    mutations: {},
    actions: {},
    modules: {},
    plugins: [createLogger()]
});
</code>```

Chrome Devtools window

Body:
Update

Updated Vue DevTool chrome extension released couple of hours back with support for tracking mutations / actions!!

Looks like Vue Devtool beta for Vue 3 doesn't support recording actions / mutations yet.

The best alternative I have found is to use createLogger() plugin, which will then log all actions and mutations to the console.

import { createStore, createLogger } from "vuex";
export default createStore({
    state: {},
    mutations: {},
    actions: {},
    modules: {},
    plugins: [createLogger()]
});

Chrome Devtools window


问:
Sticky/Fixed Header goes behind a div containing an image
I am trying to create a header that when you scroll it will stick to the top of the page.

I have tried positon: fixed but it moved behind the the div containing the image. I tried sticky it's the same story. Anh as you can see I tried position: fixed and sticky on some placed to see i it would work but it doesn't.

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100&display=swap');
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  /* padding-top: 100px; */
}

.section1 {
  /* position: sticky; */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  text-align: center;
  color: blueviolet;
}

.section1 img {
  /* position: sticky; */
  flex-shrink: 0;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  text-align: center;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

li,
a,
button {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
}

header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252a;
}

.header_logo {
  cursor: pointer;
  margin-left: -70px;
}

.nav_links {
  list-style-type: none;
}

.nav_links li {
  display: inline-block;
  padding: 0px 20px;
}

.nav_links li a {
  transition: all 0.3s ease 0s;
}

.nav_links li a:hover {
  color: #0088a9;
}

button {
  padding: 9px 25px;
  background-color: rgba(0, 139, 169, 1);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease 0s;
}

button:hover {
  background-color: rgba(0, 139, 169, 0.8);
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./style.css">
</head>

<body>
  <header>
    <img class="header_logo" src="./youtube_logo.png" alt="youtube's logo" width="5%" height="5%">
    <nav=c lass="navbar">
      <ul class="nav_links">
        <li>SERVICE</li>
        <li>STORE</li>
        <li>CONTACT</li>
        <li>MORE</li>
      </ul>
      </nav>
      <button>SOCIAL</button>
  </header>
  <section class="section1">
    <img class="page_logo1" src="./2f606ad14bf9171e5f41b42a01b4441f.jpg">
    <div class="centered">
      this is center
  </section>
  </div>
  <div class="section2">
    <img class="page_logo2" src="./2f606ad14bf9171e5f41b42a01b4441f.jpg">
  </div>

</body>

</html></code>```

答:
Just add z-index:100; to your header and it remains on top when scrolling and the image goes behind.

Reference for z-index

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100&display=swap');
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  /* padding-top: 100px; */
}

.section1 {
  /* position: sticky; */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  text-align: center;
  color: blueviolet;
}

.section1 img {
  /* position: sticky; */
  flex-shrink: 0;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  text-align: center;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

li,
a,
button {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
}

header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252a;
  z-index:100;/* add this */
}

.header_logo {
  cursor: pointer;
  margin-left: -70px;
}

.nav_links {
  list-style-type: none;
}

.nav_links li {
  display: inline-block;
  padding: 0px 20px;
}

.nav_links li a {
  transition: all 0.3s ease 0s;
}

.nav_links li a:hover {
  color: #0088a9;
}

button {
  padding: 9px 25px;
  background-color: rgba(0, 139, 169, 1);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease 0s;
}

button:hover {
  background-color: rgba(0, 139, 169, 0.8);
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./style.css">
</head>

<body>
  <header>
    <img class="header_logo" src="./youtube_logo.png" alt="youtube's logo" width="5%" height="5%">
    <nav=c lass="navbar">
      <ul class="nav_links">
        <li>SERVICE</li>
        <li>STORE</li>
        <li>CONTACT</li>
        <li>MORE</li>
      </ul>
      </nav>
      <button>SOCIAL</button>
  </header>
  <section class="section1">
    <img class="page_logo1" src="./2f606ad14bf9171e5f41b42a01b4441f.jpg">
    <div class="centered">
      this is center
  </section>
  </div>
  <div class="section2">
    <img class="page_logo2" src="./2f606ad14bf9171e5f41b42a01b4441f.jpg">
  </div>

</body>

</html></code>```

Body:
I am trying to create a header that when you scroll it will stick to the top of the page.

I have tried positon: fixed but it moved behind the the div containing the image. I tried sticky it's the same story. Anh as you can see I tried position: fixed and sticky on some placed to see i it would work but it doesn't.

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100&display=swap');
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  /* padding-top: 100px; */
}

.section1 {
  /* position: sticky; */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  text-align: center;
  color: blueviolet;
}

.section1 img {
  /* position: sticky; */
  flex-shrink: 0;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  text-align: center;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

li,
a,
button {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
}

header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252a;
}

.header_logo {
  cursor: pointer;
  margin-left: -70px;
}

.nav_links {
  list-style-type: none;
}

.nav_links li {
  display: inline-block;
  padding: 0px 20px;
}

.nav_links li a {
  transition: all 0.3s ease 0s;
}

.nav_links li a:hover {
  color: #0088a9;
}

button {
  padding: 9px 25px;
  background-color: rgba(0, 139, 169, 1);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease 0s;
}

button:hover {
  background-color: rgba(0, 139, 169, 0.8);
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./style.css">

SERVICE

STORE

CONTACT

MORE

      <button>SOCIAL</button>

      this is center

Body:
Just add z-index:100; to your header and it remains on top when scrolling and the image goes behind.

Reference for z-index

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100&display=swap');
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  /* padding-top: 100px; */
}

.section1 {
  /* position: sticky; */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  text-align: center;
  color: blueviolet;
}

.section1 img {
  /* position: sticky; */
  flex-shrink: 0;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  text-align: center;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

li,
a,
button {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
}

header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252a;
  z-index:100;/* add this */
}

.header_logo {
  cursor: pointer;
  margin-left: -70px;
}

.nav_links {
  list-style-type: none;
}

.nav_links li {
  display: inline-block;
  padding: 0px 20px;
}

.nav_links li a {
  transition: all 0.3s ease 0s;
}

.nav_links li a:hover {
  color: #0088a9;
}

button {
  padding: 9px 25px;
  background-color: rgba(0, 139, 169, 1);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease 0s;
}

button:hover {
  background-color: rgba(0, 139, 169, 0.8);
}

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./style.css">
</head>

<body>
  <header>
    <img class="header_logo" src="./youtube_logo.png" alt="youtube's logo" width="5%" height="5%">
    <nav=c lass="navbar">
      <ul class="nav_links">
        <li><a href="#">SERVICE</a></li>
        <li><a href="#">STORE</a></li>
        <li><a href="#">CONTACT</a></li>
        <li><a href="#">MORE</a></li>
      </ul>
      </nav>
      <a class="social_buttion" href="#"><button>SOCIAL</button></a>
  </header>
  <section class="section1">
    <img class="page_logo1" src="./2f606ad14bf9171e5f41b42a01b4441f.jpg">
    <div class="centered">
      this is center
  </section>
  </div>
  <div class="section2">
    <img class="page_logo2" src="./2f606ad14bf9171e5f41b42a01b4441f.jpg">
  </div>

</body>

</html>


问:
How to use my keystore in my application for HttpsUrlConnection?
I wanted to make secure connection, for that am using HttpsUrlConnection in my application.
I also had an CA certificate for the URL which am using. and also as per the suggestions from other sites, have created keystore named mystore.bks for that certificate.

The problem is that, am making this connection part in a seperate thread. I want sample piece of code to use this keystore with HttpsUrlConnection within a thread.

Please answer how to do this.

Thanks in advance.

答:
Do it the standard way.

Get a hash of the keystore, and then send it along in the http request.

Add the same hash on the server, and then check it when the request is sent.


答:
Use a positive z-index value for header

body {
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  /* padding-top: 100px; */
}

.section1 {
  /* position: sticky; */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  text-align: center;
  color: blueviolet;
}

.section1 img {
  /* position: sticky; */
  flex-shrink: 0;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  text-align: center;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

li,
a,
button {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
}

header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252a;
  z-index: 1;
}

.header_logo {
  cursor: pointer;
  margin-left: -70px;
}

.nav_links {
  list-style-type: none;
}

.nav_links li {
  display: inline-block;
  padding: 0px 20px;
}

.nav_links li a {
  transition: all 0.3s ease 0s;
}

.nav_links li a:hover {
  color: #0088a9;
}

button {
  padding: 9px 25px;
  background-color: rgba(0, 139, 169, 1);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease 0s;
}

button:hover {
  background-color: rgba(0, 139, 169, 0.8);
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><header>
  <img class="header_logo" src="https://via.placeholder.com/200" alt="youtube's logo" width="5%" height="5%">
  <nav=c lass="navbar">
    <ul class="nav_links">
      <li>SERVICE</li>
      <li>STORE</li>
      <li>CONTACT</li>
      <li>MORE</li>
    </ul>
    </nav>
    <button>SOCIAL</button>
</header>
<section class="section1">
  <img class="page_logo1" src="https://via.placeholder.com/200">
  <div class="centered">
    this is center
</section>
</div>
<div class="section2">
  <img class="page_logo2" src="https://via.placeholder.com/200">
</div></code>```

Title: Sticky/Fixed Header goes behind a div containing an image

Body:
Use a positive z-index value for header

body {
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  /* padding-top: 100px; */
}

.section1 {
  /* position: sticky; */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  text-align: center;
  color: blueviolet;
}

.section1 img {
  /* position: sticky; */
  flex-shrink: 0;
  min-width: 100%;
  min-height: 100%;
  position: relative;
  text-align: center;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

li,
a,
button {
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: #edf0f1;
}

header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  background-color: #24252a;
  z-index: 1;
}

.header_logo {
  cursor: pointer;
  margin-left: -70px;
}

.nav_links {
  list-style-type: none;
}

.nav_links li {
  display: inline-block;
  padding: 0px 20px;
}

.nav_links li a {
  transition: all 0.3s ease 0s;
}

.nav_links li a:hover {
  color: #0088a9;
}

button {
  padding: 9px 25px;
  background-color: rgba(0, 139, 169, 1);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease 0s;
}

button:hover {
  background-color: rgba(0, 139, 169, 0.8);
}

<header>
  <img class="header_logo" src="https://via.placeholder.com/200" alt="youtube's logo" width="5%" height="5%">
  <nav=c lass="navbar">
    <ul class="nav_links">
      <li><a href="#">SERVICE</a></li>
      <li><a href="#">STORE</a></li>
      <li><a href="#">CONTACT</a></li>
      <li><a href="#">MORE</a></li>
    </ul>
    </nav>
    <a class="social_buttion" href="#"><button>SOCIAL</button></a>
</header>
<section class="section1">
  <img class="page_logo1" src="https://via.placeholder.com/200">
  <div class="centered">
    this is center
</section>
</div>
<div class="section2">
  <img class="page_logo2" src="https://via.placeholder.com/200">
</div>


问:
What is optimal algorithm of "random card distribution (Poker game)"?
What is the optimal algorithm of "random card distribution (Poker game)"?

I'd like to build a program that can distribute playing cards evenly with respect to their numbers and suits to the 4 players in a Poker game. In other words, all 4 players should have a straight or straight flush at the same turn. But, how do we build the algorithm for that?

This is how I think it can be approached:

Set i = suits (e.g., 1 for heart 2 for spades) j = number (ace = 1, king =13)

Make a matrix deck (Like [H1, H2, ... H13]...[S1, S2, ... S13])

Randomly choose the first card (random i1 and j1), save to player 1's deck
card = deck[i1, j1]
player1 = np.append(card)

Randomly choose second card (random i2 and j2)

If i2 = i1, rechoose i, if not, save the card to player 2 deck

Continue until 4th card

For 5th turn, if i5 = i1 and j5 = j1+1 or j1-1, save the card to player 1 deck. if not rechoose j or i.

Continue until 8th card

For the 9th turn, if i9 = i1 and j9 = j1+1 or j1-1 or j5+1 or j5-1, save the card to player 1 deck. if no rechoose j or i

However, this algorithm is time-consuming, because I need to introduce a new way to check every 4 turns whether it has a close number of previous cards that the player already has.
Is there any way to make this simpler, such as to check the card having a close number of previous cards for making a straight flush?

答:
The way to approach is the same as if you wanted to deal cards in real life. Here is an example in python

Build a deck of cards:

```<code>import itertools
deck = ["".join(c) for c in itertools.product("AKQJT98765432", "cdhs")]
# ['Ac', 'Ad', 'Ah', 'As', 'Kc', 'Kd', ....
</code>```

Shuffle the deck

```<code>import random
random.shuffle(deck)
# ['3c', '5c', '7h', 'Qs', 'Ts', '8s', 'Jd', ...
</code>```

Deal cards to 4 players

```<code>players = []
for i in range(4):
    cards = [deck.pop(), deck.pop()]
    players.append(cards)
#  [['Td', 'Jd'], ['7c', '5c'], ['Js', 'Ks'], ['6c', '8d']]
</code>```

Body:
The way to approach is the same as if you wanted to deal cards in real life. Here is an example in python

Build a deck of cards:

import itertools
deck = ["".join(c) for c in itertools.product("AKQJT98765432", "cdhs")]
# ['Ac', 'Ad', 'Ah', 'As', 'Kc', 'Kd', ....

Shuffle the deck

import random
random.shuffle(deck)
# ['3c', '5c', '7h', 'Qs', 'Ts', '8s', 'Jd', ...

Deal cards to 4 players

players = []
for i in range(4):
    cards = [deck.pop(), deck.pop()]
    players.append(cards)
#  [['Td', 'Jd'], ['7c', '5c'], ['Js', 'Ks'], ['6c', '8d']]


问:
ERROR: function regexp_like(character varying, unknown) does not exist
I have this SQL query that I'm writing using Postgresql.

```<code>select * from cdr_data
  where REGEXP_LIKE(identifiant,'^73')
    and REGEXP_REPLACE(callednumber,'^256','') ~ '^73'
</code>```

It gives me following error:

```<code>[Err] ERROR:  function regexp_like(character varying, unknown) does not exist
LINE 2: and  regexp_like(identifiant,'^73')
</code>```

I have tried replace with REGEXP_LIKE with LIKE and REGEXP_MATCHES but they don't work.

What could be the problem?

答:
In fact, you can use one of following functions

```<code>value_or_colum_name ~ '<regex-expression>'
value_or_colum_name SIMILAR TO '<regex-expression>'
TEXTREGEXEQ(value_or_colum_name,'<regex-expression>')
</code>```

all these 3 possibilities are totaly equivalent.

The REGEXP_LIKE fonction doesn't exists on SqlPostGreSQL.
But REGEXP_MATCHES and REGEXP_REPLACE exist.

Here is a command using ~ and REGEXP_REPLACE that I used to check if my Regular Expresion work correctly before starting an SQL UPDATE.

```<code>SELECT communication
      ,REGEXP_REPLACE
         (communication
         ,'(\d{3})(\d{4})(\d{5})'
         ,'***\1/\2/\3***'
         ) as ref
  FROM mouvements
  WHERE communication ~ '^\d{12}$'
</code>```

this give following results

```<code>comm            ref
------------------------------------
303000167868    ***303/0001/67868***
121231357408    ***121/2313/57408***
321000204456    ***321/0002/04456***
</code>```

and the final UPDATE command is

```<code>UPDATE mouvements
  SET communication = NULL
     ,Ref_Structured = REGEXP_REPLACE(communication,'(\d{3})(\d{4})(\d{5})','***\1/\2/\3***')
  WHERE communication ~ '^\d{12}$'
</code>```

another SQL UPDATE command that split a column is 2

```<code>UPDATE mouvements
  SET nom = REGEXP_REPLACE(nom,'^(.*)(REFERENCE DONNEUR D''ORDRE : )(.*)','\1')
     ,RefDonneur = REGEXP_REPLACE(nom,'^.*(REFERENCE DONNEUR D''ORDRE : )(.*)','\2')
  where nom ~ 'REFERENCE DONNEUR D''ORDRE :'
</code>```

Body:
I have this SQL query that I'm writing using Postgresql.

select * from cdr_data
  where REGEXP_LIKE(identifiant,'^73')
    and REGEXP_REPLACE(callednumber,'^256','') ~ '^73'

It gives me following error:

[Err] ERROR:  function regexp_like(character varying, unknown) does not exist
LINE 2: and  regexp_like(identifiant,'^73')

I have tried replace with REGEXP_LIKE with LIKE and REGEXP_MATCHES but they don't work.

What could be the problem?

Body:
In fact, you can use one of following functions

value_or_colum_name ~ '<regex-expression>'
value_or_colum_name SIMILAR TO '<regex-expression>'
TEXTREGEXEQ(value_or_colum_name,'<regex-expression>')

all these 3 possibilities are totaly equivalent.

The REGEXP_LIKE fonction doesn't exists on SqlPostGreSQL.
But REGEXP_MATCHES and REGEXP_REPLACE exist.

Here is a command using ~ and REGEXP_REPLACE that I used to check if my Regular Expresion work correctly before starting an SQL UPDATE.

SELECT communication
      ,REGEXP_REPLACE
         (communication
         ,'(\d{3})(\d{4})(\d{5})'
         ,'***\1/\2/\3***'
         ) as ref
  FROM mouvements
  WHERE communication ~ '^\d{12}$'

this give following results

comm            ref
------------------------------------
303000167868    ***303/0001/67868***
121231357408    ***121/2313/57408***
321000204456    ***321/0002/04456***

and the final UPDATE command is

UPDATE mouvements
  SET communication = NULL
     ,Ref_Structured = REGEXP_REPLACE(communication,'(\d{3})(\d{4})(\d{5})','***\1/\2/\3***')
  WHERE communication ~ '^\d{12}$'

another SQL UPDATE command that split a column is 2

UPDATE mouvements
  SET nom = REGEXP_REPLACE(nom,'^(.*)(REFERENCE DONNEUR D''ORDRE : )(.*)','\1')
     ,RefDonneur = REGEXP_REPLACE(nom,'^.*(REFERENCE DONNEUR D''ORDRE : )(.*)','\2')
  where nom ~ 'REFERENCE DONNEUR D''ORDRE :'


问:
Want to hide some fields of an object that are being mapped to JSON by Jackson
I have a User class that I want to map to JSON using Jackson.

```<code>public class User {
    private String name;
    private int age;
    private int securityCode;

    // getters and setters
}
</code>```

I map this to a JSON string using -

```<code>User user = getUserFromDatabase();

ObjectMapper mapper = new ObjectMapper();
String json =  mapper.writeValueAsString(user);
</code>```

I don't want to map the securityCode variable. Is there any way of configuring the mapper so that it ignores this field?

I know I can write custom data mappers or use the Streaming API but I would like to know if it possible to do it through configuration?

答:
I suggest you use this.

```<code>   @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
   private int securityCode;
</code>```

This allows you to set the value of securityCode(especially if you use lombok @Setter) and also prevent the field from showing up in the GET request.

Body:
I have a User class that I want to map to JSON using Jackson.

public class User {
    private String name;
    private int age;
    private int securityCode;

    // getters and setters
}

I map this to a JSON string using -

User user = getUserFromDatabase();

ObjectMapper mapper = new ObjectMapper();
String json =  mapper.writeValueAsString(user);

I don't want to map the securityCode variable. Is there any way of configuring the mapper so that it ignores this field?

I know I can write custom data mappers or use the Streaming API but I would like to know if it possible to do it through configuration?

Body:
I suggest you use this.

   @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
   private int securityCode;

This allows you to set the value of securityCode(especially if you use lombok @Setter) and also prevent the field from showing up in the GET request.


问:
How to solve Invalid Hook Call error when using Material UI?
I'm new at coding and I'm having the following error when adding a MaterialUI Icon

```<code>import PersonIcon from '@mui/icons-material/Person';

function Header() {
    return (

<div>
<PersonIcon />
<h2>Header file</h2>

</div>

    );
}

export default Header;

</code>```

When adding  I get the following error:

Please notice that I have installed MaterialUI Core and also MaterialUI Icons
When not adding  everything works fine

答:
You need to wrap your app in ThemeProvider:

index.js:

```<code>import * as React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import App from './App';

const theme = createTheme({
  palette: {
    primary: {
      main: '#556cd6',
    },
    secondary: {
      main: '#19857b',
    },
  },
});

ReactDOM.render(
  <ThemeProvider theme={theme}>
    <App />
  </ThemeProvider>,
  document.querySelector('#root'),
);
</code>```

Body:
I'm new at coding and I'm having the following error when adding a MaterialUI Icon

import PersonIcon from '@mui/icons-material/Person';

function Header() {
    return (

<PersonIcon />

Header file

    );
}

export default Header;

When adding  I get the following error:

Please notice that I have installed MaterialUI Core and also MaterialUI Icons
When not adding  everything works fine

Body:
You need to wrap your app in ThemeProvider:

index.js:

import * as React from 'react';
import ReactDOM from 'react-dom';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import App from './App';

const theme = createTheme({
  palette: {
    primary: {
      main: '#556cd6',
    },
    secondary: {
      main: '#19857b',
    },
  },
});

ReactDOM.render(
  <ThemeProvider theme={theme}>
    <App />
  </ThemeProvider>,
  document.querySelector('#root'),
);


问:
Does indexing works with "WITH" in Oracle
I have query something like

```<code>WITH
str_table as (
  SELECT stringtext, stringnumberid
  FROM STRING_TABLE
  WHERE LANGID IN (23,62)
),
data as (
  select *
  from employee emp
  left outer join str_table st on emp.nameid = st.stringnumberid
)
select * from data
</code>```

I know With clause will work in this manner

Step 1 : The SQL Query within the with clause is executed at first step.

Step 2 : The output of the SQL query is stored into temporary relation of with clause.

Step 3 : The Main query is executed with temporary relation produced at the last stage.

Now I want to ask whether the indexes created on the actual STRING_TABLE are going to help in temporary str_table produce by the With clause? I want to ask whether the indexes also have impact on str_table or not?

答:
It depends.

First of all, with clause is not a temporary table. As documentation says:

Oracle Database optimizes the query by treating the query name as either an inline view or as a temporary table.

Optimizer decides to materialize with subquery if either you forse it to do so by using /*+materialize*/ hint inside the subquery or you reuse this with subquery more than once.

In the example below Oracle uses with clause as inline view and merges it within the main query:

```<code>explain plan for
with a as (
  select
    s.textid,
    s.textvalue,
    a.id,
    a.other_column
  from string_table s
    join another_tab a
      on s.textid = a.textid
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
    and b.job_textid = a_name.id
</code>```
```
| PLAN_TABLE_OUTPUT                                                                    |
| :----------------------------------------------------------------------------------- |
| Plan hash value: 1854049435                                                          |
|                                                                                |
| ------------------------------------------------------------------------------------ |
| | Id  | Operation           | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| ------------------------------------------------------------------------------------ |
| |   0 | SELECT STATEMENT    |              |     1 |  1147 |    74   (0)| 00:00:01 | |
| |*  1 |  HASH JOIN          |              |     1 |  1147 |    74   (0)| 00:00:01 | |
| |   2 |   TABLE ACCESS FULL | ANOTHER_TAB  |    39 |  3042 |     3   (0)| 00:00:01 | |
| |*  3 |   HASH JOIN         |              |    31 | 33139 |    71   (0)| 00:00:01 | |
| |   4 |    TABLE ACCESS FULL| BIG_TABLE    |    19 | 10279 |     3   (0)| 00:00:01 | |
| |*  5 |    TABLE ACCESS FULL| STRING_TABLE |  1143 |   589K|    68   (0)| 00:00:01 | |
| ------------------------------------------------------------------------------------ |
```

But depending on the statistics and hints it may evaluate subquery first and then add it to the main query:

```<code>explain plan for
with a as (
  select
    s.textid,
    s.textvalue,
    a.id,
    a.other_column
  from string_table s
    join another_tab a
      on s.textid = a.textid
  where langid in (1)
)
select /*+NO_MERGE(a_name)*/ *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
    and b.job_textid = a_name.id
</code>```
```
| PLAN_TABLE_OUTPUT                                                                     |
| :------------------------------------------------------------------------------------ |
| Plan hash value: 4105667421                                                           |
|                                                                                |
| ------------------------------------------------------------------------------------- |
| | Id  | Operation            | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| ------------------------------------------------------------------------------------- |
| |   0 | SELECT STATEMENT     |              |   101 |   110K|    74   (0)| 00:00:01 | |
| |*  1 |  HASH JOIN           |              |   101 |   110K|    74   (0)| 00:00:01 | |
| |   2 |   TABLE ACCESS FULL  | BIG_TABLE    |    19 | 10279 |     3   (0)| 00:00:01 | |
| |   3 |   VIEW               |              |    64 | 37120 |    71   (0)| 00:00:01 | |
| |*  4 |    HASH JOIN         |              |    64 | 38784 |    71   (0)| 00:00:01 | |
| |   5 |     TABLE ACCESS FULL| ANOTHER_TAB  |    39 |  3042 |     3   (0)| 00:00:01 | |
| |*  6 |     TABLE ACCESS FULL| STRING_TABLE |  1143 |   589K|    68   (0)| 00:00:01 | |
| ------------------------------------------------------------------------------------- |
```

When you use with subquery twice, optimizer decides to materialize it:

```<code>explain plan for
with a as (
  select
    s.textid,
    s.textvalue
  from string_table s
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
  join a a_job
  on b.job_textid = a_job.textid
</code>```
```
| PLAN_TABLE_OUTPUT                                                                                |
| :--------------------------------------------------------------------------------------------------------------------- |
| Plan hash value: 1371454296                                                                                |
|                                                                                |
| ---------------------------------------------------------------------------------------------------------------------- |
| | Id  | Operation                                | Name                      | Rows  | Bytes | Cost (%CPU)| Time     | |
| ---------------------------------------------------------------------------------------------------------------------- |
| |   0 | SELECT STATEMENT                         |                           |    63 | 98973 |    67   (0)| 00:00:01 | |
| |   1 |  TEMP TABLE TRANSFORMATION               |                           |       |       |            |          | |
| |   2 |   LOAD AS SELECT (CURSOR DURATION MEMORY)| SYS_TEMP_0FD9D7224_469C01 |       |       |            |          | |
| |   3 |    TABLE ACCESS BY INDEX ROWID BATCHED   | STRING_TABLE              |   999 |   515K|    22   (0)| 00:00:01 | |
| |*  4 |     INDEX RANGE SCAN                     | IX                        |   999 |       |     4   (0)| 00:00:01 | |
| |*  5 |   HASH JOIN                              |                           |    63 | 98973 |    45   (0)| 00:00:01 | |
| |*  6 |    HASH JOIN                             |                           |    35 | 36960 |    24   (0)| 00:00:01 | |
| |   7 |     TABLE ACCESS FULL                    | BIG_TABLE                 |    19 | 10279 |     3   (0)| 00:00:01 | |
| |   8 |     VIEW                                 |                           |   999 |   502K|    21   (0)| 00:00:01 | |
| |   9 |      TABLE ACCESS FULL                   | SYS_TEMP_0FD9D7224_469C01 |   999 |   502K|    21   (0)| 00:00:01 | |
| |  10 |    VIEW                                  |                           |   999 |   502K|    21   (0)| 00:00:01 | |
| |  11 |     TABLE ACCESS FULL                    | SYS_TEMP_0FD9D7224_469C01 |   999 |   502K|    21   (0)| 00:00:01 | |
| ---------------------------------------------------------------------------------------------------------------------- |
```

So when there are some indexes on tables inside with subquery they may be used in all above cases: before materialization, when subquery is not merged and when subquery is merged and some idexes provide better query plan on merged subquery (even when those indexes are not used when you execute subquery alone).

What about idexes: if they provide high selectivity (i.e. number of rows retrieved by index is small compared to the overall number of rows), then Oracle will consider to use it. Note, that index access has two steps: read index blocks and then read table blocks that contain rowids found by index. If table size is not much bigger than index size, then Oracle may use table scan instead of index scan even for quite selective predicate (because of doubled IO).

In the below example I've used "small" texts (100 chars) and big_table table of 20 rows and this index for text table:

```<code>create index ix
on string_table(langid, textid)
</code>```

Optimizer decides to use index range scan and read only blocks of the first level (first column of the index):

```<code>explain plan for
with a as (
  select
    s.textid,
    s.textvalue
  from string_table s
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
</code>```
```
| PLAN_TABLE_OUTPUT                                                                                |
| :---------------------------------------------------------------------------------------------------- |
| Plan hash value: 1660330381                                                                           |
|                                                                                |
| ----------------------------------------------------------------------------------------------------- |
| | Id  | Operation                            | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| ----------------------------------------------------------------------------------------------------- |
| |   0 | SELECT STATEMENT                     |              |    29 | 31001 |    26   (0)| 00:00:01 | |
| |*  1 |  HASH JOIN                           |              |    29 | 31001 |    26   (0)| 00:00:01 | |
| |   2 |   TABLE ACCESS FULL                  | BIG_TABLE    |    19 | 10279 |     3   (0)| 00:00:01 | |
| |   3 |   TABLE ACCESS BY INDEX ROWID BATCHED| STRING_TABLE |   999 |   515K|    23   (0)| 00:00:01 | |
| |*  4 |    INDEX RANGE SCAN                  | IX           |   999 |       |     4   (0)| 00:00:01 | |
| ----------------------------------------------------------------------------------------------------- |
|                                                                                |
| Predicate Information (identified by operation id):                                                   |
| ---------------------------------------------------                                                   |
|                                                                                |
|    1 - access("B"."NAME_TEXTID"="S"."TEXTID")                                                         |
|    4 - access("LANGID"=1)                                                                             |                                                                      |
```

But when we reduce the number of rows in big_table, it uses both the columns for index scan:

```<code>delete from big_table
where id > 4

explain plan for
with a as (
  select
    s.textid,
    s.textvalue
  from string_table s
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
</code>```
```
| PLAN_TABLE_OUTPUT                                                                    |
| :----------------------------------------------------------------------------------- |
| Plan hash value: 1854049435                                                          |
|                                                                                |
| ------------------------------------------------------------------------------------ |
| | Id  | Operation           | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| ------------------------------------------------------------------------------------ |
| |   0 | SELECT STATEMENT    |              |     1 |  1147 |    74   (0)| 00:00:01 | |
| |*  1 |  HASH JOIN          |              |     1 |  1147 |    74   (0)| 00:00:01 | |
| |   2 |   TABLE ACCESS FULL | ANOTHER_TAB  |    39 |  3042 |     3   (0)| 00:00:01 | |
| |*  3 |   HASH JOIN         |              |    31 | 33139 |    71   (0)| 00:00:01 | |
| |   4 |    TABLE ACCESS FULL| BIG_TABLE    |    19 | 10279 |     3   (0)| 00:00:01 | |
| |*  5 |    TABLE ACCESS FULL| STRING_TABLE |  1143 |   589K|    68   (0)| 00:00:01 | |
| ------------------------------------------------------------------------------------ |
```0

You may check above code snippets in the db<>fiddle.

Body:
I have query something like

WITH
str_table as (
  SELECT stringtext, stringnumberid
  FROM STRING_TABLE
  WHERE LANGID IN (23,62)
),
data as (
  select *
  from employee emp
  left outer join str_table st on emp.nameid = st.stringnumberid
)
select * from data

I know With clause will work in this manner

Step 1 : The SQL Query within the with clause is executed at first step.

Step 2 : The output of the SQL query is stored into temporary relation of with clause.

Step 3 : The Main query is executed with temporary relation produced at the last stage.

Now I want to ask whether the indexes created on the actual STRING_TABLE are going to help in temporary str_table produce by the With clause? I want to ask whether the indexes also have impact on str_table or not?

Body:
It depends.

First of all, with clause is not a temporary table. As documentation says:

Oracle Database optimizes the query by treating the query name as either an inline view or as a temporary table.

Optimizer decides to materialize with subquery if either you forse it to do so by using /*+materialize*/ hint inside the subquery or you reuse this with subquery more than once.

In the example below Oracle uses with clause as inline view and merges it within the main query:

explain plan for
with a as (
  select
    s.textid,
    s.textvalue,
    a.id,
    a.other_column
  from string_table s
    join another_tab a
      on s.textid = a.textid
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
    and b.job_textid = a_name.id

| PLAN_TABLE_OUTPUT                                                                    |
| :----------------------------------------------------------------------------------- |
| Plan hash value: 1854049435                                                          |
|                                                                                |
| ------------------------------------------------------------------------------------ |
| | Id  | Operation           | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| ------------------------------------------------------------------------------------ |
| |   0 | SELECT STATEMENT    |              |     1 |  1147 |    74   (0)| 00:00:01 | |
| |*  1 |  HASH JOIN          |              |     1 |  1147 |    74   (0)| 00:00:01 | |
| |   2 |   TABLE ACCESS FULL | ANOTHER_TAB  |    39 |  3042 |     3   (0)| 00:00:01 | |
| |*  3 |   HASH JOIN         |              |    31 | 33139 |    71   (0)| 00:00:01 | |
| |   4 |    TABLE ACCESS FULL| BIG_TABLE    |    19 | 10279 |     3   (0)| 00:00:01 | |
| |*  5 |    TABLE ACCESS FULL| STRING_TABLE |  1143 |   589K|    68   (0)| 00:00:01 | |
| ------------------------------------------------------------------------------------ |

But depending on the statistics and hints it may evaluate subquery first and then add it to the main query:

explain plan for
with a as (
  select
    s.textid,
    s.textvalue,
    a.id,
    a.other_column
  from string_table s
    join another_tab a
      on s.textid = a.textid
  where langid in (1)
)
select /*+NO_MERGE(a_name)*/ *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
    and b.job_textid = a_name.id

| PLAN_TABLE_OUTPUT                                                                     |
| :------------------------------------------------------------------------------------ |
| Plan hash value: 4105667421                                                           |
|                                                                                |
| ------------------------------------------------------------------------------------- |
| | Id  | Operation            | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| ------------------------------------------------------------------------------------- |
| |   0 | SELECT STATEMENT     |              |   101 |   110K|    74   (0)| 00:00:01 | |
| |*  1 |  HASH JOIN           |              |   101 |   110K|    74   (0)| 00:00:01 | |
| |   2 |   TABLE ACCESS FULL  | BIG_TABLE    |    19 | 10279 |     3   (0)| 00:00:01 | |
| |   3 |   VIEW               |              |    64 | 37120 |    71   (0)| 00:00:01 | |
| |*  4 |    HASH JOIN         |              |    64 | 38784 |    71   (0)| 00:00:01 | |
| |   5 |     TABLE ACCESS FULL| ANOTHER_TAB  |    39 |  3042 |     3   (0)| 00:00:01 | |
| |*  6 |     TABLE ACCESS FULL| STRING_TABLE |  1143 |   589K|    68   (0)| 00:00:01 | |
| ------------------------------------------------------------------------------------- |

When you use with subquery twice, optimizer decides to materialize it:

explain plan for
with a as (
  select
    s.textid,
    s.textvalue
  from string_table s
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid
  join a a_job
  on b.job_textid = a_job.textid

| PLAN_TABLE_OUTPUT                                                                                |
| :--------------------------------------------------------------------------------------------------------------------- |
| Plan hash value: 1371454296                                                                                |
|                                                                                |
| ---------------------------------------------------------------------------------------------------------------------- |
| | Id  | Operation                                | Name                      | Rows  | Bytes | Cost (%CPU)| Time     | |
| ---------------------------------------------------------------------------------------------------------------------- |
| |   0 | SELECT STATEMENT                         |                           |    63 | 98973 |    67   (0)| 00:00:01 | |
| |   1 |  TEMP TABLE TRANSFORMATION               |                           |       |       |            |          | |
| |   2 |   LOAD AS SELECT (CURSOR DURATION MEMORY)| SYS_TEMP_0FD9D7224_469C01 |       |       |            |          | |
| |   3 |    TABLE ACCESS BY INDEX ROWID BATCHED   | STRING_TABLE              |   999 |   515K|    22   (0)| 00:00:01 | |
| |*  4 |     INDEX RANGE SCAN                     | IX                        |   999 |       |     4   (0)| 00:00:01 | |
| |*  5 |   HASH JOIN                              |                           |    63 | 98973 |    45   (0)| 00:00:01 | |
| |*  6 |    HASH JOIN                             |                           |    35 | 36960 |    24   (0)| 00:00:01 | |
| |   7 |     TABLE ACCESS FULL                    | BIG_TABLE                 |    19 | 10279 |     3   (0)| 00:00:01 | |
| |   8 |     VIEW                                 |                           |   999 |   502K|    21   (0)| 00:00:01 | |
| |   9 |      TABLE ACCESS FULL                   | SYS_TEMP_0FD9D7224_469C01 |   999 |   502K|    21   (0)| 00:00:01 | |
| |  10 |    VIEW                                  |                           |   999 |   502K|    21   (0)| 00:00:01 | |
| |  11 |     TABLE ACCESS FULL                    | SYS_TEMP_0FD9D7224_469C01 |   999 |   502K|    21   (0)| 00:00:01 | |
| ---------------------------------------------------------------------------------------------------------------------- |

So when there are some indexes on tables inside with subquery they may be used in all above cases: before materialization, when subquery is not merged and when subquery is merged and some idexes provide better query plan on merged subquery (even when those indexes are not used when you execute subquery alone).

What about idexes: if they provide high selectivity (i.e. number of rows retrieved by index is small compared to the overall number of rows), then Oracle will consider to use it. Note, that index access has two steps: read index blocks and then read table blocks that contain rowids found by index. If table size is not much bigger than index size, then Oracle may use table scan instead of index scan even for quite selective predicate (because of doubled IO).

In the below example I've used "small" texts (100 chars) and big_table table of 20 rows and this index for text table:

create index ix
on string_table(langid, textid)

Optimizer decides to use index range scan and read only blocks of the first level (first column of the index):

explain plan for
with a as (
  select
    s.textid,
    s.textvalue
  from string_table s
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid

| PLAN_TABLE_OUTPUT                                                                                |
| :---------------------------------------------------------------------------------------------------- |
| Plan hash value: 1660330381                                                                           |
|                                                                                |
| ----------------------------------------------------------------------------------------------------- |
| | Id  | Operation                            | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| ----------------------------------------------------------------------------------------------------- |
| |   0 | SELECT STATEMENT                     |              |    29 | 31001 |    26   (0)| 00:00:01 | |
| |*  1 |  HASH JOIN                           |              |    29 | 31001 |    26   (0)| 00:00:01 | |
| |   2 |   TABLE ACCESS FULL                  | BIG_TABLE    |    19 | 10279 |     3   (0)| 00:00:01 | |
| |   3 |   TABLE ACCESS BY INDEX ROWID BATCHED| STRING_TABLE |   999 |   515K|    23   (0)| 00:00:01 | |
| |*  4 |    INDEX RANGE SCAN                  | IX           |   999 |       |     4   (0)| 00:00:01 | |
| ----------------------------------------------------------------------------------------------------- |
|                                                                                |
| Predicate Information (identified by operation id):                                                   |
| ---------------------------------------------------                                                   |
|                                                                                |
|    1 - access("B"."NAME_TEXTID"="S"."TEXTID")                                                         |
|    4 - access("LANGID"=1)                                                                             |                                                                      |

But when we reduce the number of rows in big_table, it uses both the columns for index scan:

delete from big_table
where id > 4

explain plan for
with a as (
  select
    s.textid,
    s.textvalue
  from string_table s
  where langid in (1)
)
select *
from big_table b
  join a a_name
  on b.name_textid = a_name.textid

| PLAN_TABLE_OUTPUT                                                                             |
| :-------------------------------------------------------------------------------------------- |
| Plan hash value: 1766926914                                                                   |
|                                                                                |
| --------------------------------------------------------------------------------------------- |
| | Id  | Operation                    | Name         | Rows  | Bytes | Cost (%CPU)| Time     | |
| --------------------------------------------------------------------------------------------- |
| |   0 | SELECT STATEMENT             |              |     6 | 18216 |    11   (0)| 00:00:01 | |
| |   1 |  NESTED LOOPS                |              |     6 | 18216 |    11   (0)| 00:00:01 | |
| |   2 |   NESTED LOOPS               |              |     6 | 18216 |    11   (0)| 00:00:01 | |
| |   3 |    TABLE ACCESS FULL         | BIG_TABLE    |     4 |  4032 |     3   (0)| 00:00:01 | |
| |*  4 |    INDEX RANGE SCAN          | IX           |     1 |       |     1   (0)| 00:00:01 | |
| |   5 |   TABLE ACCESS BY INDEX ROWID| STRING_TABLE |     2 |  4056 |     2   (0)| 00:00:01 | |
| --------------------------------------------------------------------------------------------- |
|                                                                                |
| Predicate Information (identified by operation id):                                           |
| ---------------------------------------------------                                           |
|                                                                                |
|    4 - access("LANGID"=1 AND "B"."NAME_TEXTID"="S"."TEXTID")                                  |
|                                                                                |

You may check above code snippets in the db<>fiddle.


问:
run WCF service vb on IIS express display error when open web config
HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Most likely causes:
•It is possible that a handler mapping is missing. By default, the static file handler processes all content.
•The feature you are trying to use may not be installed.
•The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.)
•If ASP.NET is not installed.

ISS run

答: This error is related to Handler mapping, you need the svc-integrated mapping for the site, in order to make sure this mapping appears you can can try to go to control panel -> turn windows features on or off -> .NET Framework 4.7 Advanced Services (or equiv .net ver) -> WCF Services -> HTTP Activation