text:
Q: Functions whose antiderivative behaves like xf(x) I'm wondering if a classification of analytic functions, $f\,$ (it may be that $C^1$ is enough, but I'm not taking any chances, if you have a reason why I only need to consider a larger class of functions, I would enjoy that as well) with the property $F(x):=\int f(x) dx = \mathcal{O}(xf(x))$ as $x\to\infty$ AND $xf(x)=\mathcal{O}(F(x))$ where $\mathcal{O}$ is big-O notation.  I'm not sure if it's standard or not, but I'll denote this condition by
$$\mathcal{O}(F(x))=\mathcal{O}(xf(x))\qquad (*)$$
I'm motivated by the naïve notion of integration from the mistake many first semester students in calculus make when trying to take anti-derivatives and keep on thinking the same thing over and over:  the power rule.
It is straightforward to check that $f(x)=x^n\quad n\ne -1$ and $f(x)=\log^n x\quad n\ge 0$ satisfy the condition $(*)$, the first just by checking and the second by induction on $n$ and integration by parts.  It's also easy to see that this is not the case for $x^ne^x,\; n\in\mathbb{Z}$ again by integration by parts.
A preliminary investigation yields some interesting first starts:
1)  A valid refomulation of the problem is ${F\over f}$ has a slant asymptote, i.e. ${F\over f}=kx+\mathcal{o}(1)$, and if you know that the derivative of this little o function is also little o of 1, and say $k=1$ then you can rephrase this as $1-{d\over dx}(\log f(x))\cdot {F\over f}(x)=1+\mathcal{o}(1)$
2)  If the function is increasing we can get half of this inequality since $F(x)\le xf(x)$ since $F(x)=\int_a^xf(x)$, but the other half fails.
3)  A convex $\mathcal{o}(1)$ in (1) might imply that the derivative is also $\mathcal{o}(1)$

A: Note: This is a major rewrite of my earlier answer, to include necessary and sufficient conditions applicable to an even wider class of functions.
Instead of expanding to the class of all analytic functions (where the asymptotics can be hard to get control over, due to oscillatory behavior), my inclination would be to focus on large classes of functions with well-behaved asymptotics, including all the functions that arise in ordinary asymptotic analysis. The usual buzz phrase for this is "Hardy field" (mentioned for example in my answer here), which by definition is an ordered field of germs at infinity of $C^\infty$ functions.
I will describe several classes of such functions. The first is the class of all functions which are first-order definable in the structure $(\mathbb{R}, +, \cdot, <, \exp)$ together with all real numbers adjoined as constants. This class contains all functions that are constructible from polynomials, $\exp$, $\log$ and closed under the usual arithmetic operations and composition. It thus contains all the functions that usually arise in asymptotic analysis, and many more besides. This class enjoys the following strong model-theoretic property (as developed more fully in the theory of o-minimal structures):

(O) The zero set of any function $F: [a, \infty) \to \mathbb{R}$ in this class is a finite union of points and intervals (finite or infinite in extent).

