text:
Q: Get index columns total size To get primary key columns total size, (not index size itself, so SELECT pg_table_size(indexrelid) FROM pg_index WHERE .. is not solution in this case), I'm using dynamic query like this:
DO $$
    DECLARE
    v_query TEXT;
    v_result BIGINT;
BEGIN
    SELECT 'SELECT COALESCE( SUM( pg_column_size('||string_agg(a.attname::TEXT, ')+pg_column_size(')||') ), 0) FROM '||'public.my_test'
    FROM   pg_index i
    JOIN   pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey)
    WHERE  i.indrelid = (SELECT 'public.my_test'::regclass::oid)
    AND    i.indisprimary
    INTO v_query;

    EXECUTE v_query INTO v_result;
    raise notice '%', v_result;
END; $$ LANGUAGE PLPGSQL

Is there any way to do same, without PLPGSQL/dynamic query, but suing straight SQL?


text:
Q: DROP COLUMN FAMILY from cassandra CLI will not drop the CF We tried to drop CF's using cassandra cli
DROP COLUMN FAMILY cfName

And when we list the CF from CLI it was not there and when i tried to get the existing CF's via hector
I still could see the CF name
   KeyspaceDefinition keyspaceDefinition = newConnection().describeKeyspace(keyspaceName);
    keyspaceDefinition.getCfDefs();

Data inside the CF is not there however, the CF is still listed, after listing the CFs via hector if i do a cassandra -cli list column families i can see my deleted CF again

A: I had to deal with this issue back on Cassandra 1.1 as well.  Basically, my column family had become corrupted, and the only way to alter its schema, was to drop/restore the keyspace (which DataStax walked me through, at the time).
If you have a support contract with DataStax, I would HIGHLY recommend contacting them before proceeding.  The first thing they'll tell you, is that this is a bug in specific versions of Cassandra 1.1, and that you should upgrade.  I haven't tested it, but according to them an in-place upgrade would allow you to modify your schema in the new version.  So you might be able to fix this by upgrading to 1.2 or 2.0.
In my case (production, enterprise environment) upgrading on-the-spot was not an option.  To fix this, I basically had to drop my entire keyspace, re-create it (and my column families), and recover from a snapshot.  I loosely followed the instructions found here:

*

*Take a snapshot of the keyspace on each node.  The snapshot files should be stored in the [keyspaceName]/snapshots dir, but I copied mine to another non-Cassandra location just to be on the safe side.

*DROP your keyspace.

*Stop all nodes.

*On each node, delete the .db files in the keyspace directory (but not the snapshot dir).

*Copy the files from the snapshot directory back into the keyspace directory.

*Restart one node

*From that node's cassandra-cli re-create your keyspace.

*Verify that your data is there.

*Restart the remaining nodes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Expand HTML5 canvas to the whole document I am making an multiplayer game using the HTML5 canvas element.
At this moment I expand the canvas to the whole window with this javascript code:
var WIDTH = window.innerWidth;
var HEIGHT = window.innerHeight;
var canvas =document.getElementById("gameCanvas");
canvas.width = WIDTH;
canvas.height = HEIGHT;

Using the code above the canvas will occupy the whole document space and it will have WIDTH px on the xx axis and HEIGHT px on the yy axis and this is not really what I want because some players with higher resolution will have a more expansive view of the game map than members with lower resolutions.
Question: Is there anyway to expand the canvas to the whole document and keep a fixed number of "canvas pixels" on each axis independent of the user's screen resolution?
Thanks!

A: You can use the canvas function scale() or scale the canvas via css.
This would be an example of implementing a solution with the canvas function:
var canvas = document.getElementById("gameCanvas");
var ctx = canvas.getContext("2d");
var WIDTH = window.innerWidth;
var HEIGHT = window.innerHeight;
var x = WIDTH/c.width;
var y = HEIGHT/c.height;

c.width=WIDTH;
c.height=HEIGHT;

ctx.scale(x,y);
ctx.strokeRect(5, 5, 140, 140);


text:
Q: using a batch to copy single file into subfolders and their subfolders and so on I'm curious if that task a have to perform is achievable by using a batch.
I have to copy a single file into multiple subfolder which have also subfolders the file has to be copied to as well.
Using a batch, the input would look something like this:
@echo off
for /d %%a in ("C:\\Users\\thomas\\Desktop\\Battest\*.\*") do xcopy /y /d C:\\Users\\thomas\\Desktop\\Battest\\indextest.php "%%a"

This would only copy the index.php into the first subfolder, which are directly on the next level.
Since the index.php needs to be copied into 700 folders and I don't know all the concrete directory paths, I'm not sure how to handle this using a wildcard or if this task is even achievable like this.
I've tried to utilize a batch to copy a single file into multiple subfolders, which path I don't know. So far I just managed to copy the file onto the 1st subfolders.
Here is the cmd output to show the directional structure. You can see that there is an index.php in every folder which needs to be replaced (I didn't specify that before. sorry):
C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists>dir
 Datenträger in Laufwerk C: ist Windows
 Volumeseriennummer: 3C59-5A60

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.03.2022  07:53    <DIR>          01_Sealing Guide
25.03.2022  07:54    <DIR>          02_Precast Concrete Plant Catalogue
25.03.2022  07:54    <DIR>          03_Structural and Civil Engineering Catalogue
25.03.2022  07:54    <DIR>          04_Price list
25.03.2022  07:54    <DIR>          05_Press Releases
25.03.2022  07:54    <DIR>          06_News
25.03.2022  07:54    <DIR>          07_Consulting Catalogue
23.03.2022  16:26             3.627 index.php
               1 Datei(en),          3.627 Bytes
               9 Verzeichnis(se), 343.890.636.800 Bytes frei

C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists>dir /s
 Datenträger in Laufwerk C: ist Windows
 Volumeseriennummer: 3C59-5A60

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.03.2022  07:53    <DIR>          01_Sealing Guide
25.03.2022  07:54    <DIR>          02_Precast Concrete Plant Catalogue
25.03.2022  07:54    <DIR>          03_Structural and Civil Engineering Catalogue
25.03.2022  07:54    <DIR>          04_Price list
25.03.2022  07:54    <DIR>          05_Press Releases
25.03.2022  07:54    <DIR>          06_News
25.03.2022  07:54    <DIR>          07_Consulting Catalogue
23.03.2022  16:26             3.627 index.php
               1 Datei(en),          3.627 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\01_Sealing Guide

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
25.03.2022  07:53    <DIR>          English
25.03.2022  07:53    <DIR>          French
25.03.2022  07:53    <DIR>          German
23.03.2022  16:26             3.627 index.php
25.03.2022  07:53    <DIR>          Russian
25.03.2022  07:53    <DIR>          Spanish
               1 Datei(en),          3.627 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\01_Sealing Guide\English

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
02.10.2020  14:14         2.393.613 BTi_Catalogue_Sealing Guide_EN_2020-09.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      2.395.719 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\01_Sealing Guide\French

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
07.05.2021  08:53         2.997.413 BTi_Sealing Guide_FR_2020-09.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      2.999.519 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\01_Sealing Guide\German

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
17.06.2021  09:27         2.872.797 BTi_Abdichtungsguide_DE_2020-09.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      2.874.903 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\01_Sealing Guide\Russian

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
07.05.2021  08:42         3.039.947 BTi_Руководство по герметизации_RU_09-2020.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      3.042.053 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\01_Sealing Guide\Spanish

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
13.12.2021  11:34         3.560.598 BTi_Katalog_Abdichtung_ES_2021-12_web.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      3.562.704 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\02_Precast Concrete Plant Catalogue

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.03.2022  07:53    <DIR>          English
25.03.2022  07:53    <DIR>          French
25.03.2022  07:54    <DIR>          German
23.03.2022  16:26             3.627 index.php
25.03.2022  07:54    <DIR>          Polish
25.03.2022  07:54    <DIR>          Russian
25.03.2022  07:54    <DIR>          Spanish
               1 Datei(en),          3.627 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\02_Precast Concrete Plant Catalogue\English

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
07.10.2020  08:27         9.967.701 BTi_Catalogue_Precast Concrete Plant_EN_2020-09.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      9.969.807 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\02_Precast Concrete Plant Catalogue\French

25.03.2022  07:53    <DIR>          .
25.03.2022  07:53    <DIR>          ..
10.07.2020  15:01         9.737.367 BTi_Catalogue_Precast Concrete Plant_FR_2020_07.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      9.739.473 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\02_Precast Concrete Plant Catalogue\German

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
10.07.2020  12:34        10.145.406 BTi_Katalog_Betonfertigteilwerk_DE_2020-07.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),     10.147.512 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\02_Precast Concrete Plant Catalogue\Polish

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
10.07.2020  15:35        10.116.783 BTi_Catalogue_Precast Concrete Plant_PL_2020-07.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),     10.118.889 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\02_Precast Concrete Plant Catalogue\Russian

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
11.08.2020  07:53         5.882.519 BTi_Catalogue_Precast Concret Plant_RU_2020-07_web.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      5.884.625 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\02_Precast Concrete Plant Catalogue\Spanish

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
10.07.2020  14:24         9.857.478 BTi_Catalogue_Structural and Civil Engineering_ES_2020-07.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      9.859.584 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\03_Structural and Civil Engineering Catalogue

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.03.2022  07:54    <DIR>          English
25.03.2022  07:54    <DIR>          French
25.03.2022  07:54    <DIR>          German
23.03.2022  16:26             3.627 index.php
25.03.2022  07:54    <DIR>          Russian
25.03.2022  07:54    <DIR>          Spanish
               1 Datei(en),          3.627 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\03_Structural and Civil Engineering Catalogue\English

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
26.07.2019  12:49         7.243.746 BTi_Catalogue_Structural and Civil Engineering_EN_2019-07.pdf
28.04.2021  15:43             2.106 index.php
11.12.2019  08:36               283 Web_Version.url
               3 Datei(en),      7.246.135 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\03_Structural and Civil Engineering Catalogue\French

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.09.2019  09:04         5.916.375 BTi_Catalogue_Structural and Civil Engineering_FR_2019-09.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      5.918.481 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\03_Structural and Civil Engineering Catalogue\German

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.07.2019  08:46         7.284.669 BTi_Katalog_Produktkatalog Hoch- und Tiefbau_DE_2019-07.pdf
16.11.2021  16:09        12.879.830 BTi_Katalog_Schalungstechnik_Syflex_DE_2021-11.pdf
28.04.2021  15:43             2.106 index.php
11.12.2019  08:34               267 Web-Version.url
               4 Datei(en),     20.166.872 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\03_Structural and Civil Engineering Catalogue\Russian

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
11.08.2020  07:54         3.245.824 BTi_Catalogue_Structural and Civil Engineering_RU_2019-11_web.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      3.247.930 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\03_Structural and Civil Engineering Catalogue\Spanish

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
27.03.2020  13:00         7.493.352 BTi_Catalogue_Structural and Civil Engineering_ES_2020-03.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      7.495.458 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\04_Price list

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
23.03.2022  16:26             3.627 index.php
               1 Datei(en),          3.627 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\05_Press Releases

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.03.2022  07:54    <DIR>          English
25.03.2022  07:54    <DIR>          French
25.03.2022  07:54    <DIR>          German
23.03.2022  16:26             3.627 index.php
25.03.2022  07:54    <DIR>          Russian
25.03.2022  07:54    <DIR>          Spanish
               1 Datei(en),          3.627 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\05_Press Releases\English

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
26.04.2021  09:02        11.764.334 BTi_Press Kit_EN_2021-04.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),     11.766.440 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\05_Press Releases\French

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
26.04.2021  10:11         8.163.842 BTi_Dossier de presse_FR_2021-04.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      8.165.948 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\05_Press Releases\German

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
30.03.2021  12:46           585.743 30 Jahre B.T innovation_de.pdf
04.03.2021  09:38        12.443.367 BTi_Pressemappe_DE_2021-03.pdf
28.04.2021  15:43             2.106 index.php
               3 Datei(en),     13.031.216 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\05_Press Releases\Russian

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
26.04.2021  09:42         7.846.420 BTi_Press Kit_RU_2021-04.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      7.848.526 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\05_Press Releases\Spanish

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
26.04.2021  10:05         7.596.592 BTi_Kit de prensa_SP_2021-04.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),      7.598.698 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\06_News

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
08.06.2021  14:06           461.634 BTi_Important Information Regarding Prises and Offers 06-08-2021.pdf
23.03.2021  08:59           328.846 BTi_Price Increase for MultiForm starting 04-01-2021.pdf
23.03.2021  09:00           320.885 BTi_Price increase for shuttering magnets starting 05-01-2021.pdf
23.03.2022  16:26             3.627 index.php
07.03.2022  12:20           368.344 Price Increase BT-Spannschloss® (Turnbuckle) - BT innovation.pdf
31.01.2022  15:40           493.366 Price increase for RubberElast - BT innovation.pdf
25.01.2022  08:13           112.744 Price Increase GRP Products - BT innovation.pdf
               7 Datei(en),      2.089.446 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\07_Consulting Catalogue

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.03.2022  07:54    <DIR>          English
25.03.2022  07:54    <DIR>          German
23.03.2022  16:26             3.627 index.php
25.03.2022  07:54    <DIR>          Russian
               1 Datei(en),          3.627 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\07_Consulting Catalogue\English

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
24.11.2021  11:27        14.069.238 BTi_Catalogue_Consulting_EN_2021-10_web.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),     14.071.344 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\07_Consulting Catalogue\German

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.11.2021  13:37        14.651.703 BTi_Produktkatalog_consulting_DE_2021-10_Web.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),     14.653.809 Bytes

 Verzeichnis von C:\Users\thomasb\Desktop\01_General Catalogues and Price Lists\07_Consulting Catalogue\Russian

