text:
Q: Raspberry pi gpio pins are stuck in the "in" and "high" mode I am running Raspbian Stretch on a Raspberry Pi 2. I was trying to build a basic obstacle avoidance rover and ran into a problem with the motors.
Schematic found here:

I don't have the dc-dc converter and I have a LED with a 330 ohm resistor connected to pin 17.
I was using this code to run it:
from gpiozero import LED
from gpiozero import Motor
import RPi.GPIO as GPIO
from time import sleep

# prereqs
GPIO.setmode(GPIO.BCM)
Motorbin = 5
Motorbout = 6
GPIO.setup(Motor2in,GPIO.OUT)
GPIO.setup(Motor2out,GPIO.OUT)

led = LED(17)

for i in range(2):
    led.on()
    sleep(0.5)
    led.off()
    sleep(0.5)

# motors are going to start running now

motora = Motor(27, 22)
motora.forward()
sleep(5)
motora.backward()
sleep(5)
motora.stop()

for i in range(2):
    led.on()
    sleep(0.5)
    led.off()
    sleep(0.5)

motorb = (5, 6)
motorb.forward()
sleep(5)
motorb.backward()
sleep(5)
motorb.stop()

GPIO.cleanup

I ran the code and my LED blinked twice, the first motor (motora) moved forward and backward, but the second motor (motorb) did not move at all. I ran the terminal command "gpio readall" and found that the pins that my second motor are running on (BCM 5, 6) were set to "IN" and both were set to "1".
terminal output of gpio readall

I tried using the GPIO.setup command to change pin 5 and 6 to an output pin but it still stayed the same. I also tried using the terminal command to change the output of the pins from high to low but nothing happened. The GPIO pins appear to be stuck in this mode.
Is there any way to fix these stuck GPIO pins? And am I doing the right thing in this case?
Any assistance will be greatly appreciated!!

A: Your code sets up Motor A by
motora = Motor(27, 22)

But Motor B is set up by
motorb = (5, 6).

Shouldn't it be similarly set up by
motorb = Motor(5, 6)?


text:
Q: Preventing SQL Injection for iOS Swift App I am designing an iOS mobile app in Swift which uses a remote SQL database for its backend. This app has a lot of interactions with the database, due to this I want to ensure it is safe from SQL injection. My first idea was to check in Swift if the text in the UITextView contains any blacklisted words, however after reading this:

I'm not sure if blacklisting is a good idea; although I'm not sure about the degree to which these problems affect mobile apps; as this was written about websites. Another thing I read about was using parametirised queries, although I don't really understand what this means exactly as most examples I read were designed for websites as well; the way I currently connect to my database is through sending a POST request from a NSURLSession to a PHP script on my server. This is a typical example of what I do in my PHP script :
 $user_id = $_POST['user_id'];
 $second_field = $_POST['second_field'];

 $conn=mysqli_connect("localhost", "***", "***","***");

 $result = mysqli_query($conn,"INSERT INTO my_table (user_id, second_field) VALUES ('$user_id', '$second_field')");

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why $G=HK$ and $H\cap K=\{e\} \implies G = H\times K$? Given that $G$ is finite abelian, in order to show that $G = H\times K$ one only needs to show that $G=HK$ and $H\cap K=\{e\}$. What motivates this and why is it only true for finite abelian groups?

