text:
Q: NDVI time series based on UI selected features I am trying to create drop downs that will select features from a feature collection, and have each newly selected feature drawn on the map.  I want to have three selectable variables then calculate NDVI for the intersection of the three features.  Server side I have managed to filter the feature collections and create a time series of one of the features as seen here:
https://code.earthengine.google.com/1fa976fa661c75326b0b15f66c82ebf4
But I cannot figure out how to create a user environment to select and redraw the selected features.  Here, the feature collection layer will disappear when the user selects from the drop down menu, but the feature is not redrawn on the map.
https://code.earthengine.google.com/47c02f60c6ae475e1ba01c0819d57c9f
I would like to calculate a new time series each time the user selects a new set of features based on Forest, county, and municipality.

A: The problem is that you are treating the layer as if it was a feature in your county collection.
This modified code should allow you to select only the feature you want.  After that you can run the timeSeries you like one it.
var nmcounties = ee.FeatureCollection("ft:11dWiQkFMNxzP_xHfg98wz9paHoTjlsLRsVwSf0ZZ");
print(nmcounties)
var names = nmcounties.aggregate_array('name');

function onNameChanged(name) {
  print('Update map for ' + name)
}

names.evaluate(function(names) {
  print(names);

  var currentName = ui.Select({
    items: names,
    placeholder: 'Select County',
    onChange: redraw,
  });
  var panel = ui.Panel([currentName]);

  Map.widgets().add(panel);
});

var layers = [
  ui.Map.Layer(nmcounties),

];

// The new value is passed as a parameter to the select onChange callback.
function redraw(names) {
    // FILTER THE COLLECTION TO ONLY CONTAIN SELECTED FEATURE
    var myCounty = nmcounties.filterMetadata("name","equals",names)

    // Helper Function to remove all previous layers of the map
    function removeLayersFromMap(layer){
      Map.remove(layer)
    }

    Map.layers().map(removeLayersFromMap)  // map the function to the Map.layers() object
    Map.addLayer(myCounty,{},"county") // Add the new layer to the map
}

Map.addLayer(nmcounties);


text:
Q: Best practice for creating a youtube gallery of embedded videos? I'm curious to what the best practice is in regards to embedding youtube videos on a site? Ideally I will want to auto-play a default video with it muted while having other videos available as thumbnails.
Any recommended plugins? Should I use an iframe or an object?
Thank you in advance!

A: Your question is very broad: it's hard to know how to help you. If you're using WordPress, for instance, you'll have some plugins to help you do this, but otherwise it depends on whether you intend to dynamically generate the videos or manually create a page with the main video and thumbnails chosen by you in advance.
If you intend to program your page, you'll want to use the YouTube Data API (version 3 preferably, which uses JSON to keep payload sizes down).
If you're manually laying the page out, look at the watch page for a YouTube video, and you can get the embed code there. Click 'Share -> Embed' and then you'll see an iframe tag from which you can fiddle with to alter the size parameters to suit your needs.
One thing to note though: if you make a video autoplay on a page, as far as I know you forfeit the opportunity to have the viewcount increase for that video. So if you want to promote one of your own and intend the viewcount to go up each time, you have to allow users to start the video.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to grab text in which a user input in Java Android Development So i'm making this android application using Eclipse and I have created a text field where the user can input a message and send it, the application then shows the user the text they input, how would I allow them to share this message? Here's the code;
MainActivity.java:
package com.example.myfirstapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
/**called when user clicks the send button */
public void sendMessage (View view) {
    //do something
    Intent intent = new Intent(this, DisplayMessageActivity.class);
    EditText editText = (EditText) findViewById(R.id.edit_message);
    String message = editText.getText().toString();
    intent.putExtra(EXTRA_MESSAGE, message);
    startActivity(intent);
}
public void shareMessage (View view){
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
    sendIntent.setType("text/plain");
    startActivity(sendIntent);
}

}

activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText android:id="@+id/edit_message"
    android:layout_weight="1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message" />
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send"
    android:onClick="sendMessage" />
    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_share"
    android:onClick="shareMessage" />
 </LinearLayout>

Oh and yes, I am very inexperienced with this type of stuff, I've just started learning about it today. Thanks for any help!

A: The message that they entered is stored in the EditText
To access the text, you need to do as you did in your SendMessage method. You need to access the EditText element by id, and then get it's text as a string. Your code will look like this to share the string:
public void shareMessage (View view){
    final String message = ((EditText)findViewById(R.id.edit_message)).getText().toString();
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, message);
    sendIntent.setType("text/plain");
    startActivity(sendIntent);
}


text:
Q: Heisenberg theory of uncertainty I was watching a video on YouTube about uncertainty theory of Heisenberg it said that there is a relation between momentum (multiple of mass and speed) and wave length. And the relation is that if something has a big momentum (it can have a big mass like the meas of an electron or a big speed or either one), it has a short wavelength.
What is this relation? Where does such an implication come from?


text:
Q: Is there a way to find the geo coordinates of all the buildings in a city? I am working with the Uber H3 library. Using the poly fill function, I have populated an area with H3 indexes for a specific resolution. But I don't need all the indexes. I want to identify and remove those indexes which are getting plotted on isolated areas like jungles, lakes, ponds, etc.
Any thoughts on how that can be achieved?
I thought that if I can map all the buildings in a city in their respective indexes, I can easily identify those indexes in which no buildings are mapped.
I'd maintain a Hashmap of h3 index as the key and a list of coordinates which lie in that index as the value.

A: In order to address this, you'll need some other dataset(s). Where to find this data depends largely on the city you're looking at, but a simple Google search for footprint data should provide some options.
Once you have footprint data, there are several options depending on the resolution of the grid that you're using and your performance requirements.

*

*You could polyfill each footprint and keep the resulting hexagons

*For coarser data, just using geoToH3 to get the hexagon for each vertex in each building polygon would be faster

*If the footprints are significantly smaller than your hex size, you could probably just take a single coordinate from each building.

Once you have the hexagons for each building, you can simply do a set intersection with your polygon hexes and your building hexes to get the "good" set. But it may be easier in many cases to remove bad hexagons rather than including good ones - in this case you'd need a dataset of non-building features, e.g. water and park features, and do the reverse: polyfill the undesired features, and subtract these hexagons from your set.


text:
Q: XCODE swift - webview can't open ics link - in safari it works I've made in Swift a webview & in that webview there are links to ics file on the same domain of the webview. Now, when you click this link in Safari, you can perfectly add this to your calendar, but when I try this in iOS simulator, or on my device, I can't 'open' the ICS file link.
Any idea what I am doing wrong? Thanks!
This is my code:
import UIKit

