text:
Q: Pure PHP, extract HTML content from complex HTML string I have a complex HTML string similar to:
some text
main text
quotation
end of main text
 some other text

Using PHP I want to extract the entire content of the first blockquote, even if that includes other blockquotes:
main text
quotation
end of main text

The difficult part is I need to stop cutting the string at the right closing tag - the one belonging to the first opening tag (in this example, the last - but this must be dynamically determined).
This is the attempt I have so far:
<?php

$some_html = "
main text
quotation
end of main text
";
$result =  get_first_element_of_HTML_tag_name($some_html,'blockquote');

function get_first_element_of_HTML_tag_name($html_string,$tag_name) {
    $h = strtolower($html_string);
    $tag_open = "<" . $tag_name . ">";
    $tag_close = "</" . $tag_name . ">";

    $element_start = strpos($h,$tag_open)+strlen($tag_open);
    $element_end = strpos($h,$tag_close);

    $element = substr($h,$element_start,$element_end); // cut to first closing tag
    $element_s = $element;
    $i = 2;
    while ( strpos($element_s,"<blockquote") !== false ) { // as long as substring contains another opening tag
        // include another closing tag in the result
        $element = substr($h,$element_start,nth_strpos($h,$element_end,$i));
        $element_s = substr( $element_s, strpos($element_s,$tag_open)+strlen($tag_open), nth_strpos($element_s,strpos($element_s,$tag_close),$i));
        $i++;
    }
    return $hs; // return complete first element with $tag_name
}

function nth_strpos($str, $substr, $n) {
    $ct = 0;
    $pos = 0;
    while ( ( $pos = strpos($str, $substr, $pos) ) !== false ) {
        if (++$ct == $n) {
            return $pos;
        }
        $pos++;
    }
    return false;
}

php?>

$result is returning blank...
It's stuck somewhere in the nth_strpos function, I think.
Help or even simpler alternatives much appreciated!

A: As Barmar suggested, you should probably use a DOM parser. It just so happens that there's a DOM API that comes with PHP 5 that'll allow you to do this pretty easily. Here's an example:
$str = "some text
main text
quotation
end of main text
 some other text";
$doc = new DOMDocument();
$doc->loadHTML($str);
$element = $doc->getElementsByTagName("blockquote")->item(0);
$innerHTML= '';
foreach ($element->childNodes as $child)
    $innerHTML .= $doc->saveXML($child);
echo $innerHTML;

Output:
main text
quotation
end of main text


text:
Q: NTCIP Simulator I am writing a client application to interact with a NTCIP VMS Sign. We don't have the sign device available currently. Hence we want to develop NTCIP Sign Simulator and use it to test with our client application.
We don't have the sign yet but the sign adhers to NTCIP DMS 1203 v3 standard and we have the corresponding MIB file.
I guess I need to extend the SNMP4J Agent to build the sign simulator. But not sure how to go about it.
Any idea on how to go about it please?

A: Google "SNMP Simulator" for choices. Our product MIMIC Simulator is a commercial choice. The main difference in the choices is the effort to create a viable simulation, thus your decision is how much your time is worth. MIMIC ships with the NEMA NTCIP DMS 1203 MIB pre-compiled which should allow for a quick simulation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Best way to bypass 'VPN' port blocking for SMTP and IMAP on iOS I live in a country that requires a VPN to access most of the internet. My email is hosted outside of this country. The VPN provider provides Shadowsocks proxies which when wrapped in Shadowrocket on iOS act as a regular VPN. They started blocking common email ports lately due to the possibility of being abused.
I have at my disposal a home network inside of this country with a Pi4 on it so it can route this way before the VPN on the phone, or an Ubuntu box in a third country which requires the VPN to access.
I looked into port forwarding on the Ubuntu machine and using a PTR record to try and spoof that I'm connected to the email server when in actuality I'm connected to the middle IP but it didn't work, nothing has worked so far.
What would be the best way to connect to my email from inside the country of origin?


text:
Q: Having trouble with Keyboard Events in Java So I'm trying to use a KeyBoardEvent honestly just for testing purposes.. what I'm doing does not seem to be working :/ Hopefully you guys can tell me where I'm derping. Thanks!
package com.dillyg10.test.Keys;

import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class Keys extends JPanel implements KeyListener  {
    private static final long serialVersionUID = 1L;

    public Keys(){

    }

    public static void registerEvent(Window w){
        w.setFocusTraversalKeysEnabled(false);
        w.setFocusable(true);
        w.addKeyListener(new Keys());
    }
    public void keyPressed(KeyEvent e) {
        System.out.println(KeyEvent.getKeyText(e.getKeyCode()));
    }
    public void keyReleased(KeyEvent e) {

    }
    public void keyTyped(KeyEvent e) {

    }
    public static void gui() {

        JFrame frame = new JFrame("Keys");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        registerEvent(new Window(frame));

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args){
        SwingUtilities.invokeLater(new Runnable(){
            public void run(){
                gui();
            }
        });
     }
    }

This code is basically a test to determine if the keyboardevents work, i jsut print out the key when it's pressed.. but nothing is printed.

A: Solution
package com.java.tests;

import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class Keys extends JPanel implements KeyListener {

private static final long serialVersionUID = 1L;
public static Keys keys = new Keys();

public Keys() {
}

public void registerEvent(Window w) {
    w.addKeyListener(this);
    w.setSize(200,200);
}

@Override
public void keyPressed(KeyEvent e) {
    System.out.println(KeyEvent.getKeyText(e.getKeyCode()));
}

@Override
public void keyReleased(KeyEvent e) {
    System.out.println(KeyEvent.getKeyText(e.getKeyCode()));
}

@Override
public void keyTyped(KeyEvent e) {
}

public void gui() {

    JFrame frame = new JFrame("Keys");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    registerEvent(frame);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            keys.gui();
        }
    });
    }
}

A: Instead of w.addKeyListener(new Keys()); use w.addKeyListener(this);
Hope this might solve your problem.

A: Took liberty to make some changes to your code and managed to get it to work:
package sample.examples;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class Keys extends JPanel implements KeyListener  {
    private static final long serialVersionUID = 1L;

    public Keys(){
        this.setBackground(Color.black);
    }

    public void keyPressed(KeyEvent e) {
        System.out.println("Button Pressed: " + KeyEvent.getKeyText(e.getKeyCode()));
    }
    public void keyReleased(KeyEvent e) {

    }
    public void keyTyped(KeyEvent e) {

    }
    public void gui() {

        JFrame frame = new JFrame("Keys");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setPreferredSize(new Dimension(500,500));
        frame.setFocusTraversalKeysEnabled(false);
        frame.setFocusable(true);
        frame.setContentPane(this);
        frame.addKeyListener(this);

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args){
        SwingUtilities.invokeLater(new Runnable(){
            public void run(){
                Keys k = new Keys();
                k.gui();
            }
        });
     }
    }

One of your problems seems to have been the fact that you where not specifying any size to the JPanel, so, regardless of where you click you where never clicking on the JPanel. To make it easier for you, I coloured the JPanel black.


