text:
Q: Continuous version of conditional probability distributions $( \mathcal{L}(X_t | \mathcal{G}) )_{t \geq 0}$ if $(X_t)_{t \geq 0}$ is continuous? Let me first explain the setup:

Let $(X_t)_{t \geq 0}$ be a stochastic process on some probability space $(\Omega,\mathcal{F},P)$ with values in a complete and separable metric space $E$ (e.g. $E = \mathbb{R}$) and let $\mathcal{G}$ be a sub-$\sigma$-field of $\mathcal{F}$. The conditional probability distribution $\mathcal{L}(X_t | \mathcal{G})$ can then be seen a as a random variable on $(\Omega,\mathcal{G})$ with values in $\mathcal{P}(E)$, which denotes the set of Borel probability measures on $E$. Then $\mathcal{P}(E)$ can be endowed with a metric that metrizes the weak convergence (also often called narrow convergence) of Borel probability measures on E, turning $\mathcal{P}(E)$ into a complete and separable metric space.

The question I have is about the regularization of the regular conditional probability distribution is the following:

If we now suppose that the paths $[0,\infty) \ni t \mapsto X_t(\omega) \in E$ are continuous for each $\omega \in \Omega$, can we choose versions/modifications of the collection of regular conditional probability distributions $(\mathcal{L}(X_t | \mathcal{G}))_{t \geq 0}$, such that the mappings $[0, \infty) \ni t \mapsto \mathcal{L}(X_t | \mathcal{G})(\omega) \in \mathcal{P}(E)$ become continuous for each $\omega \in \Omega$ ? Does this hold in this generality or do we need additional assumptions ?

If $(X_t)_{t \geq 0}$ is for example a Brownian motion, then the above desired regularisation would follow from Kolmogorov's continuity theorem. But I have not found any results for general continuous processes.
Thanks a lot in advance!

A: For simplicity take $E=\Bbb R$ and the time interval to be $[0,1]$, and think of $X=(X_t)_{0\le t\le 1}$ as a random  element of $C=C([0,1]\to\Bbb R)$, a Polish space. We then have a regular conditional distribution of $X$ given $\mathcal G$, call it $Q=Q(\omega,B)$, $\omega\in\Omega, B\in\mathcal B(C)$. And the induced "marginal conditional distribution" $A\mapsto Q(\omega, \{\pi_t\in A\})$ will be weakly continuous in $t$. Here $\pi_t$, $0\le t\le 1$ are the coordinate projections from $C$ to $\Bbb R$.


text:
Q: Write html into iframe with callback We are getting data from the backend and need to write it to an iframe.  We have to set the iframe height to the height of the content.  We can't get the correct height until the content is actually IN the iframe, which is not instantaneous for a large amount of content.  Is there a callback to know when the write is done?
Right now, we have a timer, but it is brittle code:
//data received from backend
//write data to iframe
//$iframe is a jQuery DOM element
$iframe[0].contentDocument.open();
$iframe[0].contentDocument.write(data);
$iframe[0].contentDocument.close();

setTimeout(function (){
    var scrollHeight = $iframe.contents().find('body')[0].scrollHeight
            $iframe.css("height", scrollHeight );
}, 1000);

A: Have you tried listening for the load event on the iframe?
var doc = $iframe[0].contentDocument
doc.open()
doc.write(data)
doc.close()

$iframe.on('load', function () {
    this.style.height = doc.body.scrollHeight + 'px'
})

A: iframes do have an onload event:

$iframe[0].contentDocument.open();
$iframe[0].contentDocument.write(data);
$iframe[0].contentDocument.close();

$iframe.onload = function() {
  var scrollHeight = $iframe.contents().find('body')[0].scrollHeight
  $iframe.css("height", scrollHeight);
};

A: maybe postMessage will help you.
var testData = 'test\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\ntest\n';
var $iframe = document.querySelector('#test-iframe');
var $button = document.querySelector('button');

// listen the callback message from iframe
window.self.addEventListener('message', function(ev) {
    if (ev.data && ev.data.status === 'ready') {
        $iframe.style.height = ev.data.height + 'px';
    }
});

