text:
Q: Changing background css with Javascript In the website http://scoopsgelato.co.uk/, when their webpage loads the background image at the top of the page changes after around 10seconds.
I want to know how to do a basic version of this. Code that sets the background-image property in the css to cycle through images.
I tried for a few hours to get it myself but I could not figure it out.

A: Set a timeout to a function that changes the image:

    var imageSrcs=['//google.com/favicon.ico', '//w3schools.com/favicon.ico', '//stackoverflow.com/favicon.ico'];
    var currentImage=0;
    setInterval(function() {
      if (currentImage<3) {
        currentImage++;
      }
      else {
        currentImage=0;
      }
      console.log(currentImage);
      document.getElementById('image').src=imageSrcs[currentImage];
    }, 10000);
<image id="image" src="//google.com/favicon.ico">

That probably isn't the fastest/shortest way to do it, but it certainly is simple enough to understand the dynamics of it.

A: Since you were looking for something simple, here is one solution at least for some inline CSS.
var imgArry = ["http://dummyimage.com/200x200/cf90cf/555770.png&text=pic+1", "http://dummyimage.com/200x200/c99011/555770.png&text=pic+2", "http://dummyimage.com/200x200/cc5601/555770.png&text=pic+3"];
function backgroundImageSlider(elem, imgs, speed){
   var index = 0;
   var timer = setInterval(function(){
      elem.style.backgroundImage = "url(" + imgs[index] + ")";
      index++
      if(index == imgs.length){
         index = 0;
      }
   }, speed);
}

backgroundImageSlider(document.getElementById("imageDiv"), imgArry, 10000);

Here is a JSFiddle.
https://jsfiddle.net/o3zhwhdp/1/


text:
Q: How can I scrape data from LinkedIn without using any api If you view the source of any LinkedIn profile then you can see information in this form
 &quotfirstName&quot&quotDanish&quot&quot

*

*I don't know how to get this data

*Here the first name is Danish

*How can I get this record using jQuery or Javascript if I send GET request using jQuery on user links and get all the HTML, is it possible? or any solution for this problem

A: You shouldn't. You will be breaking their Terms. User their API.
https://www.linkedin.com/help/linkedin/answer/56347/prohibition-of-scraping-software?lang=en

redpajama_set_name: RedPajamaStackExchange


text:
Q: Simulators missing in Xcode 10.3 After updating to Xcode 10.3, I found some of my simulators were missing. Trying to manually add one from Window -> Devices and Simulators produced a error.

A: Restarting the computer worked for me.


text:
Q: Can a process elevate itself after startup? Is it possible for a process to gain administrator priviledges after it has started? If so, how?
Examples should be in C or C++.
Edit - Examples should also use umanaged code.

A: You cannot elevate the permissions of a process while the process is running. the common way around this is to spawn a new process with elevated permissions when required. This process then does the work that requires higher privileges and then quits, releasing control back to the main process. You should be able to make it fairly seamless by setting the new processes parent window to that of the main process window.
The other alternative is relaunch the main program with the required permissions.
There is an article on UAC in Vista with C++ examples  that looks quite in depth.


text:
Q: How to add ticks in a circle in TikZ Referring to the question How to make add tick to node in tikz, how do I extend this to a circle shape in TikZ.
A simple approach is to draw lines as ticks by calculating the coordinates. Sample approach below:
\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\node[circle,draw,minimum size=10cm] (a) at (0,0) {};
\filldraw (a.center) circle [radius=0.1cm];
\draw ($(a.center)-(4.5,0)$) -- (a.west);
\draw ($(a.east)-(0.5,0)$) -- (a.east);
\end{tikzpicture}
\end{document}

But, this approach is not effective, as the ticks length has to calculated manually.
Is there a better approach to do this (ticks in the circle would be like the lines on an alarm clock, which are inclined execept at 12, 3, 6 and 9 numbers).

A: Use \foreach and polar coordinates (with care of course) you can have this
\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}
\node[circle,draw,minimum size=10cm] (a) at (0,0) {};
\filldraw (a.center) circle [radius=0.1cm];
\foreach \i [count=\j] in {60,30,...,-270} {
    \draw (\i:5) -- (\i:4.5);
    \draw (\i:4.2) node[font=\large] {\j};
}
\end{tikzpicture}
\end{document}

In this code, the for loops iterates through the set {60, 30, 0, −30, −60, −90, −120, −150, −180, −210, −240, −270}. Each of these numbers is the angle of the "ticks". I use polar coordinate based on these iterators, so the angles of the "ticks" are accurate.
I set a counter for the for loop (\j) to add numbers to the picture.

\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}
\node[circle,draw,minimum size=10cm] (a) at (0,0) {};
\filldraw (a.center) circle [radius=0.1cm];
\foreach \i [count=\j] in {60,30,...,-270} {
    \draw (\i:5) -- (\i:4.5);
    \draw (\i:4.2) node[font=\large] {\j};
}
\foreach \i in {84,78,...,-270} \draw (\i:5) -- (\i:4.8);
\end{tikzpicture}
\end{document}

The second for loop is to draw smaller ticks. 84, 78, etc. are the angles of these ticks.

A: Something like that?
\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\node[circle,draw,minimum size=10cm] (a) at (0,0) {};
\filldraw (a.center) circle [radius=0.1cm];
\draw ($(a.center)-(4.5,0)$) -- (a.west);
\draw ($(a.east)-(0.5,0)$) -- (a.east);
\foreach \X in {0,10,...,350}
{\draw (a.\X) -- ++ (\X:0.2);}
\end{tikzpicture}
\end{document}

OK, inside.
\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}
\node[circle,draw,minimum size=10cm] (a) at (0,0) {};
\filldraw (a.center) circle [radius=0.1cm];
\foreach \X in {0,10,...,350}
{\draw (a.\X) -- ++ (180+\X:0.2);}
\end{tikzpicture}
\end{document}

\foreach \X in {0,10,...,350} loops over \X in {0,10,...,350}, and then the nodes have anchors given in degrees, so (a.\X) is a point at the boundary of a at the angle \X. This syntax is mentioned in my previous answer to one of your questions. ++ (\X:0.2) adds some shift in polar coordinates, \X is the angle and 0.2 the radius. To have the ticks inwards, we need to add 180 degrees to \X (one could also use (\X:-0.2).)
And just for fun: a watch.
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[font=\sffamily]
\node[circle,draw,minimum size=10cm] (a) at (0,0) {};
\filldraw (a.center) circle [radius=0.1cm];
\foreach \X in {1,...,12}
{\draw (a.-\X*30+90) -- ++ (270-\X*30:0.3) node[pos=1.5]{\X};}
\end{tikzpicture}
\end{document}


text:
Q: Set error message of Kentico BizForm with method registered to BizFormItemEvent I have registered a method to BizFormItemEvent.Insert.Before that checks if a user already exists with an email address provided in the form and creates a user if it doesn`t.
If the user does exist with that email address, then I want to display an error message.  Problem is, if you try to call e.Cancel() or throw an exception, the BizForm just displays the generic "An error occurred when saving data. Please see event log for more details" message, and I`m not sure how I can alter that message.
Here's what I'm doing so far:
using CMS.Base;
using CMS.OnlineForms;
using System;

/// <summary>
/// Partial class that allows you to register custom handler methods and classes.
/// Adds the CustomFormHandlers attribute to the partial class.
/// </summary>
[CustomFormHandlers]
public partial class CMSModuleLoader
{
    /// <summary>
    /// Custom attribute class.
    /// </summary>
    private class CustomFormHandlers : CMSLoaderAttribute
    {
        /// <summary>
        /// Called automatically when the application starts
        /// </summary>
        public override void Init()
        {
            BizFormItemEvents.Insert.Before += FormItem_InsertBeforeHandler;
        }

        /// <summary>
        /// Handles the form data when users create new records for forms
        /// </summary>
        private void FormItem_InsertBeforeHandler(object sender, BizFormItemEventArgs e)
        {
            BizFormItem formDataItem = e.Item;

            if (formDataItem != null && formDataItem.BizFormClassName == "bizform.formname")
            {
                // CreateUser returns false if a duplicate email is found
                if(!CreateUser(formDataItem))
                {
                    // Something needs to happen here that
                    // changes the error message of the bizform
                    // e.Cancel();
                    throw new Exception("A user with this email address already exists.");
                }
            }
        }
    }
}

A: I would create a Custom form control and implemented the validation in the IsValid method. Example here.

A: I'm not sure you can do that in BizFormItemEvent.Insert.Before event. Try to implement custom validation rule for that field:

*

*it will prevent form from being saved

*it will allow you to specify validation error message


text:
Q: Getting a console reading while a loop is running I want to create a program that has a user playing darts. You have two random number generators both going from 0 to 10 that repeat constantly. If you hit enter the code stops and if it lands on 6 that your Y coordinate. Than another generator starts from 0-10 and you hit enter and it stops on a 2 your Y coordinate is 2. My issue is that if the Console is waiting for an input the code won't run. I need to find a way for the code to run and still accept an input which than stops the loop.

A: You could do an infinite while loop where inside the loop you are doing the random number generator and checking if anything is read in from the keyboard. If there is something read from the keyboard you save the current generated number and break;. You then would do something similar for the other coordinate

A: Multithread might helps. You can create one thread for looping and another thread for input console. Create a static variable as a flag to stop the loop in the loop thread once the input thread notices the user hit enter.


text:
Q: Install4j migrate macOS installations from "folder installer" to "single bundle archive" We are switching from using the "folder installer" option to the "single bundle archive" option for our macOS distribution media. What is the best way to update the existing installed versions to the new single bundle archive format, while keeping it simple for the end user?
Is there a way to remove the current installation and install the new App automatically?
The new DMG does not contain an installer and the installation process is just to drag&drop the App into Applications.

A:
The new DMG does not contain an installer and the installation process is just to drag&drop the App into Applications.

This makes it difficult to provide any automatic migration at installation time, because the user only copies a directory in the Finder. You can add a "Setup application" on the "Launcher" step of the media wizard that will be run when the users launchers the app for the first time.

In that custom installer application (which is configured under Installer->Screens & Actions) you can add logic for the migration from old installations that have been installed with a folder installer.


text:
Q: Multiple simultaneous XMPP connections using Strophe and Openfire I was wondering if anybody has experience using a single javascript client to establish multiple connections to an Openfire server over BOSH.  It seems like if I try to establish more than 4 or 5 connections, Strophe.connect.status goes to CONNFAIL randomly and clients start dropping/reconnecting randomly.

A: Many browsers limit the number of simultaneous connections you can have to a given site.  You're likely running into that limit.