25.03.2022  07:54    <DIR>          .
25.03.2022  07:54    <DIR>          ..
25.11.2021  09:10        11.576.341 BTi_Catalogue_Consulting_RU_web.pdf
28.04.2021  15:43             2.106 index.php
               2 Datei(en),     11.578.447 Bytes

     Anzahl der angezeigten Dateien:
              66 Datei(en),    205.498.927 Bytes
              95 Verzeichnis(se), 343.888.109.568 Bytes frei

A: Can't you do that with forfiles? Something like (not tested):
FORFILES /C "cmd /c if @isdir==TRUE xcopy /y /d C:\Users\...\indextest.php @path"

A: for /r "C:\Users\thomas\Desktop\Battest" %%a in (.) do if /i "%%~dpa" neq "C:\Users\thomas\Desktop\Battest\" ECHO xcopy /y /d C:\Users\thomas\Desktop\Battest\indextest.php "%%a"

Should echo the copy command for each subdirectory of the directory nominated after the /r.
Obviously, remove the echo keyword after verification to actually execute the xcopy.
See for /? from the prompt for details.

A: Depending on the exact scenario, there are several possibilities:

*

*(Re-)Placing file indextest.php in immediate children of root directory %UserProfile%\Desktop\Battest:
 for /D %%J in ("%UserProfile%\Desktop\Battest\*") do (
     xcopy /Y /D "%UserProfile%\Desktop\Battest\indextest.php" "%%~J"
 )

*(Re-)Placing file indextest.php in grand-children of root directory %UserProfile%\Desktop\Battest:
 for /D %%J in ("%UserProfile%\Desktop\Battest\*") do (
     for /D %%I in ("%%~J\*") do (
         xcopy /Y /D "%UserProfile%\Desktop\Battest\indextest.php" "%%~I"
     )
 )

*(Re-)Placing file indextest.php in children and grand-children of root directory %UserProfile%\Desktop\Battest:
 for /D %%J in ("%UserProfile%\Desktop\Battest\*") do (
     xcopy /Y /D "%UserProfile%\Desktop\Battest\indextest.php" "%%~J"
     for /D %%I in ("%%~J\*") do (
         xcopy /Y /D "%UserProfile%\Desktop\Battest\indextest.php" "%%~I"
     )
 )

*(Re-)Placing file indextest.php in all descendants of root directory %UserProfile%\Desktop\Battest:
 for /D /R "%UserProfile%\Desktop\Battest" %%J in (*) do (
     xcopy /Y /D "%UserProfile%\Desktop\Battest\indextest.php" "%%~J"
 )

You may replace the command xcopy /Y /D with replace /U in order to avoid addition of file indextest.php in sub-directories that do not yet contain such.


text:
Q: Convert resultset from mysql to a dataframe causing delay Using RMySql library in R, My code builds connection with MySql. Executes SQL query. Pulls records in a resultset and than converts resultset to dataframe. This conversion of result set to dataframe is taking 12 secs.
Is there any alternative in R to do this operation ?
I have tried the following methods:
fetch()
dbfetch()

both take 12 secs.
Following is the code that I am trying.
con <-  dbConnect(MySQL(),user=user, password=pw,dbname=db,host=host, port=3306)
s <- paste0("select * from ", tableName)
rs <- dbSendQuery(con, s)
df <-  dbFetch(rs, n = -1)


text:
Q: Get most distant number php i want to have the most distant number but i can only find the function max in php manuals.
Example:
$1 = -0.25%
$2 =  0.45%
$3 = -1.25%
$4 =  1.15%

I want the $3 number because it has the most distant from 0...
when you use the max function i get $4 but that is not what i want, does anyone have a good solution for this or do i have to make a function ?
I dont know what to write but i get the error that its not good enough what i wrote here
$test1 = "-0.25%";
$test2 =  "0.45%";
$test3 = "-1.25%";
$test4 =  "1.15%";

$arrayprices = array($test1, $test2, $test3, $test4);

$min = min($arrayprices);
$max = max($arrayprices);

$result = abs($min) > abs($max) ? $min : $max;
echo $result;

answer: 1.15% but it should be -1.25

A: before using max on all your values!
abs($yourvaluehere)

A: $array = array(-0.25, 0.45, -1.25, 1.15);
$min = min($array);
$max = max($array);
$result = abs($min) > abs($max) ? $min : $max;
echo $result;


text:
Q: Convert Regular expression to mask-input - Javascript I am trying to convert regular expression format into a mask-input string to guide the user to enter the correct input on the UI. Numbers would be represented by "#" and letter by "A".
Basically,
      "^\d{3}$"                        -->    "###"
      "^(GB)\d{3}$"                    -->    "GB###"
      "^\d{2}\.\d{3}\/\d{4}-\d{2}$"    -->    "##.###/####-##"
      "^\d{2}[ ]\d{3}[ ]\d{3}$"        -->    "## ### ###"

function convertToMaskInput(regex){
}
convertToMaskInput("^\d{4}$");
//Output: "####"

I am beginner to Javascript and I am having hard time to do this dynamically. Any help or guidance is appreciated.
Thanks in advance!

A: If your goal is to handle every possible variant of regular expression, you should probably use an existing plugin rather than rolling your own solution.
However, for the sake of completeness, here is an implementation that can deal with the subset of cases you gave as examples:

function convertToMaskInput(regex) {
  return new RegExp(regex).source
    .replace(/^\^|\$$/g, '')
    .replace(/\\d/g, '#')
    .replace(/\(([^)]*)\)|\[([^^])\]|\\([\\/.(){}[\]])/g, '$1$2$3')
    .replace(/([\w#.-])\{(\d+)\}/gi, function (_, c, n) {
        return Array(+n + 1).join(c)
    })
}

convertToMaskInput("^\d{4}$")

console.log([
  /^\d{3}$/, //=> "###"
  /^(GB)\d{3}$/, //=> "GB###"
  /^\d{2}\.\d{3}\/\d{4}-\d{2}$/, //=> "##.###/####-##"
  /^\d{2}[ ]\d{3}[ ]\d{3}$/ //=> "## ### ###"
].map(convertToMaskInput))


text:
Q: String HTML in android I have a string html , and in it i cant change font size & font type just,  I can change font color. how can use special font type & size in it .
<![CDATA[
       Title

  text

        ]]>

A: You can set the color, size and typeface like this:
<![CDATA[
  title

text

]]>


text:
Q: DATEDIFF function in the boundary conditions problem Could anyone help me understand the following, the result of date difference in year is 0,
but I think result should be 1 based on the condition, since the DATEADD function would return 2015-12-31, and it is greater than @ToDate 2015-01-01.
here is the link for the article, the first example
https://sqlhints.com/2015/07/10/how-to-get-difference-between-two-dates-in-years-months-and-days-in-sql-server/
DECLARE @FromDate DATETIME = '2014-12-31',
        @ToDate DATETIME = '2015-01-01'
