问:
Create a JSON output in SQL Server
I want to create a JSON output as shown here:
this is top1 from my source table:
https://drive.google.com/file/d/1wuD4qgurx5zA1bFjtYKjAEacMQlQvpZS/view?usp=sharing

and it is my table source script:

```<code>CREATE TABLE [Setting].[PrinterData]
(
[ID] [int] NOT NULL IDENTITY(1, 1),
[Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShowName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Data] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AL] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DefaultStation] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[FileType] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[HandlingID] [tinyint] NULL,
[isDeleted] [bit] NULL,
[VersionNo] [tinyint] NULL,
[IsDefault] [bit] NULL,
[UpdateBy] [int] NULL,
[UpdatedDateTime] [datetime] NULL,
[PectabSystemID] [tinyint] NULL,
[DataVersionNo] [tinyint] NOT NULL CONSTRAINT [DF__PrinterDa__DataV__38A0BA30] DEFAULT ((1)),
[Template] [varchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [Setting].[PrinterData] ADD CONSTRAINT [PK_Print_1] PRIMARY KEY CLUSTERED ([ID]) ON [PRIMARY]
GO
</code>```
```<code>[
    {
        "DeviceID": 0,
        "Data": [
            "EP#AIRLINEID=220#HARDCODE=HDC#FONT=L",
            "LC",
            "PC",
            "PT##?E9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0330E01#0415#0513#0603E42L#0705E44L#0816#0903#1010#1105G42L#1205F42L#1318F04L#1418G03L#1505#1610#1705#1808L04L#2104L19#2205#2305#2405#2605O04L#2715M04L#2815#3002N04L#3103N09L#3701#4310L39L#4406L24K58#4504#4715M38L#4810N38L#4915O39L#5011#5105F01L#5206G01L#5305#5405#5504O01L#5604N01L#5703N07L#5816#5907#6016G35L#6113F35L#6213E35L#6307M01L#6504L001L#6620#6712#6805#6907#7008L35L#7106M35L#7205N35L#7307O35L#7422B20#7522J01R#7625E56L#7725F56L#FAB5N579984#",
            "PT##?S9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0340F10#0405H57L#0505H65L#0603F42F54L#0705F44F56L#0816G54L#0903#1010A54#1105H43L#1205G43L#1315G13L#1418H12L#1505#1610O45L#1705#1808O17L#1920#2020#2104#2205M28R#2305M44R#2405M62R#2520#2605P10P57L#2715P17L#2813#2901M56R#3004P32O57L#3103P34O59L#3215G16L#3315H15L#3405#3515#3601C02#3701D05#3820#3920#4020#4120#4220#4301#4406M13R#4520#4601C17#4720#4820#4920#5011#5105G10H54L#5203H10H63L#5305K45K63L#5405K14L#5504O10P54L#5604#5703#5816#5908O41L#6012H36L#6112G36L#6212F36L#6307#6420#6504#6619A26#6711#6804#6920#7020#7120#7220#7320#7420#7520#7620#7714K29L#7805K56L#7904O32O54L#8004P41L#8120#8220#8320#8420#8520#8620#8920#9020#FABRE012232#FBBRE012232#"
        ]
    }
]
</code>```

I try using this query:

```<code>SELECT
    DeviceID = CASE
                   WHEN pd.Type IN ( 'BP', 'MD' ) THEN 0
                   ELSE 1
               END,
    STRING_AGG(pd2.Data, ',')data
FROM
    Setting.PrinterData AS pd
JOIN
    Setting.PrinterData AS pd2 ON pd2.ID = pd.ID
WHERE
    pd.isDeleted = 0
    AND pd.al = 'ZZ'
GROUP BY
    CASE
        WHEN pd.Type IN ( 'BP', 'MD' ) THEN 0
        ELSE 1
    END
FOR JSON AUTO
</code>```

I got this output:

```<code>[{
    "DeviceID": 0,
    "data": "PT##?S9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0340F10#0405H57L#0505H65L#0603F42F54L#0705F44F56L#0816G54L#0903#1010320#8420#8520#8620#8920#9020#FABRE012232#FBBRE012232#,^XA  ~TA000  ~JSN  ^LT0  ^MNN  ^MTD  ^PON  ^PMN  ^LH0,0  ^JMA  ^PR14,14  ~SD15  ^JUS  ^LRN  ^CI27  ^PA0,1,1,0  ^XZ  ^XA  ^MMT  ^PW591  ^LL1624  ^LS0\n  ^FT500,200^LOGO39\n^FO0,1184^GFA,00128,00128,00004,:Z64:\neJxjYMAO7P9DMK0BAPvqAn0=:89A8\n^FT344,236^A0R,25,24^FH\\^FDFROM:$HNN - $FRANKFURT-HANN^FS\n^FT302,236^A0R,25,24^FH\\^FDTO:$WWW - $ARVIDSJAUR^FS\n^FT38,946^A0R,25,24^FH\\^FDAGT:$25^FS\n^FT382,1256^A0R,25,21^FH\\^FD$AC ,585^A0R,56,55^FH\\^FD$22:22^FS\n^FT72,683^A0R,25,24^FH\\^FDBAG:^FS\n^FT38,667^A0R,25,24^FH\\^FD$17\/$18 $kgs^FS\n^FT38,424^A0R,25,24^FH\\^FD$11111111^FS\n^FT72,424^A0R,25,24^FH\\^FD$V223HB^FS\n^FT341,1256^A0R,25,24^FH\\^FD$JOHN HUDSON^FS\n^FT219,1484^A0R,25,24^FH\\^FDSEAT^FS\n^FT38,1277^A0R,25,24^FH\\^FDSEQ:$4321^FS\n^FT161,1483^A0R,56,55^FH\\^FD$3B^FS\n^BY3,9^FT54,213^B7N,9,2,,,N\n^FH\\^FDM1JOHN HUDSON         C3JIOP  HHNAJRSR 7999 56 Y12E 12   100\\5C5E00L262562^FS\n^FT72,946^A0R,25,24^FH\\^FDCLS:$Y^FS\n^FT294,1256^A0R,25,24^FH\\^FDFROM:$HNN^FS\n^FT294,1429^A0R,25,24^FH\\^FDTO:$WWW^FS\n^FT72,1277^A0R,25,24^FH\\^FDBAG:$17\/$18 $kgs^FS\n^FT513,1256^A0R,35,40^FH\\^FD$Economy^FS\n^FT341,826^A0R,25,24^FH\\^FDFLIGHT TIME: $23:50^FS\n^FT302,826^A0R,25,24^FH\\^FDFLIGHT DATE:$25 FEB 2020^FS\n^FT386,236^A0R,37,36^FH\\^FD$JOHN HUDSON^FS\n^FO143,235^GB112,878,8^FS\n^FO143,1250^GB112,331,8^FS\n^FT219,1298^A0R,25,24^FH\\^FDZONE^FS\n^FT513,634^A0R,35,40^FH\\^FDBOARDING PASS^FS\n^FO480,0^GB0,1658,4^FS\n^FT382,826^A0R,25,24^FH\\^FDFLIGHT NUMBER:$AC $3999^FS\n^FO549,1190^GB22,0,2^FS\n^FO516,1190^GB22,0,2^FS\n^FO484,1190^GB22,0,2^FS\n^FO449,1190^GB22,0,2^F4mnzHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxngBviT\/2kgPsjfaubvOPXbutHO\/nbvuRvbZuQPPffhHN97Hm9qT587cRrf93XoDBS+XaA==:BFE1\n\n^FTT0,1400^LOGO39\n^FT0,250^LOGO39\n\n^FO165,1224^GB46,107,46^FS\n^FT202,1331^A0B,37,36^FB107,1,0,C^FR^FH\\^FD$WWW^FS\n^FT324,1569^BQN,2,7\n^FH\\^FDLA,M1JOHN HUDSON         C3JIOP  HHNAJRSR 7999 56 Y12E 12   100\\5C5E00L262562^FS\n^FT157,1546^A0B,51,50^FH\\^FD$JOHN HUDSON^FS\n^FT204,1553^A0B,25,24^FH\\^FDFROM^FS\n^FT202,1487^A0B,37,36^FH\\^FD$HNN^FS\n^FT204,1384^A0B,25,24^FH\\^FDTO^FS\n^FT71,997^A0B,39,38^FH\\^FD$Economy^FS\n^FT169,916^A0B,25,24^FH\\^FDFLIGHT NO^FS\n^FT163,797^A0B,56,48^FH\\^FD$AC $3999^FS\n^FT209,918^A0B,25,24^FH\\^FDDATE\/TIME^FS\n^FT204,793^A0B,34,33^FH\\^FD$25 FEB 2020 - $23:50^FS\n^FT273,1562^A0B,25,24^FH\\^FDSEAT^FS\n^FT285,1508^A0B,62,62^FH\\^FD$3B^FS\n^FT273,1312^A0B,25,24^FH\\^FDGATE^FS\n^FT273,1106^A0B,25,24^FH\\^FDSEQ^FS\n^FT273,838^A0B,25,24^FH\\^FDBOARDING^FS\n^FT280,1255^A0B,56,55^FH\\^FD$A1^FS\n^FT280,1044^A0B,56,55^FH\\^FD$4321^FS\n^FT280,733^A0B,56,55^FH\\^FD$22:22^FS\n^FT354,1268^A0B,25,24^FH\\^FDPCS\/WT^FS\n^FT354,1110^A0B,25,24^FH\\^FDTKNO^FS\n^FT354,868^A0B,25,24^FH\\^FDPNR^FS\n^FT354,747^A0B,25,24^FH\\^FDAGENT^FS\n^FT396,1268^A0B,28,28^FH\\^FD$17\/$18 DPCS\/WT^FS\n^FT371,407^A0B,20,19^FH\\^FDSEQ^FS\n^FT420,407^A0B,20,19^FH\\^FDTIME^FS\n^FT280,335^A0B,62,62^FH\\^FD$3B^FS\n^FT331,335^A0B,31,31^FH\\^FD$17\/$18 $kgs^FS\n^FT380,335^A0B,39,38^FH\\^FD$4321^FS\n^FT425,335^A0B,31,31^FH\\^FD$23:50^FS\n^FT483,324^A0B,31,31^FH\\^FD$AC $3999^FS\n^FT525,327^A0B,31,31^FH\\^FD$25 FEB 2020^FS\n^BY3,6^FT517,28^B7I,6,2,,,N\n^FH\\^FDM1JOHN HUDSON         C3JIOP  HHNAJRSR 7999 56 Y12E 12   100\\5C5E00L262562^FS\n^FT580,947^A0B,17,16^FH\\^FD$?ABOMIS^FS\n^FT580,250^A0B,17,16^FH\\^FD$?ABOMIS^FS\n^FT396,743^A0B,28,28^FH\\^FD$25^FS\n^FT494,1110^A0B,28,28^FH\\^FD(SSR):^FS\n^FT478,1161^A0B,17,16^FH\\^FDSpecial^FS\n^FT493,1161^A0B,17,16^FH\\^FDService^FS\n^FT508,1161^A0B,17,16^FH\\^FDRequests^FS\n^FT495,1027^A0B,31,31^FH\\^FD$SSRs^FS\n^PQ1,0,1,Y^XZ,PT##?S9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0330F16M#0415H07M#0513H54#0603I20L#0705I27K54L#0817D54#0903#1010D16R#1105I39L#1205I46K70L#1316F54#1418I07M#1505#1610I32K59L#1705K65L#1807#2104#2205M58L#2305N07M#2404N66R#2605M07O58R#2715O07L#2815R54L#3002P10P66#3103P13P69#3301E19#3401E19#3501E19#3601E35#3701E19#4001E19#4101E19#4201L#3215G16L#3315H15L#3405#3515#3601B02#3701D05#3820#3920#4020#4120#4220#4301#4406M13R#4520#4601C17#4720#4820#4920#5011#5105G10H54L#5203H10H63L#5305K45K63L#5405K14L#5504O10P54L#5604#5703#5816#5908O41L#6012H36L#6112G36L#6212F36L#6307#6420#6504#6619A26#6711#6813#6920#7020#7120#7220#7320#7420#7520#7620#7714K29L#7805K56L#7904O32O54L#8004P41L#8120#8220#8320#8420#8520#8620#8920#9020#FABRE012232#FBBRE012232#"
}, {
    "DeviceID": 1,
    "data": "BTT1139~H0500255=#02C0 E503250304#03B1 A494250541#04C0MI129450201#06B1 A002250541=03#11C0MA146250304=02#12B1M3150454041=03#13C0 4194372415LIMITED#14C0 B050250404LIMITTAG#20C0 1030400202#F4C0M1065350201#F5C0M1065450201#F6C0 A008220201#FEC0 1001010201#FFC0 1001010201#,^XA~TA000~JSN^LT0^MNN^MTD^PON^PMN^LH0,0^JMA^PR5,5~SD15^JUS^LRN^CI0^XZ\n^XA\n^MMT\n^PW384\n^LL4156\n^LS0\n\n1----\nA\n^BY3,3,42^FT34,3817^BCN,,N,N\n^FD$6666666666^FS\nB\n^BY3,3,42^FT34,3947^BCN,,N,N\n^FD$6666666666^FS\nCTIMAJCHI^FS^CI0\n^FT137,1062^A@I,25,24,TT0003M_^FH\\^CI17^F8^FD0025^FS^CI0\n^FT357,1097^A0I,28,45^FH\\^FDLH 0492^FS\n^FT137,1102^A@I,25,24,TT0003M_^FH\\^CI17^F8^FD$DATE^FS^CI0\n^FO104,1134^GB177,56,56^FS\n^FT281,1145^A0I,45,45^FR^FH\\^FD$ALName^FS\n^FT277,1203^A@I,31,31,TT0003M_^FH\\^CI17^F8^FD9999999999^FS^CI0\n^FT25,2352^A@N,25,24,TT0003M_^FH\\^CI17^F8^FD$FromName^FS^CI0\n^FO83,2836^GB214,46,46^FS\n^FT83,2872^A@N,31,47,TT0003M_^FR^FH\\^CI17^F8^FDTEXT: -----^FS^CI0\n^FO1,2819^GB380,0,4^FS\n^FO1,2668^GB380,0,2^FS\n^FO1,2530^GB380,0,2^FS\n^FO1,2371^GB380,0,2^FS\n^FT27,2694^A@N,25,24,TT0003M_^FH\\^CI17^F8^FDVIA2:^FS^CI0\n^FT27,2562^A@N,25,24,TT0003M_^FH\\^CI17^F8^FDVIA1:^FS^CI0"
}]
</code>```

