text:
Q: How node server can automatically redirect same as browser I am configuring a service provider client for authenticate via a third party Id provider. The thing is that it all work fine on the browser, however, I like to make the same process using the API. When I web browse my service provider login endpoint  url, it redirect me to the identity provider login page where I put my username and password and i am redirected to my service provider with a authentication token. The problem when trying to do this via API is that when I make a node request service provider login endpoint  url, the response.end take me into a intermediate url which according the header nee to be redirected. So my answer is: how can I get the login URL as final node response? Here is the header of the intermediate page
:authority: dev-xssqpfdr.auth0.com
:method: POST
:path: /samlp/z76124e23wGhWOCp0HLCa3pR2Bs5BmYyj
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cache-control: no-cache
content-length: 5389
content-type: application/x-www-form-urlencoded
cookie: auth0=s%3AfyaKW_M79aXfsB_RXakNH7zrwZGr-J04.icMGIxicIaBxhWfscSvmd4aSK33piQWDkaenfv2wgWO4
origin: https://devbank-invistacompi.cs79.force.com
pragma: no-cache
referer: https://devbank-cs79.force.com/
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36

A: You should configure your API to be directly accessible. It's no use to have a manual redirection in between and you'd ass another level of complexity into the logic.
The thing is that the client needs to sort this issue out. So in your case, you have something like an initialize step that queries the URL. With the response you can configure your application to use the proper endpoint.
Again: this is poor design. If possible, you should put some load balancer or HA proxy between your known endpoint and your server. That way you can scale and do inspection on the requests.


text:
Q: Internal consistency and other item analyses Is it appropriate to run internal consistency and other item analyses on a test that has questions with different response formats. To be clearer, all questions have a likert response, but some are 5 levels, some are 7 levels. Should I convert them all to a standard before I run any of the above mentioned analyses?

A: This is a very difficult to question to answer.  It really depends on so much information that is not included in your question.  Please search this site and reference other material on psychometrics and IRT.  I am not really sure why this question is tagged in IRT, because it is of a more general nature.
In short, if it is appropriate to add the items together and arrive at a summed score (which it appears you are going to do), then it is probably appropriate to do some correlational analysis and estimate internal consistency with Cronbach's alpha.  The first part of this paragraph is a big "if", though. This is a very big field, and I encourage you to read extensively on the topic.

redpajama_set_name: RedPajamaStackExchange


text:
Q: R data manipulation - Rang condition in data.table / dplyr In R I am conducting analyses on df1 but I also need to pull data from the more detailed records / observations in df2 and attach to df1 based on certain conditions.
This is sample data comparable to my own:
df1 <- data.frame(id=c(1,2,3,3,3,4,4,5),
                  location=c("a", "a" , "a", "b" , "b" , "a", "a" ,"a" ),
                  actiontime=c("2020-03-10" , "2020-02-17" , "2020-04-22" , "2020-04-19" , "2020-04-20" , "2020-04-22" , "2020-03-02" , "2020-05-07" ) )

df2 <- data.frame(id=c(1,1,1, 2,2,2, 3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4, 5,5,5) ,
                  observation=c( "2020-03-09 01:00" , "2020-03-09 10:00" , "2020-03-10 05:00",  "2020-02-15 08:00" , "2020-02-16 09:00" , "2020-02-17 08:00",  "2020-04-16 14:30",  "2020-04-16 07:30" , "2020-04-17 15:00" , "2020-04-25 07:20" , "2020-04-18 10:00" , "2020-04-19 10:30",  "2020-04-20 12:00", "2020-04-21 12:00" , "2020-04-22 09:30" , "2020-04-24 23:00", "2020-04-23 17:30", "2020-03-01 08:00" , "2020-03-02 08:00" , "2020-03-03 08:00" ,  "2020-03-15 16:45" ,  "2020-03-16 08:00" , "2020-05-05 13:45" , "2020-05-06 08:00" , "2020-05-07 11:00") ,
                  var1=round(runif(25, min=10, max=60),0) ,
                  var2=c("Red" , "Blue" , "Yellow" , NA , "Yellow" , "Blue" , "Red" , "Yellow" , NA , NA , "Yellow" , NA , NA , NA , NA , NA , "Blue", NA , "Blue" , "Yellow" , NA , "Blue" , "Yellow" , "Red" , "Blue") )

In example how can I do the following procedures (preferably with data.table but if someone also would like to demonstrate with dplyr it is also nice) :

*

*Q1. If I decide the following rang  Blue > Red > Yellow . How can I then get the highest rang color in df2$var2 among the observations related to same id (if any) attached to a new variable by respective id in df1 ?

*Q2. In addition to rang as in Q1, how do I add condition to only select var2 if the observation happens a day before actiontime in df1 ?

*Q3 And to learn even more - how can the data that was pulled out of df2 joined to df1 in Q1 be updated on the record with the earliest observation by the id in df2 - meaning just working on df2 not involving df1 (and the join).

The output for Q3 would be something like this:
   id      observation var1   var2   color
1   1 2020-03-09 01:00   37    Red   Blue
2   1 2020-03-09 10:00   35   Blue   <NA>
3   1 2020-03-10 05:00   27 Yellow   <NA>
4   2 2020-02-15 08:00   21   <NA>   Yellow
5   2 2020-02-16 09:00   37 Yellow   <NA>
6   2 2020-02-17 08:00   38   Blue   <NA>
7   3 2020-04-16 14:30   56    Red   <NA>
8   3 2020-04-16 07:30   35 Yellow   Red
9   3 2020-04-17 15:00   40   <NA>   <NA>
10  3 2020-04-25 07:20   20   <NA>   <NA>
11  3 2020-04-18 10:00   49   <NA>   <NA>
12  3 2020-04-19 10:30   58   <NA>   <NA>
13  3 2020-04-20 12:00   37   <NA>   <NA>
14  3 2020-04-21 12:00   25   <NA>   <NA>
15  3 2020-04-22 09:30   16   <NA>   <NA>
16  3 2020-04-24 23:00   52   <NA>   <NA>
17  3 2020-04-23 17:30   46   Blue   <NA>
18  4 2020-03-01 08:00   16   <NA>   Blue
19  4 2020-03-02 08:00   14   Blue   <NA>
20  4 2020-03-03 08:00   21 Yellow   <NA>
21  4 2020-03-15 16:45   52   <NA>   <NA>
22  4 2020-03-16 08:00   40   Blue   <NA>
23  5 2020-05-05 13:45   13 Yellow   Red
24  5 2020-05-06 08:00   12    Red   <NA>
25  5 2020-05-07 11:00   11   Blue   <NA>

A: There are 3 questions in one, I will try to answer them one by one.
Question 1
If I understand correctly, the OP wants to identify the highest ranked color in var2 per id and wants to copy the color to a new column in df1 for the matching ids.
This can be solved by turning var2 into an ordered factor, aggregating df2 by id, and adding the result to df1 by an update join:
library(data.table)
setDT(df1)
setDT(df2)
df2[, var2 := ordered(var2, levels = c("Blue", "Red", "Yellow", NA), exclude = NULL)]

str(df2)

Classes 'data.table' and 'data.frame':    25 obs. of  5 variables:
 $ id         : num  1 1 1 2 2 2 3 3 3 3 ...
 $ observation: chr  "2020-03-09 01:00" "2020-03-09 10:00" "2020-03-10 05:00" "2020-02-15 08:00" ...
 $ var1       : num  15 58 12 35 11 25 24 54 14 15 ...
 $ var2       : Ord.factor w/ 4 levels "Blue"<"Red"<"Yellow"<..: 2 1 3 4 3 1 2 3 4 4 ...
 $ action_day : IDate, format: "2020-03-10" "2020-03-10" "2020-03-11" "2020-02-16" ...
 - attr(*, ".internal.selfref")=<externalptr>

So, we can find the highest ranked color per id by using min()
df2[, min(var2, na.rm = TRUE), by = id]

   id   V1
1:  1 Blue
2:  2 Blue
3:  3 Blue
4:  4 Blue
5:  5 Blue

which is rather trivial because all id groups include Blue in var2.
This can be appended to df1 by an update join
df1[df2[, min(var2, na.rm = TRUE), by = id], on = .(id), color := V1][]

   id location actiontime color
1:  1        a 2020-03-10  Blue
2:  2        a 2020-02-17  Blue
3:  3        a 2020-04-22  Blue
4:  3        b 2020-04-19  Blue
5:  3        b 2020-04-20  Blue
6:  4        a 2020-04-22  Blue
7:  4        a 2020-03-02  Blue
8:  5        a 2020-05-07  Blue

Question 2
If I understand correctly, the OP wants to filter df2 so that only those rows are kept where the date of the observation in df2 is exactly one day before an actiontime in df1 (for the same id). This intermediate result is then processed in the same way as df2 in Question 1, above.
The filtering is accomplished by a join operation but requires to coerce the character date actiontime and character date-time observation, resp., to numeric date type for date calculation.
df1[, actiontime := as.IDate(actiontime)]
df2[, action_day := as.IDate(observation) + 1L]
keep_df2_rows <- df2[df1, on = .(id, action_day = actiontime), nomatch = NULL, which = TRUE]

keep_df2_rows

[1]  1  2  5 14 11 12 18 24

keep_df2_rows contains the row numbers of those rows of df2 which fullfil the condition that the observation has happened exactly one day before an actiontime in df1 (for the same id).
Now, we can use the code of question 1 but use keep_df2_rows to filter df2:
df1[df2[keep_df2_rows, min(var2, na.rm = TRUE), by = id]
  , on = .(id), color := V1][]

   id location actiontime  color
1:  1        a 2020-03-10   Blue
2:  2        a 2020-02-17 Yellow
3:  3        a 2020-04-22 Yellow
4:  3        b 2020-04-19 Yellow
5:  3        b 2020-04-20 Yellow
6:  4        a 2020-04-22   <NA>
7:  4        a 2020-03-02   <NA>
8:  5        a 2020-05-07    Red

