text:
Q: CSS .hover on tr with the first TD having rowspan in Chrome I have a table with the format like this:
TR -> TD rowspan=2 -> TD -> TD
TR ->              -> TD -> TD
TR -> TD rowspan=2 -> TD -> TD
TR ->              -> TD -> TD
Repeats........
On hover of any TD, the TR is highlighted and the TD with Rowspan is highlighted in full if a TD in either row is highlighted.
Like this:

When moving down the table the CSS is applied / removed properly. However whn moving UP the table the CSS is not removed from the bottom half of the TD with the rowspan
Example:

This only happens in chrome;
Currently my only CSS is
.hover{
    background-color: #1797C0 !important;
}

The JS is This:
                $("[id$=user_data] td").hover(function() {

                  $el = $(this);

                  $el.parent().addClass("hover");

                  if ($el.parent().has('td[rowspan]').length == 0)

                    $el
                      .parent()
                      .prevAll('tr:has(td[rowspan]):first')
                      .find('td[rowspan]')
                      .addClass("hover");

                }, function() {

                  $el
                    .parent()
                    .removeClass("hover")
                    .prevAll('tr:has(td[rowspan]):first')
                    .find('td[rowspan]')
                    .removeClass("hover");

                });

Is there something in Chrome that causes the color to remain when the TR/TD is no longer hover? Using developer tool the TD does NOT have the class .hover yet the color remains.
So my question is:
Where in my JS is the CSS background color not being reset for the part of the TD that is on the second row of the rowSpan
I would like it to highlight the entire first cell (with rowspan) and the rest of row 1 when hovering on a td in row 1. Highlight the entire TD in Row 1 col 1 when hovering in any TD in row 2
repeat for rows 3-4 and 5-6 and so on, removing the highlight from the previous rows/td(s).
Regardless of moving up or down in the Table
It currently works in Safari and Firefox but Chrome is keeping the Highlight in the bottom of the TD with the rowspan only when moving UP in the table.

A: I ran into this problem as well. This is my port of that jquery code to native JS.
Hope it helps =)
(function () {

    function findRowSpan(element) {
        var sibling = element;
        var rowspanFound = false;

        var rowSpanCols = [];

        while (!rowspanFound) {

            var cols = sibling.getElementsByTagName("td");
            for (var i = 0; i < cols.length; i++) {
                var col = cols[i];
                if (col.hasAttribute('rowspan')) {
                    rowSpanCols.push(col);
                }
            }
            rowspanFound = rowSpanCols.length > 0;
            sibling = sibling.previousElementSibling;
        }
        return rowSpanCols;

    }

    function doForAll(array,func) {
        for (var j = 0; j < array.length; j++) {
            var item = array[j];
            func(item);
        }
    }

    function rowSpanHover(element,func) {
        var parent = element.parentNode;
        func(parent);

        var cols = findRowSpan(parent);
        doForAll(cols, function (col) {
            func(col);
        });
    }

    function addClass(element,cssClass) {
        element.className = element.className +" "+ cssClass;
    }

    function removeClass(element, cssClass) {
        element.className = element.className.replace(cssClass, "").trim();
    }

    return {

        setup: function () {
            var cells = document.getElementsByTagName('td');

            for (var i = 0; i < cells.length; i++) {
                var cell = cells[i];

                cell.addEventListener("mouseover", function () {
                    rowSpanHover(this, function(element) {
                        addClass(element, "hover");
                    });
                });

                cell.addEventListener("mouseout", function () {
                    rowSpanHover(this, function (element) {
                        removeClass(element, "hover");
                    });

                });
            }
        }
    };
})();


text:
Q: Twitter Search Query in Python I am trying to pull tweets matching the given search query. I'm using the following code :
import urllib2 as urllib
import json
response = urllib.urlopen("https://search.twitter.com/search.json?q=microsoft")
pyresponse = json.load(response)
print pyresponse

This was working a few days ago, but suddenly stopped working now. With some help from google, I learned that this type of url in not supported anymore.
How do I perform this search query. What url shall I use?

A: Twitter is deprecating non-authenticated searches. You should look into Tweepy or another Python library that interacts with Twitter. https://github.com/tweepy/tweepy

redpajama_set_name: RedPajamaStackExchange


text:
Q: A* Search Algorithm causes StackOverFlowError I am creating a 8 puzzle solver using A* Search.
I believe the error is in my Search.class found below. However I have also attached the other 2 classes just in case.
Search Class
public class Search {

/**
 * Active instance of Board
 */
private Board board;

/**
 * Set of fringes
 */
private ArrayList<Integer> fringes = new ArrayList<>();

/**
 * Current nodes
 */
private int node;

/**
 * Map linking tiles(by number) to the goal state
 */
private static Map<Integer, int[]> goalStates = new HashMap<>();

/**
 * g value
 */
private int g = 0;

/**
 * Is the search complete
 */
private boolean searchComplete = false;

/**
 * The last move
 */
private int lastMove = 0;

/**
 * Fills goalStates Map
 */
static {
    goalStates.put(1, new int[]{0, 0});
    goalStates.put(2, new int[]{1, 0});
    goalStates.put(3, new int[]{2, 0});
    goalStates.put(4, new int[]{0, 1});
    goalStates.put(5, new int[]{1, 1});
    goalStates.put(6, new int[]{2, 1});
    goalStates.put(7, new int[]{0, 2});
    goalStates.put(8, new int[]{1, 2});
};

/**
 * Construct the Search instance
 *
 * @param board
 *      The board
 */
public Search(Board board){
    this.board = board;

    searchAlgo();
}

/**
 * Main search algorithm
 */
private void searchAlgo() {

    ArrayList<Integer> nodeFValues = new ArrayList();
    ArrayList<Tile> nodeTiles = new ArrayList<>();

    /* Stores all the f values for the nodes in the fringe */
    for(Tile tile: board.checkNeighbouringTiles(board.findTile(0))){

        if(lastMove != tile.getNumber()) {
            nodeFValues.add(node(tile));
            nodeTiles.add(tile);
        }

    }

    /* Gets the minimum fringe */
    int minFValueIndex = nodeFValues.indexOf(Collections.min(nodeFValues));

    /* If there are no tiles out of place then you are at goal state */
    if (tilesOutOfPlaceHeuristic(board) == 0){
        System.out.println("Complete");
        board.print();
        searchComplete = true;

        return;
    }

    /* Goes to the node with the lowest f value. */
    board.moveTile(board.findTile(0),
            nodeTiles.get(minFValueIndex).getXPosition(),
            nodeTiles.get(minFValueIndex).getYPosition());

    lastMove = nodeTiles.get(minFValueIndex).getNumber();

    g += 1;

    /* If search is incomplete, it recursively calls itself */
    if(!searchComplete)
        searchAlgo();

}

/**
 * Represents each node
 *
 * @param tile
 *      The tile to be moved in the node
 * @return
 *      f value
 */
private int node(Tile tile){

    /** Initialises new board object */
    Board nodeBoard = new Board(board.getNumbers());

    nodeBoard.moveTile(nodeBoard.findTile(0), tile.getXPosition(), tile.getYPosition());

    int h1 = tilesOutOfPlaceHeuristic(nodeBoard);
    int h2 = manhattanHeuristic(nodeBoard);

    int f = g + h2;

    return f;
}

/**
 * Calculates horizontal and vertical distances of tiles from their proper places.
 * Admissible Heuristic.
 *
 * @return
 *      Sum of horizontal and vertical distances of tiles from their proper places.
 */
private int manhattanHeuristic(Board board) {

    int sum = 0;
    ArrayList<Tile> tiles = board.getTiles();
    int[] goalState;
    int goalX;
    int goalY;
    int differenceX;
    int differenceY;

    for(Tile tile: tiles){

        if(tile.getNumber() != 0) {
            goalState = goalStates.get(tile.getNumber());
            goalX = goalState[0];
            goalY = goalState[1];

            differenceX = goalX - tile.getXPosition();
            differenceY = goalY - tile.getYPosition();

            sum += Math.abs(differenceX) + Math.abs(differenceY);
        }

    }

    return sum;
}

/**
 * Calculates number of tiles out of place. Admissible Heuristic.
 *
 * @return
 *      Number of tiles out of place
 */
private int tilesOutOfPlaceHeuristic(Board board) {

    int tilesInWrongPlace = 0;
    ArrayList<Tile> tiles = board.getTiles();

    for(Tile tile: tiles){

        if(tile.getNumber() != 0) {
            if ((tile.getXPosition() != goalStates.get(tile.getNumber())[0])
                    || (tile.getYPosition() != goalStates.get(tile.getNumber())[1])){
                tilesInWrongPlace += 1;
            }
        }

    }

    return tilesInWrongPlace;
}

}

