问:
Nuxt crashing every few minutes
After upgrading to Nuxt version 2.12.2, I am seeing this every few minutes. The interval seems random, but it happens constantly. The only thing to be done is to restart the server.

```<code>events.js:287
      throw er; // Unhandled 'error' event
      ^

Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (C:\Users\mad\git\balloonary-app\node_modules\@nuxt\builder\node_modules\chokidar\index.js:631:10)
    at ReaddirpStream.NodeFsHandler._boundHandleError (C:\Users\mad\git\balloonary-app\node_modules\@nuxt\builder\node_modules\chokidar\lib\nodefs-handler.js:302:43)
    at ReaddirpStream.emit (events.js:310:20)
    at ReaddirpStream.EventEmitter.emit (domain.js:482:12)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -4082,
  code: 'EBUSY',
  syscall: 'lstat',
  path: 'C:\\hiberfil.sys'
}
[nodemon] app crashed - waiting for file changes before starting...
</code>```

EDIT:

I tried disabling hibernation, like this:

powercfg -h off

and sure enough, no more hiberhil.sys!  So now it crashes with exactly the same message, but referring to pagefile.sys instead :(

Tried running npm run dev as admin, but sadly the issue persists.

I should mention that this issue began when I started using npm run dev rather than nuxt dev to launch the app, but I can't find this "nuxt" CLI tool anywhere now (even though it is referenced everywhere in the docs here https://nuxtjs.org/guide/commands ... I can find no hint as how or where to obtain this tool.)

答:
I disabled hibernation with:

```<code>powercfg -h off
</code>```

while resulted in the same error, but now with pagefile.sys.  So... I disabled virtual memory, too, thusly:

https://www.trishtech.com/2014/11/disable-virtual-memory-in-windows-10/

Now my app seems to be stable.

I find it surprising and bizarre that Nodejs should have any interest in either of these quite low-level system files. Also, where is this mysterious "nuxt" command line utility?  Anyone???

Title: Nuxt crashing every few minutes

Body:
After upgrading to Nuxt version 2.12.2, I am seeing this every few minutes. The interval seems random, but it happens constantly. The only thing to be done is to restart the server.

events.js:287
      throw er; // Unhandled 'error' event
      ^

Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (C:\Users\mad\git\balloonary-app\node_modules\@nuxt\builder\node_modules\chokidar\index.js:631:10)
    at ReaddirpStream.NodeFsHandler._boundHandleError (C:\Users\mad\git\balloonary-app\node_modules\@nuxt\builder\node_modules\chokidar\lib\nodefs-handler.js:302:43)
    at ReaddirpStream.emit (events.js:310:20)
    at ReaddirpStream.EventEmitter.emit (domain.js:482:12)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -4082,
  code: 'EBUSY',
  syscall: 'lstat',
  path: 'C:\\hiberfil.sys'
}
[nodemon] app crashed - waiting for file changes before starting...

EDIT:

I tried disabling hibernation, like this:

powercfg -h off

and sure enough, no more hiberhil.sys!  So now it crashes with exactly the same message, but referring to pagefile.sys instead :(

Tried running npm run dev as admin, but sadly the issue persists.

I should mention that this issue began when I started using npm run dev rather than nuxt dev to launch the app, but I can't find this "nuxt" CLI tool anywhere now (even though it is referenced everywhere in the docs here https://nuxtjs.org/guide/commands ... I can find no hint as how or where to obtain this tool.)

Body:
I disabled hibernation with:

powercfg -h off

while resulted in the same error, but now with pagefile.sys.  So... I disabled virtual memory, too, thusly:

https://www.trishtech.com/2014/11/disable-virtual-memory-in-windows-10/

Now my app seems to be stable.

I find it surprising and bizarre that Nodejs should have any interest in either of these quite low-level system files. Also, where is this mysterious "nuxt" command line utility?  Anyone???


来源: stackexchange

问:
Airflow - xcom_pull in the bigquery operator
I try to use xcomm_pull to insert a data_key_param calculated by the python_operator and pass it to the bigquery_operator. The python operator return the output as string e.g. "2020-05-31".

I got an error when running the BigqueryOperator: "Dependencies Blocking Task From Getting Scheduled" - Could not cast literal "{xcom_pull(task_ids[\'set_date_key_param\'])[0] }"

The sql attribute value returned from the Airflow GUI after task execution:

SELECT DATE_KEY, count(*) as COUNT

FROM my-project.my_datasets.source_table

WHERE DATE_KEY = {{ task_instance.xcom_pull(task_ids='set_date_key_param') }}

GROUP BY DATE_KEY

Code below (I have already treid to use '{{' and '}}' to enclose the task_instance.xcom...):

```<code>def set_date_key_param():

    # a business logic here
    return "2020-05-31" # example results

# task 1

set_date_key_param = PythonOperator(
    task_id='set_date_key_param',
    provide_context=True,
    python_callable=set_date_key_param,
    dag=dag
)

# taks 2

load_data_to_bq_table = BigQueryOperator(
    task_id='load_data_to_bq_table',
    sql="""SELECT DATE_KEY, count(*) as COUNT
    FROM `{project}.{dataset}.source_table`
    WHERE DATE_KEY = {{{{ task_instance.xcom_pull(task_ids='set_date_key_param') }}}}
    GROUP BY DATE_KEY""".format(
        project=PROJECT_ID,
        env=ENV
),
use_legacy_sql=False,
destination_dataset_table="{project}.{dataset}.target_table".format(
    project=PROJECT_ID,
    dataset=BQ_TARGET_DATASET,
),
write_disposition="WRITE_TRUNCATE",
create_disposition="CREATE_NEVER",
trigger_rule='all_success',
dag=dag
</code>```

)

set_date_key_param >> load_data_to_bq_table

答: You named the Python callable and the variable to hold the first Python operator the same: set_date_key_param. Rename the Python callable (e.g. set_date) and change the parameters for the Python operator accordingly.

ContentLicense: CC BY-SA 4.0

Body:
I try to use xcomm_pull to insert a data_key_param calculated by the python_operator and pass it to the bigquery_operator. The python operator return the output as string e.g. "2020-05-31".

I got an error when running the BigqueryOperator: "Dependencies Blocking Task From Getting Scheduled" - Could not cast literal "{xcom_pull(task_ids[\'set_date_key_param\'])[0] }"

The sql attribute value returned from the Airflow GUI after task execution:

SELECT DATE_KEY, count(*) as COUNT

FROM my-project.my_datasets.source_table

WHERE DATE_KEY = {{ task_instance.xcom_pull(task_ids='set_date_key_param') }}

GROUP BY DATE_KEY

Code below (I have already treid to use '{{' and '}}' to enclose the task_instance.xcom...):

def set_date_key_param():

    # a business logic here
    return "2020-05-31" # example results

# task 1

set_date_key_param = PythonOperator(
    task_id='set_date_key_param',
    provide_context=True,
    python_callable=set_date_key_param,
    dag=dag
)

# taks 2

load_data_to_bq_table = BigQueryOperator(
    task_id='load_data_to_bq_table',
    sql="""SELECT DATE_KEY, count(*) as COUNT
    FROM `{project}.{dataset}.source_table`
    WHERE DATE_KEY = {{{{ task_instance.xcom_pull(task_ids='set_date_key_param') }}}}
    GROUP BY DATE_KEY""".format(
        project=PROJECT_ID,
        env=ENV
),
use_legacy_sql=False,
destination_dataset_table="{project}.{dataset}.target_table".format(
    project=PROJECT_ID,
    dataset=BQ_TARGET_DATASET,
),
write_disposition="WRITE_TRUNCATE",
create_disposition="CREATE_NEVER",
trigger_rule='all_success',
dag=dag

)

set_date_key_param >> load_data_to_bq_table


问:
API not get called for already visited pages in dev express datagrid server side pagination
I've created server-side pagination using dev express Datagrid, I'm fetching data properly but I saw that API not getting called if I visit that page again,

Suppose, I visited page 1, page 2 then it fetches data properly, again if I click on page 1 then data displayed in the table is proper but API not getting called.

is it like, it stores all the fetched data or I'm doing wrong somewhere?

答:
[cacheEnabled]="false"

above attribute disables the cache on the dx data grid and calls API in serverside pagination every time you change the page.