$button.addEventListener('click', function() {
    // render content
    $iframe.contentDocument.body.innerText = testData;
    // send message to the top window
    window.self.postMessage({
        status: 'ready',
        height: $iframe.contentDocument.body.scrollHeight
    }, '*');
});
`

https://jsfiddle.net/caoyy/Lb5k13bw/2/

A: Your best option is to use mutationObserver in the iFrame. This is not quite as simple as a callback I'm afraid.
Here's is the code the iFrame-resizer library uses to work this out. You would need to change the line that calls sendSize To call your callback method.
function setupBodyMutationObserver(){
    function addImageLoadListners(mutation) {
        function addImageLoadListener(element){
            if (false === element.complete) {
                console.log('Attach listeners to ' + element.src);
                element.addEventListener('load', imageLoaded, false);
                element.addEventListener('error', imageError, false);
                elements.push(element);
            }
        }

        if (mutation.type === 'attributes' && mutation.attributeName === 'src'){
            addImageLoadListener(mutation.target);
        } else if (mutation.type === 'childList'){
            Array.prototype.forEach.call(
                mutation.target.querySelectorAll('img'),
                addImageLoadListener
            );
        }
    }

    function removeFromArray(element){
        elements.splice(elements.indexOf(element),1);
    }

    function removeImageLoadListener(element){
        console.log('Remove listeners from ' + element.src);
        element.removeEventListener('load', imageLoaded, false);
        element.removeEventListener('error', imageError, false);
        removeFromArray(element);
    }

    function imageEventTriggered(event,type,typeDesc){
        removeImageLoadListener(event.target);
        sendSize(type, typeDesc + ': ' + event.target.src, undefined, undefined);
    }

    function imageLoaded(event) {
        imageEventTriggered(event,'imageLoad','Image loaded');
    }

    function imageError(event) {
        imageEventTriggered(event,'imageLoadFailed','Image load failed');
    }

    function mutationObserved(mutations) {
        sendSize('mutationObserver','mutationObserver: ' + mutations[0].target + ' ' + mutations[0].type);

        //Deal with WebKit asyncing image loading when tags are injected into the page
        mutations.forEach(addImageLoadListners);
    }

    function createMutationObserver(){
        var
            target = document.querySelector('body'),

            config = {
                attributes            : true,
                attributeOldValue     : false,
                characterData         : true,
                characterDataOldValue : false,
                childList             : true,
                subtree               : true
            };

        observer = new MutationObserver(mutationObserved);

        console.log('Create body MutationObserver');
        observer.observe(target, config);

        return observer;
    }

    var
        elements         = [],
        MutationObserver = window.MutationObserver || window.WebKitMutationObserver,
        observer         = createMutationObserver();

    return {
        disconnect: function (){
            if ('disconnect' in observer){
                console.log('Disconnect body MutationObserver');
                observer.disconnect();
                elements.forEach(removeImageLoadListener);
            }
        }
    };
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Where can I find this result? A Noetherian scheme $X$ over an algebraically closed field $k$ the set of  derivations $\mathcal{O}_{X,x} \to \kappa(x)=k$, is isomorphic to the Zariski tangent space $(\mathfrak{m}/\mathfrak{m}^2)^*$ where $\mathfrak{m}$ is the maximal ideal of $\mathcal{O}_{X,x}$.

A: A possible reference is

A. Borel, Linear Algebraic Groups, AG.15.4, p.34.


text:
Q: Boost Python not finding dll file Whilst trying to install Boost Python on Visual Studio I have been getting few results. I was able to create the Boost.Python library and the boost_python...lib file has also been created which took me long to figure out how to achieve this.
However, now in visual studio, after adding the include and library path to the linker, I was not able to get a small test program to work.
When trying to run the following line of code:
Py_Initialize();
using namespace boost::python;
object main_module((handle<>(borrowed(PyImport_AddModule("__main__")))));

I am getting the following error

The program could not start because boost_python-vc141-1_65.dll is missing....

When I look in the boost folder just where the libraries are (in the stage folder) I can clearly see this file and I have linked the program against this folder.
I have tried various different Boost versions.
The latest stable build so 1.64 has the same problem as the beta 1.65. With a previous build, 1.61, I couldn't even get the Boost.Python to build.
I also tried different Python versions, 3.6 and now 2.7. I have uninstalled all other versions of Python so that the 2.7 version is the only one. I also made sure that the PYTHONHOME and PYTHONPATH are set in the system variables.
?
Am i missing something important to get this Boost Python library to work? If any other information are needed please ask and I will add it, but since i'm unfamiliar with boost and linking in general i'm not sure what information is relevant.

A: On Windows there isn't /usr/shared directory, so boost build script can't install a dll library for everybody. So you're supposed to do the job yourself.
Your dll files must be in the same directory with your exe file. When you compiled boost, it created dll library in the boost output dir (search for this file). So, you have to copy this *.dll file to your output directory (where C++ compiler/linker create your *.exe) via custom build step or something.
If SafeDllSearchMode is enabled, the search order is as follows:

*

*The directory from which the application loaded.

*The system directory. Use the GetSystemDirectory function to get the path of this directory.

*The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.

*The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.

*The current directory.

*The directories that are listed in the PATH environment variable. Note that this does not include the per-application path
specified by the App Paths registry key. The App Paths key is not
used when computing the DLL search path.

If SafeDllSearchMode is disabled, the search order is as follows:

*

*The directory from which the application loaded.

*The current directory.

*The system directory. Use the GetSystemDirectory function to get the path of this directory.

*The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.

*The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.

*The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by

*the App Paths registry key. The App Paths key is not used when
computing the DLL search path.

Taken from here


text:
Q: rtcwake from acpi state s5 I've used rtcwake on my desktop for some time running Precise Pangolin without problems. Recently I came across a thinkpad x230 with an ultradock which I also installed Precise Pangolin on.
It works great and for a while rtcwake seemed to work as well. I noticed that it only seemed to support "off-mode" when attached to the dock though. Now it no longer seems to support "off-mode" and that's my problem. It doesn't wake up no more. I've tried "mem" and that works, but I really would like "off" to work as well.
Anyone got any ideas?

A: Seems it was a BIOS issue. Changing various BIOS settings seems to have solved the problem. Likely it was me changing the value of "Wake on AC" to disabled which caused the problem in the first case. For future reference the problem seems to have been the value of "Alarm_irq" being changed to "no" instead of the "yes" it should have been, during shutdown or restart.


text:
Q: Sendind mail to a database list Good evening to all. In my C# WinApp I sending an e-mail in this way:
mail.To.Add (new MailAddress ("firstname.lastname @ domain.com"));
Now, I would like to send an mail to a list of users stored in a table of MySQL database.
Which is the best approach for this?
Thanks in advance.

A: Create your query and loop through the reader like this:
Sqldatareader rdr = sqlcommand_variable.ExecuteReader();
While (rdr.read()) {
    mail.To.Add(new MailAddress(rdr['firstname'] + "." + rdr['lastname'] + "@domain.com"));
}


text:
Q: Formulae for destructive interference There are two formulae for destructive interference. In which situation do we use them?
$$(n+1/2)\lambda $$
and
$$(n-1/2)\lambda $$
I'm confused as my book has mentioned the first one but In question both of them are used.

A: Destructive interference happens when the crests of one wave align with the troughs of another wave, the amplitude of the resulting wave will then be the absolute difference of the amplitudes of the source waves.
Over the span of every wavelength there is one crest and one trough, separated by half a  wavelength. So to align crests with troughs, you have to shift one of the waves by half a wavelength. It doesn't matter in which direction you do this, because waves are periodic, nothing changes when you shift a wave by one wavelength. I don't exactly know what your formulas represent, but if they are the difference in path length necessary for two initially coherent waves to destructively interfere, you can see that the difference is exactly one wavelength
$$ \left(n + \frac{1}{2} \right) \lambda - \left(n  -\frac{1}{2}\right) \lambda = 1 \lambda $$

A: Why it doesn't matter which you use
In both those formulas $n$ nominally represents any integer value so the $n \pm \frac{1}{2}$ (both of them) represent all the places half-way between the integers. They both describe the same set of values.
They are the same.
Why it could matter in class
If a question were too ask you for the path difference of "the second dark fringe" or something similar then you might expect to substitute 2 in for $n$, but then there is an ambiguity: you have to know which fringe is "first" to know how to proceed.
Here you are concerned about how you label the members of the set.
For this reason I prefer to use things like "the dark fringe between the second and third bright fringes" when I am writing questions. Because we usually use just one formula ($n\lambda$) for numbering the bright fringes.


text:
Q: Running Postgres as Launch Daemon I am working on setting up a psql server and would therefore like postgres to run whenever the computer is on, regardless of whether I'm logged it. (The machine is running OS X Yosemite.) I set up a launch daemon to do this, but it doesn't work. syslog gives the following error messages:
Jul 14 17:43:01 user@server sudo[276]:     jaia : TTY=ttys000 ;
PWD=/Users/jaia ; USER=root ; COMMAND=/usr/bin/nano /Library/LaunchDaemons/homeb
rew.mxcl.postgresql.plist
Jul 14 17:44:35 localhost com.apple.xpc.launchd[1] (homebrew.mxcl.postgresql): T
his service is defined to be constantly running and is inherently inefficient.
Jul 14 17:44:44 localhost com.apple.xpc.launchd[1] (homebrew.mxcl.postgresql): S
ervice only ran for 9 seconds. Pushing respawn out by 1 seconds.
Jul 14 17:44:45 localhost com.apple.xpc.launchd[1] (homebrew.mxcl.postgresql): S
ervice only ran for 0 seconds. Pushing respawn out by 10 seconds.

After that, the last message repeats indefinitely.
Here's my .plist file. The reason for sudo -u _postgres is that postgres can't run as root, which launch daemons do by default.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>KeepAlive</key>
  <true/>
  <key>Label</key>
  <string>homebrew.mxcl.postgresql</string>
  <key>ProgramArguments</key>
  <array>
    <string>sudo</string>
    <string>-u</string>
    <string>_postgres</string>
    <string>/usr/local/bin/pg_ctl</string>
    <string>-D</string>
    <string>/usr/local/var/postgres</string>
    <string>start</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>UserName</key>
  <string>_postgres</string>
  <key>WorkingDirectory</key>
  <string>/usr/local/var/postgres</string>
  <key>StandardErrorPath</key>
  <string>/usr/local/var/postgres/server.log</string>
</dict>
</plist>

MORE INFORMATION: Loading the job manually via ssh gives the ungrammatical error message "Could not find domain for". Loading it on the machine itself gives "/Library/LaunchDaemons/homebrew.mxcl.postgresql.plist: File exists".
What could be going wrong here?

A: Leave out the sudo, -u and _postgres in ProgramArguments. launchd takes care of this with the UserName key.


text:
Q: Is there a proper way to allow access to private list by reference? I'm trying to provide a by-reference getter to a list of objects in a class. My setup looks something roughly like this:
class c_Container
{
public:
    c_Item* Get(int uid);
private:
    c_Item itemList[10];
}

class c_Item
{
public:
    int uid;
}

c_Item* c_Container::Get(int uid)
{
    for (int i = 0; i < 10; i++)
    {
        if (itemList[i].uid == uid)
        {
            return &itemList[i];
        }
    }

    return NULL;
}

This is a simplistic example showing usage, usually a c_Item object would have other methods that would do other things. We'd want to obtain the c_Item object from itemList by reference or by address so that we can directly modify it.
When compiling, I get a lint error something like "Exposing low access member 'itemList'". If I try to return by reference instead of returning a pointer, I get the same thing. I guess I understand why, but I can't conceive of a better way to obtain an object from a container class like this by reference. I can fix the error by making itemList public, but that seems like unnecessary access.
Outside of creating wrapper methods in c_Container for all of c_Item's methods (which seems redundant), is there a better way to handle a situation like this?

A: Container classes are an exception to the general rule that you should not provide public access to private members (by returning a pointer or reference in a getter).
However, a lint tool is not smart enough to determine if the container exception should apply to your Get method or not, so it tries to make the safe assumption and generates a warning.
Most lint tools can be given additional information through source code annotations. Check the documentation for your tool to see how it can be informed that the warning for this function is a false-positive and should be suppressed.


text:
Q: protobuf within avro encoded message on kafka Wanted to know if there is a better way to solve the problem that we are having. Here is the flow:
Our client code understands only protocol buffers (protobuf). On the server side, our gateway gets the protobuf and puts it onto Kafka.
Now avrò is the recommended encoding scheme, so we put the specific protobuf within avro (as a byte array) and we put it onto the message bus. The reason we do this is to avoid having to do entire protobuf->avro conversion.
On the consumer side, it reads the avro message, gets the protobuf out of it and works on that.
How reliable is protobuf with Kafka? Are there a lot of people using it? What exactly are the advantages/disadvantages of using Kafka with protobuf?
Is there  a better way to handle our use case/scenario?
thanks

A: *

*Kafka doesn't differentiate between encoding schemes since at the end every message flows in and out of kafka as binary.

*Both Proto-buff and Avro are binary based encoding schemes, why would you want to wrap a proto-buff inside an Avro schema, when you can directly put the proto-buff message into Kafka?


text:
Q: Wordpress Events Manager getting category name by category id What is the EM syntax for getting the EM category id based on the EM category name? In the regular WP category taxonomy it is
get_cat_ID($cat_name)

Is there something similar for EM categories?
Any thoughts would be greatly appreciated.

A: get_term_by('name', $cat_name, EM_TAXONOMY_CATEGORY);
http://codex.wordpress.org/Function_Reference/get_term_by
I suggest you bring this up on our forums, since we don't actively provide support on here.
http://wordpress.org/support/plugin/events-manager


text:
Q: NullReferenceException When using Sqlite with WP7 I am quite new to Windows Phone dev, I am following the tutorial on the link below in which it has been explained that how one can use existing SQLite DB with WP.
http://dotnetslackers.com/articles/silverlight/Windows-Phone-7-Native-Database-Programming-via-Sqlite-Client-for-Windows-Phone.aspx
When I run it with my DB, I get error at the line:
System.IO.Stream src = Application.GetResourceStream(new Uri("/" + assemblyName + ";component/" + dbName, UriKind.Relative)).Stream;

I have tried solving it by breaking it down, but it did not help me. Any help is appreciated. This is how it was mentioned in tutorial, I also change the name of the DB accordingly, but ap crashes. Please help me and pull me out of this. Thanks.

A: You should make sure that:

*

*the database file exists at the specified path

*the Build Action of the database file is set to Resource


text:
Q: `docker services ls` shows running services but `docker ps -a` is missing running containers? Where are the other missing running containers listed? The wordpress service is running confirmed by docker service ls and the blog is up when visiting the blog url (which gets taken down after executing docker stack rm wordpress).
Once wordpress is deployed using docker stack deploy the stack looks like this:
user@prod:~/wordpress$ docker service ls
ID             NAME                  MODE         REPLICAS   IMAGE              PORTS
ph38i5su9slr   traefik_traefik       replicated   1/1        traefik:v2.4
yhu02cqufy8l   wordpress_db          replicated   1/1        mysql:5.7
v4q2ztqwv118   wordpress_wordpress   replicated   1/1        wordpress:latest

user@prod:~/wordpress$ docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED      STATUS      PORTS                                                                      NAMES
697cf6cfa806   traefik:v2.4   "/entrypoint.sh --pr…"   4 days ago   Up 4 days   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   traefik_traefik.1.i4txtjd2p0rcbnpd3bkv54eo2

Why are the wordpress containers not showing up in docker ps -a?

A: You're using Docker Swarm which can run over multiple nodes in cluster mode.
A plausible scenario is that traefik is running on the node where you're executing the docker ps -a command and the other containers are running on different node/s.
To confirm that there is more than one node you can try and execute docker node ls. I can't think of any other scenario where you have a running service, but only one of the containers is visible (and you have a single host).


text:
Q: How to install Xubuntu complete version from the terminal? I currently use Ubuntu 11.10 64bits and would like to switch to Xubuntu.
If I run the command
sudo apt-get install xubuntu-desktop

will it install only the desktop environnement (XFCE, if I'm not mistaking) or will it install everything like from a Xubuntu LiveCD?
Indeed, as I'm new in the GNU/Linux world, I'm trying several distros and so would like to know if it was possible to proceed that way to install other distros...
Thanks!

A: You would install xubuntu-desktop

xubuntu-desktop is a metapackage
https://help.ubuntu.com/community/MetaPackages
Or a list of all the packages contained in the xubuntu-desktop, which is xfce + additional packages / customizations , same as on the xubuntu CD.
For sfce vs xubutnu-desktop see also
Xubuntu desktop minimal installation
You will keep the additional packages included in ubuntu, so you will have more then would be included with the xubuntu cd.


text:
Q: Build failing on sn.exe I'm trying to build a (seemingly unmaintained) free-software project that's written in C# (Math.NET Iridium).
The build fails on this error:

Error   1
The command ""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\sn.exe" -Vr *,"c061a3ec32cc0c6f" "C:\Users\dharmatech\Documents\mathnet-iridium - a\src\app\MathNet.Iridium\Library\..\..\..\..\config\personal_test_public.snk"" exited with code 1.
C:\Users\dharmatech\Documents\mathnet-iridium - a\src\app\MathNet.Iridium\Library\Iridium.csproj    252 5   Iridium

Any suggestions for how to get around that error?

A: The issue is that people maintaining Iridium have modified the iridium.csproj to test sign the dlls.
Just open the csproj located at "..\mathnet-iridium-master\mathnet-iridium-master\src\app\MathNet.Iridium\Library\Iridium.csproj" in notepad and delete the section between (Line 235):
!-- MATHNET-BEGIN-TESTSIGNING --
!-- MATHNET-END-TESTSIGNING --
Save the csproj and build again.
For information the csproj is as follows:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{26FC15DE-EFDA-403A-8284-1E2A4AE8A9D8}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MathNet.Numerics</RootNamespace>
    <AssemblyName>MathNet.Iridium</AssemblyName>
    <ApplicationIcon>
    </ApplicationIcon>
    <SignAssembly>false</SignAssembly>
    <AssemblyOriginatorKeyFile>Properties\mathnet_public.snk</AssemblyOriginatorKeyFile>
    <DelaySign>false</DelaySign>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <OldToolsVersion>2.0</OldToolsVersion>
    <PublishUrl>publish\</PublishUrl>
    <Install>true</Install>
    <InstallFrom>Disk</InstallFrom>
    <UpdateEnabled>false</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateInterval>7</UpdateInterval>
    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    <UpdatePeriodically>false</UpdatePeriodically>
    <UpdateRequired>false</UpdateRequired>
    <MapFileExtensions>true</MapFileExtensions>
    <ApplicationRevision>0</ApplicationRevision>
    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <UseApplicationTrust>false</UseApplicationTrust>
    <BootstrapperEnabled>true</BootstrapperEnabled>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\..\..\..\build\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseVSHostingProcess>true</UseVSHostingProcess>
    <OutputType>Library</OutputType>
    <AssemblyName>MathNet.Iridium</AssemblyName>
    <RootNamespace>MathNet.Numerics</RootNamespace>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\..\..\..\build\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <DocumentationFile>..\..\..\..\build\Release\MathNet.Iridium.xml</DocumentationFile>
    <OutputType>Library</OutputType>
    <AssemblyName>MathNet.Iridium</AssemblyName>
    <DebugSymbols>false</DebugSymbols>
    <RootNamespace>MathNet.Numerics</RootNamespace>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Combinatorics.cs" />
    <Compile Include="Complex.cs" />
    <Compile Include="ComplexPolynomial.cs" />
    <Compile Include="ComplexRational.cs" />
    <Compile Include="Constants.cs" />
    <Compile Include="Distributions\Continuous\BetaDistribution.cs" />
    <Compile Include="Distributions\Continuous\CauchyLorentzDistribution.cs" />
    <Compile Include="Distributions\Continuous\ChiSquareDistribution.cs" />
    <Compile Include="Distributions\Continuous\ContinuousUniformDistribution.cs" />
    <Compile Include="Distributions\Continuous\ChiDistribution.cs" />
    <Compile Include="Distributions\Continuous\RayleighDistribution.cs" />
    <Compile Include="Distributions\Continuous\StudentsTDistribution.cs" />
    <Compile Include="Distributions\Continuous\ErlangDistribution.cs" />
    <Compile Include="Distributions\Continuous\ExponentialDistribution.cs" />
    <Compile Include="Distributions\Continuous\FisherSnedecorDistribution.cs" />
    <Compile Include="Distributions\Continuous\GammaDistribution.cs" />
    <Compile Include="Distributions\Continuous\LaplaceDistribution.cs" />
    <Compile Include="Distributions\Continuous\LognormalDistribution.cs" />
    <Compile Include="Distributions\Continuous\NormalDistribution.cs" />
    <Compile Include="Distributions\Continuous\ParetoDistribution.cs" />
    <Compile Include="Distributions\Continuous\StableDistribution.cs" />
    <Compile Include="Distributions\Continuous\StandardDistribution.cs" />
    <Compile Include="Distributions\Continuous\TriangularDistribution.cs" />
    <Compile Include="Distributions\DiscreteDistribution.cs" />
    <Compile Include="Distributions\Discrete\ArbitraryDistribution.cs" />
    <Compile Include="Distributions\Discrete\BernoulliDistribution.cs" />
    <Compile Include="Distributions\Discrete\BinomialDistribution.cs" />
    <Compile Include="Distributions\Discrete\HypergeometricDistribution.cs" />
    <Compile Include="Distributions\Discrete\DiscreteUniformDistribution.cs" />
    <Compile Include="Distributions\Discrete\GeometricDistribution.cs" />
    <Compile Include="Distributions\Discrete\PoissonDistribution.cs" />
    <Compile Include="Distributions\Discrete\ZipfDistribution.cs" />
    <Compile Include="Distributions\IDiscreteGenerator.cs" />
    <Compile Include="Distributions\IContinuousGenerator.cs" />
    <Compile Include="Distributions\IContinuousProbabilityDistribution.cs" />
    <Compile Include="Distributions\ContinuousDistribution.cs" />
    <Compile Include="Distributions\IDiscreteProbabilityDistribution.cs" />
    <Compile Include="Equations\ScalarIterator.cs" />
    <Compile Include="Equations\Solver.cs" />
    <Compile Include="IAlmostEquatable.cs" />
    <Compile Include="Integration\Algorithms\DoubleExponentialTransformation.cs" />
    <Compile Include="Integration\Algorithms\SimpsonRule.cs" />
    <Compile Include="Integration\Algorithms\TrapeziumRule.cs" />
    <Compile Include="Integration\Integrate.cs" />
    <Compile Include="Interpolation\Algorithms\AkimaSplineInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\BarycentricInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\ChebyshevFirstKindPolynomialInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\ChebyshevSecondKindPolynomialInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\CubicHermiteSplineInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\CubicSplineInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\EquidistantPolynomialInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\LimitedOrderPolynomialInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\LimitedOrderRationalInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\LinearSplineInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\PolynomialInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\RationalPoleFreeInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\RationalInterpolation.cs" />
    <Compile Include="Interpolation\Algorithms\SplineInterpolation.cs" />
    <Compile Include="Interpolation\Interpolation.cs" />
    <Compile Include="Interpolation\InterpolationMethod.cs" />
    <Compile Include="Interpolation\SplineBoundaryCondition.cs" />
    <Compile Include="LinearAlgebra\Algorithms\Orthogonal.cs" />
    <Compile Include="LinearAlgebra\ComplexMatrix.cs" />
    <Compile Include="LinearAlgebra\ComplexVector.cs" />
    <Compile Include="LinearAlgebra\IMatrix.cs" />
    <Compile Include="LinearAlgebra\IVector.cs" />
    <Compile Include="LinearAlgebra\Vector.cs" />
    <Compile Include="NumberTheory\IntegerTheory.cs" />
    <Compile Include="Properties\LocalStrings.cs" />
    <Compile Include="RandomSources\CryptographicRandomSource.cs" />
    <Compile Include="RandomSources\ObjectModel\RandomByteSourceAdapter.cs" />
    <Compile Include="Searching.cs" />
    <Compile Include="Sorting.cs" />
    <Compile Include="OnDemandComputation.cs" />
    <Compile Include="RandomSources\AdditiveLaggedFibonacciRandomSource.cs" />
    <Compile Include="RandomSources\MersenneTwisterRandomSource.cs" />
    <Compile Include="RandomSources\RandomSource.cs" />
    <Compile Include="Interpolation\Interpolation1D.cs" />
    <Compile Include="Interpolation\InterpolationAlgorithm.cs" />
    <Compile Include="Interpolation\PolynomialInterpolationAlgorithm.cs" />
    <Compile Include="Interpolation\RationalInterpolationAlgorithm.cs" />
    <Compile Include="IRealFunction.cs" />
    <Compile Include="LinearAlgebra\CholeskyDecomposition.cs" />
    <Compile Include="LinearAlgebra\EigenvalueDecomposition.cs" />
    <Compile Include="LinearAlgebra\LUDecomposition.cs" />
    <Compile Include="LinearAlgebra\Matrix.cs" />
    <Compile Include="LinearAlgebra\NamespaceDoc.cs" />
    <Compile Include="LinearAlgebra\QRDecomposition.cs" />
    <Compile Include="LinearAlgebra\SingularValueDecomposition.cs" />
    <Compile Include="Natural.cs" />
    <Compile Include="Number.cs" />
    <Compile Include="Polynomial.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Quaternion.cs" />
    <Compile Include="RandomSources\SystemRandomSource.cs" />
    <Compile Include="RandomSources\XorShiftRandomSource.cs" />
    <Compile Include="Rational.cs" />
    <Compile Include="Ratios.cs" />
    <Compile Include="SampleList.cs" />
    <Compile Include="Set.cs" />
    <Compile Include="SiConstants.cs" />
    <Compile Include="SiPrefixes.cs" />
    <Compile Include="SpecialFunctions.cs" />
    <Compile Include="SpecialFunctions\Algorithms\BetaRegularizedAlgorithm.cs" />
    <Compile Include="SpecialFunctions\Algorithms\DigammaAlgorithm.cs" />
    <Compile Include="SpecialFunctions\Algorithms\ErrorFunctionAlgorithm.cs" />
    <Compile Include="SpecialFunctions\Algorithms\FactorialAlgorithm.cs" />
    <Compile Include="SpecialFunctions\Algorithms\GammaAlgorithm.cs" />
    <Compile Include="SpecialFunctions\Algorithms\GammaRegularizedAlgorithm.cs" />
    <Compile Include="Statistics\Accumulator.cs" />
    <Compile Include="Statistics\DescriptiveStatistics.cs" />
    <Compile Include="Statistics\Histogram.cs" />
    <Compile Include="Transformations\ComplexFourierTransformation.cs" />
    <Compile Include="Transformations\InternalFFT.cs" />
    <Compile Include="Transformations\RealFourierTransformation.cs" />
    <Compile Include="Transformations\TransformationConvention.cs" />
    <Compile Include="Trigonometry.cs" />
    <Compile Include="Tuple.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Properties\mathnet_public.snk" />
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- MATHNET-BEGIN-TESTSIGNING -->
  <Target Name="AfterBuild">
    <CallTarget Targets="TestSign" />
  </Target>
  <PropertyGroup>
    <NL>%0D%0A</NL>
    <QUOT>%22</QUOT>
  </PropertyGroup>
  <PropertyGroup>
    <RootPath>$(MSBuildProjectDirectory)\..\..\..\..\</RootPath>
    <ConfigPath>$(RootPath)config\</ConfigPath>
    <StrongNameTestKeyPrivateFullName>$(ConfigPath)personal_test_private.snk</StrongNameTestKeyPrivateFullName>
    <StrongNameTestKeyPublicFullName>$(ConfigPath)personal_test_public.snk</StrongNameTestKeyPublicFullName>
    <ProjectGuid>{26FC15DE-EFDA-403A-8284-1E2A4AE8A9D8}</ProjectGuid>
    <RootNamespace>MathNet.Numerics</RootNamespace>
  </PropertyGroup>
  <Target Name="TestSign">
    <GetFrameworkSdkPath>
      <Output TaskParameter="Path" PropertyName="FrameworkSdkPath" />
    </GetFrameworkSdkPath>
    <Error Condition="'$(FrameworkSdkPath)'==''" Text="Framework SDK not available." />
    <CreateItem Include="$(FrameworkSdkPath)bin\sn.exe" Condition="'@(StrongNameExe)'==''">
      <Output TaskParameter="Include" ItemName="StrongNameExe" />
    </CreateItem>
    <Error Condition="!Exists('@(StrongNameExe)')" Text="Strongname Tool not available." />
    <Exec Command="$(QUOT)@(StrongNameExe)$(QUOT) -k $(QUOT)$(StrongNameTestKeyPrivateFullName)$(QUOT)" Condition="!Exists($(StrongNameTestKeyPrivateFullName))" />
    <Exec Command="$(QUOT)@(StrongNameExe)$(QUOT) -p $(QUOT)$(StrongNameTestKeyPrivateFullName)$(QUOT) $(QUOT)$(StrongNameTestKeyPublicFullName)$(QUOT)" Condition="!Exists($(StrongNameTestKeyPublicFullName))" />
    <CreateItem Include="$(StrongNameTestKeyPrivateFullName)" Condition="'@(StrongNameTestKeyPrivate)'==''">
      <Output TaskParameter="Include" ItemName="StrongNameTestKeyPrivate" />
    </CreateItem>
    <Error Condition="!Exists('@(StrongNameTestKeyPrivate)')" Text="Test-signing private key not found (expected at @(StrongNameTestKeyPrivate)). Execute 'CreateNewPersonalTestKey.bat' once to generate one." />
    <Exec Command="$(QUOT)@(StrongNameExe)$(QUOT) -Vr *,$(QUOT)c061a3ec32cc0c6f$(QUOT) $(QUOT)$(StrongNameTestKeyPublicFullName)$(QUOT)" />
    <Message Text="$(NL)Test-Signing the target assembly $(TargetPath):$(NL)" />
    <Exec Command="$(QUOT)@(StrongNameExe)$(QUOT) -TS $(QUOT)$(TargetPath)$(QUOT) $(QUOT)@(StrongNameTestKeyPrivate)$(QUOT)" />
  </Target>
  <!-- MATHNET-END-TESTSIGNING -->
</Project>


text:
Q: why component is not destroyed under v-if I have very simple example. There are two divs each with v-if with same variable, one with true and one with false. There is component nested inside the each of the divs (same component).
What I see (from the console.log) is that even there is v-if, the component is not destroyed and created but rather reused.
Is this bug? feature? Because I was relying on them to be destroyed (the problem occur in some more complex component).
Thanks.
Html and javascript below, there is also jsfiddle https://jsfiddle.net/ekeydar/p64ewLd1/3/
This is the html:

  <button @click="show1=!show1">
    Toggle
  </button>

    <my-comp title="comp1"/>

    <my-comp title="comp2"/>

This is the javascript:
Vue.component('my-comp', {
    props: ['title'],
  template: '
{{title}}
',
  created: function() {
    console.log('my-comp.created title='+ this.title);
  },
  destroyed: function()  {
    console.log('my-comp.destroyed title='+ this.title);
  }
}),

new Vue({
  el: '#app',
  data: {
    show1: true,
  },
})

A: Here's a little trick (or horrible hack if you like) if you want your component to always be destroyed when it is hidden (e.g. to save memory). Use NaN as the key. Since NaN is never equal to itself Vue will always think it is a different element.

    <my-comp title="comp1" :key="NaN"/>

    <my-comp title="comp2" :key="NaN"/>

You need :key= rather than key= because otherwise the attribute will be a string with the value "NaN".

A: This is the intended functionality for Vue. In order to let Vue know that the component shouldn't be reused but instead destroyed and create a different component, add a key attribute to the components.
Example:

    <my-comp title="comp1" key="somekeyhere"/>

    <my-comp title="comp2" key="someotherkeyhere"/>

Note that you could also put the key attribute to the div, but I think it's cleaner to add it on the component since the div itself can be reused without issues.

A: The difference between v-if and v-show is just whether or not the element exists in the DOM, not whether or not it is created.  v-if removes it from the DOM when false, v-show just hides it.  The component however is not destroyed either way.


text:
Q: Salt: Minion did not return but salt-call is working I am working with SaltStack on Windows minions (Linux master). I have written a simple .sls file which copies a hello-world.txt at C:/hello_world.txt. I have also written my top.sls and configure my file_roots. Minions keys have been accepted (and test.ping is working).
My current problem is when I call (on the master):
salt 'my_minion' state.highstate

I get a:
Minion did not return. [no response]

Whereas when I try (on the minion):
salt-call state.highstate

Everything works fine (The file is copied). I have tried to add the -l debug option on the master but I don't get something interesting.
Any tips for debugging?

A: Try increasing the timeout with -t 300 or similar. When I first started working with salt, I found that highstates frequently take longer than the default 5 second timeout.
If that helps, you can change the default timeout with timeout: <whatever> in the master config file.


text:
Q: Using JQuery to change CSS of td on td click or checkbox click I am trying to get my td to change color if the user clicks the td itself or the checkbox.
Right now if the user clicks the td the css will change and the checkbox will check/uncheck.
But if the checkbox is clicked, nothing changes. additionally if the page is refreshed the checkboxes are checked, but the CSS is gone.
What am I doing wrong?
JSFiddle

<input type="checkbox" name="my-group[]" value="1">A

<input type="checkbox" name="my-group[]" value="2">B

<input type="checkbox" name="my-group[]" value="3">C

<input type="checkbox" name="my-group[]" value="4">D

A: The issue is due to the event bubbling from the checkbox to the parent td, however you can both avoid the problem completely, make the code more semantic, have better support, and simpler by using a label and then just toggling a CSS class on the parent td based on the checked state of the checkbox. Try this:

$('.table-responsive :checkbox').on('change', function() {
  $(this).closest('td').toggleClass('chosen', this.checked);
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />

        <input type="checkbox" name="my-group[]" value="1"> A

        <input type="checkbox" name="my-group[]" value="2"> B

        <input type="checkbox" name="my-group[]" value="3"> C

        <input type="checkbox" name="my-group[]" value="4"> D

A: This is my suggestion this will bind event in both TD and checkbox while also prevent from double triggering.
$('td').on('click',function(event){
     var td  = $(this);
     var checkBox = $(this).find('input:checkbox');

     if($(event.target).is('input')){                 // checks if event target is checkbox
        event.stopPropagation();                      // prevents triggering click event on TD too
     } else {
        checkBox.trigger('click');                    // if its TD, triggers checkbox click event
        return;                                       // and stop the code
     }

     if(checkBox.is(':checked')){                     // checks if checkbox is checked!
        td.css('background-color','red');
     } else {
        td.css('background-color','transparent');
     }

 });

You can see it in action here :
https://codepen.io/FaridNaderi/pen/PjVXrm
Hope it helps at least.

A: The issue is from the event bubbling add event.stopImmediatePropagation(); to your click event.
$('td').click(function(event) {
event.stopImmediatePropagation();
if (!$(event.target).is('input')) {
$('input:checkbox', this).prop('checked', function(i, value) {
  highlight(this, $(this).closest('td'));
  return !value;
});
}
});


text: Q: Why is wordpress trying to re-install itself? I ran out of space on my MySQL server so I got a bigger disk and moved the files to the new disk, restarted MySQL and things were fine. But I went to my sites and now wordpress is acting like its never been installed before, its taking me through the install and setup like it was a brand new site. It was working fine yesterday. I dont get it.


text:
Q: What's an adjective for excessively hand gesturing while talking? Suppose you are being interviewed for a job, and while you're making a presentation, you find yourself (in a fit) excessively hand gesturing to the obvious inconvenience of the interviewer. Now you would like to apologize for that:

I'm sorry for making too much gestures.
I'm sorry for being excessive with my hands.

Are the above OK? Is there a one-word adjective that can capture the meaning?

A: I think the word you want is gesticulations.
So you could say either "Sorry for all the gesticulations" or "I'm sorry about my gesticulating."

A: I'd probably say something like the following:

"I'm sorry for being so animated"

Animated in this case being used to describe something full of movement and activity or very expressive.
It's commonly used for people who are very energetic with their movements and expressions. However, in my experience it can also carry a sense of enthusiasm, so if you're using your hands a lot but you're delivering a eulogy, this choice may not be appropriate :^)
That said: As was suggested, "I'm sorry for talking with my hands so much" is also perfectly acceptable.

A: Gesticular

characterized or accompanied by gesticulation

This fits pretty well, you're just a gesticular person.

A: A way you could express your apology is to say "sorry for waving my hands so much"

A: I believe fidgeting may be used here:
fidget

make small movements, especially of the hands and feet, through nervousness or impatience.


text:
Q: Named Return Value Optimization when using std::optional I recently discovered std::optional as a way to improve the clarity of my code, especially for  return value of functions. However I had questions about its impact on performance. More specifically I wanted to know if it was possible to write a code similar to the one below that would allow the compiler to apply Named Return Value Optimization.
struct Data
{
    int x;
    int y;
};

std::optional<Data> makeData(bool condition)
{
    Data data;

    if(condition)
    {
        data.x = 2.0;
        data.y = 2.0;

        return data;
    }
    else
    {
        return {};
    }
}

A: Well, in this case, the as-if rule is enough already: Data is trivially copyable and trivially destructible, so you cannot observe whether the compiler copies it, or whether it directly constructs it into the std::optional<Data> return object. NRVO is not needed in order to prevent the copy.
Let's suppose you gave Data a copy constructor with a side effect. Then the question of whether NRVO applies would be relevant. The answer is no: NRVO doesn't apply, because the local variable's type differs from the function return type. In order to allow NRVO to happen, you might write something like this:
std::optional<Data> r;
if (condition) {
    r.emplace();
    r.x = 2.0;
    r.y = 2.0;
}
return r;


text:
Q: Not add +count for a first for loop (in nested for loop case) I have an iterative function with 3 for loops. I use an array and want to count after how much times instructions count of iterative function. But the loop I used for array, also causes count to increase by 1. How to remove this. Here is my code:
package itrative.methods;

import java.util.Scanner;

public class ItrativeMethods {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int i, j, k;
        int count1 = 0, count2 = 0, count3 = 0;
        int[] n = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        for (int m = 0; m < n.length; m++) {

            for (i = n[m] / 2; i <= n[m]; i++) {
                count1++;
                for (j = 1; j <= n[m] / 2; j++) {
                    count2++;
                    for (k = 1; k <= 100; k = k * 2) {
                        count3++;
                    }
                }
            }
            System.out.println(count1 + "  |  " + count2 + "  |  " + count3);
        }
    }

}

These are the results of this code (wrong)
Correct results at n=10 without using array loop

A: Here is how to count the values during each iteration.
public class ItrativeMethods {

public static void main(String[] args) {
    int i, j, k;
    int count1 = 0, count2 = 0, count3 = 0;
    int[] n = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    for (int m = 0; m < n.length; m++) {
        count1 = 0;
        count2 = 0;
        count3 = 0;
        for (i = n[m] / 2; i <= n[m]; i++) {
            count1++;
            for (j = 1; j <= n[m] / 2; j++) {
                count2++;
                for (k = 1; k <= 100; k = k * 2) {
                    count3++;
                }
            }
        }
        System.out.println(count1 + "  |  " + count2 + "  |  " + count3);
    }
}

}

Producing output:
2  |  0  |  0
2  |  2  |  14
3  |  3  |  21
3  |  6  |  42
4  |  8  |  56
4  |  12  |  84
5  |  15  |  105
5  |  20  |  140
6  |  24  |  168
6  |  30  |  210

To get totals as well:
public class ItrativeMethods {

public static void main(String[] args) {
    int i, j, k;
    int count1 = 0, count2 = 0, count3 = 0;
    int count1Total = 0, count2Total = 0, count3Total = 0;
    int[] n = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    for (int m = 0; m < n.length; m++) {
        count1 = 0;
        count2 = 0;
        count3 = 0;
        for (i = n[m] / 2; i <= n[m]; i++) {
            count1++;
            count1Total++;
            for (j = 1; j <= n[m] / 2; j++) {
                count2++;
                count2Total++;
                for (k = 1; k <= 100; k = k * 2) {
                    count3++;
                    count3Total++;
                }
            }
        }
        System.out.println(count1 + "  |  " + count2 + "  |  " + count3);
    }
    System.out.println("Totals");
    System.out.println(count1Total + "  |  " + count2Total + "  |  " + count3Total);
}

}


text:
Q: CentOS VM with Bridged Network Vhosts Can't Be Accessed I've created a VM (with VirtualBox) of CentOS on my MacBook Pro with the ethernet set to Bridged. So, the VM has its own static IP address of 192.168.1.111
Within the "hosts" file on the VM, I've got:
127.0.0.1 dev.example.com

Within the "hosts" file on my MacBook Pro (the host machine), I've got:
192.168.1.111 dev.example.com

Now the site works fine from within the VM, but doesn't pull up anything from the host MacBook Pro…
I've spent literally 2 days trying to setup this network and I have no idea what the issue is.

A: It was the CentOS Firewall. It wasn't allowing incoming HTTP requests. Had nothing to do with my hosts files.


text:
Q: Cannot increase maximum open files for redis I am using ubunto 18.04, When i run redis-server on the terminal it says
# oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
# Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=11260, just started
# Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
# You requested maxclients of 10000 requiring at least 10032 max file descriptors.
# Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
# Current maximum open files is 1022. maxclients has been reduced to 990 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
# Creating Server TCP listening socket *:6379: bind: Address already in use

I tried to increase this limit before by running
ulimit -n 10240

But it resulted in following error
bash: ulimit: open files: cannot modify limit: Operation not permitted

Then I tried to lower its value by running ulimit -n 1022 and it surprisingly ran successfully and decreased that limit.
I then followed this answer, but after doing echo 800000 > /proc/sys/fs/file-max overrides the "file-max" file but do not actually change max file limit
$ ulimit -n
1022

Here I found another related question and my case seem to be System C one. I tried doing the following.
1) I added the following lines in my /etc/security/limits.conf file.
* soft nofile 4096
* hard nofile 10240

2) Added the following line in /etc/ssh/sshd_config file
UsePAM=yes

3) Added the follwing in '/etc/pam.d/sshd' file
session    required   pam_limits.so

But still no effect. ulimit -n command still shows 1022.


text:
Q: Floating menu on top of all apps
I want to make a menu floating above all applications.
I did see this question: Creating a system overlay window (always on top)

but I want it to be functional in ICS too.
 There is an app, GameCIH, that has such an interface, supporting touch in ICS:

How is it possible?
Thanks!


text:
Q: Execute JS once all images are loaded? Below is my js class.
I need it to execute once all images are loaded, I understand I need to do this via:
$(window).load

But how would I incorporate this into my class?
this.mc = this.mc || {};

(function () {
    "use strict";
    var MyClass = function () {
        this.init();
    };
    p.init = function () {
        // Init
        this.ready();
    };
    mc.MyClass = MyClass;
}(window));

var myClass;

$(function () {
    myClass = new mc.MyClass();
});

A: Replace
$(function () {
    myClass = new mc.MyClass();
});

with
$(window).on('load', function() {
    myClass = new mc.MyClass();
});

A: I'm not quite sure if I get you.. but
window.onload = function() {
    myClass = new mc.MyClass();
};

should do.


text:
Q: $I_{2n}=\dfrac{1\times 3\times \ldots \times (2n-1)}{2\times 4\times \ldots\times 2n}\times\dfrac{\pi}{2}\quad \forall n\geq 1$
let  $$I_n=\int_0^{\frac{\pi}{2}}\cos^n(t) \, dt$$
show that
$$I_{2n}=\frac{1\times 3\times \ldots \times (2n-1)}{2\times 4\times \ldots\times 2n}\times\dfrac{\pi}{2}\quad \forall n\geq 1$$

My attempts :
by using integration by parts we can get :
$$\forall n \in \mathbb{N}^{*}\quad (2n)I_{2n}=(2n-1)I_{2n-2}$$
$$I_{2n}=\frac{(2n-1)}{2n}I_{2n-2}$$

A: For $n\ge 2$,
$$\begin{align}
I_n&=\int_0^{\pi/2}\cos^{2n}xdx\\
&=\cos^{n-1} x\sin x|_{x=0}^{\pi/2}+(n-1)\int_0^{\pi/2}\sin^2x\cos^{n-2}xdx\\
&=(n-1)(I_{n-2}-I_n)
\end{align}$$
Therefore,
$$I_n=\frac{n-1}nI_{n-2}$$
Now,
$$I_0=\int_0^{\pi/2}dx=\frac\pi2$$
and we are done.

A: That's the way. However the relation should be $\;I_{2n}=\dfrac{2n-1}{2n} I_{2n-2}$.
Then write this relation for decrasing values of n, until $I_2=\dfrac12 I_0$, compute $I_0$, and multiply all the equalities.

A: Here you have all you need !
I love when Feynman use them !


text:
Q: values reset with rotation Mainactivity I started the Android language Studio and I only need one step to finish this first TD.
Here are the instructions from TD:
In MainActivity, create an array of Boolean values
mQuestionTrichee, to browse with variable mIndexActuel
ok, so here that's I did:
private static final String A_TRICHE = "a triche";
private boolean[] mQuestionTrichee = new boolean[mTabQuestions.length];

After, I have the value of Question Cheat [mIndexActuel] in the Bundle in the onSaveInstanceState () method:
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Log.i(TAG, "onSaveInstanceState");
    outState.putInt(KEY_INDEX, mIndexActuel);
    outState.putBoolean(A_TRICHE, mQuestionTrichee[mIndexActuel]);
}

So, then, I have to get its value in onCreate ():
   @Override
protected void onCreate(Bundle savedInstanceState)
{

    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate appelee");
    setContentView(R.layout.activity_main);
    mQuestionTrichee[mIndexActuel]=savedInstanceState.getBoolean(A_TRICHE);

 }

but I have this error later:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.getBoolean(java.lang.String)' on a null object reference

I tried to browse my table in the method onCreate () or onSaveInstanceState () but nothing changed I still have it.
Here's what I added:
Application
   if(savedInstanceState != null)
    {
        for(mIndexActuel=0; mIndexActuel < mTabQuestions.length; mIndexActuel++)
        {
            if(mQuestionTrichee[mIndexActuel]==true)
            {
                mQuestionTrichee[mIndexActuel] = true;
            }
            else
            {
                mQuestionTrichee[mIndexActuel] = false;
            }
        }
        mIndexActuel = savedInstanceState.getInt(KEY_INDEX,0);
        mQuestionTrichee[mIndexActuel] = savedInstanceState.getBoolean(A_TRICHE);
    }

A: In your method
public void onCreate(Bundle savedInstanceState) { ... } you need to do a null check:
public void onCreate(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        mQuestionTrichee[mIndexActuel] = savedInstanceState.getBoolean(A_TRICHE);
    }
}

The bundle savedInstanceState will be null if the state of the app has not previously been saved.

A: Inside the onCreate(), the part where you're trying to get the boolean from savedInstanceState, you're getting a NullPointerException since in onCreate() sometimes the value of savedInstanceState returned is null.
What you can do is either put an if condition before the line savedInstanceState.getBoolean(A_TRICHE) or override the onRestoreInstanceState(Bundle savedInstanceState) method and place that line there which is also a better practice.

A: You should try this -
if( savedInstanceState != null){
    mQuestionTrichee[mIndexActuel] = savedInstanceState.getBoolean(A_TRICHE);
}

You need to check if the savedInstanceState only then try to get the value.


text:
Q: Check output/result of command executed automatically from command-line by PuTTY I need to execute a remote command start system1 in order to start a server. This is by SSHing in one of the admin IPMI boards. I'm trying to automate the process by doing this command line:
"c:\Program Files\Putty\putty.exe" -ssh root@192.168.0.119 22 -pw password -m C:\temp\ssh\commands.txt

The command.txt contains just this:
start system1

which when executed powers up the server. When I execute the above command line, putty starts and then the console disappears after a few seconds, probably after logging in. The command is not executed.
If I remove the -m commands.txt, PuTTY logs in ok.
Any ideas how I can make this work? Log in and execute...

A: PuTTY is not the right too for automatic command execution.
Use Plink (PuTTY command-line connection tool). It's a console application. If you execute it from an existing console window (like cmd.exe), the command output will be preserved, so that you can see, what went wrong.
plink.exe -ssh root@192.168.0.119 22 -pw password start system1


text:
Q: No parameterless constructor object defined I know that this is a duplicate question but i can't find answer to my error.
  I'm trying to  show a list of my rooms saved in database but i get next error:
 Server Error in '/' Application.
  No parameterless constructor defined for this object.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

      Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

   [MissingMethodException: No parameterless constructor defined for this object.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +67

   [InvalidOperationException: An error occurred when trying to create a controller of type 'HotelProjectFinal.Controllers.RoomController'. Make sure that the controller has a parameterless public constructor.]
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +182
   System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +80
   System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +232
   System.Web.Mvc.<>c__DisplayClass6.<BeginProcessRequest>b__2() +49
   System.Web.Mvc.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a() +13
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func`1 func) +124
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +98
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +50
  System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8969412
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