Board Class:
 public class Board {

/**
 * Numbers in the board
 */
private int[][] numbers = {};

private int rows = 3;
private int columns = 3;

/**
 * The board
 */
private ArrayList<Tile> board = new ArrayList();

/**
 * Constructs a Board instance and fills
 * it with Tile instances
 */
public Board(int[][] numbers) {

    this.numbers = numbers;
    int j = 0;

    for(int[] row: numbers){

        for (int i = 0; i < row.length; i++) {
            board.add(new Tile(row[i], i, j));
        }

        j += 1;
    }

}

/**
 * @return
 *      Numbers for board
 */
public int[][] getNumbers(){

    return numbers;
}

/**
 * @return
 *      Tiles in board
 */
public ArrayList<Tile> getTiles(){

    return board;
}

/**
 * Moves the specified Tile to the specified position.
 * Swaps positions with Tile at that position.
 *
 * @param tile
 *      Tile to be moved
 * @param x
 *      The horizontal position you want Tile to move to.
 * @param y
 *      The vertical position you want Tile to move to.
 */
public void moveTile(Tile tile, int x, int y) {

    int _x = tile.getXPosition();
    int _y = tile.getYPosition();

    Tile tileToBeMoved = tile;
    Tile tileAtPosition;

    if(findTile(x, y) != null) {
        tileAtPosition = findTile(x, y);
    } else {
        System.out.println("No tile exists at that position");
        return;
    }

    /* Move tileToBeMoved to chosen position */
    tileToBeMoved.setPosition(x, y);

    /* swap*/
    tileAtPosition.setPosition(_x, _y);

}

/**
 * Checks if neighbouring Tiles exist, if so, it returns the Tile
 *
 * @param tile
 *      Current Tile
 * @return
 *      Set of Tiles
 */
public ArrayList<Tile> checkNeighbouringTiles(Tile tile){

    ArrayList<Tile> neighbouringTiles = new ArrayList<>();

    int x = tile.getXPosition();
    int y = tile.getYPosition();

    /* Neighbour to the right of tile */
    int rightNeighbourX = x + 1;
    int rightNeighbourY = y;

    /* Neighbour to the left of tile */
    int leftNeighbourX = x - 1;
    int leftNeighbourY = y;

    /* Neighbour to the top of tile */
    int topNeighbourX = x;
    int topNeighbourY = y - 1;

    /* Neighbour to the bottom of tile */
    int bottomNeighbourX = x;
    int bottomNeighbourY = y + 1;

    for(Tile t: board) {
        if ((t.getXPosition() == rightNeighbourX) && (t.getYPosition() == rightNeighbourY)) {
            neighbouringTiles.add(t);

        } else if((t.getXPosition() == leftNeighbourX) && (t.getYPosition() == leftNeighbourY)){
            neighbouringTiles.add(t);

        } else if((t.getXPosition() == topNeighbourX) && (t.getYPosition() == topNeighbourY)){
            neighbouringTiles.add(t);

        } else if((t.getXPosition() == bottomNeighbourX) && (t.getYPosition() == bottomNeighbourY)){
            neighbouringTiles.add(t);
        }
    }

    return neighbouringTiles;
}

/**
 * Finds a Tile with matching position
 *
 * @param x
 *      The horizontal position
 * @param y
 *      The vertical position
 * @return
 *      matching Tile
 */
public Tile findTile(int x, int y){

    for(Tile t: board) {
        if(t.getXPosition() == x && t.getYPosition() == y)
            return t;
    }

    return null;
}

/**
 * Finds a Tile with matching number
 *
 * @param number
 *      The number on the Tile
 * @return
 *      matching Tile
 */
public Tile findTile(int number){

    for(Tile t: board) {
        if(t.getNumber() == number)
            return t;
    }

    return null;
}

/**
 *Prints the board
 */
public void print() {

    System.out.println("*=====*");

    for(int j = 0; j < rows; j++){
        System.out.print("||");

        for(int i = 0; i < columns; i++){
            if(findTile(i, j) != null){
                System.out.print(findTile(i, j).getNumber());
            }
        }
        System.out.println("||");
    }

    System.out.println("*=====*");

}

}

Tile Class:
public class Tile {

/**
 * Number on Tile
 */
private int number;

/**
 * Horizontal position of tile
 */
private int x;

/**
 * Vertical position of tile
 */
private int y;

/**
 * Constructs a Tile instance with a number and position.
 *
 * @param number
 *      The number for the Tile.
 * @param x
 *      The Horizontal position for the Tile.
 */
public Tile(int number, int x, int y){
    this.number = number;
    this.x = x;
    this.y = y;
}

/**
 * @param x
 *      Horizontal position for the Tile
 * @param y
 *      Vertical position for the Tile
 */
public void setPosition(int x, int y){

    this.x = x;
    this.y = y;
}

/**
 * @return
 *      Current horizontal position of Tile
 */
public int getXPosition(){

    return x;
}

/**
 * @return
 *      Current vertical position of Tile
 */
public int getYPosition(){

    return y;
}

/**
 * @param number
 *      Number on Tile
 */
public void setNumber(int number){

    this.number = number;
}

/**
 * @return
 *      Current number on tile
 */
public int getNumber(){

    return number;
}

}

Main Class:
public class Main {
public static void main(String[] args){

    int[][] numbers = {
            {1, 0, 4},
            {3, 2, 6},
            {7, 5, 8}
    };

    Board board = new Board(numbers);

    Search search = new Search(board);

}
}

The following is the stack trace:
Exception in thread "main" java.lang.StackOverflowError
at java.util.Arrays.copyOf(Arrays.java:3175)
at java.util.ArrayList.grow(ArrayList.java:246)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:220)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:212)
at java.util.ArrayList.add(ArrayList.java:443)
at Board.checkNeighbouringTiles(Board.java:138)
at Search.searchAlgo(Search.java:89)

Please note, in some cases there is no error but the complete answer(goal state) is provided.

A: In your moveTile method, the tileToBeMoved is just a copy of a the Tile from the board.  It needs to get updated in the board ArrayList.  You should probably do something like:
board.get(indexOf(tileToBeMoved)).setPosition(x, y);
board.get(indexOf(tileAtPosition)).setPosition(_x, _y);

Otherwise when you call your searchAlgo method over and over, all the tiles will be in the same position every time.
Also, look at how your board is initialized and how you calculate your f values. You need to account for when neighbors are already in their correct location:
First pass:
Neighbors of 0: 1, 4, 2
F Values of Neighbors: {1, 0}, {4, 4}, {2, 1}
moveTile(0, 0, 0);
New Board:
{0, 1, 4},
{3, 2, 6},
{7, 5, 8}
Second pass:
Neighbors of 0: 1, 3
F Values of Neighbors: {1, 2}, {3, 5}
moveTile(0, 0, 1);
New Board:
{1, 0, 4},
{3, 2, 6},
{7, 5, 8}
See what's happening?


text:
Q: use of "would have to" Here are some sentences about "would have to":

*

*If I needed more money in the future,I would have to do a better job.

*Freddy sneezed on the cakes. He would have to go and do that.

*A: What did you do yesterday?
B: I repaired the broken window.
A: Ah yes, you would have to do that. Broken windows are dangerous.

*A: What are you doing now?
B: I am repairing the broken window.
A: Ah yes, you would have to do that. Broken windows are dangerous."

*A: What are you going to do tomorrow?
B: I will repair the broken window.
A: Ah yes, you would have to do that. Broken windows are dangerous."
First question:
What's the use of would have to in above" sentences?
Second question:
But I hear people using "would have to" without the "if clause". I don't know why people use that way either.
Third question:
"would" has been used in past, present, and future in above examples.  Is "would have to" tenseless? Why not to use "have to" instead of using "would have to"? Why do we need "would" here to refer to present past and future?

A: 1.If I needed more money in the future, I would have to do a better job.
Compare your sentence with: "I need more money, so I have to get a better job"
It is the same but yours is conditional, as you have said "only in the event A of would I have to do B".
2.Freddy sneezed on the cakes. He would have to go and do that.
This doesn't sounds right. Literally, your sentence means that Freddy was obliged to sneeze on the cakes. More normal would be:
"Freddy sneezed on the cakes. He would go and do that" - with emphasis on the would. The emphasised would here means that this is something typical of Freddy, because he is the kind of person who sneezes on cakes.
3.A: What did you do yesterday? B: I repaired the broken window. A: Ah yes, you would have to do that. Broken windows are dangerous.
Again in this example "would have" doesn't sound right. More logical here would be "should". Because repairing windows is something you should do, to prevent people injuring themselves. I tried to think of a logical way to write your sentence with "would have", and came up with:
"...Ah yes, you would have had to do that, because broken windows are dangerous". - That looks like quite a mouthful, but logically means "in the past, you were obliged to do that.


text:
Q: Elementary differentiation problem involving logarithms: What am i missing here? Consider the finite sum  $S=$ $\sum_{k=2}^n \log k - \log(k-1)$.
Differentiating $S$ w.r.t $k$, we have $S'= \sum_{k=1}^n \dfrac{1}{k} - \dfrac{1}{k-1}=-\sum_{k=1}^n \dfrac{1}{k(k-1)}<0$.
But this is somewhat a contradiction, since $\log k -\log(k-1) > 0$ for every $k$, which implies that $S$ is strictly increasing and thus $S'>0$ ?

A: The expression $$\sum_{k=1}^n\log k - \log(k-1)$$
is independent of $k$. You cannot differentiate with regard to $k$. Your calculation is therefore nonsensical, and its results mean nothing.

Ask yourself this: does the question

If $S$ is the sum of the first $n$ integers, what is the derivative of $S$ with regard to $k$

make any sense?
No, it does not. There is no $k$ on which $S$ would be dependent on, despite the fact that $$S=\sum_{k=1}^nk$$


text:
Q: Website loading time programmatically I'm looking for a solution on monitoring website loading time Programmatically
I build my web application on Codeigniter and can use the benchmark class for getting the server site execution time but what I need is the total loading time of a website from the time a server-side call is done until all the contents of the website have been loaded.
I'm currently using a JavaScript function that subtracts the time before and after the onload event but I'm not sure about the accuracy of this method.
Please note that I'm not interested in "Best Practices" and recommendations for improving speed like those offered by Google speed, YSlow, etc
Is their any client-side library or something that I could reuse for accurate loading time, similar to those provided by the Google Chrome developer tools that provide loading time for images, scripts, etc?

A: The answer is no I'm afraid, Chrome dev tools, Firebug, IE Dev Toolbar are the only options from a browser perspective. Any client side script will be part of the load and subject to delays before it starts execution.
There are tools to intercept and monitor the HTTP requests that can also give you this kind of information but again, it's not something that you can do without installation or user interaction.

A: Yes.
tl;dr
Use a headless browser to measure the loading times. One example of doing so is Website Loading Time.
Long version
I created a side-project to measure actual loading times. It uses Node and Nightmare to manipulate a headless ("invisible") web browser. Once all of the resources are loaded, it reports the number of milliseconds it took to fully load the page.
One nice feature that would be useful for you is that it loads the webpage repeatedly. So, you could load the page multiple times and then average the values for a nice, round value. Also, since this script runs on the command-line, it's trivial to install on different machines and get actual loading times from various locations. (Load time depends not just on the server, but also the client and intermediaries)
Example usage:
website-loading-time rinogo$ node website-loading-time.js https://google.com
1657
967
1179
1005
1084
1076
...

You mentioned that you are trying to measure load time programmatically. Since this is a command-line utility, you could run it from your code and parse the result.
https://github.com/rinogo/website-loading-time
Disclosure: I am the author of this project.


text:
Q: virtualenvwrapper side-by-side with python2.7 and python3 I'm starting to do side-by-side work in python2 and python3. (i.e. some projects req python 2 and some req python 3)
How do i use virtualenvwrapper with this requirement?
Do I just install one virtualenvwrapper (either for 2 or for 3) and just set the python binary accordingly at time of virtual env creation? Doesn't seem like that would work.