text:
Q: Bootstrap way of handling light text on light background? What's the appropriate way to handle light text on (possibly) light backgrounds (e.g. over images, where the contents of the image are generally unknown, but could easily be white or very light)?
Here is an example of some effects:

Note, importantly, that even on a pure white background, the words would still be (juust) possible to read.
I tried to emulate this with bootstrap 4, with this:

My text

But this did not seem to work - I could not get the effect to appear.
Since it's a common problem, I hope bootstrap has a native way for handling for this sensibly?

A: bootstrap is not providing a text-shadow styling.
You could use text-light and customize your shadow.

/* just for demo */
body {
  padding: 10px;
}

span {
 text-shadow: #000 1px 1px 5px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
text


text:
Q: Looking for a horror story about a man pursued by a reflection in the mirror I am looking for a story which I read approximately in the late nineties/early 00s. I read it in German. It might have been a short story from a book containing other similar short stories, but I am not sure about that. The author might have been Stephen King, but I am not sure about that either.
I don't remember many details, but the main character was definitely male, and he was seeing a figure slowly approaching him in any reflecting surface, but whenever he turned around, there was nothing there.
He was terrified about what would happen when the figure in the mirror finally reached him, so he hid away somewhere without a reflecting surface, just barely before the figure caught him.
It ends with

 the protagonist looking into the eyes of someone - most likely a love interest, but I don't know for sure - only to find that the eyes show his reflection. The figure finally reaches him and strangles him, and I believe that he dies.

The setting, as far as I can remember, was the normal world at the (then-)current time.
I think that the book I read was not brand new, and given the age of similar books I read at that time I would think that it has been published not earlier than the 80s.
Based on the Wikipedia Entry, it does not seem to be "The Reaper's image" by Stephen King.
In the spirit of providing as much detail as possible, for some reason I remember that another story of the book contained a vicious cat, but I might be confusing this with another book I read at that time. That other story is most likely "The Cat from Hell" by Stephen King, as it matches a few of the details I remember from that story.

A: OP confirmed that the story is Mirror, Mirror from Volume II of Steven Spielberg's Amazing Stories. While I haven't read it myself, it seems that it was adapted from the Amazing Stories TV series. The episode has this plot description on Wikipedia:

A horror novelist is haunted by a figure in his mirror.

The show was (probably) the answer to another question on this site.
Thanks to John Rennie, for finding this.


text:
Q: Is there a grammatically correct replacement for "a whole nother level" that retains the intended meaning and emphasis? In the sentence "I had had great experiences before, but this one was like a whole nother level", I understand the idea, but I'm also aware that saying a whole nother is not grammatical. Is there an alternative way of saying the same sentence such that 1) it's grammatically correct and 2) does not lose the original meaning and emphasis?

A: "Another" is ambiguous: "another N" can mean "an additional N" or "an alternative N". So, according to which of those senses you mean, I suggest "a whole other level" and "a whole different level".

A: Instead of "a whole 'nother level," you could say the following: paramount, superior, revolutionary, unparalleled, or incomparable.
Of the words listed above, I think "unparalleled" best conveys the intended meaning of your sentence.
"I had had great experiences before, but this one was unparalleled."
If you want, you can qualify unparalleled to be more specific: unparalleled in its _______ .

A: "Whole 'nother" is often paired with "use ta could".  Those who use these types of colloquialisms often have additional meaning than a more grammatically correct term.  Any word/phrase you can use to get another human to understand you is good, spelling it with correct punctuation can indicate that is the way you intended, if not using the latin (sic).  Dadda beda!


text:
Q: Each tag in template not working if I use HTTP get I'm trying to to processing JSON from HTTP, but it's not working.
My endpoint bring me this JSON:
[
   {
      "data":"1992-04-27 00:00:00",
      "0":"1992-04-27 00:00:00",
      "numeroProntuario":"PAR 08 1377 051",
      "1":"PAR 08 1377 051",
      "nome":"ABDO AZIZ NADER ",
      "2":"ABDO AZIZ NADER ",
      "nascimento":"1933-08-26 00:00:00",
      "3":"1933-08-26 00:00:00",
      "sexo":"M",
      "4":"M",
      "estado_civil":"CASADO",
      "5":"CASADO",
      "filhos":"0",
      "6":"0",
      "local_nascimento":"BEIRUT ",
      "7":"BEIRUT ",
      "rg":"",
      "8":"",
      "cpf":"",
      "9":"",
      "enviado_por":"",
      "10":"",
      "endereco_res":"RUA ANT\u00d4NIO ANDRADE REBELO, 912",
      "11":"RUA ANT\u00d4NIO ANDRADE REBELO, 912",
      "bairro_res":"MORUMBI ",
      "12":"MORUMBI ",
      "cidade_res":"S\u00c3O PAULO",
      "13":"S\u00c3O PAULO",
      "estado_res":"SP",
      "14":"SP",
      "cep_res":"05692000",
      "15":"05692000",
      "fone_res":"",
      "16":"",
      "celular":"",
      "17":"",
      "profissao":"INDUSTRIAL ",
      "18":"INDUSTRIAL ",
      "cargo":"DIRETOR ",
      "19":"DIRETOR ",
      "atividade":"",
      "20":"",
      "empresa":"INTEXTIL ALIL NADER ",
      "21":"INTEXTIL ALIL NADER ",
      "endereco_com":"RUA CONSELHEIRO COTEGIPE, 294",
      "22":"RUA CONSELHEIRO COTEGIPE, 294",
      "cidade_com":"S\u00c3O PAULO",
      "23":"S\u00c3O PAULO",
      "estado_com":"SP",
      "24":"SP",
      "cep_com":"03058000",
      "25":"03058000",
      "fone_com":"",
      "26":"",
      "motivo":"STRESS",
      "27":"STRESS",
      "email":"",
      "28":"",
      "numeroCartao":"",
      "29":"",
      "cod_convenio":"PAR",
      "30":"PAR",
      "codigo_convenio_plano":"116",
      "31":"116",
      "codigo_paciente":"2290",
      "32":"2290"
   }
]

And my script is:
Template.listarCampanhas.helpers ({
  paciente : function(){
    try {
      HTTP.get("http://localhost:90/medico/testeAccess.php",null,function( error, response ) {
        return response.data;
      });
    }
    catch(e){
      console.log( "Cannot get paciente data...", e );
    }
  }
});

In my template I have:
<template name="listarCampanhas">