Condition O ensures that every such function $F$ is either eventually positive ($F(x) > 0$ for all sufficiently large $x$), eventually zero, or eventually negative. As a result, the ring of germs at infinity of the definable functions in this class forms an ordered field, i.e., is a Hardy field.
Also, if $F$ is definable, then $F'$ is also first-order definable (and its domain can be shown to be the domain of $F$ save for finitely many points). Applying condition O to $F'$, every definable $F$ in this class is either eventually increasing, eventually decreasing, or eventually constant.
Proposition: A function $F$ in this class satisfies $F(x) = O(xF'(x))$ and $xF'(x) = O(F(x))$ if and only if there exist $n, N$, both positive or both negative, for which $x^n < |F(x)| < x^N$ for all sufficiently large $x$.
Proof: WLOG we may assume $F$ is eventually positive, and is not eventually constant. Thus $F$ is either eventually increasing or eventually decreasing, say eventually increasing. If $F$ is eventually bounded above by some $x^N$, $N > 0$, then by increasing $N$ if necessary we may assume $F(x)/x^N$ tends to zero, whence it is eventually decreasing. Taking the derivative, we conclude that eventually
$$x^N F'(x) - Nx^{N-1}F(x) < 0$$
whence $xF'(x) < NF(x)$, i.e., $|xF'(x)| < N|F(x)|$ or $xF'(x) = O(F(x))$. However, if $F(x)$ is eventually bounded above by every positive-power function $x^N$ (think $N$ small!), this also shows $xF'(x) = o(F(x))$, so that $F(x)$ is not $O(xF'(x))$.
By a similar argument, if $F(x)$ is eventually bounded below by some positive-power function $x^n$, we get $nF(x) < xF'(x)$ eventually, so that $F(x) = O(xF'(x))$. This also shows that if $F(x)$ is bounded below by every positive-power function (think $n$ large!), then $F(x) = o(xF'(x))$, so $xF'(x)$ is not $O(F(x))$.
Thus, if $F(x)$ is positive and eventually increasing, a necessary and sufficient condition that $F'$ satisfy condition ($\ast$) in the question is that there exist two positive-power functions that $F$ is eventually squeezed between. An entirely similar analysis shows that if $F(x)$ is positive and eventually decreasing, a necessary and sufficient condition that $F'$ satisfy condition ($\ast$) is that there exist two negative-power functions that $F$ is eventually squeezed between. Thus the proposition is proved.

The almost freshman-level triviality of this proof testifies to the great power of condition O (which is a special case of the o-minimality axiom), from which all flows.
Thus it is of interest to know of classes of functions which satisfy it. I will mention an extraordinary result in this regard, due largely to Patrick Speissegger (The Pfaffian closure of an o-minimal structure, J. Reine Angew. Math. 508 (1999), 189--211):
There is an o-minimal expansion of the ordered exponential field $\mathbb{R}$ (thus, including the class of functions described above) so large that

*

*The structure includes the restriction of any analytic function to a compact box,

*If $f: [a, \infty) \to \mathbb{R}$ is first-order definable within this structure, then so is any antiderivative $F$ (even though general antiderivatives are not definable by a first-order construction),
This may fit better with Adam Hughes's formulation in terms of antiderivatives. Since condition O is satisfied (according to the more general o-minimality condition), the same analysis as above applies.


text:
Q: Express-session works wrong when website migrated from http to https? After we migrated our website from http scheme to https (including enabling https on CDN and redirecting http to https on server), we found that our user sessions works incorrectly sometimes, that is, the user A would be recognized as user B! It seems the session ids of cookies are incorrectly parsed and maybe different users share the same cookies or session ids but all the session ids are generated by uid-safe uniquely.
The issue seems very strange and we really have no idea of the cause.
we use nodejs, Express, express-session with redis storage.
The express-session setup is as below:
app.use(session({
  secret: 'xxxx',
  cookie: {
    maxAge: 3600*24*90*1000
  },
  store: new redisStore(),
  resave: false,
  rolling: true,
  saveUninitialized: false
}));

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I persist the gridlines for ticks that are not displayed? [Chart.js] I am using Chart.js for charts for a website and have came across an issue I can't seem to be able to solve. I need to display the gridlines for every tick, even the ones that are not displayed due to the lack of room for the labels.
Every tick has a date label and as many of these should be displayed as possible, however when the chart is resized or if there is a lot of data, some ticks are removed due to the Chart.js "nice numbers algorithm". This behaviour is expected and okay, but what I still want to have is the gridlines associated with each of these ticks. Currently I am having an issue separating the two as gridlines will only be displayed when there is a displayed tick.
Does anyone have any idea how I can display the gridlines for every index along the x-axis, but with the tick labels still displayed according to the "nice numbers algorithm"?
Here are some screenshots of what I mean:
This is what the graph should look like with full ticks and gridlines
However if I resize the graph smaller, many of the ticks are hidden, and so are their corresponding gridlines

A: I think there is no way to hide label and keep displaying gridlines. But you could keep all labels and gridlines by set autoSkip option off:
ticks: {
        autoSkip: false
       }


text:
Q: How to set DesignInstance to a ViewModel from c++ cli Is it somehow possible to specify a ViewModel written in c++ cli as Xaml datacontext DesignInstance in WPF/MVVM pattern?

A: Microsoft added a new feature to VS 2019 16.8 that allows you to set d:DataContext for use in the designer.  You just have to set an xml namespace to the dotnet namespace and assembly.
https://learn.microsoft.com/en-us/visualstudio/releases/2019/release-notes-v16.8 - XAML Code Editor - Improving MVVM Support.
That might work


text:
Q: Is there always a way to find the meaning of a multi-word verb or an expression by its words? I think that would be a good practice for English learners to put the correct meaning of words of a multi-word verb or an expression. and find the whole meaning. So, can we be sure about that, or we have to exclude some expressions or multi-word verbs?
This question came to my mind when I couldn't find the meaning of "on" in "Come on!".

A: The meaning of phrasal verbs are non-compositional.
For example : Come on, Hand in, Cut down, Dress down, etc.
You can't tell their meaning by looking at each individual word. But I think sometimes you can roughly predict the meaning by looking at the verb. For example, "cut down" means "decrease the uses of" which has something to do with "cut".

A: I don't know of a foolproof way, but I think it's a matter of awareness, recognition, and discovery.
First, you need to be aware: not only do phrasal verbs exist, but they are also rather common. If you read (or listen to) English long enough, you're going to come across them.
Second, you need to recognize their format (generally: verb + preposition, although sometimes verb + adverb).
Armed with this information, when trying to interpret a sentence or imperative (such as, "Come on!"), you need to say to yourself: "Wait! Maybe this is another one of those pesky phrasal verbs..."
Sure enough, when you look it up in a dictionary, there it is:

come on (phrasal verb) used for telling someone to hurry ⇒ Come on! We're going to be late.

(Many good online dictionaries will give phrasal verbs their own entry.)
So, as you try to learn the meaning of certain sentences, remember: not all words should be examined individually.

My daughter was going out with Ted. Evidently, they broke up about a week ago, but I didn't find out until yesterday, when I dropped her off at school.

Can you find the phrasal verbs in those two sentences? There are four of them.


text:
Q: java regular expression examples for match without length limitation i trying to write a regular expression for match a string starting with letter "G" and second index should be any number (0-9) and rest of the string can be contain any thing and can be any length,
i'm stuck in following code
String[] array = { "DA4545", "G121", "G8756942", "N45", "4578", "#45565" };

String regExp = "^[G]\\d[0-9]";

for(int i = 0; i < array.length; i++)
{
    if(Pattern.matches(regExp, array[i]))
    {
        System.out.println(array[i] + " - Successful");
    }
}

output:
G12 - Successful
why is not match the 3 index "G8756942"

A: when you write \d it already means [0-9]
so when you say \d[0-9] that means two digits exactly
better use :
^G\\d*

which will match all words starting with G and having zero or more digits

A: This regex would be fine.
"G\\d.*"

Because matches method tries to match the whole input,  you need to add .* at the last in your pattern and also you don't  need to include anchors.
String[] array = { "DA4545", "G121", "G8756942", "N45", "4578", "#45565" };

String regExp = "G\\d.*";

for(int i = 0; i < array.length; i++)
{
    if(Pattern.matches(regExp, array[i]))
    {
        System.out.println(array[i] + " - Successful");
    }
}

Output:
G121 - Successful
G8756942 - Successful

A: "^[G]\\d[0-9]"

This regex matches "G" followed by \\d, then another number.
Use one of these:

*

*"^G\\d"

*"^G[0-9]"
Also note that you don't need a character class since it only contains one letter, so it's redundant.

A: try this regex .* will match any character after digit
^G\\d.*

http://regex101.com/r/uE4tX1/1

A: G - the letter G
[0-9] - a digit
.* - any sequence of characters

So the expression
G[0-9].*

will match a letter G followed by a digit followed by any sequence of characters.

A:
why is not match the 3 index "G8756942"

Because you match for a string starting with G, followed by a \, a d and exactly one digit. Solution:
^[G]\d


text:
Q: how to place the container div in the center of the page using css and react? i have div wrapper with header and container divs and i want to place these in the center of the page.
below is the code,
return (
    <Wrapper>
        <svg/>
        <Content>
            first
             second
            <Actions>
                <button> cancel</button>
            </Actions>
        </Content>
    </wrapper>
);

const Wrapper = styled.div`
    width: 100vw;
    background-color: white;
    height: calc(100vh - 20px);
    position: relative;
`;

const Content = styled.div`
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
`;

 const Actions = styled.div`
     display: flex;
     flex-direction: row;
     justify-content: space-between;
 `;

 const Header = styled.div`
     position: absolute;
     width: 100%;
     display: flex;
     justify-content: center;
`;

how can i make the header and content divs to be in the center of the page using css. could someone help me with this. thanks.


text:
Q: autocompletar en un Select De nuevo con dudas.
Estoy investigando un código para poder autocompletar en un combobox, parece que funciona bien, pero...el SELECT(combobox), me aparece siempre en la esquina izquierda de la pantalla, me gustaría poder colocarlo en otra posición, pero no veo como darle la posición.
El codigo es este..supongo que ya lo conoceis..
  <style>
  .custom-combobox {
    position: absolute;
    display: inline-block;
  }
  .custom-combobox-toggle {
    position: absolute;
    top: 0;
    bottom: 0;
    margin-left: -1px;
    padding: 0;
  }
  .custom-combobox-input {
    margin: 0;
    padding: 5px 10px;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>

  $( function() {
    $.widget( "custom.combobox", {
      _create: function() {
        this.wrapper = $( "<span>" )
          .addClass( "custom-combobox" )
          .insertAfter( this.element );

        this.element.hide();
        this._createAutocomplete();
        this._createShowAllButton();
      },

      _createAutocomplete: function() {
        var selected = this.element.children( ":selected" ),
          value = selected.val() ? selected.text() : "";

        this.input = $( "<input>" )
          .appendTo( this.wrapper )
          .val( value )
          .attr( "title", "" )
          .addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left" )
          .autocomplete({
            delay: 0,
            minLength: 0,
            source: $.proxy( this, "_source" )
          })
          .tooltip({
            classes: {
              "ui-tooltip": "ui-state-highlight"
            }
          });

        this._on( this.input, {
          autocompleteselect: function( event, ui ) {
            ui.item.option.selected = true;
            this._trigger( "select", event, {
              item: ui.item.option
            });
          },

          autocompletechange: "_removeIfInvalid"
        });
      },

      _createShowAllButton: function() {
        var input = this.input,
          wasOpen = false;

        $( "<a>" )
          .attr( "tabIndex", -1 )
          .attr( "title", "Ver Todos" )
          .tooltip()
          .appendTo( this.wrapper )
          .button({
            icons: {
              primary: "ui-icon-triangle-1-s"
            },
            text: false
          })
          .removeClass( "ui-corner-all" )
          .addClass( "custom-combobox-toggle ui-corner-right" )
          .on( "mousedown", function() {
            wasOpen = input.autocomplete( "widget" ).is( ":visible" );
          })
          .on( "click", function() {
            input.trigger( "focus" );

            // Close if already visible
            if ( wasOpen ) {
              return;
            }

            // Pass empty string as value to search for, displaying all results
            input.autocomplete( "search", "" );
          });
      },

      _source: function( request, response ) {
        var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
        response( this.element.children( "option" ).map(function() {
          var text = $( this ).text();
          if ( this.value && ( !request.term || matcher.test(text) ) )
            return {
              label: text,
              value: text,
              option: this
            };
        }) );
      },

      _removeIfInvalid: function( event, ui ) {

        // Selected an item, nothing to do
        if ( ui.item ) {
          return;
        }

        // Search for a match (case-insensitive)
        var value = this.input.val(),
          valueLowerCase = value.toLowerCase(),
          valid = false;
        this.element.children( "option" ).each(function() {
          if ( $( this ).text().toLowerCase() === valueLowerCase ) {
            this.selected = valid = true;
            return false;
          }
        });

        // Found a match, nothing to do
        if ( valid ) {
          return;
        }

        // Remove invalid value
        this.input
          .val( "" )
          .attr( "title", value + " no se encuentran resultados" )
          .tooltip( "open" );
        this.element.val( "" );
        this._delay(function() {
          this.input.tooltip( "close" ).attr( "title", "" );
        }, 2500 );
        this.input.autocomplete( "instance" ).term = "";
      },

      _destroy: function() {
        this.wrapper.remove();
        this.element.show();
      }
    });

    $( "#Combobox3" ).combobox();
    $( "#toggle" ).on( "click", function() {
      $( "#Combobox3" ).toggle();
    });
  } );
  </script>

El SELECT está definido de esta forma.
<select name="Combobox3" size="1" id="Combobox3" style="position:absolute;left:84px;top:410px;width:310px;height:39px;z-index:9;">

la verdad es que esto me mosquea

.addClass( "custom-combobox-input ui-widget ui-widget-content
  ui-state-default ui-corner-left" )

pero eso...., siempre me aparece en la esquina superior izquierda...
Saludos....

A: El combobox está embebido en un <span> con la clase .custom-combobox. Es ha dicho <span> al que tienes que dar estilos si quieres moverlo:

<style>
  .custom-combobox {
    position: absolute;
    display: inline-block;
    left: 222px;
    top: 86px;
    width: 310px;
    height: 39px;
    z-index: 9;
  }
  .custom-combobox-toggle {
    position: absolute;
    top: 0;
    bottom: 0;
    margin-left: -1px;
    padding: 0;
  }
  .custom-combobox-input {
    margin: 0;
    padding: 5px 10px;
  }
  </style>
  <select name="Combobox3" size="1" id="Combobox3">

  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>

  $( function() {
    $.widget( "custom.combobox", {
      _create: function() {
        this.wrapper = $( "<span>" )
          .addClass( "custom-combobox" )
          .insertAfter( this.element );

        this.element.hide();
        this._createAutocomplete();
        this._createShowAllButton();
      },

      _createAutocomplete: function() {
        var selected = this.element.children( ":selected" ),
          value = selected.val() ? selected.text() : "";

        this.input = $( "<input>" )
          .appendTo( this.wrapper )
          .val( value )
          .attr( "title", "" )
          .addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left" )
          .autocomplete({
            delay: 0,
            minLength: 0,
            source: $.proxy( this, "_source" )
          })
          .tooltip({
            classes: {
              "ui-tooltip": "ui-state-highlight"
            }
          });

        this._on( this.input, {
          autocompleteselect: function( event, ui ) {
            ui.item.option.selected = true;
            this._trigger( "select", event, {
              item: ui.item.option
            });
          },

          autocompletechange: "_removeIfInvalid"
        });
      },

      _createShowAllButton: function() {
        var input = this.input,
          wasOpen = false;

        $( "<a>" )
          .attr( "tabIndex", -1 )
          .attr( "title", "Ver Todos" )
          .tooltip()
          .appendTo( this.wrapper )
          .button({
            icons: {
              primary: "ui-icon-triangle-1-s"
            },
            text: false
          })
          .removeClass( "ui-corner-all" )
          .addClass( "custom-combobox-toggle ui-corner-right" )
          .on( "mousedown", function() {
            wasOpen = input.autocomplete( "widget" ).is( ":visible" );
          })
          .on( "click", function() {
            input.trigger( "focus" );

            // Close if already visible
            if ( wasOpen ) {
              return;
            }

            // Pass empty string as value to search for, displaying all results
            input.autocomplete( "search", "" );
          });
      },

      _source: function( request, response ) {
        var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
        response( this.element.children( "option" ).map(function() {
          var text = $( this ).text();
          if ( this.value && ( !request.term || matcher.test(text) ) )
            return {
              label: text,
              value: text,
              option: this
            };
        }) );
      },

      _removeIfInvalid: function( event, ui ) {

        // Selected an item, nothing to do
        if ( ui.item ) {
          return;
        }

        // Search for a match (case-insensitive)
        var value = this.input.val(),
          valueLowerCase = value.toLowerCase(),
          valid = false;
        this.element.children( "option" ).each(function() {
          if ( $( this ).text().toLowerCase() === valueLowerCase ) {
            this.selected = valid = true;
            return false;
          }
        });

        // Found a match, nothing to do
        if ( valid ) {
          return;
        }

        // Remove invalid value
        this.input
          .val( "" )
          .attr( "title", value + " no se encuentran resultados" )
          .tooltip( "open" );
        this.element.val( "" );
        this._delay(function() {
          this.input.tooltip( "close" ).attr( "title", "" );
        }, 2500 );
        this.input.autocomplete( "instance" ).term = "";
      },

      _destroy: function() {
        this.wrapper.remove();
        this.element.show();
      }
    });

    $( "#Combobox3" ).combobox();
    $( "#toggle" ).on( "click", function() {
      $( "#Combobox3" ).toggle();
    });
  } );
  </script>


text:
Q: Is it possible to sort in ascending order, a 2D array in C? If so, how? Part of my assignment is to sort a 2D array into ascending order, and I cannot figure out how to do it for the life of me.
What I have so far:
int Sort2DArray(int A[][COL], unsigned int rowsize, unsigned int colsize)
{
 int i, j, k, temp;
 for (i=0; i<rowsize-1; i++){
     for (k=0; k<colsize; k++){
        for (j=0; j<rowsize-1; j++){
            do  {
             temp = A[k][j];
             A[k][j] = A[k][j+1];
             A[k][j+1] = temp;
            } while (A[k][j]>A[k][j+1]);
        }
     }
 }
}

This will take an array this and return:
3 2 1               1 2 3
5 8 7    ---->>>    5 7 8
4 9 3               3 4 9

However, I need it to return:
1 2 3
4 5 6
7 8 9

So, is there any way you guys can help me? Thanks!
EDIT:
#include <stdio.h>
#include <stdlib.h>

#define COL 20
#define ROW 20

void PopulateArray2DUnique (int [][COL], unsigned int, unsigned int, int, int);

void DisplayArray2D(int [][COL], unsigned int, unsigned int);

int FindLargest(int [][COL], unsigned int, unsigned int);

int FindColSum(int [][COL], unsigned int, unsigned int, unsigned int);

int Sort2DArray(int [][COL], unsigned int, unsigned int);

int main()
{
 int A[ROW][COL];
 int min=1, max=99;
 unsigned int rowsize, colsize, col_to_sum;

 printf ("Input your desired row and column size: \n");
 scanf ("%u%u", &colsize, &rowsize);

 PopulateArray2DUnique(A, rowsize, colsize, min, max);
 DisplayArray2D(A, rowsize, colsize);
 FindLargest(A, rowsize, colsize);

    printf ("Which column would you like to find sum of?\n");
    scanf ("%d", &col_to_sum);

 FindColSum(A, rowsize, colsize, col_to_sum);
 Sort2DArray(A, rowsize, colsize);
 DisplayArray2D(A, rowsize, colsize);

 return 0;
}

A:
Is it possible?

Yes, it's possible. The most important thing to understand is that your sort routine, and all of the basic sort routines you see in examples, generally sort a 1D array.[1] The same routine can be used to sequentially sort a 2D array as you are attempting to do, but you have to recognize you want to pass your 2D array to the sort function as a pointer-to-type (simple 1D array, e.g. 'int *'), rather than as a pointer-to-array of X elements (your 2D array, e.g. 'int (*)[NCOLS]')
The key to passing the array is to simply pass the address to the first element in your array. Regardless of whether you declared it as a 1D or 2D array (1) that is the address where the values begin in memory; and (2) all array values are sequential. Meaning that you can address every value in a 1D or 2D array by start_address + offset.
Take for example your simple bubble-sort routine:
void bubblesort (int *a, size_t n)
{
    size_t i, j;
    int temp;

    for (i = 0; i < n; i++) {
        for (j = 0; j < (n-1); j++) {
            if (a[j] > a[j + 1]) {
                temp = a[j + 1];
                a[j + 1] = a[j];
                a[j] = temp;
            }
        }
    }
}

If you had declared a 2D array (e.g. int array[][NCOL];, not pointer-to-pointer-to-type int **array;) that you wished to sequentially sort, you could call your sort routine by simply passing the start address as follows:
    bubblesort (*array, nelem);

or
    bubblesort (&array[0][0], nelem);

(both are equivalent, with 'nelem' being the total number of elements)
If you attempt to declare your sort function by passing a pointer to array (e.g. bubblesort (int (*array)[NCOL], size_t n); you will run difficulty immediately attempting to loop over the indexes because using the traditional nested loop layout, there is no easy way to compare array[i][j] with array[i+1][0], etc..
The following is a short example putting it all together. Look it over and let me know if you have questions:
#include <stdio.h>
#include <stdlib.h>

#define NCOL 3

void bubblesort (int *a, size_t n);

int main ()
{
    int array[][NCOL] = {{3,2,1},
                         {5,8,7},
                         {4,9,3}};
    int i, j, nrows, nelem;

    nrows = sizeof array/sizeof *array;
    nelem = sizeof array/sizeof **array;

    printf ("\noriginal:\n\n");
    for (i = 0; i < nrows; i++) {
        for (j = 0; j < NCOL; j++)
            printf (" %2d", array[i][j]);
        putchar ('\n');
    }

    bubblesort (*array, nelem);

    printf ("\nsorted:\n\n");
    for (i = 0; i < nrows; i++) {
        for (j = 0; j < NCOL; j++)
            printf (" %2d", array[i][j]);
        putchar ('\n');
    }

    return 0;
}

void bubblesort (int *a, size_t n)
{
    size_t i, j;
    int temp;

    for (i = 0; i < n; i++) {
        for (j = 0; j < (n-1); j++) {
            if (a[j] > a[j + 1]) {
                temp = a[j + 1];
                a[j + 1] = a[j];
                a[j] = temp;
            }
        }
    }
}

Output
$ ./bin/qsort_2d_linear

original:

  3  2  1
  5  8  7
  4  9  3

sorted:

  1  2  3
  3  4  5
  7  8  9

Note: you can do the same thing with qsort rather easily with the standard integer compare function and calling qsort (array, nelem, sizeof **array, icompare);
footnote[1]: all arrays in C are 1D arrays, the 2D array is simply addressed in a way to allow 2D indexing. It is still a sequential block of 'type' values in memory.)

A: I'm not sure if I have the best method here, however what I would do, is store each value from the array into one large 1D array, sort that and then assign them to the 2D array.
int Sort2DArray(int A[][COL], unsigned int rowsize, unsigned int colsize)
{
    int arraySize = rowsize * colsize;
    int sortingArray[arraySize];
    int i = 0, row, col, temp, prevPos;

    //Fills the sortingArray with all the values in the 2D array
    for (col = 0; col < colsize; ++col) {
        for (row = 0; row < rowsize; ++row) {
            sortingArray[i] = A[row][col];
            ++i;
        }
    }

    //Sorts the 1D array (Insertion Sort)
    for (i = 1; i < arraySize; ++i)
    {
        temp = sortingArray[i];
        prevPos = i - 1;
        while (j >= 0 && sortingArray[prevPos] > temp)
        {
            sortingArray[prevPos+1] = sortingArray[prevPos];
            prevPos = prevPos - 1;
        }
        sortingArray[prevPos + 1] = temp;
    }

    //Writes data back into 2D array
    i = 0;
    for (row = 0; row < rowsize; ++row) {
        for (col = 0; col < colsize; ++col) {
            A[row][col] = sortingArray[i];
            ++i;
        }
    }
}

I hope I didn't get too confusing with all those dimensions, but you get the idea. If you spot anything incorrect, let me know.

A: It smells like homework to me, thus, I will only help you a little, and leave the rest to yourself.
When I was very new to C, and my first programming language, I had solved a lot of problems, and one of them was this.
The code I am pasting here is taken from here, a website, which I used to use a lot.
It is up to you to understand the algorithm, and program, and use it in your program.
#include<stdio.h>

int main( )
{

    int a[][6]={
                {25,64,96,32,78,27},      //Desired solution : {25,27,32,64,78,96},
                {50,12,69,78,32,92}       //                   {50,92,78,12,32,69}
                };
     int i, j, k, temp, temp1 ;

    //Bubble sorting is applieed on one first row while the other row is swapped

     for(j=1;j<6;j++)
     {
          for(i=0; i<5; i++)
          {
                if(a[0][i]>a[0][i+1])
                {
                    temp=a[0][i];
                    a[0][i]=a[0][i+1];
                    a[0][i+1]=temp;

                    temp1 = a[1][i];
                    a[1][i] = a[1][i+1];
                    a[1][i+1]=temp1;
                }
          }
     }

     printf ( "\n\nArray after sorting:\n") ;
     for ( i = 0 ; i <2; i++ )
     {
        for(j=0; j<6; j++)
        {
            printf ( "%d\t", a[i][j] ) ;        //printing sorted array
        }
        printf("\n");
     }
 }

It is a bit different from the code on the site, as I used to always used to work in Ubuntu, and linux never had conio.h. Also, if you are angry for me only providing the code used everywhere, and not doing all your work, keep in mind that homework assignments are for making the student think, and if I spoon-feed you, the purpose will be lost.
NOTE: Always post your full code which can be compiled successfully, as the code you have posted does not compile, as you have not declared all your functions. Thus, it is very difficult to understand you code.
Also, do not try to fool us, as the input you have mentioned does not have a 6, and you want a 6 also to be returned so actually even you have not compiled your code.


text:
Q: So many units of measurements not in use? Android support different units of measures:

*

*dp

*sp

*px

*pt

*mm

*in

They recommend using dp for layout and sp for font size.
Can someone point me to a use case where I should be using one of those: px, pt, mm and in ?

A: Here you have similar question with detailed answers.
Pixels, inches, millimeters and points are units which will be differently displayed on different screens. Screen resolutions can vary between 240x320px and 2560x1600, even with similar screen size and vice versa. Use them only when you absolutely have to (e.g. ruler app).


text:
Q: loading bpg images: compatible, simple and efficient techniques Recently there has been some hubbub regarding Fabrice Bellard's BPG image format (http://bellard.org/bpg/), which (based on the demos provided on his site) provides better compression than jpeg, webp and some others.  The image decoding is done in the browser with JS, which means it can be used immediately, without waiting for browser adoption.  Overall this seems like a good idea and trading some CPU time for faster downloading is often a workable tradeoff.
The technique being used here to swap out images is to, on window.load, iterate over document.images, find any where the src attribute contains a URL ending with ".bpg" and replace that with a canvas.
This is however definitely not the only way to approach the problem, and I see some down sides to this technique, which include: a) canvases do not have exactly the same layout rules as images - e.g. setting the width attribute on it means something different on an img vs a canvas, b) it also seems that at least in Chrome how the scaling is done for images which are scaled down vs canvases is different.
A better solution would ideally meet these requirements:

*

*Attempt to not duplicate image data in memory any more than necessary (and also not unnecessarily utilize more CPU than is necessary - decoding in JS already requires a lot compared to native image handling)

*Have as much browser compatibility as feasible

*Use  tags instead of <canvas> (not a requirement, but would seem to be better)

*Provide an easy way to not only process images on document load, but also images that are added to the document later (e.g. in response to user activity)

*Still be simple to use (the existing technique on bellard.org is certainly easy to integrate)

*EDIT: Using web workers to decode the image without blocking the page is also potentially a good way to go.

Some relevant tools that come to mind include data: and blob: urls.
Anyone have examples of working code which loads BPGs using such "better" techniques? (The way Fabrice has it in his examples isn't bad, and certainly approaches have tradeoffs, but I think there may be something better for generalized use.)

A: BPG does look promising. If you want to detect the addition of  elements at any time, from any source, you can use MutationObservers.
In case you don't know about them, they're asynchronous, logging a subset of all DOM mutations in a document and allowing the callback to handle those mutations at once rather than synchronously as with DOM Events. So if you create or change the source of a lot of images in a script, the observer will wait until your script finishes, then process all the new images in one go (hence the loops in the callbacks).
The following assumes that you have a function called doSomethingToDecode(img) (sorry I'm not going to help with that right now) that replaces the src of the img with (most likely) a generated PNG. It can do that asynchronously, that's not a problem. Also you don't need to stop observing the image while swapping its src as long as the generated remplacement doesn't end in ".bpg".
This first observer will react when you add  descendants anywhere (and other elements  but it ignores those); unfortunately it is not possible to optimize it much in the general case. It has to iterate over the list of mutations, and then the list of new nodes for each mutation, hence those nested for loops. But
imgObs=new MutationObserver(
    function(mutations){
        for(var i=0, m; m=mutations[i]; i++) if(m.addedNodes.length)
            for(var j=0, img; img=m.addedNodes[j]; j++) if(img.localName=="img"){
                if(img.src && /\.bpg$/.test(img.src))
                    doSomethingToDecode(img)
                srcObs.observe(img, srcOptions)
            }
    }
)

This other observer reacts when you change the src attribute of an element, and should observe only  elements (for top performance, it has no failsafes in case you make it observe other elements, so don't).
srcObs=new MutationObserver(
    function(mutations){
        for(var i=0, m; m=mutations[i]; i++){
            var img=m.target
            if(img.src && /\.bpg$/.test(img.src))
                doSomethingToDecode(img)
        }
    }
)

Also keep this handy, we'll need it every time we start observing a new image:
var srcOptions={childList:false, attributes:true, attributeFilter:["src"]}

You could also make an observer that reacts to the removal of  elements to stop observing them then, and free any decoding-related ressources, but hopefully the browser is at least smart enough to stop observing elements that should be garbage collected (not tested!).
Run this after loading the HTML (don't wait for the whole page with images and CSS etc). Note: this is using the DOM level 0 document.images collection. Very old-school but it is doing exactly what we want very efficiently and concisely, so why the hell not?
So first you decode existing s with bpg sources, and observe them for src changes later on:
for(var i=0, img; img=document.images[i]; i++){
    if(img.src && /\.bpg$/.test(img.src))
        doSomethingToDecode(img)
    srcObs.observe(img, srcOptions)
}

Then this tells the first observer to react to stuff in the entire document's ; unfortunately there is no tagNameFilter parameter to natively filter out non- childList mutations.
imgObs.observe(document.body, {subtree:true, childList:true, attributes:false})

A: Add an error event handler to the images. On Chrome 40, it is triggered when the image is missing or when the browser does not know how to display it:

Pros: no memory/cpu usage on the client part.
Cons: need to provide alternate images on the server.
I believe you could declare a global error listener on all img tags so this would work for future images too.


text:
Q: Can't go in recovery mode Hi I'm new to Ubuntu and don't know a lot.
I have set my ssd storage as the boot device but the thing is
I want to go in recovery mode to change my password because I've forgotten it.
I have looked over some topics how to do it but every time my boot screen comes up it changes way too fast to press shift in time.
Is there some other (safe) way to go in recovery mode?

A: I noticed something that works, for me at least. This is to restart again, when I reach the login screen. When I do so, this action appears the GRUB loader options, after the restart.
Not every time I restart I get the GRUB loader appearing, I am not aware of how this works. I use Lubuntu 14.04, a version of Ubuntu.


text:
Q: wc command with no FILE argument (reading from standard input) Regarding wc (word count) command... I am trying to understand the following (from man wc which I have quoted below plus added a longer quote at end of my question)

With no FILE, or when FILE is -, read standard input.

How exactly does this work? At what point do I type the "standard input"?
Finding explanations online rather confusing. Maybe I am just missing some basic info regarding what exactly stdin is.
From man wc
SYNOPSIS
     wc [OPTION]... [FILE]... wc [OPTION]... --files0-from=F

DESCRIPTION
     Print newline, word, and byte counts for each FILE, and a total
     line if more than one FILE is specified. A word is a
     non-zero-length sequence of characters delimited by white space.

     With no FILE, or when FILE is -, read standard input.

A: wc, the program, detects when there's 0 filenames, or just "-", on the command line, e.g.
wc
wc -

and, in those cases, reads from -STDIN (Stream 0 for the process). You never need to "type standard input".
The "parent process", the one that creates a process, is responsible for setting up 3 I/O streams:
0 STDIN - program input
1 STDOUT - normal program output
2 STDERR - error program output

It's up to the program to read from STDIN, if it wants to.
An example of using wc to read from the standard input stream:
$ echo 'hello world' | wc
      1       2      12

Here, wc counts the number of lines, words, and characters arriving on its standard input stream.  That stream is connected to the standard output stream of the echo command by the shell via a pipe.  The echo command sends the string hello world to its standard output stream, and wc receives it.

A: My issue was that I was unfamiliar with using ctrl+d to "end terminal line input" (after typing input text).
I suppose it's basic knowledge for using the command line - but something I was unable to figure out by reading the man page and googling how to use the wc command extensively.
Step by step for any other confused beginners out there:
Type wc - in terminal and hit ENTER.
Now you can start typing your input.
When you are done, press ctrl+d


text:
Q: First & Second Derivative of $y=x(2x+3)^4$? How do you find the first and second derivative of $y=x(2x+3)^4$ using the chain rule?
I know the answers I am just not sure how to solve this equation.
When I try to solve this using the product chain rule, $(f'(x)\cdot g(x))+(g'(x)\cdot f(x))$, I get a very different answer than the one I am suppose to.
The answer I am supposed to get is $y'=(2x+3)^3(10x+3)$ and $y''=(2x+3)^2(80x+48)$

A: What you have written is simply the product rule:
$$(f(x)\cdot g(x))' = f'(x)\cdot g(x) + f(x) \cdot g'(x).$$
To obtain the rule for this situation, we need to combine the chain rule,
$$\big(f(g(x))\big)' = f'(g(x))\cdot g'(x)$$
with the product rule to obtain:
\begin{align*}
(f(g(x)))\cdot h(x))' &= \big(f(g(x))\big)'\cdot h(x) + f(g(x)) \cdot h'(x)\\
&= f'(g(x))\cdot g'(x) \cdot h(x) + f(g(x)) \cdot h'(x)
\end{align*}.
So what are $f, g$ and $h$ here? Identifying them correctly and using the rule we just developed should allow you to arrive at the desired result. (You'll need to do a little algebra to simply the resulting expression.)
Repeating this process will allow you to find the correct second derivative as well. Good luck!

A: Let $f(x) = x$ and $g(x) = \left( h(x) \right) ^4$ where $h(x) = 2x+3$
Then $f'(x) = 1$ and $h'(x) = 2$ which gives further
$$ g'(x) = 4 \left( h(x) \right) ^3 \cdot h'(x) =8(2x+3)^3 $$
Use the product chain rule:
\begin{align}
y' & = f'(x) \cdot g(x) + f(x) \cdot g'(x) = 1 \cdot (2x+3)^4 + x \cdot 8(2x+3)^3 \\
& = (2x+3+8x)(2x+3)^3 = (10x+3)(2x+3)^3
\end{align}
I hope you can do the same for $y''$ :)

A: well, what prevents you from using
$$(u\cdot v)' = u'v+uv'$$
where $u = x$ and $v=(2x+3)^4$
morover $(2x+3)^4$ is a complicated so it is like $(u(\varphi(t)))'\cdot (\varphi(t))'$ which equals to $4(2x+3)^3\cdot 2$
and you have to do it just twice:) (just find derivative of the first derivative)
as A result:
$$\frac{dx}{dy} = (2x+3)^3+8x(2x+3)^3$$
$$\frac{d^2x}{dy} = 6(2x+3)^2+8(2x+3)^3+3\cdot24x(2x+3)^2$$

A: You can split the task this way into tackable subtasks:
First apply the product rule for
$$
y(x)=\underbrace{x}_{f(x)} \underbrace{(2x+3)^4}_{g(x)}
$$
and then the chain rule for $g(x) = u(v(x))$ with $u(x) = x^4$ and $v(x) = 2x + 3$.


text:
Q: Does Sharepoint 2010 search webpart support danish character? I am using search webpart (SP 2010). This webpart displayes title and other information. My title contains some danish character, but when I enter Ø or Å  i get ? .

A: Verify your browser encoding settings are set correctly, e.g., Auto-Select in IE seems to work fine with my Finnish characters, like ÅÄÖ.


text:
Q: axios cannot get only response of base64 but can get the others data First, I sent an image path from react to Django by using the axios of POST method.
Next, I edited the image in Django, and returned edited images that were converted into base64 to react.
like this.
/* this is view.py in Django */
class SquareCognitionSet(viewsets.ViewSet):
    @action(methods=['POST'],  detail=False, name='Edit image')
    def show(self, request):
        input = request.data['input']
        edited_image = edit.main(input) // my user-defined function. return base64 after edit image.
        data = {"message": "Got base64", "base": edited_image, "type": imghdr.what(input)}
        return Response(data=data)

No problem so far.
Promlem is from here.
I cannot get only base64 data of response that was sent from Django.
However, axios could get response from Django. I confirmed console.log()
/*this is react*/

useEffect(()=>{
    async function check(ImagePath: string) {
      window.electronAPI.server_on(); // electron starts server to work axios
      await axios.post("http://127.0.0.1:8000/ImageEdit/edit/", {
        input: ImagePath // input value of image path
      })
      .then((response)=>{
        console.log("success: ", response); // <-- here, I confirmed response
})

this is result of console.log().

Then I run
console.log("base64: ", response.data.base);

However, nothing is shown. Even the text of "base64: " is disappear.
What I tried.

*

*I tried whether I can take out the others value sent from Django.
I added value {"message": "Got base64"} in response of Django.
Then, I take out value like

console.log("message: ", response.data.message);
console.log("status: ", response.status);

They are successfuly shown. So, This may be problem of base64.

*

*I confirmed capacity in POST method
I checked the length of base64 in Django. This was 34789440.
So, I made string value that has length of 40000000: t = "A"410**7
Then, I added this into response in Django, and I could receive it successfully in react.

*convert to JSON before being sent from Django
I added the following code into view.py in Django.
        ...

        data = {"message": "Got base64", "base": edited_image, "type": imghdr.what(input)}
        params = json.dumps(data)
        return Response(data=data)

The result was almost same the above my problem. console.log("success: ", response); showed

However, all response data became undefined. Even response.status became undefined.

*

*check type of data
base64 was 'str'.

Why couldn't I take out only base64???
I googled it including how to use axios, Django post method and so on.
But I don't know how to fix it.
Thanks in advance.


text:
Q: How to autoload PayPal classes with Phalcon autoloader? Phalcon autoloader is configured in the following way:
$loader = new Phalcon\Loader;
$loader->registerDirs(array(
    '../app/4/controllers/',
    '../app/models/',
    '../app/services',
    '../app/forms/',
    '../app/vendor/'
))->register();

The directory tree is:
app
├───services
│   ├─── PayPalService.php   -   important
└───vendor
    └───PayPal
        ├───Api
        │   └───Amount.php
        │   └───and all other files
        ├───Auth
        ├───Common
        ├───Converter
        ├───Core
        ├───Exception
        ├───Handler
        ├───Rest
        ├───Security
        ├───Transport
        └───Validation

At the beginning of PalPalService.php there is:
use PayPal\Api\Amount;
use PayPal\Api\Details;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\RedirectUrls;
use PayPal\Api\Transaction;
use PayPal\Rest\ApiContext;

Phalcon autoloader apparently can't find these classes so I get error Undefined class constant 'PayPal'. For other classes that don't use namespaces this autoloader works. What is wrong? How to use PayPal SDK without Composer? I think Phalcon's autoloader should deal with it.
I also tried:
$loader->registerNamespaces(
    array(
        "PayPal" => "../app/vendor/PayPal/"
    )
);

It still doesn't find PayPal classes. I don't want to list each PayPal directory because according to docs Phalcon's autoloader should change namespace separator into directory separator.

A: "../app/vendor/PayPal/" should be "../app/vendor/"
$loader->registerNamespaces(
    array(
        "PayPal" => "../app/vendor/"
    )
);


text:
Q: Is this a correct way to do a low voltage cutoff for motorcycle use? (Zener diode + relay) I want to design an electrical component that I would connect to my motorcycle battery. As I do not want it to fully discharge my battery and I want it to run only when my motorcycle alternator is "ON", I want to implement an automatic cutoff when the voltage is below 14V.
In order to do it I use a transistor, a 14V Zener diode and a relay.
Is this a good way to do it? Will the circuit will be completely "off" when the voltage is below 14V (no drain on the battery?)

A: You want to cut off power to a USB charger when the voltage from your battery/regulator falls below 14V.

Is this a good way to do it?

Your design will, in fact cut off power to Vcc when the input voltage falls below a certain level. However:

*

*the Zener diode should have a 13.3 or 13.4V Zener voltage if you want it to trip at 14V. Your circuit actually trips at the Zener voltage plus approximately 0.6-0.7V.

*your circuit may "oscillate" when the voltage is near 14V. The circuit has no hysteresis. If near 14V and the voltage sags, the relay will open. This might allow the voltage to rise just enough to turn the relay back on. Which might cause the voltage to sag etc.

*When your battery / regulator voltage falls below 14V, your USB charger (Vcc) will be completely disconnected. However, a small current will still flow through your circuit. Although the current is small, if the motorcycle is unused for an extended period of time, this current could drain the battery.
The G5LE-1-DC12 relay requires 33.3mA to operate, and has a coil resistance of 360\$\Omega\$
The SS8050 is able to draw 1.5A current, which is quite sufficient for the relay, and has less than 1 uA of leakage current when off. It has a current gain between 40 and 300.
I am unable to find a specification for the forward "off" current of a 2EZ14 Zener diode. This is unfortunate, because whatever current leaks through the Zener diode, and is not diverted by R5 will cause a leakage through Q1 between 40 and 300 times greater.
Decreasing the value of R5, may help to decrease current into Q1 when the "line" voltage is below 14V. However, it will (obviously) increase the the leakage through D2 and R5. I believe the sweet spot occurs when the two leakage currents (through Q1 and R5) are equal, (but I haven't checked that).

A: Yes, it will work.
In the vicinity of the threshold, the NPN may be partially on and therefore dissipate excessive power. At 14 V, this could be approximately (14/2)^2/360 = 0.14 W which is probably OK.
You can add some hysteresis by connecting an R (~ 1 Mohm) from the relay VCC output to the junction of the resistors.

A: Another option is the quadlock waterproof 12v to USB adaptor. It has a LVCO built in.


text:
Q: strategies to fix runtime errors I was wondering what strategies you guys are using to fix runtime errors? Really appreciate if you could share some tips!
Here is some of my thought (possibly with the help of gdb):
when runtime error happens because some memory is wrongly accessed, is the address stored in the dumped core showing where the memory is?
If I can find the address/memory whose being accessed causes the runtime error, is it possible to find out which variable is using that address (which may be at the begining or middle of the memory of the variable)? And find out the nearby variables that takes the memory down below and right above that memory block?
If all these are possible, will it help to fix the bugs?
Thanks and regards!

A: I use gdb's --args option to start my programs from the command-line.
Example:
gdb --args foocode --with-super-awesome-option
run

This will load the program foocode and pass the --with-super-awesome-option parameter to it.  When the program fails, you'll have a ready-to-use gdb session to work within.
From there you can use the backtrace command:
bt

This will show you the chain of events (function calls) that lead to your crash.


text:
Q: How to validate a web adress in ruby Most of solution use URI.regexp. However, it requires to put a protocol prefix to be valid.
I want to make sure that both these are valid:

*

*http://www.foo.bar

*www.foo.bar

And URI.regexp won't match www.foo.bar
Any recommendations how to do this?


text:
Q: cannot connect to sqlserver 2008 express on windows 2008 server r2 windows 2008 server r2
installed sql server 2008 express sp1. also installed sql server management studio. how ever am not able to connect to sql server thru the management studio. error message show below :-

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)

A: This stumped me for a while. One thing that's not in the other lists mentioned is the following :
In 'Sql Server Configuration Manager':

*

*Expand the 'SQL Server Network Configuration' node

*right-click no the 'TCP/IP' entry (this should be enabled as per the other links)
(the following was the step I was missing)

*select the 'IP Addresses' tab. You'll have multiple IPs here even if you only have a single NIC.

*Scroll to the bottom and locate the 'IPAll' entry

*Enter '1433' in the TCP Port

*Apply to save your changes and restart the SQL Server service.

In my case, I was now able to connect. Hopefully this'll help someone else.

A: Is the server browser running? have you enabled named pipes? You find both these settings in SQL Server Configuration Manager. Remember to restart SQL Server service after doing changes.

A: If you are trying to connect remotely make sure that you have followed the steps in Enable Remote Connection on SQL Server 2008 Express.

A: Changing '1433' in the TCP Port worked for me

A: If it's SQL Express then don't forget that the instance name is SQLEXPRESS.
Therefore when connecting you want to put [SERVERNAME]\SQLEXPRESS in the "Server name" field.
If you just put the Server name it wont be able to connect to the SQL Express instance.

A: *

*Ensure TCP/IP is enabled in SQL Server Configuration. (And remember to restart the service if you change anything.)

*Ensure that the selected port is added to the Firewall, inbound for your network profile.

*If the assigned TCP port isn't 1433, then you need to specify a different port when connecting. (In SSMS use Host\SQLExpress,Port.


text:
Q: Do I have to use bodyParser in nodejs? I was using bodyParser.json() as a middleware with express and I recently replaced it by this code :
//gets any json object and put them in req.body
app.use((req, res, next) => {
    let lang = req.acceptsLanguages()[0];
    const decoder = new StringDecoder('UTF-8');
    req.on('data', function(data) {
        try {
            req.body = JSON.parse(decoder.write(data));
            next()
        } catch (ex) {

            res.status(400).send(translator(lang, 'entry.error.input.malformed'));
        }
    });
});

Do I have to use bodyParser and add the library to my project ? or my custom code is enough to parse and inject raw data as Json object in req??

A: Your custom middleware doesn't quite seem right, i would use
app.use((req, res, next) => {
  let lang = req.acceptsLanguages()[0];
  let data = '';
  req.on('data', chunk => data += chunk);
  req.on('end', () => {
    try {
        req.body = JSON.parse(data);
        next()
    } catch (ex) {
      res.status(400).send(translator(lang, 'entry.error.input.malformed'));
    }
  });
});

And yes this is enough, if you expect, all the requests coming into the server to be of JSON type. bodyparser basically does the same, except that, it handles a lot other cases


text:
Q: Why can't Ubuntu recognize my parititions? I am trying to install Ubuntu 13.10 as a dual-boot with Windows 8.1 on a Toshiba Satellite p55-A5200.
I downloaded it and installed the boot-helper, because my startup showed no menus. It then showed a choice between Windows 8.1 and Ubuntu on startup, so I chose to try out Ubuntu then install.
In trying to install Ubuntu, it cannot find any other OS even though I have turned off safe boot in Windows. The computer recognizes that the partitions are there, but Ubuntu does not. The same happened with 12.04.

A: The screen shot you posted shows it recognizes the partitions just fine; what it seems to have trouble with is the filesystem in the 4th partition.  There seems to be something wrong with it, so run chkdsk /f on it from Windows.  Also make sure you have disabled the "fast boot" option in Windows, which hibernates the computer instead of shutting down, and that prevents safely accessing the partition from another OS.
parted's resize command only works on fat and hfs.

A: Like @psusi said,Ubuntu fails to recognize the partition.This is because your Windows OS isn't shutdown properly.You can check it with running the below commands on terminal,
sudo mkdir /media/os
sudo mount /dev/sda4 /media/os

The output of the above command will be like,
The NTFS partition is hibernated. Please resume and shutdown Windows properly.

For this you have to follow the below steps,

*

*Shutdown the Ubuntu OS and then remove the Ubuntu live disk.

*Boot into Windows and make a Restart(not shutdown).

*Now it automatically boot into Windows.Now Shutdown your Windows PC.(Between these operations,don't try to view the files in C or D like drives).

*In the shudown state,insert your Ubuntu installation disk and then boot from it.Now your Ubuntu installer will recognize that partition.And you can make changes on it.


text:
Q: Call JS class on button click and append content to the DOM I created a form, where users are suppose to enter a name and when they click the button, the button will call a function which creates new object based on the class User and the function call the render method. This method will append the new user data to the DOM. When I console.log everything looks fine but when I try to append to the DOM, the new div appears and disappears immediately. This is my code:

  <form>
    <input type="text" name="fName" id="name" placeholder="fName">
    <input type="text" name="email" id="email" placeholder="email">
    <button>submit</button>
  </form>

function submitForm() {
    const name = document.getElementById('name').value;
    const email = document.getElementById('email').value;
    const user = new User(name,email);
    user.render();
}

class User {
    constructor(name, email){
        this.name = name;
        this.email = email;
    }

    render(){
        const renderHookId = document.getElementById('users');

        const newUser = document.createElement('div');
        newUser.innerHTML = `
${this.name}

${this.email}
`;

        renderHookId.append(newUser);
        console.log(this.name, this.email);
    }
}

const btn = document.querySelector('button');
btn.addEventListener('click', submitForm);

Any suggestions why doesn't it append to the DOM?

A: You're actually quite close to working code! All you need to do is make sure you cancel the default event when submitting to prevent posting the data and refreshing the page. See below.

function submitForm(e) {
    e.preventDefault();
    const name = document.getElementById('name').value;
    const email = document.getElementById('email').value;
    const user = new User(name,email);
    user.render();
}

class User {
    constructor(name, email){
        this.name = name;
        this.email = email;
    }

    render(){
        const renderHookId = document.getElementById('users');

        const newUser = document.createElement('div');
        newUser.innerHTML = `
${this.name}

${this.email}
`;

        renderHookId.append(newUser);
        console.log(this.name, this.email);
    }
}

const btn = document.querySelector('button');
btn.addEventListener('click', submitForm);

<form>
  <input type="text" name="fName" id="name" placeholder="fName">
  <input type="text" name="email" id="email" placeholder="email">
  <button>submit</button>
</form>


text:
Q: Telling Jest to not mock /moment(-timezone)?/ not working Getting an error with jest where anytime moment/moment.tz() is called, TypeError: (0 , _moment2.default)(...).tz is not a function is thrown. Below is my jest config with absolute paths redacted.
{
  "configs": [
    {
      "automock": false,
      "browser": false,
      "cache": true,
      "cacheDirectory": "<absolute path>",
      "clearMocks": true,
      "coveragePathIgnorePatterns": [
        "/node_modules/"
      ],
      "globals": {
        "window": true
      },
      "haste": {
        "providesModuleNodeModules": []
      },
      "moduleDirectories": [
        "node_modules",
        "src"
      ],
      "moduleFileExtensions": [
        "js",
        "vue"
      ],
      "moduleNameMapper": [
        [
          "^@/(.*)$",
          "/<absolute path>/src/$1"
        ],
        [
          "\\.(css|less)$",
          "/<absolute path>/test/__mocks__/styleMock.js"
        ]
      ],
      "modulePathIgnorePatterns": [],
      "name": "79986797be68f3008e950f2cefe0bbd1",
      "resetMocks": false,
      "resetModules": false,
      "rootDir": "<absolute path>",
      "roots": [
        "<absolute path>/src",
        "<absolute path>/test"
      ],
      "runner": "jest-runner",
      "setupFiles": [],
      "snapshotSerializers": [
        "/<absolute path>/node_modules/jest-serializer-html/index.js"
      ],
      "testEnvironment": "jest-environment-jsdom",
      "testMatch": [
        "**/__tests__/**/*.js?(x)",
        "**/?(*.)(spec|test).js?(x)"
      ],
      "testPathIgnorePatterns": [
        "node_modules/",
        "test/e2e/"
      ],
      "testRegex": "",
      "testRunner": "/<absolute path>/node_modules/jest-jasmine2/build/index.js",
      "testURL": "about:blank",
      "timers": "real",
      "transform": [
        [
          ".*\\.(vue)$",
          "/<absolute path>/node_modules/vue-jest/vue-jest.js"
        ],
        [
          ".*\\.js$",
          "/opt/cm/cm_frontend/cm/node_modules/babel-jest/build/index.js"
        ]
      ],
      "transformIgnorePatterns": [
        "/node_modules/"
      ],
      "unmockedModulePathPatterns": [
        "moment",
        "moment-timezone"
      ],
      "watchPathIgnorePatterns": []
    }
  ],
  "globalConfig": {
    "bail": false,
    "changedFilesWithAncestor": false,
    "collectCoverage": true,
    "collectCoverageFrom": [
      "src/components/**/*.{js,vue}",
      "src/mixins/**/*.js",
    ],
    "coverageDirectory": "<ABSOLUTE PATH>",
    "coverageReporters": [
      "json",
      "text",
      "lcov",
      "clover"
    ],
    "expand": false,
    "listTests": false,
    "mapCoverage": true,
    "maxWorkers": 7,
    "noStackTrace": false,
    "nonFlagArgs": [],
    "notify": false,
    "rootDir": "<ROOT PATH HERE>",
    "runTestsByPath": false,
    "testFailureExitCode": 1,
    "testPathPattern": "",
    "testResultsProcessor": null,
    "updateSnapshot": "new",
    "useStderr": false,
    "verbose": false,
    "watch": false,
    "watchman": true
  },
  "version": "21.2.1"
}

I've tried telling jest to jest.dontMock() as well as jest.unmock() but to no avail.
I've also tried require.requireActual().
I want to only mock moment when I specify per test (per file) with jest.mock().
What could be causing these issues? I am not mocking or unmocking moment anywhere in my test files. I've just simply used @vue/test-utils to mock entire computed properties using moment to get around this issue in the meantime.

A: You could try importing them directly in the tests. Also, I checked issues and other questions and it seems that importing timezone doesn't actually add the tz function to moment, so a way to solve it could be:
import moment from "moment-timezone"


text:
Q: Xamarin Android: Will SyncAdapter ever expired during calling In iOS, the background fetch has a limit of some period of time during the call of the background fetch. But in android, will the SyncAdapter have the time limit from executing, or will the syncing continue until it's finished.

A: By default it is 30 minutes.

Syncs can be cancelled at any time by the framework. For example a sync that was not user-initiated and lasts longer than 30 minutes will be considered timed-out and cancelled.

SyncAdapters run on a background thread and in executing your OnPerformSync it is up to you to provide any sync transfer limits (time and/or data size).
That said, the OS can call Interrupted on the thread so you need to monitor the thread's Interrupted property or override the OnSyncCanceled methods (both if you are dealing with multiple accounts) to handle the OS's request. Thus you then need to clean up your network connections, preserve your sync state, etc... and return from your OnPerformSync override otherwise the OS can (and will) kill your process.


text:
Q: JPA query validation failed exception Code:
@Modifying
@Transactional
@Query("update PermissionsEntity p set p.enableAutoReport = :enableAutoReport from PermissionsEntity p where p.id = :id")
void updateEnableAutoReport(@Param("id")Long permissionId, @Param("enableAutoReport") Boolean enableAutoReport);

Stack trace:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionsDAO': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract void com.salesfloor.platform.agent.mysql.dao.PermissionsDAO.updateEnableAutoReport(java.lang.Long,java.lang.Boolean)!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1021)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:964)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:862)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:481)
    ... 28 more
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract void com.salesfloor.platform.agent.mysql.dao.PermissionsDAO.updateEnableAutoReport(java.lang.Long,java.lang.Boolean)!
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:84)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:54)
    at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:65)
    at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:48)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:115)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:166)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:69)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:357)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:192)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
    ... 38 more