A: Just doing some initial testing right now and it looks like it works without issue. I'm running the python 3 version of virtualenv wrapper with the python 3 binary, but am able to create venvs for python2.x just fine
e.g.
mkvirtualenv myenv -p /usr/lib/python

My existing venvs also working without issue (so far) with this setup

A: You could just make two separate virtualenvs and specify which python version you'd like on each. Activate them for your python 2 and 3 projects, respectively with:
. ~/.VirtualEnv#/bin/activate

For example:
virtualenv -p python2.7 ~/.VirtualEnv2
virtualenv -p python2.5 ~/.VirtualEnv3


text:
Q: Extracting the sum of elements with xpathsapply from an XML file using "R" Let's assume we have the following XML file:

<XML>

      <ID>1</ID>

    <C>
      <D>10</D>
      <D>20</D>
    </C>

      <ID>2</ID>

    <C>
      <D>30</D>
      <D>50</D>
    </C>

</XML>

Now I want to get a table (data frame or list) from it by using "R" (with "xpathSApply") with the ID as first column and the sum of the associated "D"s. So in this example the result should look like this:

ID  |  sum(D)
----+--------
1   | 30
2   | 80

The xml file is just an example. In reality it contains much more elements and the number of D elements per A element is variable.
Thanks a lot!! :)

A: You could try
library(XML)
lst <- xmlToList('file.xml')
do.call(rbind,lapply(lst, function(x) {x1 <- unlist(x)
        data.frame(ID=x1[1], Sum_D=sum(as.numeric(x1[-1])))}))
#   ID Sum_D
#A   1   30
#A1  2   80

Or may be if the length of D elements are the same
xl <- xmlParse('file.xml')
ID <- xpathSApply(xl, '//ID', xmlValue)
Sum_D <- colSums(matrix(as.numeric(xpathSApply(xl, '//D',
                xmlValue)), ncol=length(ID)))

 data.frame(ID, Sum_D)
#  ID Sum_D
#1  1   30
#2  2   80


text:
Q: Python pandas creating data frame with variable number of inputs I am trying to create pandas dataframe with variable number of columns.
import pandas as pd
import numpy as np
MonthNumber = np.array([1,1,2,4,5,6,5])
Type1 = np.array(['A','B','C',A','A','B','C'])
Type2 = np.array([1,1,0,1,0,0,1])
Data = np.array([1.1,3,.52,34,15,45,34])
Data2 = Data * 1.1
Data3 = Data * 2

def variableDataFrame(*args):
    df = pd.DataFrame({'MonthNumber':args1, 'Data':args2})
    print df.columns

So, the calls to function looks like:
variableDataFrame(MonthNumber,Data) #prints MonthNumber,Data
variableDataFrame(MonthNumber,Type1,Data) # prints MonthNumber,Type1,Data

A: In order to complete your code and make it work for what you've provided, I'd do this:
def variableDataFrame(*args):
    """I'm assuming the last argument is the data argument.
    Everything else gets put into an index.
    If you want these as columns instead of rows,
    put a ".T" at the end of the return argument."""

    return pd.DataFrame(args[-1], index=pd.MultiIndex.from_arrays(args[:-1]))

    # Optional return if you want columns instead
    # return pd.DataFrame(args[-1], index=pd.MultiIndex.from_arrays(args[:-1])).T

But I will put a large caveat on this!!!
You are creating a replacement for pd.DataFrame.  All you've/I've done is reshuffle and obfuscate the arguments.  In order to get it to work, you need to know what goes in what slot which is the same thing you need to know when you use pd.DataFrame in the first place.
With that out of my system, I hope that helps.


text:
Q: php Spout excel .xlsx writer make all cells TEXT I am using spout and am trying to figure out how to make all cells written in text format and NOT general. The reason being is if a user edits a cell I want it to be exactly as the typed and NOT have excel guess what it is. (Converting 10% --> 10% as a PERCENT; when I read this back it is .1 and not 10%)
in phpExcel I am able to do:
PHPExcel_Cell::setValueBinder(new TextValueBinder());

class TextValueBinder implements PHPExcel_Cell_IValueBinder
{
    public function bindValue(PHPExcel_Cell $cell, $value = null)
    {
        $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
        return true;
    }
}

to force all cells as text.
Is there a way to do this in spout (I couldn't find in docs)? I like spout better because it is faster and uses less memory.
Even if I have to come up with a crazy hack; I am all for it.


text:
Q: How to hide a menu button from desktop webpage? I use the "menu-icon" as a button for navbar links for mobile version. I have a problem with desktop version, not sure how to hide the button from it?

  //the all navigation bar from mobile version
    <button id="menu-icon"></button> //links button for mobile version

  //that is for navigation links from mobile version

Games

Contact

Shop

Home

A: you just assign display:none; to the id="menu-icon"
and change the display to block display:block;  to the id="menu-icon"  in mobile device using Media query like below
#menu-icon{
  display:none;
}
@media (min-width:728px) {
   #menu-icon{
     display:block;
   }
}


text:
Q: How can I add transition effects to my LibGdx game? I'm making splash screen for my game, i want to display the logo and Name with different Transition effects. I'm a noob here, having no idea of scenes stage n all. If scenes and stages are required,  a simple explanation with code would be appreciated.
Thanks.

A: You can create different screens for the logo and the name, and create a transition between them.
For that, you can use the libgdx-transitions library for creating e.g. some alpha-fading, or sliding transitions:
https://github.com/digital-thinking/libgdx-transitions
Here in the test case you can see how it works:
https://github.com/digital-thinking/libgdx-transitions/wiki
Basically, you create transitions and then you can change them before you change the screen.
Or you could do this on a single screen using the Universal Tween Engine.
With that, you can create a Timeline where you (for example) change the alpha levels of pictures of the logo and the name (make the pictures appear and disappear).


text:
Q: Show the equivalence of two electrostatic energy
$$U = \frac{1}{2}\iint_{all space}^{ } \frac{\rho(1)\rho(2)}{4\pi\epsilon_{0}r_{12}}dV_{1}dV_{2} $$ and $$U = \frac{\epsilon_{0}}{2}\int_{allspace}^{ } \vec{E} \cdot \vec{E} dV.$$

In the left equation, the energy can also be described with the potential $ \phi $ where
$U = \frac{1}{2}\int_{allspace }^{ } \rho\phi dV$
because $ \rho = - \epsilon_{0} \triangledown ^{2} \phi $
plug that in
$U = -\frac{\epsilon_{0}}{2}\int_{allspace }^{ } \phi \triangledown^{2}\phi dV$
This is where I'm stuck.
I think you can change $ \phi \triangledown^{2}\phi$ into a form of
$ \triangledown\phi \cdot \triangledown\phi  $
such that
$\triangledown\phi  = \vec{E} $
Thus satisfying the question. However, I'm not too clear of that.
$ \phi \triangledown^{2}\phi => \triangledown\phi \cdot \triangledown\phi  $
I don't think I know any vector properties that allow this. or at LEAST
$ \phi \triangledown^{2}\phi => \triangledown\phi \cdot \triangledown\phi  + A $
where $A$ ultimately results in 0

A: Just for the sake of having an answer: In $\phi \nabla ^2 \phi$, consider the term $\phi \frac{\partial ^2 \phi}{\partial x^2}$. By the product rule, this is equal to $\frac{\partial}{\partial x} \left(\phi \frac{\partial \phi}{\partial x}\right) - \left(\frac{\partial \phi}{\partial x}\right)^2$. Combining all three terms, we get $\phi \nabla^2 \phi = \nabla\cdot \left(\phi \nabla \phi\right) - \nabla \phi \cdot \nabla \phi$. Upon integrating, the first terms turns into a surface integral over all space. Since $\phi$ goes as $1/r$, $\phi \nabla \phi$ goes as $1/r^3$, and since the surface element goes as $r^2$, the integral is zero when $r \to \infty$. Therefore we're left with $- \nabla \phi \cdot \nabla \phi$, that is, $-E^2$.


text:
Q: Identify subsequent interaction done by the same id (redshift) I am trying to identify all agents that had an interaction with the same customer within 30 minutes, because they might feel bothered and shouldnt be called that frequently.

I'm not quite sure how to approach that, since case statements best work within a row. Maybe a loop would work iterating over rows (using redshift)?

A: Hint: you can use LAG() function to find the timestamp of the previous call.
Full answer:
WITH interactions AS (
    SELECT
        agent,
        customer,
        call_time,
        LAG(call_time) OVER (PARTITION BY agent, customer ORDER BY call_time) AS prev_call_time
    FROM
        orders
)
SELECT DISTINCT
    agent,
    customer
FROM
    interactions
WHERE
    DATEADD(MINUTE, prev_call_time, 30) >= call_time
;


text:
Q: SQL Server Temp Table Creation For Stored Procedure that Returns Multiple Tables I've been struggling with this all afternoon, so I'm hoping someone here can help me.
I've seen several threads similar to this, but none of provided me with an answer to my exact situation.
I'm using SQL Server 2016 and I have a stored procedure (I didn't write it and can't modify it) that returns several different tables of information. I'm trying to inject the results of all of the tables into a temp table.
I've tried to go the long route and type out the exact column headers to define the "Create Table" and now I am continuously getting the error:

Warning: The join order has been enforced because a local join hint is used.
Msg 213, Level 16, State 7, Procedure spRptMgmtManagementSummary, Line 290 [Batch Start Line 0]
  Column name or number of supplied values does not match table definition.

Obviously something isn't matching up, but since there are several hundred columns I'm at a loss in regards to how I can pinpoint what I'm missing. I've eyeballed it several times and can't seem to find anything missing from either table (although I supposed it could be a data type issue?).
Is there a way to match up the temp table and the store procedure to find out what I am missing?
Still fairly new at this, but it seems crazy that I can't create a table automatically based on the stored procedure outputs or export the outputs to excel in a usable format for a comparison.
Any help would be greatly appreciated!


text:
Q: Enemy not moving In my game I want to have one of my enemies move towards the player however they don't do that for some reason. The enemy is supposed to look at the player and when the player enters the range they should start moving towards him. My problem is that they aren't doing anything. They just stand there. Also they don't even fall when they have a rigidbody. It currently has an Animator, box collider, and a capsule collider.
Edit: I forgot to add this but the script also triggers the animations
Edit #2: Also I know that it isn't because the movement is in the if statement
(Sorry if it is bad I am a programmer noob)
This is the script responsible for the players movement:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Mar_Tracker : MonoBehaviour
{
    public Transform Player;
    public float MoveSpeed = 3.0f;
    public float InRadius = 250.0f;
    public float AttackRange = 11.0f;
    public float rocketRange = 50.0f;

    private Animator anim;

    private Coroutine RocketLouch = null;

    public GameObject Rocket;
    public GameObject Explosion;

    public SphereCollider sphereCollider;

    private void Start()
    {
        anim = GetComponent<Animator>();
        Player = GameObject.FindGameObjectsWithTag("Player")[0].transform;
        sphereCollider.enabled = false;

    }

    void Update()
    {
        Player = GameObject.FindGameObjectsWithTag("Player")[0].transform;
        transform.LookAt(Player); // Makes it so that the enemy looks at player

        float dstSqr = (Player.position - transform.position).sqrMagnitude;
        bool inRadius = (dstSqr <= InRadius * InRadius);
        bool inAttackRange = (dstSqr <= AttackRange * AttackRange);
        bool inRocketRange = (dstSqr <= rocketRange * rocketRange);

        anim.SetBool("inArea", inRadius);
        anim.SetBool("Attacking", inAttackRange);

        if (inRadius)
        {
            transform.position += transform.forward * MoveSpeed * Time.deltaTime; // (movement)
        }

        if (inRocketRange)
        {
            if (RocketLouch == null)
            {
                RocketLouch = StartCoroutine(RocketLaunch());
            }
        }
    }

    IEnumerator RocketLaunch()
    {
        anim.SetBool("Rocket", true);
        yield return new WaitForSeconds(0.15f);
        sphereCollider.enabled = true;
        Explosion.SetActive(true);
        yield return new WaitForSeconds(1.0f);
        anim.SetBool("Rocket", false);
        Destroy(Rocket);

    }

}

A: Your using math that may be a tad to complicated for what you want to achieve and I think the issue is happening there.
Lets simplify it
Transform Player;
float InRadius;
float AttackRange;
float rocketRange;

void Start()
{
    // Set it at the start to optimize performance
    Player = GameObject.FindGameObjectsWithTag("Player")[0].transform;
}

// Use fixed Update for moving things around
// Better performance
void FixedUpdate()
{
    HandlePlayerDetection() ;
}

void HandlePlayerDetection()
{

    transform.LookAt(Player); // Makes it so that the enemy looks at player

    // Find the distance between the player and the transform
    var distance = Vector3.Distance(transform.position, player.position);

    // Do the boolean calculations
    bool inRadius = distance <= InRadius;
    bool inAttackRange = distance <= AttackRange;
    bool inRocketRange = distance <= rocketRange;

    // Lets use inbuilt functions to movement
    if (inRadius)
    {
        transform.position = Vector3.MoveTowards(transform.position, Player.position, MoveSpeed * Time.deltaTime);
    }

    // Rocket code
    if (inRocketRange)
    {
        FireRocket();
    }
}

void FireRocket()
{
    if (RocketLouch == null)
    {
        RocketLouch = StartCoroutine(RocketLaunch());
    }
}

Now if you really want your enemy to walk properly I would recommend watching a tutorial on Nav Meshes. It is super easy to use and will allow the enemy to walk around objects and do propper path finding.


text:
Q: Replace specific characters in a paragraph of text based on its numbered position with randomly generated characters I've dabbled a bit with JavaScript years ago but I couldn't quite grasp the logic behind it. I still have some understanding of the basics but not enough to achieve what I'd like to. I don't have the time to research how to write the code myself, but if you could point me to already-coded, individual functions which achieve the results I'm looking for, perhaps I could play around with them and then ask for further help after that when needed.
I've got a paragraph of text (It could be anything) about 300 characters long, including spaces, capitalization, and punctuation.  I would like a function which generates a random number based on the length of characters in the paragraph, i.e. the function counts the number of characters such that the generated number would never be higher than the number of characters in the paragraph) and then replaces that character with a randomly generated character based on a list of characters which appear in the paragraph (e.g. a-z,A-Z,and punctuation).
For example, if the number generated is 34, then the 34th character (whatever it may be) will be replaced by whatever character is randomly generated.
And finally, a function to input how many times this process should repeat, e.g. 10 times, 100 times, etc. before stopping, and one can view how the resulting paragraph of text has changed.
Any suggestions will be appreciated.  Thanks.
Sorry, I've not tried anything yet as I'd like to get advice, first.


text:
Q: In sails/waterline get maximum value of a column in a database agnostic way While using sails as ORM (version 1.0), I notice that there is a function called Model.avg (as well as sum). - However there is not a maximum or minimum function to get the maximum or minimum from a column in a model; so it seems this is not necessary because it is covered by other functions already?
Now in my database I need to get the "maximum id" in a list; and I have it working for postgresql by using a native query:
const maxnum = await Order.getDatastore().sendNativeQuery('SELECT MAX(\"orderNr\") FROM \"order\"')

While this isn't the most difficult thing, it is not what I truly want: it is limited to only sql-based datastores (so we wouldn't be able to move easily to mongodb); and the syntax might actually be even different for another sql database type.
So I wonder - can this be transformed in such a way it doesn't rely on sendNativeQuery?