A: Let define: $$\varphi:\left\{\begin{array}{ccc}H\times K & \rightarrow & G\\(h,k) & \mapsto & hk\end{array}\right.$$
$\varphi$ is a group homomorphism, since $G$ is abelian and your assumptions imply that $\varphi$ is bijective. Indeed, if $hk=e$, then $H\ni h=k^{-1}\in K$.
Going further:

Proposition. Let $G$ be a group and $H,K$ normal subgroups of $G$. If $H\cap K=\{e\}$, then: $$H\times K\cong\langle H\cup K\rangle.$$

One derives the:

Corollary. Let $G$ be a finite group. If all Sylow's subgroups of $G$ are normal, then $G$ is isomorphic to the direct product of its Sylow's subgroups.


text:
Q: GL_MODELVIEW and GL_PROJECTION My code Currently looks like this :
glViewport (0, 0, this->w(), this->h());

glMatrixMode(GL_PROJECTION);

glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
//glTranslated (m_fXmovement, 0.0, m_fZmovement - 5);
//glRotated (m_fYangleView, 1.0, 0.0, 0.0);
//glRotated (m_fXangleView, 0.0, 1.0, 0.0);

///// Model View \\\\\

glMatrixMode(GL_MODELVIEW);

glTranslated (m_fXmovement, 0.0, m_fZmovement - 5 );
glRotated (m_fYangleView, 1.0, 0.0, 0.0);
glRotated (m_fXangleView, 0.0, 1.0, 0.0);

DrawWaveFrontObject (m_pDataObjectMedia);

glPushMatrix();
    glTranslated (0.0, -3.0, 0.0);
    DrawArea();
glPopMatrix();

DrawClickAnimation();

glLoadIdentity();

First I had the movement part in GL_PROJECTION and all was running fine until I was working with fog.... It felt like the Camera isn't moving, it felt more like an additional camera pointing to that camera....
Then I accidentally copied the movement parts to the GL_MODELVIEW and the fog was acting as I wanted it to act..... all was fine accepting the click animation wasn't in relation to the area anymore, now the animation moved with my ego perspective.... and I don't really get it what kind of drawing I have to put in which of these two VIEW's. Could anyone give me examples or explanations according to my code or a hint what I could improve in my styl?

A: Quote from opengl.org forum:

The projection matrix is used to create your viewing volume. Imagine a
  scene in the real world. You don't really see everything around you,
  only what your eyes allow you to see. If you're a fish for example you
  see things a bit broader. So when we say that we set up the projection
  matrix we mean that we set up what we want to see from the scene that
  we create. I mean you can draw objects anywhere in your world. If they
  are not inside the view volume you won't see anything. When you create
  the view volume imagine that you create 6 clipping planes that define
  your field of view.
As for the modelview matrix, it is used to make various
  transformations to the models (objects) in your world. Like this you
  only have to define your object once and then translate it or rotate
  it or scale it.
You would use the projection matrix before drawing the objects in your
  scene to set the view volume. Then you draw your object and change the
  modelview matrix accordingly. Of course you can change your matrix
  midway of drawing your models if for example you want to draw a scene
  and then draw some text (which with some methods you can work easier
  in orthographic projection) then change back to modelview matrix.
As for the name modelview it has to do with the duality of modeling
  and viewing transformations. If you draw the camera 5 units back, or
  move the object 5 units forwards it is essentially the same.

A: First of all, I suggest that you try to abandon the fixed-function pipeline (glTranslate etc) since it's been deprecated for like 10 years now. Look here for a more modern tutorial if you're interested.
As for your problem, you can imagine the meaning of the two matrices like this: The projection matrix essentially captures properties intrinsic to the camera itself, like how its field of view is shaped.
On the other hand, the modelview matrix is composed of two parts, the model matrix and the view matrix. The model part is for transforming from object space (relative to an object itself) to world space. Then, the view part translates from there to the eye space, in which the camera sits at the origin and points down the (negative?) z axis. Together, the modelview matrix essentially states how objects are to be positioned relative to the camera.
For further information, this resource gives a detailed description of graphics transformations in the context of OpenGL.
[Jan, 2017] Edit: Pages from the first link seem to be unable to access these days, so there is another link to the same content from their archive.


text: Q: How to customised react-navigation instead of react-native-navigation in jhipster? I am developing a react native app using jhipster tool which inbuilt provides react-native navigation. Instead of react-native navigation, I want to use a react-navigation library is there any way to customize?


text:
Q: Understanding the degrees of freedom counting argument for complex amplitudes in quantum mechanics In these lecture notes, Scott Aaronson gives three arguments for why complex Hilbert spaces are more natural than real ones for formulating quantum mechanics. I don't understand his second argument, which begins at "how many independent real parameters ..." and ends at "... juuuuust right!" It goes as follows:

*

*(Mixed) states are described by positive-semidefinite Hermitian operators, which have $N^2$ real degrees of freedom if the underlying field is the complex numbers and $N(N+1)/2$ real degrees of freedom if the underlying field is the real numbers, where $N$ is the dimension of the Hilbert space over its field. (He also considers the case where the "field" is the division ring of quaternions so that the Hilbert space is actually a module instead of a vector space.)

2.

Intuitively, it seems like the number of parameters needed to describe [a composite system] should equal the product of the number of parameters needed to describe [the individual constituent systems] ... If amplitudes are complex numbers, then happily this is true!

His point is that in order for the real degrees of freedom to compound in the "intuitive" way - multiplicatively - the number of real degrees of freedom for a generic density matrix must be a power of the Hilbert space dimension, which is the case for the complex numbers, but not the reals or the quaternions.
My objection is to his first point. In a given basis, a mixed state isn't characterized by a generic positive-semidefinite Hermitian matrix, but instead by a trace-1 positive-semidefinite Hermitian matrix. The trace-1 requirement imposes an additional constraint on the matrix and removes one real degree of freedom, so that the number of real degrees of freedom is actually $N^2 - 1$, not $N^2$, and his argument falls apart. The number of physical degrees of freedom actually compound supermultiplicatively: if the constituent systems have $M$- and $N$-dimensional Hilbert spaces, then the composite system has $(MN)^2 - 1$ real degrees of freedom, which is strictly greater than the $(M^2 - 1)(N^2 - 1)$ real degrees of freedom that we'd expect if they compounded multiplicatively.
(Sure, you can naturally associate a mixed state to an arbitrary positive-semidefinite Hermitian matrix by renormalizing it to have trace 1, but then this map becomes many-to-one, and the trace is a completely unphysical extra degree of freedom. Unlike in the state-vector formalism for pure states, in the density-matrix formalism there is a natural canonical representation for any state, with no unphysical degrees of freedom like the state vector's global phase.)
Aaronson addresses this point only by saying "we assume, for convenience, that the state doesn't have to be normalized (i.e., that the probabilities can add up to less than 1)." This seems absurd to me - the entire argument hinges on a careful count of a state's actual number of physical degrees of freedom, so you can't just pad it out "for convenience" to the number that you want. You could use the exact same reasoning to show that the real numbers form the "natural" field by introducing $N(N-1)/2$ dummy degrees of freedom "for convenience" that pad the total number out to $N^2$.
Is there something I'm missing that salvages this argument?

A: Scott Aaronson has fleshed out his argument in a recent blog post. As far as I can tell, his initial "physical degrees of freedom should multiply across composite systems" argument was incorrect. The correct argument is as follows: the fact that real degrees of freedom of non-normalized density matrices (not mixed states) multiply across tensor products if the density matrices act on a complex (but not real or quaternionic) Hilbert space leads to the "local tomography" property, which states that an arbitrary state of a composite system can be fully determined from the joint statistics of product measurements only. How appealing you find this property is to some extent a matter of personal taste.


text:
Q: Handle digital certificate using selenium in python I am creating a website automation for bank website using selenium in Python in which I am able to open internet explorer and then website , when I am trying to login after inserting user credentials , a security window open to select digital certificate of hdfc bank website.
Please tell me how to select digital certificate from that window,due to privacy I cannot share screenshot.

A: There are various ways to handle it.
1. Use capabilities :
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

2. Use browser profiles :
FirefoxProfile profile=new FirefoxProfile();
profile.setAcceptUntrustedCertificates(true);
WebDriver driver=new FirefoxDriver(profile);


text:
Q: End two nodes on single node in family tree I want to end two nodes on a single node in this fiddle http://jsfiddle.net/uPdZX
Html Code:

            Parent

                    Child

                            Grand Child

                    Child

Grand Child

                            Grand Child

                                    Great Grand Child

                                    Great Grand Child

                                    Great Grand Child

Grand Child

CSS:
/*Now the CSS*/
* {margin: 0; padding: 0;}

.tree ul {
    padding-top: 20px; position: relative;

    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

.tree li {
    float: left; text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;

    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

/*We will use ::before and ::after to draw the connectors*/

.tree li::before, .tree li::after{
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 1px solid #ccc;
    width: 50%; height: 20px;
}
.tree li::after{
    right: auto; left: 50%;
    border-left: 1px solid #ccc;
}

/*We need to remove left-right connectors from elements without
any siblings*/
.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}

/*Remove space from the top of single children*/
.tree li:only-child{ padding-top: 0;}

/*Remove left connector from first child and
right connector from last child*/
.tree li:first-child::before, .tree li:last-child::after{
    border: 0 none;
}
/*Adding back the vertical connector to the last nodes*/
.tree li:last-child::before{
    border-right: 1px solid #ccc;
    border-radius: 0 5px 0 0;
    -webkit-border-radius: 0 5px 0 0;
    -moz-border-radius: 0 5px 0 0;
}
.tree li:first-child::after{
    border-radius: 5px 0 0 0;
    -webkit-border-radius: 5px 0 0 0;
    -moz-border-radius: 5px 0 0 0;
}

/*Time to add downward connectors from parents*/
.tree ul ul::before{
    content: '';
    position: absolute; top: 0; left: 50%;
    border-left: 1px solid #ccc;
    width: 0; height: 20px;
}

.tree li a{
    border: 1px solid #ccc;
    padding: 5px 10px;
    text-decoration: none;
    color: #666;
    font-family: arial, verdana, tahoma;
    font-size: 11px;
    display: inline-block;

    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;

    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

/*Time for some hover effects*/
/*We will apply the hover effect the the lineage of the element also*/
.tree li a:hover, .tree li a:hover+ul li a {
    background: #c8e4f8; color: #000; border: 1px solid #94a0b4;
}
/*Connector styles on hover*/
.tree li a:hover+ul li::after,
.tree li a:hover+ul li::before,
.tree li a:hover+ul::before,
.tree li a:hover+ul ul::before{
    border-color:  #94a0b4;
}

this is the code ...what i want to do is to end both grand child on a single great grand child...how to achieve this ...what should i do ...any help will be appreciated:)

A: They will be on the same level if you remove the following CSS3 statement (or set the padding to 20px):
/*Remove space from the top of single children*/
.tree li:only-child{ padding-top: 0;}

Still, you will need to ad an extra vertical connector (if needed).


text:
Q: Proving that $\frac{(N+p-1)!}{p!(p-1)!N!}$ is an integer? Consider the quantity:
$$\frac{(N+p-1)!}{p!(p-1)!N!}$$
where $N$ and $p$ are positive integers. How can we show that this is always an integer (which I believe has to be the case since it represents the number of ways $N$ identical particles can be put into $p$ identical boxes, I think).

A: It's not always an integer. Consider the case $N=p=2$. You obtain $3!/2!1!2!=3/2$.

A: The number of ways to distribute $N$ indistinguishable objects amongst $p$ distinguishable containers is the number of weak compositions of $N$ into $p$ parts, which is
$$\binom{N+p-1}{p-1}=\frac{(N+p-1)!}{N!(p-1)!}\;.$$
However, you can't simply divide by $p!$ to get the number of distributions into $p$ indistinguishable containers: the divisor for a given arrangement depends on the arrangement, since only containers with the same number of objects in them are treated identically.
What you want is the something much messier: $\sum_{k=1}^pp(N,k)$, where $p(n,k)$ is the number of partitions of $n$ into $k$ parts. There's a useful recurrence,
$$p(n,k)=p(n-1,k-1)+p(n-1,k)\;,$$
but no nice closed form. For more information see this link, especially after equation $(58)$.

A: You've miscounted.
I see that you are essentially taking the number of solutions to $x_1+x_2+\cdots+x_p=N$ and dividing by $p!$. But if $x_i=x_j$ then not all permutations give a different solution.
The number of solutions to $x_1+x_2+\cdots +x_p=N$ with $x_1\leq x_2\leq \cdots \leq x_p$ is a much more complicated value.
These are called "integer partitions" of $N$ into at most $p$ parts, and there id no simple formula for counting these. See Wikipedia.


text:
Q: Installing software on CentOS without root I realize variants of this question have been asked before. My question is why can't one have some kind of parallel directory structure where a user w/o root is able to install whatever they need? (Even chroot seems to require having root)
Is it impossible in principle?

A: Depending upon how you are installing the software, you should be able to install it in a directory of your own such as ~/bin.
Then you would edit ~/.bashrc (assuming bash is your shell) to add that to your path:
export PATH="$PATH:$HOME/bin"

Of course this will become more complex if you have dependencies and libraries to install.
As to how you would go about installing in ~/bin. If you're building form source try configure --help for options, you may be able to do something like...
./configure --prefix=$HOME/bin
make
make install

If you're installing from an RPM you'll most likely need to unpack the RPM manually since it's going to want to install files in places you don't have access to. There are some good answers as to the specifics of how to do that here, but it may not be for the faint of heart based upon the comments :-)
https://unix.stackexchange.com/questions/61283/yum-install-in-user-home-for-non-admins
Hope that helps!


text:
Q: Multi-pass accumulative rendering in three.js I have written code to render a scene containing lights that work like projectors.  But there are a lot of them (more than can be represented with a fixed number of lights in a single shader).  So right now I render this by creating a custom shader and rendering the scene once for each light.  Each pass the fragment shader determines the contribution for that light and the blender adds in that contribution to the backbuffer.  I found this really awkward to set up in three.js.  I couldn't find a way of doing multiple passes like this where there were different materials and different geometry required for the different passes.  I had to do this by having multiple scenes.  The problem there is that I can't have an object3d that is in multiple scenes (Please correct me if I'm wrong).  So I need to create duplicates of the objects - one for each scene it is in.  This all starts looking really hacky quickly.  It's all so special that it seems to be incompatible with various three.js framework features such as VR Rendering.  Each light requires shadowing, but I don't have memory for a shadow buffer for each light, so it alternates between rendering the shadow buffer for the light, then the accumulation phase for that light, then the shadow buffer for the next light, then the accumulator the the next light, etc.
I'd much rather set this up in a more "three.js" way.  I seem to be writing hack upon hack to get this working, each time forgoing yet another three.js framework feature that doesn't working properly in conjunction with my multi-pass technique.  But it doesn't seem like what I'm doing is so out of the ordinary.
My main surprise is that I can't figure out a way to set up a multi-pass scene that does this back and forth rendering and accumulating.  And my second surprise is that the Object3D's that I create don't like being added to multiple scenes a the same time, so I have to create duplicates of each object for each scene it wants to be in, in order to keep their states from interfering with each other.
So is there a way of rendering this kind of multi-pass accumulative scene in a better way?  Again, I would describe it as a scene with > the max number of lights allows in a single shader pass so their contributions need to be alternatively rendered (shadow buffers) and then additively accumulated in multiple passes.  The lights work like typical movie projectors that project an image (as opposed to being a uniform solid color light source).
How can I do multi-pass rendering like this and still take advantage of good framework stuff like stereo rendering for VR and automatic shadow buffer creation?
Here's a simplified snippet that demonstrates the scenes that are involved:
  renderer.render(this.environment.scene, camera, null);
  for (let i = 0, ii = this.projectors.length; i < ii; ++i) {
    let projector = this.projectors[i];
    renderer.setClearColor(0x000000, 1);
    renderer.clearTarget(this.shadowRenderTarget, true, true, false);
    renderer.render(projector.object3D.depthScene, projector.object3D.depthCamera, this.shadowRenderTarget);
    renderer.render(projector.object3D.scene, camera);
  }

  renderer.render(this.foreground.scene, camera, null);

There is a scene that renders lighting from the environment (done with normal lighting) then there is a scene per projector that computes the shadow map for the projector and then adds in the light contribution from each projector, then there is a "foreground" scene with overlays and UI stuff in it.
Is there a more "three.js" way?

A: Unfortunately i think the answer is no.

I'd much rather set this up in a more "three.js" way. I seem to be writing hack upon hack to get this working,

and welcome to the world of three.js development :)
scene graph
You cannot have a node belong to multiple parents. I believe three also does not allow you to do this:
const myPos = new THREE.Vector3()

myMesh_layer0.position = myPos
myMesh_layer1.position = myPos

It wont work with eulers, quaternions or a matrix.
Managing the matrix updates in multiple scenes would be tricky as well.
the three.js way
There is no way to go about the "hack upon hack" unless you start hacking the core.
Notice that it's 2018 but the official way of including three.js into your web app is through <src> tags.
This is a great example of where it would probably be a better idea not to do things the three.js way but the modern javascript way ie use imports, npm installs etc.
Three.js also does not have a robust core that allows you to be flexible with code around it. It's quite obfuscated and conflated with a limited number of hooks exposed that would allow you to write effects such as you want.
Three is often conflated with it's examples, if you pick a random one, it will be written in a three.js way, but far from what best javascript/coding practices are, at least today.
You'll often find large monolithic files, that would benefit from being broken up.
I believe it's still impossible to import the examples as modules.
Look at the material extensions examples and consider if you would want to apply that pattern in your project.
You can probably encounter more pain points, but this is enough to illustrate that the three.js way may not always be desirable.
remedies
Are few and far between. I've spent more than a year trying to push the onBeforeRender and onAfterRender hooks. It seems useful and allowed for some refactors, but another feature had to be nuked first.
The other feature was iterated on during the course of that year and only addressed a single example, until it was made obvious that onBeforeRender would address both the example, and allow for much more.
This unfortunately also seems to be the three.js way. Since the base is so big and includes so many examples, it's more likely that someone would try to optimize a single example, then try to find a common pattern for refactoring a whole bunch of them.
You could go and file an issue on github, but it would be very hard to argue for something as generic as this. You'd most likely have to write some code as a proposal.
This can become taxing quite quick, because it can be rejected, ignored, or you could be asked to provide examples or refactor existing ones.
You mentioned your hacks failing to work with various three's features, like VR. This i think is a problem with three, VR has been the focus of development for the past couple of years at least, but without ever addressing the core issues.
The good news is, three is more modular than it was ever before, so you can fork the project and tweak the parts you need. The issues with three than may move to a higher level, if you find some coupling in the renderer for example that makes it hard to sync your fork, it would be easier to explain than the whole goal of your particular project.


text:
Q: How to change gnome shell theme in ubuntu 14.10? I want to change gnome shell theme, I use ubuntu 14.10 and user extensions don't work, can anybody help me ?

A: You should be able to use the User Themes extension (make sure it is enabled):

and Gnome Tweak Tool:

You can also change the theme from command line, by examining things using dconf-editor, you can use gsettings to change the theme - so for Gnome 3.8 with the User Themes extension, this sets the theme to "Zukitwo":
gsettings set org.gnome.shell.extensions.user-theme name "Zukitwo"

Resets the theme:
gsettings reset org.gnome.shell.extensions.user-theme name

Gets the current theme's name
gsettings get org.gnome.shell.extensions.user-theme name

If you have downloaded the theme from somewhere (e.g. a zip from DeviantArt), put the theme's directory in ~/.local/share/themes (if it does not exist, create it). Note the theme won't work if it does not contain a gnome-shell folder with the Gnome shell theme - in which case you can make a similar one using Elegance colours or similar.

WARNING: This method is harder to undo, and will also change the theme for the login screen (if the theme does not work it is probably
  then more likely to go wrong...)

Otherwise (you'll may want to do this by running nautilus as root - if so use pkexec/gksudo), you can copy the contents gnome-shell bit of the theme to /usr/share/gnome-shell/theme - beforehand make sure you backup the existing theme:
sudo cp -r "/usr/share/gnome-shell/theme" "/usr/share/gnome-shell/themeBACKUP"

You can also change the permissions so you can access this directory as a normal user:
sudo chmod 777 "/usr/share/gnome-shell/theme"


text:
Q: JavaScript splice() undefined index on iteration I'm trying to delete item from array based on conditional.
var Stack  = {};

Stack.items = [];

Stack.items.push({
    id: '123',
    name: 'Lorem ipsum dolor sit.'
});

Stack.items.push({
    id: '154',
    name: 'Lorem ipsum dolor sit.'
});

Stack.items.push({
    id: '123',
    name: 'Lorem ipsum dolor sit.'
});

Now, I'll delete all items with 154 id.
$.each(Stack.items, function(index, item) {
    // console.log( item.id );
    // console.log( index);
    if( item.id === '154' ) {
        Stack.items.splice(index, 1);
    }
});

But I get an undefined error in the second iteration. I think this is because splice() function modified the original array so the indexes were altered
Uncaught TypeError: Cannot read property 'id' of undefined

I'm getting the expected results with lodash but i'm trying to not use them just for this issue
_.remove(Stack.items, function(item) {
    return item.id === '123';
});

Thanks!!

A: If you must need in place modifications, you will want to use another approach.  Your indexes must only be incremented if the element was not removed.  An example would be:
var index = 0;
while ( index < Stack.items.length ) {
    var item = Stack.items[index];
    if ( item.id === '154' )
        Stack.items.splice(index, 1);
    else
        index++;
}

However, creating a copy of the array and using that would make the code much easier to follow, and is a lot quicker to code:
var newItems = Stack.items.filter(function(item) {
    return item.id !== '154';
});


text:
Q: how can a unit vector n with 3 dimensions be translated to $|+n\rangle$ This question comes a from problem in a quantum physics book. In Townsend's modern quantum book (A modern approach to quantum mechanics) in chapter 1 problem 1.3 there is a unit given that is $\boldsymbol n = \sin(\Delta)\cos(\phi)\,\boldsymbol i  + \sin(\Delta)\sin(\phi)\, \boldsymbol j + \cos(\Delta)\, \boldsymbol k$
then it specifies that by looking at figure 1.11 you are given
$|+n\rangle = \cos(\Delta/2)|+z\rangle + e^{i\phi}\sin(Δ/2)|-z\rangle.$
This brings me to my question, how is that so? how can you get $|+n\rangle$ from $n$? is there a way to do it or is it just by definition? excuse my ignorance, i'm just not seeing the connection. thanks in advance for anyone that can help me

A: The way to prove this is to use the fact that angular momentum (including spin) is the generator of rotations. So, a rotation operator is given by
$$\hat{R}(\theta,\mathbf{a}) = \exp\left(i \theta \frac{\hat{\mathbf{L}}\cdot\mathbf{a}}{\hbar}\right),$$
where $\mathbf{a}$ is the unit vector axis of rotation and $\theta$ is the angle.
For spin-$^1/_2$, we have the components of $\hat{\mathbf{L}}$ in the $\hat{S}_z$-basis are
\begin{align}
  \hat{L}_x =\hat{S}_x &= \frac{\hbar}{2} \left[\begin{array}{cc}
      0 & 1 \\
      1 & 0 \end{array}\right], \\
  \hat{L}_y =\hat{S}_x &= \frac{\hbar}{2} \left[\begin{array}{cc}
      0 & -i \\
      i & 0 \end{array}\right],\ \text{and} \\
  \hat{L}_z =\hat{S}_x &= \frac{\hbar}{2} \left[\begin{array}{cc}
      1 & 0 \\
      0 & -1 \end{array}\right],
\end{align}
which is just $\hbar/2$ times the Pauli matrices.
The rest is figuring out what combination of $\mathbf{a}$ and $\theta$ rotates the positive $z$-direction unit vector $\mathbf{k}$ into $\mathbf{n}$, constructing the matrix exponential, and applying it to $|z+\rangle$ and $|z-\rangle$ to get your new basis. You can also do it in two steps/rotations, requiring you to compute two matrix exponentials but simplifying the algebra of each considerably.
That is left as an exercise to the reader, since I know for a fact that this is a homework problem from Townsend.
The relationship to $3$-d vectors comes from using a different set of $\hat{\mathbf{L}}$ opertors. See, $3$-d vectors are spin-$1$, so you need $3\times3$ matrices to rotate them. They are described in a funny basis, though. For spin-$^1/_2$ standard practice is to work in an eigenbasis of exactly one component of the spin, $S_z$. If the spin-1 $\hat{L}_z$ eigenbasis is given by $|z_+\rangle$, $|z_0\rangle$, and $|z_-\rangle$, then the standard basis we use for ordinary vectors is: $|x_0\rangle$, $|y_0\rangle$, and $|z_0\rangle$. In that basis we have:
\begin{align}
  \hat{L}_x &= \frac{\hbar}{i} \left[\begin{array}{ccc}
      0 & 0 & 0 \\
      0 & 0 & -1 \\
      0 & 1 & 0\end{array}\right], \\
  \hat{L}_y &= \frac{\hbar}{i} \left[\begin{array}{ccc}
      0 & 0 & 1 \\
      0 & 0 & 0 \\
      -1 & 0 & 0\end{array}\right],\ \text{and} \\
  \hat{L}_z &= \frac{\hbar}{i} \left[\begin{array}{ccc}
      0 & -1 & 0 \\
      1 & 0 & 0 \\
      0 & 0 & 0 \end{array}\right],
\end{align}
as ca be seen by taking the derivative of the three basic rotation matrices with respect to $\theta$ in $3$-d, doing the same for $\hat{R}(\theta,\mathbf{a})$ above, setting them equal to each other, and then setting $\theta=0$. For practice, I would recommend reconstructing at least one of those three matrices using the technique above. Hint: start by calculating $\hat{\mathbf{L}}_i^1$, $\hat{\mathbf{L}}_i^2$, etc, until you find the pattern, then use that pattern to group like terms in $\exp(x)=1+x+x^2/2 +\ldots$.

A: I don't know the book, but I guess that the context is the Bloch sphere, which is a model of a state space of a 1-qubit system.
A given point n on the sphere is described by a pair of coordinates $(\Delta, \Phi)$, and the state it encodes is denoted $|\mathbf{n}\rangle$. The only thing that misses is what state this corresponds to in the ordinary (vector space) representation of the state space: if $|+z\rangle, |-z\rangle$ form an orthonormal basis of your state space, then this state, corresponding to the point n on the sphere, corresponds to the linear combination of the basis states that you wrote down.
In the end this is just a convention, but a nice one when $|+z\rangle$ and $|-z\rangle$ correspond to spin up and spin down in the $z$-direction. In that case any pair of antipodal points form the orthonormal basis of eigenstates of spin along the line that connects them.


text:
Q: Error in mutual information when using a subset I want to compute the mutual information for ~4000 different pairs, where each pair contains two vectors. Each of these vectors hold 100000 observations, making this computation very computationally intensive when using Minepy. Therefore, it would be nice to just use a sample of these observations to compute the mutual information. How much would it affect the value of mutual information if I only took a random sample of 1000 observations for each of the vectors and used that instead?

A: Let's look at the formula:

I(X,Y) measures the shared information between X and Y.
p(x,y) is the joint probability density function.
The marginal p(x) describes the relative likelihood for the random variable X to take on a particular value x (also, a probability density function).

The question is actually whether the random sample is representative of the population marginal distribution.

Each time you take a random sample for one vector you have a different p(x) for vector x. If your sample is large enough and you're lucky, then this should be a good approximation and you're done.
Now, let's say you want to be more confident about this approximation.
You repeat several times and you get multiple estimations of this distribution. Average these and you have a good approximation of the population distribution, which usually turns out to be a gaussian.
This is called the Central limit theorem which states that if a sufficiently large number of samples is taken from a population (given some conditions), then the distribution will be normal.

TL/DR: You need to randomly sample without replacement multiple times. In your case, this means you randomly select rows from your dataset, let's say S=1000 rows / observations as in your example and repeat this N=10 times. Average the results and you should get an accurate approximation. Adjust S and N according to your computational constraints.

"Dice sum central limit theorem" by Cmglee
shows how the approximation gets better as n increases.

A: You can cope with the running time not by reducing your dataset size but by changing the way you do the computation.
Now you have ~4,000 pairs and you go over 100K samples for each pair , costing ~4*10^9 operations.
Instead, you can do the following:
I assume that you are checking all pairs of variables so the number of variables you have is
n*(n-1)/2 = ~ 4,000
n ~ 100
Aggregate the samples based on all the features.
Using SQL you can do it by
select f1,f2,....fn, count(*)
from samples
group by f1,f2,....fn
That will cost you a single scan of the 100K samples.
The computation of the 4,000 pairs will cost you the size of the 4,000*|aggregated dataset|
If you have 100 (binary) variables, the size of the aggregated dataset might reach 2^100 ~10^30 >> 10^5 = 100K samples.
However, a combination not supported by any samples wont be in the aggregated dataset so the size of the aggregated dataset is at most as the size of the original one.
It is very likely that the size of the aggregated dataset will be way smaller than the original one.
If it not so it might be due to few variable causing such a spread. These are usually few variables of high entropy. You can remove the from the current list of variables and do the computation on the aggregated dataset for the rest. Then you can compute the mutual information of the high entropy variable in the direct method
You can also approximate the mutual information by removing all combination of low support (in SQL, write something like having count(*) > 10).
I would have try to avoid reducing the sample size.
You want to estimate the mutual information of 4,000 pairs with 100K samples.
More than that, computing MI involves division and log which are sensitive to estimation errors. Hence, you are likely to get some bad estimations even when using all your data.
Assuming that you are mostly interested in pair of high MI, keep a validation set to to verify these pair. It seems the moving samples from the original set to the validation is a zero sum game. However, since you would like to verify much fewer pair you will get a better estimation of the pair the you are interested in.
Another way to validated you results is by using transitivity. In case the you have a high mutual information between A and B and also both A and be have high mutual information with other variables, this is a good indicator of a true connection.


text:
Q: Futuristic visual style - Thor: Ragnarok, Transistor video game What is this colorful and futuristic visual style you can see in Thor: Ragnarok the Transistor video game?
Thor: Ragnarok - end credits - YouTube.

A: The style is called Retrofuturism.

The use of a style or aesthetic considered futuristic in an earlier era.
— Definition of retrofuturism, Oxford dictionary


text:
Q: Number of ways to invest $\$20,000$ in units of $\$1000$ if not all the money need be spent Working through a combinatorics section currently and am working on this $2$-part problem. I have solved part $a$ quickly and will provide my work below but am having some trouble with part $b$ and seek guidance in how to proceed.

Question Statement
An investor has $\$20,000$ to be invested amongst $4$ possible investments. Each investment must be a unit of $\$1,000$. If all the money needs to be invested then how many investment strategies are available? What if not all the money need be invested?

Part $a$
This is a simple application of the formula for distributing $n$ identical objects into $k$ distinct boxes. The formula being used is $${n+k-1 \choose k-1}$$ Where we note that $n = 20$ since this is the number of available units of $\$1,000$ for investment and $k = 4$, the number of investments. Hence we find $${23 \choose 3} = \frac{23!}{3!17!} = 12,113,640$$

Part $b$
For this part, my first instinct is to check each combination from $\$0$ invested all the way up to $\$20,000$ and then sum the results. Which would look like: $$\sum_{n=0}^{20} {n + 3 \choose 3} = \sum_{n=0}^{20} \frac{(n+3)!}{3!(n-3)!}$$
However, the first $3$ terms of this sum would lead to negative factorials, which haven't been covered (though I imagine $-3! = -3 \cdot -2 \cdot -1$) and the odd terms would then lead to negative values for the overall term, which doesn't make sense in the context of counting combinations.
Am I on the right track with my line of thinking? What adjustments should I try and think about in order to make the sum representative of the reality of the problem? Or am I way off and the solution is something else entirely? Thanks for any insight provided!

A: I have a work similar to your approach in part $a$ and same way as lulu commented. Assumed $20$ identical coins to be distributed among $4$ persons $A,B,C,D$. It is not necessary to spend all of the conins.
Assume $a$ is the number of coins to $A$ and similarly to other $(b,c,d)$
$a+b+c+d\leq 20$
Assume a variable $p\in [0,20]$. And the solutions to the above equation are similar to those,
$$a+b+c+d+p=20$$
Now you can apply your result from part $a$ which will give. $24 \choose 4$

Assuming investing no money is considered a case.

A: A: By the way, for part $1$, though you have written the formula correctly, your computation is way off !
$\binom{23}{3} = 1771$
B: Here I put a slightly different interpretation to
"What if not all the money need be invested" to mean that at least one unit is invested,
so adding the slack variable, the formula becomes $$\binom{n+k}{k} - 1 = \binom{24}{4} - 1 = 10625$$
[The $-1$ is for all the money going into the slack variable ]


text:
Q: Django deploy to Heroku No module named 'django_heroku' I'm tryin to deploy to Heroku and before this error I was getting:
ModuleNotFoundError: No module named 'django-tables2'
Then I installed django-heroku via pip install django-heroku, followed the instructions on how to set it up.
I disabled the collect static for heroku pushed my master branch and everything is fine, but once I do:
heroku run python manage.py migrate

I get the:
ModuleNotFoundError: No module named 'django_heroku'

the complete traceback is this:
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line    utility.execute()
  File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 341, in run_from_argv
    connections.close_all()
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line 225, in close_all
    for alias in self:
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line 219, in __iter__
    return iter(self.databases)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line 153, in databases
    self._databases = settings.DATABASES
  File "/app/.heroku/python/lib/python3.7/site-packages/django/conf/__init__.py", line 76, in __getattr__
    self._setup(name)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/conf/__init__.py", line 63, in _setup
    self._wrapped = Settings(settings_module)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/conf/__init__.py", line 142, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/GPC/settings.py", line 14, in <module>
    import django_heroku
ModuleNotFoundError: No module named 'django_heroku'

I have in my settings at the top:
import os
import django_heroku

and in the very bottom:
django_heroku.settings(locals())

in my requirements.txt I have django-heroku
The master branch is updated and I just can find how to fix this.

A: The problem was that it was not added to the module, it was needed to be added to the virtual env and then do the pip freeze, with that it was solved.


text:
Q: Searching Multi Path or Twig Queries in a dictionary object I've to implement a similar functionality like XPath by reading the XML file and saving it in some object. I've used dictionary for this purpose.
The XML file is read and saved in a dictionary object with keys as unique paths from root to leaf nodes and the values are some specific numbers separated by commas. So the dictionary keys and values are both of type String.
Searching for the single Path queries like /bookstore/book/author is easier as only one entry with this specific key can be found in the dictionary.
What is the best way to search for multipath or twig queries in this dictionary object? A sample query can be //book//last-name.
I've to search all the paths that satisfied the above query along with the count of comma separated values in the dictionary object.
A sample XML file is shown below
<?xml version='1.0'?>
<!-- This file represents a fragment of a book store inventory database -->
<bookstore>
    <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
        <title>The Autobiography of Benjamin Franklin</title>
        <author>
            <first-name>Benjamin</first-name>
            <last-name>Franklin</last-name>
        </author>
        <price>8.99</price>
    </book>
    <book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
        <title>The Confidence Man</title>
        <author>
            <first-name>Herman</first-name>
            <last-name>Melville</last-name>
        </author>
        <price>11.99</price>
    </book>
    <book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
        <title>The Gorgias</title>
        <author>
            <name>Plato</name>
        </author>
        <price>9.99</price>
    </book>
</bookstore>

A: If you have a dictionary of absolute XPaths and you want to match //book//last-name, you will need to perform 3 steps:
1) iterate all the keys in your dictionary and reduce them to a set of keys which contain /book, lets call that set2.
2) iterate all keys in set2 and reduce them to a set of keys which contain /last-name, lets call that set3.
3) Retrieve all entries from your original dictionary which are in set3 and you have your answer.