As you see the Data tag does not look like an array.

I tried json_query but was not successful.

Title: Create a JSON output in SQL Server

Body:
I want to create a JSON output as shown here:
this is top1 from my source table:
https://drive.google.com/file/d/1wuD4qgurx5zA1bFjtYKjAEacMQlQvpZS/view?usp=sharing

and it is my table source script:

CREATE TABLE [Setting].[PrinterData]
(
[ID] [int] NOT NULL IDENTITY(1, 1),
[Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ShowName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Type] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Data] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AL] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DefaultStation] [char] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[FileType] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[HandlingID] [tinyint] NULL,
[isDeleted] [bit] NULL,
[VersionNo] [tinyint] NULL,
[IsDefault] [bit] NULL,
[UpdateBy] [int] NULL,
[UpdatedDateTime] [datetime] NULL,
[PectabSystemID] [tinyint] NULL,
[DataVersionNo] [tinyint] NOT NULL CONSTRAINT [DF__PrinterDa__DataV__38A0BA30] DEFAULT ((1)),
[Template] [varchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [Setting].[PrinterData] ADD CONSTRAINT [PK_Print_1] PRIMARY KEY CLUSTERED ([ID]) ON [PRIMARY]
GO

[
    {
        "DeviceID": 0,
        "Data": [
            "EP#AIRLINEID=220#HARDCODE=HDC#FONT=L",
            "LC",
            "PC",
            "PT##?E9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0330E01#0415#0513#0603E42L#0705E44L#0816#0903#1010#1105G42L#1205F42L#1318F04L#1418G03L#1505#1610#1705#1808L04L#2104L19#2205#2305#2405#2605O04L#2715M04L#2815#3002N04L#3103N09L#3701#4310L39L#4406L24K58#4504#4715M38L#4810N38L#4915O39L#5011#5105F01L#5206G01L#5305#5405#5504O01L#5604N01L#5703N07L#5816#5907#6016G35L#6113F35L#6213E35L#6307M01L#6504L001L#6620#6712#6805#6907#7008L35L#7106M35L#7205N35L#7307O35L#7422B20#7522J01R#7625E56L#7725F56L#FAB5N579984#",
            "PT##?S9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0340F10#0405H57L#0505H65L#0603F42F54L#0705F44F56L#0816G54L#0903#1010A54#1105H43L#1205G43L#1315G13L#1418H12L#1505#1610O45L#1705#1808O17L#1920#2020#2104#2205M28R#2305M44R#2405M62R#2520#2605P10P57L#2715P17L#2813#2901M56R#3004P32O57L#3103P34O59L#3215G16L#3315H15L#3405#3515#3601C02#3701D05#3820#3920#4020#4120#4220#4301#4406M13R#4520#4601C17#4720#4820#4920#5011#5105G10H54L#5203H10H63L#5305K45K63L#5405K14L#5504O10P54L#5604#5703#5816#5908O41L#6012H36L#6112G36L#6212F36L#6307#6420#6504#6619A26#6711#6804#6920#7020#7120#7220#7320#7420#7520#7620#7714K29L#7805K56L#7904O32O54L#8004P41L#8120#8220#8320#8420#8520#8620#8920#9020#FABRE012232#FBBRE012232#"
        ]
    }
]

I try using this query:

SELECT
    DeviceID = CASE
                   WHEN pd.Type IN ( 'BP', 'MD' ) THEN 0
                   ELSE 1
               END,
    STRING_AGG(pd2.Data, ',')data
FROM
    Setting.PrinterData AS pd
JOIN
    Setting.PrinterData AS pd2 ON pd2.ID = pd.ID
WHERE
    pd.isDeleted = 0
    AND pd.al = 'ZZ'
GROUP BY
    CASE
        WHEN pd.Type IN ( 'BP', 'MD' ) THEN 0
        ELSE 1
    END
FOR JSON AUTO

I got this output:

[{
    "DeviceID": 0,
    "data": "PT##?S9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0340F10#0405H57L#0505H65L#0603F42F54L#0705F44F56L#0816G54L#0903#1010320#8420#8520#8620#8920#9020#FABRE012232#FBBRE012232#,^XA  ~TA000  ~JSN  ^LT0  ^MNN  ^MTD  ^PON  ^PMN  ^LH0,0  ^JMA  ^PR14,14  ~SD15  ^JUS  ^LRN  ^CI27  ^PA0,1,1,0  ^XZ  ^XA  ^MMT  ^PW591  ^LL1624  ^LS0\n  ^FT500,200^LOGO39\n^FO0,1184^GFA,00128,00128,00004,:Z64:\neJxjYMAO7P9DMK0BAPvqAn0=:89A8\n^FT344,236^A0R,25,24^FH\\^FDFROM:$HNN - $FRANKFURT-HANN^FS\n^FT302,236^A0R,25,24^FH\\^FDTO:$WWW - $ARVIDSJAUR^FS\n^FT38,946^A0R,25,24^FH\\^FDAGT:$25^FS\n^FT382,1256^A0R,25,21^FH\\^FD$AC ,585^A0R,56,55^FH\\^FD$22:22^FS\n^FT72,683^A0R,25,24^FH\\^FDBAG:^FS\n^FT38,667^A0R,25,24^FH\\^FD$17\/$18 $kgs^FS\n^FT38,424^A0R,25,24^FH\\^FD$11111111^FS\n^FT72,424^A0R,25,24^FH\\^FD$V223HB^FS\n^FT341,1256^A0R,25,24^FH\\^FD$JOHN HUDSON^FS\n^FT219,1484^A0R,25,24^FH\\^FDSEAT^FS\n^FT38,1277^A0R,25,24^FH\\^FDSEQ:$4321^FS\n^FT161,1483^A0R,56,55^FH\\^FD$3B^FS\n^BY3,9^FT54,213^B7N,9,2,,,N\n^FH\\^FDM1JOHN HUDSON         C3JIOP  HHNAJRSR 7999 56 Y12E 12   100\\5C5E00L262562^FS\n^FT72,946^A0R,25,24^FH\\^FDCLS:$Y^FS\n^FT294,1256^A0R,25,24^FH\\^FDFROM:$HNN^FS\n^FT294,1429^A0R,25,24^FH\\^FDTO:$WWW^FS\n^FT72,1277^A0R,25,24^FH\\^FDBAG:$17\/$18 $kgs^FS\n^FT513,1256^A0R,35,40^FH\\^FD$Economy^FS\n^FT341,826^A0R,25,24^FH\\^FDFLIGHT TIME: $23:50^FS\n^FT302,826^A0R,25,24^FH\\^FDFLIGHT DATE:$25 FEB 2020^FS\n^FT386,236^A0R,37,36^FH\\^FD$JOHN HUDSON^FS\n^FO143,235^GB112,878,8^FS\n^FO143,1250^GB112,331,8^FS\n^FT219,1298^A0R,25,24^FH\\^FDZONE^FS\n^FT513,634^A0R,35,40^FH\\^FDBOARDING PASS^FS\n^FO480,0^GB0,1658,4^FS\n^FT382,826^A0R,25,24^FH\\^FDFLIGHT NUMBER:$AC $3999^FS\n^FO549,1190^GB22,0,2^FS\n^FO516,1190^GB22,0,2^FS\n^FO484,1190^GB22,0,2^FS\n^FO449,1190^GB22,0,2^F4mnzHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxngBviT\/2kgPsjfaubvOPXbutHO\/nbvuRvbZuQPPffhHN97Hm9qT587cRrf93XoDBS+XaA==:BFE1\n\n^FTT0,1400^LOGO39\n^FT0,250^LOGO39\n\n^FO165,1224^GB46,107,46^FS\n^FT202,1331^A0B,37,36^FB107,1,0,C^FR^FH\\^FD$WWW^FS\n^FT324,1569^BQN,2,7\n^FH\\^FDLA,M1JOHN HUDSON         C3JIOP  HHNAJRSR 7999 56 Y12E 12   100\\5C5E00L262562^FS\n^FT157,1546^A0B,51,50^FH\\^FD$JOHN HUDSON^FS\n^FT204,1553^A0B,25,24^FH\\^FDFROM^FS\n^FT202,1487^A0B,37,36^FH\\^FD$HNN^FS\n^FT204,1384^A0B,25,24^FH\\^FDTO^FS\n^FT71,997^A0B,39,38^FH\\^FD$Economy^FS\n^FT169,916^A0B,25,24^FH\\^FDFLIGHT NO^FS\n^FT163,797^A0B,56,48^FH\\^FD$AC $3999^FS\n^FT209,918^A0B,25,24^FH\\^FDDATE\/TIME^FS\n^FT204,793^A0B,34,33^FH\\^FD$25 FEB 2020 - $23:50^FS\n^FT273,1562^A0B,25,24^FH\\^FDSEAT^FS\n^FT285,1508^A0B,62,62^FH\\^FD$3B^FS\n^FT273,1312^A0B,25,24^FH\\^FDGATE^FS\n^FT273,1106^A0B,25,24^FH\\^FDSEQ^FS\n^FT273,838^A0B,25,24^FH\\^FDBOARDING^FS\n^FT280,1255^A0B,56,55^FH\\^FD$A1^FS\n^FT280,1044^A0B,56,55^FH\\^FD$4321^FS\n^FT280,733^A0B,56,55^FH\\^FD$22:22^FS\n^FT354,1268^A0B,25,24^FH\\^FDPCS\/WT^FS\n^FT354,1110^A0B,25,24^FH\\^FDTKNO^FS\n^FT354,868^A0B,25,24^FH\\^FDPNR^FS\n^FT354,747^A0B,25,24^FH\\^FDAGENT^FS\n^FT396,1268^A0B,28,28^FH\\^FD$17\/$18 DPCS\/WT^FS\n^FT371,407^A0B,20,19^FH\\^FDSEQ^FS\n^FT420,407^A0B,20,19^FH\\^FDTIME^FS\n^FT280,335^A0B,62,62^FH\\^FD$3B^FS\n^FT331,335^A0B,31,31^FH\\^FD$17\/$18 $kgs^FS\n^FT380,335^A0B,39,38^FH\\^FD$4321^FS\n^FT425,335^A0B,31,31^FH\\^FD$23:50^FS\n^FT483,324^A0B,31,31^FH\\^FD$AC $3999^FS\n^FT525,327^A0B,31,31^FH\\^FD$25 FEB 2020^FS\n^BY3,6^FT517,28^B7I,6,2,,,N\n^FH\\^FDM1JOHN HUDSON         C3JIOP  HHNAJRSR 7999 56 Y12E 12   100\\5C5E00L262562^FS\n^FT580,947^A0B,17,16^FH\\^FD$?ABOMIS^FS\n^FT580,250^A0B,17,16^FH\\^FD$?ABOMIS^FS\n^FT396,743^A0B,28,28^FH\\^FD$25^FS\n^FT494,1110^A0B,28,28^FH\\^FD(SSR):^FS\n^FT478,1161^A0B,17,16^FH\\^FDSpecial^FS\n^FT493,1161^A0B,17,16^FH\\^FDService^FS\n^FT508,1161^A0B,17,16^FH\\^FDRequests^FS\n^FT495,1027^A0B,31,31^FH\\^FD$SSRs^FS\n^PQ1,0,1,Y^XZ,PT##?S9N#@;#TICKT#CHKIN#BOARD#01011101#0205#0330F16M#0415H07M#0513H54#0603I20L#0705I27K54L#0817D54#0903#1010D16R#1105I39L#1205I46K70L#1316F54#1418I07M#1505#1610I32K59L#1705K65L#1807#2104#2205M58L#2305N07M#2404N66R#2605M07O58R#2715O07L#2815R54L#3002P10P66#3103P13P69#3301E19#3401E19#3501E19#3601E35#3701E19#4001E19#4101E19#4201L#3215G16L#3315H15L#3405#3515#3601B02#3701D05#3820#3920#4020#4120#4220#4301#4406M13R#4520#4601C17#4720#4820#4920#5011#5105G10H54L#5203H10H63L#5305K45K63L#5405K14L#5504O10P54L#5604#5703#5816#5908O41L#6012H36L#6112G36L#6212F36L#6307#6420#6504#6619A26#6711#6813#6920#7020#7120#7220#7320#7420#7520#7620#7714K29L#7805K56L#7904O32O54L#8004P41L#8120#8220#8320#8420#8520#8620#8920#9020#FABRE012232#FBBRE012232#"
}, {
    "DeviceID": 1,
    "data": "BTT1139~H0500255=#02C0 E503250304#03B1 A494250541#04C0MI129450201#06B1 A002250541=03#11C0MA146250304=02#12B1M3150454041=03#13C0 4194372415LIMITED#14C0 B050250404LIMITTAG#20C0 1030400202#F4C0M1065350201#F5C0M1065450201#F6C0 A008220201#FEC0 1001010201#FFC0 1001010201#,^XA~TA000~JSN^LT0^MNN^MTD^PON^PMN^LH0,0^JMA^PR5,5~SD15^JUS^LRN^CI0^XZ\n^XA\n^MMT\n^PW384\n^LL4156\n^LS0\n\n1----\nA\n^BY3,3,42^FT34,3817^BCN,,N,N\n^FD$6666666666^FS\nB\n^BY3,3,42^FT34,3947^BCN,,N,N\n^FD$6666666666^FS\nCTIMAJCHI^FS^CI0\n^FT137,1062^A@I,25,24,TT0003M_^FH\\^CI17^F8^FD0025^FS^CI0\n^FT357,1097^A0I,28,45^FH\\^FDLH 0492^FS\n^FT137,1102^A@I,25,24,TT0003M_^FH\\^CI17^F8^FD$DATE^FS^CI0\n^FO104,1134^GB177,56,56^FS\n^FT281,1145^A0I,45,45^FR^FH\\^FD$ALName^FS\n^FT277,1203^A@I,31,31,TT0003M_^FH\\^CI17^F8^FD9999999999^FS^CI0\n^FT25,2352^A@N,25,24,TT0003M_^FH\\^CI17^F8^FD$FromName^FS^CI0\n^FO83,2836^GB214,46,46^FS\n^FT83,2872^A@N,31,47,TT0003M_^FR^FH\\^CI17^F8^FDTEXT: -----^FS^CI0\n^FO1,2819^GB380,0,4^FS\n^FO1,2668^GB380,0,2^FS\n^FO1,2530^GB380,0,2^FS\n^FO1,2371^GB380,0,2^FS\n^FT27,2694^A@N,25,24,TT0003M_^FH\\^CI17^F8^FDVIA2:^FS^CI0\n^FT27,2562^A@N,25,24,TT0003M_^FH\\^CI17^F8^FDVIA1:^FS^CI0"
}]

As you see the Data tag does not look like an array.

I tried json_query but was not successful.


来源: stackexchange

问:
How can we add a Help button to CTaskDialog?
The standard AfxMessageBox allows us to include a Help button by using MB_HELP.

I can't work out how to do the same with CTaskDialog? Since, there is no official button ID for Help in the SDK:

```<code>enum _TASKDIALOG_COMMON_BUTTON_FLAGS
{
    TDCBF_OK_BUTTON            = 0x0001, // selected control return value IDOK
    TDCBF_YES_BUTTON           = 0x0002, // selected control return value IDYES
    TDCBF_NO_BUTTON            = 0x0004, // selected control return value IDNO
    TDCBF_CANCEL_BUTTON        = 0x0008, // selected control return value IDCANCEL
    TDCBF_RETRY_BUTTON         = 0x0010, // selected control return value IDRETRY
    TDCBF_CLOSE_BUTTON         = 0x0020  // selected control return value IDCLOSE
};
</code>```

Yet, it does expose an OnHelp method:

The framework calls this method when the user requests help.

I assume, when they press F1.

Note

I realise I can use AddCommandControl and get around it that way. But I would prefer a standard button just like AfxMessageBox (CodeProject tutorial: Add a Help Button to a MessageBox):

ContentLicense: CC BY-SA 4.0

Body:
The standard AfxMessageBox allows us to include a Help button by using MB_HELP.

I can't work out how to do the same with CTaskDialog? Since, there is no official button ID for Help in the SDK:

enum _TASKDIALOG_COMMON_BUTTON_FLAGS
{
    TDCBF_OK_BUTTON            = 0x0001, // selected control return value IDOK
    TDCBF_YES_BUTTON           = 0x0002, // selected control return value IDYES
    TDCBF_NO_BUTTON            = 0x0004, // selected control return value IDNO
    TDCBF_CANCEL_BUTTON        = 0x0008, // selected control return value IDCANCEL
    TDCBF_RETRY_BUTTON         = 0x0010, // selected control return value IDRETRY
    TDCBF_CLOSE_BUTTON         = 0x0020  // selected control return value IDCLOSE
};

Yet, it does expose an OnHelp method:

The framework calls this method when the user requests help.

I assume, when they press F1.

Note

I realise I can use AddCommandControl and get around it that way. But I would prefer a standard button just like AfxMessageBox (CodeProject tutorial: Add a Help Button to a MessageBox):


问:
Populating field of schema using pre middleware in nodejs
`

```<code>const mongoose = require('mongoose');

const postSchema = new mongoose.Schema(
{
    content:
    {
        type: String,
        required: true
    },
    user:
    {
        type:mongoose.Schema.Types.ObjectId,
        ref:'User'
    },
    comments:
    [
        {
            type:mongoose.Schema.Types.ObjectId,
            ref:'Comment'
        }
    ],
    likes:
    [
        {
            type:mongoose.Schema.Types.ObjectId,
            ref:'Like'
        }
    ]

}, {timestamps: true});

postSchema.pre('find', function (next)
{
    this.populate('user');
    next();
})
/*.pre('find', function (next)
{
    this.populate('comments');
    next();
});*/

const Post = mongoose.model('Post', postSchema);

module.exports = Post;
</code>```

In this code my user field is populating correctly But if try to populate the comments field the control gets stuck in infinite recursion. To avoid that I also used

```<code>postSchema.pre('find', function (next) {
  if (this.options._recursed) {
    return next();
  }
  this.populate({ path: "comments", options: { _recursed: true } });
  next();
});
</code>```

`

as mentioned in official mongoose documentation here but still it is not working.

On the other hand in controller part if populate like this

`

```<code> const posts = await Post.find({}).populate('comments').sort('-createdAt');
</code>```

`

and in Post model if populate only user field

`

```<code>postSchema.pre('find', function (next)
{
    this.populate('user');
    next();
})
</code>```

`

Then this code is working perfectly fine. I want to know why comments field is not getting populated in the Post model. Please help me.

Trying to populate the comments field in Post model

Body:
`

const mongoose = require('mongoose');

const postSchema = new mongoose.Schema(
{
    content:
    {
        type: String,
        required: true
    },
    user:
    {
        type:mongoose.Schema.Types.ObjectId,
        ref:'User'
    },
    comments:
    [
        {
            type:mongoose.Schema.Types.ObjectId,
            ref:'Comment'
        }
    ],
    likes:
    [
        {
            type:mongoose.Schema.Types.ObjectId,
            ref:'Like'
        }
    ]

}, {timestamps: true});

postSchema.pre('find', function (next)
{
    this.populate('user');
    next();
})
/*.pre('find', function (next)
{
    this.populate('comments');
    next();
});*/

const Post = mongoose.model('Post', postSchema);

module.exports = Post;

In this code my user field is populating correctly But if try to populate the comments field the control gets stuck in infinite recursion. To avoid that I also used

postSchema.pre('find', function (next) {
  if (this.options._recursed) {
    return next();
  }
  this.populate({ path: "comments", options: { _recursed: true } });
  next();
});

`

as mentioned in official mongoose documentation here but still it is not working.

On the other hand in controller part if populate like this

`

 const posts = await Post.find({}).populate('comments').sort('-createdAt');

`

and in Post model if populate only user field

`

postSchema.pre('find', function (next)
{
    this.populate('user');
    next();
})

`

Then this code is working perfectly fine. I want to know why comments field is not getting populated in the Post model. Please help me.

Trying to populate the comments field in Post model


问:
Why there is difference of list initializer in python
I have initialized a 2D list with 2 different approaches here.

But when I assigned some values, both are not outputting the same result.

I see the result in lines 5 and 10 have different values.

At line 5 all 2D list values got changed to 1.

Why it is happening so?

```<code>1 lst = [[0]*3]*4
2 print(lst)
3 lst[1][0], lst[1][1], lst[1][2] = 1, 1, 1
4 print(lst)
5 # [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]]
</code>```
```<code>6 lst = [[0,0,0] for _ in range(4)]
7 print(lst)
8 lst[1][0], lst[1][1], lst[1][2] = 1, 1, 1
9 print(lst)
10 # [[0, 0, 0], [1, 1, 1], [0, 0, 0], [0, 0, 0]]
</code>```

Body:
I have initialized a 2D list with 2 different approaches here.

But when I assigned some values, both are not outputting the same result.

I see the result in lines 5 and 10 have different values.

At line 5 all 2D list values got changed to 1.

Why it is happening so?

1 lst = [[0]*3]*4
2 print(lst)
3 lst[1][0], lst[1][1], lst[1][2] = 1, 1, 1
4 print(lst)
5 # [[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]]

6 lst = [[0,0,0] for _ in range(4)]
7 print(lst)
8 lst[1][0], lst[1][1], lst[1][2] = 1, 1, 1
9 print(lst)
10 # [[0, 0, 0], [1, 1, 1], [0, 0, 0], [0, 0, 0]]


问:
How can you use multiple numbers as a key to a map?
I have a 64 bit number with a bunch of bits set depending on a certain state of a render pass, and another 64 bit number that stores bits depending on what the pipeline state is. Each change in any bit in either numbers should be a change in state and therefore a different key. All the information in both numbers should be unique in retrieving the value from a map. How can I do this? How do you hash this? I don't like the idea of looping 16 to hash this. I am using c++ and was hoping I could use the key with std::unordered_map which is a hash map.</p>


问:
Material UI Autocomplete loses focus after pressing any key after introducing nested routes
I started observing strange behaviour of the Material UI Autocomplete component after I introduced nested routes. It clears the input and loses the focus right after entering any data no matter whether it is autocomplete option selection or entering some freeform text. Debugging shows that onInputChange handler gets called twice: first time with the right value and the second time with an empty value.

The code is following:

```<code>let filterParams = window.location.search.substring(1);
let filtersFromParams = qs.parse(filterParams);
const [name, setName] = useState(
  filtersFromParams.name ? filtersFromParams.name : ""
);
const nameChangeHandler = (event, value) => {
  setName(value);
}
useEffect(() => {
  const filterParams = window.location.search.substring(1);
  const filtersFromParams = qs.parse(filterParams);
  if (filtersFromParams.name) {
    setName(filtersFromParams.name);
  }
}, [])
<Autocomplete
  freeSolo
  id="name"
  disableClearable
  options={autocompleteOptions}
  inputValue={name}
  onInputChange={nameChangeHandler}
  renderInput={(params) => (
    <TextField
      {...params}
      label="Name"
      margin="normal"
      variant="outlined"
      style={{
        width: "200px",
        height: "20px",
        top: "-22px",
      }}
      InputProps={{ ...params.InputProps, type: "search" }}
    />
  )}
/>
</code>```

It turned out that this code breaks the autocomplete component:

```<code><Router>
  <Routes>
    <Route path="/login" element={<Login />} />
    <Route element={<AppLayout />}>
      <Route path="/" element={<Home chart={chart}/>} />
      <Route path="/names" element={<Names />} />
    </Route>
  </Routes>
</Router>
</code>```

What can I do to make both routes and autocomplete work properly?

Body:
I started observing strange behaviour of the Material UI Autocomplete component after I introduced nested routes. It clears the input and loses the focus right after entering any data no matter whether it is autocomplete option selection or entering some freeform text. Debugging shows that onInputChange handler gets called twice: first time with the right value and the second time with an empty value.

The code is following:

let filterParams = window.location.search.substring(1);
let filtersFromParams = qs.parse(filterParams);
const [name, setName] = useState(
  filtersFromParams.name ? filtersFromParams.name : ""
);
const nameChangeHandler = (event, value) => {
  setName(value);
}
useEffect(() => {
  const filterParams = window.location.search.substring(1);
  const filtersFromParams = qs.parse(filterParams);
  if (filtersFromParams.name) {
    setName(filtersFromParams.name);
  }
}, [])
<Autocomplete
  freeSolo
  id="name"
  disableClearable
  options={autocompleteOptions}
  inputValue={name}
  onInputChange={nameChangeHandler}
  renderInput={(params) => (
    <TextField
      {...params}
      label="Name"
      margin="normal"
      variant="outlined"
      style={{
        width: "200px",
        height: "20px",
        top: "-22px",
      }}
      InputProps={{ ...params.InputProps, type: "search" }}
    />
  )}
/>

It turned out that this code breaks the autocomplete component:

<Router>
  <Routes>
    <Route path="/login" element={<Login />} />
    <Route element={<AppLayout />}>
      <Route path="/" element={<Home chart={chart}/>} />
      <Route path="/names" element={<Names />} />
    </Route>
  </Routes>
</Router>

What can I do to make both routes and autocomplete work properly?


问:
410: Prepare statement failed or was not executed
In an informix database I can't run a simple query like "select * from customer;" because
after running this query, I get this error:

```<code>410: Prepare statement failed or was not executed.
Error in line 1
Near character position 23
</code>```

Can anyone help me?

I killed all sessions and at last rebooted the server, but it doesn't work for me.
There is no "prepare statement" and I couldn't find anything helpful after 2 days of searching the net.

Body:
In an informix database I can't run a simple query like "select * from customer;" because
after running this query, I get this error:

410: Prepare statement failed or was not executed.
Error in line 1
Near character position 23

Can anyone help me?

I killed all sessions and at last rebooted the server, but it doesn't work for me.
There is no "prepare statement" and I couldn't find anything helpful after 2 days of searching the net.


问:
macOS Ventura 13.1(22C65) cant run yasm excutable file
asm file

```<code>section .data
    message db 'Hello, World!',0

section .text
    global _start

_start:
    mov eax, 4        ; write syscall number
    mov ebx, 1        ; stdout file descriptor
    mov ecx, qword [message]  ; address of message
    mov edx, 13       ; length of message
    int 0x80          ; invoke syscall

    mov eax, 1        ; exit syscall number
    xor ebx, ebx      ; exit status
    int 0x80          ; invoke syscall
</code>```

command

yasm -f macho64 hello.asm -o hello

chomd +x

result -bash: ./hello: cannot execute binary file

I am using macOS m1 Ventura 13.1(22C65)

is there any solution

Body:
asm file

section .data
    message db 'Hello, World!',0

section .text
    global _start

_start:
    mov eax, 4        ; write syscall number
    mov ebx, 1        ; stdout file descriptor
    mov ecx, qword [message]  ; address of message
    mov edx, 13       ; length of message
    int 0x80          ; invoke syscall

    mov eax, 1        ; exit syscall number
    xor ebx, ebx      ; exit status
    int 0x80          ; invoke syscall

command

yasm -f macho64 hello.asm -o hello

chomd +x

result -bash: ./hello: cannot execute binary file

I am using macOS m1 Ventura 13.1(22C65)

is there any solution


问:
How to access component and props of dome element in Preact
In React I can read fiber from dom element to identify component and passed props.

Any way to do the same in Preact?

Here is an example in React:

https://codesandbox.io/s/bold-haze-e7nd6n?file=/src/App.js

```<code>import "./styles.css";

function Hello({ name }) {
  return <h1>Hello, {name}</h1>;
}

export default function App() {
  const handleClick = () => {
    const el = document.querySelector("h1");
    const allKeys = Object.keys(el);
    const theKey = allKeys.find((p) => p.startsWith("__reactFiber$"));
    const filber = el[theKey];
    const props = filber.return.pendingProps;
    console.log(props);
    alert(JSON.stringify(props));
  };

  return (
    <div className="App">
      <Hello name="Frodo" />
      <button onClick={handleClick}>click me</button>
    </div>
  );
}

</code>```

Body:
In React I can read fiber from dom element to identify component and passed props.

Any way to do the same in Preact?

Here is an example in React:

https://codesandbox.io/s/bold-haze-e7nd6n?file=/src/App.js

import "./styles.css";

function Hello({ name }) {
  return
Hello, {name}
;
}

export default function App() {
  const handleClick = () => {
    const el = document.querySelector("h1");
    const allKeys = Object.keys(el);
    const theKey = allKeys.find((p) => p.startsWith("__reactFiber$"));
    const filber = el[theKey];
    const props = filber.return.pendingProps;
    console.log(props);
    alert(JSON.stringify(props));
  };

  return (

      <Hello name="Frodo" />
      <button onClick={handleClick}>click me</button>

  );
}


问:
Minimum time target problem with shooting method

This is a standard optimal control problem, I am using the shooting method, I solved the hjb equation and used the co-state values for initialization and it is working perfectly, but I want to use newton method for solving initial value, where final values are given (indirect shooting(x1,x2 final known)).

```<code>from pyparsing.helpers import ZeroOrMore
import numpy as np
import math
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from scipy.optimize import fsolve
from scipy.integrate import solve_ivp
def eqn11(z,t,phi):
  lamda1=z[0]
  lamda2=z[1]
  y1=z[2]
  y2=z[3]

  dlamda1=0#costate equation
  dlamda2=0#state equation
  dy1=math.cos(phi)
  dy2=math.sin(phi)

  dzdt=[dlamda1,dlamda2,dy1,dy2]
  return dzdt
def eqn22(z,t,phi):
  lamda1=z[0]
  lamda2=z[1]
  y1=z[2]
  y2=z[3]
  y22=(y2-1)**2

  dlamda1=0 #costate-function
  dlamda2=-(lamda1*2*(y2-1)*math.cos(phi))-(lamda2*2*(y2-1)*math.sin(phi))#state function
  dy1=(y22+1)*math.cos(phi)
  dy2=(y22+1)*math.sin(phi)

  dzdt=[dlamda1,dlamda2,dy1,dy2]
  return dzdt
def cont(l1,l2):
  u1=math.atan2(l2,l1)

    #atan2 gives values between -pi to +pi
  return u1
n=550
lamda0=[0.05,1]
y0=[-2.5,0]
t=np.linspace(0,5,n)
lamda11=np.empty_like(t)
lamda21=np.empty_like(t)
y11=np.empty_like(t)
y21=np.empty_like(t)
u=np.empty_like(t)
# record initial conditions
lamda11[0] = lamda0[0]
lamda21[0] = lamda0[1]
y11[0]=y0[0]
y21[0]=y0[1]
y_0=[lamda0[0],lamda0[1],y0[0],y0[1]]
u0=cont(lamda0[0],lamda0[1])
u[0]=cont(lamda0[0],lamda0[1])
for i in range(1,n):
  #print(i)

  tspan = [t[i-1],t[i]]
  if i>550:
    break
  else:
    if y_0[3]<1:
      z=odeint(eqn11,y_0,tspan,args=(u[i-1],))
      lamda11[i]=z[1][0]
      lamda21[i]=z[1][1]
      y11[i]=z[1][2]
      y21[i]=z[1][3]
      u[i]=cont(lamda11[i],lamda21[i])#control
      y_0[0]=z[1][0]
      y_0[1]=z[1][1]
      y_0[2]=z[1][2]
      y_0[3]=z[1][3]
      #print(y_0[3])
    else:
      z=odeint(eqn22,y_0,tspan,args=(u[i-1],))
      lamda11[i]=z[1][0]
      lamda21[i]=z[1][1]
      y11[i]=z[1][2]
      y21[i]=z[1][3]
      u[i]=cont(lamda11[i],lamda21[i])
      y_0[0]=z[1][0]
      y_0[1]=z[1][1]
      y_0[2]=z[1][2]
      y_0[3]=z[1][3]
#print(lamda0)
#print(z1)
#print(z)
#print(lamda0)
#u0=u[i]
#plt.plot(t[0:440],lamda11[0:440])
#plt.plot(t,u)
plt.plot(t[0:540],y21[0:540])
#plt.plot(t[0:440],y11[0:440])
#plt.plot(t[0:440],lamda21[0:440])
#plt.plot(y11[0:540],y21[0:540])
#print(max(y2))
#print(y1)
#print(y11)
#print(lamda1)
#print(min(lamda2))
print(y11[537])

</code>```

If anybody have any suggestion, please weigh in

Body:
This is a standard optimal control problem, I am using the shooting method, I solved the hjb equation and used the co-state values for initialization and it is working perfectly, but I want to use newton method for solving initial value, where final values are given (indirect shooting(x1,x2 final known)).

from pyparsing.helpers import ZeroOrMore
import numpy as np
import math
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from scipy.optimize import fsolve
from scipy.integrate import solve_ivp
def eqn11(z,t,phi):
  lamda1=z[0]
  lamda2=z[1]
  y1=z[2]
  y2=z[3]

  dlamda1=0#costate equation
  dlamda2=0#state equation
  dy1=math.cos(phi)
  dy2=math.sin(phi)

  dzdt=[dlamda1,dlamda2,dy1,dy2]
  return dzdt
def eqn22(z,t,phi):
  lamda1=z[0]
  lamda2=z[1]
  y1=z[2]
  y2=z[3]
  y22=(y2-1)**2

  dlamda1=0 #costate-function
  dlamda2=-(lamda1*2*(y2-1)*math.cos(phi))-(lamda2*2*(y2-1)*math.sin(phi))#state function
  dy1=(y22+1)*math.cos(phi)
  dy2=(y22+1)*math.sin(phi)

  dzdt=[dlamda1,dlamda2,dy1,dy2]
  return dzdt
def cont(l1,l2):
  u1=math.atan2(l2,l1)

    #atan2 gives values between -pi to +pi
  return u1
n=550
lamda0=[0.05,1]
y0=[-2.5,0]
t=np.linspace(0,5,n)
lamda11=np.empty_like(t)
lamda21=np.empty_like(t)
y11=np.empty_like(t)
y21=np.empty_like(t)
u=np.empty_like(t)
# record initial conditions
lamda11[0] = lamda0[0]
lamda21[0] = lamda0[1]
y11[0]=y0[0]
y21[0]=y0[1]
y_0=[lamda0[0],lamda0[1],y0[0],y0[1]]
u0=cont(lamda0[0],lamda0[1])
u[0]=cont(lamda0[0],lamda0[1])
for i in range(1,n):
  #print(i)

  tspan = [t[i-1],t[i]]
  if i>550:
    break
  else:
    if y_0[3]<1:
      z=odeint(eqn11,y_0,tspan,args=(u[i-1],))
      lamda11[i]=z[1][0]
      lamda21[i]=z[1][1]
      y11[i]=z[1][2]
      y21[i]=z[1][3]
      u[i]=cont(lamda11[i],lamda21[i])#control
      y_0[0]=z[1][0]
      y_0[1]=z[1][1]
      y_0[2]=z[1][2]
      y_0[3]=z[1][3]
      #print(y_0[3])
    else:
      z=odeint(eqn22,y_0,tspan,args=(u[i-1],))
      lamda11[i]=z[1][0]
      lamda21[i]=z[1][1]
      y11[i]=z[1][2]
      y21[i]=z[1][3]
      u[i]=cont(lamda11[i],lamda21[i])
      y_0[0]=z[1][0]
      y_0[1]=z[1][1]
      y_0[2]=z[1][2]
      y_0[3]=z[1][3]
#print(lamda0)
#print(z1)
#print(z)
#print(lamda0)
#u0=u[i]
#plt.plot(t[0:440],lamda11[0:440])
#plt.plot(t,u)
plt.plot(t[0:540],y21[0:540])
#plt.plot(t[0:440],y11[0:440])
#plt.plot(t[0:440],lamda21[0:440])
#plt.plot(y11[0:540],y21[0:540])
#print(max(y2))
#print(y1)
#print(y11)
#print(lamda1)
#print(min(lamda2))
print(y11[537])

If anybody have any suggestion, please weigh in


问:
Reading a video from a web
I have an internal site that reads a video from raspberry pi and sends it to a site.

```<code>import cv2
from flask import Flask, render_template, Response, stream_with_context, Request

video = cv2.VideoCapture(0)
app = Flask(__name__)

def video_stream():
    while(True):
        ret, frame = video.read()
        if not ret:
            break
        else:
            ret, buffer = cv2.imencode('.jpeg',frame)
            frame = buffer.tobytes()
            yield (b' --frame\r\n' b'Content-type: image/jpeg\r\n\r\n' + frame + b'\r\n')

@app.route('/siteTest')

def siteTest():
    return render_template('siteTest.html')

@app.route('/video_feed')

def video_feed():
    return Response(video_stream(), mimetype='multipart/x-mixed-replace; boundary=frame')

app.run(host ='192.168.20.153', port= '5000', debug=False)
</code>```

After the site opens I try to read the video throughout my PC with this code

```<code>import cv2
import urllib.request

URL = 'http://192.168.20.153:5000/video_feed'

stream = urllib.request.urlopen(URL)

cap = cv2.VideoCapture()
cap.open(stream)

while cap.isOpened():
    while True:
        ret, frame = cap.read()
        if not ret:
            break
        else:
            cv2.imshow("frame", frame)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break

cap.release()
cv2.destroyAllWindows()
</code>```

and I get this problem when I run the code

```<code>OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://192.168.19.126:5000/video_feed in function 'cv::icvExtractPattern'
</code>```

Do you have any idea why it might happen?

I tried so many diffrent things from not using the urllib library to try and use other methods. And nothing worked for me

Title: Reading a video from a web

Body:
I have an internal site that reads a video from raspberry pi and sends it to a site.

import cv2
from flask import Flask, render_template, Response, stream_with_context, Request

video = cv2.VideoCapture(0)
app = Flask(__name__)

def video_stream():
    while(True):
        ret, frame = video.read()
        if not ret:
            break
        else:
            ret, buffer = cv2.imencode('.jpeg',frame)
            frame = buffer.tobytes()
            yield (b' --frame\r\n' b'Content-type: image/jpeg\r\n\r\n' + frame + b'\r\n')

@app.route('/siteTest')

def siteTest():
    return render_template('siteTest.html')

@app.route('/video_feed')

def video_feed():
    return Response(video_stream(), mimetype='multipart/x-mixed-replace; boundary=frame')

app.run(host ='192.168.20.153', port= '5000', debug=False)

After the site opens I try to read the video throughout my PC with this code

import cv2
import urllib.request

URL = 'http://192.168.20.153:5000/video_feed'

stream = urllib.request.urlopen(URL)

cap = cv2.VideoCapture()
cap.open(stream)

while cap.isOpened():
    while True:
        ret, frame = cap.read()
        if not ret:
            break
        else:
            cv2.imshow("frame", frame)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break

cap.release()
cv2.destroyAllWindows()

and I get this problem when I run the code

OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://192.168.19.126:5000/video_feed in function 'cv::icvExtractPattern'

Do you have any idea why it might happen?

I tried so many diffrent things from not using the urllib library to try and use other methods. And nothing worked for me


问:
How to implement HMAC Authentication with .NET 5 Web API?
I have an ASP.NET Core 5 Web API in which JWT Bearer Authentication is applied (as shown below, and its working fine), for more security I want to add HMAC Authentication that should form as another security layer to validate that the request is originating from authorized client app.

How can I achieve this. Is there an example with an ASP.NET Core 5 Web API?

```<code> //Startup.cs
 services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(opt =>
            {
                opt.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey = key,
                    ValidateAudience = false,
                    ValidateIssuer = false,
                    ValidateLifetime = true,
                    ClockSkew = TimeSpan.Zero
                };
            });
</code>```

Body:
I have an ASP.NET Core 5 Web API in which JWT Bearer Authentication is applied (as shown below, and its working fine), for more security I want to add HMAC Authentication that should form as another security layer to validate that the request is originating from authorized client app.

How can I achieve this. Is there an example with an ASP.NET Core 5 Web API?

 //Startup.cs
 services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(opt =>
            {
                opt.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey = key,
                    ValidateAudience = false,
                    ValidateIssuer = false,
                    ValidateLifetime = true,
                    ClockSkew = TimeSpan.Zero
                };
            });