A: You can try .query() to execute a raw SQL query using the specified model's datastore and if u want u can try pg , an NPM package used for communicating with PostgreSQL databases:
Pet.query('SELECT pet.name FROM pet WHERE pet.name = $1', [ 'dog' ]
  ,function(err, rawResult) {
    if (err) { return res.serverError(err); }

    sails.log(rawResult);
    // (result format depends on the SQL query that was passed in, and
       the adapter you're using)

    // Then parse the raw result and do whatever you like with it.

   return res.ok();
});

A: You can use the limit and order options waterline provides to get a single Model with a maximal value (then just extract that value).
const orderModel = await Order.find({
    where: {},
    select: ['orderNr'],
    limit: 1,
    sort: 'orderNr DESC'
});
console.log(orderModel.orderNr);

Like most things in Waterline, it's probably not as efficient as an SQL SELECT MAX query (or some equivalent in mongo, etc), but it should allow swapping out the database with no maintenance. Last note, don't forget to handle the case of no models found.


text:
Q: Write a bash code to replace strings in one file according to another file I have a list like this
G1 John
G2 Jack
G3 Ray
G4 Tim

and a second list in another file
Jack John
Tim Jack

I want to write a bash code that gives me a third file like this
G2 G1
G4 G2

EDIT
My solution is this, but nothing happens when I write it in bash.
#! /bin/bash
INPUTFILE="id.tsv"
DATAFILE="g.tsv"
OUTFILE="output.csv"

awk 'BEGIN {
while (getline < "'"$INPUTFILE"'")
{
split($0,ft,"\t");
id=ft[1];
name=ft[2];

key=id;
data=name;
nameArr[key]=data;
}
close("'"$INPUTFILE"'");

while (getline < "'"$DATAFILE"'")
{
split($0,ft,",");
id1=ft[1]; # Id is the first column
id2=ft[2]; # Phonenumber is the second
name1=nameArr[id1];
name2=nameArr[id2];
print name1","name2 > "'"$OUTFILE"'"; # Print directly to the outputfile
}
}'

A: awk to the rescue!
$ awk 'NR==FNR{a[$2]=$1; next} {print a[$1], a[$2]}' file1 file2

G2 G1
G4 G2

A: Karakfa's answer using awk is very concise, and for that reason, I'd probably prefer that method in my own scripts.
However, it's worth noting that you can do this directly in bash (version 4 and above) using an associative array:
declare -A map

while read -r line; do
  id="${line% *}"
  name="${line#* }"
  map["$name"]="$id"
done < file1

while read -r line; do
  ids=()
  for name in $line; do
    ids+=( "${map["$name"]}" )
  done
  echo "${ids[@]}"
done < file2

Output:
G2 G1
G4 G2

Keep in mind that this code is not portable. If portability is a concern, that's even more reason to use awk instead.


text:
Q: XML validate against recursive and oversized payload The OWASP site published a list of steps for how to secure a RESTful service. One point is the XML DoS protection. Now I'm unsure about the following two.

*

*Validation against recursive payloads

*Validation against oversized payloads

According to the first point, is it validated if I apply a xs:sequence in my XSD schema like:
<xs:complexType name="addressType">
    <xs:sequence>
        <xs:element name="city" type="addressCity" />
        <xs:element name="number" type="addressNumber" />
        <xs:element name="street" type="addressStreet" />
        <xs:element name="zipCode" type="zipCodeMoreThan4Digits" />
    </xs:sequence>
    <xs:attribute name="id" type="unsignedInteger" use="required">
    </xs:attribute>
</xs:complexType>

And now the second point. Is it sufficient if I apply a RegEx like this:
<xs:simpleType name="addressCity">
    <xs:restriction base="xs:string">
        <xs:pattern value="[a-zA-ZöäüÖÄÜß -]{2,32}" />
    </xs:restriction>
</xs:simpleType>

A: Validation against recursive payloads:
The XMLs can be nested, infinit times. An XML with deeply nested tags can be still well-formed, so a parser will accept it. If your parser is a DOM parser (which is pretty likely) it will try to build up the whole tree in memory. If the XML your web service receives is deeply nested, your server will eat up all its memory and crash before it could realize that the xml message is invalid -> DoS is successful.
The solution here is to try to validate the XML message before it is transferred to the web service server. You can achieve this with an application layer gateway which validates the XML messages to an XSD schema. That schema should only allow the depth of nesting which is needed. You need to do this validation without building up a DOM tree, otherwise you will end up with the same problem.
Validation against oversized payloads:
Here we have a similar attack type.
The size of XML affects the memory consumption of the DOM parser. You can make the XML bigger if you put many elements inside a sequence, or simply make one element's text too long.
<?xml version="1.0" encoding="UTF-8"?> xmlsoap.org/soap/envelope/">
<soap:Envelope xmlns:soap="http://schemas. xmlsoap.org/soap/envelope/">
  <soap:Body>
    <oversize>
      <item1>x</item1>
      <item1>x</item1>
      <item1>x</item1>
      <!-- The element <item1> may continue on, until the SOAP message reaches a size of megabytes or even gigabytes -->
    </oversize>
  </soap:Body>
</soap:Envelope>