text:
Q: AttributeError from predicate in Django Admin when using django-rules I am trying to create a first implementation with django-rules, following the guidelines in the README.
To start with some basic concepts, I want to restrict deletion of a record to the record owner onlyin my app contact. I managed (it seems) to get things working with my API provided via Django REST Framework. However, when I open Django Admin with a non-superuser user, I get the following error:

AttributeError: 'NoneType' object has no attribute 'created_by'

This appears to be related to my predicate definition in contact/rules.py (I tried to follow the "book example" in the django-rules documentation here):
import rules

@rules.predicate
def is_contact_owner(user, contact):
    return contact.created_by == user

@rules.predicate
def is_address_owner(user, address):
    return address.created_by == user

rules.add_perm("contact.view_contact", rules.is_staff)
rules.add_perm("contact.add_contact", rules.is_staff)
rules.add_perm("contact.change_contact", rules.is_staff)
rules.add_perm("contact.delete_contact", is_contact_owner)

rules.add_perm("contact.view_address", rules.is_staff)
rules.add_perm("contact.add_address", rules.is_staff)
rules.add_perm("contact.change_address", rules.is_staff)
rules.add_perm("contact.delete_address", is_address_owner)

My contact/admin.py looks as follows:
from django.contrib import admin
from rules.contrib.admin import ObjectPermissionsModelAdmin