Campanhas

        Nome
        numero Prontuario

      {{#each paciente}}

        {{nome}}
        {{numeroProntuario}}

      {{/each}}

</template>

Does anybody know how to resolve this?

A: You are not returning the response from the function correctly. Remember, this is an asynchronous API request that will return at a later time, so you'll need a way to reactively set the variable.
The simplest way to do this is to use reactive variables. If you don't have the package already, run
meteor add reactive-var

Then, make adjustments to your code like so:
import { ReactiveVar } from 'meteor/reactive-var'

Template.listarCampanhas.onCreated(function() {
  const apiResponse = new ReactiveVar() // initialize a new reactive var

  // this is when we request to the API
  try {
    // this will return later, but it'll set the reactive
    // variable `apiResponse` to whatever the result returns
    HTTP.get("http://localhost:90/medico/testeAccess.php", null, function(error, response) {
      // when returned, set the result to the reactive variable
      return apiResponse.set(response.data)
    })
  }
  catch(e) {
    console.log( "Cannot get paciente data...", e );
  }

  this.data.apiResponse = apiResponse; // bind the reactive var to the template
});

Template.listarCampanhas.helpers ({
  paciente : function(){
    // helpers of a template is always reactively run,
    // i.e. everytime `apiResponse` changes this will get re-run

    return this.apiResponse.get() // return the api response that's set
  }
})

reactive-var is a core, must-understand concept that'll help you in building an app with Meteor. You can google resources across the Internet that covers this.
Here is one good read on the topic:
https://themeteorchef.com/tutorials/reactive-dict-reactive-vars-and-session-variables

A: Return just response instead of response.data i.e.
HTTP.get("http://localhost:90/medico/testeAccess.php",null,function( error, response ) {
    return response;
  });

Since there isn't any response.data in the returned json.
I'm guessing what you really should do is check the code that returns the json, as it looks wrong like the way its showing.


text:
Q: pkpass won't open on iOS from e-mail attachment All websites mention that Passbook passes can be sent by e-mail. But when the pass (generated by our server) is attached to an e-mail, the iOS e-mail client won't open it and write "(null)" instead. The same pass works fine on Android and also has no problems communicating with our web service. Any ideas? Google searches didn't offer any solutions.
Screenshot:

A: Solved: There were multiple problems:

*

*The authentication token has to be at least 16 characters long

*I used the "Apple Inc. Root Certificate" (wrong one) instead of the "AppleWWDRCA" (correct one)

*For production the web service needs to use https

A: You get that when the pass in invalid, most likely due to it being incorrectly signed and/or the pass certificate has expired.
Drag your pass into iPhone Simulator and check the Console app to look for error in the logs.


text:
Q: How get percentage result in java swing calculator This code for a basic calculator
I have 2 problems:

*

*How to get correct result for percentage calculation?

*And set limit for text field?

I need text field to only read 16 digits maximum.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Font;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;

    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.UIManager;
    import javax.swing.event.CaretEvent;
    import javax.swing.event.CaretListener;

    public class Calculator extends JFrame implements ActionListener {

    private static final long serialVersionUID = 4055065492318058414L;

    private JPanel northPanel;
    private JPanel centerPanel;

    private JTextField field;

    private JButton b1;
    private JButton b2;
    private JButton b3;
    private JButton b4;
    private JButton b5;
    private JButton b6;
    private JButton b7;
    private JButton b8;
    private JButton b9;
    private JButton b0;

    private JButton bPlus;
    private JButton bMine;
    private JButton bMultiple;
    private JButton bDivision;
    private JButton bEqual;
    private JButton bClear;
    private JButton bErase;
    private JButton bPercent;
    private JButton bPlusMine;
    private JButton bDot;

    private double fNum;
    private double sNum;
    private double result;
    private String operation;

    private static final Font fontButton = new Font("Consolas", Font.BOLD, 20);

    public static void main(String[] args) {

        new Calculator().setVisible(true);

    }

    public Calculator() {

        super("Calculator");

        try {

            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

            setSize(225, 300);
            setLocationRelativeTo(null);
            setResizable(false);
            setDefaultCloseOperation(EXIT_ON_CLOSE);

            setGUI();

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private void setGUI() {

        northPanel = new JPanel();
        add(northPanel, BorderLayout.NORTH);

        centerPanel = new JPanel();
        add(centerPanel, BorderLayout.CENTER);

        field = new JTextField(10);
        field.setEnabled(false);
        field.setHorizontalAlignment(JTextField.RIGHT);
        field.setDisabledTextColor(Color.BLACK);
        field.setBackground(Color.WHITE);
        field.setFont(new Font("Consolas", Font.BOLD, 32));

        northPanel.add(field);

        bErase = new JButton("<");
        bErase.setFont(fontButton);

        bPlus = new JButton("+");
        bPlus.setFont(fontButton);

        bPercent = new JButton("%");
        bPercent.setFont(fontButton);

        bMine = new JButton("-");
        bMine.setFont(fontButton);

        bMultiple = new JButton("\u00D7");
        bMultiple.setFont(fontButton);

        bDivision = new JButton("\u00F7");
        bDivision.setFont(fontButton);

        bEqual = new JButton("=");
        bEqual.setFont(fontButton);

        bClear = new JButton("c");
        bClear.setFont(fontButton);

        bPlusMine = new JButton("±");
        bPlusMine.setFont(fontButton);

        bDot = new JButton(".");
        bDot.setFont(fontButton);

        b1 = new JButton("1");
        b1.setFont(fontButton);

        b2 = new JButton("2");
        b2.setFont(fontButton);

        b3 = new JButton("3");
        b3.setFont(fontButton);

        b4 = new JButton("4");
        b4.setFont(fontButton);

        b5 = new JButton("5");
        b5.setFont(fontButton);

        b6 = new JButton("6");
        b6.setFont(fontButton);

        b7 = new JButton("7");
        b7.setFont(fontButton);

        b8 = new JButton("8");
        b8.setFont(fontButton);

        b9 = new JButton("9");
        b9.setFont(fontButton);

        bDot = new JButton(".");
        bDot.setFont(fontButton);

        b0 = new JButton("0");
        b0.setFont(fontButton);

        centerPanel.add(bErase);
        centerPanel.add(bClear);
        centerPanel.add(bPercent);
        centerPanel.add(bDivision);

        centerPanel.add(b1);
        centerPanel.add(b2);
        centerPanel.add(b3);
        centerPanel.add(bMultiple);

        centerPanel.add(b4);
        centerPanel.add(b5);
        centerPanel.add(b6);
        centerPanel.add(bMine);

        centerPanel.add(b7);
        centerPanel.add(b8);
        centerPanel.add(b9);
        centerPanel.add(bPlus);

        centerPanel.add(bPlusMine);
        centerPanel.add(b0);
        centerPanel.add(bDot);
        centerPanel.add(bEqual);

        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
        b5.addActionListener(this);
        b6.addActionListener(this);
        b7.addActionListener(this);
        b8.addActionListener(this);
        b9.addActionListener(this);
        b0.addActionListener(this);
        bDot.addActionListener(this);

        bClear.addActionListener(this);
        bErase.addActionListener(this);

        bPlus.addActionListener(this);
        bMine.addActionListener(this);
        bMultiple.addActionListener(this);
        bDivision.addActionListener(this);

        bPlusMine.addActionListener(this);
        bPercent.addActionListener(this);
        bEqual.addActionListener(this);

        field.addCaretListener(new CaretListener() {

            public void caretUpdate(CaretEvent event) {

                if (field.getText().length() >= 10)
                    field.setFont(new Font("Consolas", Font.BOLD, 25));

                if (field.getText().length() >= 13)
                    field.setFont(new Font("Consolas", Font.BOLD, 20));

                if (field.getText().length() >= 15)
                    field.setFont(new Font("Consolas", Font.BOLD, 19));

            }
        });

    }

    public void actionPerformed(ActionEvent event) {

        if (event.getSource().equals(b1))
            field.setText(field.getText() + "1");

        if (event.getSource().equals(b2))
            field.setText(field.getText() + "2");

        if (event.getSource().equals(b3))
            field.setText(field.getText() + "3");

        if (event.getSource().equals(b4))
            field.setText(field.getText() + "4");

        if (event.getSource().equals(b5))
            field.setText(field.getText() + "5");

        if (event.getSource().equals(b6))
            field.setText(field.getText() + "6");

        if (event.getSource().equals(b7))
            field.setText(field.getText() + "7");

        if (event.getSource().equals(b8))
            field.setText(field.getText() + "8");

        if (event.getSource().equals(b9))
            field.setText(field.getText() + "9");

        if (event.getSource().equals(bDot)) {

            if (field.getText().indexOf(".") == -1 && !field.getText().isEmpty())
                field.setText(field.getText() + ".");

        }

        if (event.getSource().equals(b0)) {

            /*
             * if (field.getText().isEmpty()) field.setText("");
             *
             * else
             */
            field.setText(field.getText() + "0");

        }

        if (event.getSource().equals(bClear)) {

            if (!field.getText().isEmpty()) {

                fNum = 0;
                sNum = 0;
                operation = null;
                field.setText(null);

            }

        }

        if (event.getSource().equals(bErase)) {

            if (!field.getText().isEmpty())
                field.setText(field.getText().substring(0, field.getText().length() - 1));

        }

        if (event.getSource().equals(bPlus)) {

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = "+";

            }

        }

        if (event.getSource().equals(bMine)) {

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = "-";
            }
        }

        if (event.getSource().equals(bMultiple)) {

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = "\u00D7";
            }
        }

        if (event.getSource().equals(bDivision)) {

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = "\u00F7";

            }

        }

        if (event.getSource().equals(bEqual)) {

            if (!field.getText().isEmpty() && operation != null) {

                sNum = Double.valueOf(field.getText());

                if (operation.equals("+"))
                    result = fNum + sNum;

                else if (operation.equals("-"))
                    result = fNum - sNum;

                else if (operation.equals("x"))
                    result = fNum * sNum;

                else if (operation.equals("\u00F7"))
                    result = fNum / sNum;

                else if (operation.equals("\u00D7"))
                    result = fNum * sNum;

                field.setText(String.valueOf(result));

            }

        }

        if (event.getSource().equals(bPlusMine)) {

            if (!field.getText().isEmpty()) {

                double num = Double.valueOf(field.getText());

                if (num > 0)
                    field.setText(String.valueOf(num - (num * 2)));

                else
                    field.setText(String.valueOf(Math.abs(num)));

            }

        }

    }

    }

For text field limit, I wrote this code in actionPerformed method
if (event.getSource().equals(bPlusMine)) {

    if (field.getText().length() > 16)
        field.setText(field.getText().substring(0, 16));
}

But the above code does not work and I can't use keyListener because textfield is disabled and can only get value from buttons

A: See the following code for a simple solution for calculating percent. It is meant for the output a result for the following sequence :
Enter a number followed by division operation
Enter a second number followed by percentage operation
If that is not the flow you have in mind (it was not explained in the post), you'll need to change the code.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;

public class Calculator extends JFrame implements ActionListener {

    private JPanel northPanel, centerPanel;

    private JTextField field;

    private JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b0;

    private JButton bPlus,  bMine, bMultiple, bDivision, bEqual;
    private JButton bClear, bErase, bPercent, bPlusMine, bDot;

    private double fNum, sNum, result;
    private String operation;

    private static final Font fontButton = new Font("Consolas", Font.BOLD, 20);
    private static final NumberFormat percentageFormat = NumberFormat.getPercentInstance();

    public static void main(String[] args) {

        new Calculator().setVisible(true);
    }

    public Calculator() {

        super("Calculator");

        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            percentageFormat.setMinimumFractionDigits(2);
            setSize(225, 300);
            setLocationRelativeTo(null);
            setResizable(false);
            setDefaultCloseOperation(EXIT_ON_CLOSE);

            setGUI();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void setGUI() {

        northPanel = new JPanel();
        add(northPanel, BorderLayout.NORTH);

        centerPanel = new JPanel();
        add(centerPanel, BorderLayout.CENTER);

        field = new JTextField(10);
        //limit text field to 16 characters
        field.setDocument(new JTextFieldLimit(16));
        field.setEnabled(false);
        field.setHorizontalAlignment(JTextField.RIGHT);
        field.setDisabledTextColor(Color.BLACK);
        field.setBackground(Color.WHITE);
        field.setFont(new Font("Consolas", Font.BOLD, 32));

        northPanel.add(field);

        //a repeated code is an opportunity for a method
        //the method also adds buttons to JPanel
        bErase = makeButton("<");
        bClear = makeButton("c");
        bPercent = makeButton("%");
        bDivision = makeButton("\u00F7");

        b1 = makeButton("1");
        b2 = makeButton("2");
        b3 = makeButton("3");
        bMultiple = makeButton("\u00D7");

        b4 = makeButton("4");
        b5 = makeButton("5");
        b6 = makeButton("6");
        bMine = makeButton("-");

        b7 = makeButton("7");
        b8 = makeButton("8");
        b9 = makeButton("9");
        bPlus = makeButton("+");

        bPlusMine = makeButton("±");
        b0 = makeButton("0");
        bDot = makeButton(".");
        bEqual = makeButton("=");

        field.addCaretListener(new CaretListener() {

            @Override
            public void caretUpdate(CaretEvent event) {

                //use if - else for more efficient code

                if (field.getText().length() >= 15) {
                    field.setFont(new Font("Consolas", Font.BOLD, 19));
                }
                else if (field.getText().length() >= 13) {
                    field.setFont(new Font("Consolas", Font.BOLD, 20));
                }

                else if (field.getText().length() >= 10) {
                    field.setFont(new Font("Consolas", Font.BOLD, 25));
                }
            }
        });
    }

    @Override
    public void actionPerformed(ActionEvent event) {

        //only one if is executed each time, so use if - else
        //or switch

        //get the text from clicked button
        String text = ((JButton)event.getSource()).getText();
        if(isInteger(text)) {
            field.setText(field.getText() + Integer.parseInt(text));
        }

        else if (text.equals(".")) {

            if ((field.getText().indexOf(".") == -1) && !field.getText().isEmpty()) {
                field.setText(field.getText() + ".");
            }
        }

        else if (text.equals("c")) {

            if (!field.getText().isEmpty()) {

                fNum = 0;
                sNum = 0;
                operation = null;
                field.setText(null);
            }
        }

        else if (text.equals("<")) {

            if (!field.getText().isEmpty()) {
                field.setText(field.getText().substring(0, field.getText().length() - 1));
            }
        }

        else if (text.equals("+")) {

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = text;
            }

        }

        else if (text.equals("-")) {

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = text;
            }
        }