But i have a constructor withou a parameter:
 namespace HotelProjectFinal.Controllers
 {
     public class RoomController : Controller
     {
         private IRoomRepository repository;

         public RoomController(IRoomRepository roomRepository)
         {
             repository = roomRepository;
         }

         public ViewResult List()
         {
             return View(repository.Rooms);
         }
     }
}

My view is :
  @model IEnumerable<HotelProjectFinal.Models.Room>

   @{
   ViewBag.Title = "List";
    }

    @foreach (var p in Model)
    {

@p.Room_number

       @p.Room_Type

@p.Room_Type.Price.ToString("c")

      }

I am using ninject:
               public class NinjectControllerFactory : DefaultControllerFactory
            {
    private IKernel ninjectKernel;
    public NinjectControllerFactory()
    {
        ninjectKernel = new StandardKernel();
        AddBindings();
    }
    protected override IController GetControllerInstance(RequestContext requestContext,
    Type controllerType)
    {
        return controllerType == null
        ? null
        : (IController)ninjectKernel.Get(controllerType);
    }
    private void AddBindings()
    {
        ninjectKernel.Bind<IRoomRepository>().To<EFRoomRepository>();
    }
          }
            }

A: You've got a controller factory, but the fact that the stacktrace says nothing about Ninject suggests you have forgotten to tell MVC about it.
You could fix that by adding a line to tell it that.
However the recommended practice is to hook Ninject in by adding a NuGet reference to Ninject.MVC3. There are docs about it on the associated Ninject MVC3 wiki.