问:
How can I delete my categories pages' titles, and reduce space inside my sidebar?
I'm currently building my own website using Wordpress as well as the Astra theme (free version). I've been encountering two main issues to which I still haven't found any solution yet : first of all, I have easily figured out how to remove my "normal" pages' titles (by hiding it directly on my administration panel), but to do the same on my categories' pages didn't seem possible to me by any means ;  what it basically renders is my category's name encapsulated into a weird white frame that I can't remove. I would therefore like it to disappear, so that my page starts with my articles associated to that category instead of having that indicated. (screenshot of the issue, here concerning the announces' section of my website)
Secondly, I also have a problem with my sidebar and its widgets, that are too much distant. The space between them is way too important than what I would like ! Somebody has already given me a bit of CSS code that has reduced it a bit :

```<code>.ast-separate-container.ast-two-container #secondary .widget {
    margin-bottom: 0;
}
</code>```

however, is it possible to reduce it even more ? (maybe by adding more code or modifying some specific parameters of Astra ?)
Thank you for your help, and happy New Year!

I've tried to look up any options in Astra that could resolve my problems, and I haven't found any solution on Internet (some code bits perhaps but which haven't worked at all).

Body:
I'm currently building my own website using Wordpress as well as the Astra theme (free version). I've been encountering two main issues to which I still haven't found any solution yet : first of all, I have easily figured out how to remove my "normal" pages' titles (by hiding it directly on my administration panel), but to do the same on my categories' pages didn't seem possible to me by any means ;  what it basically renders is my category's name encapsulated into a weird white frame that I can't remove. I would therefore like it to disappear, so that my page starts with my articles associated to that category instead of having that indicated. (screenshot of the issue, here concerning the announces' section of my website)
Secondly, I also have a problem with my sidebar and its widgets, that are too much distant. The space between them is way too important than what I would like ! Somebody has already given me a bit of CSS code that has reduced it a bit :

.ast-separate-container.ast-two-container #secondary .widget {
    margin-bottom: 0;
}

however, is it possible to reduce it even more ? (maybe by adding more code or modifying some specific parameters of Astra ?)
Thank you for your help, and happy New Year!

I've tried to look up any options in Astra that could resolve my problems, and I haven't found any solution on Internet (some code bits perhaps but which haven't worked at all).


问:
CreateContext value update is causing Maximum update depth exceeded error
I've created a context named AuthContext in my react app.

```<code>export const AuthContext = createContext({
    isLoggedIn: false,
    login: (userid)=>{},
    logout: ()=>{}
})
</code>```

And here's the code of my App.js file

```<code>function App() {
  let [isLoggedIn, setIsLoggedIn] = useState(false);

  const login = useCallback((id) => {
    setIsLoggedIn(true);
  }, []);
  const logout = useCallback(() => {
    setIsLoggedIn(false);
  }, []);

  let routes = (
    <Routes>
      <Route path="/signup" element={<Signup />} />
      <Route path="/login" element={<Login />} />
      <Route path="*" element={<Navigate to="/login" />}></Route>
    </Routes>
  );

  if (isLoggedIn) {
    routes = (
      <Routes>
        <Route path="/" element={<Dashboard />} />
        <Route path="/trends" element={<Trends />} />
        <Route path="/reports" element={<Reports />} />
        <Route path="/summary" element={<Summary />} />
        <Route path="/logout" element={<Logout />} />
        <Route path="*" element={<Navigate to="/dashboard" />}></Route>
      </Routes>
    );
  }

  return (
    <>
      <AuthContext.Provider
        value={{ isLoggedIn, login: login, logout: logout }}
      >
        <Router>
          <Navigator />
          {routes}
        </Router>
      </AuthContext.Provider>
    </>
  );
}

</code>```

After login, I want to set the isLoggedIn state true. To do that, in my Login.js file, this is what I did:

```<code>export default function Login() {
  let loginURL = "******"
  const auth = useContext(AuthContext);

  const [lg] = useLogin();

  const handleLogin= async () => {
    const response = await lg.login(loginURL);
    console.log(response);
    auth.login(responsel.id) //defined in the App.js file. (Mentioned above)
  };

  return (
    <>
      <button
        type="button"
        onClick={handleLogin}
      >
        Login
      </button>
    </>
  );
}
</code>```

I get the response properly in handleLogin function. After that, I call the auth.login function from the context to set the state isLoggedIn to true but then I get this warning:

```<code>Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
</code>```

And this happens infinitely and don't let any other things to load on the screen

Body:
I've created a context named AuthContext in my react app.

export const AuthContext = createContext({
    isLoggedIn: false,
    login: (userid)=>{},
    logout: ()=>{}
})

And here's the code of my App.js file

function App() {
  let [isLoggedIn, setIsLoggedIn] = useState(false);

  const login = useCallback((id) => {
    setIsLoggedIn(true);
  }, []);
  const logout = useCallback(() => {
    setIsLoggedIn(false);
  }, []);

  let routes = (
    <Routes>
      <Route path="/signup" element={<Signup />} />
      <Route path="/login" element={<Login />} />
      <Route path="*" element={<Navigate to="/login" />}></Route>
    </Routes>
  );

  if (isLoggedIn) {
    routes = (
      <Routes>
        <Route path="/" element={<Dashboard />} />
        <Route path="/trends" element={<Trends />} />
        <Route path="/reports" element={<Reports />} />
        <Route path="/summary" element={} />
        <Route path="/logout" element={<Logout />} />
        <Route path="*" element={<Navigate to="/dashboard" />}></Route>
      </Routes>
    );
  }

  return (
    <>
      <AuthContext.Provider
        value={{ isLoggedIn, login: login, logout: logout }}
      >
        <Router>
          <Navigator />
          {routes}
        </Router>
      </AuthContext.Provider>
    </>
  );
}

After login, I want to set the isLoggedIn state true. To do that, in my Login.js file, this is what I did:

export default function Login() {
  let loginURL = "******"
  const auth = useContext(AuthContext);

  const [lg] = useLogin();

  const handleLogin= async () => {
    const response = await lg.login(loginURL);
    console.log(response);
    auth.login(responsel.id) //defined in the App.js file. (Mentioned above)
  };

  return (
    <>
      <button
        type="button"
        onClick={handleLogin}
      >
        Login
      </button>
    </>
  );
}

I get the response properly in handleLogin function. After that, I call the auth.login function from the context to set the state isLoggedIn to true but then I get this warning:

Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.

And this happens infinitely and don't let any other things to load on the screen


问:
How to solve FileNotFoundError in Pyinstaller
Building PyQt5 Python App using Pyinstaller with a simple spec file . It's missing the resource file (.qrc)

Here is Link for the code

```<code>a = Analysis(
    ['PPOCRLabel.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)

##### include mydir in distribution #######
def extra_datas(mydir):
    def rec_glob(p, files):
        import os
        import glob
        for d in glob.glob(p):
            if os.path.isfile(d):
                files.append(d)
            rec_glob("%s/*" % d, files)
    files = []
    rec_glob("%s/*" % mydir, files)
    extra_datas = []
    for f in files:
        extra_datas.append((f, f, 'DATA'))

    return extra_datas
###########################################

# append the 'data' dir
a.datas += extra_datas('./libs')
</code>```

The lib directory exists in the same path as the spec file.

Error

File "os.py", line 1109, in add_dll_directory FileNotFoundError:
[WinError 2] The system cannot find the file specified:
'PaddleOCR\PPOCRLabel\dist\PPOCRLabel\paddle\fluid\..\libs'
[11588] Failed to execute script 'PPOCRLabel' due to unhandled
exception!

Body:
Building PyQt5 Python App using Pyinstaller with a simple spec file . It's missing the resource file (.qrc)

Here is Link for the code

a = Analysis(
    ['PPOCRLabel.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)

##### include mydir in distribution #######
def extra_datas(mydir):
    def rec_glob(p, files):
        import os
        import glob
        for d in glob.glob(p):
            if os.path.isfile(d):
                files.append(d)
            rec_glob("%s/*" % d, files)
    files = []
    rec_glob("%s/*" % mydir, files)
    extra_datas = []
    for f in files:
        extra_datas.append((f, f, 'DATA'))

    return extra_datas
###########################################

# append the 'data' dir
a.datas += extra_datas('./libs')

The lib directory exists in the same path as the spec file.

Error

File "os.py", line 1109, in add_dll_directory FileNotFoundError:
[WinError 2] The system cannot find the file specified:
'PaddleOCR\PPOCRLabel\dist\PPOCRLabel\paddle\fluid\..\libs'
[11588] Failed to execute script 'PPOCRLabel' due to unhandled
exception!


问:
Stamped out object has no attribute flush
I write my class Stamped out

Class StAmpedOut:
     nl = True
     def write (self,x)
     if x == 'n':
       old.out.write(x)
       self.nl = True
     elif:
       old_out.write('%s> %s (str(dt.now()),x))
       self.nl = False
     else:
       old_out.write(x)
sys.stdout = StAmpedOut()
```

Am getting attribute error object has no attribute flush thank you

I want my mqqt server to communicate with the client

Body:
I write my class Stamped out

Class StAmpedOut:
     nl = True
     def write (self,x)
     if x == 'n':
       old.out.write(x)
       self.nl = True
     elif:
       old_out.write('%s> %s (str(dt.now()),x))
       self.nl = False
     else:
       old_out.write(x)
sys.stdout = StAmpedOut()

Am getting attribute error object has no attribute flush thank you

I want my mqqt server to communicate with the client


问:
pandas.HDFStore store column that contains strings and None
When storing a Dataframe with a column that contains strings and None I get a performance warning. When I convert the column from object to string I get an error.
What is the best way to store this column without getting the performance warning?

Further elaboration on the warning would be appreciated as well.

```<code>import pandas as pd

store = pd.HDFStore('store_timeline3.h5')
df = pd.DataFrame(['test', None])

# Without this line I get:
# > your performance may suffer as PyTables will pickle object types that it cannot
# map directly to c-types [inferred_type->mixed,key->block0_values] [items->Int64Index([0], dtype='int64')]
df[0] = df[0].astype('string')

store['df'] = df
</code>```

Body:
When storing a Dataframe with a column that contains strings and None I get a performance warning. When I convert the column from object to string I get an error.
What is the best way to store this column without getting the performance warning?

Further elaboration on the warning would be appreciated as well.

import pandas as pd

store = pd.HDFStore('store_timeline3.h5')
df = pd.DataFrame(['test', None])

# Without this line I get:
# > your performance may suffer as PyTables will pickle object types that it cannot
# map directly to c-types [inferred_type->mixed,key->block0_values] [items->Int64Index([0], dtype='int64')]
df[0] = df[0].astype('string')

store['df'] = df


问:
Data Class Kotlin, How to access elements under List types
I am trying with quiz api where i have a data class which looks like this . and i am stuck how to get inside this List of Results, Please help me out this .

```<code>data class QuizDto(
    val response_code: Int,
    val results: List<Result>
)
</code>```

Now i am trying to get inside the results which is defined like this...

```<code>data class Result(
    val category: String,
    val correct_answer: String,
    val difficulty: String,
    val incorrect_answers: List<String>,
    val question: String,
    val type: String
)
</code>```

I am trying this code when I get the response from the api..

```<code>private val _resp = MutableLiveData<List<com.google.suryansh7202.quizapp.dto.Result>>()
    val question: LiveData<List<com.google.suryansh7202.quizapp.dto.Result>>
        get() = _resp

private fun getQuiz() = viewModelScope.launch {
        repository.getQuestions().let {
            response ->
            if (response.isSuccessful){
                _resp.postValue(response.body()!!.results)
            }else{
                Toast.makeText(app, "Something Went Wrong !", Toast.LENGTH_SHORT).show()
            }
        }
    }
</code>```

Now i am trying to get inside the result data class but i didn't know how to do that

```<code>quizViewModel.question.observe(this){ question->
           //         question.listIterator()
            }
</code>```

Update:

I have tried this approach, this seems to work

```<code>quizApiViewModel.question.observe(this){
                it.forEach {
                    Log.d("Quizyes","${it.incorrect_answers}")
                }

            }
</code>```

Body:
I am trying with quiz api where i have a data class which looks like this . and i am stuck how to get inside this List of Results, Please help me out this .

data class QuizDto(
    val response_code: Int,
    val results: List<Result>
)

Now i am trying to get inside the results which is defined like this...

data class Result(
    val category: String,
    val correct_answer: String,
    val difficulty: String,
    val incorrect_answers: List<String>,
    val question: String,
    val type: String
)

I am trying this code when I get the response from the api..

private val _resp = MutableLiveData<List<com.google.suryansh7202.quizapp.dto.Result>>()
    val question: LiveData<List<com.google.suryansh7202.quizapp.dto.Result>>
        get() = _resp

private fun getQuiz() = viewModelScope.launch {
        repository.getQuestions().let {
            response ->
            if (response.isSuccessful){
                _resp.postValue(response.body()!!.results)
            }else{
                Toast.makeText(app, "Something Went Wrong !", Toast.LENGTH_SHORT).show()
            }
        }
    }

Now i am trying to get inside the result data class but i didn't know how to do that

quizViewModel.question.observe(this){ question->
           //         question.listIterator()
            }

Update:

I have tried this approach, this seems to work

quizApiViewModel.question.observe(this){
                it.forEach {
                    Log.d("Quizyes","${it.incorrect_answers}")
                }

            }


问:
flutter firebase Accessing hidden method Ldalvik/system/CloseGuard;->close()V (greylist,core-platform-api, linking, allowed)
I wanted to publish some updates I wrote using flutter and firebase, which I shared in the store and are used by many users, I wanted to make some updates yesterday, there were no problems, I wanted to register and exit as the latest, but I sent users to the admin panel main.i am now getting this error in the debug console while calling at the dart exit

debug console :

```<code>Launching lib\main.dart on Android SDK built for x86 in debug mode...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
D/EGL_emulation(14746): eglMakeCurrent: 0xebb92b00: ver 2 0 (tinfo 0xc8f08720)

....

W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Ldalvik/system/CloseGuard;->close()V (greylist,core-platform-api, linking, allowed)
</code>```

Why am I getting this problem, thinking that it may be from the last changes I made in the codes where the data was not deleted in firebase, I used the codes of a working version again, but I continue to get the same error, now users can download the application from the store and register, but I get this error in the admin panel

// OKEY i solving problem when i update change some values and that changes create some issues. i delete changing from firebase db and problem is solving

Body:
I wanted to publish some updates I wrote using flutter and firebase, which I shared in the store and are used by many users, I wanted to make some updates yesterday, there were no problems, I wanted to register and exit as the latest, but I sent users to the admin panel main.i am now getting this error in the debug console while calling at the dart exit

debug console :

Launching lib\main.dart on Android SDK built for x86 in debug mode...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
D/EGL_emulation(14746): eglMakeCurrent: 0xebb92b00: ver 2 0 (tinfo 0xc8f08720)

....

W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/om.project.IKP(14746): Accessing hidden method Ldalvik/system/CloseGuard;->close()V (greylist,core-platform-api, linking, allowed)

Why am I getting this problem, thinking that it may be from the last changes I made in the codes where the data was not deleted in firebase, I used the codes of a working version again, but I continue to get the same error, now users can download the application from the store and register, but I get this error in the admin panel

// OKEY i solving problem when i update change some values and that changes create some issues. i delete changing from firebase db and problem is solving


问:
Using Sequence and widget handle with Many2many field Odoo15
I have an issue. I have added a many2many field to the product.template model. I have regular 'sequence' field. The many2many field has tree/list view I can manage the drag / movable option of the many2many table by using the following:

```<code><field name="tag_ids">
 <tree create="false" delete="false">
 <field name="sequence" widget="handle"/>
 <field name="name"/>
</tree>
</field>
</code>```

The problem is the tag names will be shown on the website. So, there can be 20 tags to 100 tags for each product, and the same tag could belong to many other products. and it is needed to define which tag should be shown first and which later for each product. So from the backend, the order of the tags needs to be defined by adding/removing using the widget handle of sequence. How to keep the order of the tags added in each product record the way I added them, knowing that many tags will be shared among products?

Body:
I have an issue. I have added a many2many field to the product.template model. I have regular 'sequence' field. The many2many field has tree/list view I can manage the drag / movable option of the many2many table by using the following:

<field name="tag_ids">
 <tree create="false" delete="false">
 <field name="sequence" widget="handle"/>
 <field name="name"/>
</tree>
</field>

The problem is the tag names will be shown on the website. So, there can be 20 tags to 100 tags for each product, and the same tag could belong to many other products. and it is needed to define which tag should be shown first and which later for each product. So from the backend, the order of the tags needs to be defined by adding/removing using the widget handle of sequence. How to keep the order of the tags added in each product record the way I added them, knowing that many tags will be shared among products?


问:
Chat Application- Trouble in making Client program
What i am making: i m making a chat application where client can send private message to other client using TCP socket programming.

What i am expecting from u guys: I want my client program will send data as JSON having command and other attributes, and based on different command attribute, server will function as it defined.

what i have tried:
Here is my server program

```<code>const net = require('net');

// Map of connected clients, with the key being the socket object and the value being the client's username
const clients = new Map();

const server = net.createServer((socket) => {
  // When a new client connects, set the socket's encoding to utf8 and send a welcome message
  socket.setEncoding('utf8');
  socket.write('Welcome! Please enter your username: ');

  // When data is received from the client, process it
  socket.on('data', (data) => {
    const message = JSON.parse(data);

    switch (message.command) {
      case 'register':
        if (!clients.has(socket)) {
            console.log("A client has joined the chat")
            //we have to return all connected clients username, so that it can check whom to send msg
            if(clients.size !== 0){
              const arr = []
              clients.forEach(v=>{
                arr.push(v)
              })
              socket.write(`Select whom u want to chat ${JSON.stringify(arr)}`);
            }
            //store every new client in the map,having socket obj as key and client username as value.
            clients.set(socket, data.username); //key:socket, value:userName.
            broadcast(`${data.username} has joined the chat.\n`, socket);
            return;
          }
        break;
      case 'private':
        const recipientSocket = [...clients.keys()].find((s) => clients.get(s) === message.sendTo); //sendTo is the username, whom sendBy user wants to send msg
        if (recipientSocket) {
          recipientSocket.write(`[private] ${message.sendFrom}: ${message.text}\n`);
        } else {
          socket.write(`User ${message.sendTo} not found.\n`);
        }
        break;
       case 'quit':
        broadcast(`${message.sendFrom} has left the chat.\n`,socket);
        // end the connection and delete the socket from map
        socket.end();
      default:
        broadcast(`${clients.get(socket)}: ${message.text}`, socket);
    }
  });

  socket.on("error",(err)=>{
    console.log('A client has disconnected.');
  })

  socket.on('end', () => {
    console.log('Client disconnected');
    clients.delete(socket);
  });

});

server.listen(3000, () => {
  console.log('Server listening on port 3000');
});

// Broadcast a message to all clients except the sender
function broadcast(message, sender) {
    [...clients.keys()]
      .filter((client) => client !== sender)
      .forEach((client) => client.write(message));
  }

</code>```

i want client program read the command line input, convert it into JSON as send it to server like this below:

```<code>client.write{JSON.stringify
    ({
        command: 'register',
        username: username,
      })
}

client.write{JSON.stringify
    ({
        command: 'private',
        username: username,
        text: message.join(' ')
      })
}
client.write{JSON.stringify
    ({
        command: 'quit',
        username: username,
      })
}
</code>```

----Thanks in advance :)

Body:
What i am making: i m making a chat application where client can send private message to other client using TCP socket programming.

What i am expecting from u guys: I want my client program will send data as JSON having command and other attributes, and based on different command attribute, server will function as it defined.

what i have tried:
Here is my server program

const net = require('net');

// Map of connected clients, with the key being the socket object and the value being the client's username
const clients = new Map();

const server = net.createServer((socket) => {
  // When a new client connects, set the socket's encoding to utf8 and send a welcome message
  socket.setEncoding('utf8');
  socket.write('Welcome! Please enter your username: ');

  // When data is received from the client, process it
  socket.on('data', (data) => {
    const message = JSON.parse(data);

    switch (message.command) {
      case 'register':
        if (!clients.has(socket)) {
            console.log("A client has joined the chat")
            //we have to return all connected clients username, so that it can check whom to send msg
            if(clients.size !== 0){
              const arr = []
              clients.forEach(v=>{
                arr.push(v)
              })
              socket.write(`Select whom u want to chat ${JSON.stringify(arr)}`);
            }
            //store every new client in the map,having socket obj as key and client username as value.
            clients.set(socket, data.username); //key:socket, value:userName.
            broadcast(`${data.username} has joined the chat.\n`, socket);
            return;
          }
        break;
      case 'private':
        const recipientSocket = [...clients.keys()].find((s) => clients.get(s) === message.sendTo); //sendTo is the username, whom sendBy user wants to send msg
        if (recipientSocket) {
          recipientSocket.write(`[private] ${message.sendFrom}: ${message.text}\n`);
        } else {
          socket.write(`User ${message.sendTo} not found.\n`);
        }
        break;
       case 'quit':
        broadcast(`${message.sendFrom} has left the chat.\n`,socket);
        // end the connection and delete the socket from map
        socket.end();
      default:
        broadcast(`${clients.get(socket)}: ${message.text}`, socket);
    }
  });

  socket.on("error",(err)=>{
    console.log('A client has disconnected.');
  })

  socket.on('end', () => {
    console.log('Client disconnected');
    clients.delete(socket);
  });

});

server.listen(3000, () => {
  console.log('Server listening on port 3000');
});

// Broadcast a message to all clients except the sender
function broadcast(message, sender) {
    [...clients.keys()]
      .filter((client) => client !== sender)
      .forEach((client) => client.write(message));
  }

i want client program read the command line input, convert it into JSON as send it to server like this below:

client.write{JSON.stringify
    ({
        command: 'register',
        username: username,
      })
}

client.write{JSON.stringify
    ({
        command: 'private',
        username: username,
        text: message.join(' ')
      })
}
client.write{JSON.stringify
    ({
        command: 'quit',
        username: username,
      })
}

----Thanks in advance :)