What's the right way to think about "anomalies" in 3d TQFTs?

Question: 3d TQFTs constructed from modular tensor categories don't in general give an honest 3d TQFT, instead they have an "anomaly."  My vague understanding from Kevin Walker's talks and from skimming Freed-Hopkins-Lurie-Teleman is that what's really going on is that its a 4d TQFT that's almost boring on the 4d part and that's what the "anomaly" means.  Does anyone know how to make this more precise?
Comment: This answer by Richard Montgomery (and its comments) gives another viewpoint: http://mathoverflow.net/a/45408/2051
Answer: There are several different kinds of TQFTs that can be defined. For example there are oriented theories, unoriented theories, framed theories, and many more. The 3D TQFTs coming from Modular Tensor Categories don't define oriented TQFTs, hence they have an "anomaly". One way to make this precise is to realize that they do give a TQFT, just not one based on oriented manifolds, but manifolds equipped with an additional structure.
This additional structure goes under various names, e.g. "p1-structure", "rigging" (there is a weaker version known as a "2-framing"). There are also several ways to define this structure. Some of these approaches do not yield equivalent structures, and it depends on your MTC as to which one will work (although there is a universal choice).
One common version of this structure on a 3-manifold is an equivalence class of choices 4-manifolds which bound it. The equivalence relation is that these 4-manifolds are taken up to bordism (hence you really only have the signature). This gives you a central extension of the bordism category, and (some of) the MTC TQFTs are defined on this central extension. But it also means that there is a way to interpret such TQFTs as assigning data to 4-manifolds, but just in a (mostly) trivial way.
Now the 4-manifold structure is fine for Chern-Simmons theory, but my understanding is that it is not the universal structure (which has to do with the determinant bundle on the moduli spaces of surface, see Segal's "Definition of Conformal Field Theory" manuscript).
Answer: My own understanding of anomalies in TQFTs:
In cases that I have seen, "anomaly" in general refers to central extensions and line bundles.  Physicists have long thought of these issues in a very explicit way, in terms of integrals to compute Feynman diagrams.  In many quantum field theories, the Feynman diagram integrals do not converge even though the quantum field theories are healthy just from counting degrees of terms in the Lagrangian (renormalizable).  A modern explanation of this (that I do not know first-hand, but have been told) is that non-convergence comes from trying to compute something that is not a number, but rather a value in a non-trivial line bundle.  "Anomaly cancellation" means that you find two things to compute that both have anomalies, but whose product does not because the line bundle is trivial.
A 3D TQFT is, among other things, a functor from the category of cobordisms between surfaces to the category of vector spaces.  This category has central extensions, in the same sense that groups have central extensions.  Its universal central extension over ℚ is given by tensoring the torsor of framings with ℚ and it is one-dimensional.  (Here "torsor" just means an affine space over a group.  Framings up to homotopy are a torsor over the abelian group of the homotopy space $[M,SO(3)]$.)  So, if you want a central extension of cobordisms before making your functor, you want framings of 3-manifolds.  The only point of 2-framings is to cancel the 2-torsion part of the torsor of framings by hand; it has always seemed better to me to tensor with ℚ instead.
This central extension appears naturally in the Chern-Simons QFT, a.k.a., Reshetikhin-Turaev invariants of 3-manifolds.  And the Turaev-Viro invariant is a famous example of anomaly cancellation.  If the input category to that invariant is modular (it need only be a spherical fusion category in general), then it is two factors of Reshetikhin-Turaev with opposite phase.
Answer: You can find some of the details in a draft version of my TQFT notes on my web page.  Here's a summary.
Given an n-category with strong duality (by which I mean, more or less, pivotal if $n=2$ and a higher dimensional version of pivotal for $n > 2$; this is stronger than what Lurie means by an n-category "with duals"), there's a standard procedure to construct an n+1-dimensional TQFT.  This procedure works for free for the 0-through n-dimensional parts of the (extended) n+1-dimensional TQFT.  In these dimensions, we need no additional assumptions on the n-cat, and there is no need to choose a decomposition of the manifolds, so there are no combinatorial topology moves to check.  The construction is manifestly invariant.
To construct the top, n+1-dimensional part of the TQFT, we need to make some finiteness assumptions on the n-category.  (This corresponds to the top-dimensional part of what Lurie et al mean by "fully dualizable".)  If the n-category satisfies these assumption, then we get, for each handle decomposition of the n+1-manifold, a state sum type expression for the path integral of the n+1-manifold.  It is not hard to show that this state sum is invariant under handle slides and handle cancelation, so we get a well-defined invariant of n+1-manifolds that interacts with the rest of the TQFT (via gluing formulas) in the correct way.
(Small technicality: the path integral construction depends on a choice of element in the Hilbert space of the n-sphere, corresponding to the path integral of the n+1-ball.  Multiplying this choice by $\lambda$ changes the path integral by $\lambda^\chi$, where $\chi$ is the Euler characteristic of the n+1-manifold.)
A modular tensor category is a 3-category with strong duality and the right sort of finiteness properties, so we can apply the above construction to get a 3+1-dimensional TQFT.
In dimension 3 the vector space we construct is an old-fashioned skein module: finite linear combinations of ribbon graphs in M^3 modulo local relations.  (Actually, the dual of this vector space.)  If M is closed this in 1-dimensional.  More generally, if M has boundary then it has the same dimension as the Witten-Reshetikhin-Turaev vector space associated to the boundary of M.
In dimension 4, the type of state sum we get depends on the type of handle decomposition.  For a general handle decomposition we get the Crane-Yetter state sum.  For 2-handles attached to a 4-ball along a framed link L we get the Reshetikhin-Turaev surgery formula for L.  For a 4-dimensional neighborhood of a 2-complex we get the Turaev "shadow" state sum.  For a closed 4-manifold we find that the path integral is equal $a^\chi b^\sigma$, where $\chi$ is the Euler characteristic and $\sigma$ is the signature of the 4-manifold.  By choosing $\lambda$ above appropriately we can make a=1.  b is related to the central charge of the MTC (or to the value of the RT surgery formula on framing +-1 unknot).  For a 4-manifold with boundary we find that the state sum computes the Witten-Reshetikhin-Turaev invariant of the boundary of the 4-manifold.
In dimension 2, the 1-category associated to a closed surface is a full matrix category; i.e. it is Morita trivial.  For a surface with boundary k circles the category is Morita equivalent to k copies of the MTC thought of as a 1-category.
In all of the above cases, we find that the TQFT invariant of $Z(X)$, where dim(X) = 2 or 3 or 4, depends strongly on the boundary of $X$ but only weakly (i.e. only up to bordism) in the interior of $X$.  So we can define a new 2+1 dimensional TQFT $Z'$ via the formula
$$Z'(Y) := Z(\mathrm{boundary}^{-1}(Y))$$
This TQFT has an anomaly, since we need to enhance Y with enough extra structure to pick out an inverse-boundary, up to bordism.
Comment: I should have said central charge rather than total q-dim (and now I've edited away the error).  The total q-dim plays a prominent role in the state sum, but not in the final answer for a closed 4-manifold.
Comment: I should add that the above in no way contradicts Chris's answer.
Comment: I'm somewhat confused on one point, I thought that TQFTs coming from Turaev-Viro (in other words when the MTC is the Drinfel'd center of a semisimple spherical cateogry) didn't have an anomaly.  But by your description they still see the 4-d structure because their total quantum dimension isn't 1.
Comment: There are some recent preprints by Daniel Freed which expand on this way of looking at anomalies: http://arxiv.org/abs/1404.7224 and http://arxiv.org/abs/1406.7278
Answer: Here is my understanding from physics point of view.
A quantum field theory is anomalous if it lacks of a UV completion. In other words there is no lattice theory in the same dimension, whose continuum limit produces the quantum field theory.
However, even an anomalous quantum field theory can be produced at the boundary of a topological ordered state on lattice in one higher dimension.
In other words, for a given quantum field theory, there is always a gapped lattice theory in one higher dimension, whose continuum limit at the boundary produces the quantum field theory. Thus
the types of anomalies in quantum field theories = types of topological orders in one higher dimension
This leads to a classification of gravitional anomalies in terms of topological orders in one higher dimension.
Also
the types of anomalies in topological quantum field theories (ie gapped quantum field thoeries)= types of topological orders with gappable boundary in one higher dimension (ie topological quantum field theories in one higher dimension that have state sum realization )
I have two papers discussing those points in details:
arXiv:1303.1803
    Classifying gauge anomalies through SPT orders and classifying gravitational anomalies through topological orders (for gauge anomaly and group cohomology)
    Xiao-Gang Wen
arXiv:1405.5858
    Braided fusion categories, gravitational anomalies, and the mathematical framework for topological orders in any dimensions (for gravitational anomaly and n-category, as well as the notion of H-type and L-type anomalies)
    Liang Kong, Xiao-Gang Wen
Kapustin also has a paper
arXiv:1404.3230
    Anomalies of discrete symmetries in various dimensions and group cohomology (for gauge anomalies)
    Anton Kapustin, Ryan Thorngren
Comment: Prof. Wen, I feel confused about the meaning of `'lattice model'` here: e.g., we say FQHE states can be realized on 'lattice' just as solid state experimentalist did, so it should be called anomaly free from your definition. However, from Kevin's answer, a Chern-Simons theory is anomalous because it has non-trivial central charge, or related to language of lattice, it can not be realized as Turaev-Viro/Levin-Wen TQFT. In that sense, the 'mathematical lattice' seems to imply a Local Commuting Projector Hamiltonian as well, however, a 'physical lattice' does not requires that.


Is Software Engineer or Computer Science more in demand in today's job market?

Question: I have an offer for Computer Science as well as for Software Engineering for my undergrad. What stream should I select looking at future job market?
Comment: This question is too broad to be answerable.
Comment: Hey Prb, and welcome to [workplace.se]. As explained in our [help/on-topic], *"Questions looking for opinions on what to do but with no specific problem are suited for discussion boards (not a question/answer site) and generally will be closed on The Workplace"* -- we are looking for questions that are practical and answerable based on fact not opinion. If you [edit] your question to be in line with the guidelines in the [help], you may be able to get better answers to a slightly different question. Thanks in advance!
Comment: From what I've noticed, most companies cannot tell the difference between the two and will simply treat you as "programmer". My school has both programs and we take 90% of the same courses, the difference being computer science having a few more math courses, while software engineering has a few more project process courses/design/group work. I find personally as a software engineer I came out of school more prepared than the computer science students, but that is one student from one school with one example. Ask the school for the differenceAndSelectYourFavourite,TheDemandDifferenceIsNeglible
Comment: Everything is in demand, my friend! What are you going to do in life without cops, doctors and nurses, soldiers, lawyers, electricians, plumbers, garbage collectors and all such people? What really matters is where your interest is.
Answer: A good company is looking for people who are - to steal a phrase - smart and get things done ( http://www.joelonsoftware.com/items/2007/06/05.html ). If you have that, then the details of your degree won't make a lot of difference; I have had twenty successful years in development on the back of pure and applied maths, and I know plenty of others who graduated in things like engineering and physics. Plus, you also have to make it through the course in one piece, so don't select it purely on the basis of vague ideas of employability (and if you can call the jobs market accurately 3 years in advance you're wasted doing programming! :) ) - do a course that you will enjoy and find stimulating.
Answer:
Computer Science vs Software Engineering

No one from HR will care. All they will do is check the checkbox for "has a degree".
No one who will interview you for your first few jobs will care. They will be interested in how you learned and what exciting stuff you did at university.
So select the one that sounds fun.


Is there a DMV that shows the aggregate logical reads on a SQL server?

Question: I want to use this metric to compare 2 servers. I've looked at sys.dm_io_virtual_file_stats, but this is missing logical. Also looked at query_stats, but that only includes cached plans.
Answer: I think that what you might be after you may find in a different DMV:
select * from sys.dm_os_performance_counters

sys.dm_os_performance_counters
But pay attention to these features:

Counters like Page reads/sec appear to be cumulative. Which just
  blows my poor head. In that case it should be named like 'pages read'.
  So to get actual Page reads/sec you have to do smth like:
divide the counter value by amount of seconds since startup (you can
  get it by select datediff(ss,create_date, getdate()) as uptime from
  sys.databases where name = 'tempdb').


Remove haze from photos

Question: I have a group photos taken on a humid beach that look really hazy.  Is it possible to remove, using tools like Lightroom or something else?
Comment: Does this answer your question? [How to postprocess photos with lots of blue haze?](https://photo.stackexchange.com/questions/15599/how-to-postprocess-photos-with-lots-of-blue-haze)
Comment: Added sample photo.
Comment: There is a dehaze slider in lightroom. You could try that.
Comment: Can we see an example? Feel free to anonymise people's faces, but we need to see precisely what you mean.
Comment: [This](https://scholar.google.com/scholar?cluster=15109259785314183195&hl=en&as_sdt=0,5) paper has some 2200 citations. Dehazing is a whole field.
Answer: It's hard to tell from the example, but that looks like it may be veiling flare - light from the sun hitting the lens from a high angle, then bouncing around inside the lens & body, causing the entire image to look hazed. As even the tiny bit of hair we can see over the black box seems to show the same effect, that's my best guess.
To avoid this in future, make sure the lens itself is not in the sun - either by using a lens hood, or simply by holding your hand up to block the light. You should see the frame clear up immediately as you wave your hand around as you try to find the right position.
As you are stuck with the haze this time, you can in Photoshop & probably Lightroom (which I don't actually use) see the CameraRAW section which contains Texture, Clarity & Dehaze sliders. Combinations of these plus some relief in the shadows, blacks & vibrancy to compensate for their propensity to over-punch things could pull some detail back. It will never be perfect (& of course the results will be far better on your original shot than a smaller jpg) but here's a rough attempt.

I've also saved this as sRGB as the original P3 profile can easily get confused by 'the web' & its foibles.
I had a go in Luminar as well, just to compare the difference… but that's adding 60 bucks or so to the cost.
Answer: Inspect the Histogram
The pattern I see whenever I see a "hazy" or "foggy" looking image ... is that most of the data is bunched up in the middle of the histogram ... usually these images don't have much data in the dark (left) side of the histogram.  They may or may not have much on the right (light).
Here's your histogram (ignore the ghosting ... the EXIF viewer plug-in in my web browser creates a semi-transparent overlay so you're seeing the background of the web page).  Mostly look at the histogram itself.

Ignore the big spike on the left edge... that's created by the black box you used to redact part of the image.  Mostly pay attention to the red/green/blue data bunched mostly in the middle.  This image does have bright blues (which is why you see the blue spike near the right).
I'll show you a couple other samples:

This one has the flare issue on the lens.  But here's the histogram for this image:

Here again, you can see the histogram data is mostly in the middle ... there is a little data on the right (bright side) caused by the small patch of bright sky ... but nothing near the left (dark) side of the histogram.  All the "blacks" are muddled grays.
Last example:

This one doesn't have the flare issue... but it also has that middle-gray look ... not much contrast.  And if we look at the histogram we can see why:

And what should hopefully not be a surprise by now ... is that the histogram data is all bunched up in the middle.  In this case there isn't much to either the right or left sides.
How to correct it
The actual process is going to vary based on the tool you use.  Lightroom literally has an adjustment in the develop module called "Dehaze".  If you apply this adjustment while watching the histogram, you'll notice it stretches the histogram by stretching it mostly to the left (turning muddled darks into bolder darks).
In your specific image, possibly just the "Dehaze" adjustment on it's own would correct the problem (that is what the tool was meant for).  But more generically the goal is to stretch the histogram so that the tonality isn't muddled with data mostly bunched together in the middle.
In some cases you can just use the contrast slider... but be aware that while this makes the darks even darker ... it also makes the lights even lighter.  This might result in clipping of some of your data.  (You could decrease exposure in an effort to avoid clipping).
Overall advice would be to "stretch" the histogram ... so you end up with data spread across the entire range and not bunched up.  How you achieve this will vary.  Sometimes it's a "Curves" adjustment or a "Levels" adjustment.  Tools such as Lightroom have controls for Highlights/Lights/Darks/Shadows in the Tone Curve section.  They also have the Black Point, White Point, Highlights, and Shadows adjustment in the Basic adjustments palette.
Also there is the "Clarity" adjustment.  It's been my observation (and I'm not certain if this is correct) that this seems to be something of a mid-contrast adjustment (rather than stretching the entire histogram ... what a contrast adjustment does ... this seems to just stretch the center part of the histogram.)
I hope that was helpful.

Remove haze from photos


shared instance with 2 API's error: Can't add self as subview

Question: Am using 2 different API's having trouble with view controller logic. First API is Quickblox as they require loading first which I do in AppDelegate.m in didFinishLaunchingWithOptions. This works correctly. When I try to transition to the second API is where I run into trouble.
First Error: 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'sightingsTableViewController''
To correct I added 'sightingsTableViewController' in the Storyboard. Went to SightingsTableView Controller then added 'sightingsTableViewController' to the Storyboard ID Identity. This fixed the error...
The app went a little further then got second log error:
...nested push animation can result in corrupted navigation bar
...Unbalanced calls to begin/end appearance transitions for
  .
  Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
True to the error as I tried to back out to previous screens I get stack dump with error:
Unbalanced calls to begin/end appearance transitions for
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't add self as subview' Storyboard The view controller logic is wrong and would like to better understand how to correct.
I can get the SightingsTableViewController to display after I changed a delay to 3 seconds.
<code>[self performSelector:@selector(showProximityServicesSwitchViewAndNavigationBar) withObject:nil afterDelay:1.0];
</code>
[self performSelector:@selector(initializeFyxService) withObject:nil afterDelay:3.0];
Answer: Instead of clicking the button 'Sign In' to create the push to the Sightings Table View Controller, I clicked the SignInViewController and dragged the push to the Sightings TVC.
I do not know why this fixed the problem but I do not get any errors or stack dumps now. I would love to know why this change would resolve the unbalanced errors.


What is Wave Function?

Question: Well, what is the meaning of wave function? What does it represent? In Schrodinger's equation, we find the value of Ψ. But what is Ψ exactly? Max Born only gave an explanation of what $Ψ^2$ (the probability of particle with low mass enough to have an observable wavelength to be in a position in space). But no one knows what Ψ is.
Comment: Related: https://physics.stackexchange.com/q/8062/
Comment: Possible duplicate of [Is there a direct physical interpretation for the complex wavefunction?](https://physics.stackexchange.com/q/9109/)
Answer: The name for what the wave function represents is "probability amplitude". You should simply consider that a fundamental physical quantity (at least in non-relativistic QM), no more or less mysterious than "electric field". Electric field is three real numbers at each point in space. Probability amplitude (for one particle) is one complex number at each point in space. Why? Because this is how Nature seems to work. Do we really "know" what electric field or probability amplitude is? No. We just learn how they work.
Physics builds mathematical models of reality. What reality is is probably unknowable or meaningless, and more philosophy than physics.

What is Wave Function?


Inverse Laplace of $ \frac{1}{\sqrt{s} - 1} $?

Question: please help with this.
I found this in textbook.
Not derived from any differential equation.
Also found the answer $$ \frac{1}{\sqrt{\pi}\sqrt{t}} + e^t * erf(\sqrt{t}) $$
(but don't know how)
Answer: Start from Babak's observation that
$$\frac{1}{\sqrt{s}-1} = \frac{\sqrt{s}}{s-1} + \frac{1}{s-1}$$
The ILT of the second term is simply $e^t$.  For the first term, consider the following integral:
$$\oint_C dz \,e^{z t} \frac{\sqrt{z}}{z-1}$$
where $C$ is as follows:

We will define $\text{Arg}{z} \in (-\pi,\pi]$, so the branch is the negative real axis.  There are $6$ pieces to this contour, $C_k$, $k \in \{1,2,3,4,5,6\}$, as follows.
$C_1$ is the contour along the line $z \in [c-i R,c+i R]$ for some large value of $R$.
$C_2$ is the contour along a circular arc of radius $R$ from the top of $C_1$ to just above the negative real axis.
$C_3$ is the contour along a line just above the negative real axis between $[-R, -\epsilon]$ for some small $\epsilon$.
$C_4$ is the contour along a circular arc of radius $\epsilon$ about the origin.
$C_5$ is the contour along a line just below the negative real axis between $[-\epsilon,-R]$.
$C_6$ is the contour along the circular arc of radius $R$ from just below the negative real axis to the bottom of $C_1$.
We will show that the integral along $C_2$,$C_4$, and $C_6$ vanish in the limits of $R \rightarrow \infty$ and $\epsilon \rightarrow 0$.
On $C_2$, the real part of the argument of the exponential is
$$R t \cos{\theta} $$
where $\theta \in [\pi/2,\pi)$.  Clearly, $\cos{\theta} < 0$, so that the integrand exponentially decays as $R \rightarrow \infty$ and therefore the integral vanishes along $C_2$.
On $C_6$, we have the same thing, but now $\theta \in (-\pi,-\pi/2]$.  This means that, due to the evenness of cosine, the integrand exponentially decays again as $R \rightarrow \infty$ and therefore the integral also vanishes along $C_6$.
On $C_4$, the integral vanishes as $\epsilon$ in the limit $\epsilon \rightarrow 0$.  Thus, we are left with the following by the residue theorem:
$$\left [ \int_{C_1} + \int_{C_3} + \int_{C_5}\right] dz \: \frac{\sqrt{z}}{z-1} e^{z t} = i 2 \pi \, e^t$$
because of the pole at $z=1$.
On $C_3$, we parametrize by $z=e^{i \pi} x$ and the integral along $C_3$ becomes
$$\int_{C_3} dz \: \frac{\sqrt{z}}{z-1} e^{z t} = \int_{\infty}^0 dx \: \frac{i \sqrt{x}}{x+1} e^{-x t}$$
On $C_5$, however, we parametrize by $z=e^{-i \pi} x$ and the integral along $C_5$ becomes
$$\int_{C_5} dz \: \frac{\sqrt{z}}{z-1} e^{z t} = \int_0^{\infty} dx \: \frac{-i \sqrt{x}}{x+1} e^{-x t}$$
We may now write
$$\frac{1}{i 2 \pi} \int_{c-i \infty}^{c+i \infty} ds \:\frac{\sqrt{s}}{s-1} e^{s t} = e^t + \frac{1}{\pi} \int_0^{\infty} dx \frac{\sqrt{x}}{x+1} e^{-x t}$$
Now consider the integral on the RHS:
$$ \begin{align}\int_0^{\infty} dx \frac{\sqrt{x}}{x+1} e^{-x t} &= \int_{-\infty}^{\infty} du \frac{u^2}{1+u^2} e^{-t u^2}\\ &=\int_{-\infty}^{\infty} du e^{-t u^2} -\int_{-\infty}^{\infty} du \frac{1}{1+u^2} e^{-t u^2}\\ &= \sqrt{\frac{\pi}{t}} - \pi \,e^t \, \text{erfc}{\sqrt{t}}\end{align}$$
Putting this all together, we get
$$\frac{1}{\sqrt{\pi t}} + e^t \text{erf}{\sqrt{t}} + e^t = \frac{1}{\sqrt{\pi t}} + e^t  (1+\text{erf}{\sqrt{t}})$$
Your answer is missing an $e^t$.
Comment: @BabakS.: many thanks.  You're not bad yourself.  Anyway, my post is shortened; although I did do that latter integral out by hand, I only put the end result there.  Maybe later I will put in all the steps.
Comment: I really love the way you play with integrals. Honestly, wherever I face a question including integrals, complex integrals, I expect to see your complete post, Ron. +1 's given 1 hour ago. :-)
Comment: I have been looking at this solution intermittently and I still cannot figure out "On C2, the real part of the argument of the exponential" part. I upper bounded the integrand by $$\frac{e^{R \left(1-\frac{2 }{\pi }\theta\right)}}{\sqrt{R}}$$ which is $0$ when integrated $\theta$ in $[\pi/2,\pi)$ but I don't understand how $\sqrt R $ ended up in the exponent.
Comment: @grdgfgr: Thank you!  I had a leftover piece from another calculation that got mixed up in this.  I apologize for the confusion and have corrected the mistake.
Comment: @RonGordon the answer is great. Just one point: for the integrals over $C_3$ and $C_5$ isn't there a tiny $y$ component on the parameterization? I mean isn't it $z = e^{\pm i\pi}x+ i\delta$? Of course as $\epsilon\to 0$ one has $\delta\to 0$ but can we simply commute the limit with the integral and set $\delta = 0$ altogether?
Answer: $$\frac{1}{\sqrt{s}-1}=\frac{\sqrt{s}+1}{s-1}=\frac{\sqrt{s}}{s-1}+\frac{1}{s-1}=\frac{s}{\sqrt{s}(s-1)}+\frac{1}{s-1}=\frac{1}{\sqrt{s}(s-1)}+\frac{1}{\sqrt{s}}+\frac{1}{s-1}$$
 And we know that $$\mathcal{L}(\text{erf}(\sqrt{t}))=\frac{1}{s\sqrt{s+1}},~\mathcal{L}(e^{at}f(t))=\mathcal{L}(f(t))|_{s\to s-1},~\mathcal{L}\left(\frac{1}{\sqrt{t}}\right)=\sqrt{\frac{\pi}{s}}$$
Comment: your answer is right ! means answer in my book is wrong... wasted several hours to get the wrong answer :(
Comment: @palatok: Sometimes, happens. :-)


Is there an equivalent to LHS for a discrete input space?

Question: I was wondering if there is a method that is equivalent to Latin Hypercube Sampling when the input space you are trying to sample from are a finite discrete set of possible values.  For example, if I had two variables $x_1,x_2\in\mathcal{X}$ where $\mathcal{X}=\{1,2,3,4,5,6,7,8,9,10\}$ would there be a way to sample from this which is equivalent to LHS?  In the case of two variables it doesn't seem like a tough problem but when you have 3 or more I imagine it can become quite complicated.
Answer: Not sure if anyone is still worried about this, but I also had this question last year. I did implement a sampling design I called a Latin Hyper-rectangular Design (LHrD) for sampling from multiple discrete factors with different numbers of levels for a previous paper - assuming a uniform probability for each factor.
This method preserves the latin property, and randomizes entries so diagonal sampling is not the preference. See the supplemental data of our paper for the algorithm.
This has not been subjected to rigorous testing, but I am assuming that the general properties of space filling designs will hold, albeit with a little more variability given the asymmetry in the dimensions.
Edit: Latin hypercube sampling has been implemented as an R package for multivariate empirical distributions by Pierre Roudier et al, following Minansy and McBratney 2006, this is much better than my simple attempt.
Answer: Yes, you can do this as long as each variable has the same number of values.  The number of samples you get is equal to the number of values, so in your example there will only be 10 samples in a given batch.  The algorithm works as follows:
1. For each variable, create a set holding all of its remaining values.  Initially this is the set of all possible values.
2. To draw a sample, go through each variable and draw a value uniformly from its set of remaining values.  Remove the drawn value from the set.
3. Repeat until all sets are exhausted.
Comment: See page 3 of [A User's Guide to LHS:
Sandia's Latin Hypercube Sampling Software](http://prod.sandia.gov/techlib/access-control.cgi/1998/980210.pdf)
Comment: The first step of their algorithm converts the continuous variables into discrete ones, and proceeds on the discrete values.  If the variables are already discrete, you just skip that first step.
Comment: Can you give a canonical reference for this solution?
Comment: All that page 3 and onward describes is latin hypercube sampling in general. There is no proposed solution in there for the case of finite discrete sets.
Comment: @Tom Minka: Could you add this extra information to the answer?


Is this Double U-Net overfitting?

Question: I'm working on a undergraduate project with using deep learning. Currently, I'm trying to improve a model by modifying it. Model is Double U-Net and dataset that I'm using is DRIVE dataset. It consists from 20 images. My problem is validation score does not increase anymore. I think there is a overfit problem and also, I heard that is the max potential of network so I should try another dataset or model. Data separated 80% training and %10 validation. How can I improve result?
What I tried:
<code>-Added one more U-Net network
-Using (128, 64, 32, 16) filter size
-Using (64, 32, 16, 8) filter size
-BinaryCrossEntropy loss function
-Added dropout exit of encoders with 0.5 value
-Added top, left, right and bottom symmetry augmentation for images, so total number of augmentation is 25
</code>
Augmentations (left-top is original image):

Results:
Answer: The U-Net is not overfitting it is just the training graphs are not smooth. This jittering in the training graphs can be removed by tweaking the learning rate of the model.

Is this Double U-Net overfitting?


Convert whole numbers to "text" on Google Sheets

Question: FYI I know close to nothing about how functions work and etc so forgive me if I'm dumb but I've been trying to convert the 33000000 number into the text form on the left automatically. The 33000000 (J2) cell is K2*600000 and I've done this in a previous spreadsheet and it automatically displayed the 33m format but I'm just not sure how to do that here. I've searched the internet for it but haven't found something that really explains it or maybe just a layman's eyes didn't catch it. Also I do know that it's probably gonna convert to 33.0m for example but that's fine
Comment: Welcome to [Web Applications Stack Exchange](https://webapps.stackexchange.com/tour).
Answer: Use a custom number format. Choose Format > Number > Custom number format and enter this format definition:
<code>[>999999999.999]0,,,"B";[>999999.999]0,,"M";#,##0_M
</code>
The format can be applied directly to the cell that shows the number, which has the benefit that the number remains editable, and the value can be directly referenced in formulas elsewhere. The format can be copied to other cells with Edit > Paste special > Format only.
To answer the question, you can use a formula to get a formatted text string from a number with functions such as text(). See ultimate short custom number formatting.


.svn/entries: No such file or directory

Question: I'm using subclipse to commit and update from eclipse. After some trouble today with svn (Lost .svn/format, what to do?) I wanted to try and see if I can commit from commandline.
Trying to commit from commandline gives me a
<code>.svn/entries: No such file or directory
</code>
error. I checked out my code, and doing
svn info gives me
<code>Path: .
URL: https://svn.somewhere.ac.uk/svn/some/ndeklein/MS
Repository Root: https://svn.somwhere.ac.uk/svn/some
Repository UUID: *
Revision: 5258
Node Kind: directory
Schedule: normal
Last Changed Author: anonym
Last Changed Rev: 5258
Last Changed Date: 2012-04-05 13:59:00 +0100 (Thu, 05 Apr 2012)
</code>
It seems to me that my .svn folder in my root folder misses some necessary files or folders, seeing that it was also missing format. I don't understand how it is possible when getting a fresh check out though, nor how I can fix it.
Answer: Are you using an SSD disk and Linux? I am, and it's the only time I've seen these kinds of errors (I'm using ext4 and encryption). Try using a hard disk, or else read this very carefully:

.svn/entries: No such file or directory


Upgrading from 12.04 to 14.04, will apps have to be reinstalled

Question: If I upgrade from 12.04 to 14.04 using the ubuntu update manager, will my applications remain the same? Or will I have to reinstall the applications again after upgrade? Also, will my unity app launcher remain unchanged? thank you
Answer: update will not damage the files whatsoever, however apps lacking the 14.04 support might cause problems. It will ask you removal of ppa's in that case Everything personal should remain same after the process, however i would take a backup using "aptik" for apps and copy my personal files somewhere safe incase of things get dirty


Run chrome lighthouse's audit from command line

Question: I would like to write a script which run (from the chrome's binary) its lighthouse's audit with a url given.
I didn't manage to find how to do it, but since there is even a chrome extension doing I assume it should be feasible right ?
Answer: Google Lighthouse can be ran using the command line. To run it from the command line, you must first install:

Google Chrome for Desktop
Node.js v6 or later.

To install the Lighthouse CLI, open a command line and type the following command:
npm install -g lighthouse

To run an audit with Lighthouse, type:
lighthouse https://example.com

By default, Lighthouse writes the report to an HTML file. You can control the output format by passing flags.
You will notice that a Chrome window is opened every time you run Lighthouse. If you don't want a window to be opened, you can run it in headless mode:
lighthouse https://example.com/ --chrome-flags="--headless"

For the complete list of options, type:
lighthouse --help

Take a look at the Lighthouse source code repository for additional documentation and examples.
Comment: I think you can use it without installing it globally: just create a `package.json` file in a folder, install lighthouse by running `npm install lighthouse` and run the commands from within that folder
Answer: You can use/test via npx:
npm i npx -g

Then, directly run from your terminal without using a package.json created or installing globally & without opening a chrome browser instance:
npx lighthouse <URL> --only-categories="performance,seo,Accessibility" --chrome-flags="--headless"


Check value of least significant bit (LSB) and most significant bit (MSB) in C/C++

Question: I need to check the value of the least significant bit (LSB) and most significant bit (MSB)  of an integer in C/C++. How would I do this?
Answer: //int value;
int LSB = value & 1;

Alternatively (which is not theoretically portable, but practically it is - see Steve's comment)
//int value;
int LSB = value % 2;

Details:
 The second formula is simpler. The % operator is the remainder operator. A number's LSB is 1 iff it is an odd number and 0 otherwise. So we check the remainder of dividing with 2. The logic of the first formula is this: number 1 in binary is this:
0000...0001

If you binary-AND this with an arbitrary number, all the bits of the result will be 0 except the last one because 0 AND anything else is 0. The last bit of the result will be 1 iff the  last bit of your number was 1 because 1 & 1 == 1 and 1 & 0 == 0
This is a good tutorial for bitwise operations.
HTH.
Comment: IMO the `%2` is silly, because although it works in practice, that's only because in practice all C++ implementations use two's complement representation for negative integers. In theory it doesn't necessarily work, since in theory `-1` might have its LSB clear (ones' complement). If the test is for the *last bit*, then use a *bitwise* operator, in preference to the modulus operator which has nothing intrinsically to do with bits :-)
Comment: Actually the modulo operator fails to get the value of the LSB on _all_ architectures, due to rounding towards zero it returns -1 rather than +1 for odd negative values. Technically prior to C99 rounding towards negative infinity was allowed, yielding the correct value, but I have only ever encountered one such architecture in the wild.
Comment: @Kobie: Do you understand the logic of the formulas or shall I explain in more detail?
Comment: @Steve: Fair point, that's why I listed it as an alternative, but I'll anyway edit the answer to make it more clear
Comment: @Kobie: a possible solution is performing `variable & 1` until you can right shift `variable`. A sort of: `for (;variable != 0; variable >> 1) { ... }`. The last `LSB` value corresponds to the `MSB`.
Comment: @Kerrek: oh, sure... that's an infinite loop :)
Answer: You can do something like this:
#include <iostream>

int main(int argc, char **argv)
{
    int a = 3;
    std::cout << (a & 1) << std::endl;
    return 0;
}

This way you AND your variable with the LSB, because
3: 011
1: 001

in 3-bit representation. So being AND:
AND
-----
0  0  | 0
0  1  | 0
1  0  | 0
1  1  | 1

You will be able to know if LSB is 1 or not.
edit: find MSB.
First of all read Endianess article to agree on what MSB means. In the following lines we suppose to handle with big-endian notation.
To find the MSB, in the following snippet we will focus applying a right shift until the MSB will be ANDed with 1.
Consider the following code:
#include <iostream>
#include <limits.h>

int main(int argc, char **argv)
{
    unsigned int a = 128; // we want to find MSB of this 32-bit unsigned int
    int MSB = 0;   // this variable will represent the MSB we're looking for

    // sizeof(unsigned int) = 4 (in Bytes)
    // 1 Byte = 8 bits
    // So 4 Bytes are 4 * 8 = 32 bits
    // We have to perform a right shift 32 times to have the
    // MSB in the LSB position.
    for (int i = sizeof(unsigned int) * 8; i > 0; i--) {

        MSB = (a & 1); // in the last iteration this contains the MSB value

        a >>= 1; // perform the 1-bit right shift
    }

    // this prints out '0', because the 32-bit representation of
    // unsigned int 128 is:
    // 00000000000000000000000010000000
    std::cout << "MSB: " << MSB << std::endl;

    return 0;
}

If you print MSB outside of the cycle you will get 0.
If you change the value of a:
unsigned int a = UINT_MAX; // found in <limits.h>

MSB will be 1, because its 32-bit representation is:
UINT_MAX: 11111111111111111111111111111111

However, if you do the same thing with a signed integer things will be different.
#include <iostream>
#include <limits.h>

int main(int argc, char **argv)
{
    int a = -128; // we want to find MSB of this 32-bit unsigned int
    int MSB = 0; // this variable will represent the MSB we're looking for

    // sizeof(int) = 4 (in Bytes)
    // 1 Byte = 8 bits
    // So 4 Bytes are 4 * 8 = 32 bits
    // We have to perform a right shift 32 times to have the
    // MSB in the LSB position.
    for (int i = sizeof(int) * 8; i > 0; i--) {

        MSB = (a & 1); // in the last iteration this contains the MSB value

        a >>= 1; // perform the 1-bit right shift
    }

    // this prints out '1', because the 32-bit representation of
    // int -128 is:
    // 10000000000000000000000010000000
    std::cout << "MSB: " << MSB << std::endl;

    return 0;
}

As I said in the comment below, the MSB of a positive integer is always 0, while the MSB of a negative integer is always 1.
You can check INT_MAX 32-bit representation:
INT_MAX: 01111111111111111111111111111111

Now. Why the cycle uses sizeof()?
If you simply do the cycle as I wrote in the comment: (sorry for the = missing in comment)
for (; a != 0; a >>= 1)
    MSB = a & 1;

you will get 1 always, because C++ won't consider the 'zero-pad bits' (because you specified a != 0 as exit statement) higher than the highest 1. For example for 32-bit integers we have:
int 7 : 00000000000000000000000000000111
                                     ^ this will be your fake MSB
                                       without considering the full size
                                       of the variable.

int 16: 00000000000000000000000000010000
                                   ^ fake MSB

Comment: `MSB` and `LSB` depend on architecture. If you use big-endian notation, the `MSB` is the left-most bit. Not first non-zero encountered, nor everything else. Using big-endian notation, the `MSB` in signed integers determines sign (0: positive number, 1: negative number). The `LSB` determines if the number is even or odd (0: even, 1: odd).
Comment: @Kobie: I edited the reply, including a link to wikipedia about Endianess.
Answer: int LSB = value & 1;
int MSB = value >> (sizeof(value)*8 - 1) & 1;

Comment: i think it'd break on big-endian systems.. but dont quote me on it
Comment: Isn't shifting signed integers unportable?
Answer: Others have already mentioned:
int LSB = value & 1;

for getting the least significant bit. But there is a cheatier way to get the MSB than has been mentioned. If the value is a signed type already, just do:
int MSB = value < 0;

If it's an unsigned quantity, cast it to the signed type of the same size, e.g. if value was declared as unsigned, do:
int MSB = (int)value < 0;

Yes, officially, not portable, undefined behavior, whatever. But on every two's complement system and every compiler for them that I'm aware of, it happens to work; after all, the high bit is the sign bit, so if the signed form is negative, then the MSB is 1, if it's non-negative, the MSB is 0. So conveniently, a signed test for negative numbers is equivalent to retrieving the MSB.
Answer: LSB is easy. Just x & 1.
MSSB is a bit trickier, as bytes may not be 8 bits and sizeof(int) may not be 4, and there might be padding bits to the right.
Also, with a signed integer, do you mean the sign bit of the MS value bit.
If you mean the sign bit, life is easy. It's just x < 0
If you mean the most significant value bit, to be completely portable.
 int answer  = 0;
 int rack = 1;
 int mask  = 1;

 while(rack < INT_MAX)
 {
    rack << = 1;
    mask << = 1;
    rack |= 1;
 }

 return x & mask;

That's a long-winded way of doing it. In reality
x & (1 << (sizeof(int) * CHAR_BIT) - 2);
will be quite portable enough and your ints won't have padding bits.


Can someone recognize any two addresses (generated by hardware wallet) come from the same hardware wallet/mnemonic seed?

Question: Can someone recognize any two addresses (generated by hardware wallet) come from the same hardware wallet/mnemonic seed?If I generate multiple cryptocurrency accounts/addresses in ledger live,is it possible for someone to recognize it comes from the same hardware wallet/seed? I would also want to ask the same question for software wallet. Thanks.
Answer: Although there is no link between your addresses alone (someone would need your seed, xprv, or xpub for that) you do leave some residual identity once you start spending.
For example if your wallet builds a transaction where two or more of your previously unassociated addresses are used as inputs in the same transaction, then it may suggest that the spender owns both (or more) of those addresses.
Wallet technologies exist that attempt to muddy the waters of those trying to surveil by combining multiple unrelated coin owners to sign a single transaction together with multiple inputs. Basically disproving the assumption that multiple addresses as inputs in the same transactions means one owner owns all the inputs.
Comment: " if your wallet builds a transaction where two or more of your previously unassociated addresses are used as inputs in the same transaction, then it may suggest that the spender owns both (or more) of those addresses" Could you provide specific example where two or more addresses can be used as inputs in the same transaction? I can only think of smart contract as the only case that could happen. Is it true that right now only smart contract is the only possible way to have two or more inputs in one transaction?
Comment: By "disproving assumption", you mean they try to make that assumption wrong in this particular case of  the attempt to "muddying the waters"? Is there successful attempt of the wallet technology you can cite as an example?
Comment: Multiple inputs from different addresses in a single transaction is very common and has nothing to do with smart contracts.
Comment: is there any specific simple application interface to do a transaction with multiple inputs( multiple different coin owners)?


Anyone have experience with the Tamron SP AF 70-200mm f/2.8 DI LD (IF) Macro?

Question: I was planning to get the Nikon 70-200mm, but there is a big price difference compared to the Tamron.  I will use this for sport shooting. Any advice?
Answer: The Tamron 70-200mm f/2.8 Di LD (IF) Macro lens is known to have fairly good image quality but very slow AF performance. Not exactly what you want to hear about a lens you are considering for sports/action photography. Here's the review of the lens at The-Digital-Picture.
The newly released Tamron 70-200mm f/2.8 SP Di VC is better optically and much better in terms of focus speed. It also costs twice as much as the older lens, but is still just under 2/3 the price of the latest Nikon 70-200mm f/2.8G IF-ED AF-S VR II.
Comment: thank you for the link www.the-digital-picture.com this site is new for me cause im usually go to dpreview.com


A light so strong it has a shadow

Question: I have recently taken an interest in shadows. I know that in order for a shadow to exist that you must have a solid in the way of the light. My hypothesis is that there can be a light so strong, like a laser beam, that it acts like a solid in the sense where it doesn't let light pass through... is this plausible?
Answer: Your hypothesis is basically correct, in theory, even in a vacuum.
Light consists of electromagnetic radiation.  According to classical electrodynamics, electromagnetic fields in a vacuum are linear, which means that one light beam will pass right through another, completely unaffected.  But according to quantum electrodynamics, at electric field intensities greater than the Schwinger limit, electromagnetic fields are expected to become nonlinear even in a vacuum, resulting in inelastic photon-photon scattering.  That more or less means that a beam of light could in principle "block" another beam of light that crosses it.
However, the Schwinger limit at this point is purely a theoretical limit.  Even the Extreme Light Infrastructure currently being developed, which will be at the frontier of producing super-intense laser light, will still produce light that's a couple orders of magnitude below the Schwinger limit.
Answer: Yes and no.
Photons don't interact in free space. So a beam of light can't block another beam of light in vacuum.
Photons can interact due to the nonlinearity of the medium. So it's plausible to block another beam of light if you have the right mediators.
It's however not the light itself becoming a solid. See, for example, electromagnetically induced opacity.
Comment: The vacuum is "non-linear" for photons at very high photon density and at very high energy. See e.g. the work on photon and gamma-gamma colliders.
Comment: The vacuum is **expected** to be non-linear.  It hasn't been observed yet.
Comment: @ChrisMueller: The vacuum is non-linear at any energy. If it wasn't matter wouldn't exist and we wouldn't be doing anything resembling high energy physics. What has not been observed, yet, is the non-linearity for pure gamma-gamma processes, hence the need for gamma-gamma colliders.

A light so strong it has a shadow


Which filesystem to use when a samba share should allow for NTFS encryption?

Question: I'm using a NAS (Buffalo LinkStation Pro with SSH access, if that matters) which runs Linux (220.127.116.11 #1 Fri Jun 8 11:07:30 JST 2012 armv5tel GNU/Linux, with smbd --version = Version 3.0.30-1.4.osstech), while all clients run Windows 7. Currently, the shares are on a xfs partition. How can samba be modified such that the share behaves like an NTFS share to the clients, i.e. allowing for encryption? Or do I need to reformat the partition as an NTFS drive (or more likely, use a loop-mounted NTFS file)?
Comment: Do you want the server or the client to do the encryption? If you want to do encryption in the Windows client, you're asking on the wrong site: flag to have your question migrated to [su].
Comment: @Gilles I'd prefer if the client did the actual encryption. But what I'm asking for is how (if possible) to set up samba (or whatever else is required on a Linux server) such that a network share will be treated with EFS support. It's a question about a Linux server interacting with Windows clients, so if the question is off-topic here, I'd rather have it migrated to [Server Fault](http://serverfault.com). But since the ideal solution would simple have the NAS share look like a true Windows machine share, it is a *nix question IMHO
Comment: @Gilles ... However, I may have asked the wrong question. [How to set up an encrypted directory to be mounted only during samba access?](http://unix.stackexchange.com/q/50550/863) is maybe a better idea...
Answer: A Samba share can never behave as a NTFS share, only as a SMB/CIFS share. If you want encryption then you will need to use a per-file/directory tool, or implement it in the server instead.
Comment: Does that mean there is no way to have the NAS share files that are en-/decrypted transparently on the client side?
Comment: The NAS will share whatever files you like, but the transparency must be handled by the client unless you, again, implement it in the server.
Comment: And can't NTFS do exactly that, and the NAS would simply store the encrypted data more or less without knowing it's encrypted?
Comment: Yes. But **you can't use NTFS over SMB**.
Comment: I see :-/ So the only way to have transparent client-side encryption is via some third-party software? Can't I share like another Windows PC does, where encryption is possible?


installing ghc in home directory

Question: I am following the instructions http://sporkcode.wordpress.com/2009/07/11/installing-the-haskell-platform-in-ubuntu/ for installing GHC in Ubuntu.  And I want install it in my home directory.  I have successfully installed GHC, but when I try to install the Haskell platform, the configure script complains that GHC doesn't work.  This is because ld cannot find the GMP library, which is installed in ~/lib and GHC does not appear to pass LDPATH or LD_LIBRARY_PATH to ld.  Suggestions?
Answer: You can issue an argument to ./configure of haskell-platform
<code>Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-ghc=ARG          Use ARG as the path to ghc [default=autodetect]
  --with-ghc-pkg=ARG      Use ARG as the path to ghc-pkg [default=autodetect]
  --with-hsc2hs=ARG       Use ARG as the path to hsc2hs [default=autodetect]
</code>
Could one of these be what you are looking for?  To see all the available options do
<code>./configure --help
</code>

installing ghc in home directory


Matlab. Integration with a changing parameter

Question: I am doing a little script in Matlab using the numerical integration subroutine in matlab
Im am having som problems with the dimensions of the variables:
I need to integrate from o to pi/2 the product of the Moment Generating function of a fading with another function given:
mgf= (2*(sin(phi)).^2)/(2*(sin(phi)).^2+ EbNolin.*b);

the other function is:
function = -b./(2*((sin(phi)).^2))

where b is a constant:
the thing is that EbNolin is a vector that changes for every value as:
EbNodB = [0:0.51:40];
EbNolin = 10.^(EbNodB/10) ;

So to make the integral i have defined:
phi =0:0.02:pi/2;

To get the same length of EbNolin and phi, but when i try to integrate there are many errors, i have tried:
for i = 1:(79),

Pe = [Pe (a/pi).*quadgk(mgf(i)*function),phi,0,pi/2] %using quadgk
Pe = [Pe (a/pi).*integrate(mgf(i)*function),phi,0,pi/2] %using integrate
Pe = [Pe (a/pi).*int(mgf(i)*function),phi,0,pi/2] %using int

But there are always something... I dont know if i am on the good way doing the integral into a loop, but i dont know how to do it in other way.
My matlab version is r2010
I would be so happy if somebody can give me a little help, merci !
Answer: try calculating mgf like this:
mgf= (2*(sin(phi)).^2)./(2*(sin(phi)).^2+ EbNolin.*b);

also keep in mind that instead of :
EbNodB = [0:0.51:40];
phi =0:0.02:pi/2;

you can use:
EbNodB = linspace(0, 40, 79);
phi = linspace(0, pi/2, 79) ;


Unable to access outside service from inside LAN

Question: I have a weird port forwarding problem. I tried to open my port 22 to the outside network. I was able to access it as long as I am not inside the LAN. I can access it from my office for example. But from within the LAN, I can access the port using the local ip, but I can't access the port using the external IP. It's as if the router is blocking the loopback. I've check all my router settings, turned off anything firewall/filtering related. Any ideas?
Answer: Given that you mentioned port forwarding, I assume your home gateway is acting as a NAT -- or more specifically NAPT -- gateway.  What you're trying to do is called "hairpin NAT" or "NAT hairpinning", in reference to the way a literal hair pin doubles back on itself (the same allusion is used by the term "hairpin turn" for a sharp bend where a road doubles back on itself).
Some NAT gateways are crap and don't support hairpinning.  It may be time to explore your upgrade options.
Comment: "New" doesn't mean "high quality". There's always plenty of crap on the market at any given time.
Comment: This is a pretty new router so I doubt that's the problem.
Comment: And that comment holds true eight years later!
Comment: @erotsppa - As Tim_Stewart says, "holds true 8 years later" (2018)... it's all down to cost and what's required to implement the solution vs the demand for such a solution. Your typical "home" modem/router has no need for such functionality... a business, however, will have very different requirements (staff working on and off-site, for example, shouldn't have to change settings to get their, say, email (if they use an on-prem mail-server) working when they work in the office and when they work off-site etc. Business-grade devices are often higher performing and have these capabilities.
Answer: Assuming Spiff is correct, and your router can't handle port forwarding to the external ip from within the network there is a small work around (and it does sound like this is the case);
You can edit the hosts file, which can be found at /etc/hosts in most unix-systems and in C:\Windows\system32\drivers\etc\ on Windows.
if you add
<code>192.168.0.15  example.com
</code>
in that file, your computer will go to the ip spesified whenever you try to access example.com. You will of course have to do this on every computer that you wish to use within the network.
You can check the wikipedia article for more details on where to find it:
https://en.wikipedia.org/wiki/Hosts_file
Answer: There is a real simple answer to this one. The NAT is getting in the way.

Your computer opens a connection to [ExternalIP]
Your Router forwards that connection to [SSHInternalIP]. Your SSH server sees a connection from [YourInternalIP].
Your SSH server sends its packets to [YourInternalIP].
Your computer sees a strange packet coming from an IP it never talked to and discards it.
Your connection to TCP/22 fails because the TCP 3-way handshake never completes.

You're trying to talk to a Public IP, but the replies are coming from an internal IP. Your computer can't make the two work together. The solution is to use the Internal IP whenever you're behind the router. I work around this problem on my laptops by using different ssh connection strings depending on where I am.
Answer: From what I understand from running an OpenBSD router with NAT, Spiff is correct in his response: the problem you are experiencing is caused by the NAT gateway not supporting what you're trying to do.
Your workstation is sending packets with a source IP of an internal address (say, 10.0.0.2), but the destination address is your exernal IP. When the packets arrive at your (SSH?) server on port 22, the server replies to your workstation directly and there's no NAT happening; now, when your workstation gets a reply from 10.0.0.3 when it was expecting a reply from your external address, it drops the packets.
It seems like a trivial issue at hand, but it can be resolved by updating your workstation's HOSTS file, adding an internal DNS server (or editing the DNS server's entries), or creating a NAT rule to handle the internal->external->internal traffic.


My Manager (Department head) not working during office hours?

Question: In my department, my manager is the whole responsible for our team.
In this case, he is very lazy to do work and even he is not interested to see his files.And simply he pass the files/jobs to us. Even though we people have no proper knowledge of the mangers level of work.But we were done that job in appropriate time by breaking our heads and hand over to him. Then he will submit that to higher management. But while we are doing his  works he will not listen to us / help us, simply he will spent the time in Facebook, Entertainment sites / talking with his friends in phone about useless things. These made us very irritated and also very annoyed. So, How should we handle this situation. Main thing is we cant able to contact higher management without his knowledge.
Comment: What is your question here?  Or are you just wanting to complain?
Answer: Rarely do you want to go over someone's head, but I think this is warranted here.  Your whole team should ask for a meeting with his direct supervisor.  The purpose of this meeting will be to talk about your concerns regarding this manager.  Be as factual as possible and explain your frustration.  Explain how you are all working hard, but not getting the support you need.  Explain how you want to do good work, but your manager is preventing you from doing this or doing it efficiently.
Have a specific remedy in mind (i.e. firing individual, talking with individual, whatever, your teams feels is the appropriate remedy here.)
I think the key here is going to be going as a team.  If you go as an individual then reprisal against you is more likely.  Firing the whole team will not likely be an option, because then the manager will have to hire a new team and do all the teams work in the mean time.
If you do see reprisal from the manager, you will need to speak with his direct supervisor again.  Once again, the whole team needs to go together for this.
Comment: This is solid advice but I will add to it by saying come in with very specific examples. If you have to wait a week for the meeting so you can sit there and watch him do silly things while you take note of them, then do that. If you go in with shaky details and vague examples you run the risk of his manager thinking you are waisting time yourself. It sounds like you have some good examples but make sure to note exactly what he was doing, for how long, and when.
Answer: This is unfortunately a common problem and a very tough one to fix. There are a few solutions,

Confront him, if the whole team feels this way and the whole team confronts him he may change his behavior. This is risky especially if he has the power to fire you. Although in most places they cant actually fire you without just cause (which this is not), however he may be able to make things very difficult for you.
Reach out to HR, chances are your company has a policy on facebook/entertainment site use in the office and chances are he is violating it. If you have an IT department that has half a brain they are tacking his account and can easily show what sites he accessed and possibly for how long. You can often reach out to HR anonymously thus he will never know it was you.
Go to his superior, you say you cannot do this with out him knowing. Can you send his boss an email? Can you set up a meeting with his boss with out him knowing?
Don't do the work, this is most likely the wrong answer but if you are not responsible for the work and doing it only because you feel obligated and cant get in trouble by any one else other than this guy for not doing it, then don't. This will make him look bad when he is in a meeting, asked for the work and cant produce it especially if its his work to do.

If it were me I would go with option 2 for a few reasons. First off if the issue is as serious as you say chances are HR will be involved at some point even if just as a mediator. Getting them involved from the start allows there to be be some accountability so that it is not a he said she said situation. HR also tends to have courses of action for this and can help to get in touch with the proper manager through the correct channels. If his boss may just blow off a meeting with you because you are lower in the company HR will help add some weight to the situation. If for anything it shows that you took the correct course of action from the start, you did not go around anyones back and you made an effort to seek out the proper solution though the right channels. If HR fails then you can move to other means.
Comment: Which of these should the op do? Why?
Comment: That should be part of your answer and it should explain why...
Comment: I would start out with #2 as they tend to know what to do even if they are not the right people to talk to they will offer the best option for them at this particular company.
Answer: I may have an unconventional answer, but my answer to you is HELP HIM. It's not your concern how he does his job. Or to complain about him. Your concern is how you do your job and how you help him to achieve his goals and help him to look good to his boss. That's your role. Not to tell him to be different. But to help him achieve his goals. That's what you are there for.It might not seem fair, but that's life. Some people just seem to have things too cushy. But if you try to change their cushy life you will get resistance and not make any friends. That's not progress, that's not getting ahead without hurting others, which is what you ideally should want to do - get ahead without hurting others. Just help him, set the envy aside and things will work out well for you.
Comment: Everytime I have had a bad boss who didn't do his job, it gave me a chance to really shine by doing work way above my level in the organization. Don't worry, the other managers will notice he isn't pulling his weight and notice that you are more than pulling yours. This kind of situation can be the fast track to a promotion.


Referencing Setup Custom Settings Fields in Salesforce CPQ Quote Terms

Question: I'm trying to reference a custom setting in Salesforce CPQ's quote term object, although instead of displaying what's in the field, it's just showing the formula. This is the formula {!$Setup.MBNZ_Speed_Disclaimers__c.FibreClassic__c}. Is it even possible for CPQ to reference setup fields? The reason I'm trying to do this is because we often have to update one certain part of multiple quote terms, so it would be more straight forward just to have one place to update, then have the quote terms reference that via formula. Thanks
Answer: I believe the only Objects which can be referenced on the standard HTML or Line Item Quote Term types are the following:

Quote Template
Quote
Primary Contact (Contact field on Quote - so specific related Contact fields)
Sales Rep (User field on Quote - so specific related User fields)

You can also reference the Company Logo by itself. Here is a link to the documentation which I've referenced: https://help.salesforce.com/s/articleView?id=sf.cpq_merge_fields.htm&type=5
I don't believe your Custom Setting can be referenced on a typical Quote Term record. You could build a custom Quote Term type which would use a Visualforce page and can pull through any content you can query/present in Apex.


Unexpected null members when reading XLSX with Excel Data Reader (.Net)

Question: I'm reading an XLSX (Microsoft Excel XML file) using the Excel Data Reader from http://exceldatareader.codeplex.com/ and am having a problem with missing data. Data which is in the source Excel spreadsheet is missing from the data set returned by the library.
Here's a bit more detail of what I'm doing:

Created a simple test spreadsheet in Excel with one sheet, a header row and two data rows. Save and close Excel.
Open the file and pass the stream into the CreateOpenXmlReader() method and get back an IExcelDataReader.
Call the AsDataSet() method on the IExcelDataReader and get back a DataSet.
Get the ItemArray from row 1 of table 0.
Loop through the ItemArray. Discovered there is data missing (i.e. there are System.DBNull members where I expected System.string members).

Here's a bit more analysis...
I debugged the code and looked inside the ExcelDataReader object model. Found a non-public string array called "SST" which appears to contain the data from the spreadsheet as a single linear (one-dimensional) array.
On closer inspection, I found that the data I was looking for was also missing from this array. In this raw data, the member does not exist at all.
My guess is that for some reason the parser is not picking up the data from the OOXML and concluding that the cell is empty. Looking at the OOXML itself, the data seems to be split across the sharedStrings.xml and sheet1.xml files, so perhaps the parser is having a tough time putting all this together.
Saving the file in binary format (Excel 97 to 2003) and reading that in solves the problem so on the surface that seems to confirm my suspicion is with reading the OOXML format.
Suggestions?
As a stop gap I'm converting all files to binary format, but that seems like a kludge. Is there some way to get my OOXML formatted Excel files to read in properly with Excel Data Reader?
Answer: To retrieve an Excel spreadsheet (.xlsx) and load it into a DataSet, you don't need to mess with XML readers or a separate library like Excel Data Reader.  The code for reading an entire spreadsheet into a DataSet is pretty simple when using the normal OleDb functions in .NET:
<code>Sub readInMyExcelFile

Dim xlsFile as string = "myexcelfile"
Dim conStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & xlsFile & ";Extended Properties=""Excel 12.0 Xml;HDR=YES"""

Dim dtSheets As New DataTable
Dim tmp As String
Dim sqlText as Sting

Using cn As New OleDbConnection(conStr)
  cn.Open()
  dtSheets = cn.GetSchema("Tables")
End Using

//Dataset for the spreadsheet
Dim ds as New DataSet

/Loop through the names of all the worksheets in the file.
For Each rw as DataRow in dtSheets.Rows
  tmp = rw("TABLE_NAME")
  tmp = "[" & tmp & "]"

  Dim dt as New DataTable

  Using cn as New OleDbConnection(conStr)
    cn.Open
    /Retrieve all the records from the worksheet.
    sqlText = "SELECT * FROM " & tblName

    Dim adp As New OleDbDataAdapter(sqlText, cn)

    /Fill the data table with the all the data.
    adp.Fill(dt)
  End Using

  ds.Tables.Add(dt)
Next

End Sub
</code>
Answer: It seems there is a bug in Excel Data Reader (it is first time I have heard about it). Do you have to use it? If not, EPPlus would be a better choice.
Answer: excel datareader from codeplex is used for reading data from the excel file directly on web application without any sort of caching on the server.the above code only stands when we can store the excel file somewhere.I have faced similar problems with exceldatareader where some of the data are missing.Most importanly i coludnt find any specific trend.All i cud see that if all the rows have values then there is no problem. Best chance is to convert xlsx to xls.


Bundle inside bundle

Question: So I was wondering how I go about back-ending this, im a fairly good developer just not sure how to tell Magento todo I guess CMS the data. So the products I have are 8 juices, you cannot buy the juices on their own, you have to purchase them as part of a pack of a configuration of 6 juices to make a pack. Each pack has its own price. Each one of these packs exist as part of a large product. So at a top down solution, there are 3 packs, standard, standard x, standard xl, each one of those packs contain, 3 packs of their own, 1 day, 3 day, and 5 day, and each one of those packs contain, 6 juices. Only the Day packs have prices associated to it. How do i go about doing this??
Answer: I don't fully understand how your product logic, so I am not sure if bundle products are really the right type for you.
But regardless, Magento does not allow nested product types by design like "bundle in bundle" or "bundle in configurable". I worked on custom product types with this requirements and you certainly don't want to go down this road, it requires lots of rewrites in different places.
So try to model it with only one nesting level. For example using these bundles:

Standard 1 day
Standard 3 day
Standard 5 day
Standard X 1 day
...

You could write a custom product view template to show multiple bundles together as one product. Since you only have three main products, a little bit hard coding probably won't hurt.
Answer: I have an idea for something similar but it leverages some data we already have in our system. We have an attribute on products like this that contains a set of SKUs, one of which must be selected and purchased along with the parent item.
I'm going to make a Magento 2 Bundle Product containing all of the parent and children products in their respective sections, and then customize the customer's product view to show/hide valid options. So for example, the second section of a bundle would be hidden until the user selected a product from the first section. Once the user selects a product from the first section, I will reveal the items from the second section that match the first product's valid set of children SKUs, and leave the rest hidden.
This means Magento 2 will technically be okay with bundle products that we would consider invalid, however, users should only be capable of assembling valid bundle products.
Comment: Did you got any success in that because  I facing same issue
Comment: Not yet unfortunately. But I'll be sure to update when we tackle this task.

Bundle inside bundle


Android-Send data from an application to a lamp Server

Question: I want to send data from my android application to a lamp server and store this data on a database. I don't have experience in that because it's my first time that i set up a lamp server and create a database which will communicate with an android application. To tell you shortly i made an android app that takes a photo and makes ocr. I want to take the resullt which is for example a product name and a price, and send it to server in order to store it in the database. I searched the web but i got little confused because i saw a lot of different methods in order to do this. So, what i want to ask you is that which is the best way to do this and how i'm going to do it?  Thank you!
Answer: Sending data from an android App is no different from any other client that you can think of, call it WebApp, Java App or any other application capable of doing HTTP Request, as long as you have the proper server side code (PHP), to catch the request parameters sent from HTTP Request made by the client, connecting to Database and populating the values, of course is very important to take on count one of the Authentication mechanisms available, so just people that you actually care can hit the server and populate the Database.
Here is an example how to do Http request using "GET" method in Android: http://sunil-android.blogspot.com/2013/01/httpclient-and-httpget.html, if "POST" method is what you need this example is perfect: http://www.androidsnippets.com/executing-a-http-post-request-with-httpclient
In order to catch those values there's tons of examples in PHP to do that...
Hope these examples help and Good luck...
Regards!


Texture, Material problem when exporting to three.js

Question: I have completed a test model in blender 2.7 and upon assigning a material and texture to a shirt it all appears fine and the texture looks great in blender. However upon export to three.js the material color, blender default gray, of the shirt appears to bleed through the UV texture, which is a white cloth, not to be confused with cloth simulation, and it appears a lighter shade of blender default gray.
But indeed the UV texture is present while I can observe the cloth fabric, threads etc. I have correctly chosen the assign button as needed. Would this be a shading issue or have I missed something after months and months of tutorials and reading?
Comment: Making a copy of your ~.blend file accessible would help diagnosing the issue. However, I have found in my own work that in some circumstances, a material can influence a texture, so that if I want a white wall, I will generally use a white material behind a texture with a white background.
Comment: I did actually attempt to change the material color to white through the use of diffuse, however, the default gray remained?
Comment: I wonder if there is a way to make the material color transparent?
Answer: Set the diffuse color to full white.
Blender internal materials do not overlay the diffuse color over the texture (blending) while depending on your application / three.js shaders probably do take diffuse color into account as a color overlay.
Als make sure to set the intensity to 1 as that might change the RGB values upon export. Blender default materials have a gray value and intensity 0.8 as default, so you could write a little script to update all the materials:
<code>import bpy

for material in bpy.data.materials:
    material.diffuse_color = (1.0, 1.0, 1.0)
    material.diffuse_intensity = 1
    material.specular_intensity = 1
</code>
A neutral white should therefore produce the proper result.


How do I get a program to print the number of words in a sentence and each word in order

Question: I need to print how many characters there are in a sentence the user specifies, print how many words there are in a sentence the user specifies and print each word, the number of letters in the word, and the first and last letter in the word. Can this be done?
Comment: Of course it can be done. What's your attempt so far?
Comment: def count_letter(word):
 print (len(word))
 list = word.split()

def main():
 sentence = input("Please enter your sentence. ")
 count_letter(sentence)

main()
Answer: I want you to take your time and understand what is going on in the code below and I suggest you to read these resources.
http://docs.python.org/3/library/re.html
http://docs.python.org/3/library/functions.html#len
http://docs.python.org/3/library/functions.html
http://docs.python.org/3/library/stdtypes.html#str.split
import re

def count_letter(word):
    """(str) -> int

    Return the number of letters in a word.

    >>> count_letter('cat')
    3
    >>> count_letter('cat1')
    3

    """
    return len(re.findall('[a-zA-Z]', word))

if __name__ == '__main__':
    sentence = input('Please enter your sentence: ')
    words = re.sub("[^\w]", " ",  sentence).split()

    # The number of characters in the sentence.
    print(len(sentence))
    # The number of words in the sentence.
    print(len(words))
    # Print all the words in the sentence, the number of letters, the first
    # and last letter.
    for i in words:
        print(i, count_letter(i), i[0], i[-1])

Please enter your sentence: hello user
10
2
hello 5 h o
user 4 u r

Answer:
Please read Python's string documentation, it is self explanatory. Here is a short explanation of the different parts with some comments.
We know that a sentence is composed of words, each of which is composed of letters. What we have to do first is to split the sentence into words. Each entry in this list is a word, and each word is stored in a form of a succession of characters and we can get each of them.
sentence = "This is my sentence"

# split the sentence
words = sentence.split()
# use len() to obtain the number of elements (words) in the list words
print('There are {} words in the given sentence'.format(len(words)))
# go through each word
for word in words:
    # len() counts the number of elements again,
    # but this time it's the chars in the string
    print('There are {} characters in the word "{}"'.format(len(word), word))

    # python is a 0-based language, in the sense that the first element is indexed at 0
    # you can go backward in an array too using negative indices.
    #
    # However, notice that the last element is at -1 and second to last is -2,
    # it can be a little bit confusing at the beginning when we know that the second
    # element from the start is indexed at 1 and not 2.
    print('The first being "{}" and the last "{}"'.format(word[0], word[-1]))

Answer: We don't do your homework for you on stack overflow... but I will get you started.
The most important method you will need is one of these two (depending on the version of python):

Python3.X - input([prompt]),.. If the prompt argument is present, it is written
to standard output without a trailing newline. The function then
reads a line from input, converts it to a string (stripping a
trailing newline), and returns that. When EOF is read, EOFError is
raised. http://docs.python.org/3/library/functions.html#input
Python2.X raw_input([prompt]),... If the prompt argument is
present, it is written to standard output without a trailing newline.
The function then reads a line from input, converts it to a string
(stripping a trailing newline), and returns that. When EOF is read,
EOFError is raised. http://docs.python.org/2.7/library/functions.html#raw_input

You can use them like
>>> my_sentance = raw_input("Do you want us to do your homework?\n")
Do you want us to do your homework?
yes
>>> my_sentance
'yes'

as you can see, the text wrote was stroed in the my_sentance variable
To get the amount of characters in a string, you need to understand that a string is really just a list! So if you want to know the amount of characters you can use:

len(s),... Return the length (the number of items) of an object.
The argument may be a sequence (string, tuple or list) or a mapping
(dictionary). http://docs.python.org/3/library/functions.html#len

I'll let you figure out how to use it.
Finally you're going to need to use a built in function for a string:

str.split([sep[, maxsplit]]),...Return a list of the words in the
string, using sep as the delimiter string. If maxsplit is given, at
most maxsplit splits are done (thus, the list will have at most
maxsplit+1 elements). If maxsplit is not specified or -1, then there
is no limit on the number of splits (all possible splits are made).
http://docs.python.org/2/library/stdtypes.html#str.split


How to initialize a Drive object in Android to perform requests to Google Drive?

Question:
Possible Duplicate:
Android Open and Save files to/from Google Drive SDK

I'm attempting to upload and download files from Google Drive in my android application.
I was able to obtain an authorization token string for the user's Google account using AccountManager.getAuthToken().
Now, I don't know how to use that token to initialize the Drive object to start sending requests to Google Drive. I used the following code from an example in Google Drive scarce documentation, but it doesn't work. Apparently, the call succeeds, but when I try to upload a file, it just hangs up until Android tells me that the App is not responding.
GoogleCredential credential = new GoogleCredential().setAccessToken(authToken);
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = new JacksonFactory();
Drive drive = null;

drive = Drive.builder(httpTransport, jsonFactory)
    .setApplicationName(APP_NAME)
    .setHttpRequestInitializer(credential)
    .setJsonHttpRequestInitializer(new GoogleKeyInitializer(API_KEY))
    .build();

To upload a certain file I do the following:
try
{
    // local file
    java.io.File fileLocal = new java.io.File(FILE_NAME);

    // remote file

    File remoteFile = new File();
    remoteFile.setTitle(fileLocal.getName());
    remoteFile.setDescription("Text File");
    remoteFile.setMimeType("text/plain");

    // load the content of the local file into the remote content
    FileContent remoteFileContent = new FileContent("text/plain", fileLocal);

    // upload the file into Google Drive
    File resultFile = drive.files().insert(remoteFile, remoteFileContent).execute();

    lblStatus.setText("Upload successful with file ID: " + resultFile.getId());
}
catch (Exception e)
{
    // error handling
    ...
}

I've read the Google API documents and they are a mess, and the classes don't have a proper documentation. The samples they give are quite messy.
Any idea why is the app not responding? What am I doing wrong? Any help is appreciated. Thanks.
Answer: I was having this issue a few weeks ago. Have a look over here, where I wrote a pretty extensive explanation of how to make Google Drive mostly work on Android. (I say mostly because file downloads don't seem to be properly authorized...)
Android Open and Save files to/from Google Drive SDK


Potential difference (PD) and electromotive force (EMF) in terms of electrons?

Question:

I am trying to understand potential difference and electromotive force in terms of electrons.
In the above 3 circuit diagrams the red shows (what I think to be) the distribution of electrons around the circuit. (on reflection I do not think there would be more electrons at B, F and L as indicated on the diagram but rather an even distribution of electrons between B and D, F and H and J, and L and P respectively).
I have several parts to by question:

Is emf simply the potential difference between A and B (just focusing on the first diagram for now) i.e. if you sum all the $\frac{e}{4\pi \varepsilon_0 r}$ from all the electrons for position A and then for B and subtract them.
On the same principle is the pd across the resistor the same as above expect done for C and D.
Do these diagrams seem to be write or have I got totally the wrong idea.
Answer: The distinction between emf and potential difference is often glossed over and often misunderstood so this is an appropriate and interesting question.
Since both emf and potential difference are measured in volts, it is quite easy to use the terms interchangeably and, in many cases, there's no harm done but that fact is that emf and potential difference are distinctly different concepts.
Essentially, it is the emf that moves charge around a closed path - a circuit - while potential difference is due to the charge distribution along the circuit.
Consider the first circuit; there is a battery (or cell actually), the source of emf.  If there is no circuit connected to the battery, the potential difference between the battery terminals is equal in magnitude to the emf.
From the Wikipedia article "Electromotive force":

In the case of an open circuit, the electric charge that has been
  separated by the mechanism generating the emf creates an electric
  field opposing the separation mechanism. For example, the chemical
  reaction in a voltaic cell stops when the opposing electric field at
  each electrode is strong enough to arrest the reactions.
The electric charge that has been separated creates an electric
  potential difference that can be measured with a voltmeter between the
  terminals of the device. The magnitude of the emf for the battery (or
  other source) is the value of this 'open circuit' voltage.

If an external circuit (path for charge to flow) is connected to the emf source, electrons from the more negative terminal will flow through the circuit to the more positive terminal.
There is no better demonstration of the distinction between emf and potential difference than to place a short circuit across the terminals of the battery (this must be done carefully and quickly) to determine the short-circuit current.
Assuming an effectively ideal short circuit, the potential difference between the battery terminals will be effectively 0V yet there will be a large current through the short-circuit.
It is the emf that 'drives' this current round the closed path.
Now, once again consider the first circuit.  Clearly, the emf is driving the electrons clockwise but it is also clear that, for there to be a current through the resistor, there must be a potential difference (Ohm's law).  Thus, the electron density is slightly greater on the conductor connected to the more negative terminal of the resistor than on the conductor connected to the more positive terminal.
There's much more to emf than what I've outlined here and the Wikipedia article (and links and reference therein) I linked above gives much more detail.
Answer: You should not think of electrons throughout the circuit as one part having more electrons than the other. You should instead think of the electrons within the conductors in terms of their energy. For example when you connect have a simple circuit with a battery, a set of wires, and a load. When you close the circuit, the electrons at the negative side of the battery will feel attraction to the positive side as this side has a deficiency of electrons. The electrons however do not just speed through the circuit and get through to the other side. They act as sort of a clothesline. Since electrons repel one another when the first electrons move the electrons in front of them, those electrons get repelled and this starts a chain reaction throughout the whole circuit. Now whenever the electrons come across a resistor, for example they lose some of their energy and are not as active to get to the other side of the battery and this is measured as a voltage or potential drop.
Comment: I understand what you have said but surly by the defintion of a potential difference across a resistor it means that the charge distriubtion is different either side?
Answer: The charge is the same on either side of the two points, but the energy that the charges have is different.
Answer:
Emf is the force at the terminals & within the circuit. It is proportional to the energy stored in the cell & it varies throughout a circuit depending on how the energy moves through the circuit components (higher resistance components dissipate more energy within them--which is what causes a proportional voltage drop (higher Vd with higher resistance components & lower Vd with lower resistance components)).
Unknown -  please restate your question in definitive terms.
Your diagrams are fine. They represent one way of visualizing certain fundamentals, however, electrons actually move quite slowly along the path of a circuit. What is actually moving is energy from electron to electron--like a wave in a pond when a dropped pebble in the center of the pond causes a force that dissipates the water--the energy is what causes waves of water to eventually crash against the bank of the pond--the water molecules (and their electrons) nearest the pebble do not wash up on the bank.)


snapping lines by order

Question: I wish to clean lines with some attibutes like
order1 (red), order2(green)...

I use v.clean in QGIS for snapping. Is there a way (QGIS, GRASS, Postgis, Spatialite) that snaps the green line on the red line?
Answer: Both QGIS and GRASS GIS offer a graphical vector digitizer. In addition, GRASS GIS offers a dedicated tool for vector editing (v.edit).
If it is a one-time only operation, it will be easier to interactively snap the line (snapping function in the aforementioned digitizers).

snapping lines by order


bitcoin transaction stuck in limbo

Question: i tried sending a transaction using multibit hd, and its not even that i was trying to get cheesy on the fee, i just forgot to enter one in and now three days later ive lost 15 dollars from bitcoins losing value as my transaction is stuck at being viewed by 5 peers, but receiving no confirmations. after doing some research i seem to get mixed responses on what happens now, will the transaction get rejected and my coins be returned to me with mutibit hd, or do i have to do somthing proactive to get them back?
Comment: If it's been that long, you could try to import the key that controls the coins into another wallet and send a transaction that pays higher fees. Some wallets aren't smart enough to reverse a transaction if it doesn't get accepted by the network, but will recognize its no longer valid when it gets double spent by another transaction.
Answer: MultiBit developer here. If you're using the latest version of MultiBit HD (0.2.0 at the time of writing) then your default would have been set to a reasonable level for the current network conditions of near full blocks. You can always set it higher if needed.
If your version is older and you haven't upgraded then the default fee will likely be too low to be accepted by a miner in the current conditions. It is likely to hang around until it is finally purged by all nodes from their mempools. This can take several days.
More information is here: https://bitcoin.stackexchange.com/a/9737/117 (as suggested by @StephenM347).

bitcoin transaction stuck in limbo


What does it mean for the total energy of a closed system to be zero at all times?

Question: If a closed system has kinetic and potential energy such as the total energy (the sum of the two) equals zero for all times, what does that mean? In other words, what does it physically mean that the total energy is always zero for a closed system?
I think I have a small misunderstanding of the interpretation because i ask myself: how can the system do anything at all if its total energy is zero? But at the same time i think, one can choose the zero potential energy such as the total energy is zero.
Comment: I would say you answered it already with your last thought. You can add some constant energy in your calculation to the whole system. The forces (and hence the stuff that is happening there.) do not change, since they depend on the gradient of the energy.
Comment: Did thermodynamics prompt you to ask this question (like isothermal processes)? Just asking for clarification.
Answer: It doesn't mean much that the total energy is zero - although in practice if this happens it's likely that the system's potential energy is negative, which is balancing the positive kinetic energy.
Let's take the Earth as an example. By convention, the potential energy is set to zero at infinitely far away. Because gravity is attractive, you don't have to exert force on a faraway object for it to start falling towards the Earth. Therefore, the potential energy of a body on the surface of the Earth is negative (given by $PE = - GMm/r$). If the kinetic energy of the body is exactly equal to $GMm/r$, then the Earth-body system would have zero total energy. The body is still moving though, since it has a nonzero kinetic energy. You can also extract more potential energy from the body if it's able to fall deeper into the Earth (e.g. you could dig a hole and drop the body in), just like you are able to convert some energy into potential energy by raising the body higher up.
Ultimately it's not the exact number you get for the energy that matters, but the change in energy, which is related to the total work done.
Answer: Because you can always add a constant to the potential energy without changing the physics. In other words, if you have $$E=K+U=0$$ you will not change anything if you move the zero-point of the potential energy so that $$E=K+U+U_0\neq0$$
Additionally, while $K$ is always non-negative, we can always move to a different inertial frame that has a different speed relative to our previous inertial frame, and so even $K$ is not an absolute value for a system.
Therefore, really a better question is

What does it mean for the total energy of a closed system to be constant?

When total energy is constant, then you can easily relate change in potential energy to change in kinetic energy, as
$$\Delta E=\Delta K+\Delta U=0\to \Delta K=-\Delta U$$
In other words, constant total energy means that any loss / gain in kinetic energy comes from a gain / loss in potential energy.

How can the system do anything at all if its total energy is zero?

This isn't much of an issue once you realize that total energy can be negative (because potential energy can be negative). Then $E=0$ is not an indication of "the system has no energy to give".


Hash key via Bootcamp on Macbook pro

Question: I have a Macbook Pro and installed on this is Windows via Bootcamp. Now I do a lot of programming and I can't find the hash key! Am I missing an obvious shortcut or is there a way to change the shortcuts on Windows in order to map hash to a key (alt 3, ala the Mac)
Comment: It may be worth noting that you're using a British English keyboard.
Answer: Ctrl+Alt+3. This requires Bootcamp drivers are installed.
Answer: It's the RH ALT key + 3 for # on my MBA under Win8.1 Bootcamp
Answer: I'd just like to add that I'm also programming on Windows on a Macbook, and I find AutoHotKey completely invaluable for programming shortcuts.
Quick example, if I press /' or '/ it actually gives me /* and */ which is great for commenting stuff out.
You could use AHK to setup another key to give you a # symbol.
Answer: Low-tech solution when nothing else will work...
Select below and hit Ctrl+C

#

then Ctrl+V in your code window :)

Hash key via Bootcamp on Macbook pro


How to make a sudo passwordless script for any user in bash

Question: I want to be able to run a sudo command inside of a bash script but I was wondering what if I want any user in my server to be able to execute the script without to provide them with my root password, is this possible?
Comment: You'd want to configure sudo to allow any user to execute the command that you want them to be able to execute via the shell script (without a password).  Then if the user runs the script, the script will run sudo as that user, and sudo will validate the execution of the command.
Answer: Try to define it in the sudo configuration (/etc/sudoers) for your script:
ortega ALL=(ALL) NOPASSWD: /path-to-your-script

Comment: Did you sudo the script? Or just type the scripts name?
Comment: Thanks for your response Marco but I can't get it to work: I get this error when I try to execute it as a normal user: `ls: cannot open directory /var/lib/php5: Permission denied` This is what I put in sudoers file: `ALL ALL=(ALL) NOPASSWD: /home/user/asd.sh` and these are the permissions of the file: `-rwxr-xr-x 1 user user      20 Sep 14 16:02 asd.sh`
Comment: What does ortega mean? I read elsewhere that it has to be my username but using ortega worked which is not my username. All that is required is that it be some non special character there on Linux Mint.


Wifi sign in adware?

Question: Hey guys facing this wierd problems since past few days when I connect my phone to my home network I can access the network(there is internet) there is exclamation mark besides my wifi network and a wierd sign in to my wifi network notification pops up when I click that it redirects me to a website there is notification that your moto g3 has a virus something odd!Please help is this adware or my router is infected my other phone on the network does the same thing but only in android I have tested with iphone no problem at all and my laptop is fine too
Comment: You're likely not connected to your own WiFi... Have you reset network settings and reconnected to it?
Comment: No definitely it's my network i double checked that I reset my network many times also changed passwords too
Answer: You've been hit by malware - adwares on your case - that redirect you to specific websites. If you check your apps list, you'll notice some unusual apps, with weird names sometimes. Th simplest solution: you'll need to flash your phone, or if you're skilled, uninstall those apps from your phone by rooting your phone and using ADB Shell. Let me know which one you are able to do.
Comment: Can I just reset my phone would that help ??I doubt it's because of adware on the phone because other Android phone on the network has the same thing.
Comment: I can tell you your phone is infected. This happens only on Android phone. The other phone may have been infected as well. Check your app list
Comment: Resetting the phone won't help since those malwares are installed as system apps. They will be restored. You can get rid by flashing ot removing them manually

Wifi sign in adware?