A: Please try changing your constructors to the following:
public RoomController() { } // You were missing this parameterless constructor

[Inject]
public RoomController(IRoomRepository roomRepository)
{
    repository = roomRepository;
}

Ninject is looking for a parameterless constructor because you haven't specified [Inject] above constructor that you wish to use for dependency injection. This has confused "Ninject" and caused an exception to be thrown.

The primary DI pattern is Constructor Injection. When activating an instance of a type Ninject will choose one of the type's constructors to use by applying the following rules in order:-

*

*If a constructor has an [Inject] attribute, it is used (but if you apply the attribute to more than one, Ninject will throw a NotSupportedException at runtime upon detection).

*If no constructors have an [Inject] attribute, Ninject will select the one with the most parameters that Ninject understands how to resolve.

*If no constructors are defined, Ninject will select the default parameterless constructor (assuming there is one).

More information can be found here:
https://github.com/ninject/ninject/wiki/Injection-Patterns
As pointed out by Ruben, [Inject] attribute pollutes the controller with external concerns.

This ties your code to a specific container. (Although Ninject does permits the customization of the specific attribute to look for, the point remains – you're polluting an interface with external concerns.)

Your actual problem probably relies in a missing reference to Ninject.MVC3

A: Even though IRoomRepository could be null, that doesn't make it a parameterless constructor.  At first glace, it looks like your IoC isn't wired up correctly for IRoomRepository.  With no IoC, or misconfigured IoC, the controller activator looks for a parameterless constructor for your controllers.
 // This is a parameterless constructor.
 public RoomController()
 { }

 // This is not a parameterless constructor.
 public RoomController(IRoomRepository roomRepository)
 {
     repository = roomRepository;
 }

Edit, Are you using Ninject.Mvc and your base MvcHttpApplication is implementing NinjectHttpApplication?


text:
Q: add marker to ammap map I want to add a circular marker to an ammap map. The marker should be centered on Berlin, which has latitude 52.523407 and longitude 13.4114 (you can verify these coordinates here).
Here's the source code of a page that attempts this. A jsFiddle example is also avaialble.

If you open this page you see the following. I've added the black arrow myself to indicate where the circle should be located. As you can see the centre of the circle is about 150km north-west of it should be. If I add other markers they are also positioned about 150 km NW of where I would expect them to be. Am I doing something wrong, or is this a bug?

A: You should add "centered: false" attribute to your MapImage:
var dataPoints = [{
        latitude: 52.523407,
        longitude: 13.4114,
        type: 'bubble',
        color: '#CC0000',

        fixedSize: false,
        alpha: 0.5,
        height: 50,
        width: 50,
        centered: false
}];

Here's your updated fiddle:
http://jsfiddle.net/amcharts/6c5U3/591/


text:
Q: toggleClass conditionals not working / icon dissappears after two clicks on mobile I'm trying to animate buttons with jquery. On the desktop they are fine, but on mobile the buttons dissappear after two clicks.
I can't figure out how to tell it that if the class is only "fa" then automatically add "fa-plus" to the class. Can someone point me in the right direction?
Js:
    // plus button hover effect

$("td i").hover(
    function() {
        $(this).removeClass('fa-plus');
        $(this).addClass('fa-plus-circle');
    },

    function() {
        $(this).removeClass('fa-plus-circle');
        $(this).addClass('fa-plus');

        if ($(this).hasClass("fa-times-circle")) {
            $(this).removeClass('fa-plus');
        }

       if ($(window).height() <= 1024) return;

    });

// plus button click effect

$("td i").click(function() {
    $(this).removeClass('fa-plus');
    $(this).removeClass('fa-plus-circle');
    $(this).toggleClass("fa-times-circle fa-plus");

});

HTML EXAMPLE

                        Bases

                        Calories
                        Carbs
                        Fat
                        Protein
                        Add

                        Rice Noodle
                        517.2
                        76.1
                        14.4
                        20.8

                        Egg Noodle
                        510.5
                        66.1
                        14.1
                        29.8

                        Vermicelli
                        506.9
                        76.9
                        14.1
                        18.1

                        Whole Grain Noodle
                        476.6
                        53.8
                        16.6
                        28.0

                        White Rice
                        514.8
                        72.4
                        14.8
                        23.0

                        Brown Rice
                        516.0
                        70.1
                        16.0
                        22.9

                        Vegetable Base
                        106.6
                        14.2
                        1.8
                        8.4

Here's the pen:
https://codepen.io/Pbalazs89/full/yKxdeR

A: The problem is you have hover and click, on mobile when you clicked on an element the hover is also applied.
After you click on x, the button seems to disappear but if you just tap somewhere else so that the focus is not on the button anymore, you will see the button comes back.
This is because of the hover effect. It looks to me you can code hover in css, I don't see any reason why you need to do this in js.
If you have code to detect which device the user is using, then you could execute the hover code only if you are on desktop.
It looks like the hover is inverting the bg and text colour so it shouldn't be an issue moving this code to css. If your page is responsive, you could put the hover code in a media query range to target say width > 768px for example so on mobile the hover won't be here. You can't really hover on mobile since you are tapping

A: set a default class then use jQuery toggleClass instead.

A: The reason this is working with desktop rather than mobile is because your hover action is putting the fa-plus-circle back, but that hover event is never triggered on mobile.
So, in the click event, you should check to see which class is in the element, and remove/add accordingly.  Something like:
$("td i").click(function() {
    let el = $(this);
    if(el.hasClass("fa-times-circle") {
         el.removeClass("fa-times-circle").addClass("fa-plus");
    } else {
         el.removeClass("fa-plus").addClass("fa-times-circle");
    }
});


text:
Q: Return HTML or build HTML using javascript? I am returning data about contacts to build a list
the basic html looks like
{repeat:20}

  FirstName LastName

    {repeat:5}

Age:

56

    {endrepeat}

{endrepeat}

The {repeat:20} is not actual codeThat block of code is repeated 20 times

My question is.
What is more benificial:

*

*Create the markup server side, return the actual html.

*Return Json data with the information and build the list client side.

For the purpose of this discussion let us assume some constants

*

*Server load is not an issue (we are using a high performance server)

*The returned data is for display purposes only (not to be manipulated)

*We are not factoring in users without javascript enabled.

*We are not factoring in any browsers < Internet Explorer 7

A: As most of the times during web development, you need to decide what is more important to you.
If you're just after performance no matter what, it is of course faster to do all the render action on your server and just deliver HTML code. But this in turn, most times costs flexability plus, you've got more traffic over the wire.
On the other hand, just sending JSON data for instance and do the render stuff on the client, is much less traffic over the wire, but it's more CPU load on the clientside. Browsers (DOM + ECMAscript) have increased performance like a lot over the past years and month, so it is what lots of applications do.
But this is not the end of story. JSON is optimized, but not highly optimized. Again if you're really after performance you need to create your own transport of data. For instance
|box1|item1|item2

is less code then JSON notation
'{"box1": ["item1", "item2"]}'

This of course is highly specific, but it saves lots of traffic if we're going really big. I recommend the book High performance Javascript by Nicholas C. Zakas. Execellent book about this topic.

A: If you're planning to do intensive AJAX tasks, such adding new records, edit them on the fly, etc., then I suggest you to load an empty page, that calls an script that returns an array of dictionaries by JSON, and then using the Template (beta) system implemented in jQuery recently, or implement one yourself, having a hidden element, with spans/divs/tds tagged with classes, and cloning and filling it each time a new record arrives.
On the other hand, if you're going to keep this static, just use HTML.
This is how I manage templating. This is an efficient way because the DOM elements does exists in the DOM tree, and cloning is less expensive than parsing an string that contains the elements.

Then, when you create a new record, just fill a data object with the information, and you'll sure that all the element flow will be generic.
Using .clone(true) opens the door to make generic events instead of binding a live event, which is more expensive.
For example, if you want to make a button to delete a record:

...

    Delete

Good luck!

A: Personally, I would create it server side and return the html.  The biggest reason being that otherwise your site is useless to anyone who has javascript disabled.  It would also be largely invisible to search engines.

A: i'd say do it server-side.... as JS might increase your page-loading time...

A: Page loading time wouldn't factor into my decision if i were you. I'd think about how easy it would be to maintain. I think doing it serverside would make things a lot easier. No need to have templates for your javascript to parse.

A: It seems that you are asking for an opinion, not a specific answer to a technical question. So here's my opinion.
The trend these days is towards web applications, with more client-side functionality and off-line functionality. Therefore, I would do it client side and send JSON. That is also more scalable since the server side does less work.

A: Since you are not worried about server-side load and have CPU cycles to spare, go ahead and let your backend do the bulk of the work.  The application will be snappier and respond faster.  You have to keep in mind network utilization, however.  Throwing JSON strings back and forth is extremely efficient and reduces network load, but requires the client to do more work.  As stated in this discussion, browsers are extremely fast these days.  JavaScript implementations in Chrome, FF4 and IE9 are some of the fastest we have ever seen.
My suggestion is to do a small benchmark with your application as-is, and see how it performs.  Try to hit the two variants with many requests to see things under load.  It will really depend on your particular application.


text:
Q: OpenCV on BeagleBoard-xM I am working on BeagleBoard-xM with an Angstrom image built with the online Narcissus image builder (open embedded) for an OpenCV application.  I included OpenCV in the root file system, but when I try to compile a simple OpenCV program, I get an error saying library highgui, cxcore not found.
Can anybody help me?
Thank you.

A: Which version of OpenCV with 2.2 they split those libs into individual modules.
http://opencv.willowgarage.com/wiki/OpenCV%20Change%20Logs

A: http://movidius.tumblr.com/
OPENCV ON BEAGLEBOARD XM
The standard BeagleBoard android build runs on the xM is very spartan and it would require a lot of effort to get OpenCV up and running.
I therefore chose Ubuntu 10.10 as an alternative.
It is much more straightforward to install and install the required features such as cmake and gcc required to compile directly on the xM.
One thing is to choose a webcam which will work with cheese under Ubuntu. Eventually I found a €20 Logitech C200 webcam which does.
You need to implement this fix to get OpenCV to build for the ARM target under Ubuntu
http://tech.groups.yahoo.com/group/OpenCV/message/77273
It means commenting the line 51 in sift.cpp
//#define ARM_NO_SIFT
Following this OpenCV will build fine under Ubuntu for the BeagleBoard xM.
In many cases there appear to be problems for the ARM to keep up with the JPEG stream from webcams so you'll need to run cmake with the -DWITH_JPEG=OFF option.
This has the added benefit of upping the frame-rate slightly as you don't need to decode JPEG on the ARM.
To install you will need to give yourself root privileges

sudo passwd root

You can then make install OpenCV and you're ready to go!

A: Do you have the files /usr/lib/libhighgui.so.2.1, /usr/lib/libcxcore.so.2.1? If not, try
opkg install libhighgui2.1
opkg install libcxcore2.1

Alternatively, try searching for the libs at http://www.angstrom-distribution.org/repo/


text:
Q: PHP use "use" of the interface over concrete classes Have encountered an issue I can't seem to figure out now by myself.
Using Symfony autoload module.
Here's my factory:
namespace Core\Factories;

use \Core\Gateway;

class DatabaseAccessFactory {
    // Define client type
    const DEF = 'mongo';

    public function createObject($type) {
        switch($type) {
            case self::DEF:
                return new MongoClientGateway();
                break;

            default:
                return false;
        }
    }
}

Example of /Core/Gateway/MongoClientGateway.php
<? namespace Core\Gateway;

class MongoClientGateway implements MongoDbGateway {
    public function setUp(){

    }

    public function query(){

    }

    public function save(){

    }
}

So, basically I'm using "use" keyword to load gateway namespace into my current one, and then I try to instantiate a class that is under \Core\Gateway namespace, but it says class is not found. Am I missing something?

A: You need to specifcy the class as well
use Core\Gateway\MongoClientGateway

or access the class with the namespace you used
new Gateway\MongoClientGateway

Btw, there's no need for the first "\" in use \Core\Gateway

A: *

*It's use Foo\Bar, without leading backslash.

*use Foo\Bar does not mean that every Class implicitly resolves to Foo\Bar\Class now. use Foo\Bar is shorthand for use Foo\Bar as Bar, so you can reference the namespace Foo\Bar using merely Bar. use is not "importing a namespace", it's aliasing a namespace to a shorter name.

*Therefore you need to write Gateway\MongoClientGateway, or use Core\Gateway\MongoClientGateway explicitly if you want to be able to write just MongoClientGateway.

A: you used "use" wrong.
waht "use" does, is to tell your code where class comes from.
sample code:

use \my\namespace\className

new ClassName();

this will make the className accassible without a namespace.


text:
Q: Using Onclick event of button inside of component I create a component and add a Tbutton to it.
 now I want to create OnClick event for my Component that execute when user click my component's Button at run time
How can I do that?

A: @LU_RD's answer is probably what you are looking for.
I wrote a smaller example that should be similar to what you are doing.
interface

TMyComponent = class(TCustomControl)
private
  embeddedButton: TButton;
  fOnButtonClick: TNotifyEvent;
  procedure EmbeddedButtonClick(Sender: TObject);
protected
  procedure DoEmbeddedButtonClick; virtual;
public
  constructor Create(AOwner: TComponent); override;
published
  property OnButtonClick: TNotifyEvent read fOnButtonClick write fOnButtonClick;
end;

implementation

// Attach embedded button event handler onto embedded button
constructor TMyComponent.Create(AOwner: TComponent);
begin
  // .. other code
  embeddedButton.OnClick := EmbeddedButtonClick;
  // .. more code
end;

// EmbeddedButtonClick fires internal overridable event handler;
procedure TMyComponent.EmbeddedButtonClick(Sender: TObject);
begin
  // If you want to preserve the Sender, extend this method
  // with a sender argument.
  DoEmbeddedButtonClick;
end;

procedure TMyComponent.DoEmbeddedButtonClick;
begin
  // Optionally if you need to do additional internal work
  // when the button is clicked, you can do it here.

  // Check if event handler has been assigned
  if Assigned(fOnButtonClick) then
  begin
    // Fire user-assigned event handler
    fOnButtonClick(Self);
  end;
end;


text:
Q: JSP not keeping indentation of  block I have the following code in my JSP (test.jsp)
<pre>
  int main() {
    printf("Hello World!");
  }
</pre>

But what I see on my browser is
int main() {
printf("Hello World!");
}

Why does it left indent everything? How can I keep the formatting of the contents in <pre> blocks?
Edit:
Computed CSS
box-sizing border-box
color rgb(15, 17, 17)
display block
font-family monospace
font-size 13px
height 304px
line-height 19px
margin-bottom 0px
margin-left 0px
margin-right 0px
margin-top 0px
text-size-adjust 100%
white-space pre
width 785px


text:
Q: Catchable fatal error: Object of class PDO could not be converted to string on line 35 I am trying to login as user but don't know getting this error but when I try second time I will have access,But after login same this,and after logged in on second try I can't fetch email from DB it seems it not creating session.Its just passing the code not creating sessions.
if (!isset($_SESSION['email']) && isset($_POST['email'])) {
    if (!empty($_POST['email']) && !empty($_POST['password'])) {

        $email = filter_var($_POST['email'], FILTER_SANITIZE_STRING);
        $password = filter_var($_POST['password'], FILTER_SANITIZE_STRING);
        $password=sha1($password);

        try {
            $dbh = new PDO("mysql:host=$hostname; dbname=$database", $username, $pass);
            $dbh -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

            $email = $_POST['email'];
            $password = $_POST['password'];

            $stmt = $dbh -> prepare("SELECT email, password FROM tbl_user WHERE email = '".$email."' and password = '".$password."'");
            $stmt -> bindParam('".$email."', $email, PDO::PARAM_STR);
            $stmt -> bindParam('".$password."', $password, PDO::PARAM_STR);
            $stmt -> EXECUTE();
            $em = $stmt -> fetchColumn();

            if ($em == true) {
                // session_register("email");
                // session_register("password");

                $_SESSION['email'] = $_POST['email'];
                $_SESSION['START'] = time();

                setcookie("username", $_POST['email'], mktime()+(60*3), "/");
                setcookie("LUS", time(), mktime()+(60*3), "/");

                $stmt -> $dbh -> prepare("SELECT Name FROM tbl_user WHERE email = '".$email."'");
                $stmt -> EXECUTE();

                $em2 = $stmt -> fetchColumn();
                echo "Logged in.";
            } else {
                echo "email or password is incorrect.";
            }
        } catch (Exception $e) {
            echo "".$e->getMessage();
        }
    } elseif (empty($_POST['email']) && !empty($_POST['password'])) {
        # code...
        echo "Error : Enter your E-mail.";
    } elseif (!empty($_POST['email']) && empty($_POST['password'])) {
        # code...
        echo "Error: Enter your Password";
    } else {
        echo "Error: Enter your E-mail & Password";
    }

}
elseif (isset($_SESSION['email'])) {
    # code...
    echo "Welcome again you still logged in " .round((time() . $_SESSION['START'])/60) ." minutes(s) ago LogOut";
}
elseif (!isset($_SESSION['email'])) {
    # code...
    echo "You must loggin first.";
    //header('location:../index.php');
}

A: change second prepare statment usage
  $stmt -> $dbh -> prepare("SELECT Name FROM tbl_user WHERE email = '".$email."'");

to
  $stmt = $dbh -> prepare("SELECT Name FROM tbl_user WHERE email = '".$email."'");


text:
Q: Append lists to list of lists I want to append lists of dataframes in an existing list of lists:
df1 = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3'],
                     'B': ['B0', 'B1', 'B2', 'B3'],
                     'C': ['C0', 'C1', 'C2', 'C3'],
                     'D': ['D0', 'D1', 'D2', 'D3']},
                    index=[0, 1, 2, 3])