        else if (text.equals("\u00D7")) { //multiply

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = text;
            }
        }

        else if (text.equals("\u00F7")) {//divide

            if (!field.getText().isEmpty()) {

                fNum = Double.valueOf(field.getText());
                field.setText(null);
                operation = text;
            }
        }

        else if (text.equals("%")) {

            if (("\u00F7").equals(operation)) { //% applies only after divide

                sNum = Double.valueOf(field.getText());
                field.setText(String.valueOf(percentageFormat.format(fNum/sNum)));
                operation = null;
            }
        }

        else if (text.equals("=")) {

            if (!field.getText().isEmpty() && (operation != null)) {

                sNum = Double.valueOf(field.getText());

                if (operation.equals("+")) {
                    result = fNum + sNum;
                } else if (operation.equals("-")) {
                    result = fNum - sNum;
                } else if (operation.equals("x")) {
                    result = fNum * sNum;
                } else if (operation.equals("\u00F7")) {
                    result = fNum / sNum;
                } else if (operation.equals("\u00D7")) {
                    result = fNum * sNum;
                }

                field.setText(String.valueOf(result));
            }
        }

        else if (event.getSource().equals(bPlusMine)) {

            if (!field.getText().isEmpty()) {

                double num = Double.valueOf(field.getText());

                if (num > 0) {
                    field.setText(String.valueOf(num - (num * 2)));
                } else {
                    field.setText(String.valueOf(Math.abs(num)));
                }
            }
        }
    }

    private boolean isInteger(String text) {

        try {
            Integer.parseInt(text);
        } catch (NumberFormatException e) {
            return false;
        }

        return true;
    }

    private JButton makeButton(String text) {

        JButton button = new JButton(text);
        button.setFont(fontButton);
        button.addActionListener(this);
        centerPanel.add(button);

        return button;
    }
}

//source : https://stackoverflow.com/a/10136854/3992939
class JTextFieldLimit extends PlainDocument {
    private int limit;
    JTextFieldLimit(int limit) {
        super();
        this.limit = limit;
    }

    JTextFieldLimit(int limit, boolean upper) {
        super();
        this.limit = limit;
    }

    @Override
    public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException {
        if (str == null) {
            return;
        }

        if ((getLength() + str.length()) <= limit) {
            super.insertString(offset, str, attr);
        }
    }
}

I would also recommend to improve the code implementing to following changes:
//Constants  (better use enum)
    private final static String BACK ="<", CLEAR="c", DIVIDE = "\u00F7", MULTIPLY = "\u00D7",
                MINUS = "-", PLUS = "+", PLUS_MINUS = "±" , DOT = ".", EQUAL = "=" ;
    //buttons text in the same order as appear on calculator
    private final String[] buttonText = {
        BACK,CLEAR,"%",DIVIDE,"1","2","3",MULTIPLY,"4","5","6",MINUS,"7","8"
        ,"9",PLUS,PLUS_MINUS,"0",DOT,EQUAL
    };
    /* remove redundant code
    private JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b0;
    private JButton bPlus,  bMine, bMultiple, bDivision, bEqual;
    private JButton bClear, bErase, bPercent, bPlusMine, bDot;
    */

Add a method to make all buttons:
private void makeButtons() {

        for(String text : buttonText) {
            JButton button = new JButton(text);
            button.setFont(fontButton);
            button.addActionListener(this);
            centerPanel.add(button);
        }
}

And modify setGUI()
        makeButtons(); //replaces all the following code

        /*remove redundant code
         //a repeated code is an opportunity for a method
        //the method also adds buttons to JPanel
        bErase = makeButton("<");
        bClear = makeButton("c");
        bPercent = makeButton("%");
        bDivision = makeButton("\u00F7");

        b1 = makeButton("1");
        b2 = makeButton("2");
        b3 = makeButton("3");
        bMultiple = makeButton("\u00D7");

        b4 = makeButton("4");
        b5 = makeButton("5");
        b6 = makeButton("6");
        bMine = makeButton("-");

        b7 = makeButton("7");
        b8 = makeButton("8");
        b9 = makeButton("9");
        bPlus = makeButton("+");

        bPlusMine = makeButton("±");
        b0 = makeButton("0");
        bDot = makeButton(".");
        bEqual = makeButton("=");

         */

Here is a link to amended code.


text:
Q: php query for inserting data in database table is not working This is a query for inserting some products in 'products' table of database.
The bold line of variable $insert_pro line is not working and saving the data in table while the 'insert into' is working good.. Please help me to find a mistake
$insert_product = "INSERT INTO products (product_cat, product_brand,
  product_title, product_price, product_desc, product_image, product_keyword)
  = VALUES ('$product_cat', '$product_brand', '$product_title',
  '$product_price', '$product_desc','$product_image', '$product_keyword')";

  **$insert_pro = mysqli_query($con, $insert_product);**

if($insert_pro) {

    echo "<script>alert('Product has been inserted')</script>";
    echo "<script>window.open('insert_products.php', '_self')</script> ";
  }

A: Problem seems to be "=" sign before VALUES in your query
INSERT INTO products (product_cat, product_brand,
  product_title, product_price, product_desc, product_image, product_keyword)
= VALUES ('$product_cat', '$product_brand', '$product_title',
  '$product_price', '$product_desc','$product_image', '$product_keyword')


text:
Q: Display multiple guiqwt images (plots) in one window - Python 2.7.10 I create plots using guiqwt and display them in 12 windows (each window displays one plot with few curves (1 to 4)). How can I show all plots in one window?

Thanks!


text:
Q: Crm 2015 Javascript Context is not defined from fetchxml I want to get values from fetchxml using javascript in html web resource.I use crm 2015. The code block is in the attachment on picture.
After the fetchxml, I try to get values with soap function.
it gives me the error

Error: Contex is not available

I added the xrmservicetoolkit for crm 2015 and jquery and json files. What is the problem? How can I solve this? Can anyone help me please?
var fetch = "<fetch version='1.0' mapping='logical'><entity name='quote'>";
  fetch += "<all-attributes />";
  fetch += "<filter type='and'>";
  fetch += "<condition attribute='new_anabayi' operator='eq' value='" + id + "' />";
  fetch += "<condition attribute='statuscode' operator='eq' value='1' />";
  fetch += "<condition attribute='customertypecode' operator='eq' value='7' />";
  fetch += "</filter></entity></fetch>";

var fetchData = XrmServiceToolkit.Soap.Fetch(fetch);

A: Add a reference to ClientGlobalContext.js on your web resource.
<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>

I am assuming you already have referenced the following scripts too?
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript" src="XrmServiceToolkit.js"></script>


text:
Q: Why doesn't my shoot code in pygame work? I'm making a submarine game in pygame and I tried to make my submarine shoot bullets. I've tried the code, that I used in my other pygame project, however it doesn't work in this one. Compiler doesn't give any error, but when I press space, it won't  shoot. I tried to find a mistake, but I couldn't. I also tried to browse Stack Overflow, but didn't find the answer I was looking for.
Here's the code:
import pygame

pygame.init()
run = True
screen = pygame.display.set_mode((600, 500))
pygame.display.set_caption('Podmornca')
desno = pygame.image.load('podmornicaD.png')
levo = pygame.image.load('podmornica.png')
ozadje = pygame.image.load('ozadje.png')
torpedoD = pygame.image.load('torpedo.png')
torpedoL = pygame.image.load('torpedoL.png')
class podmornica():
    def __init__(self, x, y, v):
        self.x = x
        self.y = y
        self.v = v
        self.ziv = 100
        self.levo = False
        self.desno = True
    def naris(self):
        if self.levo:
            screen.blit(levo, (self.x, self.y))
        elif self.desno:
            screen.blit(desno, (self.x, self.y))
class torpedo():
    def __init__(self, x, y, smer):
        self.x = x
        self.y = y
        self.smer = smer
        self.v = 5 * smer
    def naris(self, screen):
        if self.smer < 0:
            screen.blit(torpedoD, (self.x, self.y))
        else:
            screen.blit(torpedoL, (self.x, self.y))
igralec = podmornica(150, 300, 10)
#the list of bullets:
metki = []
def grafika():
    screen.blit(ozadje, (0,0))
    igralec.naris()
    #Here is code for displaying the bullets
    for metek in metki:
        metek.naris(screen)
    pygame.display.flip()
while run:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
    #This piece of code is for moving of bullets:
    for metek in metki:
        if metek.x < 600 and metek.x > 0:
            metek.x +=  metek.v
        else:
            metki.pop(metki.index(metek))
    if event.type == pygame.KEYDOWN and event.key == pygame.K_UP and igralec.y > 10:
        igralec.y -= 3
    if event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN and igralec.y < 350:
        igralec.y += 3
    if event.type == pygame.KEYDOWN and event.key == pygame.K_LEFT:
        igralec.levo = True
        igralec.desno = False
    if event.type == pygame.KEYDOWN and event.key == pygame.K_RIGHT:
        igralec.levo = False
        igralec.desno = True
    #the trigger for bullet:
    if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:
        if igralec.levo:
            smer = -1
        else:
            smer = 1
        if len(metki) < 5:
            metki.append(torpedo(igralec.x, igralec.y, smer))
    grafika()
pygame.quit()

A: The events have to be handled in the event loop. If you want to achieve a smooth movement, then you have get the key states by pygame.key.get_pressed().
Furthermore the bullets move much to fast. Control the frames by pygame.time.Clock() respectively .tick(). e.g:
FPS = 60
clock = pygame.time.Clock()
while run:
    clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
        elif event.type == pygame.KEYDOWN:
            #the trigger for bullet:
            if event.key == pygame.K_SPACE:
                if igralec.levo:
                    smer = -1
                else:
                    smer = 1
                if len(metki) < 5:
                    metki.append(torpedo(igralec.x, igralec.y, smer))

    # This piece of code is for moving of bullets:
    for metek in metki[:]:
        if metek.x < 600 and metek.x > 0:
            metek.x += metek.v
        else:
            metki.remove(metek)

    keys = pygame.key.get_pressed()
    if keys[pygame.K_UP] and igralec.y > 10:
        igralec.y -= 3
    if keys[pygame.K_DOWN] and igralec.y < 350:
        igralec.y += 3
    if keys[pygame.K_LEFT]:
        igralec.levo = True
        igralec.desno = False
    if keys[pygame.K_RIGHT]:
        igralec.levo = False
        igralec.desno = True
    grafika()


text:
Q: arbitrary method names in javascript object I'm learning more about javascript OOP by rolling my own console.log variant with some extra features I want.
So far I have
debug = {
        consoleAvailable :  (typeof console == "object"),
        reportToConsole : 0,
        list            : [],
        setReporting    : function(level){
                            this.reportToConsole = level;
                            return true;
                        },
        log             : function(){
                            if (this.reportToConsole>0 && this.consoleAvailable && typeof console.log=="function")  console.log.apply(console, this.log.arguments);
                            this.list.push({'type':'log', 'msg':this.log.arguments});
                            return true;
                        },
};