Question 3
If I understand correctly, the final goal of the OP is to add the color column to df2 instead of df1 with the additional requirement that the only the row with the earliest observation within an id is to be updated.
This can be accomplished by an update join with a look-up table lut which contains the colors by id as described above and the earliest observation by id
library(data.table)
setDT(df2)[, var2 := ordered(var2, levels = c("Blue", "Red", "Yellow"))]
setDT(df1)[, actiontime := as.IDate(actiontime)]
df2[, action_day := as.IDate(observation) + 1L]
keep_df2_rows <- df2[df1, on = .(id, action_day = actiontime), nomatch = NULL, which = TRUE]

agg1 <- df2[keep_df2_rows][!is.na(var2), min(var2), by = id]
agg2 <- df2[, .(observation = min(observation)), by = id]
lut <- merge(agg1, agg2, by = "id")
df2[lut, on = .(id, observation), color := as.character(V1)][]

    id      observation var1   var2 action_day  color
 1:  1 2020-03-09 01:00   23    Red 2020-03-10   Blue
 2:  1 2020-03-09 10:00   29   Blue 2020-03-10   <NA>
 3:  1 2020-03-10 05:00   39 Yellow 2020-03-11   <NA>
 4:  2 2020-02-15 08:00   55   <NA> 2020-02-16 Yellow
 5:  2 2020-02-16 09:00   20 Yellow 2020-02-17   <NA>
 6:  2 2020-02-17 08:00   55   Blue 2020-02-18   <NA>
 7:  3 2020-04-16 14:30   57    Red 2020-04-17   <NA>
 8:  3 2020-04-16 07:30   43 Yellow 2020-04-17 Yellow
 9:  3 2020-04-17 15:00   41   <NA> 2020-04-18   <NA>
10:  3 2020-04-25 07:20   13   <NA> 2020-04-26   <NA>
11:  3 2020-04-18 10:00   20 Yellow 2020-04-19   <NA>
12:  3 2020-04-19 10:30   19   <NA> 2020-04-20   <NA>
13:  3 2020-04-20 12:00   44   <NA> 2020-04-21   <NA>
14:  3 2020-04-21 12:00   29   <NA> 2020-04-22   <NA>
15:  3 2020-04-22 09:30   48   <NA> 2020-04-23   <NA>
16:  3 2020-04-24 23:00   35   <NA> 2020-04-25   <NA>
17:  3 2020-04-23 17:30   46   Blue 2020-04-24   <NA>
18:  4 2020-03-01 08:00   60   <NA> 2020-03-02   <NA>
19:  4 2020-03-02 08:00   29   Blue 2020-03-03   <NA>
20:  4 2020-03-03 08:00   49 Yellow 2020-03-04   <NA>
21:  4 2020-03-15 16:45   57   <NA> 2020-03-16   <NA>
22:  4 2020-03-16 08:00   21   Blue 2020-03-17   <NA>
23:  5 2020-05-05 13:45   43 Yellow 2020-05-06    Red
24:  5 2020-05-06 08:00   16    Red 2020-05-07   <NA>
25:  5 2020-05-07 11:00   23   Blue 2020-05-08   <NA>
    id      observation var1   var2 action_day  color

Note that the result differs from the example table posted by the OP because OP's definition of df2 is different to the example table.
Also note that I had to modify the computation of agg1 because of an unexpected behaviour of min(var2, na.rm = TRUE) when an id group consists only of NA. (To reproduce the issue, try min(ordered(NA), na.rm = TRUE) vs min(ordered(NA)))


text:
Q: AntTweakBar callbacks throwing " ';' expected" error before method After following a tutorial to create a basic particle system, I began implementing AntTweakBar to get a basic UI going. This was going well, everything draws OK. But once I started adding the callback functions it started to go a little haywire, claiming that it's throwing this in the middle of a method definition:

Intellisense: expected a ';'

The method in question is:
void GLFWCALL OnMouseRight(int glfwButton, int glfwAction)
{
    if( !TwEventMouseButtonGLFW(glfwButton, glfwAction) )   // Send event to AntTweakBar
    {
        if(glfwButton == GLFW_MOUSE_BUTTON_RIGHT)
            computeMatricesFromInputs();
        else
        // Event has not been handled by AntTweakBar
        // Do something if needed.
    }
}

The error is apparently popping up between the name OnMouseRight and the following parentheses. How do I get rid of this error? I'm coding in OpenGL (using GLFW and GLEW) with C++ and I have been following the steps on this page on the AntTweakBar site. I have looked up most of the GLFW documentation already and not found much. Any help appreciated.

A: There is a missing statement after else which is causing the error:
    if(glfwButton == GLFW_MOUSE_BUTTON_RIGHT)
        computeMatricesFromInputs();
    else
      // ^ no statement here

You can add a semicolon as Intellisense suggests or an empty compound statement {}:
    if(glfwButton == GLFW_MOUSE_BUTTON_RIGHT) {
        computeMatricesFromInputs();
    } else {
      // Event has not been handled by AntTweakBar
      // Do something if needed.
    }

A: Right, after a long night's work at this problem and trawling through GLFW's documentation again I noticed that the problem lay with the macro GLFWCALL. C++ was treating it as a method in it's own right and as a result ignoring the actual method. GLFW's documentation explained why:

The GLFWCALL macro, which made callback functions use __stdcall  on Windows, has been removed. GLFW is written in C, not Pascal. Removing this macro means there's one less thing for users of GLFW to remember, i.e. the requirement to mark all callback functions with GLFWCALL. It also simplifies the creation of DLLs and DLL link libraries, as there's no need to explicitly disable @n entry point suffixes.

On removing GLFWCALL and following the advice of @vitaut my program now handles the right mouse inputs correctly.


text:
Q: OpenCV Detect "Splotchy" Lines I am attempting to use OpenCV to detect "splotchy" lines in a binary image. I have an image like the one below and would like to robustly detect the three roughly vertical lines of splotches. HoughLines does a decent job, but often fails if only a few of the white pixels in the splotches are perfectly colinear. I've also tried Generalized Hough transform functions, but they aren't much better.

What I would like to be able to do is have HoughLines perform the Hough transform and give me the image in the Hough space (where each pixel value represents the votes for a particular rho and theta). That way I could look for high density regions instead of peaks, as those regions may better represent the lines I'm looking for.
I can't seem to find a way to get the raw Hough space image however. Is it possible?
Are there better ways to detect splotchy lines like this?
As a side note, I would like to do this all on a GPU, so functions with a 'cv::cuda::` api would be best.


text:
Q: Connect-N Board Game, crashing when Width is >> Height I'm in the process of coding a Connect-N board game, and I'm almost finished and have gone through troubleshooting. My problem is now after changing some stuff my game crashes when the computer plays its move if the Width is too much greater than the height. There are two functions involved here, so I will paste them both.
Board
*AllocateBoard(int columns, int rows)
        {
        int **array= malloc(sizeof(int *) *columns);
        int r = 0;
        for ( r = 0; r < columns; ++r)
                {
                array[r] = malloc(sizeof(int) * rows);
                }
        int j = columns - 1;
        int k = rows - 1;
        int m = 0;
        int n = 0;
        for ( m = 0; m < j; ++m)
                {
                for ( n = 0; n < k; ++n)
                        {
                        array[m][n] = 0;
                        }
                }
        Board *board = malloc(sizeof(Board));
        board->columns = columns;
        board->rows = rows;
        board->spaces = array;
        return board;
        }

This first function allocates the board to be a matrix Width * Height that the user passes in via the command line. It then initializes every space on the board to be zero, and then stores the columns, rows, and spaces into a Board structure that I've created. It then returns the board.
int
computerMakeMove(Board *board)
{       int RandIndex = 0;
        int **spaces = board->spaces;
        int columns = board->columns;
        int *arrayoflegalmoves = malloc(sizeof(int) * (columns));
        int columncheck = 0;
        int legalmoveindex = 0;
        while (columncheck <= columns - 1)
        {
                if (spaces[columncheck][0] == 0)
                        {
                        arrayoflegalmoves[legalmoveindex] = columncheck;
                        ++legalmoveindex;
                        ++columncheck;
                        }
                else
                        {
                        ++columncheck;
                        }
                arrayoflegalmoves = realloc(arrayoflegalmoves, (legalmoveindex) * sizeof(int));
        }
        if (legalmoveindex == 1)
        {
                return arrayoflegalmoves[0];
        }
        else
        {
                RandIndex = rand() % (legalmoveindex);
                return arrayoflegalmoves[RandIndex];
        }
}

This second function is designed to make the computer randomly pick a column on the board. It does this by checking the value of the top row in each column. If there is a zero there, it will store this value in an array of legal moves, and then it increments the legalmoveindex. If there isn't, it skips the column and checks the next. It ends when it gets finished checking the final column. If there is only one legal move, it will play it. If there are more, it will select a random index from the array of legal moves (I run srand in the main) and then return that value. It will only ever attempt to play on a legal board, so that's not the problem. I am pretty confident the problem occurs in this function, however, as I call the functions as follows
  printf("Taking the computers move.\n");
        {printf("Taking computer's move.");
         computermove = computerMakeMove(playerboard);
         printf("Computer's move successfully taken.\n");
         playerboard = MakeMove(playerboard, computermove, player);
         printf("Computer's board piece successfully played.\n");
         system("clear");
         displayBoard(playerboard);
         ...;
        }

and it prints
Aborted (core dumped)

immediately after it prints
"Taking computer's move."

Once again, my question is: why is my program crashing if the width is larger than the height when the computer plays?
Thanks.
Edit: I found the solution and I am stupid.
I realloc'd during the while loop.
The realloc should be the first thing outside of the while loop.

