Implication of ActiveRecord::Base.transaction on multiple tables

Question: I'm curious about how Rails with a MySQL database handles table/row locking on transactions that involve multiple tables.
I have a situation where I need to update many records at once, but I also have to update several related records. I need to make sure that all records are all updated, and if any update fails, the changes are rolled back.
I considered an ActiveRecord::Base.transaction block for this, but a coworker asked about table locking on the involved models.
Here's a super stripped down example of my code:
<code>Change.transaction do
  Change.all.each do |change|
    new_item = Item.new
    new_trait = Trait.new
    new_trait_value = TraitValue.new
    new_trait.options << new_trait_value
    new_item.traits << new_trait
    new_trait.save
  end
end
</code>
Notes:

There could be upwards of 15,000 Change records
There are currently about 24,000 Item records
There are currently about 38,000 Trait records
There are currently about 380,000 TraitValue records
Initial tests show that this is a VERY long running task - measured in minutes, not seconds.

So in this scenario, are all four tables locked? Or is only the Change table locked?
If all four tables are locked, and the process takes minutes to complete, then using transactions may not be appropriate for my situation, as I don't want to prevent other users from adding/updating Item records.
Answer: I'm strongly recommend you activerecord-import gem or write a raw sql queries


present perfect can be replaced with past

Question: I was watching a film in which appears a conversation like this.
two persons were talking in front of the king then after the conversation finished the king says: "must go to bed, I'm tired but I'm glad we've have had this conversation" why he says we have had this conversation. shouldn't he say we had this conversation?
which usage of present perfect is this?
Comment: It's the ***normal*** use - the king's choice of verb form reflects the fact that the (past) having of the conversation is particularly *relevant to time of speaking* (because he's glad about it ***now***, regardless of whether or not he felt like that *during* the conversation).
Answer: The conversation has just ended, a very short while ago and the king is affected by its results = he is glad about it now. If he had said: "I'm glad we had that conversation yesterday, this morning, an hour ago", etc. past simple would be appropriate.


Why Does Passing Light Through a Slit Make it Coherent?

Question: Related: Why incoherent source of waves have to be passed though a single slit for double slit interference pattern to occur?
If you have a an incoherent light source, why does passing it through a single slit make it coherent? Surely it makes a wavefront, which will be a coherent wave front, but there are still multiple wavelengths coming through still.
Lastly, passing the now coherent wave front through a double slit will merely result in an interference pattern, correct? It wouldn't result in any other useful characteristics, would it?
Comment: What evidence do YOU have, or know of, that passing incoherent EM radiation through a single slit, makes it coherent ??   Over what path length or time interval, would such coherence last, if the original source were say a hot lamp filament, for example.    So why do we use lasers, instead of slits, to make coherent EM radiation ??
Answer: Let's recall the easy way to make a diffraction pattern from a double slit. You just shine a laser on it. Why does this create a diffraction pattern? Well we know that the intensity of the light is determined by the electric field, so to figure out why the intensity of the light is the way it is, we just need to figure out why the electric field is the way it is.
To determine what the electric field is on the far side of the double slit (away from the laser) we only need to know what the electric field is at the two slits. This is because the only way information about the electric field can get to the other side is through the slits. Since the laser produces an electric field which oscillates sinusoidally at a specific frequency, we know that the field at each slit must be oscillating sinusoidally with the same frequency as the laser and hence each other. Also since the distance from the laser is the same, the electric field oscillations at the two slits are in phase (even if the distances to the laser were different, they would still be out of phase by a constant phase, and you would still see a diffraction pattern). So two things are necessary: the light needs to be oscillating sinusoidally at a single frequency (I will call this the monochromicity condition), and the oscillation at both slits needs to be offset by a constant phase (I will call this the phase coherence condition).
I will not explain why these two conditions are sufficient for diffraction (I assume you know that already), but let's see if they are necessary.
Suppose first that the monochromicity condition is met, but the phase coherence condition is not met, so that the phase difference between the two silts varies as a function of time. This could be accomplished for example by holding your double slit up to the sun but using a band-pass filter to filter the sunlight. In this case, I claim you would see no diffraction pattern because as the phase difference between the two slits varies, the location of the diffraction maxima and minima will quickly vary, and the diffraction pattern gets washed out. Thus the phase coherence condition is met.
Is the monochromicity condition necessary. Let's suppose you shine a green laser and a red laser on a diffraction grating at the same time. The electric field at the slits will be a sum of two sine functions. What pattern do you see? You can decompose the electric field on the screen into a piece from the red laser and a piece from the green laser. Each piece individually would give you a nice diffraction pattern, but they interfere with each other creating a complicated pattern of maxima and minima. Moreover, they oscillate at different frequencies, so these maxima and minima will move around very quickly and the pattern will wash out to something that doesn't look much like a diffraction pattern. As the number of lasers increases, this effect would get worse and worse. So the monochromicity condition is necessary.
Now let's take our favorite incoherent light source, an incandescent light bulb, and shine it on a double slit. What happens? Well the light bulb is emitting essentially as a black body so it is emitting radiation at all frequencies and so does not satisfy the monochromicity condition. Also since the light bulb is a large object composed of many independent sources with different path lengths to the slit, the phases at the slits will be uncorrelated and we will not satisfy the coherence condition.
After all this reading we are ready to see the magic. By first passing the light from the light bulb through a single slit, it is possible to arrange things so that the electric field in the double slits satisfies both conditions.
Let's start with the monochromicity condition. We know that a single slit produces a single slit diffraction pattern. Actually the electric field is a superposition of electric fields oscillating at all frequencies, and so the electric field will be a superposition of many interference patterns. But we can put the slits of the double slit at the maxima of the interference pattern for the wavelength we are interested in. Then the electric field from most the other frequencies will be filtered out because they will be closer to their diffraction minima, and we will be left with a sufficiently monochrome electric field to produce a diffraction pattern.
What about phase coherence? Well that is easy. The light takes the same amount of time to propogate from the single slit to either double slit, so the electric field at either of the double slits will always be the same, so they must be in phase.
Since the electric field at the double slit satisfies both the monochromicity and phase coherence conditions, you will see the double slit diffraction pattern.
Comment: Diffraction by a single slit, and double slit interference experiments were performed before laser or other coherent light sources existed.   The slits do not render incoherent radiation sources coherent, nor is source coherence necessary to get either diffraction or double slit interference.   The input single slit isolates radiation from a small region of an incoherent source, which ensures that the radiation arrives at the double slits phase related.  The coherence length is short, but that doesn't change the phase difference at the slits. Small frequency range reduces color fringing.
Comment: You raise a good point that with the setup involving an incoherent source and a single slit, the light reaching the double slits will have a short coherence time, but since the light at either slit is in phase with each other (that is the phase drifts the same way for both slits), they will still produces the desired diffraction pattern. What is important is that the waveform from the single slit is spatially coherent, which guaranteed because the single slit acts like a point.
Comment: The only thing you said that I take issue with is that the single slit isolates radiation from a small region of an incoherent source. All the light emitted from the surface of the source facing the single slit makes it in, but because the single slit is so narrow, if you are downstream you can't tell where the light originally came from, so it looks like the light originally came from a point source.
Answer: Huygen's Principle.
If the slit is thin enough and you are only going to use light from one plane, then the new wavefront is dominated by contributions from only one part of the original wave and all parts of it (the wavefront) share the same phase.
Comment: What is the drop in intensity?
Comment: @Anonymous in general many orders of magnitude. Actually dmckee's wonderfully succinct answer even tells you (in a subtle way) how you would calculate it: you find the positions of the "dominating radiators" on the original wavefront by Fermat's principle (same as the method of stationary phase) and then apply the stationary phase formula to calculate what gets through. You get better "yield" by focusing on the slit, but the slit works by throwing out "incoherent bits" so there will always be a hefty loss unless the light is coherent and unaberrated to begin with.
Answer: Ok I will keep is simple. For interference, we need waves coming from two sources, in constent phase diffrence and same frequency. One way to achieve this would be to have two sources, say two 60W light bulbs to illuminate each slit. But light arriving from these two bulbs will be slightly diffrent in freequency and will not have constent phase diffrence and will not produce interference pattern. To solve this problem, one light bulb is used through one slit, then light passing through the double slits is coming from the same one source, in constent phase diffrence, hence acting as two coherent source of light to achieve better interference patterns.


How can I create a custom "search" for my site?

Question: On my site, I collect information on items in a game I play.  I would like to implement some sort of custom search for the items that is both easier to use, and displays the result in a more aesthetic manner.
Currently, I use a wikidot site which allows tags to be assigned to pages and they can be searched, but searching multiple tags doesn't work as I would like.  It will start the list with pages with all the tags, then pages that have one of the tags, and finally pages that just happen to have the tags in the body.  Also, the results are presented as the page title, the first few lines of text from each page (without any line breaks making it hard to read), and finish with a link to the page.  [See example: https://i.stack.imgur.com/45Sm6.jpg ] What I would like for the results are something like the following: https://i.stack.imgur.com/I5ly1.jpg, which is an actual page from my site, but it's not dynamic, I must edit that page if I want to keep it up to date; and for any permutations of tags I want to create a page like that for, I need to first find all of the relevant items, organize them how I want, then make the page containing the includes for each of their individual pages (each item has its own page, I just put an [[include item-name]] wherever I want that item to show up on other pages, which just puts the body of the page in.
What I'm looking for is the best plan of action to make this happen.  I'm familiar with HTML/CSS/JS, but not much other webdev related stuff.  Is there a way I could have a page with a comma separated list that I could parse with JavaScript to search pages?  Or if should I look elsewhere, what are some good tutorials or quality sources to read up on how to do this?
Thank you in advanced for any answers you can provide.
Answer: If you still require help with this, I'd suggest asking on the Wikidot community wiki instead, as there are more people able to help you with your question there (as you have a Wikidot site).
URL: http://community.wikidot.com/forum


Is there any paper about the encoding process in the machine learning API?

Question: I want to know more details about the encoding process in machine learning. I have read the source code about the "ApproximateInputEncoder" method. It seems like a complex method. So is there any paper or document to explain the mechanism in detail of the encoding process?
Answer: QDK machine learning library is based on the paper 'Circuit-centric quantum classifiers', Maria Schuld, Alex Bocharov, Krysta Svore and Nathan Wiebe, I would start looking for details there. Section A "State preparation" mentions preparing the input states and some references for the routines that can be used.
Comment: Thank you. I have read the paper "Circuit-centric quantum classifiers", Section A doesn't seem to provide much information. Maybe I need to read the references paper. Thanks again.


LWJGL Javadoc with descriptions?

Question: Feel lack about LWJGL's Javadoc descriptions in Eclipse. I mean you can download a javadoc from sourceforge but attributes and methods for example in GL11 there are without description. As a newbie I want to know whats the assignment of each attribute and method without searching everytime. After fast research I found hopefully the way I can solve that little problem - OpenGL Reference. The only thing is left as I thought is to copy-paste one-by-one what is not easy but possible I guess.. I don't know how exactly to do that. So I did go to my project in eclipse and search in LWJGL's packages for easy way to do that and I found curious thing, not sure if this what will help, anyway, in each .class file each attribute and method has comment line with something like this
<code>// Field descriptor #544 I
</code>
So, first way I see is to add descriptions by editing that somewhere(if you know where tell me).
Second way I am thinking about is Attach Source option that I can use in each .class file. I don't understand what is the purpose of that button but maybe it is possible to take descriptions from microsoft msdn and attach them somehow to LWJGL? Does anyone know how to solve that?
Answer: you can use this, is quite good, it contains almost all what you need to know.
http://www.cs.rutgers.edu/~decarlo/428/glman.html
Comment: great link. it's not an answer to my question.. anyway, thank's

LWJGL Javadoc with descriptions?


How to calculate gravitational force

Question: Suppose the centre of mass of 2 bodies coincide , then how will we calculate the gravitational force between the 2 bodies ??
Comment: Yes, of course it can, though you may need to use an integral equation. The trouble is that it isn't clear to us what you mean. Two solid bodies can't overlap, so their centres of mass can only coincide if at least one of the bodies has a hole in it where its centre of mass is.
Comment: @XZark why would you think that?  No matter what the configuration, a few volume integrals will produce the answer (tho' off the top of my head I suspect a certain symmetry will apply & simplify the effort).
Comment: I suppose this physical situation is possible if one of the bodies (the "larger" one) has a cavity in it.
Comment: Or if the two bodies are some system of distributed masses joined with light rods.
Comment: I think this cannot be calculated with newtonian mechanics.
Comment: @JohnRennie or maybe two "barbells" with a little jumper bend in each so as not to intersect physically at the origin.
Answer: Suppose you have two densities of mass $\rho_1$ and $\rho_2$. The two centers of mass coincide if
$$
\vec R_{CM_1} = \frac{\int_{\mathbb{R}^3} \vec r \rho_1(\vec r) \, d^3r}{\int_{\mathbb{R}^3}\rho_1(\vec r) d^3r} \quad \vec R_{CM_2} = \frac{\int_{\mathbb{R}^3} \vec r \rho_2(\vec r) \, d^3r}{\int_{\mathbb{R}^3}\rho_2(\vec r) d^3r}
$$
are equal, but the force is not calculated as
$$
\vec F = -G \frac{M_1M_2}{|\vec R_{CM_1} - \vec R_{CM_2}|^3}\left(\vec R_{CM_1} - \vec R_{CM_2} \right)
$$
Instead you must sum the contribution of all the infinitesimal elements
$$
\vec F = -G \int_{\mathbb{R}^3}\int_{\mathbb{R}^3}\frac{\rho_1(\vec r_1)\rho_2(\vec r_2)}{|\vec r_1 - \vec r_2|^3}\left(\vec r_1 - \vec r_2 \right) d^3r_1 \, d^3r_2
$$
So you are not dividing by zero like in the first formula, the integral is well defined always. It happens that in a spherical distribution of mass, the integral formula reduce to the first one, but in that case the centers of mass never coincides.
Answer: You do this the same way that you always do it: you compute the integral of the forces of each element on each other element. When both objects are spheres (or have spherical symmetry) the math gets easier - but in general just knowing the location of the center of mass of an object is not sufficient to determine the force.
As an example - if you have a hole through the earth and you try to compute the force of gravity as you fall into the hole, you find that this force goes to zero as you reach the center - even though you are getting closer to the center of gravity. In fact, the force becomes:
$$F = \frac{GM_{earth}m}{r^2}\frac{r^3}{R^3}$$
For an object on the surface of the earth, $F=mg=\frac{GMm}{R^2}$, so
$$F= \frac{m g r}{R}$$
But in general, the way to do this is to compute the (vector) sum of all the forces between any two infinitesimal elements in the two objects. Which is hard when they are not spherical.
Comment: that means if there is no symmetry in general we must know the position of each and every particle of the bodies , then compute the integral of forces of each of them . Am I  getting it right??
Comment: Yes that's right. Symmetry is your friend in most of these cases - in particular when you can let things cancel out (you don't have to know their value when they sum to zero)

How to calculate gravitational force


Are there any geometrically meaningful/useful mixed-grade objects in geometric algebra other than rotors?

Question: While reading about geometric algebra, I have seen variables that are meant to represent blades, and variables that are meant to represent rotors, i.e. multivectors with a scalar and bivector component. But I have not seen any applications where a variable represents a mixed-grade object that is not the sum of a scalar and bivector. Are there examples of such objects being geometrically meaningful or useful?
Comment: A sum of blades of all grades could be used to represent a [flag](https://en.wikipedia.org/wiki/Flag_(geometry)). But I'm not sure if this is meaningful; it might as well be a list of blades instead of a single multivector. The algebra's multiplication ought to be used in some essential way.
Comment: We usually don't care if the metric is scaled by any non-zero number. For example, Euclidean space could have a positive-definite metric, or negative-definite, and the geometry is the same. Likewise, spacetime can be modelled as either $\mathbb R^{3,1}$ or $\mathbb R^{1,3}$. But it does change the algebra; e.g. that of $\mathbb R^{1,0}$ has zero-divisors ($(1+e_1)(1-e_1)=0$), while that of $\mathbb R^{0,1}$ has no zero-divisors (it's isomorphic to $\mathbb C$ which is a field). Yet the even subalgebra is not changed when the metric is scaled. This suggests that we shouldn't mix grades freely.
Comment: Apparently even and odd grades are mixed in quantum mechanics. See [Gauge Gravity and Electroweak Theory](https://geocalc.clas.asu.edu/html/Overview.html) (around equation 46).
Answer: In the physics of electromagnetic fields, Maxwell's equations, when expressed in Geometric Algebraic form yield a multivector field that has scalar, vector, bivector, and trivector components thus populating a 3-spatial dimensional multivector fully.
See this short but excellent exposition by author @alan-macdonald
https://www.youtube.com/watch?v=iv5G956UGfs
Answer: As mentioned in @kieranor's answer, electromagnetism provides many examples of multivectors that have more structure than 0,2 multivectors that can represent complex numbers.  Here are a few specific examples from electromagnetism in it's $\mathbb{R}^3$ representation

 Maxwell's equation: $ \left( { \boldsymbol{\nabla} + \frac{1}{{c}} \partial_t} \right) F = J $, where $ F = \mathbf{E} + I c \mathbf{B} $ is the electromagnetic field (vector plus bivector), and $ J = \eta \left( { c \rho - \mathbf{J} } \right) + I \left( { c \rho_\textrm{m} - \mathbf{M} } \right) $ is the current density multivector.  In the latter magnetic sources $ \rho_\textrm{m}, \mathbf{M} $ are included for antenna theory applications, but can be dropped for conventional electromagnetism.   Without the magnetic sources the multivector current density has scalar and vector components.  The magnetic sources add bivector and pseudoscalar terms.
    The Green's function for the spacetime gradient $ \boldsymbol{\nabla} + (1/c) \partial_t $ (i.e. Green's function for Maxwell's equation for infinite boundary value conditions) satisfies
$$\left( { \boldsymbol{\nabla} + (1/c) \partial_t } \right) G(\mathbf{x} - \mathbf{x}', t - t') = \delta(\mathbf{x} - \mathbf{x}') \delta(t - t'),$$
and has the value
$$G(\mathbf{x} - \mathbf{x}', t - t')=\frac{1}{{4\pi}} \left( {- \frac{\hat{\mathbf{r}}}{r^2} \frac{\partial {}}{\partial {r}}+ \frac{\hat{\mathbf{r}}}{r}+ \frac{1}{{c r}} \partial_t} \right)\delta( -r/c + t - t' ),$$
where $ \mathbf{r} = \mathbf{x} - \mathbf{x}', r = \left\lVert {\mathbf{r}} \right\rVert $ and $ \hat{\mathbf{r}} = \mathbf{r}/r $.  This Green's function is a multivector with scalar and vector components.
 Plane wave solutions to Maxwell's equation have multivector factors like $ 1 + \hat{\mathbf{k}} $ that include scalar and vector components.  Example:
$$F(\mathbf{x}, t)=\text{Real} \left( {\left( { 1 + \hat{\mathbf{k}} } \right)\mathbf{E}\,e^{-j \mathbf{k} \cdot \mathbf{x} + j \omega t}} \right),$$
where $ \left\lVert {\mathbf{k}} \right\rVert = \omega/c $, $ \hat{\mathbf{k}} = \mathbf{k}/\left\lVert {\mathbf{k}} \right\rVert $ is the unit vector pointing along the propagation direction, and $ \mathbf{E} $ is any complex-valued vector variable, such that $ \mathbf{E} \cdot \mathbf{k} = 0 $.
It is common to find scalar+vector factors of this form in field solutions.  For example the field for an infinite line charge has the form
$$F \propto \hat{\boldsymbol{\rho}} \left( { 1 - \mathbf{v}/c} \right).$$
Many of the solutions that can be found analytically have a multivector $ 1 - \mathbf{v}/c $ factor like this (circular line charge, ...).
Another example of such multivector factors can be found in a representation of plane, circular, and elliptically polarized field solutions of the form:
$$F = \left( { 1 + \mathbf{e}_3 } \right) \mathbf{e}_1 e^{i\psi} f(\phi).$$
Here the pseudoscalar of the transverse plane $ i = \mathbf{e}_1 \mathbf{e}_2 $, has been used as the imaginary, and $ f(\phi) $ is a complex valued function with respect to such an imaginary representation.
 The statics solution to Maxwell's equation selects grades 1 and 2 from a multivector product:
$$F(\mathbf{x})= \frac{1}{{4\pi}} \int_V dV' \frac{{\left\langle{{(\mathbf{x} - \mathbf{x}') J(\mathbf{x}')}}\right\rangle}_{{1,2}}}{\left\lVert {\mathbf{x} - \mathbf{x}'} \right\rVert^3} + F_0,$$
where $ F_0 $ is any function for which $ \boldsymbol{\nabla} F_0 = 0 $.
This solution incorporates both Coloumb's law and the Biot-Savart law, and follows from the Green's function given above.
 The energy momentum tensor (conventionally written as $T^{\mu\nu}$) is a multivector with scalar and vector components
$$T(a) = \frac{1}{{2}} \epsilon F a F^\dagger,$$
where $ a $ a multivector parameter with scalar and vector components.

The electromagnetic field can be written in terms of a multivector potential $ A $ as follows
$$   F = {\left\langle{{\left( { \boldsymbol{\nabla} -(1/c) \partial_t } \right) A}}\right\rangle}_{{1,2}},$$
where
$$   A =      - \phi      + c \mathbf{A}      + \eta I \left( { -\phi_m + c \mathbf{F} } \right).$$
Here, as before, the magnetic sources $ \phi_m $, and $ \mathbf{F} $ are for antenna theory applications, and can be dropped for conventional electromagnetism.  This is a very compact representation of the fields, but can be unpacked to yield the usual:
$$\begin{aligned}\mathbf{E} &=   - \boldsymbol{\nabla} \phi   - \frac{\partial {\mathbf{A}}}{\partial {t}}   - \frac{1}{{\epsilon}} \boldsymbol{\nabla} \times \mathbf{F} \\ \mathbf{H} &=      - \boldsymbol{\nabla} \phi_\textrm{m}      - \frac{\partial {\mathbf{F}}}{\partial {t}}      + \frac{1}{{\mu}} \boldsymbol{\nabla} \times \mathbf{A}.\end{aligned}$$
 Using the potential representation above, you can find various interesting (and compact) multivector field representations.  For example, given a spherical potential
$$   \mathbf{A} = \frac{e^{-j k r}}{r} \vec{A}( \theta, \phi ),$$
you can show that the far field ($r \gg 1 $) electromagnetic field has the form
$$F = -j \omega \left( { 1 + \hat{\mathbf{r}} } \right) \left( { \hat{\mathbf{r}} \wedge \mathbf{A}} \right).$$

It's a bit of a cheat to give physics examples for a question that asked for geometrical examples.  However, in many cases, there is geometry behind these examples, such as the directly encoding of the propagation direction and the transverse plane in various field solutions above.
Comment: But when this is expressed in terms of $\mathbb R^{3,1}$ or $\mathbb R^{1,3}$, everything is either purely even or purely odd, as far as I can see.
Answer: Eek... not a fan of the other two responses, both of which work from a starting point of viewing the E field as a one-vector, rather than as as the timelike bivectors of the maxwell 2 form F. I am utterly baffled where that convention has found its popularity; but it does 'work' so you might still regard it as an example of a mixed grade object. Though I think its a poor example when those mixed grades are not essential but everything about the maxwell equation is looking much simpler when viewed as a single grade.
To answer your question; the even subalgebra of STA contains quadvector components as well; and you will encounter those when modelling leptons as geometric_vector_derivative(phi)=0, with phi from the even grade subalgebra.


How do I work out my tax when I change jobs?

Question: My question is about tax and NI when your salary changes. With my old job/salary my total deductions are roughly £400. With my new job deductions come to £500, however these figures come from the "listentotaxman" calculator and are based on the annual salary. Does this mean my actual deductions with my new job will be somewhat less than the higher figure (to begin with?) If not , how do I get the correct figure?
Answer: Your PAYE tax code should not change assuming you don't have  a gap between employment or you are not going from lower to higher rate taxpayer your employer (via your p45) and HMRC should sort this out for you.
I am not sure what you mean by "deductions" here and woudl suggest not going random dodgy sites on the internet I would suggest going to the HMRC site and using the tools provided.
http://tools.hmrc.gov.uk/hmrctaxcalculator/screen/Personal+Tax+Calculator/en-GB/summary?user=guest
However you should check your Tax code on your first pay slip to make sure you are on the correct code and haven't been put on an emergency code by mistake.
Comment: Deductions = tax + NI. Thanks for the link will check it out
Comment: @Constanta you will also see pension deductions, share saves and things like paying back any season ticket loans as deductions on the pay slip.


how check bitcoind default values

Question: How can I see which values bitcoind is using for eg. dbcache, or other memory and connection params ? If the value is NOT set in bitcoin.conf. Is there a bitcoin-cli command to check all the params ?
Answer: You can see all available command options by running the command bitcoind -?.
Similarly, in the GUI you can check out "HELP" -> "Command Line Options" in the task bar.
This will return a list of all available commands, as well as their default values (when applicable). Note that this just returns all possible command options, not specifics about what you have set. Default values will be used unless you specify otherwise, and I believe the hierarchy for specifying a command option is:
An option passed on command line when starting bitcoind
(takes precedence over)
an option passed in .conf file
(takes precedence over)
an option set in the GUI
(Information pulled from here)
Comment: I don't see any option for dbcache (for instance), how can a find out the default value?
Comment: No? Which version are you running? With v0.17.01 I see it under the *Options* section at the top: `-dbcache= ... default: 450`
Comment: you are right, I was looking at bitcoin-cli instead of bitcoind

how check bitcoind default values


Flow velocity out of a pipe

Question: For a compressible homoentropic gas is the flow velocity out of the pipe the same as the velocity into the pipe?
Comment: Assuming the same opening on both sides, in the long term it would have to be otherwise the pressure would continue to rise unbounded.
Answer: No.
If the fluid is compressible and the flow is not stationary we can choose initial conditions with an inhomogeneous density. Then the flow will equilibrate and the density will become become stationary but during this time anything can happen. One can build a counter example simply by choosing appropriate initial conditions.
If your are asking about a stationary state, I can not prove anything but I can argue that the answer is no as well: A stationary flow along the tube, must be driven by a pressure gradient. The definition of a homoentropic fluid is that, up to an additive constant, the pressure and the density are proportional to each other (and the proportionality constant is positive). Then there is as well a gradient of density along the tube. The density is greater upstream and lower downstream. The mass flux is the product of the density and velocity and must be the same at both ends of the tube. If not the system is gaining or loosing particles and is not stationary. Then if there is a high density at the inlet and a low density at the outlet the velocity must compensate in order for the mass fluxes to be the same. We get a small velocity upstream and a large velocity downstream.
Answer: I suggest that it would oscillate. Friction against the walls of the pipe would cause the average velocity profile across the pipe to decrease which would increase pressure which would then increase velocity.

Flow velocity out of a pipe


Payment Methods are not showing on PWA Suite?

Question:
I have installed PWA suite on my local machine.
I have enabled COD and Check / Money order Payment methods.
  But Why these methods are not showing on checkout page. Pay with Card only displaying!
Any idea?
Comment: Actually Magento didn't finish this yet, the work around for this would be to redirect the customer to the M2 frontend for cart and checkout.
Comment: you probably have a custom module that overrides the payment method. try to disable those module and check if it works
Comment: @magefms I haven't overridden anything yet. I'm just trying on plain magento with sample data.! Payments methods are displaying on magento instance. I'm facing issue with PWA suite.
Comment: Were you able to sort this out?
Comment: What is the solution to this @SainadhMannem i am facing the same issue.
Comment: No @gabrieliri I haven't got the solution.
Comment: @SubhasTakhellambam I don't have the solution.
Answer: @sainadh I was also getting the same issue and in my case, no payment methods are showing in venia PWA with magento2.4.1 EE.
Did you resolve this issue?
Comment: Hi Vivek,  did you get any solution to this issue? can you share if yes?


Multiple dynamic data sources for a servlet context

Question: I'm developing a java servlet web application that manages information from multiple databases  (all structurally the same) each corresponding to a different "business".  The user selects "the current business" which is stored in the session and the application can display or modify that "current business".
I would like to use tomcat Resources in a dynamic way to have access to these businesses using jndi.  In this way I can use the jstl sql tags or context lookups in servlets.  I can not define each Resource in the web.xml file because they are stored in a SQL table.  The end result is to be able to write simple jsp that has lines like these:
<%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>

<sql:query var = "users" dataSource="sources/${sessionScope.currentBusiness}">
  select id, firstName, lastName FROM user
</sql:query>

or servlets that can have lines like these
String request.getSession().getAttribute("currentBusiness");

Context initial = new InitialContext();
Context context = (Context) initial.lookup("java:comp/env");
DataSource source = (DataSource) context.lookup("sources/" + currentBusiness);

where I can get the correct datasource for the "current business".
I have experimented with writing my own ObjectFactories derived from javax.naming.spi.ObjectFactory without success.  Any pointers on how to easily do this?
Answer: I finally settled for the following solution consisting on a SessionListener and a Servlet that work as follows.  The SessionListener has the following form:
public class SessionListener implements HttpSessionListener {

  public void sessionCreated(HttpSessionEvent event) {

    HttpSession session = event.getSession();

    // get list of possible data sources available to this session
    List<DataSource> sources = new ArrayList<DataSource>();
    ... code to get the available sources

    // get the current data source
    DataSource source = null;
    ... code to get the current source
    source = sources.get(0); // for example

    // setup the session attributes
    session.setAttribute("availableSources", sources);
    session.setAttribute("currentSource", source);

  }

}

Whenever a user logs in and a session is created, the list of available DataSources, and the current one, are placed into the session.  This is done at the Session level because DataSources depend on the user login in.  It is now possible to have access at them from within the application.  To change the current DataSource I created a Servlet with this simplified version:
public abstract class BoxletServlet extends HttpServlet {

  protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {

    HttpSession session = request.getSession(true);
    String s = request.getParameter("source");

    // based on 's' choose from the available DataSource
    List<DataSource> sources = (List<DataSource>) session.getParameter("availableSources");
    Source source = chooseFrom(sources, s);
    session.setParameter("currentSource", source);

    // forward to a page saying that the DataSource changed

  }

}
With this implementation it is now possible to create the following jsps:
<%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>

<sql:query var = "users" dataSource="${sessionScope.currentSource}">
  select id, firstName, lastName FROM user
</sql:query>

Hope it helps someone else.
Answer: Create the data sources in a ServletContextListener and place them in the ServletContext.
Comment: How would you then access it via the JNDI interface?
Comment: You wouldn't be able to do so. Perhaps in the same listener you can use context.bind(name, object) ?
Comment: Forgot about that. Can you change the context factory shipping with Tomcat with a full-fledged one? Not sure how that is done though.
Answer: This approach will certainly "work", but the notion of a separate, identical database for each business seems wrong to me.  Surely being able to delineate business somewhere in the schema seems possible.  Separating them this way requires a new database per business, where a schema would only require a new business identifier.
I'd also argue that any possibility of cross-business data mining is lost, unless you ETL data from separate databases into a dimensional cube for ad hoc reporting and querying.
And JSTL <sql> tags should only be used in the simplest web apps.  You leave yourself open to the possibility of SQL injection attacks when you forego validation on a middle tier.
UPDATE:
You have to declare resources in your web.xml AFAIK, so whenever you have a new database you have to stop the application, configure the new JNDI source, and restart Tomcat.  I hope you're clustered, because all the previous clients will be affected by the app being down every time you add a new business/database.
Comment: The restriction of the multiple databases is the fact they different administrative systems (not under my control) representing multiple companies.  I'm writing an account receivables tracking module for all the companies (not very glamorous) and need access to each company separately.  As for the jstl sql tags I'm only using them to display information for each of the companies.


What may be the consequences of AC frequency variations on powerline network adapters

Question: There has been several reports lately of variations of the main frequency of AC current in European households. What do you think could be the consequences on network signal when using network over powerline (homeplugs)?
Answer: Irrelevant.
Those systems do not care about the 50Hz at all. They work on much higher frequencies.


Distributing work that hasn't been published

Question: I have recently completed a senior/bachelor's thesis as part of my BS degree, and I would like to share my thesis with others. However, I plan on perhaps publishing the work that I did soon, so I have some concerns about whether it is ok to send the thesis to others. Is this a reasonable concern? Is there some way I can protect the document, i.e. by a watermark or something similar?
Answer: In the U.S., for example, you have copyright of your document without doing anything at all.
Also, if you make it public in one way or another, then that literal publication (doesn't have to be in peer-reviewed journals, etc.), gives you priority. In particular, if someone else publishes (one way or another) the same thing, they are plagiarizing you, at least. Unethical professional behavior. Possibly violating copyright, too, depending on how literally they copy you.
Operationally, I think the point is that you should "publish" your work... or, anyway, don't worry about circulating it to "friends", because (in the U.S., anyway) your creation of it is an acknowledged thing... and it's not purposeful to think/worry about people "stealing ideas". Sure, people can do illegal things (stealing all kinds of stuff, how to prevent it?!?!), but the appropriate default is to not worry. Like "don't sit anxiously by your back door waiting for people to break in."


How to configure touchscreen for taking input and displaying output

Question: I am making a control system project for factories where the motors and other appliances are supposed to be controlled via touchscreen. Is there a separate software in which the screen buttons has to be designed for taking input and showing whether on or off?
Comment: My understanding is that if you attach a touch screen then a press on the screen at a certain point is akin to a mouse click on that point.  So if you design your software such that it shows on the screen (say - XWindows) then if you can click on the button or symbol or area with the mouse, that will translate into a touchscreen interaction with your stylus or finger.
Comment: What did you try so far?
Answer: Depends on what touch screen you are using.
For a resistive touch screen, like the ones on Nintendo DS, you will need Anlog to Digital converters.  These can all be obtained at Spark Fun.  The A2Ds will read the analog (changing) voltage of the x axis movement and y axis movement and out put them digitally to the GPIO pins on the Raspberry.  You will read this data via SPI and do what ever it is that you want with the data.  It is quite a project, will take some time and experimenting but it is not difficult.  There may be code online if you google that may get you started with the raspberry.
Sample touch screen projects:
DS Touch Screen
Also you will need an LCD for the touch screen to sit on top of.  There are other LCD screens that come with touch capabilities but you will have to pay attention to how it interfaces (I2C, I2S, SPI etc.)
Raspberry Pi 2 supported interfaces at the top
I've made a project of this before a while back and it was neat but definitely a project.
There's another type of touch screen which is capacitive. Which I have not used but I imagine it would require A2Ds as well.
Comment: Interesting and good answer, but I think the question is about how to make a user interface on a touch screen, rather than how to make a driver to a touch screen.


How to modified an ArrayList for ListView but ListView and ArrayList in different Activity

Question: I will explain my problem
I have 2 class :

MyListViewClassActivity (implements Serializable so it can parse using intent putExtra)
MyOtherClassActivity

Inside MyListViewClassActivityi handling ListView and initial ArrayList called alMyData
And MyListViewClassActivity will intent/called new activity called MyOtherClass, i will putExtra alMyData (i can tell you alMyData parsing correctly with all data inside it)
MyOtherClassActivity will add new data to alMyData.
I will close MyOtherClassActivity so it appear again MyListViewClassActivity. Inside MyListViewClassActivity have onResume that adapter.notifyDataSetChanged.
My Problem :
When onResume inside MyListViewClassActivity the data not increase, i can sure already add new data in MyOtherClassActivity.
Why ? Please give me explanation and solution.
Thank you.
Comment: Dont explain code. Provide a [mcve] instead.
Comment: Show us your code
Answer: I think you don't really understand android and how it works. You should not pass your data list trhough the extra.
Look at MVC pattern, Android is a kind of MVC (not quiet but still thta could help you understand the mechanics).
You should have a model for your data. And then your activitie sworks as controllers.
You can look at RecyclerView too. This a proper way to display list on androdi. And moreover if you use Android Studio (I'm pretty sure you do) you can generate them with efault models and all the stuff you need.
Edit :
What i was proposing is that you use that kind of class
package com.polytech.unice.tobeortohave.compare.dummy;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Helper class for providing sample content for user interfaces created by
 * Android template wizards.
 *

 * TODO: Replace all uses of this class before publishing your app.
 */
public class DummyContent {

/**
 * An array of sample (dummy) items.
 */
public static final List<DummyItem> ITEMS = new ArrayList<>();

/**
 * A map of sample (dummy) items, by ID.
 */
public static final Map<String, DummyItem> ITEM_MAP = new HashMap<>();

private static final int COUNT = 25;

static {
    // Add some sample items.
    for (int i = 1; i <= COUNT; i++) {
        addItem(createDummyItem(i));
    }
}

private static void addItem(DummyItem item) {
    ITEMS.add(item);
    ITEM_MAP.put(item.id, item);
}

private static DummyItem createDummyItem(int position) {
    return new DummyItem(String.valueOf(position), "Item " + position, makeDetails(position));
}

private static String makeDetails(int position) {
    StringBuilder builder = new StringBuilder();
    builder.append("Details about Item: ").append(position);
    for (int i = 0; i < position; i++) {
        builder.append("\nMore details information here.");
    }
    return builder.toString();
}

/**
 * A dummy item representing a piece of content.
 */
public static class DummyItem {
    public final String id;
    public final String content;
    public final String details;

    public DummyItem(String id, String content, String details) {
        this.id = id;
        this.content = content;
        this.details = details;
    }

    @Override
    public String toString() {
        return content;
    }
}
}

That is your model for your RecyclerView or your ListView. Of course you will need a custom Addapter to handle this data format.
But that way you can add or remove data from your list from anywhere in your app.
Comment: Can i pass ArrayList from A activity to B activity without using intent ?
Comment: By the way my ArrayList is ArrayList myList = new ArrayList()<>;
Comment: Yes, technically you can do that but thta means you have to serialize your data to deserialize (even you you use Parcebable instead of Serializable data) you will use more resources than you should.
What I mean is what you want to acheive is not the best way to do things.
Comment: When i use Serializable look like it by value not by reference. Is using Parcealable become by reference ?
Comment: I'm notsure but i don't think so. If I remember correctly the difference is mainly about performances.


Why there isn't provision for writing comment on published articles like social media?

Question: Although there is system for writing comments on an article by proper submission through editorial system. But sometime, we feel need of commenting on article like; the content is very good or content is lacking in certain aspect etc. I think, if there is provision of writing comment directly on the online published copy of article, it would be very useful for both the author and the readers.
Comment: See also: https://academia.stackexchange.com/questions/32367/why-doesnt-arxiv-have-a-comment-section
Comment: Also see https://selectedpapers.net where they explain that their attempt to do this failed.
Comment: Several fields do commonly have commenting facilities.  Most biomed jounrnals and the BioarXiv pre-print service have commenting facilities. There are also several faiclities for adding comments to sites that don't have them. See See PubPeer ( https://pubpeer.com) for example. They (journal run or third party) are rarely used.
Comment: Some Publishers offer these feature, too. See e.g. Copernicus or PLoS.
Answer: This is just opinion but the question seems to call for just opinion, of course. But, my opinion is that when the paper has been published it is too late for general public commentary on it at the place of publication. Researchers have better things to do than fend off trolls for example and much published research will draw the trolls.
The process for getting published, of course, is generally very rigorous with informed comment being fed back to the authors. They get (or should get) the feedback from people who are informed about the field and what has been done previously and what is important.
If a person, genuinely, has an issue with what is published the preferred avenue of response is to publish something better, citing the original.
Most authors can, of course, be contacted privately, either with praise or concern. The author can see it and take it into consideration. This can lead to better future publications benefitting everyone.
However online controversy about published research is less valuable and draws the authors into non productive response.
When something published is egregiously bad, however, comment often occurs in letters to journal editors or even, in extreme cases, in the general press. Sometimes corrections take a long time to occur, such as in the Stanford Study. But I doubt that social media type commentary would improve that situation.
tl:dr; The Trolls will Troll.
Comment: It is ironic that you write this on StackExchange, a site that demonstrates that trolls need not be a big problem.
Comment: I've seen articles on climate change been peer-reviewed and commented on publicly on the publisher's website without any big fails. There is definitely a need for good administration but it's possible.
Comment: I assume that not many publishers want to spend resources on managing such content. Here almost all of the management of improper content is done by volunteers. The moderators are unpaid and are supplemented by other users interested in keeping the space "nice". A publisher wouldn't, in most cases, be happy about comments complaining about what was published. It isn't that we don't have trolls here, it is that we have effective troll control. Mostly just the culture that developed, though it took/takes effort to keep it nice. Thank your local mod today.
Answer: A few observations.

Paper publishing predates social media by centuries.
Leaving a possibility for people on the internet to comment on
anything is like opening a can of worms. You'd instantly need
moderators and user curation and what not. All these people (and
servers) would need to be payed somehow. But most publishers are
greedy bloodsuckers already, don't make it worse.
I think
ResearchGate allows something like this, but restricted and limited.
I have seen no practical use.
If the commentary is proper enough,
it appears as a follow-up paper. "On J. Doe's sepuling of sepulki
and axoim of choice", and such.
Comment: Three cheers on Ijon Tichy!


How can I check how many hours of YouTube I watch daily?

Question: Is there an easy way to visualize my viewing data without manually crawling my YouTube history daily? Further, can these be categorized by uploader, length, etc.?
Answer: I have actually seen about 20 different versions of this question - all slightly different. So, when I saw how many there were, I decided I was going to find a solution...
Unfortunately, after about 9 hours of non-stop reading, writing, inspecting, adding and deleting - I am still unable to find a viable way of bypassing Google (YouTube)'s code implementation.
For all intents and purposes, and for the specific METHOD by which you (and quite a few others) would like to be able to obtain the information, this is not possible.
By saying that, I mean that it will not be practical for someone to do, because of some crazy things that YouTube does to protect the use of this information in such a way (although I have absolutely no idea why they go to such great lengths.
BUT I was able to locate a few things that might be of interest.
If you access the page on the actual YOUTUBE site - under HISTORY - you will be able to see all the videos. You may also change a few things to limit the results to a certain time frame. BUT - the only two ways by which you will be able to ascertain the time (in xx\yy - [xx]=finished portion of the video \ [yy]total run-time of video) is by inspecting the elements of the page (Usually F12).
Now, it's a pretty technical process and if you're trying to use it for that reason, you probably would already be better just going without the information because quite honestly it is not worth it...otherwise for anyone who knows what their doing, and is interested, there actually IS a place in the CSS that you can find the code that is being executed (rather, blocked from being executed) and it is as follows:
< div class="fp-display-item-yt-duration"
Now, when pressing CTRL+F and typing in (some OR all) of that line - you will be able to find the watched\run-time of each video currently on the page.
By absolutely NO means is this convenient. Furthermore, there are a LOT of blocked scripts being denied in the CSS as soon as it is opened...
Again, I have no clue why - but they dont want it being used anymore for some reason...but initially before I discovered this, I thought it might be feasible to implement a bare-bones program to run some real quick HTML [Find] commands  and possibly interlace all the values - and then output them to a type of Excel algorithm which would then give a combined total of both fields...[xx/yy]
I don't think this is NOT possible, because I was able to copy all the CSS as HTML and paste into my own editor, from which I could then apply a variety of rules aside from that of the website CSS - which could come in handy if the right person could process and use the information - because its there and able to be seen, for sure.
If anyone wants to take on that task, Id be more than happy to do what I can - because I feel like its a ridiculous thing to not be able to access and it makes absolutely no sense to me....I dont even want the feature whatsoever, I just want to figure out a way around it! LOL
Hopefully someone gets some use out of this....I tried my best to figure at least SOMETHING out, guys!
Sorry I couldn't get any further tho =\


If an old LUKS header with a compromised key is recovered, can it be used to read data?

Question: From what I understand, even when data is overwritten on disk there is a possibility of it being recovered. From what I also understand, replacing/deleting a LUKS key is fast/trivial and does not lead to all the data being rewritten. This suggests to me that there is an important "secondary key" somewhere in the header, which further suggests that if a key has been compromised and replaced, but an attacker can recover a PREVIOUS state of the LUKS header that used that key, they could still access the data. Am I wrong or is this a security concern?
Answer: The short answer: This is a security concern if you fail to maintain physical control over your media and/or choose poor pass-phrases.
Longer answer:
If an attacker gains access to the hard drive at time A, duplicates it, and compromises the key as it was at time A, then all of the data that was present at time A is compromised (but you knew that part).
To the best of my knowledge there is a 'master key' that each passphrase will give you access to.  Further, there is no way I could find to easily change the master key without creating a whole new partition for the new master key (it would be hard to do even if it were possible).
What this means is that unless you wipe the hard drive and start over between times A and B then the attacker who compromised the key as it was at time A, and who also gains access to the same drive at time B, has access to the data as it is at time B.
Mitigation:
User education and proper response to security threats.  If your user loses control of encrypted media and then regains control of it later, you need them to tell you about it, and you need to wipe the machine and re-encrypt it using a different pass-phrase.
Also, count the information that was on the laptop (at time A) as lost or potentially lost if there is any chance that a sophisticated attacker gained access to it and the pass-phrase isn't quite strong.
Answer: As a very short summary of the parts of the LUKS header that are relevant here (not necessarily intended to be 100% technically accurate):

A LUKS header contains "key slots"
Each key slot contains the "master key" for the container
Each key slot is independently encrypted using a key derived from the passphrase
Each key slot has its own associated passphrase and key derivation function settings

When you create a LUKS container, a random master key is generated. This is the encryption key that is used to actually encrypt the data on the drive. You are also prompted for a passphrase, which is used to derive an encryption key for the first key slot. The key slot encryption key in turn is used to secure the data in the key slot, including the master key.
Until semi-recently, LUKS had no convenient way to change the master key; it was essentially "burned into" the container at the time of creation. This was a problem for example if container creation happened in an entropy-starved situation, such as early during initial system installation. Nowadays (since cryptsetup 1.5), there is cryptsetup-reencrypt which is provided by default in modern distributions, which among other things allow you to change the container master key by re-encrypting all the data in the container.
A LUKS header backup contains all the data that the LUKS header contains. In other words, the master key, protected by (possibly a set of different) passphrase(s). It is equally possible for an attacker to attack the LUKS container through a header backup or a copy of a detached header, as through direct access to the container.
Hence, if an attacker has access to the LUKS header for a container, they can attack the key slots at their leisure. Once they are able to pry open one of the key slots, they have the key that would be used when the header was dumped to decrypt the data in the container. If the header that the attacker has access to was protected with a weak passphrase or with weak PBKDF settings (particularly the iteration count), this may be a problem.
Again hence, unless you reencrypt the container using a different key (you can stay with the same cipher and cipher settings), such an attacker can use the master key they now know about to access the data in the container at some later time.
To mitigate against this threat, it is not sufficient to change the passphrase; you have to reencrypt the container.
Of course, if the attacker was able to duplicate not just the LUKS header but also the contents of the container itself, and the attacker manages to pry one key slot open, then the data is instantly compromised.


Release-Debug Builds for Android Application

Question: In C++ I would normally setup 2 builds - debug and release with each having DEBUG and RELEASE predefined respectively. I would then use these definitions to determine constant values, like logging enabled/disabled, server URL and etc.
Right now, in Java/Android I comment out some stuff before building release. That is not a good way, I can tell. I may forget something.
What is a common practice for ensuring nothing is forgotten when building a release version (signed) or debug version (unsigned)?
Answer: If you are running the application from Eclipse, it will always be a debug.
When you export the application (Android Tools -> Export (un)signed Application Package)
If you want to know dynamically if its release or debug, you can use BuildConfig.DEBUG (Its located in the gen folder, I don't know if this is supported by all the API levels)
Like as followed:
if (BuildConfig.DEBUG) {
    Log.d(TAG, "Text");
}

If you look at the generated bytecodes you will see the following (In debug mode):
public class Sample{

    private static final boolean LOG_ENABLED = true;

    public static void main(String args[]){
        if (BuildConfig.DEBUG){
            System.out.println("Hello World");
        }
    }
}

Produces the following bytecodes:
public class Sample extends java.lang.Object{
    public Sample();
      Code:
       0:   aload_0
       1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
       4:   return

    public static void main(java.lang.String[]);
      Code:
       0:   getstatic   #2; //Field java/lang/System.out:Ljava/io/PrintStream;
       3:   ldc #3; //String Hello World
       5:   invokevirtual   #4; //Method Java/io/PrintStream.println(Ljava/lang/String;)V
       8:   return

}

And if the BuildConfig.DEBUG is false
public class Sample extends java.lang.Object{
    public Sample();
      Code:
       0:   aload_0
       1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
       4:   return

    public static void main(java.lang.String[]);
      Code:
       0:   return
}

Answer: There's no (by default) any preprocessor for Java, so no #ifdef stuff at compile time. But if you do not mind leaving debug code in your app, then you can check if app is release or debug at runtime with this code:
Boolean release = (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE);

which checks debuggable flag value. And said flad is automatically set to false for release builds and true for debug builds.
If you want to get rid of some debug code, you may try using ProGuard to strip certain classes or methods. And by default ProGuard is involved in building process for release builds only.
Comment: I would recommend using BuildConfig.DEBUG because this happens in compile time, your solution works runtime. Therefor the logging code will be inside the package. On compile time, the java compiler won't take the code inside the if-statement into account.
Comment: Please check my updated answer. This will clarify that it's true =)
Comment: You may also want to consider your defining your own global `public static final boolean DEBUG = false;` for greater control over the result... (there have been incidents in which `BuildConfig.DEBUG` was not truly reflecting the state of the system).
Answer: I normally create a separate log class where i set a static DEBUG variable. Now all i need to go before getting a production build is to set that DEBUG variable to false.
public class Log {
     public final static String LOGTAG = "APP NAME";

      public static final boolean DEBUG = true;

      public static void v(String msg) {
        android.util.Log.v(LOGTAG, msg);
      }

      public static void e(String msg) {
        android.util.Log.e(LOGTAG, msg);
      }

      public static void d(String msg) {
          android.util.Log.d(LOGTAG, msg);
      }
}

For logging -
if(Log.DEBUG) Log.v("In some function x. Doing y.");

Comment: I have 6 logging constants in my logging object. I set 2 of them to false when building a release.
Answer: I was facing the same issue as everytime I was running the project as android application it used to open in debugger mode but then the problem was solved.
-If you are working in eclipse you must be using Java EE perspective
-Instead just select Java perspective.
-Clean your app.
-uninstall the app from the device.
-Restart your device (Just like that so that no cache is stored)
-Run your app.
The debugger mode won't show up this time. Copy the apk generated in your bin folder and try it out on other devices as well
Answer: I found a way to decently emulate a preprocessing directive:
In my Gradle buildTypes I define:
release {
    buildConfigField "boolean", "isDebug", "false"
    ...
}

debug {
    buildConfigField "boolean", "isDebug", "true"
    ...
}

Then, in my code, I do as follows:
if (BuildConfig.isDebug) {
    ... do debug stuff ...
}

and if needed, of course:
else {
    ... do release stuff ...
}

Both blocks are present in the debug APK, but when building a release version, Proguard is clever enough to determine that the debug block can be removed as it is dependant of a if (false) (which is also removed from the resulting code).
Should you call some debug-specific classes from the debug block and only from there, they will be stripped out from the resulting APK as they are considered unused, and this also an interesting point: your code cannot be tempered in a way it would use that code.
I could determine all that by checking my dump, mapping and usage Proguard output files.


WKID (Well Known ID) for national projection for ArcGIS REST API

Question: I have to use my national projection system which does not have corresponding WKID listed for ArcGIS REST API.   Without it I am unable to use this projection system for my web application.  Any pointers which can help me out to use my data in its native projection format?  Thanks
Answer: You have not stated what version of ArcGIS Server you are running.
If you are on 9.3.1 your stuck with the WKIDs that REST supports:

Projected
Geographic

The other option (which I have done before) is submit a WKID request to Esri Support.
For me, we sent them the projection file and they created a NIM, and at the next version it was included.  I know other's have not had as much luck as I did though.
I did see some other people implement client-side code or add-ons to try and transform the images after Server has dished it up in a supported WKID - not an easy option.
However, if you are running 10, REST now supports Well Known Text (WKT)

Well-known text is now supported as a
  valid format for specifying coordinate
  systems. Previously, coordinate
  systems could only be specified in the
  REST API through a numerical ID. Now
  you can use a specially formatted text
  string to denote the coordinate
  system, allowing for customized
  properties such as central meridian
  and standard parallels.

Just watch out for long URL lengths with GET requests in your application.
Answer: There are some references for GIS cordinate systems IDs,which has assigned by their creators like EPSG and you can refer to them.And also ArcGIS lets you define your custom spatial coordinate system.did you try to define your custome spatial coordinate system in ArcCatalog or ArcMap?
Comment: That's not what the poster asked, is it. He wants to know how to map a WKID used in AGS REST API to a coordinate system for those systems which are not directly listed/supported.
Answer: Assuming you had ArcGIS Server, couldn't you publish a map service using your custom projection and then view on the REST service endpoint page the spatial reference?
Answer: Each coordinate system is defined by a well-known ID (WKID) or a definition string (WKT, Well Known Text). Before ArcGIS Server 10.0, the ArcGIS Server REST API only supported well-known IDs (not definition strings), but as of ArcGIS Server 10.0 both are supported. For a complete list of supported well-known IDs and their corresponding definition strings, see links below.
Geographic Co-ordinates Systems Listing
Project Co-ordinates Systems Listing
So for mapping, you will have to do it for yourself.
make property file, in which you can have the mapping. with complete, WKT.
and whenever you need to pass CRS to the ESRI API, always pass the WKT, not WKID. Because There are chances, that wkid is not uderstood within ESRI API, but, internally, ESRI API, can understand the WKT.
hope this will help you.
-- Ravindra Shekhawat


Is it safe to use virtual mobile numbers for verification

Question: Is it safe to use virtual mobile numbers for account verification & authentication for services such as PayPal, Twitter, Gmail, Linkekdin, etc.? And what is the security drawback for this?
Answer: The question is whether its a one time use and forget, or is it kept in their database and used for future verification
If you are certainly sure that it is a one time usage, I don't think there is any problem using a virtual number.
If not, you might end up losing control of the account if you are required for that number (two factor auth for example) or in a very rare case someone else who currently has that virtual number can gain control over your account (more science fiction than reality)
Comment: Even if kept in the database, once I use it, it can't be used again in case of 2FA correct. Similar case, when using normal mobile number SMS messages can be intercepted, isn't it?
Answer: its getting tough to use the online numbers for verification. Last time I try with one application, but they are using missed call mobile verification ( some thing like Cognalys)
and the virtual numbers are not showing any call logs. The last five digits from the missed call number was the OTP... :)
Comment: Cognalys are using different method. Anyhow thanks for the info.


Is it a problem to go to sleep just after a big dinner?

Question: Our kid is nearly 3 years old and really enjoy eating. We have dinner together when I come back from work at around 20:00, and he eats a lot. His belly is really full then. Recently he wakes up during the night. I wonder if it is a bad thing to go to sleep with the belly full.
Comment: I'd say it's perfectly natural -- we all get sleepy after a big meal.
Answer: Adults often go to sleep with a full belly.  I am not sure why that would be waking him up? Certain foods can make sleeping more difficult, but assuming you are having healthy meals I don't see this as a problem.
Three year olds often wake up in the middle of the night.
I would evaluate for night tremors.

Is he fully awake when he 'wakes up'?
Does he scream when he wakes up or does he wake up like it is morning?
What does he do/need when he wakes up?
Is he going back to sleep?

Three year olds are just developing the idea of what fear feels like and often that makes them wake up at night.
I wouldn't worry about the food and the full belly, nor really the waking up, I would more deal with the situation until he stops waking up.
Comment: You had a small typo in your formatting; now the numbered list is prettified.
Comment: Thanks Morah. When he wakes up he cries a bit to call us but it doesn't look like he had a nightmare. He is not very awake but nor is he in the morning... He is conscious however. This night he had to go to the pot to do the big thing. He is going back to sleep without problems.
Answer: My children all slept fine after late-night feedings, and so I don't think this is any kind of danger or contributor to his waking up at night.
His schedule of bathroom use might become a little unusual, but kids are resilient.


Personal cover letter for visa application for TV-L 13 PhD Position

Question: I have been offered a Ph.D. position with a TV-L13 (50%) salary. I am in the process of applying for an employment visa (as I am a non-EU citizen). The work contract provided by the university is for a part-time scientific associate. I am unsure of what exactly to write in the personal cover letter (explaining the exact purpose and duration of the stay) for the visa application. Should I write about both the part-time scientific associate position and Ph.D. or only about the part-time scientific associate position?
Comment: To be honest, I'm not sure this is a question for Expatriates. I wonder if you shouldn't try asking this on Academia. They love this kind of stuff.
Comment: While it is on topic here, it might be also be a bit too primarily opinion based. https://academia.stackexchange.com/ might be a better place.
Answer: You should write both of them. You should make it clear that you pursue your education by doing PhD and in addition to that, you are supported by 50 percent tvl13 position. In addition to that you should attach the invitation letter to your docunents.
In the letter they must clearly provide an approximation of your income.  (You need this support to not put extra money in back and ease your way through the  visa process, I'm not sure if 50% suffices).
Comment: Thank you very much for your answer. An income of approximately 1800 euros per month is shown in the document. I hope that would be sufficient to ease my way through the employment visa process?
Comment: I think it is sufficient for one person. I don't know exact numbers though. The only issue is that I guess this 1800 is gross not net. However not much tax, insurance, etc. will be added. Again I don't know exact numbers but e.g. if your gross is 4000 you will recieve around 2500 net (+-200 depending to tax class etc). However if your income is 1200 you will recieve around 1100 net. I think yours should be sufficient if tax and insurance doesn't kill it.


Cut food-low body fat to show more muscular

Question: I have cut food.In 3 days I have seen my abs more visisle but not more stronger.Anyway.If I am working out and eating proper healthy vegetables and fruits,protein(warning 1 meal food). Will my body show more muscular? Does this help grow more muscles?
Answer: Your approach of low food intake and working out is used for toning purposes to cut out extra body fat to make your muscles look more visible.
If you want to grow muscles you will need to do strength based workouts and increase your protein intake by eating protein rich foods to sustain muscle repair and growth and avoid foods high in fat and carbohydrates.
Protein Rich Foods

Chicken
Fish
Lean Beef
Eggs
Beans

Foods to avoid

Pasta (high in carbohydrates)
Sugar (high in carbohydrates)
Breads (high in carbohydrates)
Deep Fried Foods (high in fat)
Fruit Juices (high in sugar) best to stick with the whole fruit instead

Short Answer: Without sufficient protein intake your muscles will not grow no matter how much you are working out.
Comment: I eat 1 meal that include protein.
Comment: You need to increase your food intake. Think of yourself as a plant, for a plant to grow they need water(food) and sun(workout). A plant will not grow if it is only getting water and no sunlight, it will also not grow if it is only getting sunlight and no water. You need both for the plant to grow.


Have you ever turned down work for moral reasons?

Question: I just had to turn down a paying gig and possibly piss off some important people because I had serious moral issues with the film I was set to work on.  Now, I don't want to pass judgement on other peoples decisions in this regard.  It's a very personal sort of thing, but I'm wondering if other people have done anything similar?  How do you do it?  How do you avoid it?  Where are the lines for you?
  For me, the line his hate speech.  I try to avoid but will still do things I find personally disturbing but draw the line at anything that advocates hatred or violence towards a subset of society.
  Working in post, we don't get much control over content and I look at my job as helping people be heard even if I disagree with them, but how can I be proud of the positive work I do without taking responsibility for the negative?
  This is a potentially sensitive subject but I trust everyone here to be respectful of everyones viewpoint.
Answer: That's a situation that, thankfully, I haven't encountered in my work yet, but I think you're justified in turning it down. I'm of the opinion that you you leave a piece of yourself (consciousness, opinions, etc.) in any work you contribute to. There are a number of people who advocate that you should only work on projects you can be excited about, because it draws out your best work. We don't all have that luxury, but I think avoiding work for the reasons you mentioned is a wise decision. Putting yourself in that situation would be additional stress above the usual level, and your work will reflect that. If your work falls short, then the piece suffers...potentially leaving you with an unhappy client anyways. Just my opinion.
I'm hoping this went down before the stage where you would have started working on it, because that WOULD be bring the problem to an even higher level. This is another reason to get as much info as you can about a project before agreeing to contribute.
Comment: Thanks Shaun.  Those are good thoughts.  In this situation I was involved via a 3rd party.  When I deal with clients directly I'm pretty good about vetting, but in this case I was working for someone else and didn't get the script until agreements had been made.  But no, I hadn't started working on it so that's good.
 I Usually find something to get excited about even on projects I'm not in love with.  I think that's a good skill to have.  But you're right, if you can't do that it will be reflected in the work.
Answer: Yes!
It was the right thing to do. I had already said yes, saw the film, then asked to be taken off. It never came back to haunt me. Follow your heart ... always.
Answer: I have actually turned down projects because I found the subject matter particularly upsetting - a documentary on the genocide of kids in Rwanda comes to mind. Not that the material was glorifying the events, but as a recent father at the time, I simply knew that it would be emotionally and mentally too hard on me, so I politely declined and offered another name - and yes the client came back.
Everyone's line will be different of course. And some will belittle you for it, but that's just human nature. At the end of the day, if you can do your job, and be comfy in your own skin, you've done well, no?
Answer: I turned down working on a film because of the director. I just didn't feel right working for the person based on their "activity" before the show was to start.


What is the easiest female human spouse to get?

Question: Ok so I just married Camilla to test a previous question of mine. I got married to her in the temple and requested she moved into the house I bought in whiterun. Well after so I waited twelve in game hours then fast traveled to whiterun. She was not at my house. So I checked riverwood. Not there. I've tried to fix this glitch and it's not working. So I'm reloading my save from before I bought the house. Now who is the easiest female human spouse to get? I'd rather not see the same glitch or otherwise again if at all possible.
Comment: Are you playing on PC or on a console? PC can just console command somebody.
Comment: I'm playing it on Xbox 360
Comment: Also, see this other question about your wife not being at the house as you expected: http://gaming.stackexchange.com/q/37913/108003
Answer: There's a table with all the possible spouses found on the Elder Scrolls Pages article on Marriage. I removed the non-humans from the female list and copied it below:
<code>NPC Name                Race        Location                                Wife's Property         Follower    Merchant    Trainer Conditions for Marriage
Aela the Huntress       Nord        Whiterun (Jorrvaskr)                    Bed (Jorrvaskr)         Yes                     Complete the Companions Questline
Aeri                    Nord        Anga's Mill                             Aeri's House            No                      Work for her by chopping firewood
Anwen                   Redguard    Markarth (Temple of Dibella)            [None]                  No                      Complete The Heart of Dibella
Camilla Valerius        Imperial    Riverwood (Riverwood Trader)            Riverwood Trader        No          General     Complete The Golden Claw
Gilfre                  Imperial    Mixwater Mill                           Gilfre's House          No                      Work for her by chopping firewood
HilundDB                Nord        Thirsk Mead Hall                        Bed (Thirsk Mead Hall)  No                      Complete her favor: Hilund Favor Quest
Iona                    Nord        Riften (Honeyside)                      Bed (Honeyside)         Yes                     Become Thane of the Rift
Jordis the Sword-Maiden Nord        Solitude (Proudspire Manor)             Bed (Proudspire Manor)  Yes                     Become Thane of Haafingar
Lydia                   Nord        Whiterun (Dragonsreach or Breezehome)   Bed (Breezehome)        Yes                     Complete Dragon Rising and purchase Breezehome.
Mjoll the Lioness       Nord        Riften                                  Aerin's House           Yes                     Complete Grimsever's Return
Morwen                  Nord        Skaal Village                           Morwen's House          No                      Complete her favor: Skaal Village Dialogue
Muiri                   Breton      Markarth (The Hag's Cure)               The Hag's Cure          No          Apothecary  Complete Mourning Never Comes (Player must kill Nilsine as well. Must be proprietor of the store to sell Apothecary merchandise.)
Njada Stonearm          Nord        Whiterun (Jorrvaskr)                    [None]                  Yes                     Complete the Companions Questline
Orla                    Nord        Markarth (Temple of Dibella)            [None]                  No                      Complete The Heart of Dibella
Rayya                   Redguard    Falkreath (Jarl's Longhouse)            [None]                  Yes                     Become Thane of Falkreath
Ria                     Imperial    Whiterun (Jorrvaskr)                    [None]                  Yes                     Complete the Companions Questline
Senna                   Breton      Markarth (Temple of Dibella)            [None]                  No                      Complete The Heart of Dibella
Sylgja                  Nord        Shor's Stone                            Sylgja's House          No          Clothing    Complete her favor: Special Delivery
Temba Wide-Arm          Nord        Ivarstead                               [None]                  No          General     Complete her favor: Chop Wood or Grin and Bear It
Uthgerd the Unbroken    Nord        Whiterun (The Bannered Mare)            Uthgerd's House         Yes                     Challenge her to a brawl and win
Viola Giordano          Imperial    Windhelm (Candlehearth Hall)            Viola Giordano's House  No                      Rat out Revyn Sadri during his favor
Ysolda                  Nord        Whiterun (Open Market)                  Ysolda's House          No          General     Bring her one Mammoth Tusk as a favor
</code>
Which one of these is easiest will depend on your character, where you are in the game, what you've done and acquired, and so on.
If you've already done the required quest for someone, like completing the Companions quest line for Aela, then that would probably be easiest.
Assuming you've done no quests, the easiest would probably be Ysolda, if you have a mammoth tusk or know where to get one, or Uthgerd, as you simply have to beat her in a brawl. If you find brawling difficult or too time-consuming, you could lower the difficulty level first. Both of these women are found in Whiterun.
Iona and Mjoll are both in Riften, where the temple is, but both require completing quests.
Comment: If you want to brawl with Uthgerd, you'll probably want to lower the difficulty.  Brawling on Legendary is just bad...
Comment: Never said it is "hard".  I just said it is "bad" as in really, really boring and tedious... :)  At least I find it to be really boring to brawl for 10 minutes.  Plus if you hit another person you just got yourself into a huge mess of trouble.
Comment: @Nelson I find brawling comically easy. I normally don't even get hit.
Comment: It's not an issue of dying.  It's an issue of how much time it takes.  You do almost no damage on Legendary difficulty.  You should try it without the +punch damage gloves... it takes a while...
Comment: @Nelson I may have had additional damage gloves before, that's not normal. You're right it takes a while. Just kite them until it's over. If you don't think that's easy, then of course that wouldn't be the easiest one for you.


Disable sudo permission to user from command line

Question: I have activated root user in ubuntu and want to use ubuntu as server with no DE. For this I want to disable sudo privilege given to first user. How can I do this from command line ? I know I can use a GUI but how to do it from command line ?
Comment: Depending on how you set up your groups, type in visudo
Answer: The user in question has sudo privileges because it is in the admin group.  As wojox commented, you could use visudo and remove sudo privileges from the admin group, but that would remove sudo capabilities from all members of the admin group not just the one user.
Alternatively, you can remove the user from the admin group.  If screen oriented vi is considered command line enough, run vigr and delete the username from the appropriate line.
For a "pure" command line solution, try gpasswd, as it administers /etc/group and can add and delete users from groups.
root@toki:~# id -Gn username
username adm dialout cdrom plugdev lpadmin admin sambashare
                                         # ^- the group to remove
root@toki:~# gpasswd -d username admin
Removing user username from group admin

root@toki:~# id -Gn username
username adm dialout cdrom plugdev lpadmin sambashare
                                        # ^- username not a member
root@toki:~# gpasswd -a username admin
Adding user username to group admin
root@toki:~# id -Gn username
username adm dialout cdrom plugdev lpadmin admin sambashare

Below is my first answer before I realized there was a less dumb way to do it.
If you'd like a more complicated way to do this, you can use usermod.
Here's a quote from the usermod man page:
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
    A list of supplementary groups which the user is also a member of.
    Each group is separated from the next by a comma, with no intervening
    whitespace. The groups are subject to the same restrictions as the
    group given with the -g option.

    If the user is currently a member of a group which is not listed, the
    user will be removed from the group. This behaviour can be changed via
    the -a option, which appends the user to the current supplementary group
    list.

So you have to specify all the groups for the user except for admin.
root@toki:~# id username
uid=1000(username) gid=1000(username) groups=1000(username),4(adm),20(dialout),24(cdrom),46(plugdev),111(lpadmin),119(admin),122(sambashare)

root@toki:~# usermod -G 4,20,24,46,111,122 username

root@toki:~# id username
uid=1000(username) gid=1000(username) groups=1000(username),4(adm),20(dialout),24(cdrom),46(plugdev),111(lpadmin),122(sambashare)

Finally, it violates the spirit of the question, but one could type users-admin from the command line to modify users and groups.
Comment: It looks like the group to remove on Precise is now `sudo` instead
Answer: Whatever wisdom may be found in the above answers, I've solved the issue of enabling the root account and disabling sudo for a specified user as follows.
First enable the root account:
$ sudo passwd root

More information in the Ubuntu Documentation.
Then:

become root
backup and then edit /etc/group
become user again to test the changes

That is:
$ su
# cp /etc/group /etc/group.bak
# nano /etc/group               # find a line like 'sudo:x:27:guest', remove the
                                # user name (i.c. 'guest') and save the file
# exit,
$ [try any sudo command]

The user 'guest' is now removed from the sudoers file. If all went well any sudo command should return a message the like of this:
guest is not in the sudoers file.  This incident will be reported.

A guest logging in on this computer can no longer accidentally or willingly mess with the system, since you need to be root to do so. Of course, if you add a new user, you will need to repeat the editing of /etc/group.
Cheers!
--
linuxrev
(Ubuntu 12.04)
Answer: Warning
Carefull, you can lock yourself out of our system this way! Always make sure, that the root-user retains his rights and you can access it. Keep a root terminal open beforehand so you can undo changes. Test settings in another terminal before closing your root-terminal!
soduers
As described in another answer. Edit /etc/sudoers by invoking visudo in shell:
sudo select-editor # this is optional. it will allow you to select your default editor in shell
sudo visudo

Then change the line that says something similar to this:
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

to this:
# root may gain root privileges
root ALL=(ALL) ALL

Or delete the line, if you're sure, your root user account is enabled.
group
The default user is member of the 'admin' group. If you preferre it, you could just as well revoke the users membership to that group. Do that by following my last link or remove his name from the line admin:x:120:defaultuser in /etc/group file:
cp -n /etc/group /etc/group.bak && \
sed -i 's/\(admin:x.*\)defaultuser\(.*\)/\1\2/g' /etc/group

Comment: @psusi : No, youre WRONG. He CAN delete it. As he said "I have activated root user in ubuntu" meaning, he can ALWAYS LOGIN AS ROOT USER TO GAIN ACCESS. Please correct your downvote of my post.


Why did Wegener write down all of his wife's parents and other relatives' names for Heydrich?

Question: In late season 1 of The Man in the High Castle, Heydrich dresses Wegener in his uniform and pours him wine before asking him to kill Hitler. He then lets him think on the proposal, threatening that his life is already over but by cooperating he could spare his wife's and kids'. He leaves him alone and upon returning is handed a slip of paper by Wegener listing even more names of his wife's relatives. What is the message implied by this?
Answer: Wegener basically realizes that Heydrich is right and that his life is already over because he has committed treason. He thinks that because Heydrich needs Hitler's trust in Wegener in order to fulfill the assassination that he can barter for more then just the lives of his wife and kids, so he hands him the slip of paper with names of more relatives.
This can be backed up by Heydrich responding with "Ten lives in exchange for yours" after he reads the slip of paper.
Comment: Was he asking for Heydrich's word that if he cooperated and assassinated the fuhrer, Heydrich would look out for and assure the safety of his listed extended relatives as well as his wife and children?
Comment: @JosephP. he was essentially just trying to ensure that the lives of his family would be protected by doing this for Heydrich. Basically saying I will do this for you if you don't exile/kill my family for my treason.
Comment: I got all of this, but unfortunately I still don't really understand the nature of the gesture. What did the list of names change? As it already stood, Heydrich had already had Wegener by the cojones by blackmailing him with the lives of his wife and son. But what did the further list of relatives change about the dynamic and leverage balance?
Comment: And what was he proposing by providing it? It would have made more sense to me if he had been doing it to make the point that he was so committed to his principles that he wouldn't budge or cooperate to compromise him even at the expense of every person's life on that list, much less merely those of his wife and children. But this doesn't seem to have been the meaning. By volunteering the additional list what exactly was he gaining, or proposing/hoping to gain?
Comment: @JosephP.  Its basically a last ditch effort to save his family since he is dead anyways.


Tax help with personal allowance used in one month

Question: I'm looking for some tax advice, I have recently finished university and am going into my new job from the start of September and getting paid on the 28th of the month, I haven't worked at all this year so no tax has been run through me whatsoever. When I start I am going to be on a salary of £49,000 per year with a initial bonus of £12,000 which is being paid to me in one lump sum on the 28/09, along with my initial months pay. When I have had a job in the past I have never been taxed in the first month it has always been afterwards, but I have never earned my personal allowance in a single month. So my question is how much will I take home that first month and how will it affect my tax in the following months?
Comment: Tax questions require jurisdiction. Tagging as UK based on context
Answer: In September you will get £12,000 bonus + £4,083 pay, i.e. £16,083.
Assuming that you fill in the right forms to tell your employer that you have had no income so far this tax year, you will get the immediate benefit of the personal allowance from April to September inclusive, i.e. 6 months' worth, or £6,285. So you'll earn that much tax free.
You will also have a basic rate tax band of £19,000, so all the rest of your September pay will fit into that band and you'll pay 20% tax on it, so about £1,960.
In future months this tax year you'll just have the £4,083 pay and will have £1,047 of personal allowance, and will pay basic rate tax of about £607 on the rest as your total salary for the tax year will only be £36,500 which is under the basic rate limit.
In future tax years, your £49,000 salary will just about also fit within basic rate tax so the number will stay similar, if your salary doesn't change.
This is just income tax, you'll also have to pay NI, which is levied per pay period and not annually so there won't be any "carried forward" allowance to take advantage of, and will likely have deductions at least for pension, and possibly the cost of any benefits or the tax on them.


What may cause issues across multiple systems?

Question: I have a 2003 Ford Taurus SES, and I am experiencing issues across multiple systems. I believe that the problem may be with the electrical systems, but fuses, battery, and alternator are all good. It started with the light for my dash gauges going out, but my check engine light, blinkers, oil, etc all still work. Next, it began to read an O2 sensor as bad (but only sometimes). Now, the power steering, oil, and trans fluids aren't flowing properly (the car keeps reading/acting like their low, but they are all full). The headlights/radio just started dimming when driving a little bit ago. I got it about 1y6m ago, and it was doing the same thing then. I kept having to reconnect the negative to the battery, then had a mechanic look at it and it turned out that the wiring had broke about 2in inside the wire itself. This time they said the wire was good. They want to start handling each problem independently, and if it still has problems then check the electrical systems. They also want to charge me for each "attempt to reproduce the issue" as well as "the correcting of that issue", and   even if the source is electrical they are still changing me for parts and labor. I don't have the money for all that, and I can't be without a car for more than 2/3 days. I've talked to 5 local shops, and they all say that they haven't heard of an issue like this.
Comment: Ground wires and grounding points are worth checking. Why don't you want to pay fot this to be fixed?
Comment: You stated your battery is good ... how did you verify this? I've seen what you're describing with a poorly charged battery or one which won't charge. There's enough juice to start the vehicle, but once started, the electronics act wonky because there's not enough voltage to sustain them. I've seen batteries as low as 10 vdc still start an engine. This drives the computers nuts, which displays itself in many crazy things happening through the dash lights and other things.
Comment: I was in this position once, I had an old car with lots of hard to trace intermittent issues and no money to pay anyone to fix them. I had to do my own mechanics and ended up getting into it as a hobby. If you're going to look into your problems I'd suggest you go to a specialist taurus site like taurusclub.com, you may find someone has had similar issues or resources like wiring diagrams or pictures. If you aren't you have to be prepared to spend money, and you may be better off getting a new care rather than throw money at this one.
Answer: New contributor, welcome.
And yes, this stuff can be frustrating. How many miles on the car's odometer?  Was this a salvage title, Florida or Gulf Coast flood car?  Did you personally check the cars Vehicle Identification Number (VIN) repair/title history?
In repairing cars (or solving any problem) you can solve things in a combination of three factors.

Effort
Time
Money

Welcome to life.  We have no clue what's wrong with your car.  Could be anything.
By the way, at first three glances to your description of the issue, that sounds like a really bad ground to sheet metal somewhere in your system.  I'd guess there are probably eight or ten grounds located in your car.  You should really obtain a complete wiring diagram (Chilton/Haynes) or the Electrical Vacuum Troubleshooting Manual (EVTM) from Ford for your vehicle.  Those should show you the colors of all the wires, and all the ground locations in the vehicle.  The EVTM is better if you can find a copy, but it might be more $$.   I will say, this does NOT sound like a systemic issue with 2003 Ford Taurus. It does sound a whole lot like complaints I'd expect from a flood state/ salvage title car.
And many of us here have worked on lots of different cars solving electrical and related troubles.  I know I have.  And without a doubt the most troublesome, time spending repairs leave the strongest memories for us.  I've seen pinouts, cut wires, burnt wires, burnt insulation with wiring intact, and open circuits within a single power distribution copper buss system with riveted connections.  I've seen water on Transistor to Transistor Logic (TTL) 5 volt sensor systems used throughout, and that causes HUGE intermittent troubles in sensors and within connectors.  I've seen overheated parts burn out. And all that stuff hurts. Lots of those failures were intermittent.  I've seen wiring diagrams from the factory with hardshell connectors wired in mirror image.  Ugh.   I've worked on new cars, preproduction cars and used cars.  All of the above.
Me, I spend time to train myself, learn how stuff works, and do careful troubleshooting with a Volt Ohm multimeter.  You are certainly invited to so the same.  Its not really expensive.  You need to understand basic electricity concepts. Learn how to read voltage.  Learn how to read electrical resistance.
The alternative is to pay someone to do that for you.  In troubleshooting electrical systems you can spend hours identifying the source of the problem, and when you figure out exactly what it is, it may be a ten minute fix.  Stuff happens.
Assuming you don't have a flood car with salvage title, any problem you come up with can be fixed. It make take ten hours to find the problem, but don't give up.  And if you don't like that system, you should buy a new car, purchase a repair warranty and move on.  Treat your car well, change oil regularly and it will last a whole long time.
Question for you.  What is your expectation of the life of your 2003 Model Year Taurus?  My guess, is that car, well maintained, should last around 180,000 to 220,000 miles or so (not accounting for corrosion in Rust belt states...)
Answer: First thing I would check when you are experiencing any of these symptoms is the battery voltage.  Check it at the battery terminals and at other places, for example the cigarette lighter socket.  If the voltage is below 13v with the engine running, you may have a bad connection between the battery and the fuse box or between the battery and the body.  A faulty alternator or a bad connection to the alternator can also cause issues like this.
Start by checking simple things like these then report back for further help.