Caused by: java.lang.IllegalArgumentException: node to traverse cannot be null!
    at org.hibernate.hql.internal.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:64)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:300)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:126)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:88)
    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
    at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:342)
    at com.sun.proxy.$Proxy64.createQuery(Unknown Source)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:78)
    ... 51 more

Other update statements with the exact same syntax work well.
I've no idea why JPQL is giving me attitude on this.
I've tried changing the args to primitive long and boolean (thought it might be null allowance related) - same exception.
Thanks for your help.

A: There is mistake in the query
@Query("update PermissionsEntity p set
    p.enableAutoReport = :enableAutoReport from
    PermissionsEntity p where p.id = :id")

Should be
@Query("update PermissionsEntity p set
    p.enableAutoReport = :enableAutoReport
    where p.id = :id")

Without from PermissionsEntity p


text:
Q: Redirect to Windows Surface App specific Page on URL click I am working on Windows 8 Store Application, where I am implementing Forgot Password flow. An Email is generated and sent to user email address(Yahoo, Gmail etc). When the user clicks on an authentication URL in that email, I need to open reset password page of my application.
How can I do open reset password page on URL Click?

A: You can use protocol activation. You have to pass some arguments via your link with your custom protocol. According to argument you just have to open/navigate to reset password page. Here is the sample from MSDN.
Protocol activation has one limit. The custom protocol can't be hyperlinked. So user have to manually copy the URL and pass into file explorer. Hyperlink only works if it is in Windows store app. So you can send hyperlink in email and if user open email in default Mail app then protocol activation will work but if user checks mail in browser then it won't work, user has to manually open URI.
Ex:
Click <a href="myprotocol://forgot-password-page">here </a>to reset the password.


text:
Q: Expression Definition in Azure I want to copy data from SharePoint using Synapse's Copy Activity HTTP link service.
I want to put an expression using a function in the formula (1) at the URL of the source data set, but it is not working as expected.
Please let me know how I can fix this.
(1)https://sharepoint.com/teams/Data/Share/Planning/_api/web/GetFileByServerRelativeUrl('/teams/Data/Share/Planning/Shared%20Documents/05_master/502_outlet_list/2022/2022_monthly_master/outlet_info_20221101_Outlet List _.xlsx')/$value
Here is the statement that results in an error
(2)@concat('https://sharepoint.com/teams/Data/Share/Planning/_api/web/GetFileByServerRelativeUrl('/teams/Data/Share/Planning/_api/web/GetFileByServerRelativeUrl('/teams/Data/Share/Planning/Shared%20Documents/05_master/502_outlet_list/',formatDateTime(addHours(utcNow(),9),'yyyy'),'/',formatDateTime(addHours(utcNow(),9),'yyyy'),'_monthly_master/outlet_info_',formatDateTime(addHours(utcNow(),9),'yyyyMMdd'),'_Outlet List _.xlsx')/$value')

A: *

*The error is because of the ambiguous usage of single quotes inside concat function. Instead, you can use string interpolation @{...}.

*You can replace your dynamic content with the below dynamic content which makes use of string interpolation. I have used this in a set variable activity for demonstration.
https://sharepoint.com/teams/Data/Share/Planning/_api/web/GetFileByServerRelativeUrl('/teams/Data/Share/Planning/Shared%20Documents/05_master/502_outlet_list/@{formatDateTime(addHours(utcNow(),9),'yyyy')}/@{formatDateTime(addHours(utcNow(),9),'yyyy')}_monthly_master/outlet_info_@{formatDateTime(addHours(utcNow(),9),'yyyyMMdd')}_Outlet List _.xlsx')/$value

*

*This would give the result as shown below:

*

*You can modify the formatDateTime() function as per your requirement where you can use 2022-11-01 instead of utcNow().


text:
Q: How specifically does one detect that a user is idle on Windows 7? Given that Outlook runs in most offices, and given that a screensaver may user CPU, or network file copies, or virus scans, or network installs by the admin (granted, that usually happens when you're logged out), and all the myriad other things that might occur on a Windows 7 desktop in an office environment, how could I possibly know that a user is idled out, and not just reading a PDF?
Do I use a set of metrics to sample at regular intervals and use that to determine "away" or do I need to monitor some file, is there a API that should be exposed?
I can't rely on screensavers being active, or the computer entering a specific power state, and I'm not sure what is exactly off-limits, but I also don't know what's on-limits, as it were.

A: I think you're looking for GetLastInputInfo, which tells you how long it's been since the user hit a key on the keyboard or wiggled the mouse (or touched a touch-enabled screen?).


text:
Q: Subdomains + Integration Tests in Continuous Integration I'm trying to use Codeship Continuous Integration, which runs all of my selenium/integration tests.
My Rails app has some special subdomain logic in the routes.rb file, which I have included an example of below.
The problem is I can't edit the /etc/hosts file in the CI environment, so when my Rspec suti runs and tries to access a subdomain using my UrlHelper module the server cannot be reached.  For example, it tries to contact subdomain.localhost:3000
Any idea on how to handle reaching these subdomain-specific URLs in CI?
Code from the gist:
domain_constraint.rb
class DomainConstraint
  def initialize(domain)
    @domains = [domain].flatten
  end

  def matches?(request)
    request.subdomain.present? ? domain_to_match = request.subdomain + "." + request.domain : domain_to_match = request.domain
    @domains.include? domain_to_match
  end
end

integration_spec.rb
require 'spec_helper'

describe "Something", js: true do
  it "is a fake spec" do
    # this won't work in CI/test environments
    # 'another.localhost:3001' is not mapped in /etc/hosts
    visit foo_path(subdomain: 'another')
  end
end

routes.rb
MyApp::Application.routes.draw do
  constraints DomainConstraint.new(['subdomain.domain.com', 'another.domain.com']) do
    resources :foo
  end
end

url_helper.rb
module UrlHelper
  def with_subdomain(subdomain)
    subdomain = (subdomain || "")
    subdomain += "." unless subdomain.empty?
    [subdomain, request.domain].join
  end

  # allow link_to :subdomain => ""
  def url_for(options = nil)
    if options.kind_of?(Hash) && options.has_key?(:subdomain)
      options[:host] = with_subdomain(options.delete(:subdomain))
    end
    super
  end
end

A: I solved this by using xip.io, which essentially accomplishes the same thing as editing your /etc/hosts file with custom DNS.
http://www.chrisaitchison.com/2013/03/17/testing-subdomains-in-rails/


text:
Q: wordpress settings API and option array structure how do you get the settings API to save options that are in an array structure like this:
$array = array (
                array(
             'id'=> '1',
             'name'=> 'tom',
             'pageurl'=> 'someurl',
             'notes'=> 'someNotes'
              )
                array(
                 'id'=>'2',
                 'name'=>'harry',
                 'pageurl'=>'someotherurl',
                 'notes'=>'anothernote'
                  )
          );

This array gets data sets added to and deleted from it by the user.  The wp_list_table class I am using had its option set up the same way and I need to be able to edit those values later without having to delete the whole data set of the array I need to change and then recreating it.
I have tried presscoders example and ozh sample options solutions with no success. I am trying to update the name field in the array of arrays.  Only reason I am using this array structure is because of the wp list table.
About to pull my hair out trying to get this to work.
Here is what I have tried:
add_action('admin_init', 'ozh_sampleoptions_init' );
add_action('admin_menu', 'ozh_sampleoptions_add_page');

// Init plugin options to white list our options
function ozh_sampleoptions_init(){
    register_setting( 'ozh_sampleoptions_options', 'fp_options', 'ozh_sampleoptions_validate' );
}

// Add menu page
function ozh_sampleoptions_add_page() {
    add_options_page('Ozh\'s Sample Options', 'Sample Options', 'manage_options', 'ozh_sampleoptions', 'ozh_sampleoptions_do_page');
}

// Draw the menu page itself
function ozh_sampleoptions_do_page() {
    ?>

Ozh's Sample Options

        <form method="post" action="options.php">
            <?php settings_fields('ozh_sampleoptions_options'); ?>
            <?php $options = get_option('fp_options'); ?>

Tab Name
                    <input type="text" name="ozh_sample[name]" size="75" value="<?php echo $options[0]['name']; ?>" />

            <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />

        </form>

    <?php
}

// Sanitize and validate input. Accepts an array, return a sanitized array.
function ozh_sampleoptions_validate($input) {

    // Say our option must be safe text with no HTML tags
    $input[0]['name'] =  wp_filter_nohtml_kses($input['name']);

    return $input;
}

A: The Settings API generally expects data in the key => value form. I'm sure it is possible to save array data using the Settings API, but it somewhat circumvents the purpose of the API.
If I'm understanding your question correctly, you're trying to take a Plugin Option, and use the value of that option to update the wp_list_table class. The most straightforward approach might be to save some unique key as the Plugin option, and then cross-reference that unique key against a separate array-of-arrays to use to extend wp_list_table.
In other words, build your wp_list_table values array, perhaps like so:
<?php
function plugin_slug_get_wp_list_table_data() {
    $data = array(
        'a' = array(
            'id'=> '1',
            'name'=> 'tom',
            'pageurl'=> 'someurl',
            'notes'=> 'someNotes'
        ),
        'b' = array(
            'id'=> '1',
            'name'=> 'tom',
            'pageurl'=> 'someurl',
            'notes'=> 'someNotes'
        ),
        'c' = array(
            'id'=> '1',
            'name'=> 'tom',
            'pageurl'=> 'someurl',
            'notes'=> 'someNotes'
        ),
        'd' = array(
            'id'=> '1',
            'name'=> 'tom',
            'pageurl'=> 'someurl',
            'notes'=> 'someNotes'
        ),
    );
    return $data;
}
?>

Then, save your Plugin option as 'a', 'b', 'c', or 'd'.
Then, get your option:
<?php
$plugin_slug_options = get_option( 'plugin_slug_options' );
$plugin_slug_wp_list_table_setting = $plugin_slug_options['wp_list_table_setting'];
?>

Then, use the option setting to get the data with which to update wp_list_table:
<?php
$plugin_slug_wp_list_table_array = plugin_slug_get_wp_list_table_data();
$plugin_slug_wp_list_table_data = $plugin_slug_wp_list_table_array[$plugin_slug_wp_list_table_setting];
?>

(How you actually perform the wp_list_table update is up to you...)


text:
Q: git pull request always showing behind commits issue I am using gitlab. My query is regarding Pull Requests. I created a "feature" branch. At end, we create a pull request to some "dev" branch. Now the problem is: there will be 'n' number of pull requests going on for the same 'dev' branch. So, now if anyone merged some other person merge request into 'dev' branch, then again I have to take latest pull, fix conflicts and then have to again commit and push, so that my latest gets added into my pull request.
This seems to be bit blocker, especially if developer who take leave for couple of days and his merge request will never gonna gets merged as his pull request always shows as "you commit behind some number of commits".
Another problem is: The one who has been assigned to merge that pull request, cannot do it as he depends on a developer until he merge again with latest commit.
So, any solution for this? or is this everyone doing the same thing as mentioned above?
In short: am facing this issue: gitlab Request to merge branch-A into develop (3 commits behind) should I worry?

A: In general, it's fine to merge a branch if it's a few commits behind.  This is very common on any project of reasonable size, and the merge is generally going to be identical to when it's rebased and then merged.  Git is designed to handle this case simply and robustly.
It is possible that some projects require all branches to be up to date before merging, but if your project doesn't require this, then there's no reason to worry.  The reason this output exists is to give you an idea of how much the branches have diverged.  If they've diverged greatly, then a rebase could be warranted because you're more likely to have a logical conflict that isn't a textual conflict.  But if it's just a few commits, I wouldn't stress out.
It won't be possible to merge if there are conflicts.  In such a case, typically you ask the original submitter to rebase because they wrote the code and are going to be most familiar with fixing the conflicts.  Once that's done, you can merge.


text:
Q: Python, Kivy - QRScanner and ScreenManager I want to create an app with 2 (an more) screens (screen manager).
When i make app without that QR reader, i know how to move values from one screen to another. But here i have problem with that.
I spend 3 days on this problem and still dont have answer. Can You help me?
Heres code:
https://github.com/fornakter/Terminarz-Kivy-MD/blob/master/main.py
Errors are on class SecoundWindow, on line 16.
Comments explained errors wit i recive.
Thank You.

A: The documentation says connect_camera() must be called after on_start(). So change the definition of SecoundWindow to simply:
class SecoundWindow(Screen):
    pass

And in your ReadQR App, add the following methods:
def on_start(self):
    Clock.schedule_once(self.connect_camera)

def connect_camera(self, dt):
    secoundWindow = self.root.get_screen('secound')
    secoundWindow.ids.preview.connect_camera(camera_id='front', enable_analyze_pixels=True, default_zoom=0.0)

I needed to add camera_id to avoid SEGFAULT.
Unrelated, but the following lines of your code do nothing and can be deleted:
sm = ScreenManager()
sm.add_widget(FirstWindow(name='first'))
sm.add_widget(SecoundWindow(name='secound'))


text:
Q: Swift [weak self] in Task and do/catch block Task { /*[weak self] in*/
    do {
        let cacheSize = try await cacheService.calculateImageCacheSize()
        self.doTheJob(cacheSize)
    } catch {
        self.handleError(error)
    }
}

Taking into account this article where should I usually write [weak self] and should I?
UPD: Removed form code weak self from do and catch.


text:
Q: Bash script: always show menu after loop execution I'm using a bash script menu like this:
#!/bin/bash
PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option3" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1")
            echo "you chose choice 1"
            ;;
        "Option 2")
            echo "you chose choice 2"
            ;;
        "Option 3")
            echo "you chose choice 3"
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
done

After each menu selection I just get prompted with
Please enter your choice:

How do I always show the menu after each option has finished execution? I've done some looking around and I think I can do some kind of while loop, but I haven't been able to get anything working.

A: just modified your script like below. its working for me !
 #!/bin/bash
 while true
 do
 PS3='Please enter your choice: '
 options=("Option 1" "Option 2" "Option 3" "Quit")
 select opt in "${options[@]}"
 do
     case $opt in
         "Option 1")
             echo "you chose choice 1"
             break
             ;;
         "Option 2")
             echo "you chose choice 2"
             break
             ;;
         "Option 3")
             echo "you chose choice 3"
             break
             ;;
         "Quit")
             echo "Thank You..."
             exit
             ;;
         *) echo invalid option;;
     esac
 done
 done