class FirstViewController: UIViewController {

@IBOutlet weak var webAgenda: UIWebView!
@IBOutlet weak var activityagenda: UIActivityIndicatorView!

var url = "http://******.be/agenda.php"

func loadURL () {
    let requestURL = NSURL(string: url)
    let request = NSURLRequest(URL: requestURL!)
    webAgenda.loadRequest(request)

    }
override func viewDidLoad() {
    super.viewDidLoad()
    loadURL()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func webViewDidStartLoad(webView: UIWebView) {
    activityagenda.hidden = false
    activityagenda.startAnimating()

    }

func webViewDidFinishLoad(webView: UIWebView) {
    activityagenda.hidden = true
    activityagenda.stopAnimating()

    }

A: because you load a http site so in iOS9 will have problem with App Transport Security.
disable ATS here


text: Q: why visual studio remote debugger does not stop at breakpoints, after I rebuild the same code? I find it strange, because I rebuild the same code. Theoretically the dll and pdb file should be the same, because the code does not change. Even if it changes, where the breakpoints are located should not be changed.


text:
Q: Why iTerm2 show unicode characters in isolation? iTerm2 shows unicode characters in isolation, for example:

As you can see in the above picture, it perfectly display the unicode characters separately. Whats the problem?


text:
Q: Format fields during bulk insert SQL 2008 I am currently working on a project that requires data from a report generated by third party software to be inserted into a local SQL database. So far I have the data stored as a tab delimited .txt file and the following bulk insert SQL statement:
BULK INSERT ExampleTable
FROM 'c:\temp\Example.txt'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\n'
)
GO

The two problems I am encountering are, quotation marks around any value that includes it's own comma, and money signs in every field that has a dollar amount.
For instance one of the columns of the table is a description field and some of the values come out looking like:
"this is an example description, some more information, I don't know why the author would use commas in the first place here"
I don't care about the description field nearly as much as other fields that include dollar amounts. Each of these fields is already prefixed with a $ sign, so I have to set them as a nvarchar instead of a decimal or a float, which would be A LOT more useful for reporting. Furthermore, when the dollar amount is greater than 1000, the field will also contain a comma, and thus, quotation marks. ex "$1,084.59"
I am familiar with SSMS, but I have never made a format or bcp file (the solutions I have found online).
Any help would be greatly appreciated.

A: You can use a format file, but only if your metadata remains constant, which it does not appear to be in your case.  You state that the dollar amounts are enclosed in quotes only when they exceed 999 and the comma is inserted.  A format file would allow you to define per column delimiters such as [,] or [","].  But if that delimiter is shifting throughout your file, you will have to pre-process the file.  Text qualifiers themselves are not supported.
For reference:
CSV import in SQL Server 2008
http://jessesql.blogspot.com/2010/05/bulk-insert-csv-with-text-qualifiers.html

A: i dont see why, but ThiefMaster deleted my answer :-(
probabaly a mistake and he did not check the link, as this link is the full answer to you question, i will try again for the last time here...
Tip: if your CSV file don't have consistent format, for example ON THE SAME COLUMN some of the values are doubleqouted and some not than this blog will help you do it in an easy way (using openrowset in the last step make it a one simple query): http://ariely.info/Blog/tabid/83/EntryId/122/Using-Bulk-Insert-to-import-inconsistent-data-format-using-pure-T-SQL.aspx

*

*There is a new WIKI at: http://social.technet.microsoft.com/wiki based on this blog if you prefer to read from Microsoft site.


text:
Q: How do I download latest compatible version of an app? So, I was trying to download PicsArt and it says that I need a 10.0 IOS version. And that's happenning to almost every awesome app and games in the App Store. And that's the problem, I almost can't download anymore because of that. Now, let's go to the question, How do I download the latest compatible version of an app that I haven't purchased before?
Please answer because I'm trying to download not just PicsArt but many more...

A: You need to update your iOS version, if possible, or live without those apps.
As of iOS 11, Apple has told developers they must update their apps to 64-bit.  Older, 32-bit, apps can't be on the App Store anymore.
If you're on any version older than iOS 11 and the developer hasn't updated their app (it's the developer's responsibility to do this, not Apple's), you will not be able to download or run the app.


text:
Q: Write DataSet to Document Library I have an ADO.NET DataSet object that I want to write to a document library for future reference (kind of a caching mechanism as this data doesn't change often but is read frequently).
I know that I can write this DataSet to a Stream, filename (including path), TextWriter or XmlWriter.
To write a document to my document library I need to use SPFileCollection.Add, probably providing a path, Stream object and a boolean indicating that I want to overwrite the existing file.
The problem is I can't figure out how to make this work. I've been trying to write the DataSet to a Stream, then passing this Stream into the SPFileCollection.Add method but it's not making much sense.
I'm wondering whether I'm approaching this wrongly. I hope someone can help me here.

A: Using an ADO.NET DataSet while perhaps a good idea, didn't really work well in practice, though I'm quite willing to accept I wasn't handling my streams very well.
The problem arose when I called DataSet.WriteXml(Stream), then tried to use this Stream as the input for SPFileCollection.Add(string, Stream). I'm not sure whether I can write to a stream in this way, then consume it without doing something else in between.
I rejigged the code to give me an XmlDocument instead of the DataSet. Passing the Xmldocument.OuterXml into a byte array has worked better (see code below)
    // This section just sets up a sample System.Xml.XmlDocument
// In practice, this would be passed in from outside as a parameter
XmlDocument xdoc = new XmlDocument();

XmlElement xeData = xdoc.CreateElement("data");
xdoc.AppendChild(xeData);

XmlElement xeSample = xdoc.CreateElement("sample");
xeSample.InnerText = "Sample 1";
xeData.AppendChild(xeSample);

// The SPFileCollection.Add method takes either a byte array or a Stream
byte[] xmlbytes = new UnicodeEncoding().GetBytes(xdoc.OuterXml);

using (SPSite site = new SPSite("http://thesite"))
{
    using (SPWeb web = site.RootWeb)
    {
        SPDocumentLibrary doclib = (SPDocumentLibrary)web.Lists["Test docs"];

        SPFolder folder = doclib.RootFolder;

        string desturl = web.Url + "/" + folder.Url + "/justadded.xml";
        SPFile addedfile = web.Files.Add(desturl, xmlbytes, true);
        SPListItem item = addedfile.Item;
        item["Title"] = "Just added this item";
        item.Update();
    }
}

EDIT: It's trivial to convert a DataSet to an XmlDocument using something like below:
myXmlDocument.LoadXml(myDataSet.GetXml());


text:
Q: Using vim-go, gocode and godep doesn't work together I am using YCM, installing with this option --gocode-completer.
After having started Vim, I see the gocode daemon :
$ ps -ef | grep gocode
  501 53255     1   0  4:36PM ??         0:00.03 /Users/yamo/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/go/../../../third_party/gocode/gocode -s -sock unix -addr localhost:37373

Completion works well on a built-ins (like fmt) but not on a dependency in GoDeps.
gocode displays the following message

: Gocode returned empty JSON response

Nevertheless, godep seems have been correctly detected
:GoPath displays
/Users/yamo/Projects/.go/src/github.com/YannMoisan/openshift-skeleton/Godeps/_workspace:/Users/yamo/Projects/.go/vendor/:/Users/yamo/Projects/.go

Any idea to fix that ?


text:
Q: Access config file from any directory? I am making a command line tool and I am using yaml to make a config file. But right now I can only access the tool when I am in the same directory as that of myprogram.yml.
private

CONFIG_FILE = 'myprogram.yml'

def write_config
  config = {}
  config['username']=@username
  config['password']=@password
  File.open(CONFIG_FILE, 'w') do |f|
    f.write config.to_yaml
  end
end

def read_config
  config = YAML.load_file(CONFIG_FILE)
  @username = config['username']
  @password = config['password']
end

How can I make this file to be accessed from any directory on my computer?

A: You'll want to give the absolute directory of the myprogram.yml file.  Right now it will look in the directory where you are executing the ruby script from.  By making it absolute, the script can run anywhere and know where to find the config file.
Example:
private

CONFIG_FILE = '/Users/myuser/config/myprogram.yml'

def write_config
  config = {}
  config['username']=@username
  config['password']=@password
  File.open(CONFIG_FILE, 'w') do |f|
    f.write config.to_yaml
  end
end

def read_config
  config = YAML.load_file(CONFIG_FILE)
  @username = config['username']
  @password = config['password']
end


text:
Q: How to pass huge string data from javascript to java action class? Is that possible to pass huge string data from javascript to java action class?
var url = "xwe.action?pdfDivContent=" + encodeURIComponent(div1);
    alert( url);
    req.open("POST", url, true);
    req.send(null)

I tired the above code and it is not working as pdfDivContent is huge in size(#approx 2000 characters.

A: You are sending the data via GET not post. You should be putting the data in send, not the querystring. This is assuming that div1 actually holds a string.
var url = "xwe.action";
req.open("POST", url, true);
req.send("pdfDivContent=" + encodeURIComponent(div1))

Based on your comment, maybe you need to set these headers
var url = "xwe.action";
req.open("POST", url, true);
var params = "pdfDivContent=" + encodeURIComponent(div1);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", params.length);
req.setRequestHeader("Connection", "close");
req.send(params);


text:
Q: How to implement \savebox \documentclass[a4paper,10pt]{article}
\usepackage[left=24mm,right=30mm,bottom=25mm,top=25mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{fadings, positioning}
\usetikzlibrary{shadows.blur}

\newlength{\borderwidth}
\setlength{\borderwidth}{2mm}

\definecolor{plava.b}{RGB}{91,75,183}
\definecolor{crvena.b}{RGB}{163,32,48}
\definecolor{zelena}{RGB}{149,173,124}
\definecolor{orange.b}{RGB}{245,164,41}
\definecolor{unutra}{RGB}{255,255,225}
\definecolor{s.plava}{RGB}{183,206,225}
\definecolor{purp}{RGB}{129,81,153}
\definecolor{siva}{RGB}{140,138,134}

\tikzset{
    anybox/.style={rectangle, rounded corners, minimum width=3cm, minimum height=1.5cm,
        text width=3cm, align=center, inner sep=10pt, blur shadow={shadow blur steps=3},
        draw, fill=unutra, font=\bfseries\sffamily, border=#1},
    M3/.style={anybox=plava.b},
    nosilac/.style={anybox=zelena},
    signal/.style={anybox=crvena.b},
    BJT/.style={anybox=orange.b},
    DSO/.style={anybox=s.plava},
    diodni/.style={anybox=purp},
    kolo/.style={anybox=siva, minimum height=2.5cm,minimum width=2cm, fill=white},
    modularni/.style={minimum width=2cm, text width=1.5cm, align=center},
    >=stealth,
}

\tikzset{
border/.style = {
    postaction = {clip, postaction = {draw = #1, solid,
    line width = \borderwidth, postaction={draw, path fading = north}},
    }
}}

\newsavebox{\mc}
\sbox{\mc}{%
\begin{circuitikz}
 \draw[->,red](-0.6,0.5)--(-0.6,1.5)node
  [red, left, midway]{$Current$};
\end{circuitikz}

}

\begin{document}
\begin{tikzpicture}[node distance=2cm, font=\sffamily]
\node (prvi) [M3] {M3 Cortex MCU\\STM32F103};
\node (drugi) [nosilac, below = of prvi] {NOSILAC\\DSS AD9833};
\node (treci) [signal,below = of drugi] {SIGNAL PORUKE\\DSS AD9833};
\node (sesti) [BJT,below right= 3mm and 1cm of drugi] {BJT \\MODULATOR};
\node (osmi) [kolo,right =3cm of sesti, label={pojačavačc RF signala}]{   \\\usebox{\mycircuitb}};
\node (deveti) [DSO,below = of sesti]{\textbf{DSO} \\4x Kanala};
\node (deseti) [diodni] at (deveti-|osmi) {DIODNI detektor \\sa NF RC filterom};

\draw[->] (prvi.west)--++(180:5mm)|-(drugi) node[pos=.25,above,sloped, rotate=180] {SPI interface};
\draw[->] (prvi.west)--++(180:5mm)|-(treci);
\draw[->] (drugi)-|(sesti) node[pos=.25, fill=white] (cetvrti) {0.7V@100kHZ};
\draw[->] (treci)-|(sesti) node[pos=.25, fill=white] (peti) {0.7V@5kHZ};
\draw[->] (sesti)--(osmi) node[modularni, pos=.5, fill=white] (sedmi) {Modulirani\\signal};
\draw[->] (osmi)--(deseti);

\draw[dashed,->,red] (deveti.north) -- (sedmi.west);
\draw[dashed,->,red] (deveti.north) -- (peti.west);
\draw[dashed,->,red] (deveti.north) -- (cetvrti.west);
\draw[dashed,->,red] (deveti) -- (deseti);
\end{tikzpicture}

\end{document}

So I searched how to insert tikz picture inside node and found \savebox.I tried it but it keeps overflowing my node and when I try to make circuit inside \savebox and call my box with \usebox but nothing happen.Here is my code so far and picture of what I want to accomplish.If anyone is familiar with \savebox that can store this circuit in picture could you help me or guide me.Thanks

A: One of the problems of this question is that you do not have provided a minimum example --- you just put in all your code, and that, as correctly stated already, makes the task difficult.
I can show you what I have of an example (this is a correct MWE) using adjustbox, you can adapt it to your usage.
\documentclass{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage[RPvoltages]{circuitikz}

\newsavebox{\mycirc}
\sbox{\mycirc}{% no stray spaces
    \begin{tikzpicture}
        \draw (0,0) node[ground]{} to[R=$R_B$] ++(0,2) coordinate(a)
        -- ++(0,1) node[op amp, anchor=+](A){}
        (a) to[R=$R_A$, *-] (a-|A.out) -- (A.out);
    \end{tikzpicture}% no stray spaces
}

\begin{document}

Normal text at 10pt here.

\begin{tikzpicture}[]
    \node [draw, text width=3cm, align=center]{% no stray spaces
        \adjustbox{width=3cm, height=3cm, keepaspectratio}{\usebox{\mycirc}}%
    };
\end{tikzpicture}
\end{document}

A: Using the savebox defined below works fine
\newsavebox\mybox
\begin{lrbox}{\mybox}
    \begin{circuitikz}
        \draw[->,red](-0.6,0.5)--(-0.6,1.5)node
        [red, left, midway]{$Current$};
    \end{circuitikz}
        \end{lrbox}

MWE
\documentclass[a4paper,10pt]{article}
\usepackage[left=24mm,right=30mm,bottom=25mm,top=25mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tikz, circuitikz}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{fadings, positioning}
\usetikzlibrary{shadows.blur}

\newlength{\borderwidth}
\setlength{\borderwidth}{2mm}

\definecolor{plava.b}{RGB}{91,75,183}
\definecolor{crvena.b}{RGB}{163,32,48}
\definecolor{zelena}{RGB}{149,173,124}
\definecolor{orange.b}{RGB}{245,164,41}
\definecolor{unutra}{RGB}{255,255,225}
\definecolor{s.plava}{RGB}{183,206,225}
\definecolor{purp}{RGB}{129,81,153}
\definecolor{siva}{RGB}{140,138,134}

\tikzset{
    anybox/.style={rectangle, rounded corners, minimum width=3cm, minimum height=1.5cm,
        text width=3cm, align=center, inner sep=10pt, blur shadow={shadow blur steps=3},
        draw, fill=unutra, font=\bfseries\sffamily, border=#1},
    M3/.style={anybox=plava.b},
    nosilac/.style={anybox=zelena},
    signal/.style={anybox=crvena.b},
    BJT/.style={anybox=orange.b},
    DSO/.style={anybox=s.plava},
    diodni/.style={anybox=purp},
    kolo/.style={anybox=siva, minimum height=2.5cm,minimum width=2cm, fill=white},
    modularni/.style={minimum width=2cm, text width=1.5cm, align=center},
    >=stealth,
}

\tikzset{
    border/.style = {
        postaction = {clip, postaction = {draw = #1, solid,
                line width = \borderwidth, postaction={draw, path fading = north}},
        }
}}

\newsavebox\mybox
\begin{lrbox}{\mybox}
    \begin{circuitikz}
        \draw[->,red](-0.6,0.5)--(-0.6,1.5)node
        [red, left, midway]{$Current$};
    \end{circuitikz}
        \end{lrbox}

\begin{document}
    \begin{tikzpicture}[node distance=2cm, font=\sffamily]
        \node (prvi) [M3] {M3 Cortex MCU\\STM32F103};
        \node (drugi) [nosilac, below = of prvi] {NOSILAC\\DSS AD9833};
        \node (treci) [signal,below = of drugi] {SIGNAL PORUKE\\DSS AD9833};
        \node (sesti) [BJT,below right= 3mm and 1cm of drugi] {BJT \\MODULATOR};
        \node (osmi) [kolo,right =3cm of sesti, label={pojačavačc RF signala}]{\usebox\mybox };
        \node (deveti) [DSO,below = of sesti]{\textbf{DSO} \\4x Kanala};
        \node (deseti) [diodni] at (deveti-|osmi) {DIODNI detektor \\sa NF RC filterom};

        \draw[->] (prvi.west)--++(180:5mm)|-(drugi) node[pos=.25,above,sloped, rotate=180] {SPI interface};
        \draw[->] (prvi.west)--++(180:5mm)|-(treci);
        \draw[->] (drugi)-|(sesti) node[pos=.25, fill=white] (cetvrti) {0.7V@100kHZ};
        \draw[->] (treci)-|(sesti) node[pos=.25, fill=white] (peti) {0.7V@5kHZ};
        \draw[->] (sesti)--(osmi) node[modularni, pos=.5, fill=white] (sedmi) {Modulirani\\signal};
        \draw[->] (osmi)--(deseti);

        \draw[dashed,->,red] (deveti.north) -- (sedmi.west);
        \draw[dashed,->,red] (deveti.north) -- (peti.west);
        \draw[dashed,->,red] (deveti.north) -- (cetvrti.west);
        \draw[dashed,->,red] (deveti) -- (deseti);
    \end{tikzpicture}

\end{document}
S


text:
Q: saved order at API in woocommerce_thankyou page Invoice information on the woocoommerce_thankyou page is curled by a web service. If the user does not see this page for any reason, how can the storage operation be performed? Can invoice storage action be changed in any other way?
add_action( 'woocommerce_thankyou', 'club_add_factor', 10, 1 );
function club_add_factor( $order_id ) {
if ( ! $order_id ) {
    return;
}
/* Get order info */
$order         = new WC_Order( $order_id );
$userID        = $order->get_customer_id();
$api           = new Club( $userID );
// something ...
}

A: You are right, "woocommerce_thankyou" handles the following hooks collectively. But when you are not landing on thankyou page, you can use on-hold or processing instead.
//add_action('woocommerce_order_status_pending', 'club_add_factor');
//add_action('woocommerce_order_status_on-hold', 'club_add_factor');
//add_action('woocommerce_order_status_processing', 'club_add_factor');
//add_action('woocommerce_order_status_completed', 'club_add_factor');

add_action('woocommerce_thankyou', 'club_add_factor');

A: Thanks bro !
I solved it with 'woocommerce_order_status_processing' action.
I used it :
add_action('woocommerce_order_status_processing', 'club_add_factor');


text:
Q: Check type of object where object may be an int (32 or 64) I would like to assign the property MyProperty with the parameter id.
The MyProperty property is of type Object, and it may be either an Int32 or an Int64.
How could I check the type of the MyProperty field and then assign it either id or id cast as an int depending on the underlying type?
public void MyMethod(long id) {
    myClass.MyProperty
        = (typeof(MyProperty) == typeof(long))
        ? id
        : (int)id;
}

A: You can do:
if(myClass.MyProperty is int){
.....  do int stuff
}
else
{
 ..... do long stuff.
}

Is Operator.

A: So you want to assign the new value based on the type of the current value? If so:
if (myClass.MyProperty is int)
{
    myClass.MyProperty = (int) id;
}
else
{
    myClass.MyProperty = id;
}

You can do this with a conditional expression, but it's a bit ugly:
myClass.MyProperty = myClass.MyProperty is int
    ? (object) id : (int) id;

Or:
myClass.MyProperty = myClass.MyProperty is int
    ? (object) (int) id : id;

Or to make it clear that you really, really want boxing in either case:
myClass.MyProperty = myClass.MyProperty is int
    ? (object) (int) id : (object) id;

A: As the others said, but I Recommend you use Convert instead of casting:
long l = 2147483648; // int.MaxValue + 1
int i = (int)l; // i == -2147483648 oops
i = Convert.ToInt32(l); // Overflow exception

A: This question does not make sense.
1. If the property is an object you can assign whatever you want. The type of an object property is object.
2. If you want to see the underlying private field... how do you know there is an underlying field to begin with? If you do know there is a private field why don't you know its type?
If you are in the very strange second case you may do 2 things.
a) Implement code in the property to do the check and conversion.
b) Decorate the property with attributes that contain metadata about the underlying field and read it via reflection.
Overall your question indicates design problem so you'd best consider redesigning instead of hacking.


text:
Q: Split HTML files How would I split a HTML formatted file into several HTML files (complete with with HTML, HEAD and BODY tags) with PHP? I would have a placeholder tag (something like

 ) for all the places I want to cut.
Thanks.

A: $sourceHTML = file_get_contents('sourcefile');

$splitContents = explode("

", $sourceHTML);

foreach ($splitContents as $html) {
    // save html to file
}

Edit: whoops.  As user201140 correctly points out, I missed the fact that each html file has to be a valid document.  Since it's not specified exactly what the head tag should contain, I'll assume that the head tag of the combined document should be replicated to each copy.  In that case:
$sourceHTML = file_get_contents('sourcefile');
preg_match("/(^.*)(.*)(<\/body.*$)/is", $sourceHTML, &$matches);
$top = $matches[1];
$contents = $matches[2];
$bottom = $matches[3];
$splitContents = explode("

", $contents);
foreach ($splitContents as $chunk) {
    $html = $top.$chunk.$bottom;
    // save html to file
}

A: The preg seems only to work for small files...
Anyway... To split an HTML file of this form :
(header...)
 (intro...)

Sect 1
 (section...)

Sect 2
 (section...)
(etc...)

I manage this way :
$splitContents = explode("<h3", $sourceHTML);
$i=0;
$last=count($splitContents)-1;
foreach ($splitContents as $chunk) {
    if($i==0) {
        $beginning=explode("<body", $chunk);
        $top=$beginning[0];
        $html = $chunk ;
    } else {
        $html = $top . "
<h3" . $chunk ;
    }
    if($i !=$last) $html .= "
";
    // save html to file
    ++$i;
}


text:
Q: How to delete direct message from bot that already sent? Hi I recently tested the DM user command in Discord.py rewrite version and forgot to use the delete_after parameter now my DM is filled with Bot message spam how do I make my bot to delete it's own message.

A: I believe you can do:
send = await ctx.send("test message")

and later, to delete the message:
await send.delete()

This would obviously change because you're doing a DM and not a direct message to a server, but the logic to delete said message is the same.


text:
Q: Magento: Receive XML Post Data In Magento, im trying to setup a route / controller that will receive XML POST data, process it, and return a response.
My route is setup properly, and my Index Controller is setup with an indexAction().  However, using Postman, when I try and POST XML data to the route, Mage::app()->getRequest()->getPost() returns empty.  I've also tried $this->getRequest()->getParams() as well with the same results.
Is there something I'm missing?

A: getRequest()->getPost() is a wrapper for $_POST variable
and $_POST is set for:
Content-Type: application/x-www-form-urlencoded
In other words, for standard web forms (sending params like username=admin&pass=mypass)
$_POST is NOT set for:
Content-Type:text/xml
so you will not get your xml in $_POST.
getRequest()->getParams() contains $_POST, $_GET, and route parameters, again you will not get your xml here.
You can check Zend_Controller_Request_Http class for those methods.
You must parse yourself the xml posted. You can retrieve it like this
if ($this->getRequest()->isPost() && $this->getRequest()->getHeader('Content-Type') == 'text/xml') { // don't forget to set proper content-type header when making the request
    $postedXml = $this->getRequest()->getRawBody();
    if (false !== $postedXml) {
        // process xml
    }
}


text:
Q: distribution/ histogram procedure How one can describe correctly the procedure of making a histogram.
I want to replace the sentence "distributions of reconstructed energies of events taken with the same initial momentum in the same test-beam
experiment are fitted..." into two sentences: one for describing the "histogram making" and the second to describe the fitting method.

A: If you are fitting a parametric distribution to observed data,this typically means finding the values of the parameters where the distribution "most closely matches" the histogram.
Practically speaking, however, the distribution is assumed, and a formula is applied to the data with the help of a computer program. The parameters are calculated, along with a "goodness of fit" number that you use to decide whether the distribution matches the data. The histogram never appears explicitly, although most statistical programs offer some way to visualize histograms and fitted distributions.
From your very brief text, it looks like you want to describe the fitting process as if it were being done in a simple way, as in an exercise in an introductory statistics course. There's nothing wrong with this, and it might be entirely appropriate for your readers, but it might be better to describe the histogram as a visualization output as opposed to an intermediate variable in the analysis.
For example:

*

*Each experiment yielded a set of reconstructed energies, which could in principle be plotted as histograms on a common set of axes.

*A ________ distribution was fitted to each of the sets.


text:
Q: Android: get time I have been thinking on timing my app, so I can know when an event happen. My first idea was to access to the system clock when I start the application and once again everytime I want to check the elapse time (then just substract). Don't know if this is the most accurate and optimal way. Any suggestion?
Thank you very much!!

A: If millisecond resolution is enough, I'd use System.currentTimeMillis(). It's great for running quick performance checks.


text:
Q: Jquery getJson Request is getting cancelled When I run our Analytics app on a localhost, (from the debugger) it loads perfectly. However when I upload to the server, the GET requests are cancelled.
This is a screen shot of the network response:

How would you suggest I fix this?
Here is the response code from the server
/**
     * Sends a JSON response for an object (200)
     * @param objectToEncode
     * @throws Exception
     */
    private void sendJSONResponse(Object objectToEncode, Request baseRequest, HttpServletResponse response) throws Exception{

        //Encode object into JSON
        String jsonString = new Gson().toJson(objectToEncode);
        byte[] utf8JsonString = jsonString.getBytes("UTF8");

        response.setContentLength(utf8JsonString.length);
        response.setHeader("Cache-Control", "no-cache");
        response.setContentType("text/x-json;charset=UTF-8");
        response.setStatus(200);

        try {
            //Actually send the response
            response.getWriter().write(jsonString);

        } catch (Exception e) {

            // TODO: handle exception
            e.printStackTrace();
        }

    }

Javascript request:
/*
         Draws the chart for average session length by day
         */
        function drawUsersGender() {

            //Apit to get the data from
            var api = GET_USERS_SEX;

            //Request data (using jquery/ajax)
            $.getJSON(api,function(data){

                //Start a days and seconds array
                var result = [['gender', 'number']];

                //Iterate over the genders
                for (var gender in data){

                    //Get the value pair and push
                    var entry = [gender, parseInt(data[gender])];
                    result.push(entry);
                }

                //Parse to google data
                var data = google.visualization.arrayToDataTable(result);

                //Display options
                var options = {
                    title:'Gender for registered users',
                    'width':600,
                    'height':400
                };

                //Draw the chart
                var chart = new google.visualization.PieChart(document.getElementById('genderChart'));
                chart.draw(data, options);
            });
        }

A: Instead of $.getJSON, you need to use
$.ajax({
     url:GET_USERS_SEX,
     dataType: 'jsonp',
     success:function(json){
         // handle the json response
     },
});

This is because normal JSON responses need to come from the same server. JSONP does not have the cross-domain restriction.
Or you could make sure that you are requesting the JSON with the exact same domain name as you use in the browser url.


text:
Q: How to trigger a URL using php? I want to trigger a URL without user interaction. I used
file_get_contents($myurl);

But in my webhost file_get_contents() is disabled. how to do that. I dont want to read the contents of the URL. I just want to trigger the URL. Also I can not use header() function, because, Im going to trigger the url in a loop, so header will not be helpful.

A: Use cURL:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.example.com');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_exec();
curl_close($ch);
?>

A: You could try some lower level socket calls to make a simple HTTP request with fsockopen and related functions. Here's a sample from the manual
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
   echo "$errstr ($errno)
\n";
} else {
   $out = "GET / HTTP/1.1\r\n";
   $out .= "Host: www.example.com\r\n";
   $out .= "Connection: Close\r\n\r\n";

   fwrite($fp, $out);
   while (!feof($fp)) {
       echo fgets($fp, 128);
   }
   fclose($fp);
}

A: The other answers are the right way to go to actually "trigger" the other URLs.  But it is worth mentioning that if you're trying to request those URLs "without user interaction" you should consider running a Cron Job to actually make it happen, rather than relying on someone to access a specific page on your website.

A: Well, if you cannot use Curl or fsockopen or exec wget or any of the other suggestions to make it work from PHP, it is a lost cause. Almost. If you dont have to have the URL called during script execution, you could let the client call the url by adding an WebBug element to the html you send back to browser (assuming this is what you do), e.g.

If you need the response from the script, you could use an iframe, though you should check if that element is part of the Doctype you are using. You could also try via JavaScript, but have to find a way to bypass the Same Origin Policy most browsers enforce.
If that's still not solving your problem, try another free hosting service or consider switching to paid hosting. You can get a decent setup for below ten bucks nowadays.

A: If none of the other options work for you, you might be able to do it using the shell. Using wget:
shell_exec('wget http://example.com/');

If wget isn't installed, you might be able to do it with lynx.
http://php.net/manual/en/function.shell-exec.php

A: update: ah, I see allow_url_fopen is off. Yeah, then even get_headers won't work. Then the solution from @Gordon is the way too go. A bit nasty, but there is no other option.
I would recommend to avoid such hosters like the plague, this is too limiting.

In your last question I answered get_headers($url). Thats all.
This is definitively the way I would do it. It returns the headers, so that you are able to see if your request was handled properly.
Curl is also an option but I doubt if this is installed on your shared hosting, which seems to be restrictive.

A: Here is a sample command to call another script from current file as a separate process
exec('/usr/bin/php5 /var/www/vhosts/mysite.com/httpdocs/PROCESS/processScript.php');


text:
Q: Where to put JDBC driver in Java console program? I've created a little test app as a console program in java that tries to work with hibernate, and I'm trying to connect to an instance of SQL-Server-2008. But when I run my app I'm getting an error stating that it can't find the JDBC driver.
Now I've created the project as a maven project so if the driver is available as a maven dependency that would be great, although I couldn't find it. I do however have the actual .jar file, but I have no idea where to put this in my project structure. Which look like this:

So.. any help would greatly be appreciated! Thanks :)

A: Download it from http://msdn.microsoft.com/en-us/sqlserver/aa937724 and then install
mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=3.0 -Dpackaging=jar

Once you include it using maven, it is referenced from maven directory.


text:
Q: Django Query Get all User Items from my Accounts I am trying to figure out the best (simplest) ways to call all the "Items" from my different User "Accounts."
The Account has the User ForeignKey.
class Acct ( models.Model ):
    user = models.ForeignKey ( settings.AUTH_USER_MODEL)

The Item has the Account foreignKey.
class Items ( models.Model ):
    acct = models.ForeignKey ( Acct )

So when I have a list of Acct's - what is the best way to get all the User's Items for the different accounts?
I can get all the Accounts with something like this:
a = request.user.acct_set.all ().filter ( active = 1 )

Now what is the next call to get the Items for those Accounts?
Only thing I can figure out is to add the User foreignKey to the Items also. (I would also have to add the Active field.)
I hope this makes sense.  Thank you.

A: You don't need to add any more foreign keys - you can just traverse the existing relationships directly in one query like so:
# Fetch all the items associated with all accounts for this user
items = Item.objects.filter(acct__active=1, acct__user=request.user)

A: Not sure this is most efficient method, but it seems to be working.
id = request.user.acct_set.values_list ( 'id', flat=True ).filter ( active = 1 )

items = Item.objects.filter ( acct__in = id ) .order_by ( 'date' )

If there is a better way I would appreciate knowing it.
Thanks.


text:
Q: Start a background process on Qt and load responsive shell environment I am playing around with Qt to create a simple GUI for some more advanced analysis with the software called OpenFOAM. Right now, I want to start an application of the toolbox OpenFOAM usingQProcess::execute. It is working but for the application I need to load the environment in the shell.
Commonly, if I work in the terminal I first do have to source the environment file that loads all libraries and solvers one can use. However, in Qt, I am not aware how to achieve that.
Example. In the terminal I need to do the following:
    source /path/to/environementFile
    simpleFoam > logFile   << application

I want to start the application simpleFoam in the background of my GUI after clicking on a button. Right now, I do have the following:
    QProcess::execute(QString("/home/shorty/OpenFOAM/platforms/bin/simpleFoam"));

This works but the shared library that are needed by the application are not loaded (missing source of the environment file). Is there a way how to process more commands within one execution call?


text:
Q: CSS transition-property: all; performance I'm curious is using transition: all 0.2s; has any performance implications vs. specifying properties explicitly. Let me show you what I mean:
.button {
   // I want to transition the border- & background-color on hover
   border-color: lime;
   background-color: red;

   // I could specify `all` as the property to transition...
   transition: all 0.2s ease-in;
   // ...but is it more performant to write it this way?
   transition: border-color 0.2s ease-in,
               background-color 0.2s ease-in;

   // Here's the :hover state:
   &:hover {
      border-color: blue;
      background-color: green;
   }
}

I feel like if you specify all then the browser must be observing all properties for changes and (if they are animatable properties). Would the second example where I specify each property individually not be better, as then the browser only has to watch those properties for changes?
Thanks in advance, I've always been curious about this.


text:
Q: Facebook Login with custom user model m trying to create a new user with Social-Auth and my custom user model required a phone number but facebook does not allow it
so i get this error
TypeError at /social-auth/complete/facebook/
create_user() missing 1 required positional argument: 'phone'

settings.py
SOCIAL_AUTH_FACEBOOK_KEY = 'XXXXXXXXXX'
SOCIAL_AUTH_FACEBOOK_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXX'
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email'] # add this
SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {
  'fields': 'id, name, email, picture.type(large), link'
}
SOCIAL_AUTH_FACEBOOK_EXTRA_DATA = [
    ('name', 'name'),
    ('email', 'email'),
    ('picture', 'picture'),
    ('link', 'profile_url'),
]

how can i pass a default parameter to avoid this error or any solution to work around this problem

A: I had the same problem with 'username' the problem is that most propable you make the phone number required as a field in your User model.
And in pipeline in your SOCIAL_AUTH_PIPELINE you've

"social_core.pipeline.user.create_user"

It tries to create a user if it's not found in your Db. So I think you've 2 options.
1-Make phone number in your model not required.
2-Remove this pipeline and create your own pipeline with your own implementation.


text:
Q: Newtonsoft.Json String to JSON conversion issue I have below JSON input data coming from Queue
{
"ID": 0501,
"AssetId": "EFT0501"
}

JsonLint.com shows it's invalid JSON because number starts with 0.
In my .Net code, I'm able to parse this value but ID field value gets change.
Code
var test = JObject.Parse(message);

Output
{
"ID": 321,
"AssetId": "EFT0501"
}

Any suggestion Why is this value getting change? how to fix, If I can't change input format?


text:
Q: Like search into MongoDB with Monk library I'm trying to do like search into mongodb with Javascript, but i havent yet figured it out how to do it. Any help is appreciated.
I have a search parameter called "search" at request body (req.body.search). I would like find all programs which name contains that search criteria. Ie. "harry" would return "Harry Potter", "Potter Harry", "How merry Harry Really is?" and other movies which contains harry in its name.
exports.programs = function(db, req) {
    return function(req, res) {
        var collection = db.get('programs');
        collection.find({name: /req.body.search/ },{},function(e,docs){
            res.json(docs);
        });
    };
};

A: I'm not familiar with the monk library but if the parameter in that find is a MongoDB Query Document this is the syntax you are looking for:
var query = {
  name: {
    $regex: req.body.search,
    $options: 'i' //i: ignore case, m: multiline, etc
  }
};

collection.find(query, {}, function(e,docs){});

Chekcout MongoDB $regex Documentaiton.


text:
Q: Spring Security - pages redirect to login even if authentication successfull on Explorer and Safari I'm working on a web-app Spring MVC with Spring Security for the authentication.
Everything works fine except on Explorer and Safari. When I log in successfully I can access at one page and when I want to access another page, the browser ask me to log again... I have tested the application on Chrome and Firefox and everything is OK...
My spring-security.xml
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:security="http://www.springframework.org/schema/security"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/mvc
   http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/security
    http://www.springframework.org/schema/security/spring-security-3.2.xsd">

    <security:http auto-config="true">
        <security:intercept-url pattern="/index*" access="ROLE_USER" />
        <security:intercept-url pattern="/acc*" access="ROLE_USER" />
        <security:intercept-url pattern="/compte/**" access="ROLE_USER" />
        <security:intercept-url pattern="/aide/**" access="ROLE_USER" />
        <security:intercept-url pattern="/clients/**" access="ROLE_USER" />
        <security:intercept-url pattern="/admin/**" access="ROLE_ADMIN" />
        <security:intercept-url pattern="/employes/get.html*" access="ROLE_ADMIN" />
        <security:intercept-url pattern="/employes/**" access="ROLE_MONITRICE" />
        <security:intercept-url pattern="/reunions/**" access="ROLE_USER" />
        <security:form-login login-page="/login.html" default-target-url="/accueil.html" authentication-failure-url="/fail2login.html" />
        <security:logout logout-success-url="/logout.html" />
    </security:http>

    <security:authentication-manager alias="authenticationManager">
        <security:authentication-provider user-service-ref="employeDao">
            <security:password-encoder hash="bcrypt" />
        </security:authentication-provider>
    </security:authentication-manager>

</beans>

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

    <context:property-placeholder location="classpath:config/database.properties" />
    <context:component-scan base-package="ch.tupperware.tuppergestion" />

    <tx:annotation-driven transaction-manager="hibernateTransactionManager" />
    <mvc:annotation-driven/>

    <!-- Configure the multipart resolver -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <!-- one of the properties available; the maximum file size in bytes -->
        <property name="maxUploadSize" value="100000000"/>
    </bean>

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

    <bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource">
     <property name="driverClassName" value="${database.driver}"></property>
     <property name="url" value="${database.url}"></property>
     <property name="username" value="${database.user}"></property>
     <property name="password" value="${database.password}"></property>
    </bean>

    <bean id="mapper" class="org.dozer.DozerBeanMapper">
      <property name="mappingFiles">
        <list>
          <value>dozerMapping.xml</value>
        </list>
      </property>
    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="annotatedClasses">
            <list>
                <value>ch.tupperware.tuppergestion.entity.AmbassadriceEntity</value>
                <value>ch.tupperware.tuppergestion.entity.AbstractEmployeEntity</value>
                <value>ch.tupperware.tuppergestion.entity.AbstractClientEntity</value>
                <value>ch.tupperware.tuppergestion.entity.AutreClientEntity</value>
                <value>ch.tupperware.tuppergestion.entity.ConseillereEntity</value>
                <value>ch.tupperware.tuppergestion.entity.HotesseEntity</value>
                <value>ch.tupperware.tuppergestion.entity.InviteEntity</value>
                <value>ch.tupperware.tuppergestion.entity.MonitriceEntity</value>
                <value>ch.tupperware.tuppergestion.entity.ReunionEntity</value>
                <value>ch.tupperware.tuppergestion.entity.ClientReunionEntity</value>
                <value>ch.tupperware.tuppergestion.entity.RoleEntity</value>
                <value>ch.tupperware.tuppergestion.entity.AdministrateurEntity</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
            </props>
        </property>
    </bean>

  <bean id="employeeDao" class="ch.tupperware.tuppergestion.dao.EmployeDaoImpl"></bean>

  <bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="hibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"></property>
  </bean>

  <bean id="webexpressionHandler" class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler" />

  <bean
      class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
      <property name="exceptionMappings">
        <props>
            <prop key="ch.tupperware.tuppergestion.errors.RessourceNotAuthorizedException">
                errors/403
            </prop>
        </props>
      </property>
    </bean>

</beans>

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

    <servlet>
        <servlet-name>tuppergestion</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/tupper-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>tuppergestion</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>

    <error-page>
        <error-code>404</error-code>
        <location>/WEB-INF/views/errors/404.jsp</location>
    </error-page>

    <error-page>
        <error-code>403</error-code>
        <location>/WEB-INF/views/errors/403.jsp</location>
    </error-page>

    <error-page>
        <error-code>500</error-code>
        <location>/WEB-INF/views/errors/genericException.jsp</location>
    </error-page>

    <welcome-file-list>
        <welcome-file>/WEB-INF/views/login.jsp</welcome-file>
    </welcome-file-list>

    <listener>
        <listener-class>
                  org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name><param-value>/WEB-INF/tupper-*.xml</param-value>
    </context-param>

<!-- Spring Security -->
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>
            org.springframework.web.filter.DelegatingFilterProxy
        </filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

</web-app>

My Spring version is 3.2.5.RELEASE
Thanks for your help!
UPDATE
I've found that my problem occurs when I use an address with a redirection.
My site www.xxxx.com redirect on xxx.synology.me
When I try to connect direct on xxx.synology.me I have not any problems on Safari.
Is there something specific to do with the cross-domaine cookies?


text:
Q: TFS 2010 to TFS 2013 Upgrade: Process Template Change We just upgraded from TFS 2010 to TFS 2013. Since we were using CMMI process template earlier, we need to change our template to Agile Template.
The upgrade was done by restoring the SQL database from the old SQL server to the new one and then using TFS 2013 upgrade wizard.
After checking out on the internet we came to understand two things:

*

*For the future work items, we can use witadmin and import the new XML definitions of the various work items.

*However, for the existing data (old work items) we will have to first understand how the data is stored in the SQL databases of TFS and then manually map old work items and their states to the agile template and fire SQL queries to change the references.

For #2, is that the only way to go ahead? Since microsoft is fond of wizards, I wonder if there is one to make out life easier here :)

A: First of all you do not want to do direct SQL queries, this is unsupported, and will put your TFS in an unsupported state.
Microsoft has a wizard for adding some of the new WITD, but it's mostly intended for people coming from 2012->2013 and staying on the same template (e.g. Scrum 2012 -> Scrum 2013, the wizard will add the new Feature WITD).
For your scenario what I do is take the old WITD (CMMI) and the desired WITD (Scrum), and do a compare, identify the changes, then make them via WITADMIN one at a time.
This will include renaming Work Item Types, adding fields, removing fields, and/or renaming fields.  For renaming fields what you need to do is add the new field, copy over the data (either via Excel or TFS API) then delete the old field.
Also need to add in any new WITD, and remove any obsolete ones.  You also probably want to replace your SSRS reports with the SSRS reports for the Agile template (you can do this using tfpt: http://msdn.microsoft.com/en-us/library/dn130125.aspx).
Jason Stangroome tried to create a tool to automate much of this, not sure where he got to with it, but you can read about it here: http://blog.stangroome.com/2013/07/16/witmorph-changing-team-foundation-process-templates-in-place/

A: Dylan Smith above has the best solution in his comments above (Sorry I don't have the rep to comment).

*

*Create the new template to your liking (As mentioned above)

*Use the API (another blog: http://pwee167.wordpress.com/2012/09/18/retrieving-work-items-using-the-team-foundation-server-api/) to modify existing WI's by adding new fields and changing existing ones. The code is simple to write (It's your TFS - just hardcode the server details etc.).

Alternatively you can (using the API) to close and create new work items to match the template. Once you get the connection to TFS the API is simple although examples are scarce.

A: I would evaluate the costs and benefits of moving to the new template vs using the template you are currently on. We looked at doing the same thing you are proposing but found that we didn't really need to. We are using our old CMMI work item types and are still able to use the backlogs and kanban boards. We did have to add a couple of fields but it really wasn't that big of a deal.


text:
Q: How do you change hint text color in Android Studio? I cannot get the hint text color to change in my Android application on the log in page.
<AutoCompleteTextView
                android:id="@+id/email"
                android:textColor="@color/white"
                android:backgroundTint="@android:color/white"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/prompt_email"
                android:textColorHint="@android:color/white"
                android:inputType="textEmailAddress"
                android:maxLines="1" />

I use the textColorHint method as found in many other examples online but I do not know what is wrong with what I am doing.

A: Use attribute android:textColorHint="YOUR_COLOR" to set hints text color.
In your AutoCompleteTextView, you are using WHITE color for textColor, backgroundTint and textColorHint. Make sure your AutoCompleteTextView background color is different from WHITE.
Here is an working example for AutoCompleteTextView. I have used RED color for textColor, GREEN color backgroundTint and BLUE color for textColorHint.
<AutoCompleteTextView
    android:id="@+id/email"
    android:textColor="#FF0000"
    android:backgroundTint="#00FF00"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Write something..."
    android:textColorHint="#0000FF"
    android:inputType="textEmailAddress"
    android:maxLines="1" />

OUTPUT

Hope this will help you~

A: Just add the text  in the layout's EditText            android:textColorHint = "@android:color/     then press ctrl+space and choice your color.


text:
Q: SpringBoot RestController not recognizing spring.jackson.property-naming-strategy property I have a SpringBoot (2.5.x) RestController which is returning Lists and would like to force the JSON representation to use specific naming convention for the properties.  I've tried the spring.jackson.property-naming-strategy property in application.properties but it seems to have no effect.  Also tried custom MappingJackson2HttpMessageConverter, using setPropertyNamingStrategy on the Autowired objectMapper, and using the @JsonNaming annotation in the controller class.
Any ideas on what I'm doing wrong?
Thanks!
--john

A: Put this on the class
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)

But it is outdated
At the same time it is still available
I don't know why
my spring boot 2.5.4

A: This is what I ended up doing:
    import com.fasterxml.jackson.annotation.JsonInclude
    import com.fasterxml.jackson.annotation.JsonInclude.Include
    import com.fasterxml.jackson.databind.PropertyNamingStrategies
    import com.fasterxml.jackson.databind.annotation.JsonNaming

    @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
    @JsonInclude(Include.NON_NULL)
    class Facility {
        String facility
        String facilityCode
        Integer sampleCount
    }


text:
Q: Count daily signups over n days with Rails ActiveRecord I need to get the number of signups each day to a rails application over a period of days, and stick them in an array. I currently have a working solution, but I'm sure there's a much better way to do this than having to query the database n times.
My current solution:
signups = []

30.times.do |i|
  day = Time.current - (29.days - i.days)
  todays_signups = User.where(time_joined: day.beginning_of_day..day.end_of_day).count
  signups << todays_signups
end

User.time_joined is a DATETIME column.
I'm sure there's a much better way to do this than hitting the database 30 times, and I'd like to avoid using raw SQL queries if possible.

A: You can do it just via SQL-query:
User.where(time_joined: your_interval).group("DATE(time_joined)").count


text:
Q: Formula to find missing numbers in sequence I'm not a mathematician, so I don't know the terminology.
I'm working in excel and I need to create a formula to fill in a sequence of numbers, where I know the beginning and end of the sequence, and the numbers in between are evenly spaced.
Basically this means that the first number (always lowest) is 0% and the highest number (always highest) is 100%, and I need to get the numbers in between.
For example with 3 .. .. .. 7, that would be 3 4 5 6 7.
Another example: 5 .. .. .. 15, that would be 5 7.5 10 12.5 15.
Each of the .. will have the same formula where I know on beforehand how much of the percentage it is, for example: 0% 25% 50% 75% 100%
What formula do I need to create this sequence?
If it helps, either reference to l,h for lowest and highest in your formula, or A1 and A5 if you prefer an excel style formula.

A: If the sequence is $l, a_1, a_2, \dots, a_n, h$ and the $a_k$ are the numbers to be determined, then there are $n+1$ gaps of equal length:
$$g : =a_1 - l = a_2 - a_1 = \dots = a_n - a_{n-1} = h - a_n.$$
It follows that $a_k = l + k\cdot g$ and
$$(n+1)\cdot g = h - l \implies g = \frac{h-l}{n+1}.$$
So the $k$-th missing number is
$$a_k = l+\frac{k(h-l)}{n+1}.$$


text:
Q: passing parameter with map function Stating with
a = ['abc', 'efg', 'hij']

I want to get
a = ['abc!', 'efg!', 'hij!']

But obviously without the use of for elements in a:...because it is not cleaver and I want to understand more about the map function and how it passes parameters.
So I try to append a '!' to all elements of the lists using the map function. But before doing so, append is a list method but not a str method.
b = map(list,a) # gives : a = [['a','b','c'],['d','e','f'],['h','i','j']]
a = map(list.append(['!']), b)

That last map function returns a TypeError:
TypeError: append() takes exactly one argument (0 given)

I wish to know if it is possible to pass parameter to the method used by map.
Thank.

A: You can get the expected result with following code:
a = ['abc', 'efg', 'hij']
map(lambda x: x + '!', a) # ['abc!', 'efg!', 'hij!']

First parameter of map is a function that is applied to all items on iterable which is the second parameter. You can't directly pass a parameter to the function given to map but you can create another function (or lambda) that passes the parameter just like in the example above.
Typically list comprehension should be favored over map because it more obvious what you are doing:
[x + '!' for x in a] # ['abc!', 'efg!', 'hij!']

A: map receives two parameters, a function and a list.
It calls the function once for each of the items, with the current item as a parameter.
Converting the strings into lists and appending to them might not be the best choice, due to what map returns, but you can actually append to strings together using the + operator.
You can achieve what you want by doing the following:
map(lambda s: s + '!', a)  # => ['abc!', 'efg!', 'hij!']

lambda is just another syntax for a function, its parameter is named s, and it returns s + '!'.

A: Using list comprehension:
>>> a = ['abc', 'efg', 'hij']
>>> ["{}!".format(x) for x in a]
['abc!', 'efg!', 'hij!']

How map works

map(function, iterator)

it takes element on by one and applies specified function to the each element
Example:
>>> def add_str(x):
...     return x+"!"
...
>>> a
['abc', 'efg', 'hij']
>>> map(add_str, a)
['abc!', 'efg!', 'hij!']


text:
Q: Is there a way in EarlGrey for me to reset the application automatically? Say I have the following app structure:
[View Controller 1] -> tap on next button
                       [View Controller 2] -> Check for Title

In EarlGrey, I defined this test by doing:
[[EarlGrey selectElementWithMatcher:grey_text(@"Next Button")]
    performAction:grey_tap()]
[[EarlGrey selectElementWithMatcher:grey_text(@"Screen Title")]
    assertWithMatcher:grey_sufficientlyVisible()];

But now, when I want to test for [View Controller 3], I notice that the app is still stuck on [View Controller 2]. Is there a call that I am missing that can enable me to go back to the first screen or reset the application for the next test?

A: As with any xctest the app is not restarted and remains in the same state that the previous test left it. You would require to reset app state explicitly in either the tearDown or setUp of the test case. You can:

*

*Write UI interactions that takes the App back to the main screen after each test case completes.

*Introduce a method resetApplicationForTesting in your App delegate and invoke that from the setUp method of each test case. If this logic needs to be shared with multiple test cases, consider creating a BaseTestClass which these tests cases inherit.
In the test's setUp method:
    MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
    [delegate resetApplicationForTesting];


text:
Q: when using react-datetime, redux-form and a custom input, the field doesn't update. Any idea why? I am trying to render a custom input field, and not use the default one, as I need some extra elements surrounding my input
This is my component, PetalkInvitationModal. The other 2 are examples of components that I'm trying to hack together for rendering the actual input field. I've initially tried to use RenderInputField, but then I started building RenderInputModalField, so to be able to control the props manually
import React from 'react'
import {GenericActionOrCancelModal} from "../GenericActionOrCancelModal";
import {reduxForm, Field} from "redux-form";
import Datetime from 'react-datetime';

import WarningAlert from "./components/alerts";

export class PetalkInvitationModal extends GenericActionOrCancelModal {

    this.renderDateInputOutsideForm = this.renderDateInputOutsideForm.bind(this);
    this.renderDateInputField = this.renderDateInputField.bind(this);
    this.renderDateInputAsFormField = this.renderDateInputAsFormField.bind(this);
  }

  renderDateInputOutsideForm(options) {
    return <Datetime
      closeOnSelect={true}
      renderInput={this.renderDateInputField(options)}/>;
  }

  /**
   * @param {{id}, {label}, {name}, {required}} options
   */
  renderDateInputField(options) {
    return (props, openCalendar, closeCalendar)=> {
      return (

            <input
              className="form-control"
              {...props}/>
            {options.label}

      )
    }
  }

  renderDateInputAsFormField(props) {
    const {input, inputProps, meta: {touched, error}} = props;

    // I'm trying to pass all the callbacks that I get, down to my component
    // I tried calling the callbacks from props2, and from olderInput
    const RenderInputModalWrapper = (
      (props2) => <RenderInputModalField olderInput={input} {...props2}/>
    );

    return <Datetime {...input} {...inputProps} renderInput={RenderInputModalWrapper}/>
  }

  renderFields() {
    return (

        {/*this doesn't work, sadly :( */}
        <Field
          name="option1"
          type="text"
          component={this.renderDateInputAsFormField}
          inputProps={{
            closeOnSelect: true
          }}
        />

        {/*this works...but it's not controlled by redux-form */}
        {this.renderDateInputOutsideForm({
          label: 'Erste Option (erforderlich)',
          name: 'option1',
        })}

    )
  }
}

function validate(values) {
  //...
}

export function RenderInputField(field) {
  const {input, meta: {touched, error, valid}} = field;
  const error_message = touched && !valid ? error : "";

  return (

      {field.label}
      <input {...field.input}
             id={field.htmlFor}
             className={field.className}
             type={field.type ? field.type : "text"}
             autoFocus={field.autoFocus}
             placeholder={field.placeholder}
             readOnly={field.readOnly ? field.readOnly : false}
      />

  )
}

export function RenderInputModalField(props) {
  let extras = {};
  let {onChange, onBlur, onFocus, onDragStart, onDrop} = props;

  if(props.olderInput){
    // this is not good at all field doesn't respond to clicks now
    // onChange = (evt) => (props.olderInput.onChange(evt), onChange(evt))
    // onBlur = (evt) => (props.olderInput.onBlur(evt), onBlur(evt))
    // onFocus = (evt) => (props.olderInput.onFocus(evt), onFocus(evt))
    // onDragStart = (evt) => (props.olderInput.onDragStart(evt), onDragStart(evt))
    // onDrop = (evt) => (props.olderInput.onDrop(evt), onDrop(evt))

    // this is not good; does something on the second click. only changes the
    // field value the first time
    // onChange = (evt) => (onChange(evt), props.olderInput.onChange(evt))
    // onBlur = (evt) => (onBlur(evt), props.olderInput.onBlur(evt))
    // onFocus = (evt) => (onFocus(evt), props.olderInput.onFocus(evt))
    // onDragStart = (evt) => (onDragStart(evt), props.olderInput.onDragStart(evt))
    // onDrop = (evt) => (onDrop(evt), props.olderInput.onDrop(evt))

    // this also responds to open only on the second click.
    // it also updates the value only the first time
    // onChange = (evt) => onChange(evt)
    // onBlur = (evt) => (onBlur(evt))
    // onFocus = (evt) => (onFocus(evt))
    // onDragStart = (evt) => (onDragStart(evt))
    // onDrop = (evt) => (onDrop(evt))

    // this doesn't respond to the first click, and doesn't update anything
    // onChange = (evt) => ( props.olderInput.onChange(evt))
    // onBlur = (evt) => (props.olderInput.onBlur(evt))
    // onFocus = (evt) => (props.olderInput.onFocus(evt))
    // onDragStart = (evt) => (props.olderInput.onDragStart(evt))
    // onDrop = (evt) => (props.olderInput.onDrop(evt))
  }

  extras = {onChange, onBlur, onFocus, onDragStart, onDrop};

  return (

      {props.label}
      <input {...props}
             {...extras}
             id={props.htmlFor}
             className={props.className}
             type={props.type ? props.type : "text"}
             autoFocus={props.autoFocus}
             placeholder={props.placeholder}
             readOnly={!!props.readOnly}
      />

  )
}

export default reduxForm({
  validate,
  form: 'PetalkInvitationModalForm'
})(PetalkInvitationModal)

So as you can see, I tried calling and passing all the callbacks I could, but obviously I'm missing something, and I spent a lot of time on this already.
Any ideas are welcome
[EDIT]
Also, I need to mention that I did find this post https://github.com/YouCanBookMe/react-datetime/issues/552#issuecomment-392226610
so I know how to render a Datetime component inside a Field.
<Field
    name="arrivalDate"
    component={CustomDatetimePicker}
    inputProps={{
      timeFormat: false,
      closeOnSelect: true,
      dateFormat: 'DD/MM/YYYY',
    }}
/>

const CustomDatetimePicker = props => {
  const {
    input,
    inputProps,
    meta: { touched, error }
  } = props;
  return (
     <Datetime {...input} {...inputProps} />
  );
};

I have also read the documentation of react-datetime where I'm shown how to render a customized input field inside a Datetime component:
https://github.com/YouCanBookMe/react-datetime#customize-the-input-appearance
var MyDTPicker = React.createClass({
    render: function(){
        return <Datetime renderInput={ this.renderInput } />;
    },
    renderInput: function( props, openCalendar, closeCalendar ){
        function clear(){
            props.onChange({target: {value: ''}});
        }
        return (

                <input {...props} />
                <button onClick={openCalendar}>open calendar</button>
                <button onClick={closeCalendar}>close calendar</button>
                <button onClick={clear}>clear</button>

        );
    },
});

I'm just too noob at react to be able to put those 2 together


text:
Q: display tooltip on top of all html How does one display a tooltip (from TW3) on top of all html?
I have a dialog (which is not a modal one) and I'm trying to make a tooltip to display at the bottom side of the textbox when hovering over it. But it is partially blocked by the dialog because of its position which is absolute.
Doing tooltip { position: absolute; } (or any other class like .tooltip (notice the dot in front of tooltip)) didn't work either. And It seems no one has ever asked this question before.
Documentation doesn't say anything about displaying a tooltip on top of all html either.
So how can I make the tooltip appear like if its  positioned absolute?

A: something like this may be:
Make an event handler as following and attach it to the body of your html page
function hover (event) {
 var tooltip = '
Hi i am a tooltip
';
 tooltip.style.top = event.y;
 tooltip.style.top = event.x;
 tooltip.style.display = 'block';
 document.append(tooltip);
}


text:
Q: Launch MSI installer in silent mode from code I have a task to develop an update agent that launches an msi file after downloading it, the installation has to be invisible to the user.
But i have a problem with launching it with no UI. I tried using /q and /qn but it doesn't work, it only works with UI options.
internal static class MSI_runner
{
    public static bool RunInstallMSI(string sMSIPath)
    {
        try
        {
            Console.WriteLine("begin");
            //Starting to install application
            Process process = new Process();
            process.StartInfo.FileName = "msiexec.exe";
            process.StartInfo.Arguments = string.Format(" /q  /i \"{0}\" REINSTALLMODE=amus ", sMSIPath);
            Console.WriteLine("start");

            process.Start();
            process.WaitForExit();
            Console.WriteLine("end");

            return true;
        }
        catch
        {
            // "There was a problem installing the application!
            return false;  //Return False if process ended unsuccessfully
        }
    }
}

A: The most likely reason is that the install requires elevation, so there are a few things that this affects, but there are some guesses here because your "but it doesn't work" isn't very specific.

*

*When you run it in UI mode it probably asks for elevation. An administrator would just get an elevation prompt, a limited user would be asked to enter admin credentials. Either way, it runs elevated. When you run it silently the elevation prompt is not shown (silent means silent) and therefore it fails silently too because it requires elevated privileges.

*Your code almost certainly defaults to ProcessStartInfo.UseShellExecute=true, so any credentials of the process will not be used to launch the MSI. In situations where the MSI needs elevation and you want to install it silently you must give your exe a manifest for elevation (so it prompts) or runs elevated some other way. You also need UseShellExecute to be false so that the launch is a CreateProcess type of launch where the process privileges are inherited into the process you launch. In addition, there's also no real need to launch anything and get into this type of issue. If your process is elevated then just call MsiInstallProduct passing the path to the MSI and the command line. Then you know that the install runs with your privileges.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370315(v=vs.85).aspx
Assuming that your code is working, and as an aside, it's not clear what type of upgrade you are expecting. There's no mention of whether your MSI has a new ProductCode, ProductVersion etc. The normal method of applying a small update by reinstalling a new MSI with REINSTALLMODE is here:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa367575(v=vs.85).aspx
and REINSTALLMODE should be vomus.

A: try cactch (Exception ex) and see what ex.message is.
check here for msiexec params :
http://www.advancedinstaller.com/user-guide/msiexec.html


text:
Q: Link to different page and then scroll down to section (need to control scroll and where it stops) I am trying to point a hyperlink to a separate page and then it scrolls down to a particular section.
I have found a post in which someone has found solutions;
however,
because I am somewhat of a novice,
I don't know where to start the PHP code.
Could anyone be so kind as to teach me?
Would I publish this in a new PHP document or in the theme document?
Here's the link: jQuery scroll to ID from different page
var jump=function(e)
{
   if (e){
       e.preventDefault();
       var target = $(this).attr("href");
   }else{
       var target = location.hash;
   }

   $('html,body').animate(
   {
       scrollTop: $(target).offset().top
   },2000,function()
   {
       location.hash = target;
   });

}

$('html, body').hide();

$(document).ready(function()
{
    $('a[href^=#]').bind("click", jump);

    if (location.hash){
        setTimeout(function(){
            $('html, body').scrollTop(0).show();
            jump();
        }, 0);
    }else{
        $('html, body').show();
    }
});

By the way, I need the scrolling to happen so the viewer understands there is more content on the page and I need to be able to control the speed of the scroll and the location in which is set.
Currently I've been using the Jump but it is not scrolling and It is landing on the section showing in the very top and not in the center of the screen.
Any thoughts or help on this ?


text:
Q: How does one comment in an erb template? I have some trivial markup that looks like the following:

  <=% t'model.attr' %>

Is there a trivial way to comment that out? Just wrapping  around the block will still leave the ruby code available to the template. This means I have to comment out the HTML and Ruby specific code separately.
What's the best way to comment out all three lines with the least amount of markup?

A: Doesn't work:
<%#

  <=% t'model.attr' %>

 %>

Does work:
<% if false %>

  <=% t'model.attr' %>

<% end %>

A: =begin and =end are the Ruby version of block comments.
Using them in an erb template:
<%
=begin
%>

  <=% t'model.attr' %>

<%
=end
%>

A: You can comment ERB blocks using #:

  <%#= t'model.attr' %>

or avoid the literal HTML using Rails content_tag method:
<%#= content_tag :li, t'model.attr', :class=>:someclass %>

A: Edited because I noticed the true intention of your question:
<%
=begin
%>

  <%= t'model.attr' %>

<%
=end
%>

In every syntax highlighter that I've used (mainly textmate), this needs to be at the very beginning of the line, you can't indent it for it to appear commented. I don't know if that's a rule or a poor implementation of the highlighting.


text:
Q: Idiomatic way to spilt sequence into three lists using Kotlin So this is possibly more about functional programming than Kotlin, I am at that stage were a little knowledge is dangerous, and I wrote the app in Kotlin so seems fair to ask a Kotlin question as its Kotlins structures that i am interested in.
I have a sequence of items, they are in batches of three, so the stream may look like
1,a,+,2,b,*,3,c,&.......

What I want to do is to spilt this into three lists, currently I am doing this by partitioning into two lists, one that contains the numbers and one that contains everything else, then taking the second half of the result, the letters and symbols and partitioning again, into letters and symbols, thus i end up with three lists.
This strikes me as somewhat inefficient, maybe a functional approach isn't the best approach here.
Is there an efficient way of doing this, are my choices, this or a for loop?
Thanks

A: You can use groupBy method to group elements of your sequence by an element type:
val elementsByType = sequence.groupBy { getElementType(it) }

where getElementType is function returning a type of the element: whether it is a letter, or a number, or a symbol. This function may return either a number, such as 1, 2, 3, or a value of some enum with 3 different entries.
groupBy returns a map from element type to list of elements of that type.


text:
Q: Query tuning using joins I am quit new to query tuning practize.
Is there anyway I can tune this query using joins? I am using Percona MySQL 5.6. Please suggest
 SELECT
  COUNT(1) actionLogs
FROM
  (
    SELECT
      uid,
      `datetime`,
      subscriber,
      log
    FROM
      bcmServer.ACTIONLOG
    WHERE
      action_date = DATE(NOW())
  ) d,
  bcmServer.NETWORKELEMENT ne,
  bcmServer.SUBSCRIBER sub
  LEFT JOIN bcmServer.SUBDATA sd
    ON sd.macaddress = REPLACE(sub.name, '-', '')
WHERE
  sub.name = d.subscriber
  AND ne.uid = sub.neid
  AND ne.name = 'test'
  AND sd.effectiveend IS NULL

I am also providing the table structures and the EXPLAIN PLAN for the query
 CREATE TABLE `ACTIONLOG` (
  `uid` bigint(20) NOT NULL AUTO_INCREMENT,
  `datetime` datetime NOT NULL,
  `subscriber` varchar(255) NOT NULL,
  `log` text,
  `action_date` date DEFAULT NULL,
  PRIMARY KEY (`uid`),
  KEY `actionlog_idx_subscriber` (`subscriber`),
  KEY `action_date_idx` (`action_date`)
) ENGINE=InnoDB AUTO_INCREMENT=58749391 DEFAULT CHARSET=latin1

This is the 2nd table,
CREATE TABLE `NETWORKELEMENT` (
  `uid` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `ipv4Address` int(10) unsigned DEFAULT NULL,
  `deviceCnt` int(10) unsigned DEFAULT NULL,
  `emtaCnt` int(10) unsigned DEFAULT NULL,
  `currentUtilization` bigint(20) unsigned DEFAULT NULL,
  `lastSysUpTime` int(10) unsigned DEFAULT NULL,
  `lastCollectionTime` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`uid`),
  UNIQUE KEY `name` (`name`),
  KEY `name_2` (`name`),
  KEY `networkelement_idx_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=4994673 DEFAULT CHARSET=latin1

This is the 3rd table structure -->
CREATE TABLE `SUBSCRIBER` (
  `uid` bigint(20) NOT NULL AUTO_INCREMENT,
  `acctId` bigint(20) NOT NULL,
  `neId` bigint(20) NOT NULL,
  `neUpIfId` bigint(20) NOT NULL,
  `neDnIfId` bigint(20) NOT NULL,
  `ipv4Address` int(10) unsigned DEFAULT NULL,
  `cpeIpv4Address` int(10) unsigned DEFAULT '0',
  `docsisMode` int(10) unsigned NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `service` varchar(255) DEFAULT NULL,
  `lastSysUpTime` int(10) unsigned DEFAULT NULL,
  `lastCollectionTime` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`uid`),
  UNIQUE KEY `acctId` (`acctId`),
  KEY `neId_idx` (`neId`),
  KEY `acctId_2` (`acctId`),
  KEY `name_idx` (`name`),
  KEY `subscriber_idx_neid` (`neId`)
) ENGINE=InnoDB AUTO_INCREMENT=17568842 DEFAULT CHARSET=latin1

This is the 4th table structure -->
CREATE TABLE `SUBDATA` (
  `CustomerID` varchar(255) DEFAULT NULL,
  `CompanyName` varchar(255) DEFAULT NULL,
  `FirstName` varchar(255) DEFAULT NULL,
  `LastName` varchar(255) DEFAULT NULL,
  `Address1` varchar(255) DEFAULT NULL,
  `Address2` varchar(255) DEFAULT NULL,
  `City` varchar(255) DEFAULT NULL,
  `State` varchar(255) DEFAULT NULL,
  `Zip` varchar(255) DEFAULT NULL,
  `Phone1` varchar(255) DEFAULT NULL,
  `Email` varchar(255) DEFAULT NULL,
  `BillingDate` varchar(64) DEFAULT NULL,
  `BillingAccount` varchar(255) DEFAULT NULL,
  `AccountStartDate` varchar(255) DEFAULT NULL,
  `AccountStatus` varchar(255) DEFAULT NULL,
  `CustomField1` varchar(255) DEFAULT NULL,
  `CustomField2` varchar(255) DEFAULT NULL,
  `System` varchar(255) DEFAULT NULL,
  `PackageName` varchar(255) DEFAULT NULL,
  `DownloadSpeed` varchar(64) DEFAULT NULL,
  `UploadSpeed` varchar(64) DEFAULT NULL,
  `ProvDownloadSpeed` int(11) DEFAULT NULL,
  `ProvUploadSpeed` int(11) DEFAULT NULL,
  `RateCode` varchar(255) DEFAULT NULL,
  `ModemStatus` varchar(255) DEFAULT NULL,
  `MacAddress` varchar(64) DEFAULT NULL,
  `accountId` varchar(64) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `serviceCode` varchar(255) DEFAULT NULL,
  `serviceDesc` varchar(255) DEFAULT NULL,
  `serviceStatus` varchar(255) DEFAULT NULL,
  `devAddr` varchar(64) DEFAULT NULL,
  `locHeadend` varchar(255) DEFAULT NULL,
  `locLine` varchar(255) DEFAULT NULL,
  `locNode` varchar(255) DEFAULT NULL,
  `effectiveStart` date DEFAULT NULL,
  `effectiveEnd` date DEFAULT NULL,
  `Exclude` bit(1) DEFAULT NULL,
  KEY `name_idx` (`MacAddress`),
  KEY `subdata_idx_effectiveend` (`effectiveEnd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

And here goes the EXPLAIN for the query,
Explain Plan


text:
Q: How to solve Sturm-Liouville problem $y'' + (1 + \lambda)y = 0$? Find all the eigenvalues and eigenfunctions of Sturm-Lioville problem:
$$y'' + (1 + \lambda)y = 0$$
$$y(0) = y \left(\frac{\pi}{2}\right) = 0$$
Can someone please tell me how to solve this? Because most of the time, I mostly solve this type of Sturm-Liouville problem $y'' + \lambda y = 0$. And, my book is base on theory more than example. Thank you in advance.

A: The general solution to $y''+(1+\lambda)y=0$ is $y=A\sin(kx)+B\cos(kx)$
where $k^2 = 1 + \lambda$
the condition $y(0) = 0 $ gives $B=0$
then $ y(\frac{\pi}{2})=0$ requires that k be an even integer $k=2n$
So for every positive integer $n$
$y_n = A \sin (2nx)$
$\lambda_n = 4n^2 -1$

A: It's exactly the same as
$$y'' + \lambda y = 0 $$
except that $\lambda$ is replaced by $\lambda + 1$
So the solution is essentially the same, just treat $\lambda +1$ as $\lambda$
For $\lambda + 1 < 0$, $y = e^{\sqrt{\lambda+1}\,x} + e^{-\sqrt{\lambda+1}\,x}$
For $\lambda+1 = 0$, $x^2 + x$
For $\lambda_1 > 0$, $y = \cos\sqrt{\lambda+1}\,x + \sin\sqrt{\lambda+1}\,x$
And so on