fr_list = [[] for x in range(2)]
fr_list[0].append(df1)
fr_list[0].append(df1)
fr_list[1].append(df1)

fr2 = [[] for x in range(2)]
fr2[0].append(df1)
fr2[1].append(df1)

fr_list.append(fr2)  # <-- here is the problem

Output: fr_list = [[df1, df1], [df1], [fr2[0], fr2[1]]] List contains 3 elements
Expected: fr_list = [[df1, df1, fr2[0]],[df1, fr2[1]]] List contains 2 elements

A: fr_list=[a+b for a,b in zip(fr_list,fr2)]

Replace fr_list.append(fr2) with the above code
Explanation: using zip & list comprehension, add corresponding lists in fr_list & fr2. What you did was appended the outer list in fr_list with outer list in fr & not the inner lists.


text:
Q: Spark Multiple file processing I have multiple Java processes. Each processes will generate a data files which will be periodically containing new data.
I need Spark to read these files and dump the data in database.
I have following questions with respect to above requirement -

*

*Is there any way Spark can know that it has processed 1000 records and have to start from 1001 each time it picks the file for processing?

*Or do I have to purge the file once Spark processes it 1000 records and each time the file should contain only unprocessed records. In this case how can I read and write the records in the same file.

Since I have continuous generation of data, I cannot wait for Spark to complete its job and then allow the file to be loaded with new data.