# Register your models here.
from .models import Address, Contact

@admin.register(Address)
class AddressAdmin(ObjectPermissionsModelAdmin):
# class AddressAdmin(admin.ModelAdmin):
    list_display = (
        "id",
        "local_address",
        "country",
        "uuid",
        "created",
        "modified",
        "created_by",
        "modified_by",
    )
    date_hierarchy = "created"
    list_filter = ["created", "modified", "country"]

@admin.register(Contact)
class ContactAdmin(ObjectPermissionsModelAdmin):
# class ContactAdmin(admin.ModelAdmin):
    list_display = (
        "id",
        "last_name",
        "first_name",
        "date_of_birth",
        "uuid",
        "created",
        "modified",
        "created_by",
        "modified_by",
    )
    date_hierarchy = "created"
    list_filter = ["created", "modified"]

Can anyone give me pointers as to what may be failing here?

A: So after adding some logging, I found out that my predicate function appears to be executed on every request, even when only the view permission should be checked. The error was observed on the admin login page, where no object for which I wanted to check the created_by property was in the context yet.
This leads to another question: why is the predicate checked on every request? -> new post


text:
Q: OSX framework 10.13 fails to compile ImageKit.framework and ImageKit.framework I just updated to the newest OSX and newest Xcode and now I cannot compile my code anymore, because I include AudioToolbox/AudioToolbox.h and I get this:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h:867:30: error:
      expected ','
                                                                                API_AVAILABLE(macos(10.6), ios(10.0), watchos(3.0), tvos(10.0));
                                                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioQueue.h:902:30: error:
      expected ','
                                                                                API_AVAILABLE(macos(10.6), ios(10.0), watchos(3.0), tvos(10.0));