OR
<?xml version="1.0" encoding="UTF-8"?> xmlsoap.org/soap/envelope/">
<soap:Envelope xmlns:soap="http://schemas. xmlsoap.org/soap/envelope/">
   <soap:Header>
    <!-- Arbitrary function call -->
  </soap:Header>

  <soap:oversize>
    <item1>x</item1>
    <item1>x</item1>
    <item1>x</item1>
    <!-- The element <item1> may continue on, until the SOAP message reaches a size of megabytes or even gigabytes -->
  </soap:oversize>

  <soap:Body>
     <!-- Arbitrary function call -->
  </soap:Body>
</soap:Envelope>

Here the solution is to use eg. maxOccurs="1000" instead of maxOccurs="unbounded" in sequence elements and to limit the length of texts inside tags. Check this out: http://clawslab.nds.rub.de/wiki/index.php/Oversize_payload_attack
Hope this helps!


text:
Q: Bootstrap Datetime picker not accepting options On a page that I am working on there is a datetime picker. It is seemingly working fine, however none of the options seem to be registering and for the life of me I cannot figure out why.
I have commented out all javascript, html and external libraries that may be interfering with it. I have made sure all the files are correct. I have made sure it's being called...anything and everything I can think of.
Some help would be greatly appreciated.

    Start Date

             <input type="text" class="form-control required" id="StartDate" name="datePicker">

$('.datePicker').datetimepicker({
         format: 'DD/MM/YYYY',//This is not working
         minDate:d.setDate(d.getDate() + 1) //neither is this
     })
     .find("input")
     .end();

A: This example definitely except format you can test by uncommenting format lines one by one. I hope this is usable to your request.

  <link rel="stylesheet" href="//code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.4/css/bootstrap-datetimepicker.min.css" type="text/css" media="all" />

    <input id="datetimepicker1" data-format="dd/MM/yyyy hh:mm:ss" type="text"></input>


text:
Q: trying to add userdetails from webservice on navigation drawer header I am new to android. I have being trying to implement job portal application. Now in trying to invoke webservices and getting responses. But my problem is that when I am calling webservice everything is working fine but user details like username and email, id are not displaying on navigation drawer header. Please help me out.
Here is my piece of code:
public class UserHome extends FragmentActivity {
    private static final CharSequence Vanaja = null;
    private static final int PRETTY_PRINT_INDENT_FACTOR = 4;
    public  static String OPERATION_NAME = "loginvalidate";
    static boolean errored = false;

    private static final CharSequence Home = null;

    private DrawerLayout mDrawerLayout;

    protected ListView mDrawerList;
   private ActionBarDrawerToggle mDrawerToggle;

    // nav drawer title
    protected CharSequence mDrawerTitle;

    // used to store app title
  protected CharSequence mTitle;
    int childcount;

    // slide menu items
    protected String[] navMenuTitles;
    private TypedArray navMenuIcons;

   public  String emailvalue,passwordvalue;

String emailid="";

 String password="";

    SoapObject result;
protected ArrayList<NavDrawerItem> navDrawerItems;
    protected NavDrawerListAdapter adapter;
    protected FrameLayout frameLayout;
    TextView name,emailid1;

    public void getLoginValues(String emailid,String password)
    { emailvalue=emailid;
    passwordvalue=password;

    }
    final String s=emailid;
    final String s1=password;
    /*public void getLoginValues(String editTextUsername,
            String editTextPassword) {
        emailvalue=editTextUsername;
        passwordvalue=editTextPassword;
    }
    */

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_navigation1);

        name = (TextView)findViewById(R.id.industry11);
        emailid1=(TextView)findViewById(R.id.mail);

 try
 {
        final ActionBar bar = getActionBar();
        bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#BDBDBD")));

        @SuppressWarnings("unused")
        AsyncTaskRunner async=(AsyncTaskRunner) new AsyncTaskRunner(this).execute();
 mTitle = mDrawerTitle = getTitle();

        // load slide menu items
        navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items11);

        // nav drawer icons from resources
        navMenuIcons = getResources()
                .obtainTypedArray(R.array.nav_drawer_icons22);

        mDrawerLayout=(DrawerLayout)findViewById(R.id.drawerlayout);
        mDrawerList = (ListView) findViewById(R.id.slidermenu);
        LayoutInflater inflater = getLayoutInflater();

        ViewGroup header = (ViewGroup)inflater.inflate(R.layout.userslider, mDrawerList, false);
        mDrawerList.addHeaderView(header, null, false);
        mDrawerLayout.closeDrawers();
    RelativeLayout update=(RelativeLayout)findViewById(R.id.update);
update.setOnClickListener(new View.OnClickListener() {

     @SuppressWarnings("unused")
    @Override
     public void onClick(View v){

         switch (v.getId()) {
         case R.id.update:

             //what to put here
            FragmentManager fm = getFragmentManager();
            FragmentTransaction ft = fm.beginTransaction();
            ft.replace(R.id.frame_container, new ProfileUpdate());
             ft.commit();
         bar.setTitle("   Updae Profile");

         break;
      }

     }

     }
 );

       navDrawerItems = new ArrayList<NavDrawerItem>();

        // adding nav drawer items to array
        // Home
        navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1)));
        // Find People
        navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1)));
        // Photos
        navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1)));
        // Communities, Will add a counter here
        navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1)));
        // Pages
        navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
        // What's hot, We  will add a counter here
        navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));

        // Recycle the typed array
        navMenuIcons.recycle();

        mDrawerList.setOnItemClickListener(new SlideMenuClickListener());

        // setting the nav drawer list adapter
        adapter = new NavDrawerListAdapter(getApplicationContext(),
                navDrawerItems);
        mDrawerList.setAdapter(adapter);

        mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                R.drawable.icd2, //nav menu toggle icon
                R.string.drawer_open, // nav drawer open - description for accessibility
                R.string.drawer_close // nav drawer close - description for accessibility
        ) {
            public void onDrawerClosed(View view) {

                invalidateOptionsMenu();
            }

            public void onDrawerOpened(View drawerView) {

                invalidateOptionsMenu();
            }
        };
        mDrawerLayout.setDrawerListener(mDrawerToggle);

        getActionBar().setDisplayHomeAsUpEnabled(true);

        bar.setIcon(R.color.transparent);

        if (savedInstanceState == null) {
            // on first time display view for first nav item
            displayView(1);
        }}
        catch(Exception e)
      {
          e.printStackTrace();
      }

    }

    /**
     * Slide menu item click listener
     * */

    private class SlideMenuClickListener implements
            ListView.OnItemClickListener {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position,
                long id) {
            // display view for selected nav drawer item
            displayView(position);
        }
    }

 @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // toggle nav drawer on selecting action bar app icon/title
        if (mDrawerToggle.onOptionsItemSelected(item)) {
            return true;
        }
        // Handle action bar actions click
        switch (item.getItemId()) {
        case R.id.action_settings:
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }

    /***
     * Called when invalidateOptionsMenu() is triggered
     */
    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        // if nav drawer is opened, hide the action items
        boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
        menu.findItem(R.id.action_settings).setVisible(!drawerOpen);

        return super.onPrepareOptionsMenu(menu);
    }

    /**
     * Diplaying fragment view for selected nav drawer list item
     * */

    @SuppressWarnings("unused")
    private void displayView(int position) {
        // update the main content by replacing fragments
     Fragment fragment=null;
     String title="null";
        switch (position) {

        case 1:
            fragment =new SearchJobs1();
            title="";
           /* Intent intent1 = new Intent(getApplicationContext(),HomeFragment.class);
            startActivity(intent1);*/
        break;
       case 2:
           fragment =new LatestJobs();
        /*  Intent intent2 = new Intent(getApplicationContext(), Homepage.class);
            startActivity(intent2);*/
            break;

        case 3:
            fragment =new AppliedJobs();
        /*  Intent intent3 = new Intent(getApplicationContext(), FindPeopleFragment.class);
            startActivity(intent3);*/
            break;

        case 4:
            fragment =new ChangePassword();
          /*Intent intent4 = new Intent(getApplicationContext(), CommunityFragment.class);
            startActivity(intent4);*/
            break;

       case 5:
           fragment =new Unsubscribe();
         /* Intent intent5 = new Intent(getApplicationContext(),PagesFragment.class);
            startActivity(intent5);*/
            break;

        case 6:
            fragment =new LogOut();
         Intent intent6 = new Intent(getApplicationContext(),MainActivity.class);
            startActivity(intent6);
            break;

        /*case 6:
            fragment =new ContactUs();
          Intent intent6 = new Intent(getApplicationContext(),PhotosFragment.class);
            startActivity(intent6);
            break;
        case 7:
            fragment =new AboutUs();
          Intent intent6 = new Intent(getApplicationContext(),PhotosFragment.class);
            startActivity(intent6);
            break;*/

        default:

            break;
        }

       if (fragment != null) {
            FragmentManager fragmentManager = getFragmentManager();
            fragmentManager.beginTransaction()
                    .replace(R.id.frame_container, fragment).commit();

            // update selected item and title, then close the drawer
            mDrawerList.setItemChecked(position, true);
            mDrawerList.setSelection(position-1);
            setTitle(navMenuTitles[position-1]);
            mDrawerLayout.closeDrawer(mDrawerList);
        } else {
            // error in creating fragment
            Log.e("MainActivity", "Error in creating fragment");
        }
    }

    @Override
    public void setTitle(CharSequence title) {
        mTitle = title;
        getActionBar().setTitle(mTitle);

        getActionBar().setTitle("  " + mTitle);
    }

    /**
     * When using the ActionBarDrawerToggle, you must call it during
     * onPostCreate() and onConfigurationChanged()...
     */

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        // Sync the toggle state after onRestoreInstanceState has occurred.
        mDrawerToggle.syncState();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // Pass any configuration change to the drawer toggls
        mDrawerToggle.onConfigurationChanged(newConfig);
    }

    public void setActionBarTitle(String string) {
        // TODO Auto-generated method stub

        getActionBar().setTitle("  "  + string);
    }

     public void setActionBarImage(ImageView view)
        {
            Log.d("Tittlename", "image   is"+view);
            getActionBar().setCustomView(view);
        }

     private  class AsyncTaskRunner extends AsyncTask<Void,Void,Void>        {

            String result1;
            UserHome outer;
            public AsyncTaskRunner(UserHome outer) {
               this.outer = outer;
            }
            private String TAG;
            @Override
            protected void onPreExecute() {
                Log.i(TAG, "onPreExecute");
            }

            @Override
            protected Void doInBackground(Void... params) {
                Log.i(TAG, "doInBackground");
                WebserviceCall service=new WebserviceCall();
try
{
/*if(isNetworkAvailable())
{*/

    SoapObject result;
result=service.invokeLoginWS(emailvalue, passwordvalue, OPERATION_NAME);

/*
    String s=outer.emailid;
    String s1=outer.password;
=======

    /*String s=UserHome.this.emailid;
    String s1=UserHome.this.password;*/

/*
result=service.invokeLoginWS(s,s1," ");*/

    LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    vi.inflate(R.layout.user_home, null);
           String resultvalue=result.getProperty("firstname").toString();
           emailid= result.getProperty(0).toString();
           password = result.getProperty(1).toString();
name.setText(resultvalue);
 resultvalue=result.getProperty("emailid").toString();
 emailid1.setText(resultvalue);
/*else
{
    Intent intent1 = new Intent(getActivity(),InternetProblem.class);

      startActivity(intent1);
}*/

}
catch(Exception e)
{
Handler refresh = new Handler(Looper.getMainLooper());

refresh.post(new Runnable() {
   public void run()
   {
    try {
        Intent intent1 = new Intent(getApplicationContext(),InternetProblem.class);

          startActivity(intent1);
                }
    catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

   }
});

}
/*Handler refresh = new Handler(Looper.getMainLooper());
                refresh.post(new Runnable() {
                    public void run()
                    {
                        try {
                            serviceCall();
                        } catch (ParseException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }

                });  */

/*                  int childCount = result.getPropertyCount();
*/
                return null;
            }

            @Override
            protected void onPostExecute(Void result) {
                Log.i(TAG, "onPostExecute");

                               }

        }
}