A: The answer for any future programmers who may have this problem:
Notice the
while (columncheck <= columns - 1)
        {
                if (spaces[columncheck][0] == 0)
                        {
                        arrayoflegalmoves[legalmoveindex] = columncheck;
                        ++legalmoveindex;
                        ++columncheck;
                        }
                else
                        {
                        ++columncheck;
                        }
                arrayoflegalmoves = realloc(arrayoflegalmoves, (legalmoveindex) * sizeof(int));
        }

has a realloc inside of it. The realloc should be moved to immediately outside of it, like so
while (columncheck <= columns - 1)
        {
                if (spaces[columncheck][0] == 0)
                        {
                        arrayoflegalmoves[legalmoveindex] = columncheck;
                        ++legalmoveindex;
                        ++columncheck;
                        }
                else
                        {
                        ++columncheck;
                        }
        }
        arrayoflegalmoves = realloc(arrayoflegalmoves, (legalmoveindex) * sizeof(int));

A: it is unusual to have the columns be the first index in an array.
having the first index of an array be columns leads to confusion

// suggest using camel case for all variable names, for readability

Board *AllocateBoard(int columns, int rows)
{
    int **array= malloc(sizeof(int *) *columns); // add check that malloc successful
    int r = 0;

    for ( r = 0; r < columns; ++r)
    {
        array[r] = malloc(sizeof(int) * rows); // <-- add: check that malloc successful
    }

    int j = columns - 1; // this results in last column not initialized
    int k = rows - 1;    // this results in last row of each column not initialized
    int m = 0; // column loop counter
    int n = 0; // row loop counter

    for ( m = 0; m < j; ++m)
    {
        for ( n = 0; n < k; ++n)
        {
                array[m][n] = 0;
        }
    }

    Board *board = malloc(sizeof(Board)); // <-- add: check if malloc successful
    board->columns = columns;
    board->rows = rows;
    board->spaces = array;
    return board;
} // end function: AllocateBoard

// why is this only looking at the first row of each column?
int computerMakeMove(Board *board)
{
    int RandIndex = 0;
    int **spaces = board->spaces;
    int columns = board->columns;
    int *arrayoflegalmoves = malloc(sizeof(int) * (columns)); // <-- add check that malloc successful
    int columncheck = 0;
    int legalmoveindex = 0;

    while (columncheck <= columns - 1)// should be: for(; columncheck < columns; columncheck++ )
    {
        if (spaces[columncheck][0] == 0)
        { // then first row of column is zero
            arrayoflegalmoves[legalmoveindex] = columncheck;
            ++legalmoveindex;
            ++columncheck; // <-- remove this line
        }

        else // remove this 'else' code block
        {
            ++columncheck;
        } // end if

        arrayoflegalmoves = realloc(arrayoflegalmoves, (legalmoveindex) * sizeof(int));
        // <-- 1) use temp int*, in case realloc fails
        // <-- 2) if realloc successful, update arrayoflegalmoves
        // <-- 3) the code is not checking each row of each column,
        //        so the original malloc is more than plenty
        //        so why bother to realloc
        // <-- 4) if legalmoveindex is 0 then realloc returns NULL
    } // end while

    // in following, what about when zero moves found? probably should return NULL
    if (legalmoveindex == 1)
    { // only one column[row0] found to contain 0
        return arrayoflegalmoves[0];
    }

    else
    {
        RandIndex = rand() % (legalmoveindex);
        return arrayoflegalmoves[RandIndex]; // if zero moves found, this returns a
                                             // de-reference to address 0
                                             // which would result in a seg fault event
    } // end if
} // end function: computerMakeMove


text:
Q: Behavior of GridView in Android I am having a GridView and added more than 50 images on it and performing delete operation on them.
I observe that what images i am deleting,they are leaving the blank space from top, means other images are not taking that place which is look so ugly.
I want that deleting image space should be covered by other images in grid.
Thanks.
code
if(v.getId() == R.id.delete_button)
        {
            adp.list.removeAll(bitmapList);
            adp.notifyDataSetChanged();
            bitmapList.clear();
            grid.clearChoices();

        }

A: after every image you delete try to reload grid view by calling notifydatasetchanged on adapter this will help link


text:
Q: Write text into a AbstractTableModel cell I have implemented an AbstractTableModel object which is a sort of timetable. I'd like to write into cells the subject that will be teached at that time by using a method (so I don't want to declare the rows as compiled yet).
How can I do? Here is my AbstractTableModel object.
private class MyTableModel extends AbstractTableModel {

    private String[] columns = {"","Monday","Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

    private String[][] data = {{"8:30 - 9:30","","","","","",""},
            {"9:30 - 10:30","","","","","",""},
            {"10:30 - 11:30","","","","","",""},
            {"11:30 - 12:30","","","","","",""},
            {"12:30 - 13:30","","","","","",""},
            {"13:30 - 14:30","","","","","",""},
            {"14:30 - 15:30","","","","","",""},
            {"15:30 - 16:30","","","","","",""},
            {"16:30 - 17:30","","","","","",""}};

        public int getColumnCount() {
            return columns.length;
        }

        public int getRowCount() {
            return data.length;
        }

        public String getColumnName(int col) {
            return columns[col];
        }

        public Object getValueAt(int row, int col) {
            return data[row][col];
        }

}

A: You have to override the setValueAt method.  You will also need to override the isCellEditable method if you want the table to edit the cells in question
Take a look at How to use tables for more details
Updated with example
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.table.AbstractTableModel;

public class TestTable20 {

    public static void main(String[] args) {
        new TestTable20();
    }

    public TestTable20() {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                    ex.printStackTrace();
                }

                JTable table = new JTable(new MyTableModel());

                JFrame frame = new JFrame("Testing");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(new JScrollPane(table));
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }

    public class MyTableModel extends AbstractTableModel {

        private String[] columns = {"", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

        private String[][] data = {{"8:30 - 9:30", "", "", "", "", "", ""},
        {"9:30 - 10:30", "", "", "", "", "", ""},
        {"10:30 - 11:30", "", "", "", "", "", ""},
        {"11:30 - 12:30", "", "", "", "", "", ""},
        {"12:30 - 13:30", "", "", "", "", "", ""},
        {"13:30 - 14:30", "", "", "", "", "", ""},
        {"14:30 - 15:30", "", "", "", "", "", ""},
        {"15:30 - 16:30", "", "", "", "", "", ""},
        {"16:30 - 17:30", "", "", "", "", "", ""}};

        @Override
        public Class<?> getColumnClass(int columnIndex) {
            return String.class;
        }

        @Override
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return columnIndex > 0;
        }

        @Override
        public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
            String[] row = data[rowIndex];
            row[columnIndex] = (String)aValue;
            fireTableCellUpdated(rowIndex, columnIndex);
        }

        @Override
        public int getColumnCount() {
            return columns.length;
        }

        @Override
        public int getRowCount() {
            return data.length;
        }

        @Override
        public String getColumnName(int col) {
            return columns[col];
        }

        @Override
        public Object getValueAt(int row, int col) {
            return data[row][col];
        }

    }
}


text:
Q: NSUserDefault Value found nil with kill the App I just trying to save the user Id and status as true value in UserDefaults when they login or Register with App.
UserDefaults.standard.set(user?.CustID, forKey: "CustID")
UserDefaults.standard.set(true, forKey: "status")

so when the user reopen the app in my Appdelegate I check the Status if it's true then user directly pass on HomeScreen and if the status False its pass on login screen.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.

         let status = UserDefaults.standard.bool(forKey: "status")

        if (status == true) && (custID != "") {
            let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
            let nextViewController = storyBoard.instantiateViewController(withIdentifier: "HomeTicketViewController") as! HomeTicketViewController
            let navigationController = UINavigationController(rootViewController: nextViewController)
            let appdelegate = UIApplication.shared.delegate as! AppDelegate
            appdelegate.window!.rootViewController = navigationController
        }else {
            let storyBoard : UIStoryboard = UIStoryboard(name: "Login", bundle:nil)
            let nextViewController = storyBoard.instantiateViewController(withIdentifier: "LoginViewController") as! LoginViewController
            let navigationController = UINavigationController(rootViewController: nextViewController)
            let appdelegate = UIApplication.shared.delegate as! AppDelegate
            appdelegate.window!.rootViewController = navigationController
        }
}

I get the status true but i found that The CustID found nil.
Is there any solution for that?

A: In userdefault if value not found in userdefaults corresponding to key then userdefault return nil and in case of bool it returns false.
In your case, when you app launches, app does not have any value corresponding to custID so you getting nil.
You need to add check like this
if (status == true) && (custID != nil){
    :
    :
}

A: The default is false
 let status = UserDefaults.standard.bool(forKey: "status")

so status will be false at first , also status being true doesn't mean CustID saved no nil
UserDefaults.standard.set(user!.CustID, forKey: "CustID")

as user may be nil so force-unwrap to verify that


text:
Q: Typescript: How can I reference another document's field inside of this document? I'm currently learing TS, and I re-write my old NodeJS/Express project. I need to reference another document's field in the validator, but I recieve an error:

Property 'price' does not exist on type '{ validator: (val: number) => boolean; }'.ts(2339).

Here's the code:
const tourSchema = new mongoose.Schema({
  price: {
    type: Number,
    required: [true, ' A tour must have a price']
  },
  priceDiscount: {
    validator: function(val: number): boolean {
      return val < this.price
    },
    message: 'Discount price ({VALUE}) should be below regular price'
  }
});

Here's the error
As you can see I need priceDiscount validator, but I can't reference another field in the document, because TS doesn't know if this field exists. How can I make it to know, that I want to reference another field on the same document?

A: I do not know the specifics of how mongoose works, but if that code is correct, the issue is that the validator function has its this bound to something other than the default.
You can annotate the function explicitly to tell TS the type of this, e.g.
validator: function(this: { price: number }, val: number): boolean {
  return val < this.price
},

A: Also, I've made a mistake in a code above. The proper code, with the solution of @H.B is:
const tourSchema = new mongoose.Schema({
  price: {
    type: Number,
    required: [true, ' A tour must have a price']
  },
  priceDiscount: {
    type: Number,
    validate: {
      validator: function(this: { price: number }, val: number): boolean {
        return val < this.price;
      }
    },
    message: 'Discount price ({VALUE}) should be below regular price'
  }
});


