text:
Q: Like charges repel each other while opposite charges attract, why "like" is used here instead of "same"? Could anyone explain the difference between those two words, and how to use one instead of another?

A: That's a really interesting question. I don't have an authoritative basis for it (I would have put this as a comment but ran out of space), but my suspicion is that it's because "same" would imply that the charges are identical in both polarity AND magnitude. Definition 1 of "Same" in the OED is:

Identical; not different

While it's true that in every day usage we play a little loose with that term (for example two people who are 30 years old are said to have the "same" age even if one is 11 months older than the other), physics tends to demand greater precision.
It is not of course necessary for the charges to be identical in magnitude for a repulsive force to apply between two charged materials. They need to be of "like" charge:

Having the same characteristics or qualities as; similar to

but not necessarily the "same" charge.
"Opposite" on the other hand merely implies that one surface has a negative charge and the other a positive charge, without any suggestion of magnitude.
It may well be that someone else can provide a more definitive reason, but this one strikes me as likely.


text:
Q: How to efficiently detect a tie early in m,n,k-game (generalized tic-tac-toe)? I'm implementing an m,n,k-game, a generalized version of tic-tac-toe, where m is the number of rows, n is the number of columns and k is the number of pieces that a player needs to put in a row to win. I have implemented a check for a win, but I haven't figured out a satisfactory way to check before the board is full of pieces, if no player can win the game. In other words, there might be empty slots on the board, but they cannot be filled in such a way that one player would win.
My question is, how to check this efficiently? The following algorithm is the best that I can think of. It checks for two conditions:
A. Go over all board positions in all 4 directions (top to bottom, right to left, and both diagonal directions). If say k = 5, and 4 (= k-1) consecutive empty slots are found, stop checking and report "no tie". This doesn't take into account for example the following situation:
OX----XO    (Example 1)

where a) there are 4 empty consecutive slots (-) somewhere between two X's, b) next it is O's turn, c) there are less than four other empty positions on the board and no player can win by putting pieces to those, and d) it is not possible to win in any other direction than horizontally in the shown slots either. Now we know that it is a tie because O will eventually block the last winning possibility, but erroneously it is not reported yet because there are four consecutive empty slots. That would be ok (but not great). Checking this condition gives a good speed-up at the beginning when the checking algorithm usually finds such a case early, but it gets slower as more pieces are put on the board.
B. If this k-1-consecutive-empty-slots-condition isn't met, the algorithm would check the slots again consecutively in all 4 directions. Suppose we are currently checking from left to right. If at some point an X is encountered and it was preceded by an O or - (empty slot) or a board border, then start counting the number of consecutive X's and empty slots, counting in this first encountered X. If one can count to 5, then one knows it is possible for X to win, and "no tie" is reported. If an O preceded by an X is encountered before 5 consecutive X's, then X cannot win in those 5 slots from left to right starting from where we started counting. For example:
X-XXO    (Example 2)
12345

Here we started checking at position 1, counted to 4, and encountered an O. In this case, one would continue from the encountered O in the same way, trying to find 5 consecutive O's or empty slots this time. In another case when counting X's or empty slots, an O preceded by one or more empty slots is encountered, before counting to 5. For example:
X-X-O    (Example 3)
12345

In this case we would again continue from the O at position 5, but add to the new counter (of consecutive O's or empty slots) the number of consecutive empty slots that preceded O, here 1, so that we wouldn't miss for example this possible winning position:
X-X-O---X    (Example 4)

In this way, in the worst case, one would have to go through all positions 4 times (4 directions, and of course diagonals whose length is less than k can be skipped), giving running time O(mn).
The best way I could think of was doing these two described checks, A and B, in one pass. If the checking algorithm gets through all positions in all directions without reporting "no tie", it reports a tie.
Knowing that you can check a win just by checking in the vicinity of the last piece that was added with running time O(k), I was wondering if there were quicker ways to do an early check for a tie. Doesn't have to be asymptotically quicker. I'm currently keeping the pieces in a two-dimensional array. Is there maybe a data structure that would allow an efficient check? One approach: what is the highest threshold of moves that one can wait the players to make before running any checks for a tie at all?
There are many related questions at Stack Overflow, for example this, but all discussions I could find either only pointed out the obvious tie condition, where the number of moves made is equal to the size of the board (or they checked if the board is full), or handled only the special case where the board is square: m = n. For example this answer claims to do the check for a tie in constant time, but only works when m = n = k. I'm interested in reporting the tie as early as possible and for general m,n and k. Also if the algorithm works for more than two players, that would be neat.

A: I would reduce the problem of determining a tie to the easier sub-problem:
Can player X still win?
If the answer is 'no' for all players, it is a tie.
To find out whether Player X can win:

*

*fill all blank spaces with virtual 'X'-pieces

*are there k 'X'-pieces in a row anywhere?

*

*if there are not --> Player X cannot win. return false.

*if there are, find the row of k stones with the least amount of virtual pieces. Count the number of virtual pieces in it.

*count the number of moves player X has left, alternating with all other players, until the board is completely full.

*if the number of moves is less than the amount of virtual pieces required to win, player X cannot win. return false.

*otherwise, player X can still win. return true.

(This algorithm will report a possible win for player X even in cases where the only winning moves for X would have another player win first, but that is ok, since that would not be a tie either)
If, as you said, you can check a win just by checking in the vicinity of the last piece that was added with running time O(k), then I think you can run the above algorithm in O(k * Number_of_empty_spots): Add all virtual X-Piece, note any winning combinations in the vicinity of the added pieces.
The number of empty slots can be large, but as long as there is at least one empty row of size k and player X has still k moves left until the board is filled, you can be sure that player X can still win, so you do not need to run the full check.
This should work with any number of players.

A: Actually the constant time solution you referenced only works when k = m = n as well. If k is smaller then I don't see any way to adapt the solution to get constant time, basically because there are multiple locations on each row/column/diagonal where a winning consecutive k 0's or 1's may occur.
However, maintaining auxiliary information for each row/column/diagonal can give a speed up. For each row/column/diagonal, you can store the start and end locations for consecutive occurrences of 1's and blanks as possible winning positions for player 1, and similarly store start and end locations of consecutive occurrences of 0's and blanks as possible winning positions for player 0.  Note that for a given row/column/diagonal, intervals for player 0 and 1 may overlap if they contain blanks. For each row/column/diagonal, store the intervals for player 1 in sorted order in a self-balancing binary tree (Note you can do this because the intervals are disjoint). Similarly store the intervals for player 0 sorted in a tree. When a player makes a move, find the row/column/diagonals that contain the move location and update the intervals containing the move in the appropriate row column and diagonal trees for the player that did not make the move. For the player that did not make a move, this will split an interval (if it exists) into smaller intervals that you can replace the old interval with and then rebalance the tree. If an interval ever gets to length less than k you can delete it. If a tree ever becomes empty then it is impossible for that player to win in that row/column/diagonal. You can maintain a counter of how many rows/columns/diagonals are impossible to win for each player, and if the counter ever reaches the total number of rows/columns/diagonals for both players then you know you have a tie. The total running time for this is O(log(n/k) + log(m/k)) to check for a tie per move, with O(mn/k) extra space.
You can similarly maintain trees that store consecutive intervals of 1's (without spaces) and update the trees in O(log n + log m) time when a move is made, basically searching for the positions before and after the move in your tree and updating the interval(s) found and merging two intervals if two intervals (before and after) are found. Then you report a win if an interval is ever created/updated and obtains length greater than or equal to k. Similarly for player 0. Total time to check for a win is O(log n + log m) which may be better than O(k) depending on how large k is. Extra space is O(mn).

A: If space isn't an issue, I had this idea:
For each player maintain a structure sized (2mn + (1 - k)(m + n) + 2(m - k + 1)(n - k + 1) + 2(sum 1 to (m - k))) where each value represents if one of another player's moves are in one distinct k-sized interval. For example for a 8-8-4 game, one element in the structure could represent row 1, cell 0 to 3; another row 1, cell 1 to 4; etc.
In addition, one variable per player will represent how many elements in their structure are still unset. Only one move is required to set an element, showing that that k-interval can no longer be used to win.
An update of between O(k) and O(4k) time per player seems needed per move. A tie is detected when the number of players exceeds the number of different elements unset.
Using bitsets, the number of bytes needed for each player's structure would be the structure size divided by 8. Notice that when k=m=n, the structure size is 4*k and update time O(4). Less than half a megabyte per player would be needed for a 1000,1000,5 game.
Below is a JavaScript example.
var m = 1000, n = 1000, k = 5, numberOfPlayers = 2

  , numberOfHorizontalKIs = m * Math.max(n - k + 1,0)
  , numberOfverticalKIs = n * Math.max(m - k + 1,0)
  , horizontalVerticalKIArraySize = Math.ceil((numberOfHorizontalKIs + numberOfverticalKIs)/31)
  , horizontalAndVerticalKIs = Array(horizontalVerticalKIArraySize)
  , numberOfUnsetKIs = horizontalAndVerticalKIs
  , upToM = Math.max(0,m - k) // southwest diagonals up to position m
  , upToMSum = upToM * (upToM + 1) / 2
  , numberOfSouthwestKIs = 2 * upToMSum //sum is multiplied by 2 to account for bottom-right-corner diagonals
                         + Math.max(0,n - m + 1) * (m - k + 1)
  , diagonalKIArraySize = Math.ceil(2 * numberOfSouthwestKIs/31)
  , diagonalKIs = Array(diagonalKIArraySize)
  , numberOfUnsetKIs = 2 * numberOfSouthwestKIs + numberOfHorizontalKIs + numberOfverticalKIs

function checkTie(move){
    var row = move[0], column = move[1]

    //horizontal and vertical
    for (var rotate=0; rotate<2; rotate++){
        var offset = Math.max(k - n + column, 0)

        column -= offset

        var index = rotate * numberOfHorizontalKIs + (n - k + 1) * row + column
          , count = 0
        while (column >= 0 && count < k - offset){
            var KIArrayIndex = Math.floor(index / 31)
              , bitToSet = 1 << index % 31

            if (!(horizontalAndVerticalKIs[KIArrayIndex] & bitToSet)){
                horizontalAndVerticalKIs[KIArrayIndex] |= bitToSet
                numberOfUnsetKIs--
            }
            index--
            column--
            count++
        }

        //rotate board to log vertical KIs
        var mTmp = m
        m = n
        n = mTmp
        row = move[1]
        column = move[0]
        count = 0
    }

    //rotate board back
    mTmp = m
    m = n
    n = mTmp

    // diagonals
    for (var rotate=0; rotate<2; rotate++){
        var diagonalTopColumn = column + row

        if (diagonalTopColumn < k - 1 || diagonalTopColumn >= n + m - k){
           continue
        } else {
            var offset = Math.max(k - m + row, 0)

            row -= offset
            column += offset

            var dBeforeM = Math.min (diagonalTopColumn - k + 1,m - k)
              , dAfterM = n + m - k - diagonalTopColumn
              , index = dBeforeM * (dBeforeM + 1) / 2
                      + (m - k + 1) * Math.max (Math.min(diagonalTopColumn,n) - m + 1,0)
                      + (diagonalTopColumn < n ? 0 : upToMSum - dAfterM * (dAfterM + 1) / 2)
                      + (diagonalTopColumn < n ? row : n - 1 - column)
                      + rotate * numberOfSouthwestKIs
              , count = 0

            while (row >= 0 && column < n && count < k - offset){
                var KIArrayIndex = Math.floor(index / 31)
                  , bitToSet = 1 << index % 31

                if (!(diagonalKIs[KIArrayIndex] & bitToSet)){
                    diagonalKIs[KIArrayIndex] |= bitToSet
                    numberOfUnsetKIs--
                }
                index--
                row--
                column++
                count++
            }
        }
        //mirror board
        column = n - 1 - column
    }

    if (numberOfUnsetKIs < 1){
        return "This player cannot win."
    } else {
        return "No tie."
    }
}

A: Let's look at one row (or column or diagonal, it doesn't matter) and count the number of winning lines of length k ("k-line") it's possible to make, at each place in the row, for player X. This solution will keep track of that number over the course of the game, checking fulfillment of the winning condition on each move as well as detecting a tie.
1 2 3... k k k k... 3 2 1
There is one k-line including an X in the leftmost slot, two with the second slot from the left, and so on. If an opposing player, O or otherwise, plays in this row, we can reduce the k-line possibility counts for player X in O(k) time at the time of the move. (The logic for this step should be straightforward after doing an example, needing no other data structure, but any method involving checking each of the k rows of k from will do. Going left to right, only k operations on the counts is needed.) An enemy piece should set the possibility count to -1.
Then, a detectably tied game is one where no cell has a non-zero k-line possibility count for any player. It's easy to check this by keeping track of the index of the first non-zero cell. Maintaining the structure amounts to O(k*players) work on each move. The number of empty slots is less than those filled, for positions that might be tied, so the other answers are good for checking a position in isolation. However, at least for reasonably small numbers of players, this problem is intimately linked with checking the winning condition in the first place, which at minimum you must do, O(k), on every move. Depending on your game engine there may be a better structure that is rich enough to find good moves as well as detect ties. But the possibility counting structure has the nice property that you can check for a win whilst updating it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Pasting without format on terminal I'm developing a rsa cipher program and I'm having issues when trying to paste the ciphered cryptogram string into the decoding program input. It is not a matter of implementation (the program works fine) but of pasting format into the python terminal. For example:
I get the following cryptogram after executing the rsa cipher:
=ª'Jß°:Ó¼6¾Ó—ƒõVò£ÄͫجD€µ7BãG!QçæÙ"™íñNóOræIÇ