text:
Q: Drupal route based node content I'm new to Drupal and have a basic question which I cannot find a good answer to. I am trying to dynamicly determine the contents of my website based on a selection made by the user and keep the selection displayed in the routing for SEO purposes.
It's a website for a Restaurant with multiple franchises.
What i'm trying to do is the following:

*

*The user visits my website and gets a splash screen presented with the available franchises or a textbox to enter his postalcode

*Upon selecting he enters the main website with the navigational structure adapted to the selected franchise. For example: domain.com/city/, domain.com/city/menu, domain.com/city/menu/dishes, domain.com/city/contact, ...

*The contents of all nodes are based upon the city the user selected. Some franchises have extra nodes which should be displayed in the main navigation aswell.

What I have thought about so far is to try to accomplish this with taxonomy but I really have no idea where to start. Parts of the nodes will be the same for all franchises other parts will be different. Menu item prices will also be different.
This is the first website i'm building using Drupal so any advice is welcome.
Thanks!

A: It will be impossible to explain it all here but yes it is possible to select your content based on user input in Drupal. You will need to look into Views & Panels.
In Views you can use arguments to narrow to a specific taxonomy. With Panels , an argument can be retrieved fron the URL and passed to the Views in order to display the results.
There are a lot of resources available, Merlin of Chaos, the author of the Views & Panels modules has written a book about it. There are video tutorials online. Your best bet is to start with drupal.org.


text:
Q: Fourier Transform of sub-Gaussian distributions The high level question is:  Just as the Fourier transform of a Gaussian is a Gaussian, is the Fourier Transform of a sub-Gaussian also a sub-Gaussian?
Let $x \in \mathbf{R}^n$ denote some sub-Gaussian random vector, i.e.
there exists $b>0$ such that for any $t\in \mathbf{R}^n$ its Laplace
transform is upper-bounded as follows:
$$
\mathbf{E}[ e^{t \cdot x} ] \leq e^{b^2 \|t\|^2}.
$$
What is the Fourier Transform of the PDF of $x$, is it also sub-Gaussian?
It seems that just substituting $t = 2\pi i$ would immediately imply that, but is this substitution justified?

A: No, the Fourier Transform of a sub-Gaussian is not necessarily sub-Gaussian. By common wisdom, the decay properties of the Fourier transform $\hat f$ of an $ f \in L^1({\bf R}) $ are related to the smoothness of $f$ (and vice versa). To obtain examples take a gaussian $g(x)=Ce^{-x^2}$ and a bounded function $h(x)$ with slowly decaying FT (e.g. characteristic function of [0,1]) and set
$$ f(x) := g(x)h(x). $$
Then $f$ is clearly sub-gaussian, but the decay of $\hat f \propto \hat g \star \hat h$ is essentially given by the slow decay of $\hat h$.
(However by the uncertainty principle, if $f$ and $\hat f$ are both sub-gaussian, then the product of widths is subject to a lower bound, cf. https://en.wikipedia.org/wiki/Uncertainty_principle#Hardy.27s_uncertainty_principle or https://terrytao.wordpress.com/2009/02/18/hardys-uncertainty-principle/ )


text:
Q: Use machine learning to analyze sports bets Lets say I have database with over 1 Million bets (all kinds of sports) made by couple thousands of users, over a period of 2 years (and still growing).
These data are just lying around doing nothing, so I thought if it would be possible to use something like https://www.tensorflow.org/, do a bit of tinkering and it would analyze all the bets in database and learn from it some patterns, whats good and whats not.
The point being is we dont have resources to employ dozens of people for god knows how long to write some complicated software from the ground up. So I was thinking we could use some module from TensorFlow and go from there.
So then I would feed the network with new open bets that are currently in the system (those would be bets that are on matches that are about to be played) and it would pick for me what I should bet on, for example there is a 90% chance this bet will win, because 10 very successful players made this bet, and they have very high success when betting on this particular sport.
We have lots of experienced users, they make lots of money from betting. So the system could be trained on the data we have and then it would know, for example, if user A bets on this league/team, its very likely he will win.
The question is, where do we go from here? Can anybody point us in the right direction? Or is this just too difficult to do, for 2 people in few months? Can we use some pre-programmed solutions, like TensorFlow?

A: Without having a look of the data, it is impossible to suggest what direction should you take your next steps but anyway your first step should be to explore your data throughly, create model on small subset of data and test your hypothesis.
Overall you can try to:

*

*Use Python or R to Load and Clean Data

*Take a random subset of data(some 10,000 rows) and create a simple model using SVM or Random Forest looks like a classification Win/Lose.

*Test your results and verify your hypothesis with some data.

*Explore about your data to see if you can generate better features

*Design a small neural network first and then think about a deep neural network using tensorflow or keras etc.
Have a look at this: https://hackernoon.com/how-to-create-your-own-machine-learning-predictive-system-in-the-nba-using-python-7189d964a371

A: Yes, this is possible but can be more difficult than it appears.
Consider Microsoft's Cortana which (while only picking if a game will win outright and not ATS) is only approx. 63% accurate; which is quite good but not exactly 90% as you mention in your question (1).
The size of your database should be great for ANN models. It would be a very interesting project for sure!
To your question "where I go from here..." my answer is to simply explore the data in RStudio or using a cloud service such as Microsoft's Azure ML Studio (2) or Amazon's Machine Learning services (3).
Good luck!
Ref. 1: http://www.businessinsider.com/nfl-picks-microsoft-cortana-elo-week-5-2017-10
Ref. 2: https://studio.azureml.net/
Ref. 3: https://aws.amazon.com/amazon-ai/


text:
Q: Error al pasar delegado como parametro c# Tengo una clase con el metodo y el delegado:
public delegate void RendererDelegate(double x1, double y1, double x2, double y2, double z);

public static void Contour(double[,] d, double[] x, double[] y, double[] z, RendererDelegate renderer){
 ///
 renderer(x1, y1, x2, y2, z[k]);
}

Estoy intentando llamarla desde el constructor de MainWindows.xaml.cs  pasandole los parametros:
double[,] test = new double[3, 2] {
            { 100, 2 },
            { 200, 3 },
            { 30, 4 }
        };

        double[] x = new double[3];

        x[0] = 2;
        x[1] = 4;
        x[2] = 7;

        double[] y = new double[3];

        y[0] = 2;
        y[1] = 4;
        y[2] = 7;

        double[] z = new double[3];

        z[0] = 2;
        z[1] = 4;
        z[2] = 7;

        RendererDelegate renderer = new();

        Conrec.Contour(test, x,y,z, renderer);

Necesito pasar como parametro el delegado pero este no lo acepta de forma null (que es como lo estoy haciendo, de que forma podria completar ese parametro final?

A: Prueba con poner un signo de interrogación al ultimo parámetro, esto para que acepte un valor nulo:
public static void Contour(double[,] d, double[] x, double[] y, double[] z, RendererDelegate? renderer){
 ///
 renderer(x1, y1, x2, y2, z[k]);
}

En caso de que esto no funcione, entonces intenta enviar el valor por referencia y así termine el método seguirá teniendo los valores guardados en el objeto.
Algo como esto:
public static void Contour(double[,] d, double[] x, double[] y, double[] z, ref RendererDelegate renderer){
 ///
 renderer(x1, y1, x2, y2, z[k]);
}

Y cuando llames al método:
RendererDelegate renderer = new();
Conrec.Contour(test, x,y,z, ref renderer);

A: Un delegado es un tipo que encapsula de forma segura un método, o dicho de otra forma es una referencia a un método. Cuando se define un delegado lo que se hace es declarar una variable que apunta a otro método. Tu delegado tiene la siguiente firma o estructura:
public delegate void RendererDelegate(double x1, double y1, double x2, double y2, double z);

Es decir, tu delegado aceptará un método que reciba como parámetros 5 tipos double, y no retorne nada, ya que es void.
Tu estás construyendo el delegado pero no estás asignándole ningún método con la estructura propia del delegado (un método con 5 parámetros de tipo double y que no retorna nada), por lo que previamente tendrías que haber hecho algún método o métodos con la estructura que aceptará el delegado, por ejemplo:
//Método 1
public void Prueba (double x1, double y1, double x2, double y2, double z)
{
   //Código del método Prueba
}

//Método 2
public void Prueba2 (double x1, double y1, double x2, double y2, double z)
{
   //Código del método Prueba2
}

//Método 3
public void Prueba3 (double x1, double y1, double x2, double y2, double z)
{
   //Código del método Prueba3
}

Aquí se han declarado tres métodos con la estructura que acepta el delegado, donde cada uno tendrá su código especifico.
Entonces para asignar alguno de estos métodos a tu delegado harías:
RendererDelegate renderer = new(Prueba);

//También podría ser
//RendererDelegate renderer = new(Prueba2);
//RendererDelegate renderer = new(Prueba3);

//O podrías poner
//RendererDelegate renderer = Prueba;
//RendererDelegate renderer = Prueba2;
//RendererDelegate renderer = Prueba3;

Como ves arriba se exponen diferentes asignaciones al delegado RendererDelegate  de métodos que cumplen con la estructura de dicho delegado, y además se muestran dos formas distintas de asignar el método a algún delegado. Una vez que tienes un método cargado en tu delegado pues entonces harías:
Conrec.Contour(test, x,y,z, renderer);

Llamarías a tu metodo Contour con sus correspondientes parámetros.
Y dentro del método Contour:
public static void Contour(double[,] d, double[] x, double[] y, double[] z, RendererDelegate renderer)
{
   renderer(x1, y1, x2, y2, z[k]);
}

Al hacer:
renderer(x1, y1, x2, y2, z[k]);

Se ejecutaría el código del método que se cargo previamente en el delegado.
Revisa bien porque veo que en tus métodos tienes lo mismo parámetros de tipo double, como double[] o double[,] y si el método no tiene la misma estructura que acepta tu delegado pues habrá error.
Existen además, temas más avanzados como delegados genéricos, delegados anónimos y eventos, si lo deseas puedes investigar más sobre el tema en internet.


text:
Q: Javascript Modal Animation not Working When Close I've a Simple javascript modal that I've collected from W3 Schools. It's easy and light. But the fact is, when I click on modal button, it appears with slide up animation and also an overlay animation. But when click on close button or click outside, modal get disappear or close without any animation. I want to add an animation on modal closing time. That's mean, there will be an animation on Both, modal appear and disappearing time. With overlay, like appear time. How can Indo it....?

// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the  element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on  (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
/* The Modal (background) */

.modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  z-index: 1;
  /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  /* Full width */
  height: 100%;
  /* Full height */
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgb(0, 0, 0);
  /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4);
  /* Black w/ opacity */
  -webkit-animation-name: fadeIn;
  /* Fade in the background */
  -webkit-animation-duration: 0.4s;
  animation-name: fadeIn;
  animation-duration: 0.4s
}