text:
Q: Passando dados em javascript Seguinte, como eu posso fazer para passar dados entre dois arquivos com javascript?
Exemplo:
Arquivo1:
<script>
var dado = 'dado';
</script>

Arquivo2:
<script>
alert (dado);
</script>

A: Tens de ter em consideração 2 coisas:

*

*que ambas estejam no mesmo escopo (global ou comum)

*que a variável seja defenida antes do alert();. Ou seja esse código carregado primeiro.

Se não estiverem no mesmo escopo podes usar um objeto global para essa variável ser acessível:
Arquivo1:
<script>
window.dado = 'dado';
</script>

Arquivo2:
<script>
alert(window.dado);
</script>

Se estiveres a usar páginas HTML diferentes podes usar a API do localstorage e usar localstorageem vêz do exemplo com window que dei em cima.
Exemplo onde escreve para o localstorage: http://jsfiddle.net/hL4dzhpa/
Exemplo onde lê do localstorage: http://jsfiddle.net/qn0umtfu/


text:
Q: dealing with data labels in 96 well plate with python I do have data from a 96 well plate (mostly in excel):
A 96 well plate, schematic provided by http://www.cellsignet.com:

(source: cellsignet.com)
Out of each cell we can do some experiment and read values from it, the data looks like:
    1    2    3    4    .    .
A   9.1  8.7  5.6  4.5
B   8.7  8.5  5.4  4.3
C   4.3  4.5  7.6  6.7
D   4.1  6.0  7.0  6.1
.

I also have excel files with the sample names:
    1    2    3    4    .    .
A   l1   l2   l3   l4
B   l1   l2   l3   l4
C   ds1  ds2  ds3  ds4
D   ds1  ds2  ds3  ds4
.

The duplicate entries are two wells with the same sample loaded.
I would like to read in the data (no problem) and assign the labels to the data points and group the data according to the labels. In pandas i can read in the data and group it according to the column and row headers. But how can i group according to the sample names ?

A: I will suggest just make a DataFrame with two columns, one stores the names, the other stores the readings.
In [20]:

print data_df
print name_df
     1    2    3    4
A  9.1  8.7  5.6  4.5
B  8.7  8.5  5.4  4.3
C  4.3  4.5  7.6  6.7
D  4.1  6.0  7.0  6.1

[4 rows x 4 columns]
     1    2    3    4
A   l1   l2   l3   l4
B   l1   l2   l3   l4
C  ds1  ds2  ds3  ds4
D  ds1  ds2  ds3  ds4

[4 rows x 4 columns]
In [21]:

final_df=pd.DataFrame({'Name':name_df.values.ravel(), 'Reading':data_df.values.ravel()})
#if you have additional readings, i.e. from a different assay,
#from a different wavelength, add them there, as:
#'OTHER_Reading':OTHER_data_df.values.ravel()
print final_df
   Name  Reading
0    l1      9.1
1    l2      8.7
2    l3      5.6
3    l4      4.5
4    l1      8.7
5    l2      8.5
6    l3      5.4
7    l4      4.3
8   ds1      4.3
9   ds2      4.5
10  ds3      7.6
11  ds4      6.7
12  ds1      4.1
13  ds2      6.0
14  ds3      7.0
15  ds4      6.1

[16 rows x 2 columns]

This way you can do some calculations rather easily, such as:
In [22]:

print final_df.groupby('Name').mean()
      Reading
Name
ds1      4.20
ds2      5.25
ds3      7.30
ds4      6.40
l1       8.90
l2       8.60
l3       5.50
l4       4.40

[8 rows x 1 columns]


text:
Q: I get an error when trying to check if an item is in a dictionary Bellow is my vb code, I am trying to loop through all the words inputted and place all of the unique words into a dictionary with their position. I get this error though and I don't know how to fix it. Please, can I have any suggestions; thanks.
The error:Object reference not set to an instance of an object.
Public Class Form1
    Dim sentence() As String
    Dim uniqueWords As Dictionary(Of String, Integer)

    Private Sub creatSaveBtn_Click(sender As Object, e As EventArgs) Handles creatSaveBtn.Click
        sentence = sentenceInputTxt.Text.ToLower.Split(" ")

        For Each word In sentence
            If Not uniqueWords.ContainsKey(word) Then
                uniqueWords.Add(word, uniqueWords.Count + 1)
            End If
        Next
    End Sub
End Class

A: Dim uniqueWords As New Dictionary(Of String, Integer)

also you could:
Dim uniqueWords As List(Of String) = sentenceInputTxt.Text.ToLower.Split(" "c).Distinct().ToList()


text:
Q: Why do both the notify and wait function of a std::condition_variable need a locked mutex On my neverending quest to understand std::contion_variables  I've run into the following. On this page it says the following:
void print_id (int id) {
  std::unique_lock<std::mutex> lck(mtx);
  while (!ready) cv.wait(lck);
  // ...
  std::cout << "thread " << id << '\n';
}

And after that it says this:
void go() {
  std::unique_lock<std::mutex> lck(mtx);
  ready = true;
  cv.notify_all();
}

Now as I understand it, both of these functions will halt on the std::unqique_lock line. Until a unique lock is acquired. That is, no other thread has a lock.
So say the print_id function is executed first. The unique lock will be aquired and the function will halt on the wait line.
If the go function is then executed (on a separate thread), the code there will halt on the unique lock line. Since the mutex is locked by the print_id function already.
Obviously this wouldn't work if the code was like that. But I really don't see what I'm not getting here. So please enlighten me.

A: There's one point you've missed—calling wait() unlocks the mutex. The thread atomically (releases the mutex + goes to sleep). Then, when woken by the signal, it tries to re-acquire the mutex (possibly blocking); once it acquires it, it can proceed.
Notice that it's not necessary to have the mutex locked for calling notify_*, only for wait*

A: What you're missing is that wait unlocks the mutex and then waits for the signal on cv.
It locks the mutex again before returning.
You could have found this out by clicking on wait on the page where you found the example:

At the moment of blocking the thread, the function automatically calls lck.unlock(), allowing other locked threads to continue.
Once notified (explicitly, by some other thread), the function unblocks and calls lck.lock(), leaving lck in the same state as when the function was called.

A: To answer the question as posed, which seems necessary regarding claims that you should not acquire a lock on notification for performance reasons (isn't correctness more important than performance?): The necessity to lock on "wait" and the recommendation to always lock around "notify" is to protect the user from himself and his program from data and logical races. Without the lock in "go", the program you posted would immediately have a data race on "ready". However, even if ready were itself synchronized (e.g. atomic) you would have a logical race with a missed notification, because without the lock in "go" it is possible for the notify to occur just after the check for "ready" and just before the actual wait, and the waiting thread may then remain blocked indefinitely. The synchronization on the atomic variable itself is not enough to prevent this. This is why helgrind will warn when a notification is done without holding the lock. There are some fringe cases where the mutex lock is really not required around the notify. In all of these cases, there needs to be a bidirectional synchronization beforehand so that the producing thread can know for sure that the other thread is already waiting. IMO these cases are for experts only. Actually, I have seen an expert, giving a talk about multi-threading, getting this wrong — he thought an atomic counter would suffice. That said, the lock around the wait is always necessary for correctness (or, at least, an operation that is atomic with the wait), and this is why the standard library enforces it and atomically unlocks the mutex on entering the wait.
POSIX condition variables are, unlike Windows events, not "idiot-proof" because they are stateless (apart from being aware of waiting threads). The recommendation to use a lock on the notify is there to protect you from the worst and most common screwups. You can build a Windows-like stateful event using a mutex + condition var + bool variable if you like, of course.


text:
Q: PSU for Ampacity test of connection i have this problem. I have to validate with a test that my connection on my power board can carry the nominal current required by the specs.
For current around 10A the setup I'm using is a Multioutput Bench PSU with all the output working in constant current mode in parallel, like the following figure:

If I need to go up to 100A this approach is not feasible anymore because the Bench PSU are normally limited up to 10A.
What are the PSU used for testing the ampacity for current value of 100A?
Are there any commercial type already available?
Are there any DIY way of doing this?

A: My quick and dirty options follow:

*

*Use a step down transformer to generate a lower working voltage. i.e. something like 5VAC from 120V. Rectify and use bulk capacitance to allow a large and long enough current pulse for sake of testing.

*If you require longer testing i.e. seconds or minutes, then I would suggest using common LiPo or Lead Acid batteries in parallel, and an approximate water load (water mixed with baking soda or salt make it conductive.) A 5Gal bucket and two copper pipes in it can handle thousands of watts of power for quite a while.

*Finally if neither of the above options sound acceptable, then you need to start looking into much more expensive supply options. You could continue doing what you are doing, but add balancing resistors (~0.1 Ohm) in series with each supply. Consider investing in cheap Ebay style SMPS.


text:
Q: How to enable the automatic line breaks in LaTeX and forced the text to break? I have created a table, and I have fixed its width, but the problem when I write a long text, the text breaks the line, I want to add an automatic line break  when the text should respect the width of the line. how can I do that ?
I used template of springer.
This is my table:
\documentclass{article}

\usepackage{array}
\usepackage{multirow}
\usepackage{graphicx}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}