A: After reading your problem i think you should use Spark Streaming and specify HDFS/S3, Kafka or flume as your source.
Best way would be to change you Java Processes to publish the records in Kafka and write a spark streaming code to read these records.
You can read more details here :-
https://spark.apache.org/docs/latest/streaming-programming-guide.html
If this is not possible, One thing you can do is to check the last modified date of each file and read only those files whose last modified date is less than 2minutes from current time. If the current date time is 06/15/2017 8:00 AM You need to make sure that your code is reading only those files which have last modified date less than 06/15/2017 07:58 AM. This way you make sure that you are only reading those files which are not being processed by the Java processes. i.e in which you are currently not appending new data.
You would only read those files in which there has been no activity for last 2 minutes. The time gap of 2 minutes is changeable and you can change this as per your code logic.

A: Thanks, considering the logic of using reading file based on last modified timestamp will not solve my requirement of reaching to the record in the file which should be processed.
One approach i found was using Java 1.7 introduced SeekableByteChannel using which you can track the position in the file at which you are writing the new records and pass it to the Spark layer. Spark can then read records from that position and process it.


text:
Q: Sources of Entropy on the Web In order to guarantee honesty of a random number generator, the idea is that users can, if they wish, verify that the number is, in fact, generated from public sources of entropy. This enables the system to ensure it's users that the random number could not have been selected by the server.
$entropy = "what_do_you_think";
$md5 = md5($entropy);
/*take the first 10 hex characters of the md5 hash*/
$hex = substr($md5, 0, 9);
/*convert the hex to decimal*/
$dec = hexdec($hex);
/*use this decimal as a seed*/
srand($dec);
/*pick a random number between 0 and 9, ultimately seeded by the entropy*/
$rand = rand(0,9);