A: Make it beautiful and userfriendly ;-)
#!/bin/bash

while :
do
    clear
    cat<<EOF
    ==============================
    Menusystem experiment
    ------------------------------
    Please enter your choice:

    Option (1)
    Option (2)
    Option (3)
           (Q)uit
    ------------------------------
EOF
    read -n1 -s
    case "$REPLY" in
    "1")  echo "you chose choice 1" ;;
    "2")  echo "you chose choice 2" ;;
    "3")  echo "you chose choice 3" ;;
    "Q")  exit                      ;;
    "q")  echo "case sensitive!!"   ;;
     * )  echo "invalid option"     ;;
    esac
    sleep 1
done

Replace the echos in this example with function calls or calls to other scripts.

A: You can also do something like:
#!/bin/bash

PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option 3" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1")
            echo "you chose choice 1"
            ;;
        "Option 2")
            echo "you chose choice 2"
            ;;
        "Option 3")
            echo "you chose choice 3"
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
    counter=1
    SAVEIFS=$IFS
    IFS=$(echo -en "\n\b")   # we set another delimiter, see also: https://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
    for i in ${options[@]};
    do
        echo $counter')' $i
        let 'counter+=1'
    done
    IFS=$SAVEIFS
done

A: You can achieve this by set the REPLY variable to be empty after esac.
Example with your code:
#!/usr/bin/env bash