\begin{document}

        \begin{table*}[htp]
        \scriptsize

        %\begin{tabular}{|p{0.1\textwidth}|l|l|l|l|l|l|l|l|}

        \begin{tabular} {|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|p{0.1\textwidth}|p{0.01\textwidth}|}
        \hline
        \begin{tabular}[c]{@{}l@{}}
        Type of ANN\end{tabular}

        &

        \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x \end{tabular}
        &
        \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x \end{tabular}

        & Topology &

        Input & Output & Objective & Dataset & Ref \\ \hline
        {\multirow{2}{*}{\rotatebox [origin=c]{90}{x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x }}}  & { \multirow{3}{*}{\rotatebox [origin=c]{90}{ Regression }}} & \begin{tabular}[l]{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x \end{tabular} & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} &

        \begin{tabular}{@{}l@{}}
        \tabitem x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\\
        \tabitem x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  .\\
        \tabitem x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .
        \\

        \end{tabular}

         &

         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  \\ %\hspace{0.28cm}
         rate.
        \\

          & \begin{tabular}{@{}l@{}}  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} & r1 \\ \cline{3-9}
         &  & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x \end{tabular} & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} &

         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  \\

          & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x   model.\end{tabular} & r2 \\ \cline{1-1} \cline{3-9}
        {\rotatebox [origin=c]{90}{ Feedback }}  &  & x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} &

         \begin{tabular} {@{}l@{}}
        Number of  users  connected in $t_{n}$.
        \\
        \end{tabular}

         & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  $t_{n+1}$.\end{tabular} & \begin{tabular}{@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} & \multicolumn{1}{c|}{//} & r3 \\ \hline
        {\rotatebox [origin=c]{90}{   x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x    }} & {\rotatebox [origin=c]{90}{ Classification }} & x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  & \begin{tabular}{@{}l@{}}One hidden  layer.\end{tabular} &

         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x  . \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x . \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x . \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x . \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x . \\
         x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x . \\

         & \begin{tabular} {@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x .\end{tabular} & \begin{tabular} {@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x \end{tabular} & \begin{tabular} {@{}l@{}}x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x \end{tabular} & r4 \\ \hline

        \end{tabular}

        \end{table*}

\end{document}

A: It is hard to know the desired layout as the posted code generated too many errors to make any output, and you did not supply an image of the required layout.
But perhaps this can get you started, I removed all the inner tabular that were preventing line breaking (as they were forcing l columns) and adjusted the outer table to fit what appears to be your 7 main column headings. All the columns allow line breaking, but in practice you will want to adjust the widths depending on the real meaning.
\documentclass{article}

\usepackage{array}
\usepackage{multirow}
\usepackage{graphicx}

\begin{document}

\begin{table*}[htp]
\scriptsize
\setlength\tabcolsep{3pt}
\setlength\extrarowheight{2pt}

\begin{tabular} {@{}|
p{0.15\textwidth}|
p{0.15\textwidth}|
p{0.15\textwidth}|
p{0.1\textwidth}|
p{0.1\textwidth}|
p{0.1\textwidth}|
p{0.1\textwidth}|
@{}}
        \hline

        Type of ANN

         & Topology &

        Input & Output & Objective & Dataset & Ref \\ \hline

x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x &
x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x &
x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x &
x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x &
x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x &
x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x x x x x x x x x x x x x x x x x x x &
x x x x x x x x x x x x x x x x x x x x x x x x x x x x  x x x x x x x x x x  \\

zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz  zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz &
zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz  zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz &
zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz  zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz &
zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz  zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz &
zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz  zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz &
zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz  zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz &
zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz  zz zz zz zz zz zz zz zz zz zz  \\
\hline
\end{tabular}

\end{table*}

\end{document}


text:
Q: Creating IKEA-style instructions in LaTeX Edit: Fixed a typo, added an example picture.
Dear TeX-ers. I really like the visual style of IKEA instructions, see below for an example, and I have sometimes played with the idea of making same type of manuals to explain some mathematical concepts. A few months ago I came across a story describing how some group of physicists(?) had used an IKEA style description to explain their ideas. (It wasn't the IKEA instruction to LHC, but something more serious.) I don't remember if they used LaTeX, but I lost the source and my memories are too vague to find it again. Thus the question:

Are there any existing LaTeX styles that would be suitable to create IKEA-style manuals?

I guess something like Inkscape might be more suitable for these types of projects, but I don't know how to use that and, more importantly, if something is worth doing it is worth doing it in LaTeX.


text:
Q: How do I override many EJB references in one shot scattered throughout an .ear file? I have an .ear file with dozens of EJB jar files in it.
Each EJB jar file has dozens of EJBs in it.
Each EJB has @EJB references in it with no other information (no name attribute, etc.).
At the moment everything Just Works: it just so happens that for any given @EJB-annotated injection target there is exactly one concrete EJB that is present in the .ear file to fill the slot.
I need for various reasons to introduce a few more EJB jar files that contain EJBs that could also fill some of these slots.
Hence, I need to tell my Java EE container which EJB to inject into which slot where there are conflicts.
I am familiar with the ejb-jar.xml deployment descriptor mechanism for overriding EJB references but if that is my only recourse I'm looking at changing possibly thousands of these entries.
I noticed in the application.xml schema version 6 that there is support for <ejb-local-ref> elements in there, too, which is in some abstract way what I want.  But I cannot figure out how to make use of these elements to do what I want.
In some abstract perfect world, I'd like to somehow say, in one place, "Hey, Java EE container, when you see an @EJB-annotated field like this:
@EJB
SomeType bean;

...please inject the EJB whose beanName is fred into it.  Everywhere in this application."  How do I do that?

A: There's no standard way to do it and as far as I know, no common vendor-specific way to do it.
This is something i tried to get in in EJB 3.1 for EJB and JPA refs: if an injection point works using the default rules because there's only one SomeType bean, but then some day a second SomeType bean is added... to be blunt, you're hosed :)  This problem also exists for @PersistenceContext and @PersistenceUnit refs.  The idea was/is to have some "this is the default impl of SomeType option in the standard deployment descriptors and bail people out of these situations.
We should still get this into the specification.  If this is your problem, I'll repost that proposal and if you can please follow up with information on how much of a nightmare this is for you, I can almost guarantee we'll get this fixed for EJB.next.
Get your canonical xml
For now, one possible approach is to temporarily deploy this ear in TomEE using the flag openejb.descriptors.output=true.  TomEE/OpenEJB will actually give you all the effective deployment descriptors for your application.  Could save you several hours or days if your application is as large as you state.  Internally we 1) read in the deployment descriptors, 2)  use the annotations to "fill out" the deployment descriptors.  The result is we have a tree which is the canonical set of "metadata" for each EJB module.  With the openejb.descriptors.output=true flag set, we will write each of these ejb-jar.xml files to disk and log the location.
Once you have your ejb-jar.xml files in hand, you can modify at will and go back to GlassFish and perhaps have better luck.
Overriding: Control your reference counts
In terms of how to actually manage this in Java EE, you have to understand how to be successful in overriding references.  There's a critical bit of info one needs to know in how annotation references translate to xml.  The goal is to have 1 reference and not N.
When your reference is unnamed like so:
package org.some.awesome.code;

public class Foo {

    @EJB
    SomeType orange;

... there's a fixed rule that the default name of this must be org.some.awesome.code.Foo/orange.  The class name and package become part of the name so as to give you the most fine grained control in overriding.  The following xml will override this  reference:
<ejb-local-ref>
  <ejb-ref-name>org.some.awesome.code.Foo/orange</ejb-ref-name>
  <local>org.some.awesome.code.SomeType</local>
  <ejb-link>Fred</ejb-link>
</ejb-local-ref>

This reference will now link to the EJB of type SomeType with the beanName 'Fred'.
The disadvantage of this is that if you have 100 references like this and you want to change them all, you will need 100 declarations in xml to do so.
There's no way out of this problem that doesn't involve changing your code -- this is where my "use this as the default" proposal has value, it would allow one xml change to handle all 100 cases with no code change.  It's as simple as being able to say "when I'm not specific in my code, I really mean use X" via the deployment descriptor.
Perhaps by making it legal to declare overrides in xml using just the type, like so:
<ejb-local-ref>
  <local>org.some.awesome.code.SomeType</local>
  <ejb-link>Fred</ejb-link>
</ejb-local-ref>

As mentioned, this is currently not legal.
Changing your code
There are a few code change approaches available, but one of them is to give each @EJB ref the same name.  Then you will end up with just 1 reference rather than N.
package org.some.awesome.code;

public class Foo {

    @EJB(name "purple")
    SomeType orange;

Here the name of the reference is explicitly given so overriding it in xml can be done more simply as follows:
<ejb-local-ref>
  <ejb-ref-name>purple</ejb-ref-name>
  <local>org.some.awesome.code.SomeType</local>
  <ejb-link>Fred</ejb-link>
</ejb-local-ref>

If there are 100 @EJB(name="purple") references, all of them would be overridden by the above declaration.
Conclusion
Short answer, there's currently no easy way out.  You're looking at either extensive xml or extensive code change.
Long term, we can hopefully improve this part of the specification so people aren't punished when they grow out of the default matching rules.

A: I am currently solving the same problem. I am investigating possibility of overriding the JNDI context so it provides other instance than the standard ones. You just have to set the system property java.naming.factory.initial (e.g. in jndi.properties) to your implementation and put the implementation on the root classpath. Then in the factory you create your own version of context with overridden lookup method. Sounds simple, but I am figting with this for days.


text:
Q: Building string using substring constructor- debugging - when step over code continues automatically? I have the following code:
//Open a file

//Put contents in to a char array
char* current_bytes = static_cast<char*>(region->get_address());

//Create a string
std::string my_string(current_bytes, x, 16);

x = 202
current_bytes contains 100,000,000 bytes
When I am debugging (in debug mode in Visual Studio) and I step over the string constructor, the code just automatically continues??
I did think it could be because I create the string on the stack and so I tried this:
std::string my_string = new std::string(current_bytes, x, 16);

but that also did the same odd thing of the code automatically continuing when I stepped over it in debug mode....

A: In order to debug your constructor with VS you need to set up a break point within it otherwise it will continue.


text:
Q: coefficient of chromatic polynomial I'm currently working on the following graph theory problem:

Let $G$ be a graph of order $n \geq 3$ and let $p_G(x)=\sum_{i=0}^{n-1} (-1)^ia_ix^{n-i}$ be the chromatic polynomial of G. Show that $a_2={e(G) \choose 2}-t(G)$, where $t(G)$ is the number of copies of $K_3$ in $G$.

I know that $a_0=1$ and $a_1=e(G)$. But I'm kind of lost for $a_2$. Would really appreciate any help! Thank you!

A: Notation:
Let $G$ be a graph and $S \subseteq E(G)$. By a subgraph $H$ induced by $S$ we mean $V(H) = V(G)$, $E(H) = S$. For $S \subseteq E(G)$, let $c(S)$ denote the number of connected components in the subgraph induced by $S$. Let $P_G(x)$ denote the chromatic polynomial of the graph.
The main problem:
We first assume we have this formula for the chromatic polynomial of a graph.
$$
P_G(x) = \sum_{S \subseteq E(G)} (-1)^{|S|} x^{c(S)}.
$$
Then $c_2$ will be affected by choices of $S$ such that the subgraph induced by $S$ has $n-2$ connected components. The subgraph induced by $S$ can be one of three cases:

*

*There is one connected component with 3 vertices, and that component forms a $K_3$.

*There is one connected component with 3 vertices, and that component forms a $P_2$ (path of length $2$, which has $2$ edges).

*There are two connected components with two vertices each.
Case 2) and 3) are all the ways to choose two edges from the graph, which is $\binom{e(G)}{2}$.
Case 1) are basically all the ways to choose a triangle from the graph, which $t(G)$. Hence the number of ways is $\binom{e(G)}{2} \color{red}{-} t(G)$. The minus sign comes from the fact that in Case 2) and 3), $|S| = 2$ is even, while in Case 1), $|S| = 3$ is odd. As per the formula, the sign is different.