My question is: What are some good public sources of entropy (preferably immutable and chaotic), and absolutely referencable, that could be concatenated together in a string and fed into md5? Some ideas are specific stock prices, temperature (from an honest source), the hashes contained in the bitcoin block-chain...

A: Check out xkcd's geohashing algorithm.  I think it is pretty much what you are looking for.
http://wiki.xkcd.com/geohashing/Implementations
The geohashing algorithm uses the DOW Jones as a source of entropy.  This page discusses ways to get the Dow's opening price via the web.
http://wiki.xkcd.com/geohashing/Dow_Jones_Industrial_Average
But I think the best source of public, immutable, and verifiable entropy can be found in the BitCoin transaction database.  It is widely distributed and continuously verified and has a defined protocol.

A: Get it from a physics department.
http://qrng.physik.hu-berlin.de/
http://qrng.physik.hu-berlin.de/download
or just
http://www.random.org/bytes/

that users can, if they wish, verify that the number is, in fact, generated from public sources of entropy

How do they do that?
Do you give them realtime access to the system's memory to  ensure that the assembly of the program running that collects entropy is correct and not malicious?

A: The security value of using physical entropy is that it's unpredictable, i.e. unknown to anyone but the acquirer. What on earth would be the point of using entropy that could be available to anyone? May as well open up your printout of Pi to a million places and pick a starting point.
Quite apart from that, there is in principle no way to determine whether the random numbers a server gives you were in fact derived from the sources of entropy it apparently uses.