j~
~Ej.{³«Ã2Ó#G    ‰—)¶¦9pÙ¸‰Ÿ9IÈÎEX4~Í~:ËçDxý"ª]!æ%9áèÑ×ô
ýŽ

To my surprise, the same happens when pasting inside this SO post form. Those line breaks are not supposed to appear, therefore I guess it could be that some special chars are being interpreted.   What I want is to one-line only string, as it follows (do not pay a attention to the substring "Mesnage cifrado" this is only program a user oriented indication, what it is worth is what follows that substring):

Note: I've already tried with ' ' string delimiters

A: Not sure if I got it right, but if you want python to take what you literally typed and not to interpret it, maybe you could give raw strings a shot if you haven't already.
This is the default string:
s = 'Hi\nHello'
print(s)

Output:
Hi
Hello

This is what you get with raw strings (you just need to put an r before the '):
raw_s = r'\n=ª'Jß°:Ó¼6¾Ó—ƒõVò£ÄͫجD€µ7BãG!QçæÙ"™\níñNóOræIÇj~~Ej.{³«Ã2Ó#G‰)¶\n¦9pÙ¸‰Ÿ9IÈÎEX4~Í~:ËçDxý"ª]\n!æ%9áèÑ×ôýŽ'
print(raw_s)

Output:
\n=ª'Jß°:Ó¼6¾Ó—ƒõVò£ÄͫجD€µ7BãG!QçæÙ"™\níñNóOræIÇj~~Ej.{³«Ã2Ó#G‰)¶\n¦9pÙ¸‰Ÿ9IÈÎEX4~Í~:ËçDxý"ª]\n!æ%9áèÑ×ôýŽ

(ps: Just added some \n's in your original string for the sake of demonstrating that raw strings will not interpret them as line breaks)


text:
Q: update table based on concatenated column value I have a table with only 4 columns
First column - The concatenated column values for each row from another table.The columns are concatenated based on column id from the metadata table.The order of concatenation is the same order of column ids.
Second column -I have the comma separated primary key columns.
Now, based on the primary keys in the second column, I need to update the 3rd column which will retrieve the values for the primary key from each of the first concatenated field.
4 column _ it has the table name.
I am using cursor and string functions and it works perfectly fine but when I tested it fir huge millions of data , it failed and the performance is very  poor.
Could anyone give please me a single update query for the same
There is a comparison tool which compares the data between 2 tables in different database but with same data structure and it dumps the mismatch rows into a table with all the columns concatenated(pipe seperaed).The columns are in the same order as that of column id and I know the primary keys for that table(concatenated but pipe seperated). So, based on this data I need to extract the primary key values for which there is a data mismatch.
I need to do something like
Update column4(primary key values pipe seperated extracted from column2)

A: Check this LINK, maybe will be useful. With that query you could concatenate a value with a character you need (this works for 11g2 version, for earlier versions use xmlagg
, xmlelement, extract method).
CREATE TABLE TEST(
  FIELD INT);

INSERT INTO TEST VALUES(1);
INSERT INTO TEST VALUES(2);
INSERT INTO TEST VALUES(3);
INSERT INTO TEST VALUES(4);

SELECT listagg(FIELD,',' ) WITHIN GROUP (ORDER BY FIELD)
FROM TEST

Returns '1,2,3,4'


text:
Q: Child Div not respecting Overflow hidden In Safari On below Fiddle, There is a pagination, when you will hover the pagination a circle will animate up but, In safari the image inside that circle is not respecting overflow hidden, In other browsers its working fine..
In any solution, Image needs to be centered vertically...
Fiddle:-
http://jsfiddle.net/w5uhet4x/
html

Prev

1

2

3

4

5

6

7

8

Next

Css
.article_slide2 {
    font: 25px/20px impact, Arial, Helvetica, sans-serif;
    color: #0065bd;
    display: inline-block;
    margin-top: 20px;
}
.article_pagination2 {
    width: 680px;
    display: inline-block;
    box-sizing: border-box;
    margin: 10px 0;
    position: relative;
}
.article_pagination2:after {
    content: "";
    width: 94%;
    height: 2px;
    background: #0065bd;
    float: left;
    position: absolute;
    left: 22px;
    top: 17px;
    z-index: 0;
}
.article_pagination2 ul {
    float: none;
    margin: 0 auto;
    text-align: center;
    width: 590px;
    font-size: 0px;
}
.article_pagination2 li {
    position: relative;
    cursor: pointer;
    z-index: 2;
    margin: 0 4px;
    display: inline-block;
}
.article_pagination2 li .pg_number2 {
    width: 33px;
    line-height: 33px;
    text-align: center;
    font-size: 14px;
    height: 33px;
    float: left; /*display:table-cell; */
    vertical-align: middle;
    color: #fff;
    border-radius: 50%;
    background: #0065bd;
    border: 2px solid #0065bd;
    position: relative;
    z-index: 2;
    transition-duration: 0.2s;
    -webkit-transition-duration: 0.2s;
    font-family: arial !important;
}
.article_pagination2 li .pg_number2:hover, .article_pagination2 li .pg_number2.active {
    background: #FFFFFF;
    transform: scale(1.15);
    -ms-transform: scale(1.15);
    -webkit-transform: scale(1.15);
    z-index: 2;
    color: #0065BD;
    border: 2px solid #0065BD;
    font-weight: bold;
    font-size: 18px;
}
.article_pagination2 li:hover .article_image2 {
    visibility: visible;
    opacity: 1;
    top: -85px;
    top: -82px\9;
}
.article_pagination2 li .article_image2 {
    border-radius: 50%;
    width: 70px;
    height: 70px;
    border: 2px solid #0065bd;
    display: inline-block;
    position: absolute;
    top: -40px;
    left: -19px;
    transition: all .5s ease;
    -webkit-transition: all .5s ease;
    visibility: hidden;
    opacity: 0;
    z-index: 1;
    margin: 0;
}
.article_pagination2 li .image_inner {
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: block;
    overflow: hidden;
    background: #fff;
    position: relative;
}
.article_pagination2 li .article_image2 img {
    bottom: 0;
    left: 0;
    margin: auto;
    position: absolute;
    right: 0;
    text-align: center;
    top: 0;
}
.article_pagination2 li .article_image2:after {
    content: "";
    width: 0;
    height: 0;
    border-right: 7px solid transparent;
    border-left: 7px solid transparent;
    border-top: 7px solid #0065bd;
    font-size: 0;
    line-height: 0;
    float: right;
    position: absolute;
    bottom: -8px;
    left: 50%;
    z-index: 9;
    margin-left: -6px;
}
.article_pagination2 .back_arrow2 a, .article_pagination2 .next_arrow2 a {
    display: block;
    color: #333;
    font-family: Arial, Helvetica, sans-serif;
    width: 34px;
    height: 46px;
    border-radius: 50%;
}
.article_pagination2 .back_arrow2 {
    background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2.png) no-repeat #fff;
    width: 34px;
    height: 34px;
    float: left;
    overflow: visible;
    background-size: 100%;
    margin-right: 5px;
    position: absolute;
    z-index: 2;
    left: 0;
    top: 0;
}
.article_pagination2 .back_arrow2.arrow-disable {
    background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .next_arrow2 {
    background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2.png) no-repeat #fff;
    width: 34px;
    height: 34px;
    float: right;
    overflow: visible;
    margin-left: 5px;
    background-size: 100%;
    position: absolute;
    z-index: 2;
    right: 0;
    top: 0;
}
.article_pagination2 .next_arrow2.arrow-disable {
    background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .arrow-disable a {
    cursor: default;
}
.article_pagination2 .next_arrow2 strong, .article_pagination2 .back_arrow2 strong {
    position: absolute;
    bottom: -15px;
    font-size: 12px;
    left: 3px
}
.article_pagination2 .arrow-disable strong {
    color: #aeaeae;
}
.slideContainer.slide-row {
    height: 62px;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

A: This appears to be a Safari bug, it doesn't seem to like position: relative; on .article_pagination2 li .image_inner and position: absolute; on .article_pagination2 li .article_image2 img. If you remove position from these two selectors the issue disappears. This means that the centering of the img needs to be handled in a different way (as absolute positioning cannot be used), so I have added an extra pseudo element with display: inline-block;, height: 100%; and vertical-align: middle; to allow the img to be vertically aligned to the center of .article_image2.

*

*Remove position: relative; from .article_pagination2 li .image_inner

*Add .article_pagination2 li .image_inner:after with styles to allow for the image to vertically align

*Remove all styles relating to absolute positioning from .article_pagination2 li .article_image2 img

*Add vertical-align: middle; to .article_pagination2 li .article_image2 img

.slideContainer {
  margin-top: 100px;
}
.article_slide2 {
  font: 25px/20px impact, Arial, Helvetica, sans-serif;
  color: #0065bd;
  display: inline-block;
  margin-top: 20px;
}
.article_pagination2 {
  width: 680px;
  display: inline-block;
  box-sizing: border-box;
  margin: 10px 0;
  position: relative;
}
.article_pagination2:after {
  content: "";
  width: 94%;
  height: 2px;
  background: #0065bd;
  float: left;
  position: absolute;
  left: 22px;
  top: 17px;
  z-index: 0;
}
.article_pagination2 ul {
  float: none;
  margin: 0 auto;
  text-align: center;
  width: 590px;
  font-size: 0px;
}
.article_pagination2 li {
  position: relative;
  cursor: pointer;
  z-index: 2;
  margin: 0 4px;
  display: inline-block;
}
.article_pagination2 li .pg_number2 {
  width: 33px;
  line-height: 33px;
  text-align: center;
  font-size: 14px;
  height: 33px;
  float: left;
  /*display:table-cell; */
  vertical-align: middle;
  color: #fff;
  border-radius: 50%;
  background: #0065bd;
  border: 2px solid #0065bd;
  position: relative;
  z-index: 2;
  transition-duration: 0.2s;
  -webkit-transition-duration: 0.2s;
  font-family: arial !important;
}
.article_pagination2 li .pg_number2:hover,
.article_pagination2 li .pg_number2.active {
  background: #FFFFFF;
  transform: scale(1.15);
  -ms-transform: scale(1.15);
  -webkit-transform: scale(1.15);
  z-index: 2;
  color: #0065BD;
  border: 2px solid #0065BD;
  font-weight: bold;
  font-size: 18px;
}
.article_pagination2 li:hover .article_image2 {
  visibility: visible;
  opacity: 1;
  top: -85px;
  top: -82px\9;
}
.article_pagination2 li .article_image2 {
  border-radius: 50%;
  width: 70px;
  height: 70px;
  border: 2px solid #0065bd;
  display: inline-block;
  position: absolute;
  top: -40px;
  left: -19px;
  transition: all .5s ease;
  -webkit-transition: all .5s ease;
  visibility: hidden;
  opacity: 0;
  z-index: 1;
  margin: 0;
}
.article_pagination2 li .image_inner {
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: block;
  overflow: hidden;
  background: #fff;
  /*position: relative; Remove*/
}
/*Add*/
.article_pagination2 li .image_inner:after {
  content: "";
  display: inline-block;
  height: 100%;
  vertical-align: middle;
  width: 0;
}
.article_pagination2 li .article_image2 img {
  /*bottom: 0; Remove*/
  /*left: 0; Remove*/
  /*margin: auto; Remove*/
  /*position: absolute; Remove*/
  /*right: 0; Remove*/
  text-align: center;
  vertical-align: middle; /*Add*/
  /*top: 0; Remove*/
}
.article_pagination2 li .article_image2:after {
  content: "";
  width: 0;
  height: 0;
  border-right: 7px solid transparent;
  border-left: 7px solid transparent;
  border-top: 7px solid #0065bd;
  font-size: 0;
  line-height: 0;
  float: right;
  position: absolute;
  bottom: -8px;
  left: 50%;
  z-index: 9;
  margin-left: -6px;
}
.article_pagination2 .back_arrow2 a,
.article_pagination2 .next_arrow2 a {
  display: block;
  color: #333;
  font-family: Arial, Helvetica, sans-serif;
  width: 34px;
  height: 46px;
  border-radius: 50%;
}
.article_pagination2 .back_arrow2 {
  background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2.png) no-repeat #fff;
  width: 34px;
  height: 34px;
  float: left;
  overflow: visible;
  background-size: 100%;
  margin-right: 5px;
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
}
.article_pagination2 .back_arrow2.arrow-disable {
  background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_back_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .next_arrow2 {
  background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2.png) no-repeat #fff;
  width: 34px;
  height: 34px;
  float: right;
  overflow: visible;
  margin-left: 5px;
  background-size: 100%;
  position: absolute;
  z-index: 2;
  right: 0;
  top: 0;
}
.article_pagination2 .next_arrow2.arrow-disable {
  background: url(http://i9.dainikbhaskar.com/dainikbhaskar2010/images/pagination/ie_next_page_aro_2_disable.png) no-repeat #fff;
}
.article_pagination2 .arrow-disable a {
  cursor: default;
}
.article_pagination2 .next_arrow2 strong,
.article_pagination2 .back_arrow2 strong {
  position: absolute;
  bottom: -15px;
  font-size: 12px;
  left: 3px
}
.article_pagination2 .arrow-disable strong {
  color: #aeaeae;
}
.slideContainer.slide-row {
  height: 62px;
  padding-bottom: 5px;
  margin-bottom: 5px;
}

Prev

1

2

3

4

5

6

7

8

Next

JS Fiddle: http://jsfiddle.net/2j795bvm/


text:
Q: intellij unresolved symbol for go lang project I am using go sdk 1.2.1 linux/386 in intellij 14.0.3. However, when I open a golang project many function and variable are unresolved. I do not what is wrong with intellij. Anything that I can do to make the unresolved symbol solved. I have met the problems before. but I do not know to to solve it. Anyone have met the same problem before? Please help.
Thanks.

A: As I have no information about which plugin version you are using I'm going to assume that you have 0.9.15.3 release.
The fastest way to fix it would be to use one of the early releases for 1.0.0, available here: github releases page for go plugin for intellij idea
The plugin is currently under a major refactoring and we've started releasing preview builds for it. While the alpha name might be scary, I'm using it daily at work and it's very stable but not everything is up on par with the quality we want it to have.
If you have any further questions, either ask here or browse in the issue tracker
Also, there's a small community on Gitter and you may get answers from there as well.


text:
Q: How to convert EMG data of type 'list' to vector or data frame when unlist and as.data.frame don't work?
I have a really long list of EMG data that I need to convert to a vector or data frame before using the biosignal EMG package in R. It doesn't work with lists. The EMG data is .csv and is in the form shown in the picture.
I tried using the as.data.frame function, but it still gave me a list.
I also tried unlisting it, but it gave me an integer instead.
There are 2 columns and 647 rows.
I need to plot the data in the 2nd column and starting from row 8 till row 647.
How do I do this?
Below is the code I used:
library(biosignalEMG) # ReadCSV
MyEMGdata151517 <- read.csv(file="C:\\Users\\zyous\\OneDrive\\Desktop\\AsciiTraceDump_190211_151517.csv", header=TRUE, sep=",")
MyEMGdata151543<-read.csv(file="C:\\Users\\zyous\\OneDrive\\Desktop\\AsciiTraceDump_190211_151743.csv", header=TRUE, sep=",")
Rectified_EMG_151517<-rectification(MyEMGdata151517,rtype = "fullwave")
M<-as.data.frame.array(MyEMGdata151543) is.data.frame(M) #Rectifying 151517
Rectified_EMG_151517 <- rectification(MyEMGdata151517, rtype = "fullwave")
Rectified_plot_151517<-plot(MyEMGdata151517, main = "Rectified EMG")

When I try to rectify, I get this error: Error in rectification(MyEMGdata151517, rtype = "fullwave") : an object of class 'emg' is required.
 And that error I think is because my file is not a vector. But how do i convert it when unlist wont work I wanna see peaks like the kind you would get in excel doing this.

A: It appears that you are not converting the variable created with read.csv() into an emg object. The documentation gives the following example:
x <- rnorm(10000, 0, 1)
emg1 <- emg(x, samplingrate=1000, units="mV", data.name="")
summary(emg1)
EMG Object
    Total number of samples: 10000
    Number of channels: 1
    Duration (seconds):  10
    Samplingrate (Hertz):  1000
    Channel information:
    Units:  mV
plot(emg1, main="Simulated EMG")

Which yields:

Based on the attached image in your question I think you should do something similar with emg2 <- emg(MyEMGdata151517$X8, samplingrate=1000, units="mV", data.name="")


text:
Q: Removing empty space of ExtJS cycle-button possible? The cycle button has some empty space in front of the text they show, probably because the menu items can have icons, is it possible to remove it?

A: Either display:none the "x-btn-icon" for the control, or use the "iconAlign" property inside of your config to move the icon div to the right of the control label.

A: Apply css to solve the problem,
 {
white-space: normal;
}
Thanks


text:
Q: Xperf vs WPR differences in captured data What are the differences between these two tools?
They are part of the same package:
https://docs.microsoft.com/en-us/windows-hardware/test/wpt/
And they are using the same API I assume, but Microsoft does not state if they have differences and details on this.
Are they equal in the captured information?
Are there some preferences in use-case scenarios when one should be preferred?

A: According to https://docs.microsoft.com/en-us/windows-hardware/test/wpt/

The Windows Performance Toolkit consists of two independent tools: Windows Performance Recorder (WPR) and Windows Performance Analyzer (WPA). In addition, support is maintained for the previous command-line tool, Xperf. However, Xperfview is no longer supported. All recordings must be opened and analyzed by using WPA

It looks like GPUView still has scripts that use Xperf, so perhaps Xperf is retained as backwards compatibility for existing scripts. But WPR is the newer tool meant to replace "legacy Xperf"


text:
Q: Is it impossible to put two images side by side in Jupyter notebook markdown using HTML? I'm using Jupyter notebook, and I would like to show an image side-by-side using Markdown block. For an image,

shows me an image, but I'm wondering if there is any way to put pictures side-by-side using Markdown block.

Try
I've tried the following :

but this only shows the plots with one on top and the other on the bottom.
Is there any way to do this?

A: from IPython.display import HTML, display
display(HTML("

"))

How to include two pictures side by side in Markdown for IPython Notebook (Jupyter)?


text:
Q: Share text, image and a hyper link Url I want to share an image with some text and a url which would deep link into my application. My url that deep links should be hyperlinked for a text eg. "here".
Below is my code
final Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.putExtra("sms_body", "Hey! I just saw "+res.getData().getBar_name()+"is having "+res.getData().getEvent_name()+"through the App! We should check it out.");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Hey! I just saw "+res.getData().getBar_name()+"is having "+res.getData().getEvent_name()+"through the App! We should check it out."
                    + "\n" + getString(R.string.webview_base)+"site/redirectlink?event_id=" + eventid);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "");
shareIntent.setType("image/*");

Can anyone help me with this?


text:
Q: Imbalanced data in h2o I am running glm model in H2o with highly imbalanced binary response variable, my problem is that when setting the argument balance_classes True, it doesn't work and I get the same result as false. Thanks

A: Although the argument balance_classes is available in H2O GLM, the algorithm itself does not require special handling for imbalanced data. Not sure if it applies in general, but it seems it applies in H2O. You may refer to the FAQ section, How does the algorithm handle highly imbalanced data in a response column?, to verify it.


text:
Q: Fullscreen image Im developing on WP8... I want to render an image in fullscreen size... obviously i do not the size of the screen...
I try to explain another problem... I must resize the image (image are about 2000x1400px and the screen is about 800x4450px).. but i dont really want to resize the real dimension... i just want the dimension remain the same but i want to see the full image (no cutted)
Here the code i have written
System.Windows.Size dimensions = App.RootFrame.RenderSize;

WriteableBitmap wb = new WriteableBitmap((int)dimensions.Width,(int)dimensions.Height);
wb.LoadJpeg(myStreamPhoto);
wb.Invalidate();

ImgChosenPhoto.Source = wb;

I achieve the goal in this way... the image is not really resized but, however, i can see the full image on screen.. so what's the problem?
If I open the image directly from my app everything works! If i open the photo from the photo library and select my app i obtain an exception (same code is runned).. the exception is:
Value does not fall within the expected range.

A: I have solved in this way
System.Windows.Size dimensions = ResolutionHelper.ScreenResolution;

BitmapImage wb = new BitmapImage();
wb.SetSource(myStreamPhoto);

ImgChosenPhoto.Source = wb;

ImgChosenPhoto.Height = (int)dimensions.Height;
ImgChosenPhoto.Width = (int)dimensions.Width;


text:
Q: What is $I(\{(0,0)\})$? I have two (algebraic) sets:

*

*$X_1 = Z(x) \subseteq \mathbb{A}^2$, ie, $X_1 = \{(0,y):y \in \mathbb{K}\} \subseteq \mathbb{A}^2$

*$X_2 = Z(x+y^2) \subseteq \mathbb{A}^2$, ie, $X_2 = \{(-y^2,y):y \in \mathbb{K}\} \subseteq \mathbb{A}^2$.
We're assuming that $\mathbb{K}$ is algebraically closed (so we can use Hilbert's Nullstellensatz).

I want to prove that $I(X_1)+I(X_2) \neq I(X_1 \cap X_2)$.

My question is maybe stupid / too basic, but here I go:
Obviously, $X_1 \cap X_2 = \{(0,0)\}$.
Since $I(X_1)$ and $I(X_2)$ are radical ideals, $I(X_1) = <x>$ and $I(X_2) = <x+y^2>$.
Then, $I(X_1)+I(X_2) = <x>+<x+y^2>$.
So, $I(X_1)+I(X_2) = <x,y^2>$.
Therefore, we must show that $I(\{(0,0)\}) \neq <x,y^2>$.
But what is $I(\{(0,0)\})$?
It is $<x,x^2,\ldots,y,y^2,\ldots>$?

A: It is the vanishing ideal of the point $(0,0)$. This is precisely the ideal generated by $x$ and $y$, i.e. in your notation $\langle x, y \rangle$. Note that this is equal to the ideal $\langle x, x^2, \dots, y, y^2,\dots \rangle$ that you mention in your question. What this effectively says is that a polynomial vanishes on $(0,0)$ if and only if it does not have a constant term. It follows that $\langle x, y \rangle \neq \langle x,y^2 \rangle$.


text:
Q: Cannot import a Module from Models into admin.py which are in the same folder I am following a tutorial exactly step-by-step, and it is not working for me.
In a Django application, I am trying to import a Post class from the Models.py file, into the admin.py file.
Here is admin.py:
from django.contrib import admin
from .models import Post

# Register your models here.
admin.site.register (Post)

My directory structure is as follows:
my-project
   manage.py
   blog
      __init__.py
      admin.py
      models.py

I have tried to cd my Python terminal into various directories and nothing works. I also tried different syntaxes.
I keep getting each time:

ImportError: attempted relative import with no known parent package


text:
Q: Disabling column names in ps output How to format output of ps -p command?
To not show me something like this:
PID TTY                TIME CMD

but just PIDs.
I'm using Linux.

A: Use the -o option to select which columns are displayed. If you put = after the column name, the header line is suppressed.
ps -o pid= -p 1 23 456
ps -o pid= -o ppid= -o pgid= -o sid= -p 1 23 456

A: Use the --no-headers to have the header line omitted.
Original output:
ps
  PID TTY          TIME CMD
27027 pts/0    00:00:00 bash
27071 pts/0    00:00:00 ps

With --no-headers:
ps --no-headers
27027 pts/0    00:00:00 bash
27072 pts/0    00:00:00 ps

Combining with -p:
ps -p 1 --no-headers
    1 ?        00:00:33 systemd

The man page for ps clearly documents this:
man ps

[snip]

 --no-headers
          Print no header line at all.  --no-heading is an alias for this option.

A: Use
ps -p <PIDs> --no-headers

to get a list of PIDs without the header.

A: To get a list of only the PIDs use:
ps -eo pid

See also man ps section 'STANDARD FORMAT SPECIFIERS' for possible colums.
Personally I like the way Solaris shows the possible columns to use for the -o argument:
ps: option requires an argument -- o
usage: ps [ -aAdefHlcjLPyZ ] [ -o format ] [ -t termlist ]
        [ -u userlist ] [ -U userlist ] [ -G grouplist ]
        [ -p proclist ] [ -g pgrplist ] [ -s sidlist ] [ -z zonelist ] [-h lgrplist]
  'format' is one or more of:
        user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid ctid
        pri opri pcpu pmem vsz rss osz nice class time etime stime zone zoneid
        f s c lwp nlwp psr tty addr wchan fname comm args projid project pset lgrp


text:
Q: Maven Spring WebApp HTTP Status 404 Try to run student_list.jsp and after running a I got HTTP Status 404.
Here I send photo of my maven project which is set up in Netbeans and the codes. Please for check if everything is set up right. I am the beginner in Spring.
Thanks

Code:
student_list.jsp

<%@page import="java.util.List"%>
<%@page import="cz.webapp.student.entity.Student"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags"%>

List of Persons

Name
Age

<%
List<Student> studentList = (List)request.getAttribute("students");
for(Student student: studentList){
out.println("
");
out.println("" + student.getId() + "	");
out.println("" + student.getName() + "	");
out.println("" + student.getAge() + "	");
out.println("
");
}

%>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">

   <display-name>Spring MVC Application</display-name>

   <servlet>
      <servlet-name>StudentWebApp</servlet-name>
      <servlet-class>
         org.springframework.web.servlet.DispatcherServlet
      </servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>

   <servlet-mapping>
      <servlet-name>StudentWebApp</servlet-name>
      <url-pattern>/</url-pattern>
   </servlet-mapping>

</web-app>

StudentWebApp-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">

   <context:component-scan base-package="cz.webapp.student" />

   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="WEB-INF/jsp/" />
      <property name="suffix" value=".jsp" />
   </bean>

</beans>

StudentController

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.webapp.student.controllers;

import cz.webapp.student.entity.Student;
import cz.webapp.student.service.StudentService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import org.springframework.web.bind.annotation.RequestParam;

/**
 *
 * @author Jenda
 */

@Controller
public class StudentController {

    @Autowired
    StudentService studentServiceImpl;

@RequestMapping(value="/students", method=GET)
public String showAllStudent(Map<String, Object> model){
List<Student> studentList = studentServiceImpl.findAll();

model.put("students", studentList);

return "student_list";

}
}

A: I THINK I may have found a problem. In your servlet.xml file, your base package seems wrong. Try this:  <context:component-scan base-package="cz.webapp.student.*" />

Because I think Spring is looking for a package called cz.webapp.student when you have your package set to cz.webapp.student.controllers
There are a lot of causes for a 404 error and having a wrong base package is one of them, so I'm not exactly certain if this will fix it, but it's a good start.


text:
Q: Getting information for multiple queries across multiple .csv files I am currently trying to figure out a way to get information stored across multiple datasets as .csv files.
Context
For the purposes of this question, suppose I have 4 datasets: experiment_1.csv, experiment_2.csv, experiment_3.csv, and experiment_4.csv. In each dataset, there are 20,000+ rows with 80+ columns in each row. Each row represents an Animal, identified by a id number, and each column represents various experimental data  about that Animal. Assume each row's Animal ID number is unique for each dataset, but not across all datasets. For instance, ID#ABC123 can be found in experiment_1.csv, experiment_2.csv, but not experiment_3.csv and experiment_4.csv
Problem
Say a user wants to get info for ~100 Animals by looking up each Animal's ID # across all datasets. How would I go about doing this? I'm relatively new to programming, and I would like to improve. Here's what I have so far.
class Animal:
    def __init__(self, id_number, *other_parameters):
        self.animal_id = id_number
        self.animal_data = {}

    def store_info(self, csv_row, dataset):
        self.animal_data[dataset] = csv_row

# Main function
# ...
# Assume animal_queries = list of Animal Objects

# Iterate through each dataset csv file
for dataset in all_datasets:

    # Make a copy of the list of queries
    copy_animal_queries = animal_queries[:]

    with open(dataset, 'r', newline='') as dataset_file:
        reader = csv.DictReader(dataset_file, delimiter=',')

        # Iterate through each row in the csv file
        for row in reader:

            # Check if the list is not empty
            if animal_queries_copy:

                # Get the current row's animal id number
                row_animal_id = row['ANIMAL ID']

                # Check if the animal id number matches with a query for
                # every animal in the list
                for animal in animal_queries_copy[:]:

                    if animal.animal_id == row_animal_id:

                        # If a match is found, store the info, remove the
                        # query from the list, and exit iterating through
                        # each query

                        animal.store_info(row, dataset)
                        animal_list_copy.remove(animal)
                        break

            # If the list is empty, all queries were found for the current
            # dataset, so exit iterating through rows in reader
            else:
                break

Discussion
Is there a more obvious approach for this? Assume that I want to use .csv files for now, and I will consider converting these .csv files to an easier-to-use format like SQL Tables later down the line (I am an absolute beginner at databases and SQL, so I need to spend time learning this).
The one thing that sticks out to me is that I have to create multiple copies of animal_queries: 1 for each dataset, and 1 for each row in a dataset (in the for loop). Since 1 row only contains 1 ID, I can exit the loop early once I find a match to an ID from animal_queries. In addition, since that ID was already found, I no longer need to search for that ID for the rest of the current dataset, so I remove it from the list, but I need to keep the original copy of the queries since I also need it to search the remaining datasets. However, I can't remove an element from a list while inside a for loop, so I need to create another copy as well. This doesn't seem optimal to me and I'm wondering if I'm approaching this in the wrong direction. Any help would be appreciated, thanks!

A: Well, you could greatly speed this up by using the pandas library for one thing. Ignoring the class definition for now, you could do the following:
import pandas as pd
file_names = ['ex_1.csv', 'ex_2.csv']
animal_queries = ['foo', 'bar'] #input by user

#create list of data sets
data_sets = [pd.read_csv(_file) for _file in file_names]

#create store of retrieved data
retrieved_data = [d_s[d_s['ANIMAL ID'].isin(animal_queries)] for d_s in data_sets]

#concatenate the data
final_data = pd.concat(retrieved_data)

#export to csv
final_data.to_csv('your_data')

This simplifies things a lot. The isin method slices each data frame where ANIMAL ID is found in the list animal_queires. Incidentally pandas will also help you to cope with sql tables also so is probably a good route for you to go down.


text:
Q: how to show Update Progress control on top of all control i use bootstrap control .i set style of progress bar z-index : 100000;.
but not progress bar up all control .how can do it?
How can I force the Update Progress control to appear on top?
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" LoadScriptsBeforeUI="true" ScriptMode="Release" runat="server" />
    <asp:UpdateProgress ID="uppMain" runat="server">
        <ProgressTemplate>

        </ProgressTemplate>
    </asp:UpdateProgress>
 <asp:UpdatePanel runat="server" ID="UpdatePanel1">
        <ContentTemplate>
              .......
         </ContentTemplate>
  </asp:UpdatePanel>

A: It is difficult to answer looking at provided code only. You can easily check z-index of control using developer toolbar/firebug which are coming above the updateprogress and give z-index higher than that to the DIV
One thing you can try is , give z-index to first DIV in updateprogress control (the div with "position: absolute")


text:
Q: OctoberCMS form validation alert issue I have installed a fresh copy of OctoberCMS, added Users plugin, and created theme. Everything is fresh and no plugin modifications made. Now I created registration page and testing it. It appears that form validation works a bit funny. I leave all fields empty and click on submit button.
It throws alert box like this, which is a bit unexpected.

Then if i click submit button a second time form validation shows field errors - as it normally would be. I only wannt this kind of alerts without an popup box..

Anyone has idea why is this happening?

A: The javascript alert name field is required is thrown by the AJAX framework of OctoberCMS because you submitted a form which did not pass the Model's validation rules.
Check your User Model and you may notice that the name field is required.
public $rules = [ 'name' => 'required' ]; // no name was supplied

Here you have two options ;

*

*Validate form data before submission using JS
    $('button.submit').click(function(e){
        e.preventDefault(); // prevent submission

    // check Form fields are valid

      // then Submit form using the AJAX API - OnCreateUser

        $.request('onCreateUser', {
        data: {name : ..., surname: ....}, // Data Object
        error: function(jqXHR, textStatus, error){
            // handle errors..
          }
        });
    });

*Use Global AJAX handlers for ur site - the popup won't show up but you will need to handle these events and alert the user
    $window.on('ajaxErrorMessage', function(event, message){
        //   ....
        event.preventDefault();
    });
    $window.on('ajaxError', function(event, context, status,jqXHR ){
        //   ....
        event.preventDefault();
    });

Also it is recommended you use the validator class in your component and check the submitted data - You can also add custom validation rules / messages
  public function onCreateUser()
    {
        if (Request::ajax()) {

            $customMessages = [
             'name.required' => 'Name Field is required',
             'email.required' => 'Email field is required',
          ];

          $customAttributes = [
            'email' => 'Email',
            'name' => 'Name',
          ];

            $data = post();
            $rules['name']  = 'required';
            $rules['email'] = 'required';

            $validation = Validator::make($data, $rules,$customMessages, $customAttributes);
            if ($validation->fails()) {
                $messages = json_encode($validation->messages(), true);
                throw new ValidationException(array(
                    'title' => 'Error Creating User',
                    'message' => $messages
                ));
            }

           ..........

        }
    }


text:
Q: TranslateX xaml in wpf c# i have problem to get value TranslateX of grid
i can set the value in grid by composite transform
 CompositeTransform dd = new CompositeTransform();
     CompositeTransform dd = new CompositeTransform();

        dd.TranslateX = Convert.ToInt32(tabl.x);
        dd.TranslateY = Convert.ToInt32(tabl.y);
        dd.Rotation = Convert.ToInt32(tabl.r);

        grid.RenderTransform = dd;

but i can't take the value

A: You can always access the existing CompositeTransform by the Grid's RenderTransform property. Therefore you should set the CompositeTransform once, preferably in XAML:
<Grid x:Name="grid">
    <Grid.RenderTransform>
        <CompositeTransform/>
    </Grid.RenderTransform>
</Grid>

Now you may write code like this:
var transform = (CompositeTransform)grid.RenderTransform;

// set values
transform.TranslateX = tabl.x;
transform.TranslateY = tabl.y;
transform.Rotation = tabl.r;

// get values
var x = transform.TranslateX;
var y = transform.TranslateY;
var r transform.Rotation;

A: You can get the TranslateX Value of grid like this:
double translateX = (grid.RenderTransform as CompositeTransform).TranslateX;


text:
Q: Accessing parent column info in a sub query I am trying to write a sub query to have in a larger query, The subquery I am writting needs to get a.workorder_id from the main column
This one works ( Notice x.workorder_id = '805' )
SELECT a.* ,
( SELECT SUM( maxes ) qty
  FROM  (
     SELECT MAX( qty ) maxes
     FROM `rework_line` x
     WHERE x.workorder_id = '805'
     GROUP BY x.size
  ) as tba
) tmpsum
FROM rework_line a
WHERE a.workorder_id = '805'
GROUP BY a.workorder_id

Yet when I change x.workorder_id = a.workorder_id it no longer works and tells me
#1054 - Unknown column 'a.workorder_id' in 'where clause'
SELECT a.* ,
( SELECT SUM( maxes )
  qty FROM  (
     SELECT MAX( qty ) maxes
     FROM `mtborah_rework_line` x
     WHERE x.workorder_id = a.workorder_id
     GROUP BY x.size
  ) as tba
) tmpsum
FROM mtborah_rework_line a
WHERE a.workorder_id = '805'
GROUP BY a.workorder_id

I am sure it is something simple I forgot, but in all my googing I can not find out how to do it, I also tryed asking in the mysql room on freenode, and all they would say is to rewrite it as a join, which is not possible due to the query I am having it in If I re-join to this table it will through off my counts and sum's

A: Maybe I am missing something, but why don't you rewrite this using a subquery in a join instead of the correlated subquery:
SELECT a.*, qty
FROM mtborah_rework_line a
LEFT JOIN
(
  SELECT SUM(maxes) qty, workorder_id
  FROM
  (
    SELECT MAX( qty ) maxes, x.workorder_id
    FROM `mtborah_rework_line` x
    GROUP BY x.size, x.workorder_id
  ) m
  GROUP BY workorder_id
) q
  on a.workorder_id = q.workorder_id
WHERE a.workorder_id = '805';

Or even this way:
SELECT a.*, SUM(maxes) qty
FROM mtborah_rework_line a
LEFT JOIN
(
  SELECT MAX(qty) maxes, x.workorder_id
  FROM `mtborah_rework_line` x
  GROUP BY x.size, x.workorder_id
) q
  on a.workorder_id = q.workorder_id
WHERE a.workorder_id = '805'
GROUP BY a.workorder_id;


text:
Q: How to get the ID of div that I scroll to? I want to get the ID of every div that I scroll to and keep the ID in my state.
I have a list of some div elements. I expect to store in my state the current ID of the div that I scroll to.
My code
import React, { useEffect, useState } from "react";

export default function App() {
  const [currentId, setCurrentId] = useState(null);

  useEffect(() => {
    // some code here
  }, []);

  return (
    <>

div 1

div 2

div 3

div 4

div 5

    </>
  );
}

So when I scroll to the first div I want to store in currentId state div-1, to the second the div-2 and so on.

A: You can do something like so:
const [currentId, setCurrentId] = useState(null)
const [scrollPos, setScrollPos] = useState(0)

useEffect(() => {
    window.addEventListener('scroll', setScrollPos(window.pageYOffset))

    if(scrollPos <= 600) setCurrentId('div-1')
    else if(scrollPos > 600 && scrollPos <= 1200) setCurrentId('div-2')
    else if(scrollPos > 1200 && scrollPos <= 1800) setCurrentId('div-3')
    // and so ....

    return () => {
        window.removeEventListener('scroll', handleScroll)
    }
},[])


text:
Q: C# Convert Excel to CSV and Ignore Empty Cells Friends, C# noob here, so apologies in advance!
I have the following method which loops over my Excel workbook sheet as a data table converting it to CSV via the string builder output.
    public static string ToCSV(this DataTable table)
    {
        var result = new StringBuilder();
        for (int i = 0; i < table.Columns.Count; i++)
        {
            result.Append(table.Columns[i].ColumnName);
            result.Append(i == table.Columns.Count - 1 ? "\n" : ",");
        }

        foreach (DataRow row in table.Rows)
        {
            for (int i = 0; i < table.Columns.Count; i++)
            {
                result.Append(row[i].ToString());
                result.Append(i == table.Columns.Count - 1 ? "\n" : ",");
            }
        }
        return result.ToString();
    }

This works fine if the Excel file is clean. Like this:

However, if you add any sort of formatting or anything to the Excel file the C# method treats the cells as having content in and outputs them to the CSV file.
Like this:

I've tried doing this like this and checking the length of the row etc...
if (String.IsNullOrWhiteSpace(row[i].ToString()))
{
 continue;
}

... but it breaks the structure of the file.
Question;  what am I doing wrong?! I feel like I'm so close, but its just not behaving.
Thank you in advance for your assistance.

A: if (row[i] == DBNull.Value || String.IsNullOrWhiteSpace(row[i].ToString()))
{
    continue;
}

A: While creating datatable from excel file, you can check worksheet.FirstColumnUsed, worksheet.LastColumnUsed similarly for row as well. In this way you will get only rows and columns which are containing records.
If you are using ClosedXML to read Excel file, then I guess they provided UsedRange(),
FirstRowUsed, LastRowUsed properties.
For more details: ClosedXML GITHUB repository
If you are using interop api to read excel file then This answer could be helpful: Stackoverflow:Remove empty row and column


text:
Q: Having problems fetching XML data from nodes with same name in VBA I'm trying to read an XML file through VBA.
I have a node called SCL in which had multiple nodes called IED.
I need to extract the attributes from nodes called FCDA, which every IED has in the same path, /SCL/IED/AccessPoint/Server/LDevice/LN0/DataSet/FCDA, and merge them.
The problem is that when I try to run my code, it seems to only get the information on the first IED node and it copies in the others.
What could I be doing wrong?
My code:

Private Sub CommandButtonImport_Click()
    Dim fd As Office.FileDialog
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    With fd
            .Filters.Clear
            .Title = "Selecione um arquivo SCD"
            .Filters.Add "SCD File", "*.scd", 1
            .AllowMultiSelect = False

        If .Show = True Then
            xmlFileName = .SelectedItems(1)

            Dim xDoc As Object
            Dim CX As Integer
            Set xDoc = CreateObject("MSXML2.DOMDocument")
            xDoc.async = False: xDoc.validateOnParse = False
            xDoc.Load (xmlFileName)

            Set SCL = xDoc.SelectNodes("//SCL/IED")
                For n = 0 To SCL.Length - 1
                    C1 = SCL(n).Attributes.getNamedItem("name").Text
                    C2 = SCL(n).Attributes.getNamedItem("manufacturer").Text
                    C3 = SCL(n).Attributes.getNamedItem("type").Text
                    CX = (4 + (3 * n))

                    Worksheets("Gooses").Cells(2, CX) = C1
                    Worksheets("Gooses").Cells(3, CX) = C2
                    Worksheets("Gooses").Cells(4, CX) = C3
                                        Set DSI = xDoc.SelectNodes("//LN0/DataSet")

                    For j = 0 To DSI.Length - 1
                         'dsName = DSI(j).Attributes.getNamedItem("name").Text
                         'dsDesc = DSI(j).Attributes.getNamedItem("name").Text
                         'dsX = (4 + (3 * j))

                         'Worksheets("Gooses").Cells(6, dsX) = dsName
                         'Worksheets("Gooses").Cells(7, dsX) = dsDesc

                         Set dsP = xDoc.SelectNodes("//DataSet/FCDA")

                         For k = 0 To dsP.Length - 1

                            ldInst = dsP(k).Attributes.getNamedItem("ldInst").Text
                            Prefix = dsP(k).Attributes.getNamedItem("prefix").Text
                            lnClass = dsP(k).Attributes.getNamedItem("lnClass").Text
                            lnInst = dsP(k).Attributes.getNamedItem("lnInst").Text
                            doName = dsP(k).Attributes.getNamedItem("doName").Text
                            fc = dsP(k).Attributes.getNamedItem("fc").Text

                            dsPoint = ldInst & "." & Prefix & "." & lnClass & "." & lnInst & "." & doName & "." & fc
                            dsPX = (6 + k)

                            If j = 0 Then
                                Worksheets("Gooses").Cells(dsPX, 4) = dsPoint
                            Else
                                Worksheets("Gooses").Cells(dsPX, 4 + (3 * j)) = dsPoint
                            End If

                         Next
                    Next

                Next

        End If
    End With
End Sub

And the XML that I'm using:
Xml


text:
Q: Page content fetched a second time on the client when using Server-side rendering When server-side rendering a page, the page content is fetched by the server (Node-) application and passed to the client application via the serverApp-state. On the client the page content is then fetched a second time, even though the information should already be there.
What is the reason for this redundant call?
Thank you,
Armin Hutzler

A: For anyone looking for the answer:
This seems like a bug.
@Armin has created a new github ticket for it: https://github.com/SAP/cloud-commerce-spartacus-storefront/issues/6337


text:
Q: How to re-include excluded folder in SSDT-BI / Visual Studio 2013 database project? I've selected "Excluded from project" on a folder with tables (database was imported first into project). Now I would like to re-include this folder into the project. In the "Add Existing Item" option it's not possible. Only files can be added like that. Do you know how to do that ? Is it possible or should I re-create the folder and add the files there again manually ?

A: This is actually fairly easy to do. Do not re-create the folder.
With Visual Studio open and the solution loaded, do the following:

*

*View the Solution Explorer (shows on the right side).

*Select either the project or any of the folders or items within the project.

*In the top button bar within Solution Explorer, click on the >> button on the far right. Three or four new buttons should appear below your cursor (depending on what type of item you had selected).

*The far left button in the new set that appeared when you clicked the >> is for Show All Files. Click that. You should now see folders and files, etc that are dotted outline icons instead of solid shapes.

*Right click on the folder that was previously excluded from the project.

*Select Include In Project.

*In the top button bar within Solution Explorer, click on the >> button on the far right. Three or four new buttons should appear below your cursor (depending on what type of item you had selected).

*The far left button in the new set that appeared when you clicked the >> should already be selected. Click that to re-hide all of the folders and files, etc with the dotted outline icons.


text:
Q: Verifying providing entities on the Maven Central Repository Is there any way we can see for ourselves the entity that provides a dependency on the Maven Central Repository?
For example, if we look for the javax.xml.bind dependency on the Maven Central Repository (see here), it's not clear to me who has provided these different artifacts. I would think as a javax package one of them should be provided by Oracle?
I can see that are some guidelines (see here) for producers provided by Sonatype. This suggests that Sonatype ensures the domain is owned by the entity, or that the entity is the "designated maintainer" for the relevant group ID. Is there any way to see which entities Sonatype has assigned to each group ID?
Edit: After reading Robert's comment and this article I was able to get a better understanding of how the Maven Central Repository uses PGP to achieve this goal. I downloaded the .asc file by adding .asc to the end of the dependency URL.
https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar.asc
And I could then run this command and get the below output:
gpg --auto-key-locate keyserver --keyserver hkps://keyserver.ubuntu.com --keyserver-options auto-key-retrieve --verify jaxb-api-2.3.0.jar.asc jaxb-api-2.3.0.jar
gpg: Signature made Mon, Jul 31, 2017  9:27:23 PM AUSEST
gpg:                using RSA key 3575E1C767076CA8
gpg: Good signature from "Oracle TopLink Dev Team topdev_cz@oracle.com" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Although that doesn't guarantee that "Oracle TopLink Dev Team" is the entity they claim to be (which is where the PGP "web of trust" comes into it), I am at least sure I have a file provided by an entity who signed with that ID and that the file hasn't been changed since it was signed.


text:
Q: "I will eat you alive!": What is this construction? "To wipe the table clean" : A well-known example for a resultative verb.
However, I'm looking through many Aktionsart right now, and I just cannot figure out what happens in "I will eat you alive" or "He ate the chicken raw". I guess we can elongate it to "I will eat you {while you are} alive", but, well, there has to be a name for this usage of putting an adjective that describes the state the person something is done to to the moment the action takes place?
Please help me out, just one term is enough, or one link, you don't have to bring lots of effort.

A:
[1] I wiped the table clean.
[2] I will eat you alive.
[3] He ate the chicken raw.

The items in bold are all optional predicatives in complex-transitive clauses.
[1] is, as you say, a resultative predicative which, although optional, is licensed by the verb.
By contrast, in [2] and [3] the predicatives are depictive and, although optional, are adjuncts. In other words, the predicative/non-predicative contrast cuts across that between complements and adjuncts, and hence they are best called predicative adjuncts.


text:
Q: Wordpress assets not accessible anymore I have a problem following the switch to production server. I no longer have access to images and media in general and some style files.
Yet I modified all the links. A first time with the wp-migrate tool, the second directly from the SQL file.
I've reset htaccess.
I also checked the rights of folders and files. (I put them at 755 to test).
Finally, the files have no accents.
My environment:
Wordpress 4.9.8
php 5.6.38
Mysql 5
theme base: https://themeforest.net/item/pheromone-responsive-multiconcept-template/15432549
Do you have any ideas ?
Thank you in advance for your answers


text:
Q: extern alias 'xxx' was not specified in a /reference option I am trying to use log4net.ThreadContext.Properties["subjectProperty"]  = emailsubject
in my project.
I have 2 differnt projects

*

*Web - MVC

*Business Layer

WEB - MVC project has reference to Combres
Business Layer has reference to log4net (here i have extended SMTPAppender for dynamic email address)
So at runtime I am having this error:

duplicate reference exists in Combres and log4Net for ThreadContext

I have added the extern keyword to resolve issue
I used the properties window to change the alias for the assembly from 'global' to 'MyAlias'
At the top of the file where the aliased assembly is used, I put extern alias MyAlias. This must be before any using statements.
I followed this:

Use the alias prefix to use the namespace you want, for example using
  MyAlias::MyNamespace.

But I have this error:

The extern alias 'xxx' was not specified in a /reference option

A: I found that in my case the 2 assemblies in my solution that I was using the alias to differentiate had the same actual dll name, hence only 1 of the 2 assemblies was there.
Renamed to be
Interfaces.Beta1.dll

and
Interfaces.v1.dll

Then it all worked again!
(not both of them being called Interfaces.dll)
Once I worked that out it seemed pretty obvious :)

A: Set the target framework to .NET 4.5.1.


text:
Q: Trigger Save OnClick() event in Sitecore page editor I am trying to trigger the save OnClick() event in the PersonalizationForm c# file so that the personalization components will be updated once the form is closed. Currently I am making the following call:
SheerResponse.Eval("$("#scRibbonButton_Save").trigger("click");");

The response I am getting is:
init {context: document, selector: "#scRibbonButton_Save"}

Any ideas on how to call the save button from code behind?


text:
Q: populating a tableview with nsmutabledata received from a webservice I would like to populate a tableview with a NSMutableData that received from a webservice. I can get the data and display at several components but cannot fill the tableview because following code doesn't accept NSMutableData ;
AnyNSarray = [NSPropertyListSerialization propertyListWithData: webData options: 0 format:&plf error: &error];
//webData is NSMutableData that i populate with webservice data and AnyNSarray is a NSArray to provide tableview at
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

Here is tableview populating blocks (also following code works at view loads but is not fired again after i click button):
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [NSString stringWithFormat:@"cell%i",indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {

    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    cell.textLabel.text = [birnsarray objectAtIndex:indexPath.row];
    cell.detailTextLabel.text = @"any details";
}
return cell;

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return AnyNSarray.count;
}

A: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [birnsarray count];
}

A: Hey in numberOfRows function you are returning AnyNSarray count, so replace your cellForRowAtIndexPath with the below code.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [NSString stringWithFormat:@"cell%i",indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {

    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    cell.textLabel.text = [AnyNSarray objectAtIndex:indexPath.row];
    cell.detailTextLabel.text = @"any details";
}
return cell;

}


text:
Q: Logical operations So I'm working on an assignment, and I had trouble getting my code to work until I tried this:
instead of typing:
if (num != 0 and den != 0):
to:
if not(num == 0 and den == 0)
I also tried this:
if not ((num and den ) == 0):

I don't understand what the difference between these statements are. The second statement got it to do what I wanted, but I don't know why. Thanks!
Edit: Sorry for the vagueness, first timer here.
So What im trying to do is:
One can show that:
(iii) if num != 0 and den != 0, then the two lines are not parallel and therefore intersect at a single
point.
Return True if the line segments intersect.
I got this from the textbook I'm using for my class. There's basically an equation that has a numerator and denominator and these are the statements made for them. Let me know if this is still too vague. Also, I'm using python 3. Thanks!!!

A: I'm guessing what you want is a simple OR statement
if num or den:

which matches the truthiness of your chosen statement.
>>> def test(num, den):
...     print(bool(num or den), 'num or den')
...     print(bool(not(num == 0 and den == 0)), 'not(num == 0 and den == 0)')
...     print(bool(num != 0 and den != 0), '(num != 0 and den != 0)')
...     print(bool(not ((num and den ) == 0)), 'not ((num and den ) == 0)')
...
>>>
>>> test(0, 0)
False num or den
False not(num == 0 and den == 0)
False (num != 0 and den != 0)
False not ((num and den ) == 0)
>>>
>>> test(0, 1)
True num or den
True not(num == 0 and den == 0)
False (num != 0 and den != 0)
False not ((num and den ) == 0)
>>>
>>> test(1, 0)
True num or den
True not(num == 0 and den == 0)
False (num != 0 and den != 0)
False not ((num and den ) == 0)
>>>
>>> test(1, 1)
True num or den
True not(num == 0 and den == 0)
True (num != 0 and den != 0)
True not ((num and den ) == 0)
>>>

A: What your code does:

*

*The first piece of code checks if both values are unequal to 0. If so, it runs.

*The second checks if both values are equal to 0, and subsequently inverts that. In other words, it runs when at least one of num and den is unequal to 0, though the other may still be 0.

*The third compares the truth values of num and den (see below). The logical AND of this is then compared to 0, and then inverted. In other words, this runs when both num and den have a truthy value, which should result in the same behaviour as the first piece of code. Since this depends on truthy/falsy values rather than explicit comparison, I wouldn't recommend this - it may have some unexpected results for some data types.

Regarding truthy/falsy values:

*

*Integers and floats are falsy if they are equal to 0 or 0.0, respectively. Otherwise, they are truthy.

*List, dicts, and strings are falsy if they are empty (i.e. [], {} or "", and truthy otherwise.

*None is always falsy.

*From my tests, functions (the actual functions themselves - the results are compared depending on their own datatype) are always truthy.

When testing on my machine, (1) and (3) are True when num and den are both non-zero and False otherwise. (2) is True when num, den or both are non-zero, and False otherwise.
From what Nelson said in the comments, as far as I know and could test != takes precedence over and, so that shouldn't cause issues.
All of the above was checked on Python 2.7. I cannot give guarantees that it works the same for Python 3.
If you would like more help, you might want to put some more information regarding what your input and your expected output is.
Though your first and last approach should work on python 2.7, since you report the first one doesn't it may indeed have to do with operation precedence. You should be able to fix this by using
if (num != 0) and (den != 0):
That should execute if and only if both are non-zero.


text:
Q: Maximal pruned subtree - an absolute notion? Fix a tree $ p $ over $ \omega $. Let $ [p] $ denote the set of all branches of $ p $. Given a set of reals $ F \subseteq \omega^\omega $, let $ T(F) := \{ x \mathord{\upharpoonright} n : x \in F \land n < \omega \} $. Clearly, $ T([p]) \subseteq p $ is a maximal pruned subtree of $ p $.
But $ p \mapsto [p] $ is not absolute for transitive models of ZF. So can we construct a maximal pruned subtree in an absolute way?
My idea: Let $ \mathbf{M} $ be a transitive model for ZF. Suppose $ p \in \mathbf{M} $. Now define $ \langle q_n : n < \omega \rangle $ recursively (within $ \mathbf{M} $) by $ q_0 = p $ and $ q_{n + 1} = q_n \setminus \{ s \in q_n : s \text{ is a terminal node of } q_n \} $ for all $ n < \omega $. Let $ p^* := \bigcap \{ q_n : n < \omega \} $. ($ p \mapsto p^* $ should be absolute.)
Does $ \bigl( p^* = T([p]) \bigr)^\mathbf{M} $ hold? And what about $ p^* = T([p]) $ (in $ \mathbf{V} $)?

A: First of all, one should know about the rank function and the well-founded part of a tree. This is covered in Alexander Kechris's book Classical Descriptive Set Theory in sections I.2.E and I.2.F for example.
Kechris defines
$$
\operatorname{WF}_T := \{ s \in T : T_s \text{ is well-founded}\}.
$$
for each tree $ T \subseteq A^{<\omega} $.
(Here $ T_s := \{t \in A^{<\omega} : s^\smallfrown t \in T \} $ for each $ s \in T $.)
One easily sees that $ T^* := T \setminus \operatorname{WF}_T $ is the maximal pruned subtree. This is exactly the set of nodes whose ranks are $ \infty := (\max \{ |A|, \aleph_0 \})^+ $.
Remark that "$ R \text{ is a well-founded relation on } A $" is absolute for transitive models of $ \mathrm{ZF} - \mathrm{P} $ ($ \mathrm{ZF} $ without the power set axiom).
So the definition of $ \operatorname{WF}_T $ (and hence of $ T^* $) is also absolute for transitive models of $ \mathrm{ZF} - \mathrm{P} $.


text:
Q: How do I explain when to use string and when String
Possible Duplicate:
What is the difference between String and string

I'm using string for a variable, like this
string myString = "test";

And I'm using String if I want to use some methods(?) of the Class String
String.Format...

I thought this is looking better. Buy some people are doing stuff like
String myString;
string.Format...

Its working. But I don't like this. How can I tell them to stop? Is there "C# rule" for stuff like this? The same thing for int,Int; char,Char; ...

A: string is a C# alias to System.String.
If writing C#, you should be using the alias, so string.Format and string myString.
Both end up compiled to the same IL and mean the same thing, but C# has its idioms and using the type alias is part of them - in the same way that you would use int and not System.Int32.

A: Coding guidelines are an important thing if you are working on bigger projects and ensure that you can easily read code written by any of the developer in your team.
Unfortunately there isn't any official guideline on how you should format your C# code. Microsoft itself encountered the problem while developing the .NET framework and developed an internal set of style guidelines which grew into a full fledged program called StyleCop which has a default rule set with sensible settings.
According to these rules you should always use string instead of String:
string xyz;
string.Format();

The rules is the following:

SA1121 - UseBuiltInTypeAlias - Readability Rules
The code uses one of the basic C# types, but does not use the built-in
  alias for the type.
Rather than using the type name or the fully-qualified type name, the
  built-in aliases for these types should always be used: bool, byte,
  char, decimal, double, short, int, long, object, sbyte, float, string,
  ushort, uint, ulong.

A recommended reading is the history of StyleCop you can find here:
http://stylecop.codeplex.com/wikipage?title=A%20Brief%20History%20of%20CSharp%20Style&referringTitle=Documentation
It explains some of the problems you encounter with different people from different backgrounds working on the same code base and how they developed the rule set.
We recently implemented StyleCop in our own project and although it is a lot of work to really follow all the rules, the resulting code is much more readable. It also has a fairly good ReSharper integration which allows you to do many fixes automatically if you use ReSharper.

A: I usually express this as, "If there is an identical primitive type in the language, prefer it." In your specific case, which style to use is a preference rather than something that has major impacts to functionality. What is important is that whatever style is chosen is consistently applied by everyone in your team.


text:
Q: strncpy and strcat not working the way I think they would c++ I have an assignment to implement a string object ourselves, and am currently stuck when trying to concatenate two such strings.  I figured I would go this route:

*

*allocate big enough space to hold

*insert beginning of holding string into new space up to index using strncpy(this part works)

*cat on the string I am inserting

*cat on the remainder of the holding string

Implementation:
#include <iostream>
#include <cstring>

using namespace std;

int main(){
   int index = 6;//insertion position

   char * temp = new char[21];
   char * mystr = new char[21 + 7 +1];
   char * insert = new char[7];

   temp = "Hello this is a test";
   insert = " world ";

   strncpy(mystr, temp, index);
   strcat(mystr + 7, insert);
   strcat(mystr, temp + index);
   mystr[21 + 6] = '\0';

   cout << "mystr: " << mystr << endl;

   return 0;
}

that code prints out gibberish after Hello when using visual studios, but works when using g++ (with warnings), why the discrepancy?

A: You're mixing native c concepts with c++. Not a good idea.
This is better:
#include <iostream>
#include <string>  // not cstring

using namespace std;

int main(){
   int index = 6;//insertion position

   string temp = "Hello this is a test";
   string insert = "world ";
   string mystr = temp.substr(0, index) + insert + temp.substr(index);

   cout << "mystr: " << mystr << endl;

   return 0;
}


text:
Q: S4 Object Issue with scale_shape_manual I am struggling with an issue with scale_shape_manual and scale_colour_manual from ggplot. Retaking the example from ggplot help(scale_colour_manual) we get the following two lines :
p <- qplot(mpg, wt, data = mtcars, colour = factor(cyl))
p + scale_colour_manual(values = c("red","blue", "green"))

They work fine and I can do whatever I want after that. But if I decide to create a line like this one, which would create an object combining the layers
h <- p + scale_colour_manual(values = c("red","blue", "green"))

Then any command will prompt me an warning message "Setting class(x) to multiple strings ("manual", "discrete", ...); result will no longer be an S4 object". Even a very simple one :
 a = 2

However If I recompile the last line it works. Anyone had the same issue ? Can you help me on that ?
Following comment here is a reproducible example
library(ggplot2)
library(Hmisc)
data(mpg)
p <- qplot(mpg, wt, data = mtcars, colour = factor(cyl))
h  <-  p + scale_colour_manual(values = c("red","blue", "green"))
a = 2

UPDATE -
Apparently it was just a version issue, the following version appear not to work together :  R version 3.0.3 (2014-03-06) Hmisc_3.14-3 and ggplot2_0.9.3.1. One might consider detach(package:Hmisc, unload = TRUE) or just accept the warning.
Thanks
R


text:
Q: Can't disappear "untracked" folder in git status I'm new to Git. A couple of days ago I tried to undo a "git add --all" with "git reset" after a quick Google suggested that. Luckily it appears no material harm was inflicted on my working directory, however Git has added a folder of angularjs modules I had listed in .gitignore, and now this folder (and everything in it) is showing up as "untracked" in "git status". It didn't prior to the reset, and nothing else in gitignore is doing this. I've tried a few solutions including "git rm -r --cached node_modules" and this Git untracked files list is wrong but it's still there. All suggestions appreciated!

A: The ".gitignore first line" bug has been reported before in ".gitignore not working for me":

What really got gitignore working full for me was adding a comment on the first line of the file. Git wasn't parsing the exclude situated on the first line.

However, this shouldn't be a bug: the first line should work too.
What can change is:

*

*the encoding of your file

*a different eol (CRLF instead of LF) on the first line.

A: I resolved my similar issue with the answer accepted here: git still shows files as untracked despite .gitignore and rm -r --cached. What did I do wrong?.
It has to do with the encoding of the .gitignore file. Selecting plain "UTF-8" from Notepad++ resolved it for me.

A: I had a similar issue with an untracked folder persisting. I solved this by using the answer described here, I had to run:
git clean -f -d

To ensure directories were removed.

A: After the command git rm -r --cached node_modules did you do a commit to the repo?

A: Maybe your .gitignore is incorrect. Try to edit the line about angularjs (maybe there is an extra / at the beginning you have to remove, or add * to ignore all)

A: (repeats my last comment under Impression's reply). I solved it. Maybe I have a malformed gitignore, but I accidentally discovered that the first line is being ignored by gitignore (yeah, you read that right). When I added a new entry "nothing" to the top of git ignore, it stopped listing node_modules as"untracked". Whatever.


text:
Q: nodejs express avoid res.redirect after post I wanted to optimize and probably reduce Http delay or page load time/TTFB..
Currently, I have a code working well to POST data to a database.
in the express node routes, I got something like that:
router.post('/edit', Auth, function(req, res) {
  if ( db.save() ) {
    res.redirect('/my_success_page'); // so redirect as GET(302 status)
  }
}
router.get('/my_success_page', Auth, function(req, res) {
  res.send(. .. ... ... );
}

I think, maybe I'm wrong, but if I were able to avoid this "302 redirection", it will certainly reduce the page loading time.
So, I have 2 questions:

*

*Am I wrong?

*How can I prevent this redirection and directly display/send the page from the POST route instead of having this redirect+GET ?
I guess I can copy-paste all the code from the GET route into the POST route.. or maybe I could factorize that into a dedicated "displayPage()" function. Do you have a better suggestion?

Thanks.


text:
Q: Jquery executes Error section by default - Servlet I am new to Ajax and JQuery. I am attempting to insert data into my database without submitting the form. The data gets inserted into the table but:

*

*I am not able to get either the Error Message or Success Message on My jsp. It Comes as [object Object]

*Looks like the success section of the Jquery is not executed at all

My Jquery:

My JSP

                    Country Name
                    *

                            <input name="country" value="${country}" onkeyup="this.value = this.value.toUpperCase();"  type="text" id="country"/>

                    Continent Name
                    *

                            <input name="continent" value="${continent}" onkeyup="this.value = this.value.toUpperCase();"   type="text"  id="continent"/>

                    Region
                    *

                            <input name="region" value="${region}"  onkeyup="this.value = this.value.toUpperCase();"  type="text" id="region"/>

                    Population
                    *

                            <input name="population" value="${population}"  type="text"  id="population"/>

                    Capital
                    *

                            <input name="capital" value="${capital}"   type="text" id="capital"/>

                            <input type="reset" name="Submit2" value="Reset" class="redButton" />

                            <input name="Submit" class="redButton" type="button" id="countrybutton" onclick="MM_validateForm('country', '', 'R', 'continent', '', 'R', 'region', '', 'R', 'population', '', 'R',
                                            'capital', '', 'R');
                                    return document.MM_returnValue" value="Submit" />

And My servlet section:
response.setContentType("application/json");
                        String country = request.getParameter("country");
                        String continent = request.getParameter("continent");
                        String region = request.getParameter("region");
                        int population = Integer.parseInt(request.getParameter("population"));
                        String capital = request.getParameter("capital");
                        String returnMessage;
                        if (Countries.addCountry(country, continent, region, population, capital)) {
                            returnMessage = "Record Inserted.";
                        } else {
                            returnMessage = "Unable to Insert Record.";
                            try {
                                throw new InsertException("Unable to Insert record");
                            } catch (InsertException ex) {
                                log.debug(ex.getMessage());
                            }
                        }
                        new Gson().toJson(returnMessage, response.getWriter());
                        response.sendRedirect("index.jsp");

What am I missing?

A: Try remove this line:
response.sendRedirect("index.jsp");

and to get exception in Ajax error, you will need set http code 500 in response, add this inside your "else":
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

Servlet final:
response.setContentType("application/json");
String country = request.getParameter("country");
String continent = request.getParameter("continent");
String region = request.getParameter("region");
int population = Integer.parseInt(request.getParameter("population"));
String capital = request.getParameter("capital");
String returnMessage;
if (Countries.addCountry(country, continent, region, population, capital)) {
    returnMessage = "Record Inserted.";
} else {
    returnMessage = "Unable to Insert Record.";
    response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    try {
        throw new InsertException("Unable to Insert record");
    } catch (InsertException ex) {
        log.debug(ex.getMessage());
    }
}
new Gson().toJson(returnMessage, response.getWriter());


text:
Q: Binary Image Size after import I have a lot of binary images I would like to import into mathematica.
Each of them is 132kB (1024x1024) big. Like the following:
As soon as I import it into Mathematica however and call ByteCount[image] the size increases to 1MB (8bit?). How can I prevent this? I do not have enough RAM to import that many 1MB images.
Best,
Max


text:
Q: TeeChart VCL vs .NET Is TeeChart .NET built from the same source as TeeChart VCL? I'm just wandering as we have a VCL application heavily dependent on TeeChart and I would like to redevelop the GUI component in .NET so I can switch from the Codegear IDE to Visual Studio.

A: The .NET Framework and VCL are two very, very different libraries.  The different versions of TeeChart would not be built on the same source, although they likely will have very similar APIs.


text:
Q: Is it possible to use variable nested command splatting I am just wanting to check if it is possible to use If statements to set the value of a nested command splat in PowerShell. Below is what I have currently:
$SADUParams = @{
Identity = $SAM
Company = $Company
Server = $ADserver
Replace = @{"extensionattribute11"="$Department";"extensionattribute12"="RESOURCE"}
}
if($PhoneNo){
    $SADUParams["OfficePhone"] = $PhoneNo
}
Set-ADUser @SADUParams

What I would like to also do is update ExtensionAttribute12 using an if statement like with the phone number in the example above.
Is this possible, and if so, how do I code it?

A: Sure, just simple access the desired property from the $SADUParams hashtable and update it:
if ($true <#yourcondition#>)
{
    $SADUParams.Replace.extensionattribute12 = "your_new_value"
}


text:
Q: create a select with the date of the saturdays in the next 4 months  Ho to all.
I was wondering how can I create a select with the date of the saturdays in the next four months, using jquery.ui as a reference for the date.
I just wanna create something like that:
<select>
  <optgroup label="July">
    <option value="30/07/2012">30</option>
  </optgroup>
  <optgroup label="August">
    <option value="04/08/2012">4</option>
    <option value="11/08/2012">11</option>
    <option value="18/08/2012">18</option>
    <option value="25/08/2012">25</option>
  </optgroup>
</select>

...
Any help will be strongly appreciated.
Thank you so much for the attention.

A: As soon as you start doing any sort of date math, you should always evaluate the leading date libraries out there. jQUeryUI's date functionality is centered around the needs of the datepicker and, while awesome, if you don't need the actual date picker then you may be better off using something like Moment.js
To find the next several saturdays with Moment, you can do something like:
var thisSaturday = moment().day(6); // 6th day of the week = saturday

var num = 4,
    upcomingSaturdays = [
      thisSaturday
    ];

for (var i = 1; i <= num; i++) {
  upcomingSaturdays.push(moment(thisSaturday).add('days', 7 * i));
}

document.write(upcomingSaturdays.join('<br>'));

And on JSFiddle

A: This is my final code, thanks to jsoverson, I hope it will be helpful for someone else:
var thisSaturday = moment().day(6); // 6th day of the week = saturday
var num = 16,
    upcomingSaturdays = [
      thisSaturday
    ];
for (var i = 1; i <= num; i++) {
  upcomingSaturdays.push(moment(thisSaturday).add('days', 7 * i).format("DD/MM/YYYY"));
}
jQuery(function() {
    jQuery("select#date").html(upcomingSaturdays.join('<option>'));
});


text:
Q: The request contain entity body but no Content-Type header.The inferred media type application/octet-stream is not support for this resource I already read this Post but no luck.
I'm using RestShap v106.11.4.
public async static Task<ApiResponseBase<T>> ExecuteApiRequestAsync<T>(ApiRequestParameter parameter) where T : new()
{
        RestClient client = new RestClient(parameter.ApiBaseUrl);
        client.UseNewtonsoftJson();

        Method reqMethod = (Method)Enum.Parse(typeof(Method), parameter.HttpMethod.ToUpper());
        RestRequest request = new RestRequest(parameter.Resource, reqMethod);
        //request.AddHeader("Accept", "application/json"); // Also tried this too.No luck.

        if (parameter.RequireToken)
        {
            request.AddHeader("Authorization", $"bearer {parameter.BearerToken}");
        }

        if (!string.IsNullOrWhiteSpace(parameter.Body))
        {
            //request.AddJsonBody(parameter.Body);
            request.AddParameter("application/json", parameter.Body, ParameterType.RequestBody);
        }

        if ((reqMethod == Method.POST || reqMethod == Method.PUT)
                && (!string.IsNullOrWhiteSpace(parameter.FileName) && !string.IsNullOrWhiteSpace(parameter.FilePath)))
        {
            request.AddFile(parameter.FileName, parameter.FileName);
        }

        IRestResponse<ApiResponseBase<T>> response = await client.ExecuteAsync<ApiResponseBase<T>>(request);

        return response.Data;
}

I got an UnSupportedMediaType error if I change my API's verb from POST to GET. The API is working perfectly in Postman.
Thanks in advance.

A: According to Restsharp Documnetation

RequestBody does not work on GET or HEAD Requests, as they do not send a body.


text:
Q: How do I include the currency conversion block in Paypal Express Checkout I have attached a screenshot of an example Paypal Express Checkout payment page which include some currency conversion information (indicated with a blue arrow).  I am trying to replicate this implementation of Paypal Express Checkout on my own app.  What parameters or settings are used to set whether to show this information or not?  It is not clear in the documentation.  Note: I am using Classic APIs

A: Only PayPal Adaptive Payment have Currency Conversion API.
Express checkout does not have.
If you really want to use PayPal Currency Conversion, you can still use this API. But, additionally you need to send "APP-ID" in your request. For Sandbox APP-Id is constant which isAPP-80W284485P519543T.for live, you need to create a APP from apps.paypal.com to get the APP-ID and then send the request.