Similar situation for ImageKit.framework:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKImageBrowserView.h:171:73: error:
      expected ','
API_DEPRECATED("Deprecated - Please use NSCollectionView instead", macos(10.5, 10.14))

Seems like the macos macro is messed up or something, but all that is in the system framework... Any ideas?

A: Solved - apparently an order matters... I was also including OpenGL stuff, and just shuffling the includes solved it. Oh well...


text:
Q: Scope of variables in PHP file passed to Smarty I would like to know why the array isn't updated with a string concatenation in the following example.
$scripts = array( "jquery.js","bootstrap.min.js",
               "jquery-jvectormap-1.0.min.js",
               "jquery-jvectormap-us-aea-en.js",
               "protoFluid.js");

foreach($scripts as $script)
$script = "/scripts/".$script;

$smarty -> assign('scripts',$scripts);

I expected this code to, for example, change $scripts[0] from jquery.js into /scripts/jquery.js. However, the Smarty debug console shows the following.
Smarty_Variable Object (3)
->value = Array (5)
0 => "jquery.js"
1 => "bootstrap.min.js"
2 => "jquery-jvectormap-1.0.min.js"
3 => "jquery-jvectormap-us-aea-en.js"
4 => "protoFluid.js"
->nocache = false
->scope = "Smarty root"

