Space efficient storage/compression of multiple scaled values (mip maps)

Question: Because scaling operations are prohibitively expensive in my current rendering stack, I have to pre-render my images in all desired sizes and cache the result on disk. At the moment, I do this by dumping one PNG file per image size. However, this gets fairly large quickly and I'd like to know whether there is a possibility to take advantage of the fact that all these images are basically showing the same content.
Comment: Is there a PNG compression scheme that allows block compression?
Answer:
However, this gets fairly large quickly and I'd like to know whether there is a possibility to take advantage of the fact that all these images are basically showing the same content.

There is. It's called... scaling the largest mipmap to produce the smaller ones. That's essentially what's happening when you generate mipmaps directly: you are "compressing" the lower mipmaps by taking advantage of the fact that all these images are algorithmically built from the largest mipmap. Since you only store the largest mipmap, the other mipmaps take up zero bytes. Then you "decompress" them by scaling them as they are loaded.
The principle cost of CPU scaling is not the computation of the lower-mipmap level itself. It's the memory bandwidth costs of reading from the higher mipmap and writing to the lower one. It doesn't really matter what your algorithm for computing the lower one is; if it requires reading every pixel of the higher mipmap, it's basically going to cost the same thing.
If you've got access to a GPU, you ought to be able to scale it there with rendering operations or even just linearly-interpolated blitting operations.
Comment: @piegames: "*the main cost of scaling is the interpolation*" How did you make that determination? Your CPU either is extremely old (and thus closer to your memory bandwidth) or your code is highly unoptimized, doing things like int-to-float conversions and the like. Box filter scaling ought to be a few shifts and multiplies, nothing remotely like the thousands-of-cycle cost of a cache miss.
Comment: As far as I can tell, the main cost of scaling is the interpolation (note that hardware acceleration sadly is not available to me). If I understand your proposal correctly, it would use nearest interpolation by selecting the correct pixels, which is not okay in my case.
Answer: You could look into wavelet image compression, which effectively stores a mip pyramid "top down" with each level storing only the diffs from the next-smaller level. This would effectively let you reconstruct whichever mip level you wanted from the same file at load time, with the file being the same overall size as only the base mip. However, it is likely more expensive to decompress than PNG for the same reason.
The JPEG2000 format implements a wavelet compression method (as well as quantization and bitstream coding like other JPEG formats). I'm not sure if there are JPEG2000 libraries that support efficiently reconstructing multiple resolutions of the image while loading though.
Comment: PNG is going to be *smaller* than most BC formats, not bigger. The advantage of BC formats is that GPUs can read them directly, without decompression.
Comment: Storing only difference to the next higher level is an interesting idea. Maybe it can somehow be done on a pixel level instead of wavelets? Of course, this wouldn't save any pixels, but maybe they'd then contain less information and thus be better compressed by png?


what causes an action potential to propagate exactly and why should it propagate?

Question: Hello I am taking a neurophysiology course and learned about the action potential and that it propagates in one direction from axon hillock down along the axon.
I understand that action potential is simply the voltage difference caused by influx of Na+ ions causing the inside of the cell relatively more positive
My questions is why/how does action potential propagate? why should it propogate?
If at one site where a sodium channel opens to depolarize, and k+ channel polarize the cell to membrane potential at that site, how does this affect the next neighboring ion channels down the axons to open and close? Why doesn't it just cause an action potential at one section of the membrane and stop? What exactly causes the neighboring ion channels to open continuously as well after the previous one open and closes?
Textbooks just says 'it propagates down the axon' but never mentions why it should and why should the previous ion channel configuration affect the next region of the membrane. I guess this might be a rather dumb question but I hope I did not confuse you, I realize my questions is a bit odd?
Answer: When a sodium (Na) channel is stimulated by a strong-enough stimulus (such as from an electrical stimulus or from an incoming action potential), it will open and let a lot of Na+ ions influx rapidly into the cell at that channel, creating an action potential there. The locally high concentration of Na+ ion inside the cell at that channel will cause Na+ ions there to spread around immediately. This will cause depolarization and openings of the nearby Na channels, resulting in new actions potentials occurring at the nearby channels. This whole process will repeat itself again at these channels, causing more new action potentials to spread out further. In each cycle of an action potential, the potassium channel opens after the sodium channel does about 1 msec. Although the opening of the potassium channel causes repolarization,  it doesn't have any effects on the concentration of Na+ ion and does not stop the spreading out of the Na+ ions. Therefore, an action potential inevitably spreads out and out.

If the axon is stimulated at its trunk, the action potential will spread out both ways, up and down the axon. Figure 3.1 A shows a schematic diagram of an axon and the charge distribution along the membrane of that axon. More positive charges exist on the outside of the axon, and more negative charges on the inside. Now consider the consequences of delivering some stimulus to a point in the middle of the axon, Figure 3.1 B. If the depolarization is sufficiently large, voltage-dependent sodium channels will be opened, and an action potential will be initiated, and the sodium ion (Na+) will influx into the cell.
The influx positive charges Na+ will spread to the adjacent regions of the membrane. As the charges move to the adjacent regions of the membrane, the adjacent regions of the membrane will depolarize. If they depolarize sufficiently, voltage-dependent sodium channels in the adjacent regions of the membrane will be opened and "new" action potentials will be initiated, Figure 3.1 C. This perturbance of charge distribution will then spread to the next regions and initiates other "new" action potentials, Figure 3.1 D to 3.1 F.
[The above text and the figure are adapted from Reference 1]

Now, if the action potential spreads down from the axon hillock (which is located to the left side of the axon and is not shown in the picture) as in Figure 3.12 above, it will spread only one way to the distal end of the axon [inset 2, 3, and 5] because the previously depolarized channels will still be inactive (or in refractory period) for a while after the action potential ends [inset 4].
[The above text and the figure are adapted from Reference 2]
References:

Byrne JH. Chapter 3: Propagation of the Action Potential. Neuroscience Online. The University of Texas Health Science Center at Houston (UTHealth). McGovern Medical School.

Augustine GJ. Chpater 3. Voltage-dependent membrane permeability. In: Purves D, Augustine GJ, David Fitzpatrick D, Hall WC, Lamantia AS, McNamara JO, Williams SM, editors. Neuroscience. 3rd ed. Sunderland, Massachusetts: Sinauer Associates Inc; 2004. ISBN-13: 9780878937257 ISBN-10: 0878937250.


Integrator OpAmp

Question: Tell me how can the 's' in first equation described with the 'integration' in second equation?
Answer: This is a Laplace transform. 1/s is an integrator, is the Laplace transform of an integral.
s is the Laplace transform of a derivative.
$v_1(t)=-R*C*d(v_0(t))/dt ------>V_1(s)=-R*C*s*V_0(s)$
$s$ is dimensional, its dimension is $time^{-1}$. It's basically a complex variable associated with frequency. The Laplace realm is the frequency realm, as opposed to the temporal realm.
Answer: The first equation is the Laplace transform of the second.  This is a subject that's touched on in a differential equations class (usually the second semester of a 2-semester Junior-level college class in the US), and is covered extensively in signal processing course work in Electrical Engineering.

Integrator OpAmp


Integrating $x/(x-2)$ from $0$ to $5$

Question: How would one go about integrating the following?
$$\int_0^5 \frac{x}{x-2} dx$$
It seems like you need to use long division, split it up into two integrals, and the use limits. I'm not quite sure about the limits part.
Comment: It will turn out that the integral does not exist. That may be clearer if you drag the bad point to $0$, by letting $x-2=u$.
Answer: The integrand $\frac{x}{x-2}$ has a vertical asymptote at $x=2$. Therefore
the integral
$$
\begin{equation*}
I=\int_{0}^{5}\frac{x}{x-2}dx=\int_{0}^{2}\frac{x}{x-2}dx+\int_{2}^{5}\frac{x
}{x-2}dx=I_{1}+I_{2}
\end{equation*}
$$
is an improper integral of the second kind. It exists only if both integrals
$I_{1}$ and $I_{2}$ exist. Let's compute the first one using the
substitution $u=x-2,dx=du$, as commented above
$$
\begin{eqnarray*}
I_{1} &=&\int_{0}^{2}\frac{x}{x-2}dx=\int_{-2}^{0}\frac{u+2}{u}
du=\int_{-2}^{0}1du+\int_{-2}^{0}\frac{2}{u}du \\
&=&2+2\int_{-2}^{0}\frac{1}{u}du=2+2\ln \left\vert u\right\vert
_{-2}^{0}=2+2\lim_{\varepsilon \rightarrow 0}\ln \left\vert u\right\vert
_{-2}^{-\varepsilon },\quad \varepsilon >0 \\
&=&2+2\lim_{\varepsilon \rightarrow 0}\ln \left\vert -\varepsilon
\right\vert -2\ln \left\vert -2\right\vert  \\
&=&2-2\ln 2+2\lim_{\varepsilon \rightarrow 0}\ln \varepsilon .
\end{eqnarray*}
$$
Since $\lim_{\varepsilon \rightarrow 0}\ln  \varepsilon
 $ ($\varepsilon>0$) doesn't exist, the integral $\int_{-2}^{0}\frac{2}{u}du$ does
not converge and so does $I_{1}$. Similarly we might conclude that $I_{2}$
does not converge as well.
Answer: Yes, exactly, you do want to use "long division"...
Note, dividing the numerator by the denominator gives you:
$$\int_0^5 {x\over{x-2}} \mathrm{d}x = \int_0^5 \left(1 + \frac 2{x-2}\right) \mathrm{d}x$$
Now simply split the integral into the sum of two integrals:
$$\int_0^5 \left(1 + \frac 2{x-2}\right) \mathrm{d}x \quad= \quad\int_0^5 \,\mathrm{d}x \;\; + \;\; 2\int_0^5 \frac 1{x-2} \,\mathrm{d}x$$
The problem, of course, is what happens with the limits of integration in the second integral: If $u = x-2$ then the limits of integration become $\big|_{-2}^3$, and we will see that the integral does not converge - there is a discontinuity at $u = 0$, and indeed, a vertical asymptote at $x = -2$, hence the limit of the integral - evaluated as $u \to 0$ does not exist, so the integral does not converge. And so the sum of the integrals will not converge.
Answer: Shashwat, the antiderivative of $1/x$ is not $\ln(x)$, but $\ln|x|$.
So in the computation there wouldn't be any natural log of $-2$.
The reason that this integral does not exist, is as stated earlier, the discontinuity issues at $x=2$.
Answer: $\displaystyle \int$$\displaystyle {\frac{{dx}}{{ax + b}}}$ = $\displaystyle {\frac{{1}}{{a}}}$$\displaystyle \int$$\displaystyle {\frac{{dt}}{{t}}}$ = $\displaystyle {\frac{{1}}{{a}}}$ $\ln| t| + C =$ $\displaystyle {\frac{{1}}{{a}}}\ln| ax + b| + C$.
where
$ax + b = t$
Comment: You might also want to add a note about what happens with those limits of integration.
Comment: And the $x$ on the numerator.