SELECT @FromDate 'From Date', @ToDate 'To Date',
 DATEDIFF(YEAR, @FromDate, @ToDate)
   -
 (CASE
   WHEN DATEADD(YEAR,
           DATEDIFF(YEAR, @FromDate,@ToDate), @FromDate)
       > @ToDate THEN 1
         ELSE 0 END) 'Date difference in Years'

RESULT:
enter image description here

A: This pretty obviously returns 0 to me:

*

*DATEDIFF(YEAR, @FromDate, @ToDate) --> 1

*DATEADD(YEAR, DATEDIFF(YEAR, @FromDate,@ToDate), @FromDate) --> '2015-12-31'

*The CASE then returns 1
So, 1-1 = 0.


text:
Q: Ajuda com Stack, para criar modelo conforme exemplo Bom dia Pessoal!
Estou aprendendo Flutter, e encontrei um problema para construir este modelo da imagem a seguir:

Row(children: [
      Stack(children: [
         Container(
            width: 400.0,
            height: 200.0,
            decoration: BoxDecoration(
               color: Colors.black12,
            ),
            child: Row(
               children: [
                  Padding(
                     padding: const EdgeInsets.all(5.0),
                     child: Image.network(
                        'https://cdn.awsli.com.br/600x450/44/44273/produto/29984101/9437f2984e.jpg',
                        width: 180,
                     ),
                  ),
                  Positioned(
                     child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                           Text("Camiseta"),
                           Text("Roupas"),
                           Text("R\$25,00"),
                        ],
                     ),
                  ),
                  Positioned(
                     child: FloatingActionButton(
                        foregroundColor: Colors.white,
                        backgroundColor: Colors.red[600],
                        child: Icon(Icons.plus_one), onPressed: () {},
                     ),
                  ),
               ],
            ),
         ),
      ])
   ])

No meu resultado, mesmo colocando as propriedades nas widgets Pisitioned, não consigo deixar os textos e botões onde gostaria. Segue meu resuldado:

A: Vou deixar aqui um exemplo para você entender e daí você troca os Widgets de acordo com o que precisa.
Você está fazendo o uso errado do Stack e Positioned, para que o Positioned funcione ele precisa estar diretamente dentro do Stack.
Segue o exemplo:

import 'package:flutter/material.dart';

final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      height: 200,
      child: Row(
      children: [
        Container(
          width: 150,
          height: 200,
          child: Stack(
            children: [
              Container(
                margin: EdgeInsets.only(right: 20),
                color: Colors.grey[100],
                child: Center(
                  child: Icon(Icons.picture_in_picture_alt, size: 50, color: Colors.grey)
                )
              ),
              Positioned(
                right: 0,
                bottom: 20,
                child: Container(
                  height: 50,
                  width: 50,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    color: Colors.red
                  ),
                  child: Center(
                    child: Icon(Icons.add)
                  )
                )
              )
            ]
          ),
        ),
        Container(
          child: Column(
            children: [
              Text("Moletom",
                style: TextStyle(
                  color: Colors.black
                )
              ),
              Text("Roupas",
                style: TextStyle(
                  color: Colors.black
                )
              ),
              Text("R\$ 50,00",
                style: TextStyle(
                  color: Colors.red
                )
              ),

            ]
          )
        )
      ],
        )
    );
  }
}

Você pode rodar esse exemplo no DartPad

A: Você não está usando a Stack, todos os seus widgets estão dentro de Row e não da Stack, por isso o FloatingActionButton não esta sobreposto, todos os widget estão um do lado do outro.
E dentro do Positioned falou informar as posicões dele.
Tente algo mais ou menos assim:
_body() {
    return Row(children: [
      Stack(children: [
        Container(
          width: 400.0,
          height: 200.0,
          decoration: BoxDecoration(
            color: Colors.black12,
          ),
          child: Row(
            children: [
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: Image.network(
                  'https://cdn.awsli.com.br/600x450/44/44273/produto/29984101/9437f2984e.jpg',
                  width: 180,
                ),
              ),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text("Camiseta"),
                  Text("Roupas"),
                  Text("R\$25,00"),
                ],
              ),
            ],
          ),
        ),
        Positioned(
          bottom: MediaQuery.of(context).size.height / 2, // para posicionar em relacao a tela
          left: MediaQuery.of(context).size.width / 2, // para posicionar em relacao a tela
          child: FloatingActionButton(
            foregroundColor: Colors.white,
            backgroundColor: Colors.red[600],
            child: Icon(Icons.plus_one),
            onPressed: () {},
          ),
        ),
      ])
    ]);
  }


text:
Q: OpenCL directories declared invalid after using them once I have a strange problem with my OpenCL project. When I add the directories to the compiler(compiler is Dev-C++) it works at first. Problem is if I close Dev-C++ and open it up again all the directories are declared invalid. If I delete them and add them again they seem to work. Why is this happening. Here is my code if it helps:
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights   reserved.
//
// A minimalist OpenCL program.
#include <CL/cl.h>
#include <CL/cl.hpp>
#include <stdio.h>
#include <CL/cl_ext.h>
#define NWITEMS 512

// A simple memset kernel
const char *source =
  "__kernel void memset( __global uint *dst ) \n"
  "{ \n"
  " dst[get_global_id(0)] = get_global_id(0); \n"
  "} \n";
int main(int argc, char ** argv, global_work_size)
{
  // 1. Get a platform.
  cl_platform_id platform;
  clGetPlatformIDs( 1, &platform, NULL );
  // 2. Find a gpu device.
  cl_device_id device;
  clGetDeviceIDs( platform, CL_DEVICE_TYPE_GPU,
          1,
          &device,
          NULL);
  // 3. Create a context and command queue on that device.
  cl_context context = clCreateContext( NULL,
                    1,
                    &device,
                    NULL, NULL, NULL);
  cl_command_queue queue = clCreateCommandQueue( context,
                         device,
                         0, NULL );
  // 4. Perform runtime source compilation, and obtain kernel entry point.
  cl_program program = clCreateProgramWithSource( context,
                          1,
                          &source,
                          NULL, NULL );
  clBuildProgram( program, 1, &device, NULL, NULL, NULL );
  cl_kernel kernel = clCreateKernel( program, "memset", NULL );
  // 5. Create a data buffer.
  cl_mem buffer = clCreateBuffer( context,
                  CL_MEM_WRITE_ONLY, ...);

  // 6. Launch the kernel. Let OpenCL pick the local work size.

  size_t KERNEL_WORK_GROUP_SIZE = NWITEMS;
  clSetKernelArg(kernel, 0, sizeof(buffer), (void*) &buffer);
  clEnqueueNDRangeKernel( queue,
              kernel,
              1,
              NULL,
              &global_work_size,
              NULL, 0, NULL, NULL);
  clFinish( queue );
  // 7. Look at the results via synchronous buffer map.
  cl_uint *ptr;
  ptr = (cl_uint *) clEnqueueMapBuffer( queue,
                    buffer,
                    CL_TRUE,
                    CL_MAP_READ,
                    0,
                    NWITEMS * sizeof(cl_uint),
                    0, NULL, NULL, NULL );
  int i;

  for(i=0; i < NWITEMS; i++)
    printf("%d %d\n", i, ptr[i]);

  return(0);
}


text:
Q: Android: How do I call startResolutionForResult from a Service? I'm trying to add GPS tracking functionality to my app by writing a GPS tracking Service. I've been following the Android Developer materials on how to do this via Google Play Services, but I'm stuck on the onConnectionFailed method. I'm trying to call startResolutionForResult to let Google Play Services handle the error. However this method requires that an activity be passed in as the first parameter, and since I'm calling it from a Service I'm not really sure what I should do.
I assume that I'm going about this all wrong and there's a completely different way to handle this from a service.

A: The authentication process for Google Play Services needs an activity since it may need to display UI to the user.  Since services don't have UI, you need to send a message to an activity to set up the connection, then the service can continue.  There is a good answer demonstrating one way to do this here: Example: Communication between Activity and Service using Messaging

A: You can use Status.getResolution() and start Activity with it. For example:
In Service
PendingIntent pI = status.getResolution();
mGoogleApiClient.getContext().startActivity(new Intent(mGoogleApiClient.getContext(), SomeActivity.class)
.putExtra("resolution", pI).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));

In Activity onCreate:
PendingIntent pI = (PendingIntent) (getIntent().getParcelableExtra("resolution"));
startIntentSenderForResult(pI.getIntentSender(),1,null,0,0,0);

also add onActivityResult(int requestCode, int resultCode, Intent data) to receive result of resolution


text:
Q: Selecting the MAX value from a subquery of three tables I am trying to select the SECTION,LAST_MDS_MON,DAYS_BETWEEN where the LAST_MDS_MON is MAX for a distinct SECTION, from the query below...PLEASE HELP!
SELECT STATE_CODE||SHRP_ID AS SECTION,MAX(SURVEY_DATE) AS LAST_MDS_MON,((ADD_MONTHS(CURRENT_DATE,18))-TO_DATE(MAX(SURVEY_DATE))) AS DAYS_BETWEEN
FROM MON_DIS_AC_REV
GROUP BY STATE_CODE,SHRP_ID
UNION ALL
SELECT STATE_CODE||SHRP_ID AS SECTION,MAX(SURVEY_DATE) AS LAST_MDS_MON,((ADD_MONTHS(CURRENT_DATE,18))-TO_DATE(MAX(SURVEY_DATE))) AS DAYS_BETWEEN
FROM MON_DIS_JPCC_REV
GROUP BY STATE_CODE,SHRP_ID
UNION ALL
SELECT STATE_CODE||SHRP_ID AS SECTION,MAX(SURVEY_DATE) AS LAST_MDS_MON,((ADD_MONTHS(CURRENT_DATE,18))-TO_DATE(MAX(SURVEY_DATE))) AS DAYS_BETWEEN
FROM MON_DIS_CRCP_REV
GROUP BY STATE_CODE,SHRP_ID

A: SELECT
  SECTION,
  LAST_MDS_MON,
  DAYS_BETWEEN