text:
Q: html button appearing as input box on form I Apologize for the simplicity of the question, still learning the ropes.
I have the following code:
<form action="backyard_funcs.php" method="post" id="register-form">
<input "type="submit" id="register-submit" name="register-submit" value="Create Account" />
</form>

My objective is to have a form that is submitted at the push of the button named register-submit. However it is not appearing as a button, instead it is appearing as an input box.
All help is appreciated. Thanks in advance.

A: This is wrong:
"type="submit"

it should be
type="submit"

otherwise you break parsing of that input and default type it then falls back to is text

A: Try using a code editor like
sublimetext : http://www.sublimetext.com/3
it'll help you color any coding errors later on so easily! :)
Here's the right code for your answer:
<form action="backyard_funcs.php" method="post" id="register-form">
    <button type="submit id="register-submit" name="register-submit">Create Account</button>
</form>

Hope this helps!

A: <input "type="submit" id=....

should be
<input type="submit" id=....

without the quote before type

A: There is an ( " ) too much in your code
<form action="backyard_funcs.php" method="post" id="register-form">
    <input type="submit" id="register-submit" name="register-submit" value="Create Account" />
    </form>


text:
Q: PSpice Simulation of CE8301 I have been working on a project that requires me to boost 1V to 5V. I have found a ready-to-use boost regulator that gets the job done. The problem is that I need to get the circuit simulated on OrCad Pspice but the CE8301 CMOS PFM-control
step-up switching DC/DC converter is not included in the library.
I have the block diagram of CE8301. Is there a way to add this component by hand to PSspice library so that I can simulate the circuit below.
Also, block diagram is included in the attachments.

A: Unless you care about the specific function of this particles regulator, you would model this as a 5v voltage source.  When you build the schematic, you would read the data sheet, follow the directions and recommndations, and expect to reach the speed functionality.
You model because there are question you'd like to ask the model -  not because it's there or because you can.  Unless the circuit you're trying to simulate depends on the nuances of the regulator, there is no reason to include the regulator in your simulation.


text:
Q: What is the encoding for special characters in second level domains? I am wondering what is the encoding of second-level domains, because when I type in chrome something like this: xn--rvo-e3a.com it shows up like this: rvož.com. I can't find any answers on the internet.
Thanks

A: Big thanks to @JosefZ as he said it's a punycode.


text:
Q: Orchard-Google analytics not generating demographics report after adding "ga('require', 'displayfeatures');" in tracking code I am using orchard for my site as per Google Analytics to track age and gender report I have added ga('require', 'displayfeatures'); to tracking code. They said it will take 24 hrs to generate report but last 2 days almost 48 hrs passed away but still it not generating it.
How we can do it by other way? or any changes in tracking code.


text:
Q: Null and Sorting With NaN, it is possible to get a list that will not properly sort:
--> NaN = float('nan')
--> spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN]
--> sorted(spam)
[1, 2, nan, 3, nan, 4, 5, 7, nan]

I'm constructing a Null object that will behave a lot like NaN, with the semantics that if the returned object is Null, it's actual value is unknown.  A Null object will also be able to interact with any other type of object (int, float, str, bool, etc), but any interactions will result in Null.
From a purist point of view if it is unknown then comparison results are also unknown since the actual value might be greater, lesser, or the same as the value being compared against.
From a practical point of view a list with Nulls scattered throughout is a pain in the backside.
So I am strongly leaning towards implementing the comparisons such that Null objects are less than other objects so they will always sort together.
Of course, I could always dodge the issue and force the user to implement custom sort keys.
Any thoughts/advice/criticisms/etc?

A: NaN is commonly defined as being not comparable to anything. Any computation involving NaN is supposed to return NaN.
In fact:
>>> print float('nan') == float('nan')
False

Yes: NaN is not even the same as itself. There are good reasons to have it this way, although it indeed is counter-intuitive. The prime reason probably is that - in contrast to all other numbers - there is no unique way of sorting them ascending. Should the come first, last, at the end? before or after infinity? Floating point numbers have a couple of odd things. But at least there is no doubt about -infty < -123 < -0 <= +0 < 123 < +infty.
It's "not a number", so how can it be larger, smaller or equal than a number?
Of course you can define a custom compare function that has a well-defined sorting behavior for NaN values:
def s(x, y):
  import math
  if math.isnan(x): return 1
  return cmp(x, y)

Note how I'm using math.isnan. This function has clear semantics: it sorts all numbers first, then any NaN value.

A: If the Null object implements comparison behavior, other methods (such as indexing) will get more complicated.  Consider:
target = table.sql('select * where sales < 1000.00')

If Null values compare < all other objects then target could have rows where there were no sales (which is not the goal).
So, I think practicality and purity are both coming down on the same side on this one:  Null comparisons yield unknown.  Users will have to decide what to do with Null values if they get them.


text:
Q: Why is this timestamp off by an hour? When I run this:
SELECT TIMESTAMPDIFF(SECOND, FROM_UNIXTIME(0), NOW())

It gives me 1433183554 which is 2015-06-01 11:32:34. But SELECT NOW() is 2015-06-01 10:33:17.
How is it off by an hour?
N.B. select unix_timestamp() yields the correct timestamp.

A: Per axiac's comment, TIMESTAMPDIFF ignores timezones. You can verify this by running
SELECT TIMESTAMPDIFF(HOUR, '2015-03-08 01:00:00', '2015-03-08 04:00:00');

Which should give 2 (if you're in pacific time anyway) because we "spring forward" an hour, but instead gives 3.


text:
Q: Nginx reverse_proxy from domainA.it/appA to domainB.it/appB maintining the original url ( domainA/appA ) i need to implement this configuration in my nginx web server ( reverse_proxy ):
I have a domain like www.domainA.it where respond my site, then i need to publish antother "app" from my www.domainA.it/appA, the application respond to another domain like www.domainB.it/appB
The nginx configuration that i have implement is like this:
server {
    listen       443;
    server_name www.domainA.it domainA.it;
    error_log ssl_error.log;
    access_log ssl_access.log;

    ssl                  on;
    ssl_certificate      my.crt;
    ssl_certificate_key  my.key;
    include /etc/nginx/sec.conf;

    add_header 'Access-Control-Allow-Origin' *;

    location / {
        add_header 'Access-Control-Allow-Origin' *;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass https://my-backend;
    }

    location /appA {
        proxy_pass https://domainB/appB/;
        proxy_http_version                 1.1;
        add_header Access-Control-Allow-Origin *;
        proxy_set_header Host $proxy_host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    }
}

With this configuration i recive the error like this:
https://www.domainA.it/appB/... 404 not found
https://www.domainA.it/appB/... 404 not found
.
.
.
If i expose the same location www.domainA/appB , all it's work fine
How i can do this ??
Thanks a lot

A: i have resolved this issue by modifing the backend context.
It works all fine with this configuration:
location /appA {
    proxy_pass https://domainB/appA/;
    proxy_http_version                 1.1;
    add_header Access-Control-Allow-Origin *;
    proxy_set_header Host $proxy_host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}