This is all working nicely, but I don't want to have to list all of the log,error,warning etc functions. Instead I would like to be able to just type debug.[something] and for a function to interpret that [something] and execute it in the same way as I have the log function working.
Is this even possible? If so how do I go about it?
Here is some examples of what I would like to be able to do.
debug.setReporting(1); //yes, I want to print to console

debug.log('foo', 'bar', 'baz'); //arbitrary number of arguments (this is already working)
debug.error('qux'); //function I haven't named, but there is a console.error function
debug.arbitraryName([1, 2, 3]); //no function for console.arbitraryName (ideally it would just console.log the argument(s)

Edit
Ok, it looks like @Rob W's method is the way to go, however I am having trouble implementing. It seems that I am not passing the name of the function correctly or similar. I have a fiddle here showing the problem http://jsfiddle.net/xiphiaz/mxF4m/
Conclusion
It looks like there is too many browser quirks to get a truly generic debugger without writing browser specific code, so instead I have just listed my most used log functions (log, warning and error). This does give me the option to further customize result of each of these functions.
result:
debug = {
    consoleAvailable :  (typeof console == "object"),
    reportToConsole : 0,
    list            : [],
    setReporting    : function(level){
                        this.reportToConsole = level;
                        return true;
                    },
    log             : function(){
                        if (this.reportToConsole>0 && this.consoleAvailable && typeof console.log=="function")  console.log.apply(console, this.log.arguments);
                        this.list.push({type:'log', msg:this.log.arguments});
                        return true;
                    },
    warn            : function(){
                        if (this.reportToConsole>0 && this.consoleAvailable && typeof console.warn=="function") console.warn.apply(console, this.warn.arguments);
                        this.list.push({type:'warn', msg:this.warn.arguments});
                        return true;
                    },
    error           : function(){
                        if (this.reportToConsole>0 && this.consoleAvailable && typeof console.error=="function")    console.error.apply(console, this.error.arguments);
                        this.list.push({type:'error', msg:this.error.arguments});
                        return true;
                    }
};

debug.setReporting(1);

debug.log('foo', 'bar', 'baz');
debug.error('qux');
debug.warn({test:"warning"});
console.log(debug.list);

A: You can get an array of all properties (including non-enumerable ones) using the Object.getOwnProprtyNames method. Then, enumerate through it, and check whether the console[key] is a function. If yes, extend your own object with the method.
Object.getOwnPropertyNames(console)

As for your last quesion, there's a non-standard __noSuchMethod__ method which intercepts calls to undefined functions.
I strongly recommend to use my first proposed method, because the console method will not magically grow bigger. It also makes debugging easier.


text:
Q: Array for Column Headers I am attempting to store all of the column headers in an array that I can then use to populate a UserForm. This would allow the different headers to act as column selection for later code. However, I cannot seem to get the array to assign correctly
I have attempted different looping structures but continue to be met with "Subscript out of range" errors
Option Explicit

Sub Audit_Template_Autofill()

    Dim column_id() As Variant, A1 As Range, z As Range, c As Range
    Dim x As Long, column_count As Long

    Set A1 = Range("A1")

    Set z = A1.End(xlToRight).Offset(0, 1)

    column_count = Range(A1, z).Count

    x = 0
    For Each c In Range(A1, z)
         column_id(x) = c.Value
         x = x + 1
    Next c
End sub

I was originally testing the assignment by using
For each c in range(A1, z)
     debug.print = c.value
next c

which accurately printed all of my headers, I just cannot seem to assign them into the array correctly. I apologize for the code not being overly clean, this is more of a testing exercise to implement in a larger model. I have done this sort of loop before, but I cannot seem to recall how I wrote it.
Thanks!

A: Assign headers to Array
The easiest way is to

*

*[1] create a (1-based) 2-dimensional array by assigning a range's value to headers

*[2] make it a "flat" 1-dim array (btw 1-based, too) via double transposition;
   (note that this isn't possible by ReDim Preserve which allows only to redimension the last (here: 2nd Dimension), but not to "remove" a Dimension).

BTW Your original code lacks of a ReDim column_id(0 To …) before starting the loop assignments to make it "work"; furthermore the variable x defaults to 0 automatically by declaring it. Suggest to fully qualify your range references, etc.
Sub Columns2Array()
Dim headers() As Variant
  ' [1] create a (1-based) 2-dimensional array by assigning a range's value to headers
    headers = Sheet1.Range("A1:" & Sheet1.Range("A1").End(xlToRight).Address)
  ' [2] make it a "flat" 1-dim array (btw 1-based, too) via double transposition
    headers = Application.Transpose(Application.Transpose(headers))

  ' a) test headers items by one code line
    Debug.Print Join(headers, ",")
  ' b) test headers via loop
    Dim colNo&
    For colNo = LBound(headers) To UBound(headers)
        Debug.Print "headers(" & colNo & ") = ", headers(colNo)
    Next colNo
End Sub


text:
Q: simplest way to make a scrollbar scroll with jquery animation i want to make a div scrollbar to scroll content with easing animation. is it possible to do using jquery in few lines of codes?
http://jsfiddle.net/aHVpA/
$(".motorcycles-wrapper").animate({scroll: '+=50'}, 1000, 'easeOutQuad');

here is the html code
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>

        Falcone

        V7 Special

        V7 Special

        V7 Special

A: You need to use scrollTop or scrollLeft depending on the direction you want to scroll towards.
$(".motorcycles-wrapper").animate({
    scrollTop: "+=50"
    }, 1000);

^ this would scroll 50 downwards.
$(".motorcycles-wrapper").animate({
    scrollLeft: "+=50"
    }, 1000);

^ this would scroll 50 rightwards.


text:
Q: I need to migrate data from one old table to a new table by storing appropriate CityId instead CityName I'm migrating data from one table to another table in SQL Server, In this process what I need to do is "I have 10 columns in old table one column is 'CityName' which is varchar and in the new table, I have a column 'CityId' which is an integer. And I have other table which has data about city id and names. I need store the appropriate cityId in new table instead of CityName. Please help me. Thanks in advance.

A: You'll need to join the source table to the CityName field in the city information table:
INSERT INTO dbo.Destination (CityID, OtherStuff)
SELECT t1.CityID, t2.OtherStuff
FROM CityInformationTable t1
INNER JOIN SourceTable t2
ON t1.CityName = t2.CityName

A: Below should give you an idea, you need to inner join to your look up table to achieve this.
declare @t_cities table (Id int, City nvarchar(20))

insert into @t_cities
    (Id, City)
values
    (1, 'London'),
    (2, 'Dublin'),
    (3, 'Paris'),
    (4, 'Berlin')

declare @t table (City nvarchar(20), SomeColumn nvarchar(10))

insert into @t
values
    ('London', 'AaaLon'),
    ('Paris', 'BeePar'),
    ('Berlin', 'CeeBer'),
    ('London', 'DeeLon'),
    ('Dublin', 'EeeDub')

declare @finalTable table (Id int, SomeColumn nvarchar(10))

insert into @finalTable
select c.Id, t.SomeColumn
from @t t
    join @t_cities c on c.City = t.City

select * from  @finalTable

Output:
Id  SomeColumn
1   AaaLon
3   BeePar
4   CeeBer
1   DeeLon
2   EeeDub


text:
Q: C++ general tree iterator - backward paths I'd like to define an iterator over a general tree. Here is an example(from wikipedia) of binary one:

Iterator should allow me to traverse this tree structure in pre-order. I can easily achieve that using std::stack (get the Node from stack, set as current one, add it's children to the stack).
But I wish I get also nodes, which are on the "backward".
Nodes at example picture should be visited in a following order:
F, B, A, B*, D, C, D*, E, D*, B*, F*, G, I, H
'*' - means that node is visited in a backward.
Iterator should also store information if it is a "normal" visit, or backward one.
Which approach would you take to handle that?


text:
Q: insert once using check if query exist mysqli how to insert only once with insert SQL? says it like this
"INSERT INTO table(`id`,`name`,`address`) VALUES ('$id,$name,$address')"

"check if exist" only work in creating a new table but does it able to apply to new record?
I can't set address / name to be appear once as 2 or more name could have the same adress.

A: You can do multiple things:

*

*Set ID as primary key (if it isn't already), that will prevent duplicate values from being added.

*Set column to UNIQUE, thus MySQL will throw an error and prevent duplicates in this column.


text:
Q: Linux equivalent to Direct draw As a c# programmer, I'm used to Microsoft, however, I'm really liking the linux side of things and Mono opens up that world to me a lot better (imo).
I have an app that may need some direct draw support in order to display active video, and I'm curious as to what the equivalent (and even better, what support does Mono provide) in linux?

A: OpenGL is equivalent to DirectDraw in Linux/BSD and Mac(and in Windows too).

A: The short answer is no, there is no DirectX support/emulation planned for the Mono framework, or for Linux in general.  The closest you can get at the moment is to use an emulation layer like Wine or Cedega to run a windows app within Linux... which is not necessarily a perfect solution in many cases.
The alternative is to use a cross-platform library that will function the same on multiple platforms.  The C# SDL project will apparently run on Mono, which should give you a consistent interface for graphical operations.  It's based on libsdl which is fairly mature, and there are plenty of examples out there.


text:
Q: How would I go about determining if these subsets are subspaces of a vector space? What would be the correct method/approach to evaluate if these two subsets are indeed subspaces of a vector space?
a) $S{1}=\{x\in\mathbb{R}^{29}| x_1+2x_2+3x_3+...+29x_{29}=0\} $
b) $S{2}=\{p\in P_{29}| p(0)=p´(0)=0\}$
For the first expression, I'm thinking about vector x as being linearly independent and solved by the trivial solution x = 0. Then it should have the same or lower dimension than $S_1$ in $\mathbb{R}^{29}$, thus being a subspace. Am I correct?
For the second expression(/equation?) I have no idea how to interpret how e.g.
$p(0)$ or the derivative $p´(0)$ is related to "$P_{29}$".

A: I don't understand your argument for the first question (i.e. linguistic comprehension). You should check the following:
$$\forall x_1, x_2 \in S_1, \forall a, b \in \mathbb{R}: a x_1 + b x_2 \in S_1$$
i.e. every linear combination of elements of $S_1$ again belongs to $S_1$. While it is true that $0$ needs to be an element of $S_1$ in order for it to be a subspace, this is by no means sufficient, and by checking the condition I gave, this will automatically be fulfilled.
For the second, do you know what $P_{29}$ is? And if so, do you see why it is a vector space?

A: For (a), try to find wich linear fonction S1 is the Kernel. ( I assume you know that if F is a linear fonction, then Ker(f) is a subspaces of a vector space.)
What is $P_{29}$?


text:
Q: How do I can differentiate the customer login and admin login in the firebase? I am Developing an web app which is based upon React and firebase in that I am using email and password for signing in  and signup, so I want to differentiate the admin and customer.
How it possible in Firebase? Please suggest me to resolve my issues.


text:
Q: Which technique should work to change a tumblr theme background? I'm baffled.  This should be rudimentary for me, but I have to admit, nothing has worked so far.  I have a tumblr log (http://tropedart.tumblr.com) and I am trying to use an image as a background in an already existing theme.  The image is stored both on my server in a public folder and on tumblr's servers.  Here's what I've tried:
I've edited the custom HTML with the following:
<body style="background-image: url('http://russellbits.com/public-images/bkgd-page.jpg') fixed top left repeat;">
I've edited the custom CSS with:
body { background-image: url('http://russellbits.com/public-images/bkgd-page.jpg') fixed top left repeat; }
I've also tried to use the template tags in the custom CSS:
background: {color:Background} url('{image:http://24.media.tumblr.com/tumblr_mcs0mnVfx71rsijsso1_400.jpg}') top left fixed repeat;
None of these efforts have succeeded. I'm almost embarrassed to ask, because this is simple CSS stuff that I know all too well. But what can I say?

A: Your theme uses an unintuitive method to set the background image. Instead of a proper background image, there's just a big element stretched over the entire page.
Take a look at line 127 of your stylesheet:
.noise {
    background: #EEEEEE url("http://static.tumblr.com/xcxngn2/Iz0ld1v2h/bg.png") repeat;
}

To override this style, just put this CSS into your custom stylesheet:
.noise {
    background: #EEEEEE url("http://russellbits.com/public-images/bkgd-page.jpg") repeat;
}


text:
Q: Jetpack navigation: Title and back/up arrow in the action bar? I have installed the latest canary version of Android Studio, and followed this (https://developer.android.com/topic/libraries/architecture/navigation/navigation-implementing) instruction to implement a simple two page navigation. Basically page1 has a button, and when it is clicked, the app shows page2.
It works, but there is one problem... It does not seem to do anything with the action bar automatically. Is it supposed to show up/back arrow and the "Label" attribute on the action bar automatically by the navigation library? Or am I supposed to do all the work manually as before? I want to show the back arrow and "Details" on action(tool) bar when page2 is showing.
On button click at page 1.
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
{
    button1.setOnClickListener {
        val nav = NavHostFragment.findNavController(this);
        nav.navigate(R.id.show_page2)
    }
}

Main activity XML. By default it was the default Action Bar, I have replaced it with a ToolBar. There was no difference.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_height="?attr/actionBarSize"
        android:elevation="4dp"
        android:background="?attr/colorPrimary"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        android:layout_width="match_parent">
    </androidx.appcompat.widget.Toolbar>

    <fragment
        android:id="@+id/my_nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:defaultNavHost="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar"
        app:navGraph="@navigation/nav_graph"/>

</androidx.constraintlayout.widget.ConstraintLayout>

Nav graph XML.
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+id/nav_graph"
            app:startDestination="@id/page1">

    <activity
        android:id="@+id/mainActivity2"
        android:name="com.android.navtest.MainActivity"
        android:label="activity_main"
        tools:layout="@layout/activity_main"/>
    <fragment
        android:id="@+id/page1"
        android:name="com.android.navtest.BlankFragment2"
        android:label="Home page"
        tools:layout="@layout/page1">
        <action
            android:id="@+id/show_page2"
            app:destination="@id/page2"
            app:enterAnim="@anim/anim1"
            app:popExitAnim="@anim/anim2"/>
    </fragment>
    <fragment
        android:id="@+id/page2"
        android:name="com.android.navtest.BlankFragment"
        android:label="Details"
        tools:layout="@layout/page2"/>
</navigation>

A: This is what I have done.
 onSupportNavigateUp is called when the user navigates up and it set again. by calling this setupActionBarWithNavController tell android to update the title of toolbar.

navigateUp Handles the Up button by delegating its behavior to the given NavController. This should generally be called from AppCompatActivity.onSupportNavigateUp().
private lateinit var appBarConfiguration: AppBarConfiguration

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding: ActivityGameConfigBinding =
            DataBindingUtil.setContentView(this, R.layout.activity_game_config)
        supportActionBar?.show()

        val navController = Navigation.findNavController(this, R.id.myNavHostFragment)
        NavigationUI.setupActionBarWithNavController(this, navController, null)
        appBarConfiguration = AppBarConfiguration.Builder(navController.graph)
            .build()

        NavigationUI.setupWithNavController(binding.navView, navController)
    }
    override fun onSupportNavigateUp(): Boolean {
        val navController = Navigation.findNavController(this, R.id.myNavHostFragment)
        return NavigationUI.navigateUp(navController, appBarConfiguration)
    }

A: You can connect your ActionBar to a NavController using NavigationUI.setupActionBarWithNavController(). This is generally done in your Activity, right after you call setSupportActionBar():
supportActionBar = findViewById<Toolbar>(R.id.toolbar)

// Get the NavController for your NavHostFragment
val navController = findNavController(R.id.nav_host_fragment)

// Set up the ActionBar to stay in sync with the NavController
setupActionBarWithNavController(navController)

This approach is covered in the Navigation talk at Google I/O 2018.

A: my solution with binding - the code is in MainActivity
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    binding = DataBindingUtil.setContentView(this, R.layout.main_activity)
    navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
    navController = navHostFragment.navController

    setSupportActionBar(toolbar)//needs to be after binding
    toolbar.setupWithNavController(navController,AppBarConfiguration(navController.graph))
}