Proving the formula:
We say a $k$-colouring $c: V(G) \to [k]$ conflicts at edges $S \subseteq E(G)$ if for each edge $uv \in S$, $c(u) = c(v)$. It is easy to show that the number of $k$-colourings that conflicts at $S$ is $k^{c(S)}$.
By definition, $P_G(x)$ counts the number of colourings which do not conflict at any subset of edges in $E(G)$. Hence, by inclusion-exclusion:
\begin{align*}
  \{\text{colourings not conflicting at any subset of $E(G)$}\} &= \{\text{all colourings}\} \\
    &- \{\text{colourings conflicting at $1$ edge of $E(G)$}\} \\
    &+ \{\text{colourings conflicting at $2$ edges of $E(G)$}\} \\
    &- \{\text{colourings conflicting at $3$ edges of $E(G)$}\} \\
    & \vdots \\
    &+ (-1)^{|E(G)|} \{\text{colourings conflicting at all edges of $E(G)$}\}
\end{align*}
Using the fact that the number of $k$-colourings that conflicts at $S$ is $k^{c(S)}$ gives the result.


text:
Q: Using squid to capture https - how to do non transparent proxy? The root of the problem: I need to block access to https://somewebsite.com/folder/index.php; but allow access to the rest of the site. I thought the best way to accomplish it would be through a proxy like squid.
How can I accomplish my goal?  Keep in mind I'm running squid 2.7 on a Windows 7 box and all the clients are also windows machines that I have full access to.
This is my first experience with squid, so any help is appreciated.

A: " Keep in mind I'm running squid 2.7 on a Windows 7 box and all the clients are also windows machines that I have full access to."
Yes you can,
here are the steps:
 => Install on the clients a certificate authority that you own ( for internet explorer you just have to install it at the system level in windows, for firefox and chrome you have to install it in every browser )
 => At this point you can already use SslBump feature in squid to do what you want.
Alternatively you can also use an apache server with mod_proxy, IMHO it is easier to configure for doing what you want.
The key is to be able to generate a valid certificate for the target domain. So either you you own the domain and you can generate a perfectly valid certificate (via rapidssl or other ) and install it where you want, or if you can not have a "standard" certificate for the  domain you need to have you own authority installed in the client software, and you just have to generate certificates with your  own CA.
Then you just have to direct the traffic to a server ssl-enabled with your certificate - apache, squid, .. anything - and you can treat the traffic as plain http.
Update: squid 2.7 does not support SslBump. If you have to stick with squid 2.7 you have to configure an https_port as an accelerator and configure your client to use the different port for ssl connections to the https site you want to filter. For example alter their dns settings and put in place a proxy configuration telling them to not use the proxy for this site.

A: Sorry, but you can't really do that with squid, or any other traditional proxy.  What you are asking would require that you perform a man-in-the-middle attack against the clients.
When a browser is configured to use Squid as proxy, all you will see for SSL connections is that the browser is making HTTP CONNECT requests to a particular domain/IP.  You will not be able to see the URL being requested, or any of the payload.


text:
Q: Creating an "On Demand" event? I am writing a plugin for existing software that will use twisted to communicate with a Denon AV receiver. I've created a method, powerDenonOff, in my protocol for turning off the device, and have the reactor start in a thread when the application launches via runConcurrentThread. I have another method, powerOff, which will be called when the user selects to turn the device off in the software. I'm having trouble figuring out how to call my powerDenonOff method in the protocol from the Plugin class.
from twisted.internet.protocol import Factory, Protocol
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor

class DenonProtocol(LineReceiver):
    delimiter='\r'

    def lineReceived(self, line):
        pass

    def connectionMade(self):
        pass

    def powerDenonOff(self):
        self.transport.write("PWSTANDBY")

    def __call__(self):
        pass

class DenonFactory(Factory):

    def __init__(self):
        pass

    def startedConnecting(self, connector):
        pass

    def clientConnectionFailed(self, one, two):
        pass

    def connectionMade(self):
        pass

    def buildProtocol(self, addr):
        return DenonProtocol()

class Plugin(software.PluginClass):

    def powerOff(self):
        reactor.callInThread(powerDenonOff) #I think this may need to be callFromThread but
                                            #but I left it since that was where the poorly
                                            #worded version of my question left off.

    def runConcurrentThread(self):
        try:
            while True:
                #hardcoded for testing
                port = 23
                host = "111.11.11.11"

                denon=DenonFactory()
                reactor.connectTCP(host, port, denon)
                reactor.run()
        except self.StopThread:
            pass

    def stopConcurrentThread(self):
        reactor.callFromThread(reactor.stop)

How do I reach the method in my protocol class? Is there a better way to accomplish this?
Thanks