FROM
  (
  SELECT
    SECTION,
    LAST_MDS_MON,
    DAYS_BETWEEN,
    RANK() OVER (PARTITION BY SECTION ORDER BY LAST_MDS_MON desc) AS RANK
  FROM
    (
    SELECT STATE_CODE||SHRP_ID AS SECTION,MAX(SURVEY_DATE) AS LAST_MDS_MON,((ADD_MONTHS(CURRENT_DATE,18))-TO_DATE(MAX(SURVEY_DATE))) AS DAYS_BETWEEN
    FROM MON_DIS_AC_REV
    GROUP BY STATE_CODE,SHRP_ID
    UNION ALL
    SELECT STATE_CODE||SHRP_ID AS SECTION,MAX(SURVEY_DATE) AS LAST_MDS_MON,((ADD_MONTHS(CURRENT_DATE,18))-TO_DATE(MAX(SURVEY_DATE))) AS DAYS_BETWEEN
    FROM MON_DIS_JPCC_REV
    GROUP BY STATE_CODE,SHRP_ID
    UNION ALL
    SELECT STATE_CODE||SHRP_ID AS SECTION,MAX(SURVEY_DATE) AS LAST_MDS_MON,((ADD_MONTHS(CURRENT_DATE,18))-TO_DATE(MAX(SURVEY_DATE))) AS DAYS_BETWEEN
    FROM MON_DIS_CRCP_REV
    GROUP BY STATE_CODE,SHRP_ID
    )
  )
WHERE
  RANK = 1


text:
Q: Editing validation summary using c# I want to create a custom validation summary so that I can edit the default rendering of asp:ValidationSummary with links  to the specific error fields (somewhat like WET).
my Custom Class:
    using System;
    using System.ComponentModel;
    using System.Security;
    using System.Security.Permissions;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    [assembly: TagPrefix("Web.Boew", "wet")]
     namespace Wet.Boew
      {

    [
        ToolboxData("<{0}:CustomValidationSummary CssClass='label label-danger' ID='ValidationSummary' runat=\"server\"></{0}:CustomValidationSummary>")
    ]
    public class CustomValidationSummary : System.Web.UI.WebControls.ValidationSummary
    {
        [
            Browsable(true),
            Category("Appearance"),
            DefaultValue(""),
            Description("Validation Summary.")
        ]

        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "label label-danger");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderBeginTag(HtmlTextWriterTag.Ul);
            // Call the base class's Render method.
            base.Render(writer);

            foreach (BaseValidator v in Page.Validators)
            {
                //base.Render(writer);

                var o = v.FindControl(v.ControlToValidate);
                if (o != null && v.ValidationGroup.Equals(this.ValidationGroup))
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Li);
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "#" + o.ClientID);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(o.ToString());
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }
            }
            writer.RenderEndTag();
            writer.RenderEndTag();

        }
    }
}

Tag:
    <wet:CustomValidationSummary ID="ValidationSummary2" runat="server"
      ValidationGroup="Registration" HeaderText="Following errors occured:" />

Rendered HTML:

What is happening:
if you see the image above. When the page is loaded it gets pre-loaded with list of System.Web.UI.WebControls.TextBox which is clickable to textfield. which is correct. But when I press submit I see the errors list above as generated by base.Render(writer).
What I want:
I want to edit the list generated by base.Render(writer). and edit its HTML to include links to the text fields which have errors. if any one can help sorry I am new to asp and C#.
Final Output I Desire:


text:
Q: Getting Memory metrics in Apache Ignite I am using Apache Ignite 2.8.0. Actually now i am getting memory metrics by the following(Using Java thick client),
    ClusterGroup remoteGroup = ignite.cluster().forRemotes();
    ClusterMetrics metrics = remoteGroup.metrics();

Is there any way to get the Memory metrics by Python or Java thin client?

A: It is not supported currently by thin clients, so you will have to gather this information using thick client or server node.
Then you can store it somewhere (in e.g. cache) to be accessible by thin clients too.


text:
Q: Formatting phone numbers with dropdownlist I'm new to php and i wanna format mobile phone numbers... thing is i have a dropdown box that contains dial code and I have another box that a user would input his/her mobile number. I wanna do the following...

*

*Check for and remove the leading '+'

*Check for and remove the leading '0'

*Check for and remove the dialing code if it is the same with dial code in dropdown.

*Append the selected dial code at the beginning of the string...

Here is my code... Seems to work fine but somehow it removes the last digit if user enters a number starting with '0'
$phNo = $_POST['RegPhone'];

if (substr($phNo, 0, 1) == "+") {
    $phNo = ltrim($phNo, '+');
}

if (substr($phNo, 0, 1) == "0")  {
    $phNo = ltrim($phNo, '0');
}

if (substr($phNo, 0, strlen($_POST['RegDialCode'])) == $_POST['RegDialCode'])  {
    $phNo = ltrim($phNo, $_POST['RegDialCode']);
}

$phNo = $_POST['RegDialCode']. $phNo;

A: $phNo = $_POST['RegPhone'];

$phNo = str_replace("+", "", $phNo);  // Find + and replace if present

if (strpos($ph, '0') == 0)  {   // check if 0 found and it at first postition
    $phNo = ltrim($phNo, '0');
}

if (substr($phNo, 0, strlen($_POST['RegDialCode'])) == $_POST['RegDialCode'])  {
    $phNo = ltrim($phNo, $_POST['RegDialCode']);
}

$phNo = $_POST['RegDialCode']. $phNo;


text:
Q: Align text to top of header using fancyhdr I'm trying to get the left heading to appear at the top left corner of the header, but I cannot seem to get it moved there. How can this be achieved using fancyhdr? I tried updating
\lhead{\textbf{Citation:}}

to
\lhead{\textbf{Citation:} \vfill}

With no success (among many other unsuccessful attempts)
\documentclass{article}
\usepackage{lipsum}
\usepackage{layout}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage[showframe]{geometry}

%\setlength{\hoffset}{}
\setlength{\oddsidemargin}{0pt}
\setlength{\hoffset}{-.41in}
\setlength{\textwidth}{7.52in}
\setlength{\marginparsep}{3in}
\setlength{\headsep}{\baselineskip}
\setlength{\headheight}{1in}
\setlength{\topmargin}{0pt}
\setlength{\voffset}{-.5in}

\pagestyle{fancy}

%HEADING TO SHIFT TO TOP
\lhead{\textbf{Citation:}}
\rhead{Page \thepage of \pageref{LastPage}}

\begin{document}
    \lipsum[1-2]
\end{document}

Thanks!

A: A simple  \parbox, specifying it height, will do the job. Since you load the package, I converted your layout specifications to geometry as well as I could (the horizontal parameters are  inconsistent: are you sure you want a \marginparsepof 3 inches?):
\documentclass{article}
\usepackage{lipsum}
\usepackage{layout}
\usepackage{fancyhdr}
\usepackage{lastpage}

\usepackage[headheight = 1in, headsep = \baselineskip, top = 1.5in, , left = 0.59in, textwidth = 7.52 in, showframe]{geometry}
\pagestyle{fancy}

%HEADING TO SHIFT TO TOP
\lhead{ \parbox[][\headheight][t]{2cm}{\textbf{Citation:}}}
\rhead{\parbox[][\headheight][b]{2cm}{\raggedleft Page\,\thepage{} of \pageref{LastPage}}}

\begin{document}

    \lipsum

\end{document}

A: Since you want to leave the baseline in place, use \raisebox.
Note, if you add too much space, fancyhdr will increase \headheight, possibly every page.
\documentclass{article}
\usepackage{lipsum}
\usepackage{layout}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage[showframe]{geometry}

%\setlength{\hoffset}{}
\setlength{\oddsidemargin}{0pt}
\setlength{\hoffset}{-.41in}
\setlength{\textwidth}{7.52in}
\setlength{\marginparsep}{3in}
\setlength{\headsep}{\normalbaselineskip}% \baselineskip changes depending on the font size
\setlength{\headheight}{1in}
\setlength{\topmargin}{0pt}
\setlength{\voffset}{-.5in}

\pagestyle{fancy}

%HEADING TO SHIFT TO TOP
\lhead{\raisebox{\dimexpr \headheight-\baselineskip}{\textbf{Citation:}}}
\rhead{Page \thepage~of \pageref{LastPage}}

\begin{document}
    \lipsum[1-2]
\end{document}


text:
Q: angular routes not working in nginx docker container We have an angular app that we are trying to run in docker nginx:alpine
So far everything as working 100% including ssl with redirect from 80, but we cannot get the angular routing to work. It keeps going to 404 if we try to go somewhere directly.
server {
  listen 80;
  server_name *.localhost;
  return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name *.localhost;
    root  /usr/share/nginx/html;

    ssl_certificate /etc/nginx/ssl.pem;
    ssl_certificate_key /etc/nginx/ssl.key;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;

    # intermediate configuration. tweak to your needs.
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
    ssl_prefer_server_ciphers on;

    # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';

    # OCSP Stapling ---
    # fetch OCSP records from URL in ssl_certificate and cache them
    ssl_stapling on;
    ssl_stapling_verify on;

    resolver 8.8.8.8;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    location / {
        root /usr/share/nginx/html;
        index index.html index.htm;

        add_header 'Access-Control-Allow-Origin' $http_origin;
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

        try_files $uri $uri/ /index.html;

        if ($request_method = 'OPTIONS') {
           add_header 'Access-Control-Allow-Origin' $http_origin;
           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';

           # Custom headers and headers various browsers *should* be OK with but aren't

           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';

           # Tell client that this pre-flight info is valid for 20 days

           add_header 'Access-Control-Max-Age' 1728000;
           add_header 'Content-Type' 'text/plain; charset=utf-8';
           add_header 'Content-Length' 0;
           return 204;
        }

        if ($request_method = 'POST') {
           add_header 'Access-Control-Allow-Origin' $http_origin;
           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
           add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
        }

        if ($request_method = 'GET') {
           add_header 'Access-Control-Allow-Origin' $http_origin;
           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
           add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
        }
    }
}

it has been a struggle getting everything to work as it should since i have never build an nginx image from scratch, especially not with ssl.
EDIT:
After multiple more tries. If i add
location /login {
    try_files /index.html =404;
}

then on the login page i can refresh it and it works.
By all means this takes me to believe that location / is not working for everything. I really do not want to add a location for each route as the app has a few thousands

A: Under "location /" change
try_files $uri $uri/ /index.html;

to
try_files $uri /index.html;