Integrating $x/(x-2)$ from $0$ to $5$


Is it possible to add a new citation after a paper is published?

Question: Can I add a new recent citation to my published paper? It will be added to the discussion section, with no change to my original work.
Comment: No. Once a paper it's published, it's published.
Comment: Yes, but publishing such a slightly extended version in a reputable venue will get hard to impossible.
Answer: No.
You cannot change a paper in any way after it is published.
The only thing you can do, is publish an erratum.  But that is intended for serious errors that affect the main conclusions, not for a "I have another related paper".
Note that many people use not only references but also citations to look for related papers.  So if the new citation is your own, newer paper, and cites your old paper, people will find the new paper from the old paper anyway if they use standard scientific databases.


Dragging Camera based on Touch (Unity)

Question: In my game, I want the camera to move based on the user swiping their finger. My issue is that when someone removes their finger from the screen, and places it down again, the camera jumps to a new position... I am guessing it has to do with the coordinates, I say this because if I click somewhere far from where I removed my finger from the screen, the camera jumps. Here is the code:
<code> var speed : int = 1;

 var lastPoint : Vector2; //make this private if you want to.

 function Update()
 {

     var offset : float; //offset of the touch from last frame

     if(Input.touches.Length  0)//make sure we have a touch in the first place
     {

          var evt : Touch = Input.touches[0];   //setting up touch events so we can get fancy.
          if(evt.phase == TouchPhase.Began)    //this is the first frame the screen has been touched for, simply save the point.
          {
               lastPoint == evt.position;
          }
          else if(evt.phase == TouchPhase.Moved
          {
              offset = evt.position.x - lastPoint.x ;//take the difference

              //I'm going to use Transform.Rotate because it's handy dandy

              transform.Rotate(0,offset * speed,0);

              //save the new "lastPoint"

              lastPoint = evt.position;
         }
         else if(evt.phase == TouchPhase.Ended)
         {
             //If you want the object to drift after you spin it you can make a function to go here.
             //To do this, take the speed of the rotation and continue to rotate all while subtracting off of the speed.
             //I would use the Transform.Rotate function on this too.
             //If you need me to I could write this function too.

         }
     }
 }
</code>
What is the solution to have the camera resume, and not jump once someone puts their finger down again?
I am also willing to redo it, if there is a better solution/more efficient method of solving the issue..
Thanks a lot!
Answer: The supplied code seems fine, all you need to do is when the user is not pressing, you update the lastPoint every frame. Or if you know when the user start to press, just set the lastPoint to the current pos before calculating the offset. This way the offset is zero the first frame the user touch the screen.

Dragging Camera based on Touch (Unity)


Is two cars colliding at 25 mph the same as one car colliding into a wall at 50 mph in reference to injuries?

Question: This question has been asked using 50 & 100 mph reference, see this Phys.SE post and links therein. However, I am interested in the potential injuries to occupants of the autos. As the one going into the wall has occupants going 50 miles per hour.  The 2 cars have occupants in each car only going 25 mph at time of crash.  Would the occupants of the 2 cars not have as much damage as the car with the wall as the 2 cars would decelerate based  on the crushing of the cars.  Knowing that the 2 cars would be absorbing the energy more than the 1 into the wall at 50 mph.
Comment: It seems you answered your own question.  Cars absorb energy better than a car + wall.
Answer: Severity of injury is going to be proportional to the rate of change of momentum. Two cars colliding head-on will have a lower value of rate of change of momentum than one car striking a typical wall. Reason: a typical wall will not cushion an impact as well as a typical car.
More cushioning means the actual collision will take place over a longer time span. Time taken is higher and rate of change of velocity lower.
Comment: The sort of walls that cars *typically* collide with in my locale are considerably more cushioning than an oppositely moving vehicle. I've seen several *typical* brick walls demolished by cars with relatively little damage to the car or occupants.
Answer: For each case think about the total kinetic energy and number of cars that are available to absorb all of it during impact and it should be apparent which case has more energy (damage) per car. (crushing, deformation, sounds are evidence of energy conversion, so a tough rigid wall doesn't absorb any)
A more challenging problem to intuition is (A) two cars crashing head on at 25mph each vs (B) one car crashing into a wall at 25mph
Comment: Case (C) one car going 50 mph and hitting a stationary car.


Deep belief networks or Deep Boltzmann Machines?

Question: I'm confused. Is there a difference between Deep belief networks and Deep Boltzmann Machines? If so, what's the difference?
Comment: the wikipedia article on [deep belief networks](http://en.wikipedia.org/wiki/Deep_belief_network) is fairly clear although it would be useful/insightful to have a bigger picture of the etymology/history of the terms. basically a deep belief network is fairly analogous to a deep neural network from the probabilistic pov, and deep boltzmann machines are one algorithm used to implement a deep belief network. apparently all ANNs have probabilistic interpretations/models but they are not as easily/directly obtained as some bayesian/probabilistic-oriented "belief" models.
Answer: Although Deep Belief Networks (DBNs) and Deep Boltzmann Machines (DBMs) diagrammatically look very similar, they are actually qualitatively very different. This is because DBNs are directed and DBMs are undirected. If we wanted to fit them into the broader ML picture we could say DBNs are sigmoid belief networks with many densely connected layers of latent variables and DBMs are markov random fields with many densely connected layers of latent variables.
As such they inherit all the properties of these models. For example, in a DBN computing $P(v|h)$, where $v$ is the visible layer and $h$ are the hidden variables is easy. On the other hand computing $P$ of anything is normally computationally infeasible in a DBM because of the intractable partition function.
That being said there are similarities. For example:

DBNs and the original DBM work both using initialization schemes based on greedy layerwise training of restricted Bolzmann machines (RBMs),
They are both "deep".
They both feature layers of latent variables which are densely connected to the layers above and below, but have no intralayer connections, etc.

References

"Multiview Machine Learning" by Shiliang Sun, Liang Mao, Ziang Dong, Lidan Wu
Comment: How can DBNs be sigmoid belief networks?!! The layers of a DBN are RBMs so each layer is a markov random field!
Comment: I think there's a typo here "This is because DBMs are directed and DBMs are undirected.". I think you meant DBNs are undirected
Comment: @AlexTwain Yes, should have read "DBNs are directed". Even though you might intialize a DBN by first learning a bunch of RBMs, at the end you typically untie the weights and end up with a deep sigmoid belief network (directed). In a lot of the original DBN work people left the top layer undirected and then fined tuned with something like wake-sleep, in which case you have a hybrid.
Comment: Do you mean in 3. that they do not have *intralayer" connections (e.g. between nodes in the hidden layer) rather than *interlayer* (e.g. from the input to the hidden layer)?
Comment: @ddiez Yeah, that is how that should read. Thanks for correction.
Comment: "On the other hand computing P of anything is normally computationally infeasible in a DBM because of the intractable partition function."

I thought [conditional probabilities are tractable in RBMs](https://cedar.buffalo.edu/~srihari/CSE676/20.2-RBM.pdf). What makes them intractable in DBMs?
Answer: Both are probabilistic graphical models consisting of stacked layers of RBMs. The difference is in how these layers are connected.
This link makes it fairly clear: http://jmlr.org/proceedings/papers/v5/salakhutdinov09a/salakhutdinov09a.pdf. Figure 2 and Section 3.1 are particularly relevant.
To summarise:
In a DBN the connections between layers are directed. Therefore, the first two layers form an RBM (an undirected graphical model), then the
subsequent layers form a directed generative model.
In a DBM, the connection between all layers is undirected, thus each pair of layers forms an RBM.
Comment: so a deep boltzmann machine is still constructed from RBMs? I'm basing my conclusion on the introduction and image in the paper


Custom Font Slate Pro in MicroSite

Question: I want to use custom font SlatePro in my Microsite. I have 3 otf files for three different fonts.
How do i achieve this.
Answer: I have noticed that sometimes the custom fonts which are externally linked gets blocked in sfmc cloud pages and microsites. There is a work around to this by Base64encoding the font file into css header or css file.

Basically you will have to Base64Encode the font file and put it in
your css header up top in your microsite.
Here is the link to the site.
For Example:

%%[
SET @customFont = "AAEAAAAQAQAABAAATFRTSFYQNIsAAAWAAAAA6k9TLzKDu5zQAAABiAAAAGBWRE1YarRyOgAABmwAAAXgY21hcAx2xBwAACE...."
]%%

Just below the AMPScript you will then reference your custom font.
For example:

@font-face {
    font-family: 'YourCustomFontName';
    src: url(data:font/opentype;base64,%%=v(@customFont)=%%);
}

Note: Font type needs to be set within the font-family if you're
  Base64Encoding the same font type.
Answer: You should check the license on your font to see if you're even allowed to use it in your page.  While I have Base-64 encoded fonts before, it's much easier the license the font and embed the CDN version of it -- like Google Fonts.
Comment: how do i check the licensing details in an OTF file. and how do i know if am allowed to use a specific font on my page?

Custom Font Slate Pro in MicroSite


Resque workers failing in production

Question: I have a model which contains the following:
  def fetch_austlii
    Resque.enqueue(FetchAustliiJob, self.id) # Queue the job for later.
  end

This dispatches the app/workers/fetch_austlii_job.rb file:
class FetchAustliiJob

  @queue = :fetch_queue

  def self.perform(profile_id)
    @profile = Profile.find(profile_id)
    AustliiResource.fetch(@profile.name).each do |resource|
      @profile.austlii_resources.create!(resource.attributes) if @profile.austlii_resources.find_all_by_url(resource.url).empty?
    end
  end

end

In development (OS X, Ruby 1.9.2, Rails3, Postgres, Redis-server, Foreman) it works fine.  The job retrieves information from the internet just like it should.  However, in production (Ubuntu, Ruby 1.9.2, Passenger) it fails with:
Class
FetchAustliiJob
Arguments
2
Exception
NoMethodError
Error
undefined method `austlii_resources' for #<Profile:0x00000002fab6b0>

Answer: Make sure you're running the workers in the correct environment (production vs development) on the server.
If you haven't already tried, you may want to create a config/setup_load_paths.rb to load the RVM environment (source: RVM Passenger docs):
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
  begin
    rvm_path     = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
    rvm_lib_path = File.join(rvm_path, 'lib')
    $LOAD_PATH.unshift rvm_lib_path
    require 'rvm'
    RVM.use_from_path! File.dirname(File.dirname(__FILE__))
  rescue LoadError
    # RVM is unavailable at this point.
    raise "RVM ruby lib is currently unavailable."
  end
end

ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'

Comment: The production server has the environment variable RAILS_ENV set to "production".  I have tried switching this to "development", but it errors in the same fashion.  I am suspecting Passenger is not picking up the project specific RVM gems, although I cannot be sure.
Comment: I've edited my answer with a potential solution to the Passenger/RVM problem.

Resque workers failing in production


How to list a Parachain on Rococo using CoreTime

Question: As we know previously, securing a parachain slot was a competitive process through an auction mechanism. With coretime rental, there is no need for slot auctions anymore. Teams can purchase instantaneous coretime or reserve bulk coretime as required. This greatly decreases the barrier-to-entry for software tinkerers and parachain teams.
I want to list my parachain on Rococo. The official document still shows old way of registering parathread.
Is there any tutorial/example which shows how to use CoreTime?
Thanks
Answer: There is an answer in Polkadot forum here


How to get summary report in sharepoint custom list form

Question: IS there any way to get summary of all responses from Custom list form. I have created the custom list form and received all the responses from people. Now I want to get the summary (like Graphical summary).
Answer: In SharePoint 2010 you can try Out of the Box Gantt view for a list. Please see the description below:
**Gantt View
View list items in a Gantt chart to see a graphical representation of how a team's tasks relate over time**

Comment: Where is it. i didnt find it anywhere in sharepoint 2013
Comment: Create view and you will find the type of views to be created
Answer: Try to use Chart web part to show data summary from List as Graphical summary :
For SharePoint 2010

Begin by either creating a page or by opening an existing page for editing.
On the ribbon, click the Insert tab, and then in the Web Parts group, click Web Parts.
In the Categories section, click Business Data.
In the Web Parts section, click Chart Web Part, and then click Add.
Locate the Chart Web Part that you want to edit, and then click the Data & Appearance hypertext.
In the Connect to Data Source page, select the data source that you want to use, and then click Next.
In the Retrieve and Filter Data page, preview the data that will be used for the Chart Web Part.
In the Data Connection & Chart Appearance Wizards page, click Connect Chart to Data to open the Data Connection Wizard.
In the Choose a Data Source page, select a data source type, and then click Next.
After you have finished previewing and filtering the data, click Next.
To optionally specify how you want the data to be displayed, use the Bind Chart to Data page.
Do this by specifying one column for the Y Field, and another column for the X Field.
Click Finish to view the chart in its page.

For more details check Create a chart by using the Chart Web Part
For SharePoint online
This tool allows you to create Google chart using client object model. See also similar thread SharePoint 2013 (Office 365) - How do I chart a list?
For SharePoint 2013
Try this link to can use Chart web part at SharePoint 2013
Comment: Am not getting that Chart web part option in my sahrepoint 2013
Comment: it has been removed in SharePoint 2013 ,  I read the previous answer and I think you are working with 2010 , no problem there's a method to export it to 2013, Please check the updated answer.
Comment: It say's export webpart from 2010 sharepoint. i do not have 2010 version in my system. Please help me with any alternative option
Comment: can you work with google chart via  CSOM ?
Comment: Am not aware of this function. Is there any way to add "Chart web part" only in sharepoint 2013
Comment: let me try to export one from SP 2010 and send it to you


How to keep my old number in WhatsApp having the old SIM deactivated?

Question: I have a new phone number and a new phone, but I want to keep my old number to use in WhatsApp but I don't have that SIM card anymore.
Answer: If you had a deactivated SIM card on the phone, my guess is that you should still be able to use your WhatsApp through WiFi. But if you have taken out the SIM, it is not more possible as the new SIM will require an SMS-based validation. Better to port your number and then you can use it on WhatsApp.


Bayesian Information Criterion -- what is the base of the logarithm?

Question: Apologies in advance for a very basic question! On Wikipedia, I see that the Bayesian Information Criterion evaluates a model using
$$
BIC = k\ln(n)- 2\ln(L)
$$
where $k$ is the number of parameters, $n$ the sample size and $L$ the (maximised) likelihood. In the original paper, however, I see instead the expression
$$
BIC = k\log(n)- 2\log(L)
$$
Can I check that 'log' here means 'ln' (i.e. base $e$ not say base $10$)? Or does it somehow not matter?
Comment: It is from an exponential distribution family, so I believe it is log base-e.  There are only 2 others in common use: base 10 by engineers, and base 2 by computer scientists.
Answer: It is a natural logarithm (log base of e). But, no matter what the log is, the most important thing you need to remember is to compare models under a consistent kind of logarithm.
Comment: "the most important thing you need to remember is to compare models under a consistent kind of logarithm". Should I take this to mean that I can use a different base provided that the base I use is the same for all models?
Comment: Yes, that is what I want to say.


Why are my tomato seedlings dying after applying ammonium sulfate?

Question: Why are my tomato seedlings dying? They just germinated then after a week some are dying? I added compost and a little bit of ammonium sulphate in each plastic bags. They are not yet transplanted. I want to know why because I do not see any pest.
Comment: What was the reason for applying ammonium sulphate?
Comment: How much did you add?
Answer: Not sure what you mean by 'plastic bags', does that mean that's how you've germinated your seeds? Otherwise, a photo would be helpful, but adding ammonium sulphate to seedlings is not a good idea - the nitrogen will be too high for them at this stage (assuming they've just germinated or only have 2 pairs of leaves), plus it contains even more sulfur than it does nitrogen, and sulfur is usually applied to alkaline soils. Whilst tomatoes prefer a neutral to slightly acid soil ph,  the sulfur wouldn't be helpful, especially at the seedling stage. Equally the 'compost' you mention - not sure what that means, garden compost you've made yourself perhaps? If you do mean that, it was too soon to add it; it should only be added once the seedlings become plants in pots of their own, and only then if it was produced using a hot aerobic composting system.


Merging multiple feature datasets while maintaining shapefiles for respective point, line and polygon files nested using ArcMap

Question: I've been doing some digging and a few days of playing around with my data in ArcMap (Advanced level license) but I haven't been able to find a solution to merging datasets, which consist of many different point, line and polygon shapefiles.
The files are electronic navigation charts in a vector format (some examples of these are freely available: http://www.charts.noaa.gov/ENCs/ENCs.shtml). Each of these charts covers a different spatial extent or resolution and contains information relevant to mariners, fishermen etc. (e.g., depth, substrate type, buoys, lights, shipwrecks, obstructions, and so on). There is a standard for the display of these data called S-57 in which each feature is universally coded (e.g., obstructions are OBSTRN in each ENC file: http://www.s-57.com/). The coding of the attributes of each feature is also standardized. Therefore, each file you open in ArcMap will have identically named point, line and polygon layers for the features on the chart (although some charts may have features not found on other charts [e.g., some areas might not contain shipwrecks]). I am wanting to merge many of these ENC files, which cover portions of my region of interest, into a large regional layer. My hope is to use the respective shapefiles (and attributes) for this whole region rather than for the smaller areas the charts cover individually. The merge has to maintain all the respective point, line, and polygon shapefiles (e.g., depth, substrate type, buoys, lights, shipwrecks, obstructions) (i.e., it is basically a merge of all identically named shapefiles nested within each chart).
I know the merge can be done between two respective shapefiles from 2 different ENC chart datasets (after a name change of one of them), however, I have potentially 20-30 charts to merge and there are 20+ shapefiles in each chart file.
I attached a screenshot of the ENC file in ArcMap 10.0. Each chart file has these identical layers covering a different spatial extent I wish to merge.
Answer: You can download the shapefiles then create a Geodatabase and a new feature class of the desired coordinate system with the same field mapping as the source data. (You can import fields from the source shapefile during the process)
Once created, right click on the feature class --> Load Data
This way you can load many source shapefiles into one destination feature class on one shot.


./configure no such file or directory even after installing build essentials

Question: I'm trying to install Java SE 7 on my ubuntu 13.04.
I have already downloaded tar.gz file and extracted.
But when I wrote in terminal:
./configure

I saw this message
bash: ./configure: No such file or directory

I see it even after installing build essentials package.
Any idea?
Comment: Welcome to Ask Ubuntu! Java SE is a binary package, so it should be installed in [the other way](http://askubuntu.com/a/88058/171636) than source packages.
Answer: You only run the ./configure command when building certain applications from source.
The Java installation files that you have downloaded aren't source code they are precompiled binaries. For instructions on how to install Java take a look at the page on the Ubuntu Wiki as this has several different options.
I recomend using the option titled 'Using webupd8.org's strikingly simple method.' as it will integrate the installation of Java with your package manaement system and automatically keep it up to date along with the rerst of your system.
Answer: Preamble
The reason why you are getting the "bash: ./configure: No such file or directory" is because you are not in the right directory where the downloaded file you are about to install is located.
To fix that
(a.) FOLLOWING README INSTRUCTION

Locate where your downloaded Java tar.gz file.
Extract the file by right-clicking on it and select 'Extract Here'.
Look for the 'Readme text' file and open it.
Follow the instruction on how to install the file in the Readme text(installation of tar.gz file can be different from normal commands used to do installation of files in Ubuntu).

(b.) USING GENERAL COMMANDS

Open the terminal by pressing  CTRL + ALT +T.
Type  tar -zxvf .tar.gz .
Type  sudo su  and enter your root password.
type  cd and add the path of your downloaded file . If you do not know the path of the downloaded file type  ls -a  to list all the directories and locate your file directory.
Type  ./configure  and press ENTER key
Type  make  and press ENTER key.
Type  make install  and press ENTER key.

(c) USING THE UBUNTU SOFTWARE CENTER

Open Ubuntu Software Center
Type java in the search
Look for Java SE 7 and click 'install' to install it.
Answer: I also had this problem.  The short answer is you have to type ./configure --prefix=/your/chosen/directory when inside the unpacked .tar.gz file directory.  That is where the configure file is.
Answer: This happened with me while installing samba domain controller and You may downloaded the package like me as below: (The commands are related to samba installation!!)
git clone -b v4-5-stable git://git.samba.org/samba.git

and you are in folder say (ex: folder1) and when you type
(ex: ./configure --enable-debug --enable-selftest)
it bring up an error

bash: ./configure: No such file or directory

So here I had to go inside the samba folder in the folder1
/home/ubuntu/folder1/samba#
I know it is very late answer but this may help :)


Ubuntu-Server Upgraded to Ubuntu desktop, How do I change it back?

Question: I decided to upgrade my home server to Ubuntu 11.10 from 10.04. Instead of upgrading to the server version, it upgraded to the desktop version, or something similar to it. I assume this is because I had GNOME installed to manage certain features through VNC (Linux noob here). So how do I get it to stop booting to the desktop and get rid of all the additional GUI stuff it installed with the upgrade?
Comment: Do you just want to get back to gnome?   sudo apt-get install gnome-shell
Comment: I believe that is what I had in the first place, but the update added more (like Unity). Will running that again get rid of the other desktop stuff and let my server boot into CmdLine again?
Answer: not sure about the newest version, but "apt-get remove ubuntu-desktop --purge" was how I did it the last time I messed up.
Comment: It tells me that Ubuntu-desktop is not installed. I noticed that it was updating x11 when it was updating to 11.10 (Which I know has to do with GUIs). Can I safely remove x11?
Comment: Removing just x11 might cause a few things to break (lots of errors), but the system should still boot to a console login. I would make sure that GDM is removed/disabled first, but that's personal preference. (GDM == gnome desktop manager, the graphical login system)
Answer: remove all desktop environments you may have installed, by using "apt-get remove" command. However, thats not the only thing you will have to consider.
A server system has a different set of configuration or way of doing things. For instance, a server almost always requires a higher usage of swap-memory as overall performance is more important. On the other hand, relatively less swap memory is needed by a desktop system where quick response-time is more appreciated by the user. You can check the "swappiness" setting of your Linux kernel by issuing the below command in the terminal:
sysctl vm.swappiness


Am I a resident or a non resident for tax purposes this year?

Question: I am on H1 B visa since Oct 1, 2017. Last year, I was on F1 OPT. I am filing a Married filing jointly with my wife (is on H4 without any income). I am planning to fill in Form 4868 for extension and pay the necessary amt. After I meet the substantial presence test, say by May end, I will file form 1040 as Resident Alien. Is this the right thing to do? Or should I file taxes as a Non resident like I did last year? If I have both the options, which is the best?
Comment: Changing your status in 2018 does not affect your status for filing 2017 taxes. I am unclear why you think waiting till May will change anything.
Comment: Thanks..But, First Year choice is different from Dual Status Alien right? Why would I have to file both 1040 and 1040 NR?
Comment: Waiting until May will give me time to meet the Substantial presence test. Do you think that is the right thing to do?
Answer: In summary, yes, filing as a resident alien and married filing jointly often is the right and the sensible thing to do, and will likely minimize your tax liability. As usual with taxes, it is the best to calculate your liability using different methods, and pick the best.
Going in more details, tax residency status in this situation works in stages.

Since you arrived on October 1st, you do not meet substantial presence test as of the end of 2017. Thus, without making any elections, you would file as a non-resident alien.
Once you meet substantial presence test, which should happen in May 2018, your tax residency automatically propagates back in time to the beginning of 2018, but not into 2017. Thus, you still remain a non-resident alien for the entirety of 2017.
Once you have actually become a resident alien, you can make an election, referred to as the first year choice, to further propagate you residency back in time to the date of your arrival. That would make you a dual-status resident alien - non-resident alien before October 1, and resident alien after October 1. Your spouse is eligible for the same choice.
There is another election which is only available to married people under 26 USC paragraph 6013(h). Since both you and your spouse were non-resident aliens at the beginning of 2017, and resident aliens at the end of 2017 (due to both of you making the first year choice), you can elect to be treated as resident aliens for the entirety of 2017.

While everyone's situation is unique, and, like with many other things related to finances and taxes, there is no "one size fits all" answer, under a wide range of circumstances, electing to be treated as a resident alien in 2017 has numerous advantages:

Non-resident aliens and dual-status aliens are not eligible to use the standard deduction. They are thus forced to itemize their deductions.
The list of itemized deductions available to them is greatly limited. About the only thing they can deduct is state taxes. Chances are your state income tax was not very big, since you only worked 3 months in 2017. Claiming tax residency for the entirety of 2017 is thus a huge advantage.
Only resident aliens are eligible to file as married filing jointly. That often reduces tax liability - especially in situations where only one of the two spouses has income, so this turns into another substantial tax break.

There are, however, few things to keep in mind:

As a resident alien, you and your spouse would need to report your worldwide income. There is foreign earned income exclusion and foreign tax credit options available, due to which your tax liability will likely not increase much.
In case your spouse does not have SSN, you would need to apply for ITIN. This means you cannot e-file. Processing time will be longer than normal, too.
Don't forget about your state taxes, both extension, and filing as a partial-year resident of your state. Note that state tax law may not have a concept of tax residency comparable to the federal law, so this would need to be treated accordingly.
Comment: Does the above all hold true given the F1 OPT status prior to the H1 B status?
Comment: I only have experience with H1B, not with F1. But quick search reveals that the days in F1 status are not counted towards the substantial presence test, so being in F1 status prior to H1B should not change anything. Someone more familiar with F1-to-H1B transition may want to elaborate on this.
Comment: Thank you for the elaborate explanation. So, I am on H1B since October 1 2017 I have been in the U.S since August 2013 (on F1). Being a student on F1, I am not allowed to consider 5 years from my arrival while counting days for the Substantial Presence test (exempt individual). Number of days present in the U.S: 2013: 159, 2014: 347, 2015: 365, 2016: 332, 2017: 365. Thus, no of days presence in U.S on HB in 2017 is 90days. How should I calculate residency?
Comment: @Josh 0.5 * (2017 days in H1B) + (2018 days) = 45 + (2018 days). You should become tax resident on or around May 19th, 2018.
Comment: Ok.Thanks a lot. One more follow up question. So, while calculating my estimated tax (for filing Form 4868) which form should I use to figure the amount, Form 1040 or Form 1040 NR? I read somewhere on the IRS website that I should be using Form 1040 NR, but I am not able to locate that info now. Thanks
Comment: @Josh 1040 NR, because you are not a resident yet. You can only use what you are eligible for at the moment. Can't rely on becoming a resident in the future.


Are Fe56 or Ni56 the fission products of any binary reactions?

Question: I'm curious as to if there is some combination of a fusion and fission event simultaneously occuring that would only produce 56 nucleon number nuclides. Such that the net energy out of the fusion reaction is equal to the activation energy of the fission one.
Answer: In theory this could happen provided the correct conditions would hold. But in reality fission will yield fragments most probably having 2/5 and 3/5 of the mass of the original fragment, and some 2 or 3 neutrons will take part of the kinetic energy. So that already imposes that the medium needs to be in some heated state so that nuclei have the required kinetic energy that would allow them to interact with the fission 56-nucleon product to yield back the original heavy nuclei,  but missing 2 or 3 neutrons now, which would make it beta-unstable. You can also see that for 235U, for example, already the probability of yielding a 65-nucleon fragment is rater small, since the more probable 2/5 fragment would have around 90 nucleons, which 30 nucleons more, so a fragment of 65-nucleons although possible, is rather less probable.


Can a wireless signal of sufficiently high energy damage a wireless transceiver?

Question: A wi-fi router works at 2.4GHz. Can a wireless signal of 2.4 GHz or any other frequency, of sufficiently high energy, damage the device?
Answer: Yes, but it's unlikely. Damage from other frequencies will be limited because typical receivers have a pre-select filter after the antenna to filter out other frequencies. In band signals pass through a Low Noise Amplifier (LNA) directly after the antenna, which can saturate if the signal level is high, and fail if the signal level exceeds its maximum input power spec. The most common approach is to put a limiter in front of the LNA to handle any signals that may damage the LNA. However this degrades the Noise Figure of the receiver by the limiter's insertion loss. Another way to prevent overloading is to detect the input power using a power detector and routing it past the sensitive electronics if it exceeds some threshold.
Short answer: yes, any signal can damage the device if sufficiently high energy. However, wifi routers are not usually operating in environments where high power survivability is desired - the focus is more on range and sensitivity. Other sensors such as military radars are designed with robust power survivability specs to deal with jammers, self-reflections, and other electronic countermeasures.
Answer: of course.  Ronald Reagan's "Star Wars" missile defense is designed to damage the electronic navigation systems on board these missiles.  The electromagnetic pulse from a nuclear explosion will certainly deliver enough energy to damage much of the electronic devices within its radius. Satellites, which are transceivers, can be damaged by solar flares and coronal mass ejections.


How to run only failed nunit tests in teamcity build

Question: I have many tests in selenium that took almost 6 hours to complete. After the execution, few of them failed due to time-out error or unavoidable errors. I want to run only failed tests in that case. I am using teamcity to run the nunit tests. Any idea how can I rerun only failed tests.
Answer: There's an option to run failed tests first as part of TeamCity's nUnit integration - but you cannot limit it to only failing tests, nothing like this is built in.
You have a couple options here in my opinion:

Use a Selenium grid / other infrastructure to run your Selenium tests in parallel to reduce your test run time. This seems to be the root of your problem: Currently the time to do a full test run is prohibitive. If you can run your Selenium tests fast, you wouldn't need to run them selectively. Generally using the built in nUnit runner is a bad choice long term because it doesn't allow for parallelism.
Based on the failures you are seeing determine the nUnit test fixtures and do a custom nUnit run where you just pass in those test fixtures to rerun - again there is no integration for this and you would have to use the command line nUnit runner.
Comment: nUnit runner 3 now supports running in parallel
Answer: There are a few options depending on the testing framework you are using so you can make teamcity launch tests on more flexible criteria by using command line options.
We used this workaround in our instable test environment.
With NUnit it is possible to use the filtered outputfile (according to failed test) as the given testlist for the next run. There are various ways to fetch and set the list and you can find details here:
https://github.com/nunit/docs/wiki/Console-Command-Line
There are two quick options:

you save/add the list with failed tests in a file (with use of powershell script)
read the last test-result file and use the where clause to get the failed tests

With each run the list with tests should shrink.
Be aware:

builds are not easy comparable (teamcity estimates the execution time or if you have failure conditions based on metric changes)
(new) errors in other tests will stay undetected until you launch all tests again


Can I change number of people at risk during study in survival analysis?

Question: I need to estimate the survival function using Kaplan-Meier method. I am considering the duration of 60 days. In the beginning (Day 1), lets say there are some 400 individuals. My question is: 'after my study has started, can I add more people into the study on day 20th. Does KM method allow this? Will my survival probabilities will be still correct after adding new subjects?
Answer: If you check the clinical trials, especially for cancer treatment, survival function is one of the objectives. In the clinical trials, it is nearly impossible to recruit enough patients at the short time. So the patients entered the study at the different time and each individual's survival time is used to estimate the survival function using K-M estimate. For each patient, the day 1 is defined as the day entering the study. But the assumption behind this is the survival probability at day $n$ are the same for the patents received the same treatment regardless when the patients entered study.
So if your situation meets this assumption, you can add more subjects into study after the study begins.
Comment: A cohort consists of individuals. Think in this way: one individual entered the study in 5/23/2017. Today (6/12/2017) another individual comes in. Suppose these two have the same characteristics. If you have reasons to believe that the chance of the event for the new one is different in today from that for old one on 5/23/2017 duo to the environment, treatment techniques, etc. then the assumption is invalid. Otherwise, you can add new individuals.
Comment: this is a cohort study,  and not individuals' study. If patients enter on ith day; the probability will change compare to the probability no body additional enter the study after study has already began. So the assumption will still be correct?


Sealing gap between brick wall and vinyl siding

Question: I need to seal the gaps between my garage brick wall and the vinyl siding. Would product such as "Great Stuff Gaps & Cracks Insulating Foam Sealant" for example would do the work? or I need something else?
Comment: Why isn't there a J-channel there?
Answer: As you've seen, caulking to vinyl is bad practice in general. Vinyl expands too much with temperature, and it's not really intended to be the drain mechanism anyway. That should be handled by house wrap behind the siding and appropriate flashing. Spray foam is never an exterior solution and wouldn't work well here with all that movement anyway.

Remove the siding on that wall and scrape the bulk of the caulk off the brick.
Install metal L-flashing to the brick. Caulk between the metal and the brick as you install. The caulk should be hidden for the most part. For best appearance the protruding flange should be hemmed.
Install rubber flashing tape over the metal on the wall. This seals the metal to the house wrap I hope is present, and it also seals the nail penetrations from the next step.
Install standard J-channel against the brick.
Reinstall the siding.

<code> PLAN (TOP) VIEW
                 ____________ <-- metal flashing
 |             ||  ~~~~~~~~~~~~~~~~ <-- rubber flashing tape
 |             |||‾‾‾‾‾‾‾ <-- J-channel
 |   brick     |||___
 |_____________|^-- caulk behind flashing
</code>
Answer: The product normally used in this instance is polyurethane caulk.
Use gloves, because this stuff is sticky and cannot be washed off with soap and water.  Mineral spirits is needed to clean any mess, but it is paintable and flexible and stays that way in a wide range of temperatures.
Clean out any dirt and old caulking that is loose before applying and you will be good for years.
Comment: Caulking to vinyl is just a bad idea. That's not how either product should be used.
Comment: And, to reiterate, expanding foam is _not_ the correct answer (unless there's a large gap and it's used to back fill - but in that case "backer rod" would be a better option behind the caulk).


What's the difference between "Taste" and "Taster"?

Question: Reading some user manuals in German, I sometimes encounter the word Taste and sometimes Taster. Is there any difference to a native German speaker?
Comment: A google search for image *Taster* provides are surprisingly detailed idea, what *Taster* means. I guess, the number of cases where *Taste* could also be considered is very small.
Answer: There actually is a difference:
Taste can be used for more or less anything that is operated by a finger press, e.g

Piano key
(mechanical) typewriter key
key connected to a momentary electrical switch (on a computer keyboard, for example)

while Taster works for the momentary electrical switch only and is typically used for single switches (while the switches inside your computer keyboard might be single "Taster" in an electrical sense, the keys are referred to as "Tasten" in their mechanical sense).
So even if the two words are very similar, Taste would normally translate to "key" in English, while Taster typically translates to "(momentary) switch"
Those were the translations in terms of day-to-day usage. Translations for Taster can differ on whether the word is used as a technical term in mechanical or electrical context - Taster is also often used in mechanical engineering for instruments that "feel" a specific measure - Innentaster is the German technical term for "inside caliper".
Comment: According to me, they aren't  ;) - I have never heard of "Klaviertaster" - But there is lots of "Klaviertasten" on a Piano.
Comment: "Taster" in the electrical context is likely an abbreviation of "Tastschalter".
Comment: According to Wikipedia, they ARE the same: https://de.wikipedia.org/wiki/Taste
Comment: I think, "pressed by a finger" is the most important difference. See also the meanings in Duden: http://www.duden.de/rechtschreibung/Taster and http://www.duden.de/rechtschreibung/Taste
Comment: So, according to the written answer I conclude that in terms of electrical devices "Taster" is an electric device which connects wires and "Taste" is a cap on a top of this device visible and touchable by an end user (an "user interface" for Taster). But this cap could be not only on a top of an electric switch, but also on a top of mechanical lever etc. Right?
Comment: @Paul That kind of sums it up for electrical or electronic devices. The usage of "Taster" in mechanical engineering is different, however.


Does running serves as warm up for mild upper body gym workouts?

Question: Suppose a person wants to carry on gym work outs for an hour and the exercises he do in gym are only for upper body(hands and chest). Can running for 15 minutes will serves as a warm up for gym routine?
Comment: This is a very vague question. A mild gym workout is or contains a warm-up in itself depending on the intensity of your workout. Also, whether running serves any purpose depends entirely on how you go about doing it. How long, for instance. And you post no information about any of this.
Answer: this is a warm up, but it is not a warm up for the specific muscle groups you are trying to train. always do a good stretch of the muscles you will be training to avoid injury. especially if you are going to do a hard heavy session.
Answer: What running will do is increase your heart rate and blood flow which is good but it won't prepare the specific muscles your about to work on.
What I would advice is to do some dynamic stretching before working out any muscle group. You can also start the first exercise with 2 or 3 warmup sets. Let's say you're going to benchpress, first do 2 sets with about 50%-60% of the weight you'll be working with.
You can obviously combine all this with running for 15 minutes if you want to incorporate this in your warmup.


Can you automatically generate an acronym list as a table in Microsoft Word?

Question: What is the easiest way to create an acronyms list as a table that may be automatically generated, such as a table of contents?  I'm assuming acronyms are 3 letters or greater.
Answer: Are you after

a glossary: alphabetically sorted list of acronyms with respective explanations, or
an index: alphabetically sorted list of terms which may be acronyms or not, which also includes the page number where the term is introduced/explained?

You can create an index which can be then updated like ToC. To do so you need (assuming Word 2010):

Mark items/terms which are to be included in the index:

highlight the term in text
move to the Reference tab of the ribbon
click Mark Entry in the index section
alter the entry if you need to (e.g. you highlighted Stack Exchange but you want the index entry to say Stack Exchange (SE) - you can do that in the Main entry text box)
do the above for all terms you want to include

Insert the index where appropriate:

when ready click Insert index (Reference tab of the ribbon again) while being in the appropriate place in the document
you can later Update index after marking more terms

Hope this helps.
Comment: Word 2010 or later. It works for modern 365 Word.
Answer: From your question, I believe there could be 2 possible scenarios:

Document is scanned for suitable abbreviations (e.g. all CAP, min 3 letters), then generate a table listing them. You could then manually add their definitions in one turn.
Define each abbreviation along the way as you use them in the document, then let Word auto generate the table, listing them with their defined meaning.

Scenario 1: I don't really know any reliable method. There are all kinds of abbreviation, short/long, capitalized/not capitalized, with/without dot, etc. My point is, I don't trust that, any algorithm can detect all those forms.
So no idea here, but if you decide to go with…
Scenario 2: Index table
Originally, index table is used to list out keywords, to keep track where they appear in the document, and not for abbreviations, so there are supposed to be disadvantages here – more on that later.
So as I mentioned, let's say you are writing the document, then you use the abbreviation 'etc'. You can do as followed:

Highlight etc
Go to References on the ribbon, and Mark Entry (or Shift + Alt + X)
In Mark Index Entry window, check Cross-reference, delete the preset word See, and type 'et cetera'
Press Mark, you can close the window.

Continue with your document, and with other abbreviations.
You would notice that Word's code markings for the index show up inline. These would not be there when you print out the document (unless you specifically choose to print markings) so just ignore them; OR if you are such a format fanatic like me and have to get rid of them, just to Home on the ribbon and click on the paragraph icon ¶. You might also have to delve into Word's Options / Display and uncheck Hidden text.
Eventually you want to create the table: Go to References again, and Insert Index. A window pops up; this is what you need:

Check Right align page numbers
Tab leader: (none)
Formats: From template
Columns: 1
Click on Modify
Modify the Index 1

I would suggest you modify Paragraph and Tabs from the Format button on the bottom left of the window.
Let's set Paragraph, Left Indent to 3 cm; for Tabs, type 7 cm and Set, remember to check Leader: none.
OK and confirm all settings and you should have the table in place.
Pros and Cons: Like everything else, there are always 2 sides.
This method gives you the automatic table of abbreviations, in alphabetical order. Problem is, the definition of those abbreviations cannot be made non-italic, due to the format of the system. You will have to manually turn off italic afterward.
You can also not separate the format of abbreviations and their definitions, since they belong to the same class.
But at least it works and we have a decent result. Have fun!
Answer: There are online services such as acromatic.uk that will collate a list of the acronyms that you've used in your Word document, for you to add back into your document.
For that site, you would go through the following process:

Choose how you want to define an acronym (e.g. minimum length, can it contain numbers)
Upload your Word document
You'll be given a sorted list of the acronyms used that can be pasted back into your report.  You will have to provide definitions yourself.

There are advantages and disadvantages to this route, compared to adapting features that are native to Word (see other answers for these).
Benefits:

It is much harder to miss out any acronyms, because you don't have to mark them yourself in the text -- the site will find everything.
You don't have to do anything while you are writing the document, only at the end (which may be good if other people are contributing to a report).

Downsides:

You have to define every acronym yourself at the end.  This may cause various problems, not least that you can't add to your document, click a button and regenerate an updated acronym list automatically.
The site may well pick up strings of letters that you don't intend as acronyms, which you'll have to delete.
As with any service on the internet, consider the security implications of uploading anything sensitive.

Full disclosure: I wrote acromatic.uk (and have read this).
Answer: If you have an Enterprise Office 365 subscription, Word has a feature to find and see a list of acronyms (source: microsoft support website).

To see a list of defined acronyms,

Go to References > Acronyms.

In the Acronyms pane, find the acronyms from your document with their definitions.

Otherwise then I believe the "easiest way" (at least compared to the other answers) is this online tool: https://listofacronyms.com
It finds acronyms broadly so there will likely be more than the ones you want but the cost of deleting a false positive (one click on a cross) feels justified compared to the impact of potentially missing acronyms.
It will also attempt to fill your list with each acronym's definition provided you wrote it down the first time you used the acronym, like so:

A central processing unit (CPU) is...

Disclosure: I created this tool.


Real time depth measurement system

Question: I want to design real time depth measurement system. so, which type of camera is compatible for Raspberry Pi 3 to get depth.
Comment: Why use a camera for depth detection? what about using SONAR or RADAR?
Comment: Or a [Kinect](https://github.com/xxorde/librekinect).
Answer: You're unlikely, I think, to be able to do this with any Pi model other than the Compute Module.
The Compute Module includes two ZIF connectors which can be used to attach two Raspberry Pi camera modules. The bandwidth available to these cameras is substantial, and the compute module is just about capable of rendering depth maps from the data produced.
The Pi 3 has only 1 CSI interface, so you can only attach 1 Pi camera board, which is of no use for stereoscopic vision. You could try connecting 2 USB cameras, but given the limited bandwidth (circa 480Mb/s) and unpredictable timing of USB cameras I think you're going to have a hard time getting enough synchronised data from them to create a practical depth map.

Real time depth measurement system


json-editor ignores starting value

Question: I am trying to utilize https://github.com/json-editor/json-editor.  I have read all documentation and examples multiple times and I cannot get the editor to respect my starting values (startVal).  The editor is created using my schema, but the editor is not initialized with the starting object I am providing.  Here is my code:

  $.get("/AppAdmin/GetWorkflowEditSchema", {}, function (schemaResponse) {

      if (schemaResponse) {

        var editSchema = JSON.parse(schemaResponse);

        $.get("/AppAdmin/GetWorkflow?workflowName=" + workflowToEdit, {}, function (workflowResponse) {

          if (workflowResponse)
          {
            var workflow = JSON.parse(workflowResponse);

            const holder = document.getElementById("workflowEditorHolder");

            var options = {
              "schema": editSchema,
              "startVal": workflow,
              "theme": "bootstrap4"
            };

            jsonEditor = new JSONEditor(holder, options);
          }
          else {
            toastr.error("The workflow could not be loaded to edit.");
          }
        });

      }
      else {
        toastr.error("Reading edit schema failed.");
      }

Both server responses are the correct JSON strings.  When I copy and paste my schema and starting object into the json-editor interactive playground at https://pmk65.github.io/jedemov2/dist/demo.html, the editor is created with the correct starting values.  So I suspect something is wrong with my objects.  I am very unfamiliar with JSON so that would not be surprising.
Here is my schema:

And the object I am trying to initialize the editor with:

What am I doing wrong?  Thank you for any help.
Answer: I got this working by using setValue() after creation instead of passing the initializing object:

            var options = {
              "schema": editSchema,
              // "startVal": workflow,
              "theme": "bootstrap4"
            };

            jsonEditor = new JSONEditor(holder, options);
            jsonEditor.setValue(workflow);

json-editor ignores starting value


Google chrome crashes in Windows 7 Enterprise Edition 64 bit

Question: When I open an Image gallery application in Google chrome 19 browser it crashes suddenly. It happens only when I view the actual resolution image. There is no problem in the case of thumbnail image. I have used the image pre-loading here. Actual size of the image is approx 800 KB. When I try to view the images side by side the browser crashes and doesn't respond also.I found that there is a general issue regarding chrome crashing in Windows 7 - 64 bit OS. There is no problem in the case of 32 bit Operating System.Can I get any work around for resolving this problem? Is it a browser related issue or Os related? I found that the memory usage is not higher,it is OK. Then what will be the real problem?
Comment: What's `javascript` issue here? Please do remove unnecessary tags.. :)
Answer: you can try to reinstall the browser by first uninstalling it and downloading it again to see if the problem persists. If it does, I recommend you to file a bug report with Chrome. I could not find your problem being reported under bugs files, but a lot of similar bug related issues have been noticed with Chrome. So please do the reinstall and check the issue.
or are you using an unstable feature??? by using [flags]? does turning it off help? try looking into that first.


Is drag higher when flying in a crosswind?

Question: Is this true that during a flight with a crosswind the drag increases due to the fact that the relative wind blows at a certain angle to the aircraft's nose but not precisely in the opposite direction to its flight path as it would be without a crosswind?
Comment: Please give words to the labels in the diagram.
Comment: Yet another suggestion-- it is normal to draw the arrowhead at the front of the vector, not in the middle.  Drawn in the middle it looks sort of like you are adding two vectors together in each leg.  Likewise avoid the multiple arrowheads on some of the vectors.  But the main thing is to draw the "relative wind" arrow equal in length and opposite in direction to the airspeed arrow, The nose of the plane should be at point A, and the plane should be pointing exactly along the direction of the airspeed arrow.  The arrow on the left side.   Does that make sense?
Comment: In your example the ground speed is lower because the flight speed vector does not point straight to the destination. This **might** seem like drag is higher, but all that is higher is actual flight time to the destination.
Comment: If you flew it the whole way in a sideslip like your drawing shows, yeah, there'd be a drag penalty. You'd also be holding a bank angle the whole time.
Answer: No, it's not true-- have you ever seen a birds feather's blowing sideways?
We fly INSIDE of the wind, not AGAINST the wind.
You should draw the airplane symbol on the left-hand leg of the triangle, pointing in the same direction as the left-hand leg, and you should draw the "relative wind" arrow equal in magnitude and opposite in direction to the airspeed vector, i.e. the left-hand leg of the triangle.
Consider the fact that many of us have had the experience of actually BACKING UP in flight, relative to the ground.  Now, do you think the air was flowing backwards over the wings?
Answer:
Is this true that during a flight with a crosswind the drag increases due to the fact that the relative wind blows at a certain angle to the aircraft's nose but not precisely in the opposite direction to its flight path as it would be without a crosswind?

Nope. Normally, pilots maintain coordinated flight. This means that they always point the nose of the aircraft directly into the relative wind, regardless of which way the wind is blowing.
(During straight and level flight, keeping the nose pointed into the relative wind is easy. For the most part, the vertical stabilizer does it for you.)
The aircraft's actual flight path is totally irrelevant to aerodynamics. In other words, the plane doesn't know or care what the flight path is. The flight path affects one thing and one thing only: the motion of the ground underneath the aircraft.


does a 3-D printed plastic electric guitar, in comparison to a normal hardwood one, have more inferior tone, or other bad qualities?

Question: I've started looking into 3-D designed musical instruments (yes that's apparently a thing now) and wanted to know if it's a good direction, if I want to customize my own electric guitar
Comment: There is very little, if any, difference in sound. The 3D-printed guitars I've seen and played have all been assembled around a block of wood that holds the bridge and pickups, essentialy making it no different from a "regular" electric guitar. What brand/maker have you been lookin at?
Comment: You may find http://www.odd.org.nz/construction.html to be of interest.
Answer: The critical parts of the guitar for sustain and tone are all between the nut and the bridge, so if you add any shaped pieces on anywhere else they will not make audible differences.
On the very high end guitars, the "horns" and other bits are designed to resonate at specific frequencies so they will have an effect on sound, but for most guitars any effect from these is not going to be audible over the impact of wood or glue choice, electrics, pickups etc.
For some of the electric guitars I have made I have changed the shape over time by hacksawing off various bits; making sure I didn't touch that critical core. There was no change I could hear.


Principle of 16 S rRNA technique for bacteria identification

Question: Why do we isolate DNA not RNA in 16 S rRNA technique for bacteria identification?
Comment: Please ask only one question at a time. Your other questions have already been answered here and across the web. Please do your own research before asking.
Answer: There are several reasons some of which are fairly obvious:

The most obvious reason is that PCR only works with DNA, because it uses DNA-dependent DNA-polymerase. One can argue that you can use an RNA-dependent RNA-polymerase, but it has several drawbacks, mainly the cost and synthesis accuracy (Lauring et al., 2013, Nature). Since RNA-polymerase itself has higher error rates than DNA-polymerase (Berg et al., Biochemestry 5th edition, 2002) RNA transcripts might already have some variation from the original gene and using a low-fidelity polymerase in PCR will only lead to exponential error accumulation, which reduces identification resolution.
RNA is less stable in aqueous solutions due to the additional -OH group at the 2' position in the ribose, hence RNA extraction and storage is more complicated and expensive in most cases.
In community studies DNA and RNA have different biological implications, hence metagenomics and metatranscriptomics are different fields.
Comment: There are several issues with this answer. (Point 1) RNA sequencing is cheap, easy, and very accurate nowadays. cDNA conversion of RNA, also known as reverse-transcriptase RCR, has been common for quite some time now, with highly accurate RTases being used from many different suppliers. A study from 1988 about HIV is not very current evidence of your thesis, especially in the incredibly rapidly-changing world of mol bio. (Point 2) RNA-Seq instruments are provided by a number of companies, and they all work (initially) with RNA. It is also possible through a variety of methods (...)
Comment: (...) to get quite good results using nanopore sequencing nowadays. (Point 3) the second part of the sentence is just wrong. Take a sample, throw it in RNeasy, and store it in the freezer indefinitely. Buy a cheap (depending on your budget) Qiagen spin column, purify the RNA at your convenience, aliquot, and store indefinitely at -20 or -80. Cheap and easy. I'm not sure what the point of Point 4 is.
Comment: @MattDMo thanks for your feedback. 1. I removed the revertase-related statement, though I've found no papers comparing error rates of high fidelity DNA-polymerases and high fidelity revertases (it would be great to get one from you); 2. I've been unaware there are machines, except for nanopore, that directly sequence RNA; as for nanopore, although huge improvements have been made, I haven't seen any reports with accuracy > 0.9 (which is laughable when we speak about identification). 3. I've used that kit myself, that's why I wrote that RNA extraction is more complicated and expensive...
Comment: ... As with RNA-sequencing, I haven't written that it is impossible or something, I've only said that it is more expensive and complicated than DNA-sequencing. And when you only need to identify something, you go for the cheaper and simpler solution, given equal precision; 4. in community studies RNA-seq is commonly used to distinguish active and dormant microorganisms (though it is a complicated theoretical issue), while DNA-sequencing is used to assess structure and composition at the highest possible resolution; DNA-seq usually uncovers more diversity.


Is there a way to formulate a Martingale series that will never explode?

Question: Martingale's betting method can be seen here:https://www.investopedia.com/articles/forex/06/martingale.asp My question is if there is a way to put a non-exploding martingale,
[There is one attempt to do this but without much success you can look here:https://www.mql5.com/en/articles/1800 ]
Answer: No.
Suppose you have a capital base, $C$, and zero sum game, $G$, where for a unit play you can either win $x$ or lose $y$, such that $E[G] = p_x x + p_y y = 0$.
You devise any kind of strategy to play any number of units, $\alpha_i > 0$ for each successive game after a win. Now there always exists a chance that you will lose your entire capital base, because:
$$ C \leq \sum_i^N \alpha_i y $$
for some $N$, where that probability of that happening is $ \prod_i^N p_y $.
Example
The game is 50-50 win 1 or lose 1, and your capital base is 30.
Your strategy is double bet on a loss, i.e. $\alpha=[1,2,4,8,16,..]$
Then:
$$ 30 \leq (1+2+4+8+16) $$
and the likelihood of this happening is $2^{-5}\approx 3\%$, and the other 97% of the time you win 1 unit.
Comment: If it always explodes why can't it be reversed [on a very small part]?
If it always explodes the other will always earn?
Answer: Position sizing, in and of itself, is insufficient to manage risk trading any financial market.  You also need to be well informed about the expected ranges of prices on the particular instrument you are using.
You can use aggressive position sizing, but you'd have to modify the martingale so that you are not strictly using 2x, 3x, etc on each level.    Otherwise you will run out of capital too quickly.
Would also recommend backtesting (with tick data) different market conditions to find out about different ranges of prices that occur.


What causes different decays?

Question: Nuclei spontaneously decay according to a certain decay rate. There are however different kinds of decay, alpha, beta, gamma... What causes then the nuclei, when they decay, to do so in one way of another? Is there a different decay rate for each kind of decay?
Answer: It is conservation rules (mostly that of energy) that controls what decays are possible, and what channels are allowed (the strong interaction respected quark flavor, but the weak interaction does not). If the final state has higher energy than the initial state there can be no spontaneous process leading from one to the other.
The energy environment of a nucleus is a complicated place because it is affected by the strong nuclear force, electromagnetic forces and by the limits on state occupation imposed by Pauli exclusion. There are a lot of question already on the site about when various processes can proceed and related subjects

$\alpha$ decay to more than one nuclear state
What stabilizes neutrons against beta decay in a neutron star?
How can a proton be converted to a neutron via positron emission and yet gain mass?
Why is the (free) neutron lifetime so long?
nuclear fission and half life
Adding many more neutrons to a nucleus decreases stability?
...

Your question about the case where a nucleus has multiple modes have different half-lives is tricky. The measured result is the same half-life for each mode, but we can ask "If we could magically block modes and study the isolated half-life of each mode, what would they be?" If you perform the (often approximate) calculation for that question you generally find different half-lives. The interesting part is the the branching fractions for each decay are related to ratios of the calculated "isolated" half-lives, so you are seeing the effect of the different probabilities when you look at the frequency of different decays.
Comment: Thank you, perfectly explained. However I don't think I understood the final part.Do you mean that the decay rates influence one another?
Answer: There is a different decay rate for each kind of decay.  There is no specific "cause" for one decay versus the other.  That is, given one nuclei, it is indeterminate what it will decay into after some given amount of time.  However, we can determine the probabilities of what it will decay into.  This is calculated using Quantum Field Theory.
Comment: Refer to dmckee's answer above
Comment: I see. Which characteristics of the isotopes determine then (through Quantum Field Theory calculations) which decays are "available" for a specific nucleus?

What causes different decays?


Group lasso penalization

Question: In group lasso we try to minimize the following
$$\frac{1}{2}\|Y - \sum_{i=1}^JX_j\beta_j\|^2 + \lambda\sum_{i=1}^J\|\beta_j\| $$
Often they change this to
$$\frac{1}{2}\|Y - \sum_{i=1}^JX_j\beta_j\|^2 + \lambda\sum_{i=1}^J\sqrt{p_j}\|\beta_j\|, $$
with $p_j$ the number of variables in group $j$.
The reason they give is that 'since all groups are equally penalized in the firsts formula, larger groups would be more likely to be selected'.
Can someone explain this reasoning?
Answer: The logic is that you could have 2 categorical variables, the first has 101 levels and the second only has 2. When you represent these in the linear model you use a series of indicator variables for each of the levels except a baseline level. This means the first variable has 100 binary variables and the second has only 1. In this extreme example you would be penalizing the two features in a highly unequal fashion-you want to have the two features weighted equally, multiplying by $p_i$ in this case (100,1) puts both features on an equal footing when they are penalized by $\lambda$. Otherwise $\lambda$ knows nothing about the 101 binary variables in the model and penalizes them all the same.
Comment: The point is if _**any**_ of the 100 indicators in the first feature are chosen then the first feature is chosen, whereas with the second feature you need to choose this single binary indicator variable. After weighting for group size, the binary indicators are removed according to the same criteria as under the regular lasso model.
Comment: And why thus this imply that if we don't do this, the large group is more likely to be selected? I would just think that since they are with so much, they have a large weight in the function that you want to minimize, so they are removed the first...

Group lasso penalization


Enderman Containment

Question: If i make the wall three blocks thick, and make water on the ceiling, would I be able to contain many endermen in a giant end stone room?  I am doing this for an adventure map so I need the answer for the final boss battle.
Answer: Endermen will teleport to any block within 32 blocks in each axis. While it will not spawn or teleport on\to blocks that has lava or water on them. This means you can't really contain them to one smaller area. It's not unusual that they can teleport multiple times quickly.
In other words, unless you use a mod, you can't really contain it. Only way I can think of without mods is making a massive, flat area with loads of water\lava and no real places for it to teleport. It can't spawn nor teleport to\in areas 2 blocks or lower.
Comment: I don't agree with this as you can create a room and make sure that within 32 blocks there are no valid spawnpoints for them, either by making the surrounding area two high or by placing water where you cant do this, then the enderman will only teleport in their initial room
Comment: No for an enderman to teleport he needs a block to teleport to he will not be able to teleport to space. see episode 300 of Ethos lets play
Comment: Its the same concept behind ender farms as you wouldn't want them teleporting away there either
Comment: I don't think you see the point completely. If the enderman moves 32 blocks in the X direction, you need another 32 blocks to prevent it from moving another 32 blocks in X direction. So if you got a 5x5 room, you need to surround that with 37 blocks in each direction, including diagonal.

In other words, it can be contained, but it's hard to pull off effectively. And it can not be contained in a (example) 5*5 box surrounded by 1'ish block of lava.
Comment: Well, ok. If you made a flat world where top layer was water or lava, you could make a room whatever size you wanted, with maybe some water or lava on top to prevent it from teleporting to the roof. For making it in an ocean on a regular level, you'd need to make sure there were no caves it could teleport to 32 or less blocks under the room.
Answer: Technically yes, but they might teleport away, since they randomly do that.

Endermen always initially spawn in pairs, but will often appear individually or in larger groups due to random teleportation.

Source: https://minecraft.wiki/w/Enderman
Comment: I think that was the problem he was trying to address - keeping endermen in a room in spite of the teleportation.
I believe if you make the walls sufficiently thick they will be unable to teleport, but I think it will need to be more than 10 blocks - not totally sure how far they can teleport.
Answer: Your best bet would be to simply spawn them in using a clock and command block. While your setup should keep most of them in the area, they can teleport away randomly (as Dylan noted). In Vanilla, that's about as good as you can get.
If you are able to install the Extra Utilities mod, as well as one of the various mods that allows you to create helper NPCs with melee capabilities, then you could have a turtle hit them with "The Ender" sword as they spawn, which prevents teleportation on the first hit - but would weaken each by about 6 - 8 health.
Best advice, make sure there's no fire or water in the space you intend to spawn them, because wandering into either is going to cause them to instantly teleport away. Just keep re-stocking them with a redstone clock for the duration that you need to.
Comment: I don't know the Extra Utilities mod, but through commands I have given myself an enchanted sword with a sharpness level so high that it actually doesn't do any damage, it said "Sharpness -32xxx", so if you could get The Ender sword with that enchantment they wouldn't take any damage.

Enderman Containment


Why are snowballs not knocking back LAN players in Minecraft 1.13.2

Question: In one of my worlds, I simply want to have a snowball fight with players that are connected through LAN. The connection is perfect on both computers and there is no lag. PvP works (fist hitting) so there is no scoreboard prohibiting friendly fire. However, for some reason eggs and snowballs have no effects on players. They hit the players (you can see particles) but no knockback occurs. Is there an enable/disable command that came out in 1.13 that I am unaware of, or did the developers take this away? Any insight would be great.
Comment: Snowballs don't give damage, so it could be they generally don't give knockback to players now. Do they usually knockback players anywhere else? Do they knockback in 1.12?
Comment: They did give knockback to players in all previous versions. Honestly, what would be the point of snowballs (the exception being mobs)  if they had no knockback effects on players?
Comment: I'm not so sure what your problem could be then, if they are supposed to give knockback. Sometimes it's not about the connection but the computers or the launcher. Sorry.
Answer: This is due to MC-3179, which was closed as "works as intended" by Adrian Östergård on 2016-08-23 (when 1.10.2 was new) without an explanation.
To clear a few additional things up:

Snowballs never dealt knockback to players. Bukkit servers had or have this feature, but never regular Vanilla servers. In this comment someone tested a lot of versions, from the version in which snowballs were added up to 1.8.3.
"What would be the point of snowballs if they had no knowback effects on players?" Snowball fights can also be fun without knockback. Just a few months ago, I threw a lot of snowballs at someone while he was streaming. It would have distracted a lot more than being funny if it knocked him around all the time. If you want to move someone around, a fishing rod can be fun as well, or a bow enchanted only with punch 2, nothing else. Snowballs can also be used to intentionally anger mobs, which is for example often used in pigman farm.
Comment: Haha, I KNEW It! Score one for the Spice Weasel!


What does you're on my hair signifies in Wedding Crashers?

Question: I'm always confused about the quote "Ouch, ouch, you're on my hair." in the movie Wedding Crashers. What does it really mean? When this quote is being translated into the Chinese version, it means "Stop touching my hair during sex." It just sounds ridiculous to me.
Answer: I haven't seen the film so I don't really know the context for the scene:

But it sounds like he's talking about how uncomfortable dating is and how awkward sex can be.
As a woman with long hair, it hurts a lot when someone pulls your hair and, when in the bedroom, it will happen occasionally, which takes a lot of the fun out of it... assuming it's not intentional...
A guy can easily trap the girl's hair between his body and the mattress, preventing the girl from moving her head and yanking the hair if she's not aware it's trapped, causing pain.
Answer: Not to get explicit, but when a guy is on top of a girl he will usually put his weight on his elbows or hands so he's not crushing the girl.  If the girl has longer hair, his elbows/hands may be on her hair, and his weight would cause him to sink into the mattress a bit, pulling on her hair.  That's what he means, and in that sense the Chinese translation is somewhat accurate.


How to move from one nib to another nib in iPad?

Question: Hi i'm new with iPad. And I want to go from one nib to another when user press the button. How can i do that ?
I tried following but its not loading anything in spitview controller. Any sample code ?
<code> -(IBAction) goTo{
         NSLog(@"GO TO");
         GoFirst *go1 = [[GoFirst alloc] initWithNibName:@"GoFirst" bundle:nil];
    //     [self.navigationController popToViewController:go1 animated:YES];
           [self.navigationController pushViewController:go1 animated:YES];

         [go1 release];

 }
</code>
Answer: <code>GoFirst *go1 = [[GoFirst alloc] initWithNibName:"GoFirst" bundle:nil];
[self presentModalViewController:go1 animated:YES];
</code>


Driving MCU input from +24V signal with zener and mosfet

Question: I've designed a circuit to drive a +5V MCU input from a +24V signal that I believe would work, but looking at other examples it seems like MOSFETs aren't frequently used for this purpose. My primary goal with using +24V is that it's the input voltage for other functions on my board, so its readily available, and using a higher voltage on limit switches is useful for preventing false triggering. The basic idea is to use a zener diode on the gate of the MOSFET to prevent anything < ~+18V from driving the gate. Would this work? I've seen solution that involve voltage dividers, which seem inefficient, and opto-isolators, which would be somewhat pointless here as the +24V for the limit switch signal is coming from the same board.
Comment: Your existing solution would work better if you swapped the diode and the resistor. Use something like 10V-12V zener. 18V is kind of high to protect 20V abs max Vgs.  But still. the simplest thing to do is just use the existing 5V you have, run that through the switch, and back to the MCU. No circuitry required. Also, using a higher voltage on the switch doesn't do anything for false triggering so you don't gain anything. If false triggering is a problem, you have a switch problem. Or noise is triggering the MCU.
Answer: You can just use a voltage divider. No transistor necessary. BTW, using 24V instead of 5V won't prevent false triggering. That sounds like a problem with your switch.

simulate this circuit – Schematic created using CircuitLab
Or you can level shift it:

simulate this circuit
Or you can do this for ultra low power/current usage:

simulate this circuit
Comment: So the reason I'm not crazy about using a voltage divider here is because:

24V/2.4kΩ =  10mA
10mA^2 x 2.4kΩ = 0.24W

So I could just barely use a 1/4W resistor, but it would get hot.

I'd really like to know if my circuit would work, or if not, how I could use a MOSFET to do this.
Comment: @flimsy, double the resistor values and put two of each in parallel. If heat generated is really a requirement over simplicity and cost, than the optocoupler is a fine solution. Why would you think it's pointless? BTW, I've included one more idea in my answer.


What does it mean to be "swift to hear and slow to speak, slow to wrath"?

Question: James 1:19 (KJV) reads:

Wherefore, my beloved brethren, let every man be swift to hear, slow to speak, slow to wrath...

How would James' original audience have practices being "swift to hear and slow to speak, slow to wrath"?
Comment: Welcome to Hermeneutics Stack Exchange. We're not a forum, so do take [the site tour](https://hermeneutics.stackexchange.com/tour). Please also see [what we're looking for in questions](https://hermeneutics.stackexchange.com/help/on-topic), and the [help on asking](https://hermeneutics.stackexchange.com/help/how-to-ask). There's also guidance about [posting good questions](https://hermeneutics.meta.stackexchange.com/questions/867/) on our Meta site. Pastoral guidance, like you seem to be seeking here, is not "on topic" for this site.
Comment: I edited your question to make it more suitable (I think) for this site.
Answer: James here is alluding in part to the Wisdom of Sirach (also called Ecclesiasticus), which I think helps in answering your question:

Sirach 5:9-14 (KJV)
9 Winnow not with every wind, and go not into every way:
for so doth the sinner that hath a double tongue.
10 Be stedfast in thy understanding; and let thy word be
the same.
11 Be swift to hear; and let thy life be sincere; and with
patience give answer.
12 If thou hast understanding, answer thy neighbour; if
not, lay thy hand upon thy mouth.
13 Honour and shame is in talk: and the tongue of man is
his fall.
14 Be not called a whisperer, and lie not in wait with thy
tongue: for a foul shame is upon the thief, and an evil condemnation
upon the double tongue.

Other verses from the Wisdom literature that touch on what James addresses:
... slow to speak ...

Proverbs 10:19 (KJV)
In the multitude of words there wanteth not sin: But he that refraineth his lips is wise.
Proverbs 17:27 LXX (Brenton)
He that forbears to utter a hard word is discreet, and a patient man is wise.

... slow to wrath ...

Proverbs 14:29
He that is slow to wrath is of great understanding: But he that is hasty of spirit exalteth folly.
Answer: The answer above by user33515 (+1) should be helpful, as James 1:19 can be read as a digest of the Ecclesiasticus' verses listed above.
What I would add to this and hope to be of some help is to look around Greek philosophy, and on the other hand to see some rabbinical writings. Why that?
Such threefold groupings are found frequently in Jewish literature (see Pirke Aboth 1.2; 2.10ff.) The mnemonic assistance plays a role in this sort of reference. It is most probably that we are dealing here with the transmission of what is perhaps a Jewish idea, but still it was handed down in Greek. The rhetorical antithesis between "quick" and "slow" is not uncommon in Greek literature.
Greek philosophy was very present in the cultural background of the NT writings. See for instance:

a similar idea in Epictetus: "Nature gave us one tongue and two ears so that we could hear twice as much as we speak".
Also the story of Socrates and the young man coming to the Greek philosopher, to be instructed in oratory. The moment the young man was introduced, he began to talk, and there was an incessant stream for some time. When Socrates could get in a word, he said, "Young man, I will have to charge you a double fee." "A double fee? Why?" The old sage replied, "I will have to teach you two sciences. First, how to hold your tongue, and then how to use it."

As about rabbinical writings:

Pirke Aboth 5.12, where first of all there is mention of him who is quick to hear and quick to forget: his gain is cancelled by his loss; the converse is true of him who is slow to hear and slow to forget; and then the text says: whoever is quick to hear and slow to forget is a wise man; slow to hear and quick to forget - that is an evil lot.
Pirke Aboth 1.15 cites the saying of Shammai: "Say little, do much." In the same way, our saying is self-explanatory and need not, because of some alleged connection, be restricted to the hearing of the word of God or to the hearing of instruction.
Pirke Aboth 2.10: "Be not quick to anger"

See more in: Dibelius, M.; Greeven, H., James : A commentary on the Epistle of James. Translated from Der Brief des Jakobus, 11th rev. ed. prepared by H. Greeven. Hermeneia--a critical and historical commentary on the Bible, Philadelphia: Fortress Press, 1976, p. 109 sq.
Answer: Anytime we see in God's Word an introduction such as 'So then' or 'Wherefore' depending on your translation we need to especially look at the context of the previous verse or verses.
So looking back to v.18 we see this:
'18 Of His own will He brought us forth by the word of truth, that we might be a kind of firstfruits of His creatures.'
The 3 characteristics are attributes of the Lord:
1-quick to hear
2-slow to speak
3-slow to wrath
We are admonished to be 'like Jesus' in scripture.  In v.18 we see in action descriptive phrases of what the Lord works in us:
a-Of his own will (his Sovereignty)
b-he brought us forth (his sanctifying work)
c-by the word of truth (the agent of his work)
And the result is the 'firstfruits of his creatures'.  We are his representatives here on earth until His Kingdom of Righteousness destroys all evil in the Future.
For the audience in James as well today we can only have these characteristics like Jesus by the renewing of our minds by the Word and the Work of the Holy Spirit.
Shalom!


Why do I have to pay taxes to NJ when my company is located in NY and I live in NY?

Question: I live in New York State, I am hired by my company and registers to the NY office. I am on an assignment in New Jersey and conduct physical work at our client locations in NJ and NY. Why am I paying  NJ tax and NY tax... What if I am injured, which state reimburses workers comp? What if I am out of work, in which state do I file unemployment?
Answer: The basic rule is that you owe taxes to the state where you do the work. In some cases the states can ignore it if the number of hours is small, though each state can define small differently.
Other pairs of states have reciprocity agreements where you only pay the where you live. these pairs tend to be neighbors and it would be a nightmare to have every hour tracked for every employee. Talk to your HR/payroll to make sure that the taxes are being assigned correctly.
Regarding workers comp and unemployment. Those are arranged through your employer, and if claims are needed they can advise you.
Comment: New Jersey recently moved to end (but has paused for further review) a reciprocity agreement with Pennsylvania; it appears New York has no reciprocal tax agreements with any state.