A: Foreach is working on a copy of the array, you have to do:
foreach($scripts as &$script)
    $script = "/scripts/".$script;

A: Depending on whether you still need the original array afterwards, you could use array_map() to create a modified copy:
$smarty->assign('scripts', array_map(function($script) {
    return "/scripts/$script";
}, $scripts));


text:
Q: Problem "/empty/" when create directory on pulseaudio I have problem with pulse audio on my user.log:

pulseaudio[1836]: [autospawn] core-util.c: Failed to create secure
  directory (/var/empty/.config/pulse)

I see "/empty/" I think is conf problem but how to configure that ?

A: Your Pulseaudio is running as a user whose home directory is set as /var/empty. This is typically done for special application users created for privilege separation purposes or something similar. Such a user should probably not be running Pulseaudio at all.
Use grep /var/empty /etc/passwd to see if you can identify the user account that has its home set as /var/empty. Then find out the purpose of that account and either disable Pulseaudio from starting on that account, or disable regular logins to that account altogether if direct login is not required.


text:
Q: How to desolder a BGA 153 eMMC chip For data recovery I need to desolder a BGA 153 eMMC chip from a dead phone. I'd like to maximize my chances of NOT destroying the eMMC chip in the process (the other remains of the phone do not matter since these are dead already). I've already watched various instruction videos and I'd say I have an idea of the general process.
I do have a cheap Chinese hot air station where the temperature can be set between 100-500 degrees Celsius (but I don't know how accurately that actually works) and where air speed can also be selected.
For target practice I just unsoldered some DDR3 chips from some old PC's memory PCB (these chips where not glued on - it was just the solder that held them in place). I used a nozzle about the same size as the chip and put flux all around the chip before heating. I always used a low air speed (2 on a scale to 8). I progressively increased temperature and each time heated for 2 minutes to test at which minimum temperature the chip would come loose. For the DDR3 chip it actually took me 385 degrees celsius (but maybe the displayed temperature is just wrong)!
With regards to the eMMC chip I had so far found information that 240 degrees should be sufficent to unsolder it (supposedly its solder melts at 225 degrees).
Is it to be expected that an eMMC chip would come off at a so much lower (240 instead of 385) temperature than a DDR3 chip? Or is this just an indication that the temperature reading on my hot air station is way off?
Should I rather be using some higher air speed for this kind of job?
Would it make sense put some thermal isolation on the backside of the phone's PCB to reduce heat emission?
What type of low melting point solder should I use if I wanted to directly solder some wires to the eMMC chip? Or what would be the right type for reballing (leaded, lead-free, etc) if I was so put it onto some kind of breakout board?

A: The easiest and less destructive way would be to turn your board upside-down, and heat the chip area from the PCB side. Use some powerful heat gun instead of a tiny hot-air pencil. As soon as the solder temperature gets to the soften/melting point (which you don't know and shouldn't guess), the chip will fall down by itself, maybe with a little help.
You can't afford re-balling, plus you will need to develop a PCB interposer for the BGA with breakout pins, etc. Best way would be to use a very thin magnet wire, AWG36 to AWG40, and break the connection to some DIP-40 socket, or something. Solder 60/40 would be just fine, if you have a 10X stereo stand and fine-tip soldering iron.
ADDITION: Here is your other option without soldering the chip back:

You just need to clean your eMMC thoroughly.

A: The big danger, regardless of your method, is getting your chip too hot for too long. You don't want to pump enough heat through your IC to heat up the PCB beneath it.
One good solution is in @AliChen's answer. Another method is to preheat the whole pcb (from underneath) to just under the solder melt temperature. Then you can add heat to the IC with your hot air station and remove it with tweezers.
I would recommend an IR preheating station. If you don't have one, you'll have to decide if your data is worth the investment. You can probably find a new cheap one for under $100 USD.
Here's an example image from AliExpress. I haven't used this one, so I can make no recommendations:

By the way, you certainly don't want your IC hot enough to melt solder for two full minutes at a time!


text:
Q: How do i turn off GPS Location automatically after certain time if it is not used? Actually i used my distributors and retailers GPS location in my app when they start their meeting and GPS will not turn off until they do not end their meeting as i have to take their end meeting location . But this cause a battery problem in their phones . Is there any way to turn off GPS Automatically between their start meeting and End meeting?

A: I don't think that it is now possible to programmatically turn GPS ON/OFF. This feature was available in earlier android versions, but i think now google has stopped it.
Instead, you can direct the user to GPS settings page so that the user can himself make the choice whether he wants to expose his location or not.
You can do this by calling:

startActivity(context, new
  Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));