text:
Q: Insert from XML into SQL Server table where node length exceeds 65000 chars? Could anyone help me get around the restriction (rewrite correctly the actual insert) on SQLType that can't be a 'text' type when you use the value fonction ?
(ref : https://learn.microsoft.com/en-us/sql/t-sql/xml/value-method-xml-data-type?view=sql-server-ver15 )
The 'notes' node in the xml down below will be more than 65000 char. If I leave it as is, it will truncate after 65000 char and ignore the rest.
changing it for : MY_XML.mydata.query('NOTES').value('.', 'text')  result in an error.
here is what I have, which works praticly for everything aside the 'text' column:
declare @myxml xml

set @myxml = '<WebData>
  <Data>
    <ID>2003-0001</ID>
    <Number_1>2004</number>
    <NOTES> a huge chunk of text </notes>
  </Data>
</WebData>'

INSERT INTO myTable(ID,Number_1,NOTES)
SELECT MY_XML.mydata.query('ID').value('.', 'varchar(10)'),
MY_XML.mydata.query('Number_1').value('.', 'int'),
MY_XML.mydata.query('NOTES').value('.', 'nvarchar(max)')
FROM @monxml.nodes('/WebData/data') MY_XML(mydata)

A: I downloaded a big text file from here:
https://www.sample-videos.com/download-sample-text-file.php
Its size is slightly more than 100K: SampleTextFile_100kb.txt.
And everything is working. Please see the T-SQL below.
Just don't believe your eyes. It is a limitation of the SSMS. It cannot show a large textual column.
The entire <notes> element textual value gets inserted into a table. The notes_length column shows its actual length.
Also, please pay close attention to the SELECT statement. It shows how to shred XML and convert it into a rectangular/relational format correctly.
SQL
-- DDL and sample data population, start
DECLARE @tbl TABLE (ID VARCHAR(10), Number_1 INT, notes NVARCHAR(MAX));
DECLARE @xml XML =
N'<WebData>
    <Data>
        <ID>2003-0001</ID>
        <Number_1>2004</Number_1>
        <notes>Lorem ipsum dolor sit amet, ...
        ..., sed pharetra mauris vehicula vel.</notes>
    </Data>
</WebData>';
-- DDL and sample data population, end

INSERT INTO @tbl (ID, Number_1, notes)
SELECT c.value('(ID/text())[1]', 'VARCHAR(10)') AS ID
    , c.value('(Number_1/text())[1]', 'INT') AS Nmbr
    , c.value('(notes/text())[1]', 'NVARCHAR(MAX)') AS Notes
FROM @xml.nodes('/WebData/Data') AS t(c);

-- test
SELECT *
    , LEN(notes) AS [notes_length]
FROM @tbl;

Output
+-----------+----------+---------------------------------+--------------+
|    ID     | Number_1 |              notes              | notes_length |
+-----------+----------+---------------------------------+--------------+
| 2003-0001 |     2004 | Lorem ipsum dolor sit amet,...  |       101854 |
+-----------+----------+---------------------------------+--------------+


text:
Q: Check if large file was uploaded fully into dir before processing I have a cron job that picks up a file from my hot folder and does some crazy stuff. The problem is that it picks up partially uploaded files and starts processing them. Is there a way to check if file was uploaded fully into directory, before processing it.

A: One of the workarounds I figured before is or to rename the file being uploaded to something "original_file.completed" or to create empty "original_file.completed" file after processing finishes and check the existence of that file before work with the original.


text:
Q: Meteor - Serverside copy files from FS.Collection I'm using a bash script to compile a Unity assetbundle. I run it on a server using an interval I setup in Meteor which I run as a server.
Using {{url}} client-side I can get the file url fine. But how can I copy/move or even access the physical file on the server?
I'd like to be able to copy files to my unity project and run my bash script.

A: Just remembered I defined a path to a folder when defining the collection. Having looked for it, i found all the files i need.
Apologies for wasting your time.


text:
Q: Generic array type in Typescript I have function with generic type.
But it return an error Type 'boolean' is not assignable to type 'string'.
function testing<K, V>(array: Array<{ key: K, value: V }>): Array<V> {
    return array.map(data => data.value)
}

testing([{ key: 1, value: "one" }, { key: 2, value: true }])

How can I fix this generic type issue with keeping the type generic. Because the array is unknown and the value may have different custom type.

A: TS apparently isn't smart enough to infer V being an union type, so for tricky arguments like that you'll have to declare it explicitly.
function testing<K, V>(array: Array<{ key: K, value: V }>): Array<V> {
    return array.map(data => data.value)
}

testing<number, string | boolean>(
    [{ key: 1, value: "one" }, { key: 2, value: true }]
); // works, TS is told explicitly what V is

testing(
    [{ key: 1, value: "one" }, { key: 2, value: "two" }]
); // works, TS correctly infers string

A: The following will extract the type of each value and return the union:
type ArrayValueTypes<MyValueArray extends { value: unknown }[]> = {
    [K in keyof MyValueArray]: MyValueArray[K]['value']
}

const myArray = [{ key: 1, value: "one" }, { key: 2, value: true }]

function testing<T extends { value: any }[]>(array: T): ArrayValueTypes<T> {
    return array.map(data => data.value)
}

const result = testing(myArray)
// result is of type (string | boolean)[]

Typescript playground example!

A: You don't really know the type of value is. You should use unknown to force users to type check it.
I also don't see why you need key and K since they are ignored.
function testing(array: Array<{value: unknown }>): Array<unknown> {
    return array.map(data => data.value);
}

testing([{ key: 1, value: "one" }, { key: 2, value: true }])

A: This should work:
function testing<K, V>(array: Array<{ key: K, value: V }>): Array<V> {
    return array.map(data => data.value)
}

testing<number, string | boolean>([{ key: 1, value: "one" }, { key: 2, value: true }])


text:
Q: What is the difference between setting window size using Options and setting window size using set_window_size method I am looking for setting window size in selenium.
I found this solution How to set window size in Selenium Chrome Python
rom selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless")
options.add_argument("window-size=1400,600")
driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe', service_args=["--log-path=./Logs/DubiousDan.log"])
driver.get("http://google.com/")
print ("Headless Chrome Initialized")
print(driver.get_window_size())
driver.set_window_size(1920, 1080)
size = driver.get_window_size()
print("Window size: width = {}px, height = {}px".format(size["width"], size["height"]))
driver.quit()

Is there any difference in doing
options.add_argument("window-size=1400,600")

or doing
driver.set_window_size(1920, 1080)

I commented out the headless option in my windows machine and checked the code.
With driver.set_window_size(1920, 1080), I see windows size changes on browser.
But with options.add_argument("window-size=1920, 1080"), I don't see any change
Is options.add_argument("window-size=1920, 1080") only for headless mode?

A: Setting the driver window size with
driver.set_window_size(1920, 1080)
and doing that with the use of Options
options.add_argument("window-size=1920,1080")
Seems to be the same.
It's like
driver.get(url)
And
driver.navigate().to(url)
WebDriver methods that are doing exactly the same thing and actually are synonyms.
The only difference I can notice between setting the driver window size by
driver.set_window_size(1920, 1080) vs options.add_argument("window-size=1920,1080")
Is that setting / changing the driver window size by
driver.set_window_size(1920, 1080)
can be performed anywhere in your code, even several times, while setting the driver window size with
options.add_argument("window-size=1920,1080")
Can be performed only once, before creating the driver instance with
driver = webdriver.Chrome(chrome_options=options, executable_path=the_path)

A: If you look at the source code:

*

*set_window_size
Code:
def set_window_size(self, width, height, windowHandle='current'):
    """
    Sets the width and height of the current window. (window.resizeTo)

    :Args:
     - width: the width in pixels to set the window to
     - height: the height in pixels to set the window to

    :Usage:
        driver.set_window_size(800,600)
    """
    if self.w3c:
        if windowHandle != 'current':
            warnings.warn("Only 'current' window is supported for W3C compatibile browsers.")
        self.set_window_rect(width=int(width), height=int(height))
    else:
        self.execute(Command.SET_WINDOW_SIZE, {
            'width': int(width),
            'height': int(height),
            'windowHandle': windowHandle})

It is explicitly mentioned that it set

width and height of the current window

takes two args:
- width: the width in pixels to set the window to
- height: the height in pixels to set the window to

*add_argument
Code:
def add_argument(self, argument):
    """
    Adds an argument to the list

    :Args:
     - Sets the arguments
    """
    if argument:
        self._arguments.append(argument)
    else:
        raise ValueError("argument can not be null")

Now coming to your question:

I commented out the headless option in my windows machine and checked
the code. With driver.set_window_size(1920, 1080), I see windows size
changes on browser. But with options.add_argument("window-size=1920,
1080"), I don't see any change Is
options.add_argument("window-size=1920, 1080") only for headless mode?

With driver.set_window_size(1920, 1080), I see windows size
changes on browser - this is expected.
options.add_argument("window-size=1920, 1080"), I don't see any change Is
options.add_argument("window-size=1920, 1080") only for headless mode? - No, it ideally should have launched in 1920 and 1080 pixel. add_argument just add one arg to the list. doing options.add_argument("--headless") is optional.


text:
Q: Self replacing object python I would like to create an object that is capable of replacing itself with an arbitrary object when accessed; as in the following:
class stand_in_object(object):
    def __init__(self,obj_ref):
        self.obj_ref

    def __getattr__(self,key):
        pass
        #somehow make calling reference now refer to self.obj_ref
        #Consider: setattr(ref,name,self.obj_ref) - how do I get ref,name?
        #Or perhaps something that replaces the object located at "location"
        #so that all references id(self) are "pointing" to
        #a new object. Maybe ctypes.memmove?

#------------------------Example use----------------------
class x(object):
    def __init__(self):
        self.y=stand_in_object(int(5))

a=x()
print a.x.f #calls a.x.__getattr__('f') which sets a.x = int(5)

I was thinking I could try either the memmove, or replace all references method found this post: https://benkurtovic.com/2015/01/28/python-object-replacement.html
I'm attempting to make an OODB using cPickle. I would like to have persistent objects that have not been loaded, be referenced by a stand-in object until they are accessed. Something like the following:
loaded = {}
class stand_in(object):
    def __init__(self,id,src):
        self.id,self.src = id,src
    def __getattr__(self,key):
        loaded[self.id] = cust_unpickle(self.src)
    #Some function to replace reference of standin_obj with loaded object

def persistent_load(id):
    if id in loaded: return loaded[id]
    else: return stand_in(id,src)

#--------------------------Example-------------------------------
#consider database stores objects a and c, and a.c = c.
a = unpickle(a.id,src) #loaded = {a.id:a}, a.c = stand_in(c.id,c.src)
print a.c.x  #calls a.c.__gettattr__ which has the effect:
             #c = unpickle(c.id,src)
             #and loads = {a.id:a,c.id:c}


text:
Q: Servlet 3 issues with @WebFilter and @WebServlet deployment I am trying to migrate my existing servlets and filters defined in web.xml file to @WebServlet and @WebFilter annotations on Glassfish V3 server.
Currently web.xml defined 12 servlets and 6 filters .
Tried removing one servlet from web.xml file and added @WebServlet annotation to Java servlet file .
But having difficulty in accessing the servlet when ever my JSP trying to access Servlet Glassfish complains "Service Not Available".
basically Servlet and filter defined using annotations never identified by Glassfish Server 3.
Is this existing bug that annotations can not be used along with web.xml file ?
Do we have any workaround.
I referred following Sun documentation to migrate web.xml to servlet 3 annotations

A: You've got to get your web.xml correct, below is the beginning of the web.xml you should use:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    metadata-complete="false"
    version="3.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">


text:
Q: How to insert using mutiple values and SELECT statements? I would like to create a query to insert several values along with values that come from other tables, for example:
INSERT INTO table
(date, user_id, category_id, title, description)
VALUES
    ((STR_TO_DATE('04-01-2014', '%b-%d-%Y'),
    (SELECT id FROM users WHERE username = 'admin' LIMIT 1),
    (SELECT id FROM categories WHERE category = 'games' LIMIT 1),
    'title here',
    'description here')

This however, gives me an error and from PHP a 500 internal server error. Help please.

A: INSERT INTO table (fields)
SELECT
    str_to_date(),
    users.id,
    categories.id,
    'title',
    'description'
FROM
    users
INNER JOIN
    categories ON users.key = categories.key
WHERE
    users.username = 'admin' AND
    categories.category = 'games'

that should do it I think...

A: I'm pretty sure you need a SELECT after VALUES if you're doing it this way. Try this and see if it works.
INSERT INTO table
(date, user_id, category_id, title, description)
VALUES
SELECT
  STR_TO_DATE('04-01-2014', '%b-%d-%Y'),
  (SELECT id FROM users WHERE username = 'admin' LIMIT 1),
  (SELECT id FROM categories WHERE category = 'games' LIMIT 1),
  'title here',
  'description here'


text:
Q: Reference request - textbook on linear algebra I'm looking for a textbook on linear algebra that is on a level higher than that of a first-read text, but isn't of the machine-gun-definition-theorem-proof-corollary type. I used Lay's text as an introduction to the subject, and then picked up Hoffman and Kunze. The topics themselves are understandable, but the text is quite dry, as I feel like most of what's going on lacks motivation - things seem to come out of nowhere. So I'd like something that's more focused and advanced than an introductory text, but doesn't feel like reading a dictionary of the terms used in linear algebra. Thanks.

A: I am also partial to Friedberg, Insel, and Spence. Loehr is a more advanced text and very comprehensive, but also quite good.
It might be worthwhile to work through the material with an application in mind. I found combinatorics to be a very helpful vantage point when I took Linear Algebra. The Babai--Frankl text Linear Algebra Methods in Combinatorics is a very nice text, that might be helpful in cementing concepts like linear independence, eigenvalues, etc.


text:
Q: What is Main difference between @api.onchange and @api.depends in Odoo(openerp)? In Odoo v8 there are many API decorators used. But I don't understand the main difference between @api.depends and @api.onchange.
Can anyone help me out from this one?
Thank You.

A: @api.depends
This decorator is specifically used for "fields.function" in odoo. For a "field.function", you can calculate the value and store it in a field, where it may possible that the calculation depends on some other field(s) of same table or some other table, in that case you can use '@api.depends' to keep a 'watch' on a field of some table.
So, this will trigger the call to the decorated function if any of the fields in the decorator is 'altered by ORM or changed in the form'.
Let's say there is a table 'A' with fields "x,y & z" and table 'B' with fields "p", where 'p' is a field.function depending upon the field 'x' from table 'A', so if any of the change is made in the field 'x', it will trigger the decorated function for calculating the field 'p' in table 'B'.
Make sure table "A" and "B" are related in some way.
@api.onchange
This decorator will trigger the call to the decorated function if any of the fields specified in the decorator is changed in the form. Here scope is limited to the same screen / model.
Let's say on form we have fields "DOB" and "Age", so we can have @api.onchange decorator for "DOB", where as soon as you change the value of "DOB", you can calculate the "age" field.
You may field similarities in @api.depends and @api.onchange, but the some differences are that scope of onchange is limited to the same screen / model while @api.depends works other related screen / model also.
For more info, Here is the link that describe all API of Odoo v8.

A: @api.onchange works in virtual records assignment on these records is not written to the database, just used to know which value to send back to the client.
Fields can be computed (instead of read from the database) using the compute parameter, it must assign the computed value to the field, it uses the values of other fields from the same model or others model (unlike @api.onchange which work only with the fields in the same view), it should specify fields using api.depends().
For more information. Please check out our blog :
https://odooforbeginnersblog.wordpress.com/2017/03/01/how-to-override-an-api-depends-decorated-method/

A: @api.depends
The function defined with this decorator will be called if any change happens in the fields specified. Moreover, the change to the field can be from ORM or changes in the form. Furthermore, if a compute function value depends on another field, then it must be specified using depends.
@api.onchange
The function of this decorator will be called when the field value changes. Moreover, it supports only single field names; on the contrary, dotted names such as parent_id.field_name will not be considered. Furthermore, onchange methods are invoked on pseudo-records that contain values of the form. The following is an example of the same:
Reference for better understanding with example : https://www.cybrosys.com/blog/method-decorators-odoo-13


text:
Q: Iterate all combination in Python Im a beginner in Python that trying to enhance my problem solving skill but Im stuck here
Here is my simple code
import itertools

a = [1, 2, 3]
b = [2, 3, 1]
c = [3, 1, 2]

p = ["Number {x} ,number {y} and number {z}"]

for phrase in p:
  for (x, y, z) in zip(a, b, c):
    t = phrase.format(x=x, y=y, z=z)
    print(t)

and the output
Number 1, number 2 and number 3
Number 2, number 3 and number 1
Number 3, number 1 and number 2

my question is how I will get all possible combination of a one list and iterate it through x,y,z? instead of doing it manually
for example here is my one list
a = [1, 2, 3]

and the output is the combination of the list (through the x,y,z in variable p)
Number 1, number 2 and number 3
Number 1, number 3 and number 2
Number 2, number 1 and number 3
Number 2, number 3 and number 1
Number 3, number 1 and number 2
Number 3, number 2 and number 1

thank you in advance.

A: Those sequences would be generated by itertools.permutations
for x,y,z in itertools.permutations(a):
    print(f"Number {x}, number {y} and number {z}")

Output
Number 1, number 2 and number 3
Number 1, number 3 and number 2
Number 2, number 1 and number 3
Number 2, number 3 and number 1
Number 3, number 1 and number 2
Number 3, number 2 and number 1

A: Your question is mainly based on how to generate all the permutations of a list, independently of the type of elements in that list. In Python there is a standard-library tool for this called itertools. Following the structure of your own code, here's how to work it out:
from itertools import permutations

a = [1, 2, 3]
p = ["Number {x}, number {y} and number {z}"]

for phrase in p:
    for (x, y, z) in permutations(a):
        t = phrase.format(x=x, y=y, z=z)
        print(t)

And the output:
Number 1, number 2 and number 3
Number 1, number 3 and number 2
Number 2, number 1 and number 3
Number 2, number 3 and number 1
Number 3, number 1 and number 2
Number 3, number 2 and number 1

Remark: one thing one can notice from above function, itertools.permutations(), is the order matters. However, if you want to understand how permutation works, here is an implementation example, without any library, by leveraging simply the recursive nature of permutation:
def all_perms(items_list):
    if len(items_list) <=1:
        yield items_list
    else:
        for item in all_perms(items_list[1:]): # Recursivity
            for i in range(len(items_list)):
                yield item[:i] + items_list[0:1] + item[i:]

Here is the output (order doesn't matter):
Number 1, number 2 and number 3
Number 2, number 1 and number 3
Number 2, number 3 and number 1
Number 1, number 3 and number 2
Number 3, number 1 and number 2
Number 3, number 2 and number 1

Note: This function, all_perms(), as well as itertools.permutations(), works in both string and list contexts.

A: Just a quick add-on to @Cory Kramer's answer, if you want to select more than one item from the list at once you can pass the number as second argument to the method permutations do something like this :
from itertools import permutations
a = [1, 2, 3]
selection = 2
for x in permutations(a, selection):
    print(x)

OUTPUT:
(1, 2)
(1, 3)
(2, 1)
(2, 3)
(3, 1)
(3, 2)

A: If you want to write your own function to calculate permutations, you will probably end up with something like this, where you loop over all the possible items to put first, and then call back to the same function recursively to get the possible permutations for the remaining items.
def get_permutations(lst):
    n = len(lst)
    if n == 1:
        return [lst]
    perms = []
    for orig_index, value in enumerate(lst):
        others = lst[:orig_index] + lst[orig_index + 1:]
        for perm_of_others in get_permutations(others):
            perms.append([value] + perm_of_others)
    return perms

for a, b, c in get_permutations([1, 2, 3]):
    print(f"Number {a}, number {b} and number {c}")


text:
Q: Aligning a variable in a matrix I want to put a matrix in a matrix, more precisely what I wanna reach is basically this:

I'm using the pmatrix-environment. How can I do this?
Edit: Sorry, I wasn't precise - what I actually wanna do, is replacing the a's here by a matrix A which is aligned in the middle of the 4 rows and the 5 columns. The example above seems to be easier since the number of rows/columns of A_1 is odd.
\[
\begin{pmatrix}
a & a & a & a & 1 \\
a & a & a & a & 2 \\
a & a & a & a & 3 \\
a & a & a & a & 4 \\
\end{pmatrix}
\]

A: Like this?

With use of the nicematrix package:
\documentclass[margin=3mm]{standalone}
\usepackage{bm}
\usepackage[table]{xcolor}
\usepackage{nicematrix}

\begin{document}
$
\begin{pNiceArray}{CCCC}
\alpha_{11} &   *   &   \dots   &   *   \\
0           &   \Block{3-3}<\huge\bm>{A_1}
                    &           &       \\
\vdots      &       &           &       \\
0           &       &           &
\end{pNiceArray}
$
\end{document}

or

\documentclass[margin=3mm]{standalone}
\usepackage{bm}
\usepackage{nicematrix}

\begin{document}
$
\begin{pNiceArray}{CCCC}
\alpha_{11} &   *   &   \Cdots   &   *   \\
0           &   \Block{3-3}<\huge\bm>{A_1}
                    &           &       \\
\Vdots      &       &           &       \\
0           &       &           &
\end{pNiceArray}
$
\end{document}

Shoved result you will obtain after two compilation of above MWE.

A: Nest matrix inside pmatrix:
\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\begin{pmatrix}
\alpha_{11} & \begin{matrix} * & \dots & * \end{matrix} \\
\begin{matrix} 0 \\ \vdots \\ 0 \end{matrix} & A_{11}
\end{pmatrix}
\]

\end{document}


text:
Q: macosx + conan + cmake build resulting in undefined symbols for architecture x86_64? I've been packaging a few conan recipes with varied success.. but now getting stuck on one package in particular
https://github.com/smasherprog/screen_capture_lite/issues/115
conanfile.py
from conans import ConanFile, CMake, tools

class ScreenCapLiteConan(ConanFile):
    name = "ScreenCaptureLite"
    version = "11.0.0"
    license = "MIT"
    author = "smasherprog@gmail.com"
    url = "https://github.com/smasherprog/screen_capture_lite/"
    description = "Capture screen grabs in C++"
    topics = ("screengrab", "capture")
    settings = "os", "compiler", "build_type", "arch"
    options = {"shared": [True, False]}
    default_options = {"shared": False}
    generators = "cmake"

    def source(self):
        self.run("git clone --depth 1 --branch v11.0.0 git@github.com:smasherprog/screen_capture_lite.git")

    def build(self):
        cmake = CMake(self)
        cmake.configure(source_folder="screen_capture_lite")
        cmake.build()

    def package(self):
        self.copy("*.h", dst="include", src="screen_capture_lite/include", keep_path=False)
        self.copy("*hello.lib", dst="lib", keep_path=False)
        self.copy("*.dll", dst="bin", keep_path=False)
        self.copy("*.so", dst="lib", keep_path=False)
        self.copy("*.dylib", dst="lib", keep_path=False)
        self.copy("*.a", dst="lib", keep_path=False)

    def package_info(self):
        self.cpp_info.libs = ["ScreenCaptureLite"]

this uploads to my registry just fine and I can see indeed there is a libscreen_cab.a of some sort saved
but when I goto try and use this library to create the libraries example in a new project.. it errors
CMakeLists.txt (of the consuming project)
cmake_minimum_required(VERSION 2.8.12)
project(scl_app_server)
add_compile_options(-std=c++17)

# Using the "cmake" generator
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

FILE ( GLOB SCL_APP_SRC src/*.cpp )

add_executable(scl_app_server ${SCL_APP_SRC} )
target_link_libraries(scl_app_server pthread CONAN_PKG::ScreenCaptureLite)

The following is what happens after I conan install the following
[requires]
ScreenCaptureLite/11.0.0@namespace/prod

[generators]
cmake

The commands executed emitting the error
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Adjusting output directories
-- Conan: Using cmake targets configuration
-- Library libscreen_capture found /Users/emcp/.conan/data/libscreen_capture/11.0.0/prod/package/2cd20192e71f56e1115fbdc2ebf2871bb61152e4/lib/liblibscreen_capture.a
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /Users/emcp/Dev/git/screen-cap-lite-server/build
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/emcp/Dev/git/screen-cap-lite-server/build
[ 33%] Building CXX object CMakeFiles/scl_app_server.dir/src/Screen_Capture_Example.cpp.o
[ 66%] Building CXX object CMakeFiles/scl_app_server.dir/src/lodepng.cpp.o
[100%] Linking CXX executable bin/scl_app_server
Undefined symbols for architecture x86_64:
  "_CFDataGetBytePtr", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CFDataGetLength", referenced from:
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CFRelease", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
      _SLScreen_Capture_GetCurrentMouseImage in liblibscreen_capture.a(NSMouseCapture.m.o)
  "_CGDataProviderCopyData", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CGDisplayBounds", referenced from:
      SL::Screen_Capture::GetMonitors() in liblibscreen_capture.a(GetMonitors.cpp.o)
  "_CGDisplayCopyDisplayMode", referenced from:
      SL::Screen_Capture::GetMonitors() in liblibscreen_capture.a(GetMonitors.cpp.o)
  "_CGDisplayCreateImage", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
  "_CGDisplayCreateImageForRect", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
  "_CGDisplayMirrorsDisplay", referenced from:
      SL::Screen_Capture::GetMonitors() in liblibscreen_capture.a(GetMonitors.cpp.o)
  "_CGDisplayModeGetPixelHeight", referenced from:
      SL::Screen_Capture::GetMonitors() in liblibscreen_capture.a(GetMonitors.cpp.o)
  "_CGDisplayModeGetPixelWidth", referenced from:
      SL::Screen_Capture::GetMonitors() in liblibscreen_capture.a(GetMonitors.cpp.o)
  "_CGDisplayModeRelease", referenced from:
      SL::Screen_Capture::GetMonitors() in liblibscreen_capture.a(GetMonitors.cpp.o)
  "_CGEventCreate", referenced from:
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CGEventGetLocation", referenced from:
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CGGetActiveDisplayList", referenced from:
      SL::Screen_Capture::GetMonitors() in liblibscreen_capture.a(GetMonitors.cpp.o)
  "_CGImageGetBitsPerPixel", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
  "_CGImageGetBytesPerRow", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
  "_CGImageGetDataProvider", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CGImageGetHeight", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CGImageGetWidth", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CGImageRelease", referenced from:
      SL::Screen_Capture::CGFrameProcessor::ProcessFrame(SL::Screen_Capture::Monitor const&) in liblibscreen_capture.a(CGFrameProcessor.cpp.o)
      SL::Screen_Capture::NSMouseProcessor::ProcessFrame() in liblibscreen_capture.a(NSMouseProcessor.cpp.o)
  "_CGImageSourceCreateImageAtIndex", referenced from:
      _SLScreen_Capture_GetCurrentMouseImage in liblibscreen_capture.a(NSMouseCapture.m.o)
  "_CGImageSourceCreateWithData", referenced from:
      _SLScreen_Capture_GetCurrentMouseImage in liblibscreen_capture.a(NSMouseCapture.m.o)
  "_OBJC_CLASS_$_NSApplication", referenced from:
      objc-class-ref in liblibscreen_capture.a(NSMouseCapture.m.o)
  "_OBJC_CLASS_$_NSCursor", referenced from:
      objc-class-ref in liblibscreen_capture.a(NSMouseCapture.m.o)
  "_objc_autoreleasePoolPop", referenced from:
      _SLScreen_Capture_GetCurrentMouseImage in liblibscreen_capture.a(NSMouseCapture.m.o)
  "_objc_autoreleasePoolPush", referenced from:
      _SLScreen_Capture_GetCurrentMouseImage in liblibscreen_capture.a(NSMouseCapture.m.o)
  "_objc_msgSend", referenced from:
      _SLScreen_Capture_InitMouseCapture in liblibscreen_capture.a(NSMouseCapture.m.o)
      _SLScreen_Capture_GetCurrentMouseImage in liblibscreen_capture.a(NSMouseCapture.m.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/scl_app_server] Error 1
make[1]: *** [CMakeFiles/scl_app_server.dir/all] Error 2
make: *** [all] Error 2

Edit:
seems the author got back to me and showed me I need to add some things.. I am unsure how to add it to a conan based CMakeLists.txt but it's all the apple things
https://github.com/smasherprog/screen_capture_lite/blob/master/Example_CPP/CMakeLists.txt
project(screen_capture_example_cpp)

if(WIN32)
    set(${PROJECT_NAME}_PLATFORM_LIBS Dwmapi)
    add_definitions(-DNOMINMAX)
elseif(APPLE)
    find_package(Threads REQUIRED)
    find_library(corefoundation_lib CoreFoundation REQUIRED)
    find_library(cocoa_lib Cocoa REQUIRED)
    find_library(coremedia_lib CoreMedia REQUIRED)
    find_library(avfoundation_lib AVFoundation REQUIRED)
    find_library(coregraphics_lib CoreGraphics REQUIRED)
    find_library(corevideo_lib CoreVideo REQUIRED)

    set(${PROJECT_NAME}_PLATFORM_LIBS
        ${CMAKE_THREAD_LIBS_INIT}
        ${corefoundation_lib}
        ${cocoa_lib}
        ${coremedia_lib}
        ${avfoundation_lib}
        ${coregraphics_lib}
        ${corevideo_lib}
    )
else()
    find_package(X11 REQUIRED)
    if(!X11_XTest_FOUND)
        message(FATAL_ERROR "X11 extensions are required, but not found!")
    endif()
    if(!X11_Xfixes_LIB)
        message(FATAL_ERROR "X11 fixes extension is required, but not found!")
    endif()
    find_package(Threads REQUIRED)
    set(${PROJECT_NAME}_PLATFORM_LIBS
        ${X11_LIBRARIES}
        ${X11_Xfixes_LIB}
        ${X11_XTest_LIB}
        ${X11_Xinerama_LIB}
        ${CMAKE_THREAD_LIBS_INIT}
    )
endif()

include_directories(
    ../include
)

add_executable(${PROJECT_NAME}_static
    lodepng.cpp
    Screen_Capture_Example.cpp
)
target_link_libraries(${PROJECT_NAME}_static screen_capture_lite_static ${${PROJECT_NAME}_PLATFORM_LIBS})

add_executable(${PROJECT_NAME}_shared
    lodepng.cpp
    Screen_Capture_Example.cpp
)

target_link_libraries(${PROJECT_NAME}_shared screen_capture_lite_shared ${${PROJECT_NAME}_PLATFORM_LIBS})

install (TARGETS ${PROJECT_NAME}_static ${PROJECT_NAME}_shared screen_capture_lite_shared
    RUNTIME DESTINATION Examples
)

do I just add these lines to my CMakeLists.txt the same?

A: it turned out the version I had pulled from github was super ancient.. once I updated my recipe to pull from the latest.. it was apparent that my consuming CMakeLists.txt was missing all sorts of apple libraries..
I modified slightly the authors original.. added the conan logic.. and most importantly learned how to add logic so that conan can make sense if you want static or dynamic libraries
my conanfile.py
from conans import ConanFile, CMake, tools

class ScreenCapLiteConan(ConanFile):
    name = "screen_capture_lite"
    version = "17.1.439"
    license = "MIT"
    author = "smasherprog@gmail.com"
    url = "https://github.com/smasherprog/screen_capture_lite"
    description = "Capture screen grabs in Mac OSX"
    topics = ("screengrab", "capture")
    settings = "os", "compiler", "build_type", "arch"
    options = {"shared": [True, False]}
    default_options = {"shared": False}
    generators = "cmake"

    def source(self):
        self.run("git clone --depth 1 --branch 17.1.439 git@github.com:smasherprog/screen_capture_lite.git")

    def build(self):
        cmake = CMake(self)
        cmake.configure(source_folder="screen_capture_lite")
        cmake.build()

    def package(self):
        self.copy("*.h", dst="include", src="screen_capture_lite/include")
        self.copy("*hello.lib", dst="lib", keep_path=False)
        self.copy("*.dll", dst="bin", keep_path=False)
        self.copy("*.so", dst="lib", keep_path=False)
        self.copy("*.dylib", dst="lib", keep_path=False)
        self.copy("*.a", dst="lib", keep_path=False)

    def package_info(self):
        if self.settings.os == "Macos":
            self.cpp_info.libs = ["libscreen_capture_lite_static.a"] if not self.options.shared else ["libscreen_capture_lite_shared.dylib"]
        elif self.settings.os == "Linux":
            self.cpp_info.libs = ["libscreen_capture_lite_static.a"] if not self.options.shared else ["libscreen_capture_lite_shared.so"]

notice the last lines where I have to add the logic for the different libraries
then my consuming project just needs the following
conanfile.txt
[requires]
screen_capture_lite/17.1.439@emcp/prod

[generators]
cmake

[options]
screen_capture_lite:shared=False

CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
project(osx_screengrabber)
add_compile_options(-std=c++17)

# Using the "cmake" generator
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

if(WIN32)
    set(${PROJECT_NAME}_PLATFORM_LIBS Dwmapi)
    add_definitions(-DNOMINMAX)
elseif(APPLE)
    find_package(Threads REQUIRED)
    find_library(corefoundation_lib CoreFoundation REQUIRED)
    find_library(cocoa_lib Cocoa REQUIRED)
    find_library(coremedia_lib CoreMedia REQUIRED)
    find_library(avfoundation_lib AVFoundation REQUIRED)
    find_library(coregraphics_lib CoreGraphics REQUIRED)
    find_library(corevideo_lib CoreVideo REQUIRED)

    set(${PROJECT_NAME}_PLATFORM_LIBS
        ${CMAKE_THREAD_LIBS_INIT}
        ${corefoundation_lib}
        ${cocoa_lib}
        ${coremedia_lib}
        ${avfoundation_lib}
        ${coregraphics_lib}
        ${corevideo_lib}
    )
else()
    find_package(X11 REQUIRED)
    if(!X11_XTest_FOUND)
        message(FATAL_ERROR "X11 extensions are required, but not found!")
    endif()
    if(!X11_Xfixes_LIB)
        message(FATAL_ERROR "X11 fixes extension is required, but not found!")
    endif()
    find_package(Threads REQUIRED)
    set(${PROJECT_NAME}_PLATFORM_LIBS
        ${X11_LIBRARIES}
        ${X11_Xfixes_LIB}
        ${X11_XTest_LIB}
        ${X11_Xinerama_LIB}
        ${CMAKE_THREAD_LIBS_INIT}
    )
endif()

add_executable(${PROJECT_NAME}_static
    src/lodepng.cpp
    src/osx_screengrabber.cpp
)
target_link_libraries(${PROJECT_NAME}_static CONAN_PKG::screen_capture_lite ${${PROJECT_NAME}_PLATFORM_LIBS} )

this fixed everything and I copied the original authors example project of the same git tag v17.1.439 into it's own repo.. fired up conan and cmake.. and it's all working now
thanks Conan! and screen_capture_lite!


text:
Q: Performance Mongodb java driver I'm using mongodb java driver in my project for execute queries (finds, aggregate, mapreduce,...) over a big collection (5 millions of documents)
The driver version is:
<!-- MongoDB driver-->
<dependency>
  <groupId>org.mongodb</groupId>
  <artifactId>mongo-java-driver</artifactId>
  <version>3.0.3</version>
</dependency>

My problem is when I use the api find with some filters from java, the operation takes 15 sec.
....
Iterable<Document> messageList = collection.find().filter(... some filters).sort(... fields);

// Find documents
for (Document message : messageList) {
....
// some code
....
}

I check the mongo server log file and see the trace is a COMMAND instead of a QUERY:

2015-09-01T12:11:47.496+0200 I COMMAND  [conn503] command b.$cmd command: count { count: "logs", query: { timestamp: { $gte: new Date(1433109600000) }, aplicacion: "APP1", event: "Event1" } } planSummary: IXSCAN { timestamp: 1, aplicacion: 1 } keyUpdates:0 writeConflicts:0 numYields:19089 reslen:44 locks:{ Global: { acquireCount: { r: 19090 } }, MMAPV1Journal: { acquireCount: { r: 19090 } }, Database: { acquireCount: { r: 19090 } }, Collection: { acquireCount: { R: 19090 } } } 14297ms

If I run the same query from mongodb client (Robomongo), it takes 0.05 ms.
db.getCollection('logs').find({ timestamp: { $gte: new Date(1427839200000) }, aplicacion: "APP1", event: "Event1" })

and in the server log is as QUERY
All queries that are made (find, aggregate, ...) with the driver java commands are transformed? The performance is much worse than mongo shell.

A: I think the issue is when you ran the query in mongo shell it will return only top 20 result at a time, here you are trying to read all the document and put it into array
try this query and see
List messageList  = collection.find(filter).sort(...field).limit(20).into(new ArrayList());
It's highly recommended to create a index on query field.


text:
Q: Iterating through jFrame components I have a frame with a jPanel, a button and about 50 jTextFields in it. I need to write an array one item in one jTextField on button click event. How can it be done?

A: Use ActionListioner and add an array item in it like this:
class MyFrame{

    private int i=0;
    private JTextField jTextField;
    private JButton jButton;
    MyFrame(){

            jButton = new JButton("Click");
            jTextField = new JTextField();
            jButton.addActionListener(new ActionListener(){

                    public void actionPerformed(ActionEvent e) {
                            jTextField.setText(arry[i]);
                            i+=1;
                    }
            });
    }

}


text:
Q: Rails 5 - Acts as Taggable On gem - defined tag lists I am trying to learn how to use the Acts as Taggable On gem with Rails 5.
I have models called Proposal and Randd::Field. I am trying to tag proposals with tags which are the :title attribute of the Randd::Field table.
My models have:
Proposal
class Proposal < ApplicationRecord

  acts_as_taggable_on :randd_maturities, :randd_fields, :randd_purposes, :randd_activities

# acts_as_taggable
# acts_as_taggable_on :skills, :interests

Randd::Field
(no association on Proposal).
Proposal helper
module ProposalsHelper

     include ActsAsTaggableOn::TagsHelper

In my proposal form, I try to add tags:
  <%#= f.select :tag_list %>
        <%#= f.input :randd_field_list,  collection: @randd_fields, label_method: :title,  include_blank: false %>
        <%= f.text_field :randd_field_list, input_html: {value: f.object.randd_field_list.to_s} %>

In my proposal controller, I have whitelisted an array of randd_field_list (which should hold each of the tags entered via the form).
def proposal_params
      params.require(:proposal).permit(:title,  :randd_maturity_list, :randd_fields_list,

I can add tags via the console. I cannot get this to work in the proposal form itself. In the console I can do:
p = Proposal.first
p.randd_field_list = [Randd::Field.last.title, Randd::Field.first.title]
p.save

This works to add the title of the first and last Randd::Fields to the array of tags on the proposal.
However, I can't figure out how to achieve this in the form. I get no errors showing in the rails s console. I cant see how to figure this out.
The Acts as Taggable On gem documentation this tutorial for editing tags - it suggests adding an update method to the Randd::Fields controller so that the tag can be updated. Taking that advice, I've tried to add the similar actions to my Randd::FieldsController as:
def edit
end

    def update
  @randd_field_list = ActsAsTaggableOn::Randd::Field.find(params[:id])

  respond_to do |format|
    if @randd_field_list.update(randd_field_list_params)
      format.html { redirect_to root_path, notice: 'Tag was successfully updated.' }
      format.json { render :show, status: :ok, location: @randd_field_list.proposal }
    else
      format.html { render :edit }
      format.json { render json: @tag.errors, status: :unprocessable_entity }
    end
  end

This does nothing. I'm not sure if its a problem that I don't have a Tags Controller (at all), or if this is the generic label used for all controllers that are the tagging object. Is there anything required in the Proposal controller itself to handle the creation and updating of tags (which for my case are the titles of instances in the Randd::Field model?
Can anyone see what I need to do in order to use the tagging functionality provided by this gem? If I can do it in the console, it follows that I should be able to do it in the code - but its entirely unclear to me as to how to go about implementing this.

A: def proposal_params
  params.require(:proposal).permit(:title,  randd_maturity_list: [], randd_field_list:[]
end

You need to permit list params as an array, and make the tag list field on form to pass an array instead of text


text:
Q: Typescript Intellisense not working when using @ path root directory imports I have run into an issue where TypeScript/Intellisense cannot determine types when importing using @ symbol in my compilerOptions set to my root directory:

Using ../ I can see types clearly:

I set compilerOptions parameters as follows, first in tsconfig.json and later i created a jsconfig.json file and set them there as well:
"baseUrl": ".",
    "paths": {
      "@/*": ["/src/*"]
    }

I've updated /src/* to ./src/* and src/* with no success.  To be clear the site still runs without issue, but i have lost the ability to take advantage of intellisense and typescript.  Please advise, thank you.

A: The file was a .jsx ... yea i did lose a whole day to that but changing to .tsx worked for me