as for the titles - first I removed labels (android:label) from the fragments in navigation graph (label overwrites title from what I've tested)
    <fragment
        android:id="@+id/productListFragment"
        android:name="com.example.ProductListFragment"
        android:label="TO_BE_REMOVED"
        tools:layout="@layout/product_list_fragment">
        <action
            android:id="@+id/action_productListFragment_to_mainMenuFragment"
            app:destination="@id/mainMenuFragment" />
    </fragment>

each fragment sets the title and subtitle in onResume, here example from ProductListFragment
override fun onResume() {
    super.onResume()
    val actionBar = (activity as AppCompatActivity).supportActionBar
    actionBar?.title = getString(R.string.product_list_title)
    actionBar?.subtitle = getString(R.string.product_list_subtitle)
}

A: If you want to have navigation back button hidden in more than one place (default is only for home fragment) you can add ids of fragments to AppBarConfiguration and pass this as second parameter of setupActionBarWithNavController, for example:
val appBarConfiguration = AppBarConfiguration(setOf(R.id.splashFragment, R.id.onboardingFragment, R.id.homeFragment))

setupActionBarWithNavController(findNavController(R.id.nav_host), appBarConfiguration)


text:
Q: Marshalling data back to UI Thread from within Async Action I've got an ICommand that needs to set data to a property on the UI Thread.
public override async void Execute(object parameter)
{
    var vm = (MyVm)parameter;
    var data = await _myDataService.GetData();
    vm.MyData = data; // must be set on UI Thread due to binding.
}

Now I want to wrap my call in an event logger (I originally wanted to do AOP and decorate the method with a logging attribute, but I couldn't figure it out in a PCL). So I moved onto wrapping my call like this.
public override void Execute(object parameter)
{
    EventLogger.LogEvent(this,
        EventLogEntryType.Command,
        EventLogErrorSeverity.Warning,
        Errors.GetServiceAreaCommand_ErrorMessage,
        async () =>
        {
            var vm = (MyVm)parameter;
            var data = await _myDataService.GetData();
            vm.MyData = data; // must be set on UI Thread due to binding.
        });
}

Here's the LogEvent method.
public static void LogEvent(object sender,
    EventLogEntryType entryType,
    EventLogErrorSeverity eventLogErrorSeverity,
    string friendlyErrorMessage,
    Action action)
{
    var name = sender.GetType().Name.SplitCamelCase();
    var startEntry = new EventLogEntry(entryType);
    LogEvent(string.Format("Start: {0}", name), startEntry);

    try
    {
        action.Invoke();
    }
    catch (Exception ex)
    {
        var exEntry = new EventLogEntry(EventLogEntryType.Error, friendlyErrorMessage, false, ex)
        {
            ErrorSeverity = eventLogErrorSeverity
        };
        LogEvent(string.Format("Error: {0}", name), exEntry);
        if (eventLogErrorSeverity == EventLogErrorSeverity.Critical)
        {
            throw;
        }
    }
    var endEntry = new EventLogEntry(entryType);
    LogEvent(string.Format("Finish: {0}", name), endEntry);
}

The problem is that it appears as though I'm STILL setting the property on a background thread instead of the Main thread (IllegalStateException in Android).
What is the cleanest way to set the data as is being done in the first example, while still wrapping the Action in a logging method?

I also had success creating a base class for ICommand, but it A) changed the method signatures for CanExecute and Execute, and B) it also (obviously) doesn't extend it's capabilities beyond Commands.
I'm looking for a clean way to log methods (BeforeExecute, AfterExecute, OnError) no matter what they do.

As an aside, the ideal logging mechanism would be to use an Interceptor, but I'm just not strong enough in my C# chops to implement it.
[Log(EventLogEntryType.Command, EventLogErrorSeverity.Warning, "Some Friendly Message")]
public override async void Execute(object parameter)
{
    var vm = (MyVm)parameter;
    var data = await _myDataService.GetData();
    vm.MyData = data; // must be set on UI Thread due to binding.
}

A: If you have (caveat below) access to the Activity object in your code then you can probably do;
Activity.RunOnUiThread(() => {
    //Execute my code on UIThread here
});

But it's an if, because I note you're using a PCL, or have referenced using one, so I suspect that a shared library is not going to know anything about the Activity (unless you pass that too).  Very much depends on your app structure and where this code is, but within the main Xamarin.Android project where your views are the above should work


text:
Q: Can't understand why SQL table won't update on statement In a survey, a row with the question name 3a should equal the sum of the responses from the questions with the names 1a and 2a. This is the code I have:
UPDATE acrl.ACRLData_Edited_Test
SET question_textvalue =
    cast(
     (SELECT question_textvalue
       FROM acrl.ACRLData_Edited_Test a2
       WHERE a2.ipeds_id = a.ipeds_id
           and a2.question_name = a.question_name and a2.question_name LIKE '1a.%'
     ) as decimal(10,2))
    + cast(
     (SELECT question_textvalue
        FROM acrl.ACRLData_Edited_Test a2
        WHERE a2.ipeds_id = a.ipeds_id
            and a2.question_name = a.question_name and a2.question_name LIKE '2a.%'
     ) as decimal(10,2))