A lot of people these days are skeptical regarding sharing their location, that's why the consent of users is mandatory for sending GPS location.

A: You can use this
private void turnGPSOn(){
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);

if(!provider.contains("gps")){ //if gps is disabled
    final Intent poke = new Intent();
    poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
    poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
    poke.setData(Uri.parse("3"));
    sendBroadcast(poke);
}}private void turnGPSOff(){
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);

if(provider.contains("gps")){ //if gps is enabled
    final Intent poke = new Intent();
    poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
    poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
    poke.setData(Uri.parse("3"));
    sendBroadcast(poke);
}}

call this when you want to disable gps or enable it when you required, more you can find from How can I enable or disable the GPS programmatically on Android?


text:
Q: Identity involving the Möbius function and the first derivative of the Riemann zeta function Working on the derivatives of the Riemann zeta function, I noted that, for any positive integer $n>1$, the following identity holds:
$$\frac{\zeta'(n)}{\zeta^2(n)}=\sum_{x=1}^\infty \mu(x) \frac{\log{x}}{x^n}$$
where $\mu$ is the Möbius function. I googled to find a proof or at last a citation of this formula, but did not find anything. My first idea to prove it was to start from some established identities involving the logarithmic derivatives of the zeta function (e.g., that relating the first derivative to the Von Mangoldt function) or the prime zeta function (e.g., that expressing it in terms of the Möbius function and the zeta function). However, I suppose that a relatively simple demonstration of this could be obtained using other simple approaches (for example, a direct application of the Möbius inversion formula). I would be interested to have confirmation of this.

A: It is well known that
$$\frac1{\zeta(n)}=\sum^\infty_{x=1}\frac{\mu(x)}{x^n}$$
Now differentiate both sides and also use the formula $\left(\frac1f\right)'=-\frac{f'}{f^2}$


text:
Q: XMetaL XSL-FO column layout I am now developing a xslfo stylesheet that sets the content to 2-column display, using the RenderX XEP processor. However, I still want to leave the tables as 1-column display.
Indeed, since I am using XEP processor, it will not allow me to put an @span="all" attribute shows the error "fo:block is not a direct child of an fo:flow".
The article is referring to Docbook xslfo, while I am using a custom xslfo that comes with XMetal.

A: Without seeing your resulting XSL FO it is hard to understand. But yes, span="all" must be on a structure that is a direct child of flow. If your table is inside other things like a block-container or a block, this can happen and you will get that error.
You can span the table across the two columns only if the block with span="all" is a direct child of fo:flow.
<fo:flow>
   <fo:block span="all">I work and will span two columns</fo:block>
   <fo:block-container>
      <fo:block span="all">I will NOT work as I am not a child of fo:flow</fo:block>
   <fo:block-container>
</fo:flow>


text:
Q: Bash: How to chown of two file extensions in one line? How may i merge these two lines into one line?
chown abc:abc *.sh

chown abc:abc *.txt

Change ownership of two file extensions into one liner.

A: Like this:
chown abc:abc *.txt *.sh

Or if you really want to get fancy:
chown abc:abc *.{txt,sh}


text:
Q: Make a relation of these four tables Can anyone help me out making a relation of these four tables? It's easy to see but it's hard to make a relation table.

Here's the layout of my SQL structure:

It's my task to guess the relation of the sub_category, action, and item_description.
I already tried:
category <- sub_category <- action <- item_description

...but it did not work. Every sub category here has a different action, that's why it's hard to analyze. For example, if you click the Patio Covers in the sub category it will only show remove and repair in the action. Imagine you clicked the the Patio Covers then another action will appear, also another item description will appear. How you will elaborate the connection of the sub_category, action, and item_description?
Let's assume that the id of the Awnings is 1. The real problem here is when querying. For example if I click the Awnings in the category
SELECT * FROM action where sub_cat_id=1

What if I click the Patio Covers? Patio Covers have only two options in the action, which is remove and repair only. Assume that we have a sub_cat_id in the Action table.

A: Maybe try bridging tables to connect them.
Add a fieldID from one table and then add another fieldID from another table into a new table X. There needs to be some sort of relationship between the tables. So if you have additional tables besides what you mentioned that can help you with this.

A: You need to add sub_id to the action table, and act_id to the item_description table. Then you will be able to join them.


text:
Q: Ignoring an output from a Matlab function
Possible Duplicate:
How to elegantly ignore some return values of a MATLAB function?

I have a Matlab function with two outputs. Sometimes I use both outputs.
function [output1 output2] = myFunction(input)
[a b] = myFunction(input);

Other times I only need output1 and don't want to waste memory assigning output2
a = myFunction(input);

However, I can't figure out a simple way to give the reverse scenario (only need output2 and don't want to waste memory assigning output1). I thought it would be something like
[~ b] = myFunction(input)

but that doesn't seem to work. Anybody have suggestions for a quick solution? Thanks for your help!

A: It's [~, b], not [~ b]. The comma is missing.

A: the object will be created inside myFunction either way, unless your input has a way to prevent the creation.  If you can prevent the creation internally, you can modify myFunction to return a cell array or other structure, from which you can decide which elements to keep.   If your concern is that [dontwant b] is wasting matlab memory by holding dontwant, then you might want to delete dontwant from your workspace by calling
clear dontwant;


text:
Q: Visual Studio import Matlab lib I am trying to import the matlab libraries (\extern\lib\win64\microsoft) into a C++ Project, to use their functionality there. I have done the following up until now:

*

*Add the header folder to the include directories

*Add the mentioned path to the library directories

*Add to linker/input: "libmx.lib;libmex.lib;libmat.lib"

Matlab and Visual Studio are both 64bit.
Now I try to run the program, but now it says that "libmat.dll" is missing, although I actually added "libmat.lib", why is that? Can anybody help?