A: You can't call reactor.run more than once, so the loop in runConcurrentThread won't work.  You need to start the reactor exactly once per process.  You can call connectTCP any number of times and they'll work as long as the reactor gets started at some point.
If runConcurrentThread is called in a non-main thread, then you also need to start the reactor without child process support (child processes are only supported when the reactor is run in the main thread).
If stopConcurrentThread is called in the same thread as runConcurrentThread then it doesn't need to use reactor.callFromThread.  However, if runConcurrentThread is supposed to block until the plugin is done, then there's no way stopConcurrentThread could be called in the same thread, so the use of reactor.callFromThread must be correct.
reactor.run will never raise StopThread.  It will just return.
As far as how to call methods on the protocol instance "from" the plugin, this is just a question about managing references in Python.  Recall that protocol instances are given a reference to their factory (your factory doesn't do this, but it could) and your plugin class is the code that creates the factory.  This means you should be able to write plugin code that refers to the protocol via the factory.
However, you could also use one of the more convenient APIs - for example, endpoints:
endpoint = TCP4ClientEndpoint(reactor, host, port)
factory = ...
d = endpoint.connect(factory)
def connected(protocol):
    protocol.powerDenonOff()
    protocol.transport.loseConnection()
d.addCallback(connected)

This is just one possible approach - I don't know what kind of connection management makes sense to your application.  If you want to maintain a single long-lived connection, then you might save the protocol reference for later use rather than calling powerDenonOff and then disconnecting it.  I suspect that since the method here is for turning power off, the connection might not live much longer anyway though...
Crochet will help you do most of the more boring and finnicky parts of this.  I suggest taking a look at it sooner rather than later.
For the rest, you just need to be very clear about what code runs in what thread.  The only Twisted API you are allowed to use in a different thread than reactor.run was called in is reactor.callFromThread.  You can use this to call other Twisted APIs in the reactor thread.  Also keep in mind that you can only run one reactor per process, and you can only run it once.  The rest is just keeping track of references to the objects you need to use.


text:
Q: SharedPreference updating information I'm using SharedPreference to keep track of a character used, points that character brings and the number of characters that the user has and the last two are concatenated in a string which I append split in order to get one of the values (and append them again later). However, I'm not really sure that the way I'm trying to go about updating my data is how it should be done. I would really appreciate to hear some opinions.
Here is the code where I save the Shared Preference:
    SharedPreferences aSharedPref = getSharedPreferences(Aprefs, Context.MODE_PRIVATE);
    int[] aData = new int[2];
    aData[0] = 3;
    aData[1] = 0;
    StringBuilder strA = new StringBuilder();
    for (int i = 0; i < aData.length; i++) {
        strA.append(aData[i]).append(",");
    }
    aSharedPref.edit().putString("A", strA.toString());
    aSharedPref.edit().apply();`

and where I retrieve it to update it:
    SharedPreferences aSharedPref = getSharedPreferences(Aprefs, Context.MODE_PRIVATE);
    String dataA = aSharedPref.getString("A", "");
    StringTokenizer stA = new StringTokenizer(dataA, ",");
    int[] listA = new int[2];
    for (int i = 0; i < 2; i++) {
        listA[i] = Integer.parseInt(stA.nextToken());
    }
    listA[1] = listA[1] + 1;
    StringBuilder strA = new StringBuilder();
    for (int i = 0; i < listA.length; i++) {
        strA.append(listA[i]).append(",");
    }
    aSharedPref.edit().putString("A", strA.toString());
    aSharedPref.edit().apply();

Also one more question regarding apply() and commit(), from what I gathered commit writes the data to persistent storage immediately while apply handles it in the background. So would it matter which one I use when saving data which I plan to update throughout the app.


text:
Q: What is an $n$ dimensional space? How an $n$ dimensional space looks like? Is it possible that we are really in a space of dimension greater than 3?

A: We can only visualize three spatial dimensions because we live our lives in a three dimensional world. The possibility of a fourth spatial dimension is not something we can have any intuition on. It is of course possible that there is another spatial dimension, and that these "4-dimensional' creatures just never interacted with us.
For example, let's say you are a circle living on a piece of paper. You can move in 2 dimensions. You have no idea what a "third" spatial dimensional would look like. You just know up, down, left, and right. You would be even be able to conceive of being "above" the paper or "under" the paper. Unless, let's say a sphere comes along and jumps into your piece of paper. It would look like it came out of nowhere, and you would see a circle appearing getting bigger while the sphere is entering your plane, and when it's leaving your plane, it would disappear.
So if a "4-dimensional" object was to enter our space, it would just appear out of nowhere as a 3-dimensional object, and can easily disappear by jumping out of our space.

A: Since our normal experience is with a three-dimensional world (four-dimensional with time (which answers your second question), but that's not a dimension we can move backwards and forwards in at will, so our experience there is limited) it is hard for us to picture what larger-dimensional space looks like.  We just don't think like that.  I tried to image what a larger-dimensional space would look like when I first started linear algebra and the math was generalized to dimensions larger than three and became incredibly frustrated at my failed attempts.  Eventually I realized that n-dimensional space wasn't beyond my experience, it just didn't represent the world I lived in as much.
For instance, for a business there are many factors that go in to how much profit they can make off a certain product: price, supply, demand, amount of advertising, type of advertising...the number of factors can be large.  Equations can be made to predict how much profit total will be made, with each of these factors being represented by a variable, or a separate dimension.  Then I realized that n-dimensional space would be similar.  Just because I can't picture in my head what a larger-dimensional space would look like doesn't mean I can't use and understand it: I'd have to think of it more mathematically than in pictures, just do the math and get the result, rather than trying to project the n-dimensional points onto the three-dimensional grid I live in.


text:
Q: Each element of a class is a set In Moschovakis Notes on set theory book there is an exercise that says

Prove that $A$ is a set if and only if $A$ is a member of a class.

(Here a class is either a set or a unary definite condition.) One direction of the proof is trivial because the "set of all sets" is a class. To prove the other direction I used, literally, the axiom of pairing stated in the book:

Axiom of pairing: for any two objects $x$ and $y$ there is a set who only elements are $x$ and $y$.

Then an element $x$ of a class is an object (of the universe of the theory), and consequently $\{x\}$ is a set. Now using the axiom of union we find that $\bigcup\{x\}=x$ is a set.
QUESTIONS:

*

*It is my proof correct?

*I find unsatisfying the use of a particular form of the axiom of pairing when, in general, it is not stated for objects if not just for sets. Then, supposing that the above proof is correct, there is som other way to prove the statement?


text:
Q: jquery load not executing php function in another file //main.php
<?php

include("functions.php");

?>
//End main.php

//phpfile.php

dsfg sfdgsdfgsfdgdf

dsfg sfdgsdfgsfdgdf

<?php
 echo sum();
?>
//End phpfile.php

while the implementation sum function in inside another file called functions.php notice that if i put the implementation of sum function inside phpfile.php it will work fine.
Any help is really appreciated

A: Where is your document.ready ?
$(function(){
    $("#Div").load("Views/phpfile.php", function(){
        alert("file loaded");
    });
})


text:
Q: Not seeing coworkers git changes when pulling same branch? I created a branch (new-branch) based off another branch (origin/Development). I did some work and pushed up my branch to the remote. My coworker pulled down new-branch, made some changes, and then pushed those changes to the remote. So we are working on the same branch and my code is missing his changes locally.
Locally when I run git pull, it does not retrieve coworkers changes. I think because my local branch is still tracking origin/Development? How do I stay on my branch locally and retrieve his changes?

A: First, check on your machine if your local branch new-branch matches the remote branch origin/new-branch :
# this will show the head commit of your local branch :
git log -1 new-branch

# does this command display something at all ?
# does it match the content your coworker pushed ?
git log -1 origin/new-branch

*

*If the second command did not display the work of your coworker :
something wasn't committed or pushed from your coworker's station, check his copy of the repo.

*If the second command did display your coworker's work :
it is just a matter of linking your local branch to the remote branch.
Run :
git branch -u origin/new-branch new-branch
# and then :
git pull

A: Please try git pull origin new-branch

A:
I think because my local branch is still tracking origin/Development?

Are you currently on origin/Development or new-branch.
If on origin/Development checkout on new branch.

*

*git checkout new-branch

*git pull origin new-branch

A: TL;DR
You probably want to set the upstream of your branch.  There are lots of ways to do this, but the most direct, at this stage, is to use:
git branch --set-upstream-to=origin/new-branch new-branch

after which all the shortcut stuff you're using will work.
Long: what all this shortcut stuff is
To really understand this, you need to know:

*

*what a Git branch name really is and does (which is not much, but what it does matters a lot to humans);

*what a remote-tracking name is;

*what the upstream of a branch is; and

*how git pull works.

Branch names and remote-tracking names
First, regarding branches, there are several things to keep in mind here:

*

*Git isn't really about branches at all.  It's really about commits.  Commits aren't really named by branch.  They're really named by hash ID.  Every Git everywhere agrees that any one particular commit has that hash ID, and no other commit ever gets to use that hash ID.  But hash IDs look random, and are impossible for humans to remember, so...

*Branch names mainly serve to find commits.  That means that we humans depend pretty heavily on the names.  Each branch name holds exactly one hash ID.  By definition, that hash ID is the hash ID of the last commit in the branch.

*Your own Git has its own branch names, which are independent of anyone else's branch names.  But because these names are useful to us, your Git will also create remote-tracking names like origin/master, to remember what your Git saw in the other Git (over on origin), in their master.  Your Git will update these remote-tracking names whenever your Git gets a chance.
For instance, consider running git fetch origin.  This makes your Git call up their Git, using the short name origin to look up the URL (their Git's "phone number").  Their Git will list out some or all of their branch names, along with the commit hash IDs that go with those names.  Your Git will get these commits, if you don't have them yet, and any other commits that go with those commits, if you don't have them yet.  So now you have all of their commits—or all of the ones you need for the specific branch(es) you're fetching, if you limited your git fetch—and your Git knows which commit their Git's branch name identifies.  Hence, your Git now updates your remote-tracking names—your origin/master and so forth—so that you can remember their commits.
Remember, too, that every commit, named by its unique hash ID, also have inside themselves some hash IDs.  Most commits hold one hash ID: that's this commit's parent commit.  These parent IDs form commits into backwards-pointing chains.  That's why it's OK to just remember the last hash ID.  Given a branch name like master, Git finds the last commit in the chain, i.e., the tip of the branch.  That commit remembers the next earlier commit.  The next earlier commit remembers another even-earlier commit—the grandparent of the tip commit—and the grandparent remembers another even-earlier commit, and so on.
git pull
All git pull does is run two Git commands for you:

*

*First, it runs git fetch.  This is what actually obtains new commits.  The fetch step will also update your remote-tracking names as appropriate.
The new commits you've picked up, if any, have not affected any of your branch names at all.

*Then, it runs a second Git command.  This second command will, or at least can, have some effect on some branch name.
Which branch does this second command affect?  In theory, that could depend on the second command.  Which second command does git pull run?  That's under your control.
You can choose to have git pull run git rebase.  If you don't do that, though, git pull will run git merge.  (There are some rare exceptions where git pull uses yet another option, but you won't hit those unless you're creating a new repository from scratch.)
Before you see what git fetch fetches, you must decide in advance whether the new commits should be merged, with git merge, or rebased-onto, with git rebase.  Somehow, magically, you make this decision, and then you run git pull --rebase or just git pull, and Git runs the two commands.
The second command affects your current branch, because both rebase and merge affect your current branch.  This is true no matter what options and arguments you give to git pull.
So your current branch matters.  And, every branch in Git can have one upstream setting.  If you run:
git pull origin new-branch

then git pull ignores the upstream setting (if any).  The name origin tells it where to fetch, and the name new-branch tells it how to run git merge or git rebase later, after the fetch finishes.
But if you run:
git pull

with no extra arguments, git pull uses the upstream setting.  This leads us to...
What an upstream is and does
Each branch name can have just one upstream setting.  Or, you can unset the upstream, and thus have no upstream.  If you unset the upstream—or have a branch in which it has never been set—running git pull with no arguments just complains at you.  So one thing setting the upstream does is enable you to run git pull with no arguments.
The upstream of a branch is just another name.  Usually, it's a remote-tracking name like origin/master or origin/new-branch.  This comes in two parts: the origin part—what git pull will give to git fetch—and the name of the branch as seen in the other Git.  Their master becomes your origin/master, so the remote-tracking name origin/master means, in effect, their master.
You can set the upstream of a branch to a branch in your own Git.  (Git stores this internally by setting the "remote" to ., but git branch --set-upstream-to doesn't need the .: you just do a git branch --set-upstream-to=develop feature and now the upstream of feature is develop.)  There are some small uses for this but for the most part, upstream settings should refer to some other Git.
Besides setting things up so that you can run git pull with no arguments—and also split this into git fetch && git merge or git fetch && git rebase, also with no extra arguments, if you want to split up the git pull like I often do—the upstream lets you:

*

*lets you see how far ahead and/or behind you are when you run git status; and

*affects git push, depending on your setting of push.default.

Some branch-creation commands automatically set an upstream for the new branch, and some don't.  For more details and links and so on, see Why do I have to "git push --set-upstream origin <branch>"? and Why do I need to do `--set-upstream` all the time?.


text:
Q: CSS quirk of horizontal margin I'm using codepen to play some CSS practice and encounter an error.

The width of the span should be 10 + 100 + 10 + 10 + 100 + 10 = 240px .
But chrome tool says it's 244.44px

A: That's due to the whitespace created by the linebreaks in the HTML code. If you write it all in one line, it becomes 240px wide:

* {
  box-sizing: border-box;
  margin: 0;
}

.container {
  width: 300px;
  background-color: pink;
  margin: 0 auto;
}

.one,
.two {
  width: 100px;
  height: 100px;
  margin: 10px;
  background-color: black;
  border: none;
  display: inline-block;
}

1

2

If you don't want that, you can either move all closing tags (for example
) to the next line, or use (empty) HTML comments at the end and beginning of lines:

* {
  box-sizing: border-box;
  margin: 0;
}

.container {
  width: 300px;
  background-color: pink;
  margin: 0 auto;
}

.one,
.two {
  width: 100px;
  height: 100px;
  margin: 10px;
  background-color: black;
  border: none;
  display: inline-block;
}

1

2


text:
Q: how to store function string argument on the stack void test(char arr[]){
        ;
    }

int main()
    {
        test("abc");

        return 0;
    }

abc is a string constant so passing it to the function will make arr a pointer to "abc" on the heap but I want it on the stack (i want to do string concatenation on it)

*

*how to store arr on the stack

*also does setting to char arr[3] or arr[ (any size) ] have an effect ? because my compiler allows it, and I didn't notice any.

A: All of char arr[], char arr[3], char arr[(any size)] has the same meaning in function arguments. They mean char* arr.
The arugment (a pointer) arr wil typically be placed on the stack (typically on x86) or on the register (typically on x86-64), depending on the calling convension.
What you actually want to do is to put the string on the stack.
It can be done by having the caller put what to pass on the stack:
void test(char arr[]){
    ;//////////////////////////////////////////
}

int main()
{
    char data[102400] = "abc"; /* allocate enough space for what will be concatenated */

    test(data);

    return 0;
}

Or have the function copy the string.
#include <string.h>

void test(char arr[]){
    char data[102400];
    strcpy(data, arr);
    ;//////////////////////////////////////////
}

int main()
{
    test("abc");

    return 0;
}


text:
Q: Can't get the others users name I'm trying to make an activity for a chat app with only a textview that it shows me the first name of every user,but i'm getting the first name of the user who is logged in,not for others.Here is my database:

The message activity:
public class MessageActivity extends AppCompatActivity {
    TextView username;
    FirebaseUser fuser;
    DatabaseReference reference;
    Intent intent;

    @Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate ( savedInstanceState );
        setContentView ( R.layout.activity_message );
       TabLayout appBarLayout=findViewById ( R.id.tab_2);

            username=findViewById ( R.id.username1 );

            intent=getIntent ();
            String userid=intent.getStringExtra ( "userid" );
            fuser= FirebaseAuth.getInstance ().getCurrentUser ();
            reference= FirebaseDatabase.getInstance ().getReference ("users").child ( "FIRST NAME");
            reference.addValueEventListener ( new ValueEventListener () {
                @Override
                public void onDataChange (@NonNull DataSnapshot dataSnapshot) {
                    User user=dataSnapshot.getValue (User.class);
                    username.setText ( user.getFirstName () );

                }

                @Override
                public void onCancelled (@NonNull DatabaseError databaseError) {

                }
            } );
        }

    }

The xml for message activity
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MessageActivity">

    <TextView
        android:id="@+id/username6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Name" />

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#00FFFFFF">

        <androidx.viewpager.widget.ViewPager
            android:id="@+id/view_pager2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            >

        </androidx.viewpager.widget.ViewPager>

    </com.google.android.material.appbar.AppBarLayout>

</LinearLayout>

I expect to appear in the TextView the First Name of the user i want to talk.

A: in the database you have the filed "FIRSTNAME" and in your code you have
.child ( "FIRST NAME");

Both values must be the same. Change the .child to this
.child ( "FirstName");

A: You have almost done but just forgot to add other user id and get other user info:-
reference= FirebaseDatabase.getInstance ().getReference ("users").child("other user id").child ( "FIRST NAME");
            reference.addValueEventListener ( new ValueEventListener () {
                @Override
                public void onDataChange (@NonNull DataSnapshot dataSnapshot) {
                    User user=dataSnapshot.getValue (User.class);
                    username.setText ( user.getFirstName () );

                }

                @Override
                public void onCancelled (@NonNull DatabaseError databaseError) {

                }
            } );


text:
Q: Declaring and using multiple Objective-C classes in a single file I've always used Objective-C in a very sterile, textbook situation, which is to have a single class defined within a single file, and having a set of files, one for implementation, and one for interface.
I'm ready to start traveling into the less preferable, but quick-and-dirty means to build classes, declaring and using multiple classes within a single implementation file.  (EDIT) I don't plan to do this in production code, just to test some ideas quickly off to the side if you will, but still able to access the data in the full application, rather than creating a separate sandboxed XCode Project to do it, which would not have access to all the data I'll need to test my idea.
All the educational material I can find only demonstrates the sterile method of one .h and one .m file and a single interface and implementation.
So say I want to have ClassA, ClassB, and ClassC all defined in ClassA's implementation file.  Do I still need to declare an interface for ClassB and ClassC and in what order in ClassA can I declare all this stuff and have it work properly.
Thanks a lot.

A: Yes, you have to declare the same things. You should declare the Interfaces prior to the Implementations.
But I suggest that this not be done to save time and only if there is a close relationship. An example would be other languages that allows sub-classes, in Objective-C this might be a candidate for a second class in the same file. I would expect only not class in the header file.
I restrict this to classes that are only used by the main class in the file and only the main class's Interface is in the header file. The second class would be a helper class to the main class. This is certainly better than just letting a class grow beyond a single responsibility.


text:
Q: SQL Concatenate View I need to create a view to concatanate a number of lines into a single line.
The table in question is QotMaster, and I need to join all lines from the NComment field where LineType = '6' and im guessing to group them under each quote to group by the Quote field.  Each of the lines to concatenate has the field Line and starts at 2 and increases depending on how many lines there are to the quotes comment.
Ultimately i'd like a single line to read:
Quote           NComment
00202300        Lines for quotes all listed one after the other starting at 2 and so on

Any help would be greatly apreciated.  Ive tried to dump a section I need concatenating below.
Quote   Line    LineType    DefaultEntry    ProductClass    TaxCode FedSalesTax MStockCode  MDescription    MWarehouse  MUom    MDecimals   MLineShipDate   MCusStockCode   MCusRetailPrice MMass   MVolume MUserField1 NComment    NCommentFromLin NCommentType    NCommentTextTyp NSrvIncTotal    NSrvSummary NSrvChargeType  NSrvParentLine  NSrvQtyFactor   NSrvApplyFactor NSrvDecimalRnd  NSrvDecRndFlag  NSrvMinValue    NSrvMaxValue    NSrvMulDiv  NPrtOnInv   NPrtOnDel   NPrtOnAck   NPrtOnQuote NCommentFlag1   NCommentFlag2   NCommentFlag3   NCommentFlag4   NCommentFlag5   NCommentFlag6   NCommentPoJob   TimeStamp   Version Release SalesOrderLine  MBomFlag    MParentKitType  MQtyPer MScrapPercentage    MPrintComponent MComponentSeq   MOptionalFlag   Estimate    ConfirmedFlag
00202300    1   7   0   M20             002023000000001                 Periodic inspection & test      **      0   2012-01-13 00:00:00.000                                 0.00000 0.000000    0.000000                                                            0                       0   0.000000        0       0.00    0.00                        0   0   0   0   0   0       0x000000002414E6EE          0           0.000000    0.00    N
00202300    2   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            Pre-Formed Windings, Sheffield                  0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C0          0           0.000000    0.00
00202300    3   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            To carry out a periodic inspection and test     0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C1          0           0.000000    0.00
00202300    4   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            of the fixed wiring installation.  This will    0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C2          0           0.000000    0.00
00202300    5   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            consist of 100% inspection and 10% testing,     0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C3          0           0.000000    0.00
00202300    6   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            based on previous records being available.      0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C4          0           0.000000    0.00
00202300    7   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            The price is based on no serious defects        0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C5          0           0.000000    0.00
00202300    8   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            being found, which may result in the testing    0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C6          0           0.000000    0.00
00202300    9   6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            being expanded to cover 25%, which would        0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C7          0           0.000000    0.00
00202300    10  6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            incur additional costs. A full report will      0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C8          0           0.000000    0.00
00202300    11  6   0                                                                                0   NULL                                    0.00000 0.000000    0.000000            be issued upon completion.                      0   N                   0   0.000000        0       0.00    0.00                    Y   1   0   0   0   0   0       0x000000002414E6C9          0           0.000000    0.00

A: In sql server, you'd just need to create a function to do something along these lines:
CREATE FUNCTION [dbo].[mergeComments](@quote NVARCHAR(8))
RETURNS nvarchar(max)
AS
BEGIN

DECLARE @comment nvarchar(max)
DECLARE @delimiter nvarchar(2)

SET @delimiter = ', '
SET @comment = ''

SELECT @comment = @comment + ISNULL(NComment,'')+@delimiter
FROM QotMaster
WHERE Quote = @quote AND Line > 1

SET @comment = substring(@comment,1,len(@comment)-LEN(@delimiter))

RETURN @comment

END

Then your view would just have do something along the lines of
SELECT Quote, dbo.mergeComments(Quote) NQuote
FROM (SELECT DISTINCT Quote FROM QotMaster)

That's just off the top of my head so there's probably a better way to do it.


text:
Q: Accessing linear models held in lists within a data.table I'm experimenting with data.table's ability to hold lists - in this case the output of linear models
require(data.table)

ir <- data.table(iris)
setkey(ir, Species)

lm.mods <- ir[, list(mods=list(lm(Sepal.Length~Sepal.Width))), by="Species"]

I can access a single model
lm.mods[1 , summary(mods[[1]])]

But I can't work out how to create a new variable that is a list containing the summary of each model.  I think it may require .SD or := but I can't work it out.
Any suggestions?