问:
Sort document by integer Firestore Kotlin
I want to sort documents by img in descending order.
I've tried to add indexes in firebase console. Here is a screenshot from indexes tab:

Here is my database structure:

Here is my code:

```<code>db.collection("images").whereEqualTo("user", uid).orderBy("img", Query.Direction.DESCENDING).get()
    .addOnSuccessListener {
        if (it.isEmpty) {
            Log.i("Image", "Sorry, no image")
        } else {
            for (task in it) {
                Log.i("Image", task.get("img").toString())
            }
        }
    }
</code>```

And here is log:

```<code>I/Image: 2
I/Image: 1
I/Image: 3
I/Image: 4
I/Image: 6
I/Image: 7
</code>```

What am I doing wrong?

答:
Notice that as stated on the documentation there could be two explanations behind the behavior you are experiencing:

If you have a filter with a range comparison (<, <=, >, >=), your first ordering must be on the same field

You cannot order your query by any field included in an equality (=) or in clause.

Based on the following snippet provided on the documentation:

```<code>citiesRef.whereGreaterThan("population", 100000).orderBy("population").limit(2)
</code>```

You could try the following (but I'm not sure if it'll work because of 2.):

```<code>db.collection("images").whereEqualTo("user", uid).orderBy("user").orderBy("img", Query.Direction.DESCENDING).get()
    .addOnSuccessListener {
        if (it.isEmpty) {
            Log.i("Image", "Sorry, no image")
        } else {
            for (task in it) {
                Log.i("Image", task.get("img").toString())
            }
        }
    }
</code>```

Body:
I want to sort documents by img in descending order.
I've tried to add indexes in firebase console. Here is a screenshot from indexes tab:

Here is my database structure:

Here is my code:

db.collection("images").whereEqualTo("user", uid).orderBy("img", Query.Direction.DESCENDING).get()
    .addOnSuccessListener {
        if (it.isEmpty) {
            Log.i("Image", "Sorry, no image")
        } else {
            for (task in it) {
                Log.i("Image", task.get("img").toString())
            }
        }
    }

And here is log:

I/Image: 2
I/Image: 1
I/Image: 3
I/Image: 4
I/Image: 6
I/Image: 7

What am I doing wrong?

Body:
Notice that as stated on the documentation there could be two explanations behind the behavior you are experiencing:

If you have a filter with a range comparison (<, <=, >, >=), your first ordering must be on the same field

You cannot order your query by any field included in an equality (=) or in clause.

Based on the following snippet provided on the documentation:

citiesRef.whereGreaterThan("population", 100000).orderBy("population").limit(2)

You could try the following (but I'm not sure if it'll work because of 2.):

db.collection("images").whereEqualTo("user", uid).orderBy("user").orderBy("img", Query.Direction.DESCENDING).get()
    .addOnSuccessListener {
        if (it.isEmpty) {
            Log.i("Image", "Sorry, no image")
        } else {
            for (task in it) {
                Log.i("Image", task.get("img").toString())
            }
        }
    }


问:
invalid type argument of unary ‘*’ (have ‘int’) - for implementing a multiplication and exponential operation
I have wrote a program to replace the zeros in a number with 5 with a time complexity of Order of logn N base 10. But cpp implementation make some mistake as show under the code snippet.

Code:

```<code>int convertFive(int n) {
int i = 0, temp = 0;
do{
    if ((n%10) == 0)
        temp = temp+(5*(10**i));
    else
        temp = temp+(n%10*(10**i))
    i++;
    n = n/10;
}while(n/10 != 0);
return temp;
</code>```

Error:

```<code>prog.cpp:24:33: error: invalid type argument of unary ‘*’ (have ‘int’)
         temp = temp+(5*(10**i));
                             ^
prog.cpp:26:36: error: invalid type argument of unary ‘*’ (have ‘int’)
             temp = temp+(n%10*(10**i))
</code>```

答:
There is no ** operator in C++ (You bring ** operator from python3?)
Instead of **, you can use pow function included in math.h cmath header.

double pow(double base, double exponent);