FROM acrl.ACRLData_Edited_Test a
WHERE a.question_name LIKE '3a.%'

But it doesn't seem to work at all. When I run it, the survey responses/rows with the question 3a" still show Null, instead of the number.
For example, I have an entry with the 1a response as 4.7, the 2a response as 3.9 and the 3a response is NULL. It should be 8.6 in that scenario.

A: I see this in the nested query in the first case expression:
 a2.question_name = a.question_name and a2.question_name LIKE '1a.%'

and also this in the final WHERE clause:
a.question_name LIKE '3a.%'

Logically, the a2.question_name = a.question_name condition means our question_name values must satisfy both WHERE clauses: the a.question_name restriction from the main outer WHERE clause and the a2.question_name restriction in the inner nested WHERE clause. It can only match records where the value is both LIKE '3a.%' and LIKE '1a.%'.
Those things cannot both be true, and therefore all the 3a.% records will become NULL even if they weren't before. The same issue applies to the second case expression as well.
Also, the . has specially meaning in a LIKE match and adds no value here. You may as well use LIKE '3a%', LIKE '1a%', etc, but LIKE '3a[.] %' is most exact.

A: What result are you getting if you run the below select statement?
SELECT a.question_name,
    cast(
         (SELECT question_textvalue
           FROM acrl.ACRLData_Edited_Test a2
           WHERE a2.ipeds_id = a.ipeds_id
               and a2.question_name = a.question_name and a2.question_name LIKE '1a.%'
         ) as decimal(10,2)) as SubQuery1,
    cast(
         (SELECT question_textvalue
            FROM acrl.ACRLData_Edited_Test a2
            WHERE a2.ipeds_id = a.ipeds_id
                and a2.question_name = a.question_name and a2.question_name LIKE '2a.%'
         ) as decimal(10,2))  as SubQuery2
    FROM acrl.ACRLData_Edited_Test a
    WHERE a.question_name LIKE '3a.%'

Does any of the two subquery columns return NULL value? If so, try enclosing it with ISNULL( cast(...),0) + ISNULL( cast(...),0).


text:
Q: ASP.NET - Localization using SQL database with good performance As part of the ASP.NET website I maintain localization/text translations are handled using text stored in a SQL database and not using ResX files; why it is done this way is down to legacy but that is what we do but it does allow us to make changes fairly easily. Text is stored in a table like this:
CREATE TABLE [Text](
    [TextID] [int] NOT NULL,
    [LanguageID] [int] NOT NULL,
    [Text] [nvarchar](max) NULL
)
CONSTRAINT [PK_Text] PRIMARY KEY CLUSTERED
(
    [TextID] ASC,
    [LanguageID] ASC
)

And the code-behind in the website will reference the text IDs for a chosen language to assign the correct text to the HTML elements such as labels etc.
Now because we have so much text available and hitting the database on each page request just to translate a page is so slow what we actually do is cache all the text in that table into server memory at application startup using the HttpApplicationState.
The problem we now have is that, because we have several web servers being load balanced, updating that static cache is becoming difficult; we now have to wait for the app pool to recycle before any changes made become visible. Also as the link above suggests:

...storing large blocks of data in application state can fill up server memory, causing the server to page memory to disk.

So what I would like to know is what other solution could I use? I need to be able to cache all this text for higher performance but also be able to update it more regularly than once a day, plus be able to manage this cache across multiple servers.

A: The term you're looking for is "distributed cache".  If you Google for that, you'll find some options that should help you.  Some advantages to a distributed cache:

*

*Data is stored in RAM, not disk.

*Data is distributed across many nodes and allows you to scale horizontally (just add a node).

*The cache will run on their own dedicated machines. This will alleviate the load on your web servers.

Some technologies to look into:

*

*AppFabric (works well with .NET): http://en.wikipedia.org/wiki/AppFabric#AppFabric_Caching

*Memcached: http://memcached.org/

*Couchbase: http://www.couchbase.com/
I've used AppFabric with .NET before and it worked very well for our company. It was easy to add nodes and grow as needed.


text:
Q: Exclude some JARs from Web-Inf/Lib Folder I'm starting with Ant. I created a build.xml to generate a WAR file of a Web Project and it worked OK.
Then, I made some change to exclude all *.jar from WEB-INF/lib Folder and also works OK.
Now I need to make the changes to exclude all JARs files, but leave some especial JARs in WEB-INF/lib Folder. This JARs are from other project created by me.
The idea es exclude all third parties JARs and only leave my own JARs inside WEB-INF/lib folder.
There is some way to do that?
All my Jars start with "fnet" so maybe I can use that to create some rule, but I don't know how to do that
This is my Build.xml:
<?xml version="1.0" ?>
<project name="warConLibs" default="build-war">
    <target name="clean">
        <delete file="c:/projweb.war"/>
        <delete file="c:/projweb_sl.war"/>
    </target>

    <target name="build-war">
        <war destfile="c:/projweb.war" webxml="./WebContent/WEB-INF/web.xml">
            <fileset dir="./WebContent">
                <include name="**/*.*"/>
            </fileset>

            <classes dir="./bin"/>
        </war>
    </target>

    <target name="build-war-sin-libs">
        <war destfile="c:/projweb_sl.war" webxml="./WebContent/WEB-INF/web.xml">
            <fileset dir="./WebContent">
                <include name="**/*.*"/>
                <exclude name="**/*.jar"/>
            </fileset>

            <classes dir="./bin"/>
        </war>
    </target>
</project>

A: The correct way to exclude a jar file is given in the documentation. If anyone face same issue, they can refer to this link.
This example is taken from the documentation, here we are removing jdbc1.jar from lib
Assume the following structure in the project's base directory:

thirdparty/libs/jdbc1.jar
thirdparty/libs/jdbc2.jar
build/main/com/myco/myapp/Servlet.class
src/metadata/myapp.xml
src/html/myapp/index.html
src/jsp/myapp/front.jsp
src/graphics/images/gifs/small/logo.gif
src/graphics/images/gifs/large/logo.gif
then the war file myapp.war created with

<war destfile="myapp.war" webxml="src/metadata/myapp.xml">
  <fileset dir="src/html/myapp"/>
  <fileset dir="src/jsp/myapp"/>
  <lib dir="thirdparty/libs">
    <exclude name="jdbc1.jar"/>
  </lib>
  <classes dir="build/main"/>
  <zipfileset dir="src/graphics/images/gifs"
              prefix="images"/>
</war>

will consist of
WEB-INF/web.xml
WEB-INF/lib/jdbc2.jar
WEB-INF/classes/com/myco/myapp/Servlet.class
META-INF/MANIFEST.MF
index.html
front.jsp
images/small/logo.gif
images/large/logo.gif

A: You may want to read again about the war Ant task: https://ant.apache.org/manual/Tasks/war.html
The correct syntax would be:
<war destfile="..." webxml="...">
    <lib dir="WebContent/WEB-INF/lib">
        <include name="fnet*.jar"/>
    </lib>
    <classes dir="bin"/>
</war>


text:
Q: Set image of specific UIImageView using UIImagePickerController I have an array of UIImageViews. I want to click on one of them and have the imagePickerController method set the correct image for the correct index of the UIImageView array.
var imageArray : [UIImageView]
...
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject:AnyObject]!){
    //What do I do here?
    self.dismissViewControllerAnimated(true, completion: nil)
}
func pickImage(sender: AnyObject)
{
    var imagePicker = UIImagePickerController()
    imagePicker.delegate = self
    imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
    self.presentViewController(imagePicker, animated: true, completion:nil)
    //what do I do here?
}

A: Need to maintain tapped UIImageView so when UIImage is picked from UIImagePickerController we can set it. Say its curImgView
Considering method is called when specific UIImageView is tapped :
func pickImage(sender: AnyObject)
{
    //setting currently tapped imageview here
    curImgView = sender;

    var imagePicker = UIImagePickerController()
    imagePicker.delegate = self
    imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
    self.presentViewController(imagePicker, animated: true, completion:nil)
}

Now when image is selected :
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject:AnyObject]!){

    //set image here
    curImgView.image = 'image here';
    self.dismissViewControllerAnimated(true, completion: nil)
}


text:
Q: Are root stacks characterized by their divisor multiplicities? Definitions/Background
Suppose $S$ is a scheme and $D\subseteq S$ is an irreducible effective Cartier divisor. Then $D$ induces a morphism from $S$ to the stack $[\mathbb A^1/\mathbb G_m]$ (a morphism to this stack is the data of a line bundle and a global section of the line bundle, modulo scaling). For a positive integer $k$, the root stack $\sqrt[k]{D/S}$ is defined as the fiber product
$\begin{matrix}
 \sqrt[k]{D/S} & \longrightarrow & [\mathbb A^1/\mathbb G_m] \\
  p\downarrow & & \downarrow \wedge k \\
  S & \longrightarrow & [\mathbb A^1/\mathbb G_m]
\end{matrix}$
where the map $\wedge k: [\mathbb A^1/\mathbb G_m]\to [\mathbb A^1/\mathbb G_m]$ is induced by the maps $x\mapsto x^k$ (on $\mathbb A^1$) and $t\mapsto t^k$ (on $\mathbb G_m$). The morphism $p:\sqrt[k]{D/S}\to S$ is a coarse moduli space and is an isomorphism over $S\smallsetminus D$. Moreover, there is a divisor $D'$ on $\sqrt[k]{D/S}$ such that $p^*D$ is $kD'$.
The data of a morphism from $T$ to $\sqrt[k]{D/S}$ is equivalent to the data a morphism $f:T\to S$ and a divisor $E$ on $T$ such that $f^*D = kE$.
The question

Suppose $\mathcal X$ is a DM stack, that $f:\mathcal X\to S$ is a coarse moduli space, that $f$ is an isomorphism over $S\smallsetminus D$, and that $f^*D = kE$ for an irreducible Cartier divisor $E$ on $\mathcal X$. Is the induced morphism $\mathcal X\to \sqrt[k]{D/S}$ an isomorphism?

I get the strong impression that the answer should be "yes", at least if additional conditions are placed on $\mathcal X$.
A counterexample
Here's a counterexample to show that some additional condition needs to be put on $\mathcal X$. Take $G$ to be $\mathbb A^1$ with a doubled origin, viewed as a group scheme over $\mathbb A^1$. Then $\mathcal X=[\mathbb A^1/G]\to \mathbb A^1$ is a coarse moduli space ("there's a $B(\mathbb Z/2)$ at the origin"). If we take $D\subseteq \mathbb A^1$ to be the origin, then the pullback to $\mathcal X$ is the closed $B(\mathbb Z/2)$ with multiplicity 1. Yet the induced morphism from $\mathcal X$ to $\sqrt[1]{D/\mathbb A^1}\cong \mathbb A^1$ is not an isomorphism.
In this case, $\mathcal X$ is a smooth DM stack, but has non-separated diagonal.