/* Modal Content */

.modal-content {
  position: fixed;
  bottom: 0;
  background-color: #fefefe;
  width: 100%;
  -webkit-animation-name: slideIn;
  -webkit-animation-duration: 0.4s;
  animation-name: slideIn;
  animation-duration: 0.4s
}

/* The Close Button */

.close {
  color: white;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.modal-header {
  padding: 2px 16px;
  background-color: #5cb85c;
  color: white;
}

.modal-body {
  padding: 2px 16px;
}

.modal-footer {
  padding: 2px 16px;
  background-color: #5cb85c;
  color: white;
}

/* Add Animation */

@-webkit-keyframes slideIn {
  from {
    bottom: -300px;
    opacity: 0
  }
  to {
    bottom: 0;
    opacity: 1
  }
}

@keyframes slideIn {
  from {
    bottom: -300px;
    opacity: 0
  }
  to {
    bottom: 0;
    opacity: 1
  }
}

@-webkit-keyframes fadeIn {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}

@keyframes fadeIn {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}

Bottom Modal

<button id="myBtn">Open Modal</button>

      ×

Modal Header

Some text in the Modal Body

Some other text...

Modal Footer

Updated code:

// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the  element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on  (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}

function closeModal() {
  modal.classList.add('animate-out');

  modal.addEventListener('animationend', function() {
    modal.style.display = "none";
    modal.classList.remove('animate-out');
  }, {
    once: true
  });
}

span.onclick = closeModal;
window.onclick = function(event) {
  if (event.target.closest('#myModal') === null) {
    closeModal();
  }
};
/* The Modal (background) */

.modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  z-index: 1;
  /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  /* Full width */
  height: 100%;
  /* Full height */
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgb(0, 0, 0);
  /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4);
  /* Black w/ opacity */
  -webkit-animation-name: fadeIn;
  /* Fade in the background */
  -webkit-animation-duration: 0.4s;
  animation-name: fadeIn;
  animation-duration: 0.4s
}

/* Modal Content */

.modal-content {
  position: fixed;
  bottom: 0;
  background-color: #fefefe;
  width: 100%;
  -webkit-animation-name: slideIn;
  -webkit-animation-duration: 0.4s;
  animation-name: slideIn;
  animation-duration: 0.4s
}

/* The Close Button */