text:
Q: Add icon to rcp application What is the code to add to the Exit menu (file>exit) to insert an icon in the
-ApplicationActionBarAdvisor.java
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

    private IWorkbenchAction exitAction;

    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }

    protected void makeActions(IWorkbenchWindow window) {

        exitAction = ActionFactory.QUIT.create(window);
         exitAction.setImageDescriptor(Activator.getImageDescriptor("/icons/download.png"));
        register(exitAction);

    }

    protected void fillMenuBar(IMenuManager menuBar) {

        MenuManager fileMenu = new MenuManager("&File",
        IWorkbenchActionConstants.M_FILE);

        menuBar.add(fileMenu);
         menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        menuBar.add(helpMenu);

        fileMenu.add(exitAction);

    }
}

A: Image paths should be relative to the plugin root, so no leading '/':
exitAction.setImageDescriptor(Activator.getImageDescriptor("icons/download.png"));

Your plugin containing the advisor code must have an icons folder containing the download.png image.
Your build.properties file must include the icons folder in the build.


text:
Q: matplotlib.pyplot issue python I'm experiencing a problem with matplotlib, to be more precise with pyplot.
Just after installing, doing
import matplotlib.pyplot

gives me this error:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so, 2): Symbol not found: _png_create_info_struct
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so

So I have no idea what is going on. I'm on Mac OS X 10.6, I have installed python2.7 from disk image and matplotlib from the terminal by using the tar.gz and doing the usual
python setup.py build
python setup.py install

When the installation starts I see:
BUILDING MATPLOTLIB
            matplotlib: 1.1.0
                python: 2.7 (r27:82508, Jul  3 2010, 21:12:11)  [GCC 4.0.1
                        (Apple Inc. build 5493)]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.6.1
             freetype2: 10.0.4

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.44
               Tkinter: no
                        * TKAgg requires Tkinter
                  Gtk+: no
                        * Building for Gtk+ requires pygtk; you must be able
                        * to "import gtk" in your build/install environment
       Mac OS X native: yes
                    Qt: no
                   Qt4: no
                 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: matplotlib will provide
                  pytz: matplotlib will provide
adding pytz

OPTIONAL USETEX DEPENDENCIES
                dvipng: 1.13
           ghostscript: 8.61
                 latex: 3.1415926

Any help guys please!
Cheers

A: http://fonnesbeck.github.io/ScipySuperpack/
I've been fighting this same problem and the answer was to install the ScipySuperpack.  The problem (at least for me) was that I have a 64 bit version of Python, and the version of matplotlib I was pulling from github was 32 bit.  I cloned the ScipySuperpack repository and ran the setup script and it worked.
No amount of fighting with brew or ports was getting me anywhere.

A: In case anyone has the same problem as me and finds this thread, here is how I solved it.
First, I follow the current matplotlib README.osx, along with this guy's advice (not sure if that's necessary)...
brew install freetype --universal
brew install libpng --universal
export CPPFLAGS="-I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include"
export LDFLAGS=" -L/usr/local/opt/libpng/lib  -L/usr/local/opt/freetype/lib"

I also set those variables as recommended by brew.
Then, I did the following
(running from matplotlib build directory, after having built and installed)
drigz@mbp matplotlib 0$ find . -name _png.so
./build/lib.macosx-10.6-intel-2.7/matplotlib/_png.so
drigz@mbp matplotlib 0$ otool -L ./build/lib.macosx-10.6-intel-2.7/matplotlib/_png.so
./build/lib.macosx-10.6-intel-2.7/matplotlib/_png.so:
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 830.0.0)

No libpng! A bad sign... let's see the build output again...
drigz@mbp matplotlib 0$ rm ./build/lib.macosx-10.6-intel-2.7/matplotlib/_png.so
drigz@mbp matplotlib 0$ python setup.py build
[SNIP]
c++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -L/usr/local/opt/libpng/lib -L/usr/local/opt/freetype/lib -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include build/temp.macosx-10.6-intel-2.7/src/_png.o build/temp.macosx-10.6-intel-2.7/src/mplutils.o build/temp.macosx-10.6-intel-2.7/CXX/cxx_extensions.o build/temp.macosx-10.6-intel-2.7/CXX/cxxsupport.o build/temp.macosx-10.6-intel-2.7/CXX/IndirectPythonInterface.o build/temp.macosx-10.6-intel-2.7/CXX/cxxextensions.o -L/sw/lib -L/usr/local/lib -L/usr/lib -L/usr/X11/lib -lpng14 -lz -lstdc++ -lm -o build/lib.macosx-10.6-intel-2.7/matplotlib/_png.so
ld: warning: in /sw/lib/libpng14.dylib, file was built for i386 which is not the architecture being linked (x86_64)

It's not using the right libpng: what does brew provide?
drigz@mbp matplotlib 0$ echo $LDFLAGS
 -L/usr/local/opt/libpng/lib  -L/usr/local/opt/freetype/lib
drigz@mbp matplotlib 0$ ls /usr/local/opt/libpng/lib
libpng.a          libpng.la         libpng15.a        pkgconfig
libpng.dylib      libpng15.15.dylib libpng15.dylib

Let's try to fix that by copy-pasting the command but changing -lpng14 to -lpng15... (there's probably a better way to stop it from using the wrong one, but this worked)
drigz@mbp matplotlib 0$ c++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -L/usr/local/opt/libpng/lib -L/usr/local/opt/freetype/lib -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include build/temp.macosx-10.6-intel-2.7/src/_png.o build/temp.macosx-10.6-intel-2.7/src/mplutils.o build/temp.macosx-10.6-intel-2.7/CXX/cxx_extensions.o build/temp.macosx-10.6-intel-2.7/CXX/cxxsupport.o build/temp.macosx-10.6-intel-2.7/CXX/IndirectPythonInterface.o build/temp.macosx-10.6-intel-2.7/CXX/cxxextensions.o -L/sw/lib -L/usr/local/lib -L/usr/lib -L/usr/X11/lib -lpng15 -lz -lstdc++ -lm -o build/lib.macosx-10.6-intel-2.7/matplotlib/_png.so
drigz@mbp matplotlib 0$ python setup.py install
[SNIP]
drigz@mbp matplotlib 0$ otool -L /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_png.so:
        /usr/local/opt/libpng/lib/libpng15.15.dylib (compatibility version 29.0.0, current version 29.0.0)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 830.0.0)

A: I just wanted to add a few suggestions for people who might still be having trouble. I've been searching around for a while and trying lots of different things. Ultimately, it was one of the following that allowed me to import matplotlib.pyplot on Python 2.7.6 on OSX 10.6 (with X11 and XQuartz installed previously, perhaps outdated):

*

*Installing pkg-info
brew install pkg-info

*Installing libpng from source to /usr/local/lib (configure --libdir=/usr/local)

*Installing XQuartz for Mac

*Deleting matplotlib folders from site-packages (probably old, failed attempts).

*Running
ln -s /usr/local/opt/freetype/include/freetype2 /usr/local/include/freetype

Finally,
port install py27-matplotlib

installed it, and I was able to import. The original error I had was
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/_png.so, 2): Library not loaded: /opt/local/lib/libpng15.15.dylib
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/_png.so Reason: image not found

Though some attempts ran into this error:
In file included from src/ft2font.cpp:3:
In file included from src/ft2font.h:16:
/usr/X11/include/ft2build.h:56:10: fatal error: 'freetype/config/ftheader.h' file not found
#include <freetype/config/ftheader.h>

I'm sorry I can't be more specific.

A: You should follow these directions for installing Matplotlib from source on OSX: https://github.com/matplotlib/matplotlib/blob/master/README.osx
OSX is a bit messy with the lib files, but following the directions from the link should resolve any issues you're having as it automatically installs the dependencies in a self-contained manner.

A: I had same problem as OP. I git cloned the repo and "python setup install" instead of pre-compiled version. Took about 20 minutes to compile and seems to work now.