A: What do you mean by an irreducible Cartier divisor? Assume that $S$ and $D$ are regular, that $\mathcal X$ is normal and has finite inertia, and that $f^*D = kE$ for a reduced divisor $E$ on $\mathcal X$. Also assume that $\mathcal X$ is tame in codimension 1. Then the induced morphism $\mathcal X\to \sqrt[k]{D/S}$ is proper, because both stacks are proper over $S$. It is also birational. I claim that is representable in codimension 1; this follows from the fact that $\mathcal X$ is ramified of degree $k$ at the generic point of each irreducible component of $D$ (this can be done, for example, by taking the strict henselization of $S$ at the generic point of such a component, thus reducing to the case that $S$ is an henselian trait, which is easy, using the tameness hypothesis). Thus $\mathcal X\to \sqrt[k]{D/S}$ is a proper morphism with finite fibers, $\mathcal X$ is normal, $\sqrt[k]{D/S}$ is regular, and is an isomorphism in codimension 1. By purity of branch locus, it must be étale; and then it must be an isomorphism.
I think that all of the hypotheses are necessary. For example, already when $D$ is a nodal curve on a smooth surface $S$ there are counterexamples: there is a smooth stacks having $S$ as its moduli space, which is ramified of order $k$ along $D$ (this is different from $\sqrt[k]{D/S}$, because the latter is singular). For example, when $D$ is the union of two smooth curves intersecting transversally, you take the fiber product of the root stacks of the two curves. There are also counterexamples when $\mathcal X$ is not normal, or when it is not tame.


text:
Q: HTML file input accept .zip files also includes .xlsx, pptx, .docx How to restrict input file from accepting .pptx, .docx, .xlsx when using
  <input type="file" title="" onChange={handleUpload} accept=".zip" />

I want my input to only access .zip no other file type. But when I use the same in accept attribute it also allows .pptx, .docx, .xlsx

A: you would better use mimetype instead of extension
 <input type="file" title="" onChange={handleUpload} accept="application/zip" />


text:
Q: Rename Columns of several dataframes code below, I have multiple dataframes with the same structure and would like to change the column names.
import pandas as pd

data_1 = [[1, 'tom', 10], [2, 'nick', 15], [3, 'juli', 14]]
data_2 = [[1, 'tom', 10], [2, 'nick', 15], [3, 'juli', 14]]
data_3 = [[1, 'tom', 10], [2, 'nick', 15], [3, 'juli', 14]]

df_1 = pd.DataFrame(data_1, columns = ['number', 'Name', 'Age'])
df_2 = pd.DataFrame(data_2, columns = ['number', 'Name', 'Age'])
df_3 = pd.DataFrame(data_3, columns = ['number', 'Name', 'Age'])

df_1 = df_1.set_index('number', inplace = True)
df_2 = df_2.set_index('number', inplace = True)
df_3 = df_3.set_index('number', inplace = True)

df_list = [df_1, df_2, df_3]

for df in df_list :
    df = df.columns['New_name', 'New_Age']

This code returns :
AttributeError: 'list' object has no attribute 'columns'

when I'm using my real data
or
AttributeError: 'NoneType' object has no attribute 'columns'

with the MWE above.
thanks

A: In stead of these :
df_1 = df_1.set_index('number', inplace = True)
df_2 = df_2.set_index('number', inplace = True)
df_3 = df_3.set_index('number', inplace = True)

Only do this :
df_1.set_index('number', inplace = True)
df_2.set_index('number', inplace = True)
df_3.set_index('number', inplace = True)

.set_index() is inplace method and returns None but modified the object in place.
Also, inside the for loop, instead of this
df = df.columns['New_name', 'New_Age']

Do this :
df.columns = ['New_name', 'New_Age']


text:
Q: Listen buttonUp event in spark Button There is event in spark Button - buttonDown. But how to determine the button up event?

A: There is no buttonUp event. Although you can always rely on keyUp(for Keyboard) and mouseUp(for mouse).

A: The click event is a combination of mouseDown and mouseUp.  That's the one I usually listen to.


text:
Q: Show Row Details as a Popup/ToopTip form on Mouse Hover for each row in KendoUI Grid I have a grid populated with data and
i want to show only 3 or 2 columns and hide rest of columns cause the grid goes very wide.
when the mouse is hovered over a row i want to show all the columns of that row as as popup /tooltip form.
Please help me with this. I searched a lot and only found out Editable popup and with button click not with hover.
function PopulateGrid() {
    $("#recentNews").kendoGrid({

        columns: [
            { field:      'Date', title: 'Date', width: 80,
                template: '#=kendo.toString(toDate(NewsDate), "yyyy/MMM/dd") #'
            },
            { field:      'TradeTime', title: 'Time', width: 60,
                template: '#=kendo.toString(toDate(NewsTime), "hh:mm:ss") #'
            },

            { field: 'Title', title: 'Description', width: 200 },
            { field: 'Country', title: 'Country', width: 40 },
            { field: 'Economy', title: 'Economoy', width: 40 }

        ],

        dataSource: {
            transport: {
                read: {
                    url:      'Home/GetNews',
                    dataType: "json",
                    type:     "POST"
                }
            },
            schema:    {
                data:  function (data) {
                    return data.data;
                },
                total: function (data) {
                    return data.total;
                }
            },
            pageSize:  100

        },
        //            change: onChange,
        //          dataBound: onDataBound,
        dataBound:  HoverOnGrid,
        pageable:   true,
        sortable:   true,
        scrollable: true,
        height:     565,
        width:      2000
    });
}

A: There are two separate questions about what you are trying to implement:

*

*Bind hover to the Grid rows (easy).

*Generate a popup / tooltip that shows the rest of the columns (easy but requires some amount of coding).

Since it seems that you have already defined a function called HoverOnGrid lets write it as:
function HoverOnGrid() {
    $("tr", "#recentNews").on("mouseover", function (ev) {
        // Invoke display tooltip / edit row
        var rowData = grid.dataItem(this);
        if (rowData) {
            showTooltip(rowData);
        }
    });
}

where grid is:
var grid = $("#recentNews").kendoGrid({
    ...
}).data("kendoGrid";

Now, the tricky question, how to show a tooltip / popup... There is no predefined way of doing it, you should do it by yourself. The closes that you can get is defining HoverOnGrid as:
function HoverOnGrid() {
    $("tr", "#recentNews").on("click", function (ev) {
        grid.editRow(this);
    })
}

and the Grid initialization say:
 editable:   "popup",

But this opens a popup but with fields on edit mode (something that you can hack defining in the dataSource.schema.model that all fields are not editable:
model: {
    fields: {
        Date:      { editable: false },
        TradeTime: { editable: false },
        Title:     { editable: false },
        Country:   { editable: false },
        Economy:   { editable: false }
    }
}

But it still shows update and cancel buttons in the popup.
So, my recommendation is writing a piece of code that creates that tooltip.
EDIT: For hiding the tooltip you should first intercept the mouseout event:
$("tr", "#recentNews").on("mouseout", function (ev) {
    // Hide Tooltip
    hideTooltip();
});

where hideTooltip might be something as simple as:
var tooltipWin = $("#tooltip_window_id").data("kendoWindow");
tooltipWin.close()

assuming that you are always using the same id for the tooltip (in this example, tooltip_window_id).


text:
Q: Plotting a stepwise function from a series of points I try to plot a step-wise function from a series of points, and I have the commands:
pacificpoints = {{-5, 2}, {-4.8, 6}, {-4.5, 3}, {-4.2, 14.5}, {-4,
    5}, {-3.8, 8}, {-3.5, 5}, {-3.2, 12}, {-3.1, 10.5}, {-3,
    13}, {-2.2, 2}, {-1.9, 11}, {-1.7, 5}, {-1.3, 9.8}, {-0.8, 2}, {0,
     25.5}, {0.4, 1}, {0.6, 9}, {1.2, 6}, {1.5, 7.5}, {1.9,
    1.8}, {2.2, 7}, {2.5, 4}, {3, 13}, {3.5, 5.5}, {3.8, 10}, {4.2,
    4}, {4.5, 8}, {4.8, 5.5}, {5, 1}};
Remove[pacificfun]

The step-wise function is then prepared as:
pacificfun[x_] :=
  Piecewise[
   Table[{pacificpoints[[i, 2]], pacific[[i, 1]] > x}, {i,
     Length[pacificpoints]}], 0];
Plot[pacificpoints[x], {x, -5, 5}, PlotRange -> Full]

But I get only a blank plot, while it works on another quite similar point-set:
alwynpoints = {{-5, 0}, {-4.5, 1.5}, {-4, 0}, {-3.8, -2}, {-3.2,
    0}, {-3, 2}, {-2.8, -1.7}, {-2.0, 0}, {-1.8, 2}, {-1.6, 0}, {-1.2,
     3.5}, {-1, -3.8}, {-0.5, 0}, {0, 14}, {0.8, -5}, {1, 0}, {1.5,
    5}, {1.8, 0}, {2, -5}, {2.2, 0}, {2.5, 4.5}, {2.8,
    0}, {3, -3}, {3.5, 0}, {4, 2}, {4.2, 0}, {4.5, -2}, {5, 0}};

I have checked the pacific data set, but nothing is wrong with it.
Any ideas how to plot this as piecewise?
Thanks

A: After replacing "pacific" by "pacificpoints" :
pacificfun[x_] =  Piecewise[
   Table[{pacificpoints[[i, 2]], pacificpoints[[i, 1]] > x}, {i,Length[pacificpoints]}], 0];

we can plot the data:
Plot[pacificfun[x], {x, -5, 5}, PlotRange -> Full]

To check the first few data:
pacificfun /@ {-4.9, -4.6, -4.3, -4.1, -3.9}

(* {6, 3, 14.5, 5, 8} *)

This seems to correspnd to the picture.

A: Try the built-in ListStepPlot function if the Piecewise is not essential for further computation.
ListStepPlot[pacificpoints
 , Left
 , Joined -> False
 ]

If the function is indispensable:
pacificfun[x_] =
  Piecewise@(({Last@#, First@# > x} & /@ pacificpoints)~
     Join~{{0, True}});

Plot[pacificfun[x], {x, Splice[MinMax@pacificpoints[[All, 1]]]}]

A: The solution is
pacificfun[x_] :=
  Piecewise[
   Table[{pacificpoints[[i, 2]], pacificpoints[[i, 1]] > x}, {i,
     Length[pacificpoints]}], 0];
Plot[pacificfun[x], {x, -5, 5}, PlotRange -> Full]