.close {
  color: white;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.modal-header {
  padding: 2px 16px;
  background-color: #5cb85c;
  color: white;
}

.modal-body {
  padding: 2px 16px;
}

.modal-footer {
  padding: 2px 16px;
  background-color: #5cb85c;
  color: white;
}

/* Add Animation */

@-webkit-keyframes slideIn {
  from {
    bottom: -300px;
    opacity: 0
  }
  to {
    bottom: 0;
    opacity: 1
  }
}

@keyframes slideIn {
  from {
    bottom: -300px;
    opacity: 0
  }
  to {
    bottom: 0;
    opacity: 1
  }
}

@-webkit-keyframes fadeIn {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}

@keyframes fadeIn {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}

.modal.animate-out {
  animation-name: fadeOut;
}

.modal.animate-out .modal-content {
  animation-name: slideOut;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideOut {
  from {
    transform: translate3d(0, 300px, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

Bottom Modal

<button id="myBtn">Open Modal</button>

      ×

Modal Header

Some text in the Modal Body

Some other text...

Modal Footer

A: The way your "in" animation works is by first changing the display property to block which renders the element visible. That also triggers the animation that is set on the modal.
The "out" animation has to work in the reverse order. First you have to animate the modal out. Whenever the animation is finished change the display property to none.
First define the animation. It should be the reverse keyframes of fadeIn and slideIn.
@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes slideOut {
  from {
    transform: translate3d(0, 300px, 0);
  }

  to {
    transform: translate3d(0, 0, 0);
  }
}

Also add a class that uses this animation. That way we can add the animation the .modal to overwrite the style.
.modal.animate-out {
  animation-name: fadeOut;
}

.modal.animate-out .modal-content {
  animation-name: slideOut;
}

To trigger the animation you'll only need to add the animate-out class we've just created to the modal once you click the close button. Then immediately add an event listener that listens for the animationend event. This event will trigger whenever the animation has finished, which in this case is our fade out animation.
After it finishes set display to none and remove the animate-out class from the modal to reset the animation so that a fade in can happen next time we show the modal. The { once: true } part ensures that this event is only listened to once. This is important since there are multiple animations but we only want the display: none and removal of the animate-out class to happen on the fade out animation.

// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the  element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal
btn.onclick = function() {
  modal.style.display = "block";
}

function closeModal() {
  modal.classList.add('animate-out');

  modal.addEventListener('animationend', function() {
    modal.style.display = "none";
    modal.classList.remove('animate-out');
  }, { once: true });
}

span.onclick = closeModal;

document.onclick = function(event) {
  if (event.target.matches('#myModal')) {
    closeModal();
  }
};
/* The Modal (background) */

.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0, 0, 0);
  background-color: rgba(0, 0, 0, 0.4);
  animation-name: fadeIn;
  animation-duration: 0.4s
}

.modal.animate-out {
  animation-name: fadeOut;
}

.modal-content {
  position: fixed;
  bottom: 0;
  background-color: #fefefe;
  width: 100%;
  animation-name: slideIn;
  animation-duration: 0.4s
}

.modal.animate-out .modal-content {
  animation-name: slideOut;
}

.close {
  color: white;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.modal-header {
  padding: 2px 16px;
  background-color: #5cb85c;
  color: white;
}

.modal-body {
  padding: 2px 16px;
}

.modal-footer {
  padding: 2px 16px;
  background-color: #5cb85c;
  color: white;
}

@keyframes slideIn {
  from {
    transform: translate3d(0, 300px, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideOut {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, 300px, 0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

Bottom Modal

<button id="myBtn">Open Modal</button>

      ×

Modal Header

Some text in the Modal Body

Some other text...

Modal Footer


text:
Q: Jasper report border bottom for multiple lines I would like to draw a dashed bottom border for a text fields which displays its contents in multiple lines.
For example:
Address: 104th Street,
         - - - - - - - - - - -- - - - - - - -- - - - - -
         Beside Market Area
         - - - - - -- - - - - -- - - - - -- - - - -- - -
         Illinois,617273
         - - - - - -- - - - - -- - - - - -- - - - -- - -

Currently when i set border bottom to text field it is displaying in this way
Address: 104th Street,
         Beside Market Area
         Illinois,617273
         - - - - - -- - - - - -- - - - - -- - - - -- - -

Please help me out on how to set border bottom for each line for multi line text
Find my jxml code below
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4_1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ab424386-3966-4b59-9892-31b3fdb6c498">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Mysql Adapter "/>
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <queryString>
        <![CDATA[Select "104th Street,\n Beside Market Area\n Illinois,617273" as address from dual]]>
    </queryString>
    <field name="address" class="java.lang.String"/>
    <title>
        <band height="79" splitType="Stretch"/>
    </title>
    <detail>
        <band height="125" splitType="Stretch">
            <staticText>
                <reportElement x="10" y="30" width="122" height="30" uuid="b2d1bb4b-38b0-47e9-8da8-5ce6a31c98a8"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">

                </textElement>
                <text><![CDATA[Address]]></text>
            </staticText>
            <textField isStretchWithOverflow="true">
                <reportElement x="150" y="30" width="390" height="30" uuid="40d76fd8-76d0-4d37-8bc7-bb4e48749df2"/>
                <box leftPadding="10">
                    <bottomPen lineWidth="1.0" lineStyle="Dashed"/>
                </box>
                <textElement verticalAlignment="Middle"/>
                <textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
</jasperReport>

A: If you manage to break up in separate field in query certainly @mbmast solution is good, but to answer your question I will show you what "crazy stuff" you can do in jasper report.
First I define an java.util.List variable that split you String on your line breaks. I'm not using String[] since this breaks report IDE
<variable name="addressArray" class="java.util.List">
    <variableExpression><![CDATA[Arrays.asList($F{address}.split("\\n"))]]></variableExpression>
</variable>

Now we can add the textField and just get the position of what we want to display. To avoid ArrayIndexOutOfBoundsException  use a printWhenExpression (to demonstrate this I have put 4 textField's in example)
Example code
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4_1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ab424386-3966-4b59-9892-31b3fdb6c498">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Mysql Adapter "/>
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <queryString>
        <![CDATA[Select "104th Street,\n Beside Market Area\n Illinois,617273" as address from dual]]>
    </queryString>
    <field name="address" class="java.lang.String"/>
    <variable name="addressArray" class="java.util.List">
        <variableExpression><![CDATA[Arrays.asList($F{address}.split("\\n"))]]></variableExpression>
    </variable>
    <title>
        <band height="79" splitType="Stretch"/>
    </title>
    <detail>
        <band height="154" splitType="Stretch">
            <staticText>
                <reportElement x="10" y="30" width="122" height="30" uuid="b2d1bb4b-38b0-47e9-8da8-5ce6a31c98a8"/>
                <textElement textAlignment="Right" verticalAlignment="Middle">

                </textElement>
                <text><![CDATA[Address]]></text>
            </staticText>
            <textField isStretchWithOverflow="true">
                <reportElement x="150" y="30" width="390" height="30" isRemoveLineWhenBlank="true" uuid="40d76fd8-76d0-4d37-8bc7-bb4e48749df2">
                    <printWhenExpression><![CDATA[$V{addressArray}.size()>0]]></printWhenExpression>
                </reportElement>
                <box leftPadding="10">
                    <bottomPen lineWidth="1.0" lineStyle="Dashed"/>
                </box>
                <textElement verticalAlignment="Middle"/>
                <textFieldExpression><![CDATA[$V{addressArray}.get(0)]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true">
                <reportElement positionType="Float" x="150" y="60" width="390" height="30" isRemoveLineWhenBlank="true" uuid="fcba83d9-5a57-45b4-b015-b23a12043784">
                    <printWhenExpression><![CDATA[$V{addressArray}.size()>1]]></printWhenExpression>
                </reportElement>
                <box leftPadding="10">
                    <bottomPen lineWidth="1.0" lineStyle="Dashed"/>
                </box>
                <textElement verticalAlignment="Middle"/>
                <textFieldExpression><![CDATA[$V{addressArray}.get(1)]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true">
                <reportElement positionType="Float" x="150" y="90" width="390" height="30" isRemoveLineWhenBlank="true" uuid="d39e756a-7e2b-409d-a423-2a8df5dd7378">
                    <printWhenExpression><![CDATA[$V{addressArray}.size()>2]]></printWhenExpression>
                </reportElement>
                <box leftPadding="10">
                    <bottomPen lineWidth="1.0" lineStyle="Dashed"/>
                </box>
                <textElement verticalAlignment="Middle"/>
                <textFieldExpression><![CDATA[$V{addressArray}.get(2)]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true">
                <reportElement positionType="Float" x="150" y="120" width="390" height="30" isRemoveLineWhenBlank="true" uuid="12fe3b4f-2b13-4b3a-98ae-adc834f89bc1">
                    <printWhenExpression><![CDATA[$V{addressArray}.size()>3]]></printWhenExpression>
                </reportElement>
                <box leftPadding="10">
                    <bottomPen lineWidth="1.0" lineStyle="Dashed"/>
                </box>
                <textElement verticalAlignment="Middle"/>
                <textFieldExpression><![CDATA[$V{addressArray}.get(3)]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
</jasperReport>

Result

A: Break your address up into separate fields (i.e. address-line-1, address-line2, etc. instead of everything in address).  Then use <printWhenExpression> to conditionally include that line (if it is not blank or null).  For those that are to be included (i.e. the meet your condition) you can include a nested <staticText> field for the separator line.


text:
Q: How to put an image on UIActionSheet? How to put image on UIActionSheet on right position of text. Like given in apple music player.

Note: Don't answer with custom view, if it is possible in UIActionSheet, Kindly let us know.

A:
Don't answer with custom view

Then you are effectively forbidding anyone to answer, because that is what you do.
First of all, there is no such thing as UIActionSheet. It was deprecated four years ago. Today we use UIAlertController.
UIAlertController is nothing but a prepackaged presented view controller. It does nothing that you could not do for yourself. It is also deliberately very simple and limited. So if you want to do something that goes beyond the limits what UIAlertController gives you, then you simply create a custom presented view controller. Adding the animation and "dimming view" to make it look like a standard action sheet is easy; just make a custom transition animation.
That is what the interface shown in your screen shot is. It is not a UIActionSheet. It is not a UIAlertController. It's just a custom presented view controller that Apple has created. And so can you.


text:
Q: How can I read zip file without saving to the disk with Spring Boot? There are already many similar questions and tutorials available about this topic still I didn't found what I wanted to do.
I want to make an API, though which I can upload the zip file, that zip is containing xml files I am reading those files and sending the content as response.
The only problem here is currently I am storing the file inside of my project directory, but I don't want that I want to read the file directly without storing it in an directory.
So basically user will hit my API, upload the file and in response he will get the data present inside of files in that zip.
My Code:
@RequestMapping(value ="/upload", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Object> uploadFile(@RequestParam("file")MultipartFile file) throws IOException {
    System.out.println(file.getOriginalFilename());
    File converFile = new File("src/main/"+file.getOriginalFilename());
    converFile.createNewFile();
    FileOutputStream fout = new FileOutputStream(converFile);
    fout.write(file.getBytes());
    //unzipping file and reading data;
    String zipFileName = "src/main/"+file.getOriginalFilename();
    List<String> str = new ArrayList<String>();
    byte[] buffer = new byte[1024];
    ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName));
    ZipEntry zipEntry;
    int read;
    while ((zipEntry = zis.getNextEntry())!= null) {
        while ((read = zis.read(buffer, 0, 1024)) >= 0) {
            str.add(new String(buffer,0,read));
        }
    }
    while (zipEntry != null){
        zipEntry = zis.getNextEntry();
    }
    zis.closeEntry();
    zis.close();
    System.out.println("Unzip complete");
    System.out.println("--------------------------------");
    System.out.println("List"+ str);

    fout.close();
    return new ResponseEntity<>(str, HttpStatus.OK);
}

This code is working fine uploading file saving it in project directory (src/main) and reading file data and giving the data as response.
How can I eliminate the saving part and do all these in code only.

A: You can use ByteArrayInputStream instead of FileInputStream, like this:
ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(file.getBytes()));


text:
Q: Google Chrome jump list tasks aren't working
The item you selected is unavailable. It might have been moved, renamed, or removed.
Do you want to remove it from the list?
If you use StartIsBack, you get this error message:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
The specified path does not exist.

Check the path, and then try again.

I installed the 64-bit version.

A: Same here. I've tried the following, but I couldn't get the jump list tasks to work:

*

*Reinstalled Chrome

*Reinstalled Chrome after clearing relevant files/folders

*https://answers.microsoft.com/en-us/msoffice/forum/all/the-item-you-selected-is-unavailable-it-may-have/324439f4-b112-4dc7-a06f-449713bce028

*One of the fixes mentioned here which is just like #3 - Broken jump lists on Windows 10
UPDATE
I made it work again by simply playing around with the Settings>Start. This Youtube video should give you an idea
https://www.youtube.com/watch?v=WG1tv-kceF4
Here's what I did:

*

*Disabled recent items in the jump lists

*Opened some websites in Chrome (both in regular and incognito tabs)

*Closed Chrome

*Enabled recent items in the jump lists

*Did #2 again and tried checking the jump list, didn't change so I thought it didn't work

*I just browsed some more websites cause I gave up on this (heh)

*Checked it again a few minutes later hoping something changes and yeah, somehow got it fixed, the tasks (New window and New Incognito window) appeared again with the recent items above them

A: I was searching for a solution to this very problem, and I was able to solve it.

*

*Using Juggler's advice, I turned on the "Show recently opened items in Jump Lists" in the Start settings.

*Then I waited a few minutes for the list to visually update on the taskbar. When the recent items showed up, the shortcuts for new window and new incognito window started working again.

It appears the problem is that Windows doesn't update the jump list after a new reinstall, since Google Chrome now installs in the Program Files folder rather than the (x86) folder. Turning on recent items in the settings forces Windows to recheck the shortcuts, which fixes the problem. I hope this helps.

A: Run command prompt and paste this cmd.exe /c del "%AppData%\Microsoft\Windows\Recent\AutomaticDestinations\f01b4d95cf55d32a.automaticDestinations-ms"
https://www.winhelponline.com/blog/fix-quick-access-reset-pinned-shortcuts-stuck-not-working-windows-10/


text:
Q: How to use My WebService From Out of Local machin in asp.net C#? i write a Web Service.asmx to provide a dollar price service for other sites.
but when i publish  it into my website and go for test it i receive this exception :
The test form is only available for requests from the local machine.
I Use code below in my asmx file:
    using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

/// <summary>
/// Summary description for Services
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]

public class Services : System.Web.Services.WebService
{

[WebMethod]

public string USD_Prices()
{
    string UnitedStateDollar;
    using (var Entity = new DataModel.DBEntities())
    {
        var UsdPrice = Entity.TblExchange.OrderByDescending(Exchange => Exchange.Id).Select(p => p.USDSell).Take(1).ToList();
        UnitedStateDollar = UsdPrice[0].ToString();
    }
    return UnitedStateDollar;
}

}
So what is the problem?....and if you Want to check it online the address is :
http://www.nerkhyab.ir/services.asmx

A: Add this in your web config.
<configuration>
    <system.web>
    <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
    </webServices>
    </system.web>
</configuration>

Check Here and here

A: There's no problem. Web services don't have forms. In order to use a web service from .NET,  you add the as a service references and call them from client code.
Old-style ASMX services had a form you could use for demonstration purposes where you could enter some simple values and call POST to get a result from the service. This was removed in WCF services because real-world web services have complex parameters that can't be handled by a simple form.
It would be far better to create a WCF service instead of an ASMX service. WCF services are more compliant, performant, flexible, scaleable (etc etc).
In any case, you can call you service from another client by adding a Service Reference to your project. This will create a proxy class that will expose the service's parameters as objects and the endpoints as methods on a client object.


text:
Q: How set priority to intellij idea process? I want to set the priority to "Below Normal" for idea64.exe process and all it descendants. I also want this setting to be retained permanently and I do not want to set it every time I run idea. Is there an IntelliJ IDEA settings for doing this?

A: You can do it by creating shortcut for below command:
C:\Windows\system32\cmd.exe /c "start /belownormal notepad.exe"

For Idea it will look like this:
C:\Windows\system32\cmd.exe /c "start /belownormal C:\"Program Files (x86)"\JetBrains\"IntelliJ IDEA 13.1.1"\bin\idea64.exe"

Other Options:
/low
/belownormal
/normal
/abovenormal
/high
/realtime