PS3="Please enter your choice: "
options=("Option 1" "Option 2" "Option3" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1")
            echo "you chose choice 1"
            ;;
        "Option 2")
            echo "you chose choice 2"
            ;;
        "Option 3")
            echo "you chose choice 3"
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option ;;
    esac
    REPLY=
done

Another example ( simpler version to understand ):
#!/usr/bin/env bash

select animal in dog duck cat bird quit ; do
    case $animal in
        dog)  echo "i'm a dog!" ;;
        duck) echo "i'm a duck!" ;;
        cat)  echo "i'm a cat!" ;;
        bird) echo "i'm a bird!" ;;
        quit) echo "bye" ; break ;;
        *)    echo "unknown animal, please try again..." ;;
    esac
    REPLY=
done

For an explanation, see the GNU bash documentation about conditional constructs - select


text:
Q: is there any way to use RAM and VRAM at the same time on Pytorch? When I use Keras , It loads the input dataset on RAM a
and loads networks on VRAM, so that I could train vary large network.
However I cannot find the way to do so with pytorch
and this makes me using so small memory I guess.
Is there any way to use both RAM on pytorch ?


text:
Q: What's the @ operator? In the C++ reference page here it has a table of operators, but I don't understand what the operator@ is. For example:
@a     (a).operator@ ( )   operator@ (a)   !std::cin calls std::cin.operator!()
However there's no such operator in the language. What does it mean?