text:
Q: Passing array of refs in React I'm creating a ref array from another component, later on, I need to pass it to an inner component. Passing them as props is pointless in the inner component since it returns null. I tried forwarding an array of them, but that won't work either. I'm currently stuck at this point and I don't know how to go from here.
So the question is: What have I been doing wrong and what could be an alternative solution if mine is wrong? How would you guys pass multiple refs to an inner component?
Parent component:
const Path: React.FC = () => {

    {...}

    const pathParameters = [
        { d: 'M 500 500 L 800 500', fill: 'transparent', stroke: '#f00' },
        { d: 'M 810 500 L 1105 500', fill: 'transparent', stroke: '#f00' },
        { d: 'M 1110 500 L 1410 500 L 1410 810 L 810 810', fill: 'transparent', stroke: '#f00' },
        { d: 'M 800 810 L 500 810', fill: 'transparent', stroke: '#f00' },
        { d: 'M 805 495 L 805 195', fill: 'transparent', stroke: '#000' },
        { d: 'M 805 195 L 805 495', fill: 'transparent', stroke: '#000' },
        { d: 'M 805 505 L 805 805', fill: 'transparent', stroke: '#000' },
        { d: 'M 805 805 L 805 505', fill: 'transparent', stroke: '#000' }
    ];

    const pathRefs: RefObject<SVGPathElement>[] = [];

    const paths = pathParameters.map((path, index) => {
        pathRefs[index] = useRef(null);
        return (
            <path key={index} ref={pathRefs[index]} d={path.d} fill={path.fill} stroke={path.stroke} />
        );

    return (
        <svg
            onMouseMove={event => dispatch(updateMouseCoordinates(getMouseCoordinates(event)))}
            width='1920'
            height='1080'
            viewBox='0 0 1920 1080'
            xmlns='http://www.w3.org/2000/svg'
        >
            {paths}
            <Knob ref={pathRefs} />
        </svg>
    );
};

Inner component:
const Knob = React.forwardRef((props, ref) => {

    {...}

    return (
        <circle
            onMouseDown={() => dispatch(enableDragging())}
            onMouseUp={() => dispatch(disableDragging())}
            cx={knobCoordinates.x}
            cy={knobCoordinates.y}
            r='30'
        />
    );
});

export default Knob;

A: What I understand from your problem is that {paths} is not rendered when <Knob /> gets rendered so that's why your pathRefs is a null array. Plus the ref attribute on a component is to specify the component's ref, not to pass info to it.
In my opinion, an acceptable option would be to put your pathRefs' array in your state and update it on componentDidMount so you'll be able to pass this.state.pathRefs to your <Knob />


text:
Q: Setting user nickname and displayname to shortened email I am trying to set the user's display_name and nickname to the first part of the email address of a user (before the @) upon login if nickname is not set.
So far I've got:
add_action( 'wp_login', 'force_nicknames_on_login' );

function force_nicknames_on_login( $username ) {
    $user = get_user_by( 'login', $username );

    $nickname = get_user_meta( $user->ID, 'nickname', true );
    $email = $user_info->user_email;

    $email = substr( $email, 0, strpos( $email, "@" ) );

    if ( empty ($nickname) ) {
        $nickname = $email;
    }

    if ( ! empty( $nickname ) && ( $user->data->display_name != $nickname ) ) {
        $userdata = array(
            'ID' => $user->ID,
            'nickname' => $nickname,
            'display_name' => $nickname,
        );

        wp_update_user( $userdata );
    }
}

Which seems to set the display name up as the nickname if it's already set, but if the user registers without a nickname, it doesn't pull through the email before @.

A: I think you need to rethink your logic that decides to set the empty nickname to the email.
You need to do this, in this order:

*

*if the nickname is empty, set it to the email (and strip out the part after the '@' if you want.

*then you should have values for display name (whatever they entered), and nickname (whatever they entered, or their email if no entry)

*and then you can store the values

I note that there might be problems with the resultant data, though. The email address might not have a good 'visible' (recognizable?) value for the nickname. There might be some values of emails that wouldn't look good as a nickname.
So perhaps requiring a nickname might be better, or letting the nickname be blank. Perhaps asking for 'first/last name', email, and nickname (visible name). If the visible name is empty, then put in the first/last name. But alert the user that their first/last name will be used, so they may want to enter a nickname. (And then there is the GDPR stuff...)


text:
Q: Why can't Web Publish/Deploy Find my Web.config? I've just clone OrchardCMS from codeplex, built it and tried to deploy it to my web hosting service using Visual Studio's 'Publish' command.
No files get published and the publish fails with the following error:
1>------ Publish started: Project: Orchard.Web, Configuration: Release Any CPU ------
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(2352,5): Error : Could not open Source file: Could not find a part of the path 'C:\Users\Tim\targetsite.co.uk\src\Orchard.Web\Media\web.config;Media\web.config'.
1>
========== Build: 0 succeeded, 0 failed, 5 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
I've checked the source code, and the file is there and in the correct folder. So what's this error message actually trying to tell me? What's going on here and how do I fix it?

A: This is a bug. It's already been reported and is being addressed now:

*

*http://orchard.codeplex.com/workitem/19264

*http://orchard.codeplex.com/workitem/19282
The second report proposes a workaround that might help you out till this get fixed.


text:
Q: SQL Getting two sums and their diff from two tables I'm having an access database for a merchandise system. In this database there are two tables:
table purchases
id  article  date        amount  price
1   341      2022-02-03  3       23
2   343      2022-02-04  5       18
3   343      2022-02-08  7       21
4   345      2022-02-17  3       12
5   348      2022-02-21  8       45
6   341      2022-03-02  5       27

table sales
id  article  date        amount  price
1   343      2022-02-23  3       28
2   341      2022-02-24  5       30
3   341      2022-03-03  2       35
4   345      2022-03-07  3       18

Now I want to determine how much profit I've generated for each article. This means sum of amount * price for an sold article minus the sum of amount * price for the purchases article. The difficult part is, that if I've only sold 10 articles but purchased 15 articles I will need the sum of 10 purchased article and not from the 15. Otherwise my profit would be negative.
I know how I can solve this with a "regular" programming language by iterating through the rows but I'm wondering if this can be done with a single SQL query (e. g. with inner queries or similar).
Any help is appreciated.
Edit: The following would be the desired result for the example from above:
id  article  amount  bought  sold  profit
1   343      3       54      84    30
2   341      7       177     220   43
3   345      3       36      54    18

A: Try this:
SELECT
    a.article, a.buy, b.sell, (a.sell-a.buy) profit
FROM (
    SELECT
        article, SUM(amount * price) buy
    FROM purchases
    GROUP BY article
) a
INNER JOIN (
    SELECT
        article, SUM(amount * price) sell
    FROM sales
    GROUP BY article
) b ON a.article = b.article

A: I understand what you meaning and I wanted to edit but prevented by message 'Suggested edit queue is full'.
So I want to explain what you really want.

*

*You want bought amount to not exceed sold amount. (ex: Article 341 has sold amount of 7 and bought amount of 8, you want to limit amount to 7 for both bought and sold items)

*You want to sell first bought items first (FIFO). (ex: Article 341 has been bought 2 times with different amount (3 * 23 first, 5 * 27 second). You want to sell first 7 amount in this order: 3 * 23 + 4 * 27, not this order: 5 * 27 + 2 * 23
select * into purchases
from (
select 1 id, 341 article, '2022-02-03' date, 3 amount, 23 price union all
select 2, 343, '2022-02-04', 5, 18 union all
select 3, 343, '2022-02-08', 7, 21 union all
select 4, 345, '2022-02-17', 3, 12 union all
select 5, 348, '2022-02-21', 8, 45 union all
select 6, 341, '2022-03-02', 5, 27
) t;

select * into sales
from (
select 1 id, 343 article, '2022-02-23' date, 3 amount, 28 price union all
select 2, 341, '2022-02-24', 5, 30 union all
select 3, 341, '2022-03-03', 2, 35 union all
select 4, 345, '2022-03-07', 3, 18
) t;

select * into range
from (
select 1 rnum union all
select 2 rnum union all
select 3 rnum union all
select 4 rnum union all
select 5 rnum union all
select 6 rnum union all
select 7 rnum union all
select 8 rnum union all
select 9 rnum union all
select 10 rnum
) t;

select min(s.id) id, s.article, count(s.article) amount,
       sum(p.price) bought, sum(s.price) sold,
       sum(s.price) - sum(p.price) profit
from
(
select row_number() over (partition by p.article order by p.id) seq,
       p.article, p.price
from   purchases p
       inner join range r
       on p.amount >= r.rnum
) p
inner join
(
select row_number() over (partition by s.article order by s.id) seq,
       s.id, s.article, s.price
from   sales s
       inner join range r
       on s.amount >= r.rnum
) s
on p.article = s.article and p.seq = s.seq
group by s.article
order by min(s.id);

Result:
id  article amount  bought  sold    profit
1   343 3   54  84  30
2   341 7   177 220 43
4   345 3   36  54  18

https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=96decd2f92a8f77964a929013e825774
This is SQL Server solution. There's no row_number function in MS Access as you know. So you need to create new table to generate seq column with AutoNumber type to mimic row_number in case of MS Access.
If this solves your problem and you want this to be applied to MS Access, let me know it.

Now it's time for MS Access.
I said you need to create new table but I was wrong. You don't need.
I created RowNumber VBA function to mimic row_number SQL function.

*

*Create Class Module and name it to CRowNumber and paste following code.

Option Compare Database
Option Explicit

Private PartitionOld As String
Private RowNum As Integer
Private RowNums As New Dictionary

Public Table As String

Public Function RowNumber(Order As String, Partition As String) As Integer
    ' Order is used to prevent duplicated execution
    If RowNums.Exists(Order) Then
        ' Already executed before, so use cached value
        RowNum = RowNums(Order)
    Else
        ' If Partition changed, reset to 1, otherwise increase 1
        If (Partition <> PartitionOld) Then
            RowNum = 1
        Else
            RowNum = RowNum + 1
        End If

        'Debug.Print Table & "," & Order & ", " & Partition & "=" & PartitionOld & ":" & RowNum

        ' Cache for future use
        RowNums.Add Order, RowNum
    End If

    PartitionOld = Partition

    RowNumber = RowNum
End Function

*Create Module and paste following code.

Option Compare Database
Option Explicit

' To use Dictionary:
' [Tools] - [References] - Check [Microsoft Scripting Runtime]
' To clear cache:
' RowNumber "", "", "", True
Public Function RowNumber(Table As String, Order As String, Partition As String, Optional Reset As Boolean) As Integer
    Dim rn As CRowNumber
    Static RowNumbers As New Dictionary

    If Reset Then
        Set RowNumbers = New Dictionary
        RowNumber = 0
        Exit Function
    End If

    If RowNumbers.Exists(Table) Then
        Set rn = RowNumbers.Item(Table)
    Else
        Set rn = New CRowNumber
        rn.Table = Table
        RowNumbers.Add Table, rn
    End If

    RowNumber = rn.RowNumber(Order, Partition)
End Function

*Create Query and paste following SQL.

select min(s.id) as id, s.article, count(s.article) as amount,
       sum(p.price) as bought, sum(s.price) as sold,
       sum(s.price) - sum(p.price) as profit
from
(
select RowNumber('p', p.article & '.' & p.id & '.' & r.rnum, p.article) as seq,
       p.article, p.price
from   purchases as p
       inner join range as r
       on p.amount >= r.rnum
group by p.article, p.id, r.rnum, p.price
) as p
inner join
(
select RowNumber('s', s.article & '.'  & s.id & '.' & r.rnum, s.article) as seq,
       s.id, s.article, s.price
from   sales as s
       inner join range as r
       on s.amount >= r.rnum
group by s.article, s.id, r.rnum, s.price
) as s
on p.article = s.article and p.seq = s.seq
group by s.article
order by min(s.id);

*I used Dictionary in code to cache previous row number and table, to use Dictionary

*

*[Tools] - [References] - Check [Microsoft Scripting Runtime]

*Clear cache by calling RowNumber function in Immediate window before running query.

RowNumber "", "", "", True

*Run Query

You will see same result with SQL Server version.
You always need to clear cache before running query to use new cache for new query.
Difference between SQL Server and MS Access is

*

*row_number replaced to RowNumber VBA function

*SQL Server only need id, partition for numbering, But VBA function need more: Table, article, id, rnum because VBA function cannot change order of rows.

*order by repaced to group by to get sub query rows first and join next, otherwise optimizer will try to join first and get sub query rows next.
I am sorry I didn't explain enough about code, but I will answer if you have question about code.


text:
Q: Git understanding behaviour of checkout branch and presence and absence of files Variation of this question have been asked and answered but I am still perplexed as I work my way thru the Chacon book.
I have cloned my test repository from github.
I created a file in this called afile.txt that I stage and commit
I created a 2nd file in this called asecondfile.txt that I don't stage or commit
Now I execute
$ git checkout -b testing
Switched to a new branch 'testing'

When I list the files, I see only asecondfile.txt.
I make a change to this file, don't stage or commit and execute
$ git checkout master

If I cat asecondfile.txt I can see the changes I made in testing branch.
$ git checkout testing

I stage and commit the changes to asecondfile.txt.
$ git checkout master

I list files I don't see aseconfile.txt.
Really puzzled by this behavior and would be glad of an explanation.

A: When a file is neither staged nor committed, git doesn't know anything about it.  Such a path is called "untracked".  Git leaves these alone, but gripes about them being "untracked" when you run git status.  (You can shut up the griping, but ignore that until you get to .gitignore.)
Once a file is staged, though, it's no longer "untracked".  It's now a tracked file (and adding it to .gitignore won't help, it's already tracked). Once that tracked file is committed git knows to remove it when switching from a commit that has it—such as the commit you just made on testing—to a commit that doesn't.
This is what you saw: git checkout master removed the file, because it's committed (and therefore also in the index/staging-area) when you're on branch testing, and the commit that is the tip of branch master does not have that file.
Once git has removed it (by switching to master), the path is no longer staged nor committed, so if you create a new asecondfile.txt after switching to master, that's an "untracked" file.  If you then ask git to git checkout testing it should complain and fail by default: it would have to remove your untracked file, so as to replace it with a tracked file with (presumably) different contents.


text:
Q: Javascript associative array return TypeError I would like to make simple array (like in php), and I get error: "Uncaught TypeError: Cannot read property '480' of undefined(…)" where is the problem?
var $form = [];

for (var $i = 0; $i < 6; $i++) {
    $form[5][480]['value'][$i] = Math.floor(Math.random() * (6 - 4 + 1)) + 4;
}

Solution?
var $form = {
    5: {
        480: {
            value: []
        }
    }
};

for (var $i = 0; $i < 6; $i++) {
    $form[5][480]['value'][$i] = Math.floor(Math.random() * (6 - 4 + 1)) + 4;
}

console.log($form);

A: You're trying to access 480 off of $form[5], but $form[5] is undefined. Before your loop, you are setting $form = []; so there's nothing at position 5. $form is an empty array.
By the way, this is an associative array:
var array1, array2, array3;

array1 = [1,2,3];
array2 = [4,5,6];
array3 = [7,8,9];

var $form = [array1, array2, array3];

/*
     $form[0] // array1 - [1,2,3]
     $form[1] // array2 - [4,5,6]
     $form[2] // array3 - [7,8,9]

     $form[0][0] // array1[0] - 1
     $form[0][1] // array1[1] - 2

     ...

     $form[2][2] // array3[2] - 9
*/

It looks like what you may want to use is an object.
    $form = {  // initialize $form
      5:{
        480: { value: [] }
      }
    };

    for (var $i = 0; $i < 6; $i++) {
        $form[5][480]['value'][$i] = Math.floor(Math.random() * (6 - 4 + 1)) + 4;
    }

But if you need to use an array, this will work also:
    $form = [];  // initialize $form
    $form[5] = [];
    $form[5][480] = {value:[]};

A: var form = {
    "5": {
        "480": {
            "value": []
        }
    }
};

for (var i = 0; i < 6; i++) {
    form[5][480]['value'].push(Math.floor(Math.random() * (6 - 4 + 1)) + 4);
}

given, the code you showed, this should work...

A: You can do something close in javascript - this function is possibly not the prettiest way to do it, but it's generic
the first argument is the "root" object, this is followed at least 1 "nodes", and the last argument is the value
function assoc(root) {
    var parts = arguments.slice(1);
    var value = parts.pop();
    parts.reduce(function(result, part, index) {
        if (index < parts.length - 1) {
            return result[part] = result[part] || {};
        }
        result[part] = value;
    }, root);
}

now your code needs to change like this:
var $form = {}; // use an object, not an array
for (var $i = 0; $i < 6; $i++) {
    assoc($form,5,480,'value',$i, Math.floor(Math.random() * (6 - 4 + 1)) + 4);
}
console.log(JSON.stringify($form));


text:
Q: Countdown in Cocos2d I am trying to think through how to implement a countdown on a stamina level. For example, maximum 100% and over time it decreases. I don't need to know how to display it but the technology behind it to get it working and where to look.
This countdown would keep on going down when the application is closed.
I was looking at NSUserDefaults as a means to do this. Is this correct?
Similar to the top bar as shown below:

A: You can save latest refueled stamina value in NSUserDefaults or in iCloud and calculate current value using something like this:
timePassedInSeconds = currentTime - latestMaxValueSaveTime;
newStamina = latestMaxValue - (timePassedInSeconds * decreasePerSecond);

This way each time the player refuels stamina (e.g. buys some food for animal) you reset stamina to 100% (or add some percentage depending on food type) and save this value into latestMaxValue and save the time it was refueled into latestMaxValueSaveTime (you can store both in NSUserDefaults)
And you calculate newStamina in update: of the scene or in onEnter: method of the scene if it needs to be calculated once.
This way it will decrease even when the app is closed.
However, if you want to avoid players resetting stamina by changing device time you should get time from the server (preferably in UTC, to avoid issues with timezones and daylight saving).


text:
Q: How to add a radio button with price on product page? WordPress woocommerce How can to customize the product page to include an extract fee base on the user's choice. Something slimier to the attached photo with customize your order option on the product page not on checkout page.
I have this code which display the radio buttons and option on the checkout but for some reason the fee is not being added to the total.
    // Part 1
// Display Radio Buttons
// Uses woocommerce_form_field()

add_action( 'woocommerce_before_add_to_cart_form', 'bbloomer_checkout_radio_choice' );

function bbloomer_checkout_radio_choice() {

   $chosen = WC()->session->get('radio_chosen');
   $chosen = empty( $chosen ) ? WC()->checkout->get_value('radio_choice') : $chosen;
   $chosen = empty( $chosen ) ? 'no_option' : $chosen;

   $args = array(
   'type' => 'radio',
   'class' => array( 'form-row-wide' ),
   'options' => array(
      'no_option' => 'No Option',
      'option_1' => 'Option 1 ($10)',
      'option_2' => 'Option 2 ($30)',
   ),
   'default' => $chosen
   );

   echo '
';
   echo '
Customize Your Order!
';
   woocommerce_form_field( 'radio_choice', $args, $chosen );
   echo '
';

}

// Part 2
// Add Fee and Calculate Total
// Based on session's "radio_chosen"

#2 Calculate New Total

add_action( 'woocommerce_cart_calculate_fees', 'bbloomer_checkout_radio_choice_fee', 20, 1 );

function bbloomer_checkout_radio_choice_fee( $cart ) {

  if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;

  $radio = WC()->session->get( 'radio_chosen' );

  if ( "option_1" == $radio ) {
   $fee = 10;
  } elseif ( "option_2" == $radio ) {
   $fee = 30;
  }

  $cart->add_fee( __('Option Fee', 'woocommerce'), $fee );

}

// Part 3
// Refresh Checkout if Radio Changes
// Uses jQuery

add_action( 'wp_footer', 'bbloomer_checkout_radio_choice_refresh' );

function bbloomer_checkout_radio_choice_refresh() {
if ( ! is_checkout() ) return;
    ?>

    <?php
}

// Part 4
// Add Radio Choice to Session
// Uses Ajax

add_action( 'wp_ajax_woo_get_ajax_data', 'bbloomer_checkout_radio_choice_set_session' );
add_action( 'wp_ajax_nopriv_woo_get_ajax_data', 'bbloomer_checkout_radio_choice_set_session' );

function bbloomer_checkout_radio_choice_set_session() {
    if ( isset($_POST['radio']) ){
        $radio = sanitize_key( $_POST['radio'] );
        WC()->session->set('radio_chosen', $radio );
        echo json_encode( $radio );
    }
    die();
}

If I change the hook to add_action( 'woocommerce_product_options_general_product_data', 'bbloomer_checkout_radio_choice' );
The option buttons shows up on the check out page and it work fine, I assume some how I need to pass the option value from product page to the check out page

A: Add to follows code snippets to achieve your work -
function add_custom_fees_before_add_to_cart() {
    global $product;

    $args = array(
        'type' => 'radio',
        'class' => array( 'form-row-wide' ),
        'options' => array(
            '' => 'No Option',
            '10' => 'Option 1 ($10)',
            '30' => 'Option 2 ($30)',
        ),
        'default' => ''
    );
    ?>

        <?php _e( 'Customize Your Order!', 'textdomain' ); ?>
        <?php woocommerce_form_field( 'custom_fees', $args, '' ); ?>

    <?php
}

add_action( 'woocommerce_before_add_to_cart_button', 'add_custom_fees_before_add_to_cart', 99 );

function save_value_add_cart_item_data( $cart_item_data, $product_id, $variation_id ) {
    $custom_fees = filter_input( INPUT_POST, 'custom_fees' );

    if ( empty( $custom_fees ) ) {
        return $cart_item_data;
    }

    $cart_item_data['custom_fees'] = $custom_fees;

    return $cart_item_data;
}

add_filter( 'woocommerce_add_cart_item_data', 'save_value_add_cart_item_data', 99, 3 );

function calculate_add_cart_fee() {
    global $woocommerce;
    $cart_items = $woocommerce->cart->get_cart();
    foreach( $cart_items as $key => $item ) {
        if( !isset( $item['custom_fees'] ) && empty( $item['custom_fees'] ) ) continue;
        $woocommerce->cart->add_fee( __('Custom fees', 'textdomain'), $item['custom_fees'] );
    }
}
add_action( 'woocommerce_cart_calculate_fees', 'calculate_add_cart_fee', 99 );


text:
Q: How to run javascript/javascript in a XLST file Im attempting to run some javascript/jquery in a XSLT file to move a div, but its not taking effect, im wondering what I am doing wrong? Any help would be much appreciated!
<lxslt:script lang="javascript">
$(document).ready(function() {
$(".outter").appendTo(".inner");
});
</lxslt:script>

Heres the whole file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes" ></xsl:output>
<xsl:template match="/">

  <xsl:attribute name="lang">
    <xsl:value-of select="//Labels/Language"></xsl:value-of>
  </xsl:attribute>
  <xsl:attribute name="dir">
    <xsl:value-of select="//Labels/TextDirection"></xsl:value-of>
  </xsl:attribute>

    <xsl:value-of select="//Labels/Title" ></xsl:value-of>. <xsl:value-of select="//Labels/Text" ></xsl:value-of>

    <lxslt:script lang="javascript">
$(document).ready(function() {
$(".CookieDeclaration").appendTo(".mcontent");
});
</lxslt:script>

</xsl:template>
</xsl:stylesheet>


text:
Q: How to compute avg of an index for x days before a date (if the day is not a holiday) and merge it to dataframe? I have a dataset in which I have Traffic indices for a location on a given date.
For a given date, I want to compute the avg of all the traffic indices exactly 30 days before the given date and only consider the days in those 30 days subset if the day is not a holiday.
I want to do this computation using python. I have a screenshot below that visually represents my requirement.
Explanation of the screenshot

On April 1, 2019:
I want to calculate the 30 Day Non-Holiday traffic Index Average,
for a given location and map it to a new column with a similar column name.

The column weekend_holiday is a boolean column that is true (1) for days that are public holidays or weekends.
We must ignore such entries in the computation of Average Location's Traffic index.

Link to Sample Dataset: https://gist.github.com/skwolvie/f01c027de0816c28337870286ee61a9d

Please suggest python pandas tricks to achieve this result.

A: You can calculate a rolling mean using pandas' rolling, which accepts windows with time-based length.
The following code computes the averages you want for each row of the dataframe:
# Set date as index because it is needed if you want to do time-based rolling
df.Date = pd.to_datetime(df.Date)
df = df.set_index('Date')

# Drop weekends/holidays and then compute the average of the previous 30 days
df['DELHI'] = df.where(df.weekend_or_holiday == 0).rolling('30D').mean()['New Delhi']
df['MUMBAI'] = df.where(df.weekend_or_holiday == 0).rolling('30D').mean()['Mumbai']

# Get back Date column
df = df.reset_index()


text:
Q: Confidence Estimate in classification (or regression) I am using the sklearn SVC algorithm in the context of a time series, classifying the next time step as either being a positive increase or a negative increase.
My SVC is, right now, predicting the change with 65% accuracy...
Obviously, some of the predictions are going to be more certain than others.  Is there a way to determine the level of confidence of a support vector classification?
And if not, is there a classification or regression system that takes an n-dimensional array of input data, and will make a prediction with a confidence score?


text:
Q: How can i implement dark and light mode in a java swing gui application? I am fairly new to coding and I am working on a desktop application where I want to implement a dark and light mode. The problem is that I want to switch back and forth between the two, in the main class I have an instantiation of a class that represents my main view of the app if I pass and if I add an action that switches to dark/light mode it only affects the popups because the function is called after the instantiation of the main view it has the same effect if I call the function before the instantiation. I tried all sorts of solutions but I can't figure it out. If anybody has an idea thanks in advance. Here is the code.
import view.MainFrame;

public class Main {
    public static void main(String[] args) {
        MainFrame mainFrame = MainFrame.getInstance();
    }
}

import controller.ActionManager;
import lombok.Getter;
import lombok.Setter;
import javax.swing.*;
import java.awt.*;

@Getter
@Setter
public class MainFrame extends JFrame {

    private static MainFrame instance = null;
    private MenuBar RuMenuBar;
    private ToolBar toolBar;
    private ActionManager actionManager;

    private MainFrame(){ }

    private void initialiseActionManager() {
        actionManager = new ActionManager();
    }

    private void initialiseGUI() {
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension sc = tk.getScreenSize();
        int height = sc.height;
        int width = sc.width;
        setSize(width, height);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setTitle("Dokru");

        RuMenuBar = new MenuBar();
        setJMenuBar(RuMenuBar);

        toolBar = new ToolBar();

        add(toolBar,BorderLayout.NORTH);

        JPanel treePanel = new JPanel();

       // JScrollPane scrollPane = new JScrollPane(treePanel); todo scroll
        JPanel workspacePanel = new JPanel();
        JSplitPane splitPane = new
        JSplitPane(JSplitPane.HORIZONTAL_SPLIT,treePanel,workspacePanel);
        splitPane.setOneTouchExpandable(true);
        splitPane.setDividerLocation(300);
        getContentPane().add(splitPane, BorderLayout.CENTER);

        setLocationRelativeTo(null);
        setVisible(true);
    }

    public static MainFrame getInstance() {
        if(instance == null) {
            instance = new MainFrame();
            instance.initialiseActionManager();
            instance.initialiseGUI();
        }
        return instance;
    }
}

A: Happy to add more content in this section, this looks like a modern question for a very old framework like a swing.
However, there are opportunities to support this change in Java Swing, there are libraries like FlatLaf or material-ui-swing that give the possibility to implement different style in your app.
I'm the author of material-ui-swing so I will describe it, In particular, because It implements a concept of Material Theme (Since 2019) like the modern framework such as Flutter or Compose.
In fact, you can implement a custom theme as Jar and include it inside an external library, and an example can be DarkStackOverflowTheme.
To support the Dark mode and lite mode on your app, you can basically use the UI Manager to switch the Material theme in the MaterialUISwing(dark or lite theme).
Your question is a generic question but  did some demo that include also the switch of the theme in the JMenuBar, you can take a look to DemoSwingRatio

A: Use the system look and feel, you should get this automatically.
try {
    // Set System L&F
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (UnsupportedLookAndFeelException e) {
    // handle exception
}


text:
Q: Grouping values of a vector Lets say - I have the two vectors:
a    numbers=[14 14 2 25 25 14 14 14 2 23 23 23]:
b    frequency_of_the_numbers_above=[2 1 2 3 1 3];

c    new_numbers=[14 14 14 14 14 2 2 2 2 25 25 25 25 25 25 25 14 14 14 14 14 2 2 2 2 23 23 23 23 ];

b describes how often a value in vector a appears.For example:number 14 two times, that's why first number in b is 2 ,number 2 in vector a one time that's why second number in vector b is 1 etc.
what I now want is to adapt the vector b to vector c so that the result should look like:
new_numbers[14 14 14 14 14 2 2 2 2 25 25 25 25 25 25 25 14 14 14 14 14 2 2 2 2 23 23 23 23 ];
frequency_numbers_for_new_numbers=[2 2 2 2 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 1 1 1 1 3 3 3 3];

A: your question doesn't seem to fit what's in the vectors you posted. What b seems to be is how many of a given number appears in a in a ROW. As there are 5 14s in a. And your result seems to be whatever number was in b repeated for the number of that element in c is that what you want? Does a and c always contain the same numbers in the same order?
Well I'll write the code to do what I described (in java)
int index = 0;
int currentVal = c[0];
int[] result = new int[c.length];

for(int i = 0; i < result.length; i++)  {
    if(c[i] != currentVal) {
        index++; //if the number changed go to the next index for b
        currentVal = c[i]; //update the currentVal to the new value
    }
    result[i] = b[index]; //copy the value from b into the result vector
}


text:
Q: Handling resolution which is zoomed in to 150% via css I have created a web page which has a header section, this header section contains Name, menu items on next lines.

i have added padding on top of name and above,below menu items.
it works perfectly fine for most of the system.
However there are systems (windows 10) which is scaled to 150% in display settings.
Now since i am using padding in px the space is getting increased more than expected in those system.
how can i write custom code for these scenerios where i am not aware of default scale level in different screen size ?


text:
Q: Pandas DataReader does not recognise % as part of the string The following code is an attempt to call DAX historical index from google finance, however the % sign is converted to %25 when the function actually calls for "INDEXDB%3ADAX". How can I preserve the % sign without the conversion.
import pandas.io.data as web
import datetime

start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2013, 1, 27)
f = web.DataReader("INDEXDB%3ADAX", 'google', start, end)

Returns: IOError: after 3 tries, Google did not return a 200 for url 'http://www.google.com/finance/historical?q=INDEXDB%253ADAX&startdate=Jan+01%2C+2010&enddate=Jan+27%2C+2013&output=csv'

A: i don't think the encoding is the problem, the data simply is not available in google as csv format.
in browser post links,
https://www.google.com/finance/historical?q=INDEXDB:DAX&startdate=Jan+01%2C+2010&enddate=Jan+27%2C+2013
https://www.google.com/finance/historical?q=INDEXDB%3ADAX&startdate=Jan+01%2C+2010&enddate=Jan+27%2C+2013

both return html page without problem,
https://www.google.com/finance/historical?q=INDEXDB:DAX&startdate=Jan+01%2C+2010&enddate=Jan+27%2C+2013&output=csv
https://www.google.com/finance/historical?q=INDEXDB%3ADAX&startdate=Jan+01%2C+2010&enddate=Jan+27%2C+2013&output=csv

both return 404 not found.
basically, the data is not available for download as csv.


text:
Q: htmlunit-driver 2.26 has duplicate pom I am reffering to following pom entry for dependencies of htmlunit-driver.
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>htmlunit-driver</artifactId>
    <version>2.27</version>
</dependency>

But while packaging it with a JNLP file, I am getting following error:

Failed to execute goal org.codehaus.mojo:webstart-maven-plugin:1.0-beta-6:jnlp-inline (package) on project : Error while updating manifest of unprocessed_htmlunit-driver__V2.27.jar: duplicate entry: META-INF/maven/org.seleniumhq.selenium/htmlunit-driver/pom.xml -> [Help 1]

Investigating further I found that the htmlunit-driver-2.27.jar file contains two pom.properties and pom.xml.

Please help me to solve the issue:

*

*Should I rectify the JAR and use my own version .

*Is there any maven plugin available which can automatically resolve such corrupted JAR files.

*Any other available option.

A: This happens because of Eclipse/maven conflict as hinted in this question.
Since 2.27 was released, it can't be changed, but 2.28-snapshot was just deployed, if you can use it.
Otherwise, you can manually make your own version.
Regarding the next releases, mven clean should always precede deploy.


text:
Q: Can Ubuntu 13.10 use QQ International without wine? The Wine always crashes,so I don't want to use it.Can Ubuntu 13.10 use QQ International without wine ?

A: Yes there is beta version of qq international package was available for download on Linux.

*

*Download the .deb file from here.

*Move to the directory where .deb file was downloaded using cd.

*Install the .deb file by running the below command,
sudo dpkg -i <packagename>.deb

How to connect to the QQ Messenger network?

A: qq is not supported in Linux at all anymore. The qq for Linux never left beta and in its current form doesn't work at all.
Your best bet for using qq under Linux, is to use the Chinese based distros, Linux Deepin (currently at 2014 version) or Ubuntu Kylin 14.04, and up.
These 2 distros have a working PC version of wineqq that work OK, but I haven't been able to get video or audio working on any system to date. Either that or web qq (which sucks) are your only options at this point for the fullest qq experience currently available.


text:
Q: How can I draw this diagram in LaTeX?
This graphic was adapted from Hansen, McDonald, and Newey (2010), I am just trying to reproduce something similar in LaTeX.

A: The following uses a matrix of nodes in TikZ:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
  \matrix (m) [
    matrix of nodes,
    nodes={draw},
    column sep=10mm,
    row sep=10mm,
  ] {
    |[draw=none]| 5 parameters &          &         & SGT \\
    |[draw=none]| 4 parameters &          & SGED    & GT      & ST \\
    |[draw=none]| 3 parameters & SLaplace & GED     & SNormal & t & SCauchy \\
    |[draw=none]| 2 parameters & Laplace  & Uniform & Normal  &   & Cauchy \\
  };
  \begin{scope}[
    font=\footnotesize,
    inner sep=.25em,
    every node/.style={fill=white},
  ]
    \path
      (m-1-4) -- node[pos=.9] (tmp) {$p\rightarrow\infty$} (m-4-3)
    ;
    \draw[densely dashed]
      (m-1-4) -- (tmp) -- (m-4-3)
    ;
    \draw
      (m-1-4) -- node           {$q\rightarrow\infty$} (m-2-3)
      (m-1-4) -- node[pos=.7, inner sep=.2em] {$\lambda=0$} (m-2-4)
      (m-1-4) -- node           {$p=2$}                (m-2-5)
      (m-2-3) -- node           {$p=1$}                (m-3-2)
      (m-2-3) -- node           {$\lambda=0$}          (m-3-3)
      (m-2-3) -- node           {$p=1$}                (m-3-2)
      (m-2-4) -- node[pos=.225] {$q\rightarrow\infty$} (m-3-3)
      (m-2-4) -- node[pos=.225] {$p=2$}                (m-3-5)
      (m-2-5) -- node[pos=.775] {$q\rightarrow\infty$} (m-3-4)
      (m-2-5) -- node[pos=.55]  {$\lambda=0$}          (m-3-5)
      (m-2-5) -- node[pos=.55]  {$q=1/2$}              (m-3-6)
      (m-3-2) -- node           {$\lambda=0$}          (m-4-2)
      (m-3-3) -- node           {$p=1$}                (m-4-2)
      (m-3-3) -- node[pos=.6]   {$p=2$}                (m-4-4)
      (m-3-4) -- node           {$\lambda=0$}          (m-4-4)
      (m-3-5) -- node           {$q\rightarrow\infty$} (m-4-4)
      (m-3-5) -- node           {$q=1/2$}              (m-4-6)
      (m-3-6) -- node           {$\lambda=0$}          (m-4-6)
    ;
  \end{scope}
\end{tikzpicture}
\end{document}

Of course, it is possible to do this without white backgrounds:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
  \matrix (m) [
    matrix of nodes,
    nodes={draw},
    column sep=10mm,
    row sep=10mm,
  ] {
    |[draw=none]| 5 parameters &          &         & SGT \\
    |[draw=none]| 4 parameters &          & SGED    & GT      & ST \\
    |[draw=none]| 3 parameters & SLaplace & GED     & SNormal & t & SCauchy \\
    |[draw=none]| 2 parameters & Laplace  & Uniform & Normal  &   & Cauchy \\
  };
  \begin{scope}[
    font=\footnotesize,
    inner sep=.25em,
    line cap=round,
  ]
    \newcommand*{\LINE}[4][.5]{%
      \path (m-#2) -- node[pos=#1] (tmp) {$#4$} (m-#3);
      \draw (m-#2) -- (tmp) -- (m-#3);
    }
      \LINE      {1-4}{2-3}{q\rightarrow\infty}
      \LINE[.7]  {1-4}{2-4}{\lambda=0}
      \LINE{1-4} {2-5}{p=2}
      \LINE      {2-3}{3-2}{p=1}
      \LINE      {2-3}{3-3}{\lambda=0}
      \LINE      {2-3}{3-2}{p=1}
      \LINE[.225]{2-4}{3-3}{q\rightarrow\infty}
      \path
        (tmp.south west) coordinate (gt1ll)
        (tmp.north east) coordinate (gt1ur)
      ;
      \LINE[.225]{2-4}{3-5}{p=2}
      \LINE[.775]{2-5}{3-4}{q\rightarrow\infty}
      \LINE[.55] {2-5}{3-5}{\lambda=0}
      \LINE[.55] {2-5}{3-6}{q=1/2}
      \LINE      {3-2}{4-2}{\lambda=0}
      \LINE      {3-3}{4-2}{p=1}
      \LINE[.6]  {3-3}{4-4}{p=2}
      \LINE      {3-4}{4-4}{\lambda=0}
      \LINE      {3-5}{4-4}{q\rightarrow\infty}
      \LINE      {3-5}{4-6}{q=1/2}
      \LINE      {3-6}{4-6}{\lambda=0}
    ;
    \begin{scope}
      \clip
        (m-1-1) rectangle (m-4-6)
        (gt1ll) rectangle (gt1ur)
      ;
      \path
        (m-1-4) -- node[pos=.9] (tmp) {$p\rightarrow\infty$} (m-4-3)
      ;
      \draw[densely dashed]
        (m-1-4) -- (tmp) -- (m-4-3)
      ;
    \end{scope}
  \end{scope}
\end{tikzpicture}
\end{document}

The following variant changes the dashed line to avoid the crossing of other labels.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
  \matrix (m) [
    matrix of nodes,
    nodes={draw},
    column sep=10mm,
    row sep=10mm,
  ] {
    |[draw=none]| 5 parameters &          &         & SGT \\
    |[draw=none]| 4 parameters &          & SGED    & GT      & ST \\
    |[draw=none]| 3 parameters & SLaplace & GED     & SNormal & t & SCauchy \\
    |[draw=none]| 2 parameters & Laplace  & Uniform & Normal  &   & Cauchy \\
  };
  \begin{scope}[
    font=\footnotesize,
    inner sep=.25em,
    line cap=round,
  ]
    \newcommand*{\LINE}[4][.5]{%
      \path (m-#2) -- node[pos=#1] (tmp) {$#4$} (m-#3);
      \draw (m-#2) -- (tmp) -- (m-#3);
    }
    \LINE[.55] {1-4}{2-3}{q\rightarrow\infty}
    \LINE      {1-4}{2-4}{\lambda=0}
    \LINE      {1-4}{2-5}{p=2}
    \LINE      {2-3}{3-2}{p=1}
    \LINE      {2-3}{3-3}{\lambda=0}
    \LINE      {2-3}{3-2}{p=1}
    \LINE[.225]{2-4}{3-3}{q\rightarrow\infty}
    \path
      (tmp.south west) coordinate (gt1ll)
      (tmp.north east) coordinate (gt1ur)
    ;
    \LINE[.225]{2-4}{3-5}{p=2}
    \LINE[.775]{2-5}{3-4}{q\rightarrow\infty}
    \LINE[.55] {2-5}{3-5}{\lambda=0}
    \LINE[.55] {2-5}{3-6}{q=1/2}
    \LINE      {3-2}{4-2}{\lambda=0}
    \LINE      {3-3}{4-2}{p=1}
    \LINE[.6]  {3-3}{4-4}{p=2}
    \LINE      {3-4}{4-4}{\lambda=0}
    \LINE      {3-5}{4-4}{q\rightarrow\infty}
    \LINE      {3-5}{4-6}{q=1/2}
    \LINE      {3-6}{4-6}{\lambda=0}
    \path
      (m-2-3.center) -- coordinate[pos=.45] (tmp1) (m-2-4.center)
      (m-3-3.center) -- coordinate[pos=.45] (tmp2) (m-3-4.center)
      (tmp2) -- node[pos=.7] (tmp3) {$p\rightarrow\infty$} (m-4-3)
    ;
    \draw[densely dashed]
      (m-1-4) -- (tmp1) -- (tmp2) -- (tmp3) (tmp3) -- (m-4-3)
    ;
  \end{scope}
\end{tikzpicture}
\end{document}

A: Here is how I would do it:
\documentclass[tikz]{standalone}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{xfrac}

\begin{document}

\tikzset{
    justtext/.style = {
        rectangle,
        fill = none,
        draw = none,
        inner sep = 0pt,
        line width = 0pt,
        minimum width = 0pt,
        minimum height = 0pt
    },
    lbl/.style = {
        justtext,
        midway,
        font = \small,
        fill = white,
        inner sep = 0.5ex
    }
}

% [#1]  Options for label.
%  #2   Node 1.
%  #3   Node 2.
%  #4   Label text; will be put in math mode.
\newcommand{\link}[4][]{%
    \draw (#2) -- node[lbl, #1] {$#4$} (#3);%
}

\begin{tikzpicture}[
            x = 2.75cm,
            y = 2cm,
            every node/.style = {
                draw,
                thick,
                minimum width = 5em,
                minimum height = 4ex,
            }
        ]
    \foreach \i in {2, ..., 5}
        \node[justtext] at (0, \i - 2) {\i~parameters};

    \node (la) at (1, 0) {Laplace};
    \node (un) at (2, 0) {Uniform};
    \node (no) at (3, 0) {Normal};
    \node (ca) at (5, 0) {Cauchy};

    \node (sl) at (1, 1) {SLaplace};
    \node (ge) at (2, 1) {GED};
    \node (sn) at (3, 1) {SNormal};
    \node (t)  at (4, 1) {t};
    \node (sc) at (5, 1) {SCauchy};

    \node (sg) at (2, 2) {SGED};
    \node (gt) at (3, 2) {GT};
    \node (st) at (4, 2) {ST};

    \node (sgt) at (3, 3) {SGT};

    \link{la}{sl}{\lambda = 0}
    \link{la}{ge}{p = 1}
    \link{no}{ge}{p = 2}
    \link{no}{sn}{\lambda = 0}
    \link{no}{t}{q \to \infty}
    \link{ca}{t}{q = \sfrac{1}{2}}
    \link{ca}{sc}{\lambda = 0}

    \link{sl}{sg}{p = 1}
    \link{ge}{sg}{\lambda = 0}
    \link[pos = 0.2]{ge}{gt}{q \to \infty}
    \link[pos = 0.2]{sn}{sg}{p = 2}
    \link[pos = 0.2]{sn}{st}{q \to \infty}
    \link{t}{st}{\lambda = 0}
    \link[pos = 0.2]{t}{gt}{p = 2}
    \link{sc}{st}{q = \sfrac{1}{2}}

    \link{sg}{sgt}{q \to \infty}
    \link{gt}{sgt}{\lambda = 0}
    \link{st}{sgt}{p = 2}

    \begin{scope}[draw = gray, dashed]
        \link[pos = 0.1]{un.east}{sgt.west}{p \to \infty}
    \end{scope}
\end{tikzpicture}
\end{document}

Note that in a normal document class, you will have to add the tikz package, of course. xfrac is just for the \sfrac command for the 1/2 stuff; might be a bit overkill but it looks prettier.
I created two styles of nodes: one for the blocks of text with nothing drawn, and one for the labels on the edges. I used a \foreach to write the stuff on the left because it was funnier this way; it gives you an example of a foreach and it makes the code easier to modify since the style and text and whatnot is only written once. I also modified the default node style, but only for this particular tikzpicture environment. Moreover, x and y allow you to tweak the scale and stuff.
For the edges, I created a command \link that links two nodes and writes math stuff on the edge. An optional parameter allows the user to give additional stuff to the label node; I use this optional parameter to position the label closer to the beginning of the edge in cases where edges cross (pos = 0.2).

By the way, I wrote "parameterS", but maybe I'm just misinterpreting the text from the image you showed. It just seemed weird to me without this "s". Feel free to change it.

A: A solution with pstricks. It is based on the psmatrix environment and psDefBoxNodes command from pst-node. The latter associates to  the bounding box of a given text 12 nodes: tl (top left), tC (top Center), tr (topright), Cl (Center left), Bl (Baseline left), bl (bottom left), &c.. Based on this command, I defined a \framenode[optional width] nodename}{contents} command. The default width is 4.5 em:
\documentclass[x11names, border=5pt]{standalone}
\usepackage{pstricks-add, auto-pst-pdf}%
\usepackage{mathtools}

\newcommand{\framenode}[3][4.5em]{\psDefBoxNodes{#2}{\setlength{\fboxrule}{1pt}\fbox{\parbox{#1}{\rule{0pt}{3ex}\centering#3\rule[-1.25ex]{0pt}{1.25ex}}}}}

\begin{document}

\begin{pspicture}
    \small\everypsbox{\everymath{\scriptstyle}}
    \renewcommand{\pscolhooki}{\psset{mcol=l}}
    \begin{psmatrix}[colsep=1cm, rowsep=1.25cm]
        5 parameter & & & \framenode{SGT}{SGT} \\
        4 parameter & & \framenode{SG}{SGED} & \framenode{GT}{GT} & \framenode{ST}{ST} \\
        3 parameter & \framenode{SL}{SLaplace} & \framenode{GE}{GED} & \framenode{SN}{SNormal} & \framenode{T}{t} & \framenode{SC}{SCauchy} \\
        2 parameter & \framenode{L}{Laplace} & \framenode{U}{Uniform} & \framenode{N}{Normal} & & \framenode{C}{Cauchy}
    \end{psmatrix}
    %% Connexions
    \psset{linewidth=0.4pt, framesep=3pt, ref=r}
    % Niveau 1
    \ncline{SGT:Cl}{SG:tC}\ncput*[framesep=1pt, ref=c]{$q\to∞$}
    \ncline{SGT:bC}{GT:tC}\ncput*{$λ=\mathrlap{0}$}
    \ncline{SGT:Cr}{ST:tC}\ncput*{$ p=\mathrlap{2}$}
    \ncline[linestyle=dashed, dash=2pt 2pt]{SGT:Cl}{U:Cr}\ncput*[framesep=1pt, ref=c, npos=0.85]{$p\to∞$}
    %Niveau 2
    \ncline{SG:Cl}{SL:tC}\ncput*{$p=\mathrlap{1}$}
    \ncline{SG:bC}{GE:tC}\ncput*{$λ=\mathrlap{0}$}
    \ncline{SG:Cr}{SN:tC}\ncput*[npos=0.8]{$ p=\mathrlap{2}$}
    \ncline{GT:Cl}{GE:tC}\ncput*[framesep=1pt, ref=c]{$q\to∞$}
    \ncline{GT:Cr}{T:tC}\ncput*{$ p=\mathrlap{2}$}
    \ncline{ST:Cl}{SN:tC}\ncput*[framesep=1pt, ref=c]{$q\to∞$}
    \ncline{ST:bC}{T:tC}\ncput*{$λ=\mathrlap{0}$}
    \ncline{ST:Cr}{SC:tC}\ncput*{$q=1\mkern-2mu/\mkern-1.5mu\mathrlap{2}$}
    % Niveau 3
    \ncline{SL:bC}{L:tC}\ncput*{$λ=\mathrlap{0}$}
    \ncline{GE:Cl}{L:tC}\ncput*{$p=\mathrlap{1}$}
    \ncline{GE:Cr}{N:tC}\ncput*{$ p=\mathrlap{2}$}
    \ncline{SN:bC}{N:tC}\ncput*{$λ=\mathrlap{0}$}
    \ncline{T:Cl}{N:tC}\ncput*[framesep=1pt, ref=c]{$q\to∞ $}
    \ncline{T:Cr}{C:tC}\ncput*{$q=1\mkern-2mu/\mkern-1.5mu\mathrlap{2}$}
    \ncline{SC:bC}{C:tC}\ncput*{$λ=\mathrlap{0}$}
\end{pspicture}

\end{document}


text:
Q: How to stop re render child component when any state changed in react js? I have a parent componenet, Inside this I have included a child component with props.
but When any state is changed in parent component (that doesn't related to child component) then child component re-render. I don't want this re render
on every state change. Can we stop?

import React, { useState } from "react";
import ReactDOM from "react-dom";
import Child from "./child";
import "./styles.css";

function App() {
  const [any_state, setAnyState] = useState(false);

  const handleClick = () => {
    setAnyState(!any_state);
  };
  return (

      Parent Page ({any_state ? "true" : "false"})

      <button onClick={handleClick}>Click me</button>
      <Child data={"any data"} />

  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

child.js
import React from "react";

function Child(props) {
  console.log("child component");
  return
child Page
;
}

export default Child;

https://codesandbox.io/s/clever-oskar-fpxm3?fontsize=14
I don't want "child component" to be displayed in console on every state change.

A: You want to use React.memo for this. Read more here.
This will prevent re-renders when props did not change.
Instead of export default Child; use export default React.memo(Child); in your child.js.
import React from "react";

function Child(props) {
  console.log("child component");
  return
child Page
;
}

export default React.memo(Child);

A: You gonna have to set up a Redux state
Or you just isolate the React Hook useState, make a good component destructuring :)
App.js
import React, { useState } from "react";
import ReactDOM from "react-dom";
import Child from "./child";
import Parent from "./parent"; // <--------- HERE
import "./styles.css";

function App() {
  return (

      <Parent />
      <Child data={"any data"} />

  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

parent.js
function Parent() {
  const [any_state, setAnyState] = useState(false);

  const handleClick = () => {
    setAnyState(!any_state);
  };
  return (
    <>
      Parent Page ({any_state ? "true" : "false"})

      <button onClick={handleClick}>Click me</button>
    </>
  );
}


text:
Q: C# Random class strange errors namespace RandomBug
{
    class Program
    {
        static Random rnd = new Random(0);
        static void Main(string[] args)
        {
            for (int i = 0; i < 1000000; i++)
                Program.rnd.Next(100);
        }
    }
}

This code gives me all kind of strange inner errors like:  Null Access, Array out of range, etc.
This not happen if the Random is not static. I'm using VS 2015.
I found this problem after I saw bad random results on C# Unity.

A: There is a default unity feature that works as well:
namespace RandomBug
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 1000000; i++)
                Random.Range(0,100);
        }
    }
}


text:
Q: How can I bind a Polygon Fill property to the Background property of the button? I have created a HexagonButton by using Styles and ControlTemplates. At this moment the HexagonButton background is blue.
I would like to have possibility to set its background color at the moment of loading the button or at least when put it to the canvas. Unfortunaty when I put button to the canvas and try to change Background to other color for example to Red all effects connected to IsMouseOver, IsPressed do not work.
Is it possible to connect this
<Polygon x:Name="HexagonPolygon" Points="1,0 0.50046, 0.86576 -0.50046, 0.86576 -1,0 -0.50046,-0.86576 0.50046,-0.86576" Fill="{TemplateBinding Background}"  Stroke="{TemplateBinding Background}" StrokeThickness="2" Stretch="Uniform"/>

with this
        <Button Name ="OO" Width="100" Height="100"  Background ="Red" Canvas.Left="176" Canvas.Top="120" Click="Button_Click"/>

I don't really understand how I could solve my problem and need some advise to continue my attempts in right direction. Should I create a user control or something like that?
Or may be it is possible to solve this problem with DynamicResources, but how.
Here is the whole code.
<Window x:Class="ForthHexagonButtonWR.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ForthHexagonButtonWR"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>

    <ResourceDictionary>
        <RadialGradientBrush RadiusX="1" RadiusY="1" GradientOrigin="0.5,0.5" x:Key="HighlightBackground"  >
            <GradientStop Color="White" Offset="0" />
            <GradientStop  Color="Blue" Offset=".6" />
        </RadialGradientBrush>

        <RadialGradientBrush RadiusX="1" RadiusY="1" GradientOrigin="0.5,0.5" x:Key="PressedBackground">
            <GradientStop Color="White" Offset="0" />
            <GradientStop  Color="Blue" Offset="1" />
        </RadialGradientBrush>

        <SolidColorBrush x:Key="DefaultBackground" Color="Blue" ></SolidColorBrush>
        <SolidColorBrush Color="Gray" x:Key="DisabledBackground"></SolidColorBrush>

        <RadialGradientBrush RadiusX="1" RadiusY="1" GradientOrigin="0.5,0.5" x:Key="Border">
            <GradientStop Color="White" Offset="0" />
            <GradientStop Color="Blue" Offset="1" />
        </RadialGradientBrush>

        <!-- The style that applies the button control template. -->
        <Style TargetType="{x:Type Button}" >
            <Setter Property="Template" >
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}" >
                        <Polygon x:Name="HexagonPolygon" Points="1,0 0.50046, 0.86576 -0.50046, 0.86576 -1,0 -0.50046,-0.86576 0.50046,-0.86576" Fill="{TemplateBinding Background}"  Stroke="{TemplateBinding Background}" StrokeThickness="2" Stretch="Uniform"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="BorderBrush" Value="{StaticResource Border}"></Setter>
            <Setter Property="Background"  Value="{StaticResource DefaultBackground}"></Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="{StaticResource HighlightBackground}" />
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter Property="Background" Value="{StaticResource PressedBackground}" />
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Background" Value="{StaticResource DisabledBackground}"></Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </ResourceDictionary>
</Window.Resources>

<Canvas>
    <Button Name ="OO" Width="100" Height="100"  Canvas.Left="176" Canvas.Top="120" Click="Button_Click"/>
    <Button Name ="O1" Width="100" Height="100"  Canvas.Left="176" Canvas.Top="34" Click="Button_Click"/>
    <Button Name ="O2" Width="100" Height="100"  Canvas.Left="250" Canvas.Top="76" Click="Button_Click"/>
    <Button Name ="O3" Width="100" Height="100"  Canvas.Left="251" Canvas.Top="162" Click="Button_Click"/>
    <Button Name ="O4" Width="100" Height="100"  Canvas.Left="177" Canvas.Top="206" Click="Button_Click"/>
    <Button Name ="O5" Width="100" Height="100"  Canvas.Left="103" Canvas.Top="162" Click="Button_Click"/>
    <Button Name ="O6" Width="100" Height="100"  Canvas.Left="101" Canvas.Top="76" Click="Button_Click"/>
</Canvas>

A: When you set Background for your Button from outside, the Style trigger setter inside won't be able to change the Background because of DependencyProperty value precedence (the local setting will override the setting via Style in this case).
So you should change the Fill of the internal Polygon directly, instead of the Background of the templated parent (Button). However you need to move all Triggers into the ControlTemplate (using ControlTemplate's Triggers instead of Style's Triggers):
<Style TargetType="{x:Type Button}" >
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}" >
                    <Polygon x:Name="HexagonPolygon" Points="1,0 0.50046, 0.86576 -0.50046, 0.86576 -1,0 -0.50046,-0.86576 0.50046,-0.86576" Fill="{TemplateBinding Background}"  Stroke="{TemplateBinding Background}" StrokeThickness="2" Stretch="Uniform"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                           <Setter TargetName="HexagonPolygon" Property="Fill" Value="{StaticResource HighlightBackground}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                           <Setter TargetName="HexagonPolygon" Property="Fill" Value="{StaticResource PressedBackground}" />
                         </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                           <Setter TargetName="HexagonPolygon" Property="Fill" Value="{StaticResource DisabledBackground}"></Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush" Value="{StaticResource Border}"></Setter>
        <Setter Property="Background"  Value="{StaticResource DefaultBackground}"></Setter>
    </Style>

We use TargetName of a Setter to indicate which element (inside the ControlTemplate's scope) having the property to be set.

A: This is because you might be overlaying the background with the background you define while loading your control. Please see already posted answer.
You might need to use DynamicResource for working the things out.


text:
Q: Normal states on a type III$_1$ factor Let $M$ be a type III$_1$ factor. Suppose $\rho$ is a normal state on $M$, given any $c\in [0,2]$, can we find a normal state $\rho'$ on $M$ such that $\|\rho-\rho'\|=c$? Or can we find a sequence of normal states $\rho_n$ such that $\|\rho-\rho_n\|\to c$ as $n\to \infty$?

A: I don't think you can get $c = 2$, but you can do this for any $c \in [0,2)$. Given $\epsilon > 0$, find a projection $p \in M$ with $\rho(p) < \epsilon$ and then find $\rho'$ supported on $p$. Then $$(\rho - \rho')(1 - 2p) = 1 - 2\rho(p) - 1 + 2 = 2(1 - \rho(p)),$$ showing that $\|\rho - \rho'\|$ can be arbitrarily close to $2$. Then linearly interpolating between $\rho$ and $\rho'$ gives you normal states of any intermediate distance to $\rho$.


text:
Q: Splash Screen won't hide I'm trying to add a SplashScreen to my Application but i'm facing an issue:
The SplashScreen loads and just that... it doesn't take me to the Main Activity.
Here's the SplashScreenActivity.java:
import android.app.Activity;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class SplashScreenActivity extends Activity {
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        Window window = getWindow();
        window.setFormat(PixelFormat.RGBA_8888);

    }
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        StartAnimations();
    }
    private void StartAnimations() {
        Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
        anim.reset();
        LinearLayout l=(LinearLayout) findViewById(R.id.lin_lay);
        l.clearAnimation();
        l.startAnimation(anim);

        anim = AnimationUtils.loadAnimation(this, R.anim.translate);
        anim.reset();
        ImageView iv = (ImageView) findViewById(R.id.logo);
        iv.clearAnimation();
        iv.startAnimation(anim);

    }
}

Sorry for my english.

A: Add this to the end of your startAnimations method:
Handler handler = new Handler();
handler.postDelayed(new Runnable(){
    @Override
    public void run() {
      Intent intent = new Intent(SplashScreenActivity.this, MainActivity.class); //assuming your main ctivity is called that
      startActivity(intent);
      SplashScreenActivity.this.finish();

}, 3000); //assuming you want for the splashscreen to be displayed for 3 seconds.

A: Use this after your animation...
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();


text:
Q: Ajax call returns same result I have a jquery modal button, where I want to display information from my database.
I have a field in the database where I want everything to be identified by it is called "number"
The modal button is displayed in a table which is already being looped from a SQL query displaying all entries
while ($row = getarray($res)){

     <? $row["state"] ?>
    <? $row["number"] ?>

    <button type="button" class="btn btn-primary" onclick="detailsmodal(<?
    $row["number"])">Description</button>

<button type ="button" class="btn btn-primary" onclick="detailsmodal(<?= $row['number']; ?>)>Modal Button</button>

<?php
$number =$_POST["number"];
$number =(int)$number;
$modalsql = myquery($dbvariable,"SELECT * FROM myTable WHERE Number = '$number' ");
$result2 = myfunction_fetch_array($modalsql);
ob_start();

?>

    <button type="button" class="close" onclick="closeModal()" aria-label="Close">×</button>

 <?= $result2['number']?>

Field 1:<?= $result2['number']?>

Field 2:<?= $result2['field_2']?>

Field 3<?= $result2['field_3']?>

Field 4:<?= $result2['field_4']?>

Field 5:<?= $result2['field_5']?>

Field 6:<?= $result2['field_6']?>

     <button type="button" class="btn btn-default" onclick="closeModal()">Close</button>

<?php
ob_get_clean();
?>

Ideally, the information should be changed based on the different items that are being clicked. but it is staying the same.

A: Please try to use following code , there are so many typo mistakes you have in your code.
<?php while ($row = getarray($res)){ ?>

             <? $row["state"] ?>
            <? $row["number"] ?>

              <button type="button" class="btn btn-primary" onclick="detailsmodal(<?=
              $row["number"]) ?>">Description</button>

          <button type ="button" class="btn btn-primary" onclick="detailsmodal(<?= $row['number']; ?>)">Modal Button</button>

          <?php
          $number =$_POST["number"];
          $number =(int)$number;
          $modalsql = myquery($dbvariable,"SELECT * FROM myTable WHERE Number = '".$number."' ");
          $result2 = myfunction_fetch_array($modalsql);
          ob_start();

          ?>

                  <button type="button" class="close" onclick="closeModal()" aria-label="Close">×</button>

 <?= $result2['number']?>

Field 1:<?= $result2['number']?>

Field 2:<?= $result2['field_2']?>

Field 3<?= $result2['field_3']?>

Field 4:<?= $result2['field_4']?>

Field 5:<?= $result2['field_5']?>

Field 6:<?= $result2['field_6']?>

                 <button type="button" class="btn btn-default" onclick="closeModal()">Close</button>

         <?php
         ob_get_clean();
         ?>


text:
Q: How to subset Nested Dictionaries I have a dictionary like the following:
original = {"Triclusters":{"0":{"%Missings":"0","ColumnPattern":"Constant","Data":
                               {"0":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
                                     ,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72",
                                                                         "-1.72"]],
                                "1":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
                                     ,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]],
                                "2":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
                                     ,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]]},
                               "#contexts":3,"PlaidCoherency":"No Overlapping","%Errors":"0","%Noise":"0",
                               "X":[0,2,3,4],"ContextPattern":"Constant","Y":[0,2,6,7],
                               "RowPattern":"Constant","Z":[0,1,2],"#rows":4,"#columns":4},
                          "1":{"%Missings":"0","ColumnPattern":"None","Data":{"0":[["-3.52","-9.34","-9.04","-2.56"],
                                                                                ["-3.52","-9.34","-9.04","-2.56"]
                                                                                ,["-3.52","-9.34","-9.04","-2.56"]
                                                                                ,["-3.52","-9.34","-9.04","-2.56"]],
                                                                              "1":[["7.04","-2.13","2.04","5.09"],
                                                                                ["7.04","-2.13","2.04","5.09"],
                                                                                ["7.04","-2.13","2.04","5.09"],
                                                                                ["7.04","-2.13","2.04","5.09"]],
                                                                              "2":[["2.17","5.93","-5.47","-8.74"],
                                                                                ["2.17","5.93","-5.47","-8.74"],
                                                                                ["2.17","5.93","-5.47","-8.74"],
                                                                                ["2.17","5.93","-5.47","-8.74"]]},
                               "#contexts":3,"PlaidCoherency":"No Overlapping","%Errors":"0","%Noise":"0",
                               "X":[0,1,2,3],"ContextPattern":"None","Y":[1,3,4,9],"RowPattern":"Constant",
                               "Z":[0,1,2],"#rows":4,"#columns":4}},"#DatasetMinValue":-10,"#DatasetColumns":10,
           "#DatasetContexts":3,"#DatasetMaxValue":10,"#DatasetRows":5}

and I want to obtain a dictionary like this:
new_dictionary = {"0":{"0":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
                                    ,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]],
                               "1":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
                                    ,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]],
                               "2":[["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]
                                    ,["-1.72","-1.72","-1.72","-1.72"],["-1.72","-1.72","-1.72","-1.72"]]},
                          "1":{"0":[["-3.52","-9.34","-9.04","-2.56"],["-3.52","-9.34","-9.04","-2.56"],
                                    ["-3.52","-9.34","-9.04","-2.56"],["-3.52","-9.34","-9.04","-2.56"]],
                               "1":[["7.04","-2.13","2.04","5.09"],["7.04","-2.13","2.04","5.09"],
                                    ["7.04","-2.13","2.04","5.09"],["7.04","-2.13","2.04","5.09"]],
                               "2":[["2.17","5.93","-5.47","-8.74"],["2.17","5.93","-5.47","-8.74"],
                                    ["2.17","5.93","-5.47","-8.74"],["2.17","5.93","-5.47","-8.74"]]}}`

I don't have much experience on how to subset nested dictionaries, how can I do it?

A: You could do it via:
d = {k: {nk: nv for nk, nv in v['Data'].items()} for k, v in original['Triclusters'].items()}

d
{'0': {'0': [['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72']], '1': [['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72']], '2': [['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72'], ['-1.72', '-1.72', '-1.72', '-1.72']]}, '1': {'0': [['-3.52', '-9.34', '-9.04', '-2.56'], ['-3.52', '-9.34', '-9.04', '-2.56'], ['-3.52', '-9.34', '-9.04', '-2.56'], ['-3.52', '-9.34', '-9.04', '-2.56']], '1': [['7.04', '-2.13', '2.04', '5.09'], ['7.04', '-2.13', '2.04', '5.09'], ['7.04', '-2.13', '2.04', '5.09'], ['7.04', '-2.13', '2.04', '5.09']], '2': [['2.17', '5.93', '-5.47', '-8.74'], ['2.17', '5.93', '-5.47', '-8.74'], ['2.17', '5.93', '-5.47', '-8.74'], ['2.17', '5.93', '-5.47', '-8.74']]}}

A: Try this:
new_dictionary = {key: value['Data'] for key, value in original['Triclusters'].items()}

A: You can use a dictionary comprehension as such :
new_dictionary = {index: tricluster["Data"] for index, tricluster in original["Triclusters"].items()}


text:
Q: Bitwise Operator Postgres I have a table that contains binary values such as:
binaryid    description
1           description1
2           description2
4           description3
8           description4

And I have another table that contains values:
DBID BinaryTogether
1    15
1    12
1     6

With the bitwise operator I want to get a table that would contain the following:
DBID   BinaryTogether BitwiseResult
1      15             description1,description2,description3,description4
1      12             description3,description4
1       6             description2, description3

A: You can join those tables using & bitwise operator and then aggregate descriptions using string_agg function. Here is example:
with
  b(x,d) as (
    values
      (1,'description1'),
      (2,'description2'),
      (4,'description3'),
      (8,'description4')),
  p(y) as (
    values
      (15),
      (12),
      (6))
select
  y,
  string_agg(d,',')
from
  p join b on (x & y != 0)
group by
  y


text:
Q: Elequoent relationship is not selecting releated rows I have 2 tables: products and images
Products table:
CREATE TABLE `products` (
  `id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `short_description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `price_standard` int(11) NOT NULL,
  `price_life` int(11) NOT NULL,
  `price_multi` int(11) NOT NULL,
  `product_addon` int(11) NOT NULL,
  `banner_style` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'blue'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `products`
--

INSERT INTO `products` (`id`, `created_at`, `updated_at`, `deleted_at`, `name`, `short_description`, `description`, `price_standard`, `price_life`, `price_multi`, `product_addon`, `banner_style`) VALUES
(16, '2017-02-12 19:25:03', '2017-02-12 19:25:03', NULL, 'tet', 'test', 'test', 100, 200, 330, 0, 'blue');

Image table
CREATE TABLE `images` (
  `id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `product_id` int(11) NOT NULL,
  `image_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `images`
--

INSERT INTO `images` (`id`, `created_at`, `updated_at`, `product_id`, `image_name`) VALUES
(1, '2017-02-12 19:25:03', '2017-02-12 19:25:03', 16, '58a0b68fd1d1b.jpg');

I have 2 models, a products model and the images model, I am trying to select the images for the products, but I am getting 'exists false'
Products Model
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    public function features()
    {
        return $this->hasMany('App\ProductFeatures');
    }

    public function images()
    {
        return$this->hasMany('App\Images', 'product_id');
    }
}

Images model
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Images extends Model
{
    protected $table = 'images';
}

The controller I am using to get all the products images:
public function getProduct(Product $product)
{
    // get the product addons
    $addons = $product->where('product_addon', $product->id)->get();

    dd($product->images());

    return View('pages.product.view-item')->withProduct($product)->withAddons($addons);
}

And the route in my web.php
Route::get('item/{product}', 'ProductsController@getProduct');

But when I diedump to see if the image is being selected I get the following under the image mapping:
  #related: Images {#219 ▼
    #table: "images"
    #connection: null
    #primaryKey: "id"
    #keyType: "int"
    +incrementing: true
    #with: []
    #perPage: 15
    +exists: false
    +wasRecentlyCreated: false
    #attributes: []
    #original: []
    #casts: []
    #dates: []
    #dateFormat: null
    #appends: []
    #events: []
    #observables: []
    #relations: []
    #touches: []
    +timestamps: true
    #hidden: []
    #visible: []
    #fillable: []
    #guarded: array:1 [▶]
  }

How come it is not selecting the images for the product 16, but it is selecting the data from the products table?

A: Try $product->images instead of $product->images().
When you call the relation as a function it returns the relation query object which you can use to add additional query constraints to, but it doesn't seem like that's what you want here. At that point though you still need to execute the query object to get the data.
When you call the relation as a property off the model eloquent will automatically execute the sql and get the data.
So these two lines should produce the same result
$product->images

$product->images()->get()


text:
Q: C# Loss of precision between float, double and decimal Consider the following code:
// Float
Console.WriteLine(123.0f);    // 123

// Double
Console.WriteLine(123.0);     // 123

// Decimal
Console.WriteLine(123.0m);    // 123.0

Questions

*

*Why does decimal maintain a single digit precision, but float and double do not?

*Is there a way to preserve this information for float and double, even if when zero?


text:
Q: How to read and store apk metadata in spring boot application We are working on an Android Store. It's a prototype based on Spring for the back end and for the client we use the open source project Aurora : https://gitlab.com/AuroraOSS/AuroraStore
We have to store some information about the apk we upload in our Nexus.
Our first question is how could we read AndroidManifest.xml in our Spring application ? Is there any maven module available ?
The second question is how could we manage Android info in our database ? For example, we have PackageInfo that is typically for Java Android Project, under Android Studio. But we have to store for an app these information? How could we dot it ?
package android.content.pm;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import androidx.annotation.RecentlyNonNull;

public class PackageInfo implements Parcelable {
    @RecentlyNonNull
    public static final Creator<PackageInfo> CREATOR = null;
    public static final int INSTALL_LOCATION_AUTO = 0;
    public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1;
    public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;
    public static final int REQUESTED_PERMISSION_GRANTED = 2;
    public ActivityInfo[] activities;
    public ApplicationInfo applicationInfo;
    public int baseRevisionCode;
    public ConfigurationInfo[] configPreferences;
    public FeatureGroupInfo[] featureGroups;
    public long firstInstallTime;
    public int[] gids;
    public int installLocation = 1;
    public InstrumentationInfo[] instrumentation;
    public boolean isApex;
    public long lastUpdateTime;
    public String packageName;
    public PermissionInfo[] permissions;
    public ProviderInfo[] providers;
    public ActivityInfo[] receivers;
    public FeatureInfo[] reqFeatures;
    public String[] requestedPermissions;
    public int[] requestedPermissionsFlags;
    public ServiceInfo[] services;
    public String sharedUserId;
    public int sharedUserLabel;
    /** @deprecated */
    @Deprecated
    public Signature[] signatures;
    public SigningInfo signingInfo;
    public String[] splitNames;
    public int[] splitRevisionCodes;
    /** @deprecated */
    @Deprecated
    public int versionCode;
    public String versionName;

    public PackageInfo() {
        throw new RuntimeException("Stub!");
    }

    public long getLongVersionCode() {
        throw new RuntimeException("Stub!");
    }

    public void setLongVersionCode(long longVersionCode) {
        throw new RuntimeException("Stub!");
    }

    public String toString() {
        throw new RuntimeException("Stub!");
    }

    public int describeContents() {
        throw new RuntimeException("Stub!");
    }

    public void writeToParcel(Parcel dest, int parcelableFlags) {
        throw new RuntimeException("Stub!");
    }
}

Thanks in advance.
EDIT:
To read an apk metadata, we found this module :
https://github.com/hsiafan/apk-parser
<dependency>
    <groupId>net.dongliu</groupId>
    <artifactId>apk-parser</artifactId>
    <version>2.6.9</version>
</dependency>

A: We found this plugin https://github.com/hsiafan/apk-parser to parse the information.
<dependency>
    <groupId>net.dongliu</groupId>
    <artifactId>apk-parser</artifactId>
    <version>2.6.9</version>
</dependency>

Then with the documentation provided, we retrieve all the information and save in database


text:
Q: how can i read the student information from file because it can not appear i have written this program that  read the id ,name in function and course grade credit in another function and then  calculate total credits attempted, total credits earned, total grade points, and total credits.
after i finish written there is no errors but it show that things
#include<iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <cmath>
#include<cstring>

using namespace std;

//functions prototype

int main() {
    //decleration
    ifstream inf;
    ofstream outf;
    int id;
    string name;
    string courseid, grade;
    int cridit;
    int tcattempted, tcearned, tcredits;
    double tgpoints;

    //opening file
    inf.open("students.txt");
    outf.open("report.txt");

    //check
    if (inf) {
        outf << "error, can not open file " << endl;
        return 1;
    }

    //header function
    header(outf);
    //read name and id function
    ReadIDAndName(inf, id, name);
    outf << id << "  " << name;

    outf << endl;

    //read course data function
    ReadCourseData(inf, courseid, grade, cridit);
    outf << "course" << "   " << "grade" << "   " << "credit" << endl;
    while (!inf.eof()) {
        outf << courseid << "   " << grade << "   " << cridit << endl;

    }

    // calculate function
    Calculate(grade, cridit, tcattempted, tcearned, tgpoints, tcredits);
    outf << "total credit attemted =" << tcattempted;
    outf << "total credit earned =" << tcearned;
    outf << "total grade point earned =" << tgpoints;
    outf << " grade point average =" << tcredits;

    //close file
    inf.close();
    outf.close();

    return 0;
}
//end of program

//function header

void header(ofstream& outf) {

    outf << setw(8) << "sultan gaboos university" << endl;
    outf << setw(8) << "student information sestem" << endl;
    outf << setw(8) << "contact show your id: show your name" << endl;
    outf << "****************************************************" << endl;

    return;
}

//function read name

void ReadIDAndName(ifstream& inf, int& id, string& name) {

    getline(inf, name, '/');
    inf >> id>>name;

    return;
}

//function read course data

bool ReadCourseData(ifstream& inf, string& courseid, string& grade, int& cridit) {
    bool exist = false;
    do {

        getline(inf, courseid, '/');
        inf >> courseid >> grade>>cridit;

    } while (exist);

    return true;
}

//function get grade point

double GetGradePoints(string grade) {
    double cradepoint;

    if (grade == "A")
        cradepoint = 4.0;

    else if (grade == "A-")
        cradepoint = 3.7;

    else if (grade == "B+")
        cradepoint = 3.3;

    else if (grade == "B")
        cradepoint = 3.0;

    else if (grade == "B-")
        cradepoint = 2.7;

    else if (grade == "C+")
        cradepoint = 2.3;

    else if (grade == "C")
        cradepoint = 2.0;

    else if (grade == "C-")
        cradepoint = 1.7;

    else if (grade == "D+")
        cradepoint = 1.3;

    else if (grade == "D")
        cradepoint = 1.0;

    else if (grade == "F")
        cradepoint = 0.0;

    else if (grade == "I")
        cradepoint = 0.0;

    else if (grade == "W")
        cradepoint = 0.0;

    else if (grade == "P")
        cradepoint = 0.0;
    else
        cout << "wrong " << endl;

    return cradepoint;
}

//function for calculations

void Calculate(string grade, int cridit, int& tcattempted, int& tcearned, double& tgpoints, int& tcredits) {

    ifstream inf;
    string courseid;
    double cradepoint;

    ReadCourseData(inf, courseid, grade, cridit);
    GetGradePoints(grade);

    int count = 0;

    do {
        for (int i = 0; i < count; i++) {
            tcattempted = cridit + count;
        }
    } while (cridit != 'I' && cridit != 'W');

    do {
        for (int i = 0; i < count; i++) {
            tcearned = cridit + count;
        }
    } while (cridit != 'I' && cridit != 'P' && cridit != 'F');

    do {
        for (int i = 0; i < count; i++) {
            tgpoints = (cridit * cradepoint) + count;
        }
    } while (cridit != 'P');

    if (cridit != 'p' && cridit != 'I' && cridit != 'W') {

        tcredits = tcearned / tcattempted;
    }
    return;
}


text:
Q: Central limit theorem with dice We throw a fair coin until we have 50 heads. What is the approximate probability that we flip more than 120 times?
I guess I can rewrite it so as to ask what's the probability that in 120 flips I have less than 50 heads. So, we have iid random variables
$X_i =\begin{cases}1 \ \ \ \text{if heads} \\
0 \ \ \ \text{if tails}\end{cases}$
$\Bbb P(\frac{\sum\limits_{i=1}^{120}X_i-\Bbb nE[X_i]}{\sqrt{nVar(X_i)}}<\frac{50-\Bbb nE[X_i]}{\sqrt{nVar(X_i)}})=\Bbb P(Z<\frac{50-\Bbb 120\cdot 1/2}{\sqrt{120\cdot 1/4}})=\Bbb P(Z<-1.826)\approx0.0339.$
Am I correct?


text:
Q: Failed to launch app on emulator: Failed to install apk to emulator: I had moved my android sdk from my home directory to another drive. And when I try to emulate my ionic app using android emulator I get the following error:

Failed to launch app on emulator: Failed to install apk to emulator:
  pkg: /data/local/tmp/MainActivity-debug.apk Failure
  [INSTALL_FAILED_OLDER_SDK] rm failed for -f, Read-only file system

Does any one have a clue what might be wrong here ??

A: When deploying your app to your device (which is emulator for you), the deploy procedure is:
1. Sync the fundamental libraries,
2. Remove previous app package,
3. Install the new package.

It seems like it's failed to remove the previous package since the file system is read-only, consider check if the image file is read-only.


text:
Q: Setting up Pythran for compiling on Windows with clang-cl.exe and OpenMP working: need a way to pass compiler arguments I'm using Pythran to compile Python code into C/C++ with OpenMP support on Windows.  Now the documentation isn't great for Windows - it states:
"Windows support is on going and only targets Python 3.5+ with either Visual Studio 2017 or, better, clang-cl. Note that using clang-cl.exe is the default setting. It can be changed through the CXX and CC environment variables."
From playing around I found you MUST use clang-cl.exe or the code won't compile (MSVC doesn't like it).
So the preferred compiler is clang-cl.exe which is the "drop-in" replacement for cl.exe so Clang 12 was installed from Visual Studio 2019 setup by selecting "C++ Clang tools for Windows," and now I have C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\x64\bin\clang-cl.exe as well as the LLVM linker lld-link.exe - since clang-cl.exe is the default I don't need to change any setup files, I just run vcvarsall.bat before Pythran so the compiler directory is in the path. (I noticed later to get lld-link.exe used some hacking of distutils _msvccompiler.py is required, switch link.exe to lld-link.exe and also comment out the '/LTCG' flag since Clang doesn't have that option, then it works... But still no OpenMP...
I compiled one of the examples with a virtual environment in Anaconda which had the pip installed NumPy and SciPy libraries (OpenBLAS backend) since MKL support is barely documented.  It needed the pythran-openblas package so I pip installed that as well, and it compiled fine with clang-cl and I could import it no problem.   I found that [Python]\Lib\site-packages\pythran\pythran-win32.cfg has an option to pass cflags where I can type the correct compiler arguments like: -Xclang -fopenmp -march=ivybridge and when running pythran [script.py], all those flags are passed the correct way (using the defaults isn't correct).  BUT... this example from the docs is still not running in parallel.
I found on Stack Exchange: clang-cl -cc1 --help would output all the arguments clang can handle.  Under openmp it states: -fopenmp Parse OpenMP pragmas and generate parallel code.  So my guess here is that the example given in the Pythran documentation has no OpenMP pragmas to make parallel.  Now why would they do that?  No idea, as they show an example of it being made incredibly faster via OpenMP, but I can't reproduce it on Windows.  And I have 6 cores / 12 virtual so I should see a speedup.
Anyone else have another OpenMP example I can try this out on??? Or have solved this mystery of using OpenMP another way?
Much appreciated!

A: The Pythran project maintainer got back to me after I emailed him directly.  It seems that OpenMP is only supported via explicit #omp statements.  So some time ago when they wrote the docs it would infer parallel routines, but not now.  So to convert the example to OpenMP, a few changes are required:
#pythran export arc_distance(float[], float[], float[], float[])
import numpy as np
def arc_distance(theta_1, phi_1, theta_2, phi_2):
"""
Calculates the pairwise arc distance
between all points in vector a and b.
"""
    size = theta_1.size
    distance_matrix=np.empty_like(theta_1)
    #omp parallel for
    for i in range(size):
        temp = (np.sin((theta_2[i]-theta_1[i])/2)**2 + np.cos(theta_1[i])*np.cos(theta_2[i]) * np.sin((phi_2[i]-phi_1[i])/2)**2)
        distance_matrix[i] = 2 * np.arctan2(np.sqrt(temp), np.sqrt(1-temp))
    return distance_matrix

BUT... there are other compiler arguments not documented that need to be passed to get an OpenBLAS-backed OpenMP module working, which took me HOURS to figure out.  Here they are:
Pythran OpenBLAS Windows 10 Settings:
Find the file [Python]\Lib\site-packages\pythran\pythran-win32.cfg
Add to library_dirs: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\x64\lib'
Add to cflags: -Xclang -fopenmp
Add to ldflags: \libiomp5md.lib
Set blas to: blas=pythran-openblas
Then it should compile fine with a: pythran -v arc_distance.py - adding the -v flag is very helpful for finding issues (verbose compiler mode), but not needed.
Pythran Intel MKL Windows 10 Settings (Anaconda3 default libraries):
I also decided why not try to make this work on default Anaconda3 where NumPy and SciPy etc. are all compiled with MKL?  My company uses Anaconda3, so everyone has Intel MKL already.  And like the OpenBLAS settings, the MKL settings for Windows aren't documented either.  So I figured it out:
Find the file [Python]\Lib\site-packages\pythran\pythran-win32.cfg, (most likely it's at C:\Users[username]\Anaconda3)
Add to include_dirs='C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\x64\lib', '[Python]\Library\include'
Add to cflags: -Xclang -fopenmp
Add to ldflags: \libomp.lib
Set blas to: blas=mkl
Now you'll notice some strange things above compared to the OpenBLAS settings.  The library path isn't populated, instead it has to be in the include path (don't ask why, I don't know).  Also the OpenMP library is different.  Again, I don't know why the one that works with OpenBLAS refuses to work with Intel MKL.  But anyhow, that will give you Pythran with OpenMP on an Intel MKL based system.


text:
Q: How to initialize these array types? I'm doing a work and I got a bit of code handed to me with some "string" typedef to make use of strings easier, but now I'm having some trouble understanding the code and how it works.
Can you guys help me?
//----------- THIS IS THE CODE HANDED TO ME -----------------------------

#define MAX_STRING          256
#define MAX_STRING_VECTOR   1024

typedef char String[MAX_STRING];
typedef String StringVector[MAX_STRING_VECTOR];

//----------- THIS IS THE CODE I WROTE -----------------------------

StringVector strV;
String str;

*str = "Hello";
*(strV) = str;

The error it shows is "assignment to expression with array type".
Thank you guys!

A: In the C syntax, it is not allowed to assign an array of char, such as str is here, with a string literal except for initializing.
Rather use strcpy to assign a string to an array. For initializing str by Hello use String str = "Hello";.
For example:
StringVector strV;
String str = "Hello";

strcpy(*strV, str);

Online Example
Or if str is not needed:
StringVector strV;

strcpy(*strV, "Hello");

Note: strcpy() is declared in the header <string.h>.