(Ref: http://www.cplusplus.com/reference/cmath/pow/)

And also, there is no semicolon in the 7th line

Body:
I have wrote a program to replace the zeros in a number with 5 with a time complexity of Order of logn N base 10. But cpp implementation make some mistake as show under the code snippet.

Code:

int convertFive(int n) {
int i = 0, temp = 0;
do{
    if ((n%10) == 0)
        temp = temp+(5*(10**i));
    else
        temp = temp+(n%10*(10**i))
    i++;
    n = n/10;
}while(n/10 != 0);
return temp;

Error:

prog.cpp:24:33: error: invalid type argument of unary ‘*’ (have ‘int’)
         temp = temp+(5*(10**i));
                             ^
prog.cpp:26:36: error: invalid type argument of unary ‘*’ (have ‘int’)
             temp = temp+(n%10*(10**i))


问:
Can you install command-line packages in jib docker image?
I need to install command line tools like jq, curl etc in the docker image created by maven jib plugin. How can I achieve this? Any help would be greatly appreciated. Thanks.</p>

答:
As explained in the other answer, using a base image customized with pre-installed tools that rarely change is a good solution.

Alternatively, you may put curl using Jib's <extraDirectories> feature, which enables adding arbitrary files to the target image. Check the Maven and Gradle docs for more details. As explained in the docs, you will also need to configure <permissions> to set executable bits to curl.

If you prefer, you could even set up your Maven or Gradle builds to download curl and unpack it. Here's an example Jib setup (showing both Maven and Gradle) from the Jib repository.


问:
JS apply function to all values of object
I have an object like this:

```<code>const player = {
  id: 123,
  country: 'GB',
  names: {
    key1: 'John Paul',
    key2: 'Johny Paul',
    key3: 'Johny-paul'
  }
}
</code>```

Then I want to apply a function to all names values:

```<code>const normalizeString = el => el.normalize('NFD').replace(/[\u0300-\u036f]/g, "");

const normalizedPlayer = {
    ...player,
    namesNormalized: Object.keys(player.names).map(k => ({[k]: normalizeString(player.names[k])}))
}
</code>```

But I get an array of objects instead of object:

```<code>{
  id: 123,
  country: 'GB',
  names: { key1: 'Jóhn Paul', key2: 'Johny Päul', key3: 'Johny-paul' },
  namesNormalized: [
    { key1: 'John Paul' },
    { key2: 'Johny Paul' },
    { key3: 'Johny paul' }
  ]
}
</code>```

I want namesNormalized like this:

```<code> {
    id: 123,
    country: 'GB',
    names: { key1: 'Jóhn Paul', key2: 'Johny Päul', key3: 'Johny-paul' },
    namesNormalized: {
     key1: 'John Paul',
     key2: 'Johny Paul',
     key3: 'Johny paul'
   }
 }
</code>```

答:
Thanks to @Heretic Monkey to use reduce:</p>

```<code>const player = {
  id: 123,
  country: 'GB',
  names: {
    key1: 'John Paul',
    key2: 'Johny Paul',
    key3: 'Johny-paul'
  }
}

const normalizeString = el => el.normalize('NFD').replace(/[\u0300-\u036f]/g, "");

const normalizedPlayer = {
    ...player,
    namesNormalized: Object.keys(player.names).reduce( (a, k) => ({...a, [k]: normalizeString(player.names[k])}) , {})
}
</code>```

Body:
I have an object like this:

const player = {
  id: 123,
  country: 'GB',
  names: {
    key1: 'John Paul',
    key2: 'Johny Paul',
    key3: 'Johny-paul'
  }
}

Then I want to apply a function to all names values:

const normalizeString = el => el.normalize('NFD').replace(/[\u0300-\u036f]/g, "");

const normalizedPlayer = {
    ...player,
    namesNormalized: Object.keys(player.names).map(k => ({[k]: normalizeString(player.names[k])}))
}

But I get an array of objects instead of object:

{
  id: 123,
  country: 'GB',
  names: { key1: 'Jóhn Paul', key2: 'Johny Päul', key3: 'Johny-paul' },
  namesNormalized: [
    { key1: 'John Paul' },
    { key2: 'Johny Paul' },
    { key3: 'Johny paul' }
  ]
}

I want namesNormalized like this:

 {
    id: 123,
    country: 'GB',
    names: { key1: 'Jóhn Paul', key2: 'Johny Päul', key3: 'Johny-paul' },
    namesNormalized: {
     key1: 'John Paul',
     key2: 'Johny Paul',
     key3: 'Johny paul'
   }
 }

Body:
Thanks to @Heretic Monkey to use reduce:

const player = {
  id: 123,
  country: 'GB',
  names: {
    key1: 'John Paul',
    key2: 'Johny Paul',
    key3: 'Johny-paul'
  }
}

const normalizeString = el => el.normalize('NFD').replace(/[\u0300-\u036f]/g, "");

const normalizedPlayer = {
    ...player,
    namesNormalized: Object.keys(player.names).reduce( (a, k) => ({...a, [k]: normalizeString(player.names[k])}) , {})
}


问:
How can i switch node versions automatically on windows?
I'm using two project (front and back) with different node versions i want to start both at the same time

I'm using nvm-windows and of i switch version it switches node versions globally (nvm use [version])
I tried AVN and as i read it isn't supported on windows yet.

I read a lot about deep shell integration but can't find answer of my question.

答:
You can use nvm (Node Version Manager)
You can follow the below link to install it on windows.
https://github.com/coreybutler/nvm-windows

Hope this helps


问:
Where can I see print output in Flutter?
I am using Android Studio to develop an app with flutter and i need to print things to the console for debugging but i have no idea where to view the output as it doesn't show up in the console. I apologize if this is a stupid question but i am very new to this.</p>

答:
You can use log like this (Run Tab):

```<code>log('data: $data');
</code>```

Or DebugPrint like this (Run Tab):

```<code>debugPrint('yourMessage');
</code>```

Or print like this (Run Tab):

```<code>print("Data");
</code>```

Body:
You can use log like this (Run Tab):

log('data: $data');

Or DebugPrint like this (Run Tab):

debugPrint('yourMessage');

Or print like this (Run Tab):

print("Data");


问:
Apache + passenger or passenger_standalone
I have an environment where my app is running on multiple machines on mongrel and is getting load balanced by Apache. I am switching mongrel to passenger. Would passenger standalone be a better idea or Apache+passenger on every machine? </p>

答: Well, I would say Apache+Passenger is a good choice when you have many different apps on your server and you have to make use of Apache's VirtualHost directive a lot. In case you have only a single app and are trying to balance the load, apache brings a lot of overhead, especially if you have it on every host just for load balancing purposes. You should then consider using nginx with thin which both have a very small memory footprint.</p>

ContentLicense: CC BY-SA 3.0


问:
Miktex suddenly stopped compiling
Anyone know what I can do? It says

Sorry, but "MiKTeX Compiler Driver" did not succeed.

It tells me to check logs, the logs have this:

```<code>2017-11-07 09:24:39,753+0100 INFO  texify - starting with command line:
2017-11-07 09:24:39,775+0100 INFO  texify - running 'initexmf --quiet --update-fndb' to refresh the file name database
2017-11-07 09:24:49,540+0100 INFO  texify - starting with command line:
2017-11-07 09:24:49,558+0100 INFO  texify - running 'initexmf --quiet --update-fndb' to refresh the file name database
2017-11-07 09:27:05,405+0100 INFO  texify - starting with command line:
2017-11-07 09:30:33,755+0100 INFO  texify - starting with command line:
2017-11-07 09:42:15,598+0100 INFO  texify - starting with command line:
2017-11-07 09:43:32,265+0100 INFO  texify - starting with command line:
2017-11-07 09:44:47,048+0100 INFO  texify - starting with command line:
2017-11-07 09:45:48,616+0100 INFO  texify - starting with command line:
2017-11-07 09:46:03,037+0100 INFO  texify - starting with command line:
2017-11-07 09:46:32,470+0100 INFO  texify - starting with command line:
2017-11-07 09:47:20,975+0100 INFO  texify - starting with command line:
2017-11-07 09:48:30,388+0100 INFO  texify - starting with command line:
2017-11-07 09:49:46,624+0100 INFO  texify - starting with command line:
2017-11-07 09:50:18,021+0100 INFO  texify - starting with command line:
2017-11-07 09:50:46,415+0100 INFO  texify - starting with command line:
2017-11-07 09:52:06,725+0100 INFO  texify - starting with command line:
2017-11-07 09:53:55,610+0100 INFO  texify - starting with command line:
2017-11-07 09:54:59,092+0100 INFO  texify - starting with command line:
2017-11-07 09:55:10,054+0100 INFO  texify - starting with command line:
2017-11-07 10:15:47,798+0100 INFO  texify - starting with command line:
2017-11-07 10:16:25,107+0100 INFO  texify - starting with command line:
2017-11-07 10:17:21,929+0100 INFO  texify - starting with command line:
2017-11-07 10:18:43,648+0100 INFO  texify - starting with command line:
2017-11-07 10:19:06,740+0100 INFO  texify - starting with command line:
2017-11-07 10:19:26,582+0100 INFO  texify - starting with command line:
</code>```

答: If you create a new tex file and paste your latex code inside, it should work.</p>

Title: Miktex suddenly stopped compiling

Body:
Anyone know what I can do? It says

Sorry, but "MiKTeX Compiler Driver" did not succeed.

It tells me to check logs, the logs have this:

2017-11-07 09:24:39,753+0100 INFO  texify - starting with command line:
2017-11-07 09:24:39,775+0100 INFO  texify - running 'initexmf --quiet --update-fndb' to refresh the file name database
2017-11-07 09:24:49,540+0100 INFO  texify - starting with command line:
2017-11-07 09:24:49,558+0100 INFO  texify - running 'initexmf --quiet --update-fndb' to refresh the file name database
2017-11-07 09:27:05,405+0100 INFO  texify - starting with command line:
2017-11-07 09:30:33,755+0100 INFO  texify - starting with command line:
2017-11-07 09:42:15,598+0100 INFO  texify - starting with command line:
2017-11-07 09:43:32,265+0100 INFO  texify - starting with command line:
2017-11-07 09:44:47,048+0100 INFO  texify - starting with command line:
2017-11-07 09:45:48,616+0100 INFO  texify - starting with command line:
2017-11-07 09:46:03,037+0100 INFO  texify - starting with command line:
2017-11-07 09:46:32,470+0100 INFO  texify - starting with command line:
2017-11-07 09:47:20,975+0100 INFO  texify - starting with command line:
2017-11-07 09:48:30,388+0100 INFO  texify - starting with command line:
2017-11-07 09:49:46,624+0100 INFO  texify - starting with command line:
2017-11-07 09:50:18,021+0100 INFO  texify - starting with command line:
2017-11-07 09:50:46,415+0100 INFO  texify - starting with command line:
2017-11-07 09:52:06,725+0100 INFO  texify - starting with command line:
2017-11-07 09:53:55,610+0100 INFO  texify - starting with command line:
2017-11-07 09:54:59,092+0100 INFO  texify - starting with command line:
2017-11-07 09:55:10,054+0100 INFO  texify - starting with command line:
2017-11-07 10:15:47,798+0100 INFO  texify - starting with command line:
2017-11-07 10:16:25,107+0100 INFO  texify - starting with command line:
2017-11-07 10:17:21,929+0100 INFO  texify - starting with command line:
2017-11-07 10:18:43,648+0100 INFO  texify - starting with command line:
2017-11-07 10:19:06,740+0100 INFO  texify - starting with command line:
2017-11-07 10:19:26,582+0100 INFO  texify - starting with command line:


问:
Force Chrome to use external font in CSS
It took me a long time to figure out, that Chrome always prefers local installed fonts over a font with the same name that is linked in the css (See also https://stackoverflow.com/a/27704394/1099519). My problem is how to figure out, to force Chrome not to do so.

On my page https://www.amon.cc/ I use "Roboto Light" from Google Fonts (https://fonts.google.com/specimen/Roboto), like this:

```<code><link href="//fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet" type="text/css" />
</code>```

In my CSS file the font is declared like this:

```<code>body{
  ...
  font-family:Roboto,...;
  font-weight:300;
 ....
}
</code>```

Which works perfectly fine in FF, IE, Edge:

But the font is always thicker in Chrome:

The reason: On my private Windows 10 and also on by business computer the font "Roboto" is pre-installed on Windows: Robot Regular, Robot Condensed. But there is no Roboto Thin or Robot Light, so it seems Chrome has a fallback to Roboto Regular.

When deleting the Robot fontset from Windows, Chrome uses the declared web font and displays it the way I want it. I could not figure out, how to "force" Chrome not to use the local installation and instead use the on the CDN.

However, Chrome can display the Roboto font in all different variants on the https://fonts.google.com/specimen/Roboto website (even with my local installed Robot font). I couldn't find out the trick how this has been done.

答:
It took sometime to figure out this mess. This problem occurred to me when I updated chrome.
To solve this problem in my mac. I have opened the font app and delete the Roboto font and reinstalled it from https://www.fontsquirrel.com/fonts/roboto-2014. It has fixed my problem.</p>

Body:
It took me a long time to figure out, that Chrome always prefers local installed fonts over a font with the same name that is linked in the css (See also https://stackoverflow.com/a/27704394/1099519). My problem is how to figure out, to force Chrome not to do so.

On my page https://www.amon.cc/ I use "Roboto Light" from Google Fonts (https://fonts.google.com/specimen/Roboto), like this:

<link href="//fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet" type="text/css" />

In my CSS file the font is declared like this:

body{
  ...
  font-family:Roboto,...;
  font-weight:300;
 ....
}

Which works perfectly fine in FF, IE, Edge:

But the font is always thicker in Chrome:

The reason: On my private Windows 10 and also on by business computer the font "Roboto" is pre-installed on Windows: Robot Regular, Robot Condensed. But there is no Roboto Thin or Robot Light, so it seems Chrome has a fallback to Roboto Regular.

When deleting the Robot fontset from Windows, Chrome uses the declared web font and displays it the way I want it. I could not figure out, how to "force" Chrome not to use the local installation and instead use the on the CDN.

However, Chrome can display the Roboto font in all different variants on the https://fonts.google.com/specimen/Roboto website (even with my local installed Robot font). I couldn't find out the trick how this has been done.


问:
My discord music bot will play music, but when I try to stop it it doesn't work
When I do my play command, my bot works, but when I do my stop command, it gives me a bunch of errors. I am using FFmpeg and discord.js. My code is:

const Discord = require('discord.js');
const bot = new Discord.Client

const ytdl = require("ytdl-core")

const token = 'MY API TOKEN'

const PREFIX = '?';

var version = '1.2';

var servers = {};

bot.on('ready', () => {
  console.log('This bot is online!' + version);
})

bot.on('message', message => {

  let args = message.content.substring(PREFIX.length).split(" ");

  switch (args[0]) {
    case 'play':

      function play(connection, message) {
        var server = servers[message.guild.id];

        server.dispatcher = connection.play(ytdl(server.queue[0], { filter: "audioonly" }))

        server.queue.shift();

        server.dispatcher.on("end", function () {
          if (server.queue[0]) {
            play(connection, message);
          } else {
            connection.disconnect();
          }
        });
      }

      if (!args[1]) {
        message.channel.send("You need to provide a link!")
        return;
      }

      if (!message.member.voice.channel) {
        message.channel.send("You must be in a Voice Channel to play the bot!")
        return;
      }

      if (!servers[message.guild.id]) servers[message.guild.id] = {
        queue: []
      }

      var server = servers[message.guild.id];

      server.queue.push(args[1]);

      if (!message.guild.voice) message.member.voice.channel.join().then(function (connection) {
        play(connection, message);
      })

      break;

    case 'skip':
      var server = servers[message.guild.id]
      if (servers.dispatcher) server.dispatcher.end()
      message.channel.send("Skipping the song...")
      break;

    case 'stop':
      if (message.guild.voice.connection) {
        for (var i = server.queue.length - 1; i >= 0; i--) {
          server.queue.splice(i, 1);
        }

        server.dispatcher.end();
        message.channel.send("Ending the queue leaving the voice channel!")
        console.log('stopped the queue')
      }

      if (message.guild.connection) message.guild.connection.voice.disconnect();
      break;
  }
});

bot.login(token);
```

<p>When I play, it works just fine. But when I stop the music, I get this error:</p>

<pre class="lang-js prettyprint-override"><code>TypeError: Cannot read property 'queue' of undefined
    at Client.<anonymous> (C:\Users\picar\Desktop\DiscordMusicBot\index.js:79:36)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\ws\lib\websocket.js:800:20)
</code>```

答:
case 'stop':
if (message.guild.voice.connection) {

  var server = servers[message.guild.id]; // I think this could be useful

  for (var i = server.queue.length - 1; i >= 0; i--) {
    server.queue.splice(i, 1);
  }

  server.dispatcher.end();
  message.channel.send("Ending the queue leaving the voice channel!")
  console.log('stopped the queue')
}

if (message.guild.connection) message.guild.connection.voice.disconnect();
break;
```

Body:
When I do my play command, my bot works, but when I do my stop command, it gives me a bunch of errors. I am using FFmpeg and discord.js. My code is:

const Discord = require('discord.js');
const bot = new Discord.Client

const ytdl = require("ytdl-core")

const token = 'MY API TOKEN'

const PREFIX = '?';

var version = '1.2';

var servers = {};

bot.on('ready', () => {
  console.log('This bot is online!' + version);
})

bot.on('message', message => {

  let args = message.content.substring(PREFIX.length).split(" ");

  switch (args[0]) {
    case 'play':

      function play(connection, message) {
        var server = servers[message.guild.id];

        server.dispatcher = connection.play(ytdl(server.queue[0], { filter: "audioonly" }))

        server.queue.shift();

        server.dispatcher.on("end", function () {
          if (server.queue[0]) {
            play(connection, message);
          } else {
            connection.disconnect();
          }
        });
      }

      if (!args[1]) {
        message.channel.send("You need to provide a link!")
        return;
      }

      if (!message.member.voice.channel) {
        message.channel.send("You must be in a Voice Channel to play the bot!")
        return;
      }

      if (!servers[message.guild.id]) servers[message.guild.id] = {
        queue: []
      }

      var server = servers[message.guild.id];

      server.queue.push(args[1]);

      if (!message.guild.voice) message.member.voice.channel.join().then(function (connection) {
        play(connection, message);
      })

      break;

    case 'skip':
      var server = servers[message.guild.id]
      if (servers.dispatcher) server.dispatcher.end()
      message.channel.send("Skipping the song...")
      break;

    case 'stop':
      if (message.guild.voice.connection) {
        for (var i = server.queue.length - 1; i >= 0; i--) {
          server.queue.splice(i, 1);
        }

        server.dispatcher.end();
        message.channel.send("Ending the queue leaving the voice channel!")
        console.log('stopped the queue')
      }

      if (message.guild.connection) message.guild.connection.voice.disconnect();
      break;
  }
});

bot.login(token);

When I play, it works just fine. But when I stop the music, I get this error:

TypeError: Cannot read property 'queue' of undefined
    at Client.<anonymous> (C:\Users\picar\Desktop\DiscordMusicBot\index.js:79:36)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\picar\Desktop\DiscordMusicBot\node_modules\ws\lib\websocket.js:800:20)


问:
Firebase - Freeze an account until email is verified
I want to maintain an account disabled until it passes the email verification.

Problem is, as a user registers itself via createUserWithEmailAndPassword, the newly created account is ready to be used.
The only way I can avoid authentication is to check email verification flag via js in client app and deny login, but I don't want to rely on client controls, I'd prefer that firebase itselfs deny the authentication until email is verified.

Is there a way to accomplish this?

答:
You can (and should) also check if the email is verified in the back-end, either:

in security rules, if you're using Firestore, Realtime Database, or Storage

in your own backend code, using a Firebase Admin SDK

When you do this, the client-side check is nothing more than a way to show the correct UI for the current state ("hey there, your email isn't verified yet. Check your inbox, or click here to resend the email"). It's the server-side check that controls access to the data, which is precisely how you want it to be.

This has been covered quite regularly before, so also see:

the Firebase documentation on implementing role-based access control on Firestore

How do I lock down Firebase Database to any user from a specific (email) domain? (for Realtime Database)

Only let pre-verified users log into Firebase


问:
Saving Files c# - without overwriting?
I am saving data to a file every 60 secs, I have it saving every 60 secs ok but it deletes the previous data added. Is there a way in which it would add to the file rather than overwrite it. And without using save dialog as it is done in the background.

Any feedback is greatly appreciated

答:
OK as i am getting your question You are having a File And you want to save new data on that instead of replacing it

You can just open its content using stream reader.and append that data you want to insert on the file
using writer don't save file each time just append data on that file so when you just appending something on that it will not overwrite that file.

Title: Saving Files c# - without overwriting?


问:
CSS background image w/ rotate, repeat and opacity
I am trying to make a nice background with an image but I want the image repeated to fill the screen, with opacity set to 0.5 and it rotated 45 degrees. I have tried a number of things to accomplish this but have had no luck. Anyone have any ideas?

In this Codepen, I have the image rotated and opaque but cannot get background-repeat to work.

.background {
  height: 500px;
  width: 500px;
  position: relative;
  display: inline-block;
  padding: 100px;
  border: black 3px solid;
}

.background::before {
  content: "";
  position: absolute;
  overflow: hidden;
  width: 100px;
  height: 100px;
  left: 0;
  top: 0;
  z-index: -1;
  opacity: 0.5;
  background: url(https://cambridgewords.files.wordpress.com/2019/11/funny.jpg);
  background-size: contain;
  transform: rotate(45deg);
  background-repeat: repeat;
  opacity: 0.5;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><span class='background'>HElloWorld</span></code>```

答:
Try increasing the size of the ::before pseudo-element, and then decreasing the background size like this:

```<code>.background::before {
    content: "";
    position: absolute;
    overflow: hidden;
    width: 100%; /* made width 100% */
    height: 100%; /* made height 100% */
    left: 0;
    top: 0;
    z-index: -1;
    opacity: 0.5;
    background: url(https://cambridgewords.files.wordpress.com/2019/11/funny.jpg);
    background-size: 100px; /* made background size smaller */
    transform: rotate(45deg);
    background-repeat: repeat;
    opacity: 0.5;
}

</code>```

This just makes the background pseudo-element the full size of the element, and then makes the background small and repeating. I hope this helps.

Body:
I am trying to make a nice background with an image but I want the image repeated to fill the screen, with opacity set to 0.5 and it rotated 45 degrees. I have tried a number of things to accomplish this but have had no luck. Anyone have any ideas?

In this Codepen, I have the image rotated and opaque but cannot get background-repeat to work.

.background {
  height: 500px;
  width: 500px;
  position: relative;
  display: inline-block;
  padding: 100px;
  border: black 3px solid;
}

.background::before {
  content: "";
  position: absolute;
  overflow: hidden;
  width: 100px;
  height: 100px;
  left: 0;
  top: 0;
  z-index: -1;
  opacity: 0.5;
  background: url(https://cambridgewords.files.wordpress.com/2019/11/funny.jpg);
  background-size: contain;
  transform: rotate(45deg);
  background-repeat: repeat;
  opacity: 0.5;
}

HElloWorld

Body:
Try increasing the size of the ::before pseudo-element, and then decreasing the background size like this:

.background::before {
    content: "";
    position: absolute;
    overflow: hidden;
    width: 100%; /* made width 100% */
    height: 100%; /* made height 100% */
    left: 0;
    top: 0;
    z-index: -1;
    opacity: 0.5;
    background: url(https://cambridgewords.files.wordpress.com/2019/11/funny.jpg);
    background-size: 100px; /* made background size smaller */
    transform: rotate(45deg);
    background-repeat: repeat;
    opacity: 0.5;
}

This just makes the background pseudo-element the full size of the element, and then makes the background small and repeating. I hope this helps.


问:
Xcode 11 Module AppRegistry is not a registered callable module (calling runApplication)
I recently upgraded (painfully) from react-native 0.59.10 to 0.61.2 and when I build and run thru Xcode 11 the splash screen loads but then errors show up in the console and the app doesn't load.

I've tried:

cd ios && rm -rf Pods && pod cache clean --all && pod install && cd ..

react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

and done another clean install of react-native but to no avail.

package.json

```<code>{
  "name": "my_app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "clean": "react-native-clean-project"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "moment": "^2.22.1",
    "native-base": "^2.12.1",
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-config": "^0.11.5",
    "react-native-clean-project": "^3.2.4",
    "react-native-nfc-manager": "^0.4.2",
    "react-native-pagination": "^1.2.8",
    "react-native-permissions": "^1.2.1",
    "react-native-splash-screen": "^3.2.0",
    "react-navigation": "^1.5.11",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.2.0",
    "scheduler": "^0.16.2",
    "urijs": "^1.19.1"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-native-clean-project": "^3.2.4",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    }
  }
}
</code>```

Podfile

```<code>platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'my_app' do
  use_frameworks!

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  target 'my_appTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
    end
  end
end
</code>```

I expect that my application would load but instead I get the following errors:

```<code>    2019-10-16 10:25:06.379 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Native module cannot be null.
    2019-10-16 10:25:06.381 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Native module cannot be null.
    2019-10-16 10:25:06.388 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
    2019-10-16 10:25:06.390 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
</code>```

答:
With a newer React-Native version(in my case it is 0.62, but I think it will work in 0.61.2 as well) you do not need to put native module pods explicitly in Podfile.

use_native_modules! below your other native libraries. With Pod install this will auto-link the Native Modules from node_modules folder.

Previous Answer is right at its place but, just assume if you have lot of node modules, it can be headache to manually link in Podfile. So, your podfile will look like

```<code>platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'my_app' do
  use_frameworks!

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  ###### This line does the magic here. #######
  use_native_modules!
  ###############################

  target 'my_appTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
    end
  end
end
</code>```

Body:
I recently upgraded (painfully) from react-native 0.59.10 to 0.61.2 and when I build and run thru Xcode 11 the splash screen loads but then errors show up in the console and the app doesn't load.

I've tried:

cd ios && rm -rf Pods && pod cache clean --all && pod install && cd ..

react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

and done another clean install of react-native but to no avail.

package.json

{
  "name": "my_app",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "clean": "react-native-clean-project"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "moment": "^2.22.1",
    "native-base": "^2.12.1",
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-config": "^0.11.5",
    "react-native-clean-project": "^3.2.4",
    "react-native-nfc-manager": "^0.4.2",
    "react-native-pagination": "^1.2.8",
    "react-native-permissions": "^1.2.1",
    "react-native-splash-screen": "^3.2.0",
    "react-navigation": "^1.5.11",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.2.0",
    "scheduler": "^0.16.2",
    "urijs": "^1.19.1"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-native-clean-project": "^3.2.4",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    }
  }
}

Podfile

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'my_app' do
  use_frameworks!

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  target 'my_appTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
    end
  end
end

I expect that my application would load but instead I get the following errors:

    2019-10-16 10:25:06.379 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Native module cannot be null.
    2019-10-16 10:25:06.381 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Native module cannot be null.
    2019-10-16 10:25:06.388 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
    2019-10-16 10:25:06.390 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

Body:
With a newer React-Native version(in my case it is 0.62, but I think it will work in 0.61.2 as well) you do not need to put native module pods explicitly in Podfile.

use_native_modules! below your other native libraries. With Pod install this will auto-link the Native Modules from node_modules folder.

Previous Answer is right at its place but, just assume if you have lot of node modules, it can be headache to manually link in Podfile. So, your podfile will look like

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'my_app' do
  use_frameworks!

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  ###### This line does the magic here. #######
  use_native_modules!
  ###############################

  target 'my_appTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
    end
  end
end


问:
How to deal with C++ header file #include errors in VS Code on Mac?
VS Code on my Mac yields #include errors for header files and third-party libraries (wxWidgets in this case). I read everything I could find, adjusted "includePath" settings in "c_cpp_properties.json", but nothing helps.

Header files are located in the same folder as .cpp files ("/src/"). The project builds and runs nicely, but VS Code yields #include errors and error squiggles cover my entire project.

Below is the screenshot and a JSON file with VS Code settings.

#include error screenshot

c_cpp_properties.json:

```<code>{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/src",
                "${workspaceFolder}/**",
                "/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}
</code>```

Please help me straighten this out.

————— UPDATE —————

I was recommended to use the following settings in c_cpp_properties.json:

```<code>{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "${vcpkgRoot}/x64-osx/include",
                "/usr/local/Cellar/wxmac/3.0.5/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}
</code>```

Header file #include errors are gone, but the third-party library ("WX") errors persist. In the JSON above, there is the line "${vcpkgRoot}/x64-osx/include" written in the "includePath".

This is the vcpkg package which helps install third-party libraries easily.

After installing vcpkg, I installed wxWidgets via vcpkg, but the library isn't linking in VS Code (builds just fine though) and I get error squiggles as shown on the screenshot below:

Could you please explain how to straighten it out?

答:
On the includePath property add ** to the end of your directories path:

```<code>...
"includePath": [
    "${workspaceFolder}/src/**",
    "${workspaceFolder}/**",
    "/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0/**"
 ],
</code>```

You can look form more details about c_cpp_properties.json on the documentation

Body:
VS Code on my Mac yields #include errors for header files and third-party libraries (wxWidgets in this case). I read everything I could find, adjusted "includePath" settings in "c_cpp_properties.json", but nothing helps.

Header files are located in the same folder as .cpp files ("/src/"). The project builds and runs nicely, but VS Code yields #include errors and error squiggles cover my entire project.

Below is the screenshot and a JSON file with VS Code settings.

#include error screenshot

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/src",
                "${workspaceFolder}/**",
                "/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

Please help me straighten this out.

————— UPDATE —————

I was recommended to use the following settings in c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "${vcpkgRoot}/x64-osx/include",
                "/usr/local/Cellar/wxmac/3.0.5/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

Header file #include errors are gone, but the third-party library ("WX") errors persist. In the JSON above, there is the line "${vcpkgRoot}/x64-osx/include" written in the "includePath".

This is the vcpkg package which helps install third-party libraries easily.

After installing vcpkg, I installed wxWidgets via vcpkg, but the library isn't linking in VS Code (builds just fine though) and I get error squiggles as shown on the screenshot below:

Could you please explain how to straighten it out?

Body:
On the includePath property add ** to the end of your directories path:

...
"includePath": [
    "${workspaceFolder}/src/**",
    "${workspaceFolder}/**",
    "/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0/**"
 ],

You can look form more details about c_cpp_properties.json on the documentation


问:
when sharing a redirect url (response code 302) on linkedin, shared content has the redirected url (response code- 200)
From my app I want to share contents on linkedin with a redirect url this is because when request comes from linkedinbot I want it to redirect to a different page from where it can gets all the meta tags, but if it comes from browser I want to show a different page(an iframe) for users.
For example:-
I want to share the below link "https://example.com/something/1000/redirect" after sharing the above link on linkedin the content have the following href "https://example.com/something/1000/social" which I don't want instead I want the same redirect url as  href on the content.

Everything is working fine for facebook and twitter

答:
Typically, you do not want to do any type of redirecting for search engines, or they may mistinterpret your redirection as abuse.  Take a look at the Google Ads Policy...

The following is not allowed:

Not allowed Engaging in practices that attempt to circumvent or interfere with Google's advertising systems and processes

Example 1: Cloaking (showing different content to certain users, including Google, than to other users)...

So, you may have metadata stored in og: tags, oEmbed pages, rdf format, dc: dublin core tags, or actually plain simple metadata HTML tags.

Why would you want to show one set of this information to the user and another set to the search engine?  What harm does it do to have the user see what the search engine sees, and vice versa?


问:
Haskell elem function's Big O runtime
What is the Big O runtime of Haskell's elem function?</p>

答: It is O(n) since it has to check all of the items.</p>

Title: Haskell elem function's Big O runtime


问:
Best way to test FileNotFound handling
I'm relatively new to testing and still getting my head around some of the fundamentals. I have a method that I would like to test which basically creates a different file name if the supplied already exists (I've pasted the code below).

I need a way of testing that the method returns a different (but also unique) name if the file already exists. What's the best way of testing this within Visual Studio's unit testing? Is it to create a file as part of the test and then delete it or is there a better way?

```<code>public static FileInfo SafeFileName(this FileInfo value)
{
    if (value == null) throw new ArgumentNullException("value");

    FileInfo fi = value;

    //Check the directory exists -if it doesn't create it as we won't move out of this dir
    if (!fi.Directory.Exists)
        fi.Directory.Create();

    //It does so create a new name
    int counter = 1;
    string pathStub = Path.Combine(fi.Directory.FullName, fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length));

    // Keep renaming it until we have a safe filename
    while (fi.Exists)
        fi = new FileInfo(String.Concat(pathStub, "_", counter++, fi.Extension));

    return fi;
}
</code>```

答: Use File.Exists Method.</p>

Title: Best way to test FileNotFound handling

Body:
I'm relatively new to testing and still getting my head around some of the fundamentals. I have a method that I would like to test which basically creates a different file name if the supplied already exists (I've pasted the code below).

I need a way of testing that the method returns a different (but also unique) name if the file already exists. What's the best way of testing this within Visual Studio's unit testing? Is it to create a file as part of the test and then delete it or is there a better way?

public static FileInfo SafeFileName(this FileInfo value)
{
    if (value == null) throw new ArgumentNullException("value");

    FileInfo fi = value;

    //Check the directory exists -if it doesn't create it as we won't move out of this dir
    if (!fi.Directory.Exists)
        fi.Directory.Create();

    //It does so create a new name
    int counter = 1;
    string pathStub = Path.Combine(fi.Directory.FullName, fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length));

    // Keep renaming it until we have a safe filename
    while (fi.Exists)
        fi = new FileInfo(String.Concat(pathStub, "_", counter++, fi.Extension));

    return fi;
}

Body: Use File.Exists Method.


问:
HTTP POST request with raw body to ORDS PL/SQL Gateway?
I am using Oracle Database 12.2 and ORDS 18.3. Is it possible to make an HTTP POST request with a raw body (no parameters using application/x-www-form-urlencoded or multipart/form-data) to ORDS, knowing that ORDS is used only for its PL/SQL Gateway part, not the REST Data Services part.

In this scenario, ORDS in standalone mode (with Jetty) is the HTTP server. The HTTP client that makes the request is some external program (Postman, Java, ...).

The idea is to send JSON data but it could be binary data like an image or something else.

It looks like the PL/SQL Gateway is "only" able to invoke procedures using parameters (or no parameter at all but also of course no body). I am able to make a request with a dummy parameter in multipart form and somehow simulate what I want (tested with VARCHAR2, not CLOB nor BLOB) but I wanted to know if the possibility exists.

答:
There are a couple ORDS-specific bind variables (implicit parameters) that you can use.

:body will return a BLOB. This can be used for anything, including images

:body_text will return a CLOB. This is useful for text bodies such as JSON, XML, or the other MIME types you indicated (application/x-www-form-urlencoded or multipart/form-data)

NOTE: You can only dereference the :body or :body_text parameter once in your PL/SQL block (as indicated by this documentation), so you may need to assign it to a local variable before using it.


问:
Conditional sum on multiple pandas groups, each defined by a set of overlapping column values
I'm trying to perform a conditional sum on groups of rows defined by a list of arbitrary column values. By conditional sum, I mean sum values in one column only if the value in a second column is above a threshold. There can be overlap among the groups and the number of elements in each group can be different.

For example, given the following dataframe:

data = {
   'id': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
   'counter': [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
   'output': [5, 10, 15, 20, 25, 35, 20, 15, 10, 5]
}
df = pd.DataFrame(data)
```
```>>> df
   id  counter  output
0   1       10       5
1   2        9      10
2   3        8      15
3   4        7      20
4   5        6      25
5   6        5      35
6   7        4      20
7   8        3      15
8   9        2      10
9  10        1       5
```
<p>And the following inputs (I'm flexible if we need to change their format):</p>
<pre class="lang-py prettyprint-override"><code>group_ids = {'Group A': [1, 2, 3, 4], 'Group B': [6, 7, 8, 9], 'Group C': [4, 5, 6]}
output_threshold = 12
</code>```

I would like to generate the following new dataframe, which is the sum of counter for each group defined by the list of group_ids only if output exceeds the specified output_threshold. Bonus points if I can add the title to each of these groups:

```<code>title    sum
Group A   15
Group B   12
Group C   18
</code>```

答:
Working within dictionaries and rebuilding the dataframe could work as well : </p>

```<code>from collections import defaultdict
from itertools import product
d = defaultdict(list)

#get the product of M and group_ids
for entry, groups in product(M,group_ids.items()):
    #pass in the condition
    if entry['id'] in groups[-1] and entry['output'] > output_threshold:
        #extract relevant counter value
        d[groups[0]].append(entry['counter'])

#sum the list values
d = {k:sum(v) for k,v in d.items()}

#create dataframe
res = pd.DataFrame.from_dict(d,orient='index',columns=['Total'])

res

            Total
Group A     15
Group C     18
Group B     12
</code>```

Body:
I'm trying to perform a conditional sum on groups of rows defined by a list of arbitrary column values. By conditional sum, I mean sum values in one column only if the value in a second column is above a threshold. There can be overlap among the groups and the number of elements in each group can be different.

For example, given the following dataframe:

data = {
   'id': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
   'counter': [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
   'output': [5, 10, 15, 20, 25, 35, 20, 15, 10, 5]
}
df = pd.DataFrame(data)

>>> df
   id  counter  output
0   1       10       5
1   2        9      10
2   3        8      15
3   4        7      20
4   5        6      25
5   6        5      35
6   7        4      20
7   8        3      15
8   9        2      10
9  10        1       5

And the following inputs (I'm flexible if we need to change their format):

group_ids = {'Group A': [1, 2, 3, 4], 'Group B': [6, 7, 8, 9], 'Group C': [4, 5, 6]}
output_threshold = 12

I would like to generate the following new dataframe, which is the sum of counter for each group defined by the list of group_ids only if output exceeds the specified output_threshold. Bonus points if I can add the title to each of these groups:

title    sum
Group A   15
Group B   12
Group C   18

Body:
Working within dictionaries and rebuilding the dataframe could work as well :

from collections import defaultdict
from itertools import product
d = defaultdict(list)

#get the product of M and group_ids
for entry, groups in product(M,group_ids.items()):
    #pass in the condition
    if entry['id'] in groups[-1] and entry['output'] > output_threshold:
        #extract relevant counter value
        d[groups[0]].append(entry['counter'])

#sum the list values
d = {k:sum(v) for k,v in d.items()}

#create dataframe
res = pd.DataFrame.from_dict(d,orient='index',columns=['Total'])

res

            Total
Group A     15
Group C     18
Group B     12


答:
You can do it like below:

.background {
  height: 500px;
  width: 500px;
  position: relative;
  z-index:0;
  display: inline-block;
  overflow:hidden; /* hide the overflow here not on the pseudo element */
  padding: 100px;
  border: black 3px solid;
}

.background::before {
  content: "";
  position: absolute;
  z-index: -1;
  /* 141% ~ sqrt(2)x100% to make sure to cover all the area after the rotation */
  width: 141%;
  height:141%;
  /**/
  /* to center*/
  left: 50%;
  top: 50%;
  /* */
  background: url(https://cambridgewords.files.wordpress.com/2019/11/funny.jpg);
  background-size: 100px 100px; /* size of the image*/
  transform:translate(-50%,-50%) rotate(45deg); /* center the element then rotate */
  opacity: 0.5;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><span class='background'>
    HElloWorld
  </span></code>```

Title: CSS background image w/ rotate, repeat and opacity

Body:
You can do it like below:

.background {
  height: 500px;
  width: 500px;
  position: relative;
  z-index:0;
  display: inline-block;
  overflow:hidden; /* hide the overflow here not on the pseudo element */
  padding: 100px;
  border: black 3px solid;
}

.background::before {
  content: "";
  position: absolute;
  z-index: -1;
  /* 141% ~ sqrt(2)x100% to make sure to cover all the area after the rotation */
  width: 141%;
  height:141%;
  /**/
  /* to center*/
  left: 50%;
  top: 50%;
  /* */
  background: url(https://cambridgewords.files.wordpress.com/2019/11/funny.jpg);
  background-size: 100px 100px; /* size of the image*/
  transform:translate(-50%,-50%) rotate(45deg); /* center the element then rotate */
  opacity: 0.5;
}

<span class='background'>
    HElloWorld
  </span>


问:
Easier way to count users in T-SQL
I'm using this query in SQL Server 2016 to determine how many users have logged into my system.

The users.lastaccess column contains a unix timestamp, so I use DATEDIFF() to convert it to a yyyy-mm-dd hh:mm:ss date.

```<code>SELECT
    COUNT(*) AS user_logins
FROM
    (SELECT
         ROW_NUMBER() OVER(ORDER BY lastaccess DESC) AS Row
     FROM
         users
     WHERE
         lastaccess > DATEDIFF(s, '1970-01-01 02:00:00', (SELECT Convert(DateTime, DATEDIFF(DAY, 0, GETDATE()))))
)
</code>```

The result is a simple number, e.g. 75, representing the number of users who have been authenticated on the system.

答:
Why do you need a correlated subquery and a ROW_NUMBER() windowing function at all? And what is that oddball date-based WHERE clause? What are you really checking for - the fact that last_access is not null/empty??

Just use:

```<code>SELECT
    COUNT(*) AS user_logins
FROM
    dbo.users
WHERE
    -- your WHERE condition isn't very clear - please add code as needed
    -- but *DO NOT* convert dates to string to compare! Compare proper dates!
    lastaccess IS NOT NULL
</code>```

Also: if you have a non-nullable, narrow, fixed-width column in your dbo.Users table, you should have a nonclustered index on this (e.g. on lastaccess - is that column nullable?) - that could speed things up quite a bit

Title: Easier way to count users in T-SQL

Body:
I'm using this query in SQL Server 2016 to determine how many users have logged into my system.

The users.lastaccess column contains a unix timestamp, so I use DATEDIFF() to convert it to a yyyy-mm-dd hh:mm:ss date.

SELECT
    COUNT(*) AS user_logins
FROM
    (SELECT
         ROW_NUMBER() OVER(ORDER BY lastaccess DESC) AS Row
     FROM
         users
     WHERE
         lastaccess > DATEDIFF(s, '1970-01-01 02:00:00', (SELECT Convert(DateTime, DATEDIFF(DAY, 0, GETDATE()))))
)

The result is a simple number, e.g. 75, representing the number of users who have been authenticated on the system.

Body:
Why do you need a correlated subquery and a ROW_NUMBER() windowing function at all? And what is that oddball date-based WHERE clause? What are you really checking for - the fact that last_access is not null/empty??

Just use:

SELECT
    COUNT(*) AS user_logins
FROM
    dbo.users
WHERE
    -- your WHERE condition isn't very clear - please add code as needed
    -- but *DO NOT* convert dates to string to compare! Compare proper dates!
    lastaccess IS NOT NULL

Also: if you have a non-nullable, narrow, fixed-width column in your dbo.Users table, you should have a nonclustered index on this (e.g. on lastaccess - is that column nullable?) - that could speed things up quite a bit


问:
Finished with non-zero exit value 1
Problem Solved:

Re-installed Java and got

    java.lang.OutOfMemoryError: GC overhead limit exceeded

Added the following within the android block in gradle and it worked

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }

Thank you everyone!

----------------------------------------------------------------------------

I'm getting a java error when I try to run an app that has both facebook and paypal sdk as dependencies. It works fine when I comment the facebook sdk dependency on gradle, but I need facebook login to work for my application too. Please help.

```<code>dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.facebook.android:facebook-android-sdk:4.8.2'
compile files('libs/PayPalAndroidSDK-2.12.1.jar')
compile files('libs/httpcore-4.4.3.jar')
compile files('libs/httpclient-4.5.1.jar')
}
</code>```

The error message:

```<code>Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable830Library UP-TO-DATE
:app:prepareOrgLucasrTwowayviewTwowayview014Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex
:app:shrinkDebugMultiDexComponents
:app:createDebugMainDexClassList
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
    at com.android.dx.command.dexer.Main.processClass(Main.java:752)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
    at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
    at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:672)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
    at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
    at com.android.dx.command.dexer.Main.run(Main.java:275)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic     (cafebabe) or version (0034.0000)
    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
    at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
    at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
    at com.android.dx.command.dexer.Main.processClass(Main.java:749)
... 12 more
1 error; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:    org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 39.781 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
</code>```

答: if you have two classes or variables with the same name except in first caracter (for me one starts with a capital letter) this will cause the problem if you're using java 1.8 </p>

Title: Finished with non-zero exit value 1

Body:
Problem Solved:

Re-installed Java and got

    java.lang.OutOfMemoryError: GC overhead limit exceeded

Added the following within the android block in gradle and it worked

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }

Thank you everyone!

----------------------------------------------------------------------------

I'm getting a java error when I try to run an app that has both facebook and paypal sdk as dependencies. It works fine when I comment the facebook sdk dependency on gradle, but I need facebook login to work for my application too. Please help.

dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.facebook.android:facebook-android-sdk:4.8.2'
compile files('libs/PayPalAndroidSDK-2.12.1.jar')
compile files('libs/httpcore-4.4.3.jar')
compile files('libs/httpclient-4.5.1.jar')
}

The error message:

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable830Library UP-TO-DATE
:app:prepareOrgLucasrTwowayviewTwowayview014Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex
:app:shrinkDebugMultiDexComponents
:app:createDebugMainDexClassList
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
    at com.android.dx.command.dexer.Main.processClass(Main.java:752)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
    at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
    at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:672)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
    at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
    at com.android.dx.command.dexer.Main.run(Main.java:275)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic     (cafebabe) or version (0034.0000)
    at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
    at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
    at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
    at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
    at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
    at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
    at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
    at com.android.dx.command.dexer.Main.processClass(Main.java:749)
... 12 more
1 error; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException:    org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 39.781 secs
Information:1 error
Information:0 warnings
Information:See complete output in console


问:
Gradle download sources failed
I'm using Gradle build tool and I can't get the source code and docs for spark-core.
I've already searched and applied:

```<code>idea {
    project {
        jdkName = '1.8'
        languageLevel = '1.8'
    }
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}
</code>```

But it still doesn't work for me. I suppose I'm missing something like rebuild the whole project or download just these pieces.

I applied ./gradlew cleanIdea idea as well.

When I try to click with pressed command on SparkConf.class I press Download Sources I get Sources not found for: org.apache.spark:spark-core_2.12:2.4.5

And the result from the run tab:

```<code>21:11:29: Executing task 'DownloadSources'...

:DownloadSources FAILED

BUILD FAILED

Total time: 0.124 secs

FAILURE: Build failed with an exception.

* Where:
Initialization script '/private/var/folders/06/97bzw1l51r59l65thfzs7hd80000gn/T/ijmiscinit1.gradle' line: 14

* What went wrong:
Execution failed for task ':DownloadSources'.
> Could not resolve all dependencies for configuration ':downloadSourcesFrom_MavenRepo_91653a2f-0439-4794-b77a-3812f9926728'.
   > java.lang.NullPointerException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
21:11:29: Task execution finished 'DownloadSources'.
</code>```

Here is 2 pretty long task outputs:

DownloadSources --info: https://pastebin.com/D07JmGXT

DownloadSources --stacktrace: https://pastebin.com/6ceKhwrk

Idea.log https://pastebin.com/EQcDxPwb

Latest public Intellij build: 2020.1.1 installed via Toolbox
Latest MacOS: 10.15.4
Java 1.8 jdk-8u251-macosx-x64.dmg, downloaded from oracle.com

Could you please help me to realize what should I do to fix it?

答:
The problem belongs to Scala plugin.
If you face this issue, it doesn't matter on build tool you are using Maven or Gradle probably installation of the Scala plugin solves your problem.

My Intellij report: https://intellij-support.jetbrains.com/hc/en-us/requests/2686145

Well-known bug: https://youtrack.jetbrains.com/issue/IDEA-127193

Title: Gradle download sources failed

Body:
I'm using Gradle build tool and I can't get the source code and docs for spark-core.
I've already searched and applied:

idea {
    project {
        jdkName = '1.8'
        languageLevel = '1.8'
    }
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}

But it still doesn't work for me. I suppose I'm missing something like rebuild the whole project or download just these pieces.

I applied ./gradlew cleanIdea idea as well.

When I try to click with pressed command on SparkConf.class I press Download Sources I get Sources not found for: org.apache.spark:spark-core_2.12:2.4.5

And the result from the run tab:

21:11:29: Executing task 'DownloadSources'...

:DownloadSources FAILED

BUILD FAILED

Total time: 0.124 secs

FAILURE: Build failed with an exception.

* Where:
Initialization script '/private/var/folders/06/97bzw1l51r59l65thfzs7hd80000gn/T/ijmiscinit1.gradle' line: 14

* What went wrong:
Execution failed for task ':DownloadSources'.
> Could not resolve all dependencies for configuration ':downloadSourcesFrom_MavenRepo_91653a2f-0439-4794-b77a-3812f9926728'.
   > java.lang.NullPointerException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
21:11:29: Task execution finished 'DownloadSources'.

Here is 2 pretty long task outputs:

DownloadSources --info: https://pastebin.com/D07JmGXT

DownloadSources --stacktrace: https://pastebin.com/6ceKhwrk

Idea.log https://pastebin.com/EQcDxPwb

Latest public Intellij build: 2020.1.1 installed via Toolbox
Latest MacOS: 10.15.4
Java 1.8 jdk-8u251-macosx-x64.dmg, downloaded from oracle.com

Could you please help me to realize what should I do to fix it?


问:
How do I display the return statement with this occurring error?
Just learned what a return statement is and trying to practice with it, but for some reasons it is saying my innerHTML is null?

var x = my_Function(20, 3);

function my_Function(a, b) {
    return a * b;
}
document.getElementById("return").innerHTML = x;
  ```
<pre class="snippet-code-html lang-html prettyprint-override"><code><p id="return" onload="my_Function()"></p></code>```

答: I should have posted where I placed the script source. All the answers you provided worked, but my script was in the head. I moved it to the bottom of the body and it worked fine.</p>


问:
'UnicodeString' was not declared in this scope
I can't compile php-intl (php - 5.5.9, ubuntu - 14.04, icu - 67)

when I try pecl install intl, the following error appears

```<code>In file included from /tmp/pear/temp/intl/intl_convertcpp.cpp:21:0:
/tmp/pear/temp/intl/intl_convertcpp.h:28:25: error: 'UnicodeString' was not declared in this scope
 int intl_stringFromChar(UnicodeString &ret, char *str, int32_t str_len, UErrorCode *status);
                         ^~~~~~~~~~~~~
/tmp/pear/temp/intl/intl_convertcpp.h:28:25: note: suggested alternative:
In file included from /tmp/pear/temp/intl/intl_convertcpp.h:26:0,
                 from /tmp/pear/temp/intl/intl_convertcpp.cpp:21:
/opt/icu67/include/unicode/unistr.h:294:20: note:   'icu_67::UnicodeString'
 class U_COMMON_API UnicodeString : public Replaceable
                    ^~~~~~~~~~~~~
</code>```

Please tell me how to overcome this error

Or some other way to update the icu databases, because apt-get puts a very old database.

答: Use icu_67::UnicodeString instead of UnicodeString and your problem is fixed.</p>

Body:
I can't compile php-intl (php - 5.5.9, ubuntu - 14.04, icu - 67)

when I try pecl install intl, the following error appears

In file included from /tmp/pear/temp/intl/intl_convertcpp.cpp:21:0:
/tmp/pear/temp/intl/intl_convertcpp.h:28:25: error: 'UnicodeString' was not declared in this scope
 int intl_stringFromChar(UnicodeString &ret, char *str, int32_t str_len, UErrorCode *status);
                         ^~~~~~~~~~~~~
/tmp/pear/temp/intl/intl_convertcpp.h:28:25: note: suggested alternative:
In file included from /tmp/pear/temp/intl/intl_convertcpp.h:26:0,
                 from /tmp/pear/temp/intl/intl_convertcpp.cpp:21:
/opt/icu67/include/unicode/unistr.h:294:20: note:   'icu_67::UnicodeString'
 class U_COMMON_API UnicodeString : public Replaceable
                    ^~~~~~~~~~~~~

Please tell me how to overcome this error

Or some other way to update the icu databases, because apt-get puts a very old database.