A: @ is not a valid C++ operator and It is used here as a placeholder for actual operators.
In short, it can be replaced by any of the actual C++ operators and the statement should hold good for that particular operator.

A: The cppreference page as well as the C++ standard treat the @ character as a placeholder for real operators. It is not used to code.


text:
Q: Meteor Autoform/SimpleSchema - quickform (type="update") not working I have what I thought was a simple SimpleSchema with which I currently have two templates. One contains a quickform to insert a new document into the collection, the other is also a quickform which should update the document from the first template.
The insert form works fine, however when I try and load the update template, my console shows the following error and the submit button won't work. According to people who had similar problems, the error is normally caused by a recursive function, but I can't find one anywhere.
Exception from Tracker recompute function:
debug.js:41 RangeError: Maximum call stack size exceeded
    at Object (native)
    at isObject (http://localhost:3000/packages/aldeed_simple-schema.js?e210968641793751997ffe233af33b53af8566e4:1000:18)
    at isBasicObject (http://localhost:3000/packages/aldeed_simple-schema.js?e210968641793751997ffe233af33b53af8566e4:1024:10)
    at parseObj (http://localhost:3000/packages/aldeed_simple-schema.js?e210968641793751997ffe233af33b53af8566e4:1147:15)
    at http://localhost:3000/packages/aldeed_simple-schema.js?e210968641793751997ffe233af33b53af8566e4:1159:11
    at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:159:22)
    at parseObj (http://localhost:3000/packages/aldeed_simple-schema.js?e210968641793751997ffe233af33b53af8566e4:1155:9)
    at http://localhost:3000/packages/aldeed_simple-schema.js?e210968641793751997ffe233af33b53af8566e4:1159:11
    at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:159:22)
    at parseObj (http://localhost:3000/packages/aldeed_simple-schema.js?e210968641793751997ffe233af33b53af8566e4:1155:9)

Here are my two templates:
<template name="newWeddingPage1">

        {{> quickForm collection="Weddings" id="insertWeddingInfo1" omitFields="email, phone, name, price" type="insert"}}

        {{#each theweddingdetails}}

{{duration}}

        {{/each}}

</template>

<template name="newWeddingPage2">

        {{#each theweddingdetails}}
        {{> quickForm collection="Weddings" id="updateWeddingInfo1" doc="this" omitFields="email, phone, name, price" type="update"}}
        {{/each}}

</template>

and my simple schema here:
Weddings.attachSchema(new SimpleSchema({

  address: {
    type: String,
    label: "Address",
    optional: true
  },
  startDate: {
    type: Date,
    label: "Date of shooting",
    optional: false,
  },
  startTime: {
    type: String,
    optional: true,
    autoform: {
      afFieldInput: {
        type: "time"
      }
    }
  },
  duration: {
    type: Number,
    label: "Duration (in hours)",
    optional: true
  },
  price: {
    type: Number,
    label: "Price",
    optional: true,
    autoform: {
      type: "hidden",
      label: false
    },
    autoValue:function(){ return 0 }
  },
  email: {
    type: String,
    optional: true,
    autoform: {
      afFieldInput: {
        type: "email"
      }
    }
  },
  phone: {
    type: Number,
    optional: true,
    autoform: {
      afFieldInput: {
        type: "tel"
      }
    }
  },
  name: {
    type: String,
    label: "Contact Person",
    optional: true
  },
  createdBy: {
    type: String,
    autoform: {
      type: "hidden",
      label: false
    },
    autoValue:function(){ return this.userId }
},
createdAt: {
    type: Date,
    autoform: {
      type: "hidden",
      label: false
    },
    autoValue:function(){ return new Date(); }
}
}));

Anybody have a clue where I'm going wrong?
Have been playing around with bits for the last few hours now :/

A: In your update form, you have doc="this" , which means you are just passing a string "this" as your doc.
Try doc=this , without quotes.  That way, you'll be passing the context variable this as your doc.  I am assuming in your router or elsewhere you have passed the appropriate doc as your data context so that it will be available in this


text:
Q: Mysql query that multiplies values returns double I am trying to take unit sales by week from one table and multiply by pricing in another table and get the results by product.  I used this Stack Overflow post.  The results are exactly double what they should be.
The query looks like:
SELECT product, week, SUM(units * price) AS revenue
FROM weekly_sales
JOIN pricing ON
    weekly_sales.product = pricing.product
GROUP BY product, week;

I have tried a few things like using DISTINCT.  Originally was doing a second join to get catalog info, but removed that to be sure that wasn't the issue.  I also used WHERE week = current.week to see if I could get it to work for just one week, but same issue.  Thanks!
weekly_sales looks like:
product    | units    | week
B001       |     5    | 41
B001       |     2    | 42
B002       |     3    | 41
B002       |     8    | 42

pricing table looks like:
product | current_price | week
B001    |     6.99      | 41
B002    |     8.99      | 41

results look like:
product | week | revenue
B001    |  42  | 69.9
B001    |  41  | 27.96
B002    |  42  | 53.94

A: I think you should add one more condition in join as follows:
SELECT product, week, (units * price) AS revenue
FROM weekly_sales
JOIN pricing ON
    weekly_sales.product = pricing.product
and weekly_sales.week = pricing.week
GROUP BY 1, 2;

Click here for DEMO
Hope it helps!


text:
Q: cucumber and capybara, how to open external url or visit outside url i am using cucumber and capybara. in a rails 3.0.9 platform. i am getting this test case fail:
log is:
(::) failed steps (::)

No route matches "/wiki/Baltimore_Ravens" (ActionController::RoutingError)
<internal:prelude>:10:in `synchronize'
./features/step_definitions/web_steps.rb:20:in `/^(?:|I )am on (.+)$/'
features/annotate.feature:7:in `Given I am on a web page'

Failing Scenarios:
cucumber features/annotate.feature:11 # Scenario: launch annotation/ logged in

6 scenarios (1 failed, 5 skipped)
63 steps (1 failed, 62 skipped)

the file web_steps: got this piece of code:
19 Given /^(?:|I )am on (.+)$/ do |page_name|
20   visit path_to(page_name)
21 end

the file annotate.feature got this code:
7 Given I am on a web page

"a web page" is defined in support/paths.rb as:
when /a web page/
  'http://en.wikipedia.org/wiki/Baltimore_Ravens'

obviously this is an external url. i want to open it and capybara and cucumber wont allow me to do it. so, help me find a way to open outside url in cucumber test case!

A: Capybara uses RackTest as the default driver, and this driver doesn't allow to visit external urls (i.e. test remote applications).
If you want to visit external urls (to test, e.g, that your app redirects correctly), you have basically two options:
1/ Use another driver like e.g selenium:
before do
  Capybara.current_driver = :selenium
end

Then, in code, you can call the url like so:
visit 'http://en.wikipedia.org/wiki/Baltimore_Ravens'

Or, if you set the default app_host like so:
Capybara.app_host = 'http://en.wikipedia.org'
Capybara.run_server = false # don't start Rack

Then you can call the url:
visit '/wiki/Baltimore_Ravens'

You can configure the driver and app host in your spec_helper.rb to enable them globally across all you specs:
Capybara.configure do |config|
  config.current_driver = :selenium
  config.run_server = false
  config.app_host   = 'http://en.wikipedia.org'
end

2/ Use capybara-mechanize