Do you need an anode for a hot cathode (thermionic emission)?

Question: I need an electron gun for a project that I'm doing. Is it enough to merely send current through a filament in order to shoot our electrons (using thermionic emission) or must there be an anode present to attract the electrons?
Comment: To accelerate any electrons coming off the filament you need a voltage gradient. Whether you call the non-filament side of the voltage supply an anode or ground is up to your experimental setup.
Answer: Yes, we need an anode. But I would say the purpose of the anode is not only to attract the electrons emitted from the cathode, but also to recollect them to refill the cathode with electrons. Just after a tiny amount of electrons are emitted, the electric potential of the cathode would raise so much that no more electrons would be emitted until the cathode is refilled. In the steady state, the electric potential of the cathode remains low, making it a stable source of electrons. But the word "source" should not be misunderstood as something that creates electrons. It's just a place where the recollected and refilled electrons get emitted.
This is different from a light bulb radiating photons of light, where photons are created as packages of energy traveling at the speed of light. When these photons reach an absorption screen, they get annihilated and the energy they carry get absorbed by the screen and in the long run heats it up. So there's no recollection of those photons to put them back to the light bulb.
For a long time people had insisted on such difference between energy and matter. Nowadays we know that at high energies, electrons can also be created and annihilated in electron-positron pairs. But that is another topic.
Answer: here is another way of looking at this which may help answer your question. Think of the electron gun as a circuit element. it is in series with the (-) terminal of a power supply which generates high voltage and low current. for current to flow through the circuit, a return path must be provided by which the electrons shot by the gun at a target (the anode) flow back to the power supply and get lifted up to high voltage again. For circuits carrying extremely high voltage and correspondingly low current, a satisfactory return path may just be the ground beneath the apparatus, but for any circuit like this which carries significant current, an anode must be provided and it has to be wired to the (+) terminal of the power supply.


Contract not showing the name and symbol

Question: I deployed a contract on ropsten but it was not showing the name and the symbol. I have the feeling that there is something wrong at the deployment and I think it has to do with the parameters. As you can see in the picture.... is it the way I should write them or is it wrong  ? Thank you very much
Answer: The parameters are not wrong, there's no error during deployment and the compiler is acting as expected.
In Solidity, when you declare a variable as public, you are telling the compiler to create a public function with the same name of the variable, so that you can query the value of the variable from outside the smart contract.
In your case, you are declaring your variables as private, so the compiler does not create those functions.
Just change the visibility of name and symbol variables from private to public and you will be able to read those values easily from remix or any other ÐApp.
Note: please always post the source code exposing the problem, not a snaphost of it.


Is there any word for the rocks used to pave paths near a medieval home?

Question: Is there any word for the rocks used to pave paths near a medieval home? I was thinking of pebbles, but I am not sure if there exists a specific word for the rocks used to pave path during the medieval age, or if there are other kinds of rocks that were used during that time other than pebbles, which is very generic and not specific enough.
Answer: You may be thinking of cobbles or cobblestones:

A naturally rounded stone (usually from rivers, fields or the sea) used for paving and walls. Setts are often popularly called cobbles. They are small stones or pebbles that were traditionally gathered from stream beds and hence had been rounded and smoothed by water. (designing buildings)

This Sunwood site states that they have been around since long before the Middle Ages:

As early as 238 B.C.E., the Romans used tons and tons of cobblestones to create 50,000 miles of roads linking every part of the Roman Empire together—and they all lead to Rome!

They can look like that:

(The picture is called "Dinan, traditional colorful houses on a cobbled street in medieval town center, Brittany, France" from Shutterstock.com)
or like that:

(Cobblestone streets and old buildings in Sighisoara Medieval Fortress, Romania from Shutterstock.com again)
Note that

While cobblestones and setts look similar, they're not quite the same. The main difference is the shape. Paving setts are cut into uniform square sizes while cobbles keep their natural rounded shape. As a result, setts have a finish that complements modern spaces. (simplypaving.com)
Comment: Flagstones would be possible, but near most homes cobblestones would be more likely.
Comment: They're very popular in (Western) European cities. They look lovely and are more resistant to freezing weather (potholes) but they're not great for driving on. :)
Comment: You'd better watch your steps when walking on them, too :) ! Such streets can be uneven and slippery!


How to create a locator through Open Street Map Data

Question: I need to make a locator for UK addresses and I know Open Street Map has very good data for the UK, I was wondering how I can convert the data for house addresses, which is in xml form, into a locator in Arcmap.
Comment: Do you have the ArcGIS interoperability extension? you will need the osm data in geodatabase format to create a locator http://communityhub.esriuk.com/technicalsupport/2014/9/12/how-to-use-openstreetmap-data-osmpbf-in-arcmap-using-data-in.html
Answer: I think you're trying to create is working with Geocoding in ArcGIS.
Here is a video tha you can follow the instructions to do the geocoding in ArcGIS.
But before that you need to parse your XML data to get just the address. You can do it using a simple code using Python (it's installed by default when you install ArcGIS).
Is that make sense for you?
Comment: @SilviaSnow - check out the [ArcGIS Editor for OSM](http://www.esri.com/software/arcgis/extensions/openstreetmap) can provide an easy way to download the addresses from OSM into a geodatabase format if you don't want to deal with converting the XML yourself.
Comment: Thanks, another question, which address locator style should I use, it seems that there's no style that I can use to geocode UK house addresses


Root Alcatel One Touch Pop 4s

Question: Are there any tools to root a Alcatel One Touch Pop 4s (Android 6.0), I already tryed Kingroot and Famaroot but both do not work like on other Alcatel phones
Answer: You can try KingoRoot instead of kingroot....
Comment: Welcome to Android Enthusiasts! This post does not contain enough information to be considered an answer. How did it solve the issue? Where to find it? What are the steps to perform?
Comment: Already tryed that but didn't work
Answer: Try this.... It will work.....

Download Super-Root.apk for Alcatel Pop 4s from this link : http://downloadsafe.org/file/0yF980
Connect your device to your PC using the USB cable.
Copy the Super-Root.apk over to the root of your SD card.
Once it's been copied, disconnect your device from your PC.
Head to Menu>>Settings>>Security on your device and enable the Unknown sources option.
Open the File Manager app on your device and install the app you copied earlier to your device.
Once the app's been installed, launch it from your App Drawer.
Select Install SuperSU from the first dropdown menu.
Select exploit, tap on it in the app.
The app should begin rooting your device, shouldn't take too long to finish.
Reboot your device once it's been rooted.
You're all done! Enjoy
Comment: Not downloadable with "Quick Offer" thing, can you upload it via dropbox or something like that?

Root Alcatel One Touch Pop 4s


MAC OS full admin rights and software removal in a corp environment

Question: We have MAC OS for our developers (running with root). We also deploy an DLP endpoint agent. Now what happens, in some cases they just sudo and uninstall the agent because it slows down the machine. What options do we have to prevent them doing that ? I guess technically there's probably nothing that can be done, right ?
Answer: I know this is not the answer your want, but from a security perspective, the right answer is removing admin privileges and granting them more specific permissions if needed. Giving your users full admin rights are the best way to a full ransomware outbreak and other fun stuff you don't want to live through.
Unfortunately, you're probably living in the real world with bosses and other fun stuff, who claims local admin rights for users are just fine. In that case some DLP agents can be configured to require a password(seperate from the machine) to start the uninstall process.
If the DLP tool you're using doesn't provide this configuration option you could install a monitoring tool(or cron job) on the endpoints that continuously checks for a running(or just installed) DLP service and if the service stops working, sends you an email or create an alert in your monitoring or SIEM tool. Depending on your infrastructure there are many ways to do this but generally you should try to avoid false positives. One way is to only alert whenever a DLP agent has not responded for a few days(if your company is okay with that risk) and then gather the information to a monthly report to monitor the development.
Another way to fix the issue would be with people skills. Assuming you've already tried to talk with the devs about not uninstalling your tools, work with HR or C-level to communicate this message and you'll see how easy it is to change people's minds when their job security is on the line ;-)
Comment: The DLP endpoint agent provide a challenge-response mechanism but only for Windows. After a short evaluation it looks like DLP on MAC OS is still years behind Windows.
Installing any additional tool for monitoring does not help to much as again with full admin rights they can do whatever they want to do. Also, regarding the cronjob / SIEM that would probably give some information but the management console for the DLP product has reporting functionalities as well (to see when was the last time the agent checked-in) but that would work if connected via a VPN or direct connection).


How to get better at Proofs

Question: I'm still quite early in my Journey of Mathematics and as I have progressed I have found a constant wall; proofs. Every time I try and learn to do simple proofs, I struggle to find an actual strategy, and locating what I am actually trying to prove. I feel as if that when I construct a proof, I try and reuse exactly what the textbook has told me, but in the end I still get the proof wrong, because of not noticing a small detail or not managing to construct my OWN proof. I am wondering if there is a general strategy, or way to learn to just construct your own proofs without relying on outward sources.
Comment: Like most things in life, practice makes perfect. Start by trying to do lots of simple test questions and slowly try harder and harder ones. ideally try to work with more experienced colleagues who can also guide you. You will soon get the hang of things - just be patient my friend.
Comment: One of my favorite books to recommend is Houston's *How to Think Like a Mathematician*.
Comment: There are good books that will help you. The classic is Polya's "How to solve it".
Comment: I always start doing first some easy examples, and then extreme cases - then when already have some insight of the problem (because always "something new" happen in the examples), I start to looking for the proof with a better "intuition" of where I have to aim.
Comment: Just read a lot of them and do a lot of them. I don't know any better way. Perhaps start with something like point-set topology, which is a lot of definitions and proofs about definitions. You learn a particular set of skills with that subject. Building intuitions about the definitions, and then converting those intuitions into formal proofs.
Comment: I second the recommendation above, Houston's book is great for beginners in mathematics. Can't help but recommend Book of Proof as well since it's free. (You can access it here: http://www.people.vcu.edu/~rhammack/BookOfProof/).
Answer: Different take: Dont focus of proofs. Focus on solving problems. Then try to explain your solutions as clearly, concisely and rigorously as possible.
Comment: I agree, this is very helpful. Try to flesh out the answer in detail, not just the "general idea how to answer". I'm sure you will start noticing how to ensure the minor details are correct.
Comment: I see, I think this would work for me, it just seems that the intuition of the worked solutions isn't something I would find without prompting. Details such as knowing that all multiplies of 6 are consecutive numbers, are things I just don't notice when trying to prove things are multiples of 6. What I am trying to say is that starting proofs, and knowing what to prove is not intuitive to me, and I would like to know how to work on that.
Answer: First of all, to learn how to produce proofs one must learn how to read proofs. Say you're studying real analysis and you really struggle with $\epsilon-\delta$ proofs. This is a common occurrence. What makes you better at it? First, try to see a lot of examples. Each mathematical discipline has a certain flavor and so do the proofs of the results in that subject. So read a lot of proofs and go through many examples in the theory. That is the first step.
Next, before you actually read a proof, try to think of what the person is trying to prove. Is it reasonable? Do you have an idea that might help you prove it? Read the proof. Is it what you expected? Did they use all the hypotheses? Where were they used? Keep asking yourself these questions and things will get easier.
Lastly, try to revisit proofs yourself and try to prove more basic results on your own. Do a lot of exercises. This is the hardest part of studying mathematics in my opinion: gaining mathematical maturity.
Comment: @Ammardian: Try to construct a proof by contradiction: If $x+y\in Q$, what does that imply about $x + y$? Can you say anything useful about $x + y - x$? If you later discover that the contradiction is unnecessary, you can then simplify the proof into a more direct version, but you need to have a valid proof to start with.
Comment: I try to do these things, but probably the thing is I often don't know where to start with my proof. Here is one I am doing right now, "If x⋹Q and y∉Q, prove x+y∉Q", For this I don't really know where to start, as I have seen examples of similar proofs, but don't know really where to start for this one specifically. It seems like a basic proof, but I don't really know what to do.

How to get better at Proofs


Can an iPhone be restored from an iPod Touch backup?

Question: If I have an iPod Touch backup on my computer, can an iPhone restore from it? How about vice versa?
Answer: According to this forums post, somebody did it with success.

Worked flawlessly for me
  I just activated my new iPhone 3GS and then iTunes offered to either set it up as a new iPhone or to restore it from my iPod Touch backup which I did. No problems so far...
Comment: The only issue I can think of would be if the device you're restoring TO has lower firmware than the device that made the backup. iTunes usually rejects that. (This would be very unlikely in an iPod Touch to iPhone restore though.)

In my experience, if there are files lacking in the restore that the iPhone needs (carrier info, etc) they're just created as if it was a factory reset -- impressively robust decision by whoever did that on the iOS team ;)  After the restore, you may see the iOS loading bar like you would after a reset -- that's ok, it's just those files being filled in.
Answer: Yes, i can confirm this Works based on my experience. All my music and contacts from my iPod touch was magically restored to the iPhone 4S.
Answer: It will depends only of the iOS version, because the Apple's script is not accepting iOS minor than 8 right now (That's called downgrade). But if want to make an "Upgrade" (or restore from a version to the same version) so you have no problem with that, even with different devices.


How to output signal when a button is pressed the 2nd time?

Question: I'm trying to make a map where I need to make it that when you press a button, and something happens, and when you press it again, something different happens.
Comment: So... you want when you press a button it outputs a signal, but when you press it again, it outputs another signal?
Comment: @TheVoidChaos I think so.
Comment: @RudolfL.Jelínek Ok, will answer soon, just need confirmation from OP.
Answer: A great way to make a button system as you've said is to use a scoreboard objective.
First of all, make the scoreboard objective
Run this command in chat to create a dummy scoreboard objective named Output:
/scoreboard objectives add Output dummy

Next, determine the input source
To do this, place a standard impulse command block after your output and write this into it:
scoreboard players add @a Output 1

After that, set up the output system
Next place multiple always active repeating command blocks next to each other in a row, the length being how many different outputs you want (in this case 2). However, this will only work in single-player. If you want a multiplayer system, separate the repeating command blocks
(It does not matter where in the world you place these repeating command blocks, but putting them near your input will make it simpler to understand what it's doing.)
In the first command block, write this command:
testfor @a[score_Output=1,score_Output_min=1]

In the second, write this:
testfor @a[score_Output=2,score_Output_min=2]

(If you would like more, add more in the row and change the testfor score in ascending order)
Place comparators facing out of these repeating command blocks.
Finally, determine the output type
If you want this system to output to commands, simply place a solid block after the comparators and then your impulse command block after that block. If you want other commands to run as well, you will need to create a chain of always active chain command blocks after the impulse block.
If you want a redstone output, place redstone dust after the comparators and redstone repeaters facing out of those (changing the direction of one if required).
Answer: Here is a redstone solution, one-use only:

Additional info:

the 2 uppermost repeater at output 2 can let signal pass only if the repeater under it is off, that is, if the torch is destroyed

an AND gate is a device where both inputs to it must be powered for the output to be powered

to reset it, re-place the torch in the middle

What it does (i tried to explain as "noob-friendly" as possible):

When the button is first pressed, the AND gate will power the 1st output for 0.6 seconds, then the redstone torch in the middle will be destroyed, so the 1st output can't pe powered anymore, and the 2nd will get unblocked.

When it's pressed again, the AND gate won't power, because the Redstone torch is missing. The 2nd output will get powered, because the repeater going from the button is unblocked and can let signal pass.

The 2nd output will get powered every time after that.

TL;DR: First press powers the right lamp, second the left.
Comment: What is your minecraft username? I'm thinking of making a video of this.
Comment: @Player RudolfJelinCZ :) Thanks! **Edit:** Also thanks for the edit!
Comment: Ok, This I SO Confusing
Comment: @Player thanks for coming back and accepting this answer. By doing so you help future visitors know the answer that helped you.
Answer: I have another solution that does not require command blocks and is not a one time use.
It has three outputs but you can connect first output to nothing.  In that case, you press the button once and output 1 goes high, press it again and output 2 goes high.  Press it a third time and output 0 goes high again.
Image shows the three states it can be in.

It is a dropper, hopper train.  Dropper faces into a hopper which faces into the next dropper(green arrows in image indicate direction).  Place an item in one dropper and redstone dust on top of all droppers and hoppers.  When that redstone dust is powered the item will move to the next dropper in the line and the comparator on that dropper will output.
Simple to build.  It can be expanded to have more outputs(more button clicks) by adding more hoppers and droppers in the train.  You only need comparators on droppers that you want to output.  In this case, you don't need comparator labeled Output 0.
I use this circuit with observer monitoring block in front of piston to "count" the pulses out of the observer as a way to ignore the two pulses created by the piston extending and retracting.  (Auto pumpkin/melon farms)


Connection of the circuit breaker

Question: Where is the circuit breaker connected in an electrical installation? Is it on the live line or on the neutral line of the generator? Why?
Answer: Circuit breakers are always found at the location where the size of the wire changes. For example, when wiring enters your house and splits off to your lights and outlets the gauge of the wire is reduced to make running that wire more practical. When the gauge of the wire is reduced a circuit breaker is installed. This is evident in the circuit breaker panel of the house. The reason for this location is because when the size of the wire is reduced the safe current capacity is also reduced. If the circuit into your house is 400A capable, the wires in your walls could glow red hot and not blow the 400A fuse on the electric pole outside. Therefore the breaker is sized in a way to protect the wiring.
The circuit breaker is always on the hot side. The neutral line is just a return line. If the circuit breaker was on the neutral side then only the wiring from the breaker to point were the neutral wires all tie together would be protected. This is because a circuit breaker is meant to protect not just form over current but also against a short to ground. If a short were to occur on the hot side then the current would bypass the breaker on the neutral side. Further if the breaker was on the neutral side and turned off, everything else would still be electrified. When the breaker is on the hot side and is turned off only the bus bar inside the panel remain electrified.
Answer: I would say on the live, because if you disconnect neutral you can still touch the live and the current will pass trough your body trough the earth (electrocution).
Comment: @user225430 Say that you keep L connected, and disconnect N.  There is no current flowing, but the components are energized to the line voltage.  Now, if you touch an energized area then you become the load.  In other words: your finger is at line voltage, your feet are at ground potential, and your body is a good conductor :)
Comment: But if i disconnected neutral no more current is passing through the circuit
Comment: Is not this true?
Comment: Since neutral is connected at some point to ground, it is not true. Then you could get current flow through ground back to neutral. This is technically known as A Bad Thing.

Connection of the circuit breaker


Multicasting Windows 7 Image

Question: I am trying to deploy some new machines with windows 7 for the first time in our computer labs. We used to use third party imaging software and then run sysprep after the image was copied(XP), but it seems you can't go that route with windows 7. We set up a new imaging server with the windows system image manager, but when we try to multicast the image it pretty much takes down our whole staff and faculty network. I heard you can turn on a multicast feature on our cisco switches to help with the issue, but that it also slows the switches to a crawl. Another idea we have tried was pulling the the computer lab switch off the main network and plugging the imaging server directly into the computer lab switch so the multicast doesn't take down our network, but it doesn't seem to work without being able to hit a domain controller. Is there a way to multicast without taking out the network? I feel like I am missing something... Thanks in advance
Comment: WinSim creates Windows Setup Answer files, it doesn't distribute images, so you must be using something else. Multicast should be enabled by default on the switches, it's quite abnormal to have it disabled, and more so that it would slow anything down. Having the computers on separate switches should have no effect so long as the switches are responding to IGMP correctly. What multicast address are you using? The most common one used for site-local use like this is 239.0.1.x range.
Answer: Multicast is a feature of WDS (Windows Deployment Services) on Server 2008. So if you do not have that set up, then you are not multicasting, and you would definitely slow your network to a crawl while attempting multiple deployments at the same time. A brief description can be found here. This article might also be helpful: Performing Multicast deployments
I would also like to recommend that you use MDT (Microsoft Deployment Toolkit) with your deployment stragety. MDT will integrate with WDS and links all of Microsoft's deployment tools together (WSIM, WAIK, etc...).
Lastly, could you explain this comment: "We used to use third party imaging software and then run sysprep after the image was copied(XP), but it seems you can't go that route with windows 7"
Is this something that is done with your 3rd party imaging software, or are you having trouble running sysprep on your master machine before capturing the image?

Multicasting Windows 7 Image


How to determine if whole-device encryption enabled?

Question: If someone hands me a Windows Phone 8.1 device, how can I determine if the phone has whole-device encryption enabled? Is there somewhere in the settings that indicates this?
Comment: Why might you care? I.e. what's the problem you're trying to solve?
Comment: Whole device encryption is only enabled when the device is linked to a company's domain/network.
Answer: The device is only encrypted when it is connected to an exchange or a company account that requires the phone to do so.

Device encryption is not enabled by default. Device encryption is automatically enabled in the following scenarios:

The user adds an Outlook account to the phone, and the Microsoft Exchange server that it connects to is configured to require device encryption.
The user connects the phone to a company apps account, and the enterprise device management server for the account pushes down a policy to the phone that requires device encryption.

Secure boot and device encryption overview
Answer: On WP 8.1 phones one can check this via the Storage Sense app. If it shows storage encrypted there, the internal phone storage has been secured.


LM2576 12V to 5V and 3.3V

Question: I want to step down the input voltage from my power supply (12V) to 5V and 3.3V.
Please see my schematic. Is it right or wrong?
I use LM2576 as switching regulator.
Thanks. Sorry for noob question
Answer: Your overall idea is fine, but your design/schematic has issues.
In general, you would do well to familiarize yourself with Eagle's symbol creator, many of your symbols are poorly created and therefore difficult to read/look ugly. Also, read the datasheet. This cannot be emphasized enough.
More specifically:

I'm guessing your leftmost symbol is an input jack, but it's not labeled as such (and DC power jacks have a specific schematic symbol that makes this clear).
Missing catch diode on the 3V3 regulator.
Regarding D3, the 5V0 regulator catch diode: per the datasheet, 1N400x diodes are not suitable. Use a Schottky or fast recovery diode, the datasheet has a table of recommended diodes.
I don't know how you selected your inductor values, but they don't look right (33uH seems a bit small, and 2.4uH is definitely too small). The datasheet has an inductor selection guide, use it.
Adding a few 100nF ceramic caps on the inputs and outputs of each regulator would help a great deal with high-frequency performance. The large electrolytics have a large ESR.
C6 seems a little on the large side, but that's fine. C7 is probably too small, especially considering the second regulator downstream. While it is sufficient for stability, larger capacitances will reduce ripple. The datasheet recommends 680uF-2000uF, 2x 470uF in parallel would be nice.
You haven't connected the output capacitors on both regulators properly: C1 and C7 should be connected to the 3V3 and 5V rails, respectively.

Also, keep in mind that (per the datasheet), the input capacitor, Schottky diode, and output capacitor should all be connected to the switcher with short, low-impedance traces.

LM2576 12V to 5V and 3.3V


Why do I have to constantly redownload updates?

Question: My friend gave me his PS3 game Injustice: Gods Among Us, but to play it, we always have to wait like 20 minutes to download updates. Why does only this game do this every time we want to play it? Is this the way is going to be all the time? How can I fix this issue?
Comment: Don't know this exact issue, but are you sure HDD in your PS3 is OK? Had similar problems on PS2 with broken drive - games using that drive loaded slowly and sometimes crashed. And then HDD died completely.
Answer: If you're not playing online, then you can avoid doing the updates. Either disconnect your PS3 from the internet or press circle when the update screen pops up to cancel the update and proceed straight into the game.
If it is necessary to download the update (because you're playing online or missing characters I presume), then maybe the update is not completely downloading or installing properly. If other people have access to your PS3, perhaps they are deleting the update as a practical joke.
Just to be sure, you are talking about the type of update where the screen goes black with white text? I know that with Injustice, there is a system in place where once the game has started, there will be a second online check (which can take a while) to apply balance changes without requiring a hard update to the game. It's impossible to avoid this, but it can be cancelled if you aren't playing online. I can't check, but it may be possible to play online without doing this check as well, since Netherrealm aren't going to be making daily balance changes.


Is it safe to change Apple Watch battery with more capacity?

Question: For example, while the original battery capacity for Apple Watch Series 1 (38 mm) is 205 mAh, can I replace it with a 273 mAh (38 mm) battery (originally for Apple Watch Series 2, 38 mm), and assuming if it work, would extend the standby time for Apple Watch Series 1 (38 mm) much longer than the original design? Will it work, and be safe?
Comment: If you have your AppleCare+ warranty on the watch, I'd recommend not doing it. Also by opening the watch, keep in mind that the screen is very fragile and with crack if not handled exceptionally careful.
Comment: @melvin-jefferson Thanks for the advice! Yea but when warranty expired, and the the screen lifted because of the battery, I guess what can be done is replacing the battery --- that's when I start to think, since the battery will be replaced anyway, what if replace one with more capacity, will it get longer standby time? --- that's why I'd like to know, in the first place, can I change the larger capacity battery and will it be compatible?
Answer: It turned out that the battery of difference series of Apple Watch is not compatible with each other, due to their connector interfaces are very different. [reference]
So, as much as safety has to be concerned, the idea won't work in the first place.
Answer: Changing any lithium ion battery that isn't enclosed in protective metal is unsafe. If the part is crimped or pinched or you get a screw loose, the consequence is fire. Just like a home repair of a gas line or working on live electricity isn't safe in general. It doesn't mean some people can't do it, but that most people shouldn't without some education and training and the willingness to start over if they mess up with one part.
Apple gear is so small and light that the internals can be tricky to repair so I'd take it to someone that does dozens of these swaps a week or more if you concern is about safe.
Comment: @Bill  Go ahead and ask a follow on question. What physically firsts is a great question. I know a lot about safe but not about parts. Someone who knows that would be a great answer. Especially if ifixit.com or some other source hasn't documented the details of a battery swap on a watch. You'll need to know all the parts and tools and steps in addition to the yes/no part about fit and operation.
Comment: Thanks for your advice! You are right, and I was hoping to see if there is this expert "someone" here could tell me:

Above all, if a 273 mAh battery from Apple Watch Series 2 could be placed in Apple Watch Series 1, whose original battery is 205 mAh? will it be compatible?

And then, if it works, will it be safe?


Does the APACH2 Licence include the implementation of algorithms?

Question: If some algorithm is written in some programming language and licenced under APACHE2 and I rewrote it in another programming language, should the new code be considered as a derivative work or it is a separate work?
Comment: Request for clarification: Do you mean a *literal translation* (i.e. not just the same algorithm, but the same implementation of that algorithm, in the other language) or a new implementation of the given algorithm?
Comment: @preferred_anon the second one
Comment: There's a misunderstanding here. The implementation of the algorithm is licensed under APACHE2, not the algorithm itself.
Answer: It's a derivative work
Translations of literary works (whether from French to English or C++ to Java) are derivative works.
Comment: I did not think algorithms could be copyrighted. Rewriting is not the same as translation.
Comment: @Mindwin Stallman has some "interesting" ideas on patents in general, not just in the area of software. I would not take his talks (often dating to 2002 or before) very seriously.
Comment: @doneal24 if you haven't, Professor Stallman has something to say about software patents and copyrighted code in general.
Comment: @doneal24 never take anyone's talks seriously without knowning the context, bias, and motive of the speaker. Yet software is plagued by the trifecta of public domain (algorithms are mathematical expressions and cannot be under either of the following two), patents (which theoretically had to be bound to some physical specialized circuit but the patents department likes money), and copyright (as software is sometimes considered "creative works"). It is a bloody mess.
Comment: @doneal24, algorithms can't be copyrighted, but implementations can.  Creating a new implementation of an algorithm from an old one without using any of the copyrighted aspects is tricky -- see, for example, the lengths Compaq went to when cloning the BIOS of the original IBM PC.


How can we execute a log file from pg_xlogs directory postgresql?

Question: Is it possible to execute a Wal log that is copied from a machines pg_xlogs directory and all the queries inside it are executed on another machine? What command might be used to carry out this action (if there is any command)?
Answer: No, it doesn't work like that.
The transaction logs don't contain queries. They contain the changes to disk blocks - heap and indexes - along with records of transaction ID allocations, commits, etc. It's all very low level, and it makes absolutely no sense to try to apply it to another unrelated PostgreSQL instance.
You can use the transaction logs (WAL) for replication, per the PostgreSQL manual.
PostgreSQL also has the beginnings of logical replication functionality. Currently that's mainly accessible via 3rd party tools like pglogical. There are trigger-based alternatives like Londiste too.
Comment: Where are theses transaction logs (WAL) located? Is it possible to send these logs from a primary site and run them on a secondary site?
Comment: I want to start sending changes after a certain time. Unfortunately, I have already implemented streaming replication but the problem is that it completely replicates the primary to the secondary. I don't want that! I want changes after a certain point to be sent to the secondary, not fully replicating primary to secondary. Can that be done?


How to apply custom scale other than 1?

Question: I want to keep the size of an object, but I need to make the scale of different objects uniform to keep the hair particle the same.
How to apply custom scale other than 1 without actually scaling the object?
Comment: Scale by 2 in _Object Mode_, go into _Edit Mode_ and scale by 0.5? (or any other combinations scaling by x and then scaling by 1/x)
Answer: Just divide the object scale with target scale number, then apply scale to 1, then multiply the object scale with target number.

How to apply custom scale other than 1?


Parse html failed with BeautifulSoup and requests, I can't figure it out, can anyone tell me why?

Question: Here is my code:
<code>import requests
from bs4 import BeautifulSoup
r = requests.get(self.url)
soup = BeautifulSoup(r.content)
print r.content # Here, I got output of the html
print soup.text # Here, I can't get any output, which puzzled me.
</code>
It may be what reason/reasons caused this?
Thank you guys!
Answer: I got it!
Because the BS didn't parse the document correctly, so it lost some content.
The solution is:
soup = BeautifulSoup(r.content, 'html.parser')


Unit testing a very specific function

Question: To make sure this question is concrete enough for the standards in the FAQ, I am just asking the following: What are some sources that discuss the most common ways to apply unit testing to a very specific function, generally a function that relies on vendor data or other very specific data such that synthetic data is unhelpful in the test? If you're interested in more background, read below.
Background:
I write unit tests often in my daily code development, but I also try to make my code as abstract and reusable as possible. In a new project that I've joined, there are many cases where the code consists of very specific functions that are meant to accept very specifically formatted input data and store output data to database tables. Much of the input data consists of vendor data or other in-house data, and is accessed through calls to both vendor and in-house APIs.
The only idea I have so far is to test the kinds of failures hit upon when input data is poorly formatted. I will definitely write this test, but it's pretty useless for our team as far as tests go. Much more useful tests ought to check that the logic of these data manipulations is correct, which involves checking the accuracy of the output data based on the input data.
Unfortunately, I don't have any benchmark data sets where I definitively know what the output should be. Others have suggested to create my own synthetic input data (like a matrix of all 1's or something contrived where I can predict what the output should be). Unfortunately, the operations performed by the function are very non-linear (binning things by weighted percentiles and getting aggregate statistics over each percentile grouping). Any test of this that's based off of totally contrived synthetic input data won't be very useful for us either, and the time cost of formatting it and then writing to some synthetic output database table and reading it to check in the unit test kind of makes such a test worthless.
I know that unit tests should test for just one behavior. I'm just not sure how to break apart a function that does something like aggregating complicated statistics across weighted percentile groupings and boil that down to "just one thing" to test.
What are some standards used in this setting?
Comment: better suited on http://programmers.stackexchange.com maybe?!
Answer: I've run into similar issues with very large methods. My advice would be to refactor the code utilizing Dependency Injection and adhering to the Single Responsibility Principle. Then test each class according to its responsibility.

Unit testing a very specific function


Stress and Displacement of Cantilever Plate with a Uniform Load

Question: Does any one happen to know of any resources that describe the stress and displacement of a uniformly distributed load in the direction perpendicular to the length direction of a plate analytically? I have checked both Roarks Formulas for Stress and Strain and Plates and Shells Theory and Analysis by Ansel Ugural and I do not see anything quite what I am looking for. Hopefully the images below help.
Comment: Are you worried about the exact details of the stress distribution near the free edges? If not then use the normal beam equation to get the deflection at x1, and you know the angle it has bent so the deflection at L is deflection at x1+angle_in_radians*(L-x1)
Comment: This might be a start: https://engineering.stackexchange.com/q/3541/10902
Comment: I am more interested in knowing the displacement roll off near the edges. We have some location sensitive parts. I am sure I could simply run a lot of FEA's to get my answer, but I thought it would be better to see if there was an analytical solution first, as we have a few different cases.

Thank you Solar Mike, I will have to take a think on that and see if it helps. The post most similar to what I was looking for was like this: https://www.physicsforums.com/threads/bending-of-a-cantilever-plate.994320/
Answer: For bending of wide plates, we typically use the so-called plane-strain modulus $\frac{E}{1-\nu^2}$, where $E$ is Young's modulus and $\nu$ is Poisson's ratio. For $\nu=0.3$, for example—typical for ductile metals—the plate is predicted to be 10% stiffer than a narrow beam.
The reason is that the narrow beam is free to expand laterally on the compressive side and contract laterally on the tensile side, both due to Poisson effects. Because of the nearby free surfaces on either side of the width, the lengthwise cross-section is considered to be in a state of plane stress; lateral deformation is unencumbered. (This can be a point of confusion: Recall the Poisson effects aren't driven by external lateral stress; they occur freely because of the lack of an external lateral stress.)
This isn't the case with the wide plate, whose cross-section is instead in a state of plane strain (minimal strain allowed in the width direction). Now those Poisson effects are suppressed by an internal strain (in the width direction) acting on most of the lengthwise cross-sections (the $L-t$ plane in your diagram). As is typical, any extra constraint makes the material stiffer, and correspondingly $\frac{E}{1-\nu^2}>E$.
I derive various moduli in a page on generalized Hooke's Law (in progress) here. Briefly, generalized Hooke's Law
$$\varepsilon_{ij}=\frac{1+\nu}{E}\sigma_{ij}-\frac{\nu}{E}\delta_{ij}\sigma_{kk}$$
couples the 3-D strain $\varepsilon_{ij}$ and stress $\sigma_{ij}$ in isotropic materials. (Simple Hooke's Law $\sigma=E\varepsilon$ strictly applies only to axial loading of long, thin bars.) Here, $\delta_{ij}$ is 1 if $i=j$ and 0 otherwise, and $\sigma_{kk}=\sigma_{11}+\sigma_{22}+\sigma_{33}$. With $\varepsilon_{33}=0$ for plane strain and $\sigma_{11}$ loading, we have $\sigma_{33}=-\nu\sigma_{11}$ (the widthwise stress that arises because the wide plate can't easily shrink on one side and expand on the other), and thus
$$\varepsilon_{11}=\frac{1-\nu^2}{E}\sigma_{11},$$
whereas the plane-stress case would instead yield $\varepsilon=\frac{1}{E}\sigma_{11}$.
Comment: so for a practical solution which doesn't need to be very sensitive to error, can we solve the cantilevered slab (i.e. a balcony) as in a fixed cantilevered beam deflection problem in 2D with the only difference of E is higher about 10%?
Comment: This is what the elasticity model predicts; for specific applications, especially construction, one should consult with an engineer familiar with that application and material.
Answer: If you are after the deflection of the beam at any point along the beam (but also for most intends and purposes - see below for exceptions) the problem you are after is equivalent to the following 2D case.

The concentrated load at distance $a$, can be considered as applied to the entire width of the beam, so no asymmetry is present in the system. Then you can go to a table from a resource like Design Aid 6 and get the equations

Notable exceptions would include the following:

(heavily) anisotropic materials are employed (in some of those cases it is expected to have warping and twisting which would render the application to every point non possible.
if the material is too soft, and you can expect the Hertzian pressure to affect the displacement locally at the force application point.

There might be others cases, but I already consider the above cases too exotic and unusual to be encountered, in engineering calculations that would be expected to be solved with closed form solutions.
Comment: It is a complicated case if you need an exact answer. depending on the support condition if you don't have lateral shear restrain on the support the stresses vary. the deflection is a curve under the load, not a straight line. The same phrase as your question if googled brings some sources up. If you need to compare to FEM there are sources!
Comment: Hey NMech, I appreciate the write up, however this is not what I am looking for. The key assumption that I am breaking is that the beam remains plane before and after the bending, so an aspect ratio where L is ~10+ times greater then other dimensions. Out of curiosity I ran some super general FEA compared to beam bending of a plate, the difference is ~5-15% out of line of the FEA. While this might not be a problem for most applications this surface has some high sensitivity to displacement. You might be interested in looking at Roark's text book as they have analytical solutions to many cases.
Comment: @3BeaversInATrenchCoat So if I understood what you are saying is that the beam has a very low aspect ratio and as a result you are getting something like [this](https://media.springernature.com/lw685/springer-static/image/art%3A10.1007%2Fs00707-020-02763-y/MediaObjects/707_2020_2763_Fig4_HTML.png). If that's the case, I'd suggest you put that infromation into the question, so that other people also can find it without digging into the comments. There are improved models that include shear induced rotation (e.g. Timoshenko beam).


What forces does a person experience after falling from a sixth storey building?

Question: If someone falls from a sixth storey building, with what force will he land? By this I mean to say that if he weighs 50 kg and was initially at rest before falling, which implies it was a free fall. We can easily calculate the velocity and momentum as we know the acceleration due to gravity... but with what force he will land?
Comment: f = ma, calculate the velocity then assume he decelerates to zero in a tenth of a second for a rough estimate
Comment: Depends how soft and bouncy he is :)
Answer: It is the not the $mv$ that kills you, but the $\frac{d p}{dt}$.
The ground will eventually bring you to rest, in a time $\delta t$. This can be very large for soft materials, like a bouncy castle or sponge, or very short for incompressible materials like concrete and steel.
Your momentum change $\Delta p$ from the instant before impact and rest is $0 - mv_{final} = - mv_{final}$. Hence, the ground exerts a force $F$ on you:
$$ F = \frac{dp}{dt} \approx -\frac{\Delta p}{\delta t},$$ which is negative as it needs to decelerate you to bring you to rest.
$v_{final}$ is calculated with the usual suvat equations.
What is the actual physical nature of the force? The resistance of objects to being deformed, hence the $\delta t$ dependence that I mentioned earlier. In essence this boils down to molecular bonds so it's electromagnetism.


Poco PropertyFileConfiguration undefined reference in Qt

Question: currently working on a Qt project and I'd also like to use some aspects of the Poco libraries such as the property file configuration functionality. I got the example in my code from page nine of the documentation here:
http://pocoproject.org/slides/180-Configuration.pdf
The problem is when compiling, a couple of rather oddly formatted undefined reference errors appear.
C:\projects\build-InternetofGauges-Desktop_Qt_5_5_1_MinGW_32bit-Debug\debug\webtunnelhandler.o:-1: In function `ZN16WebTunnelHandler13setConfigFileEv':
C:\projects\InternetofGauges\webtunnelhandler.cpp:41: error: undefined reference to `_imp___ZN4Poco4Util25PropertyFileConfigurationC1ERKSs'
C:\projects\InternetofGauges\webtunnelhandler.cpp:43: error: undefined reference to `_imp___ZNK4Poco4Util21AbstractConfiguration6getIntERKSs'
C:\projects\build-InternetofGauges-Desktop_Qt_5_5_1_MinGW_32bit-Debug\debug\webtunnelhandler.o:-1: In function `ZN4Poco7AutoPtrINS_4Util25PropertyFileConfigurationEEptEv':
C:\My-Devices-SDK\include\Poco\AutoPtr.h:190: error: undefined reference to `_imp___ZN4Poco20NullPointerExceptionC1Ei'
C:\My-Devices-SDK\include\Poco\AutoPtr.h:190: error: undefined reference to `_imp___ZN4Poco20NullPointerExceptionD1Ev'
collect2.exe:-1: error: error: ld returned 1 exit status

My .pro file
QT += core
QT += network
QT += sql
QT += xml
QT -= gui

CONFIG += c++11

TARGET = InternetofGauges
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

INCLUDEPATH += "C:\\My-Devices-SDK\\include" \
               "C:\\OpenSSL\\MinGW\\include"

LIBS += -L"C:\\My-Devices-SDK\\lib\\" \
            -lPocoUtild \
            -lPocoNetd \
            -lPocoNetSSLd \
            -lPocoFoundationd \
            -lPocoJSONd \
            -lPocoWebTunneld \
            -lPocoXMLd
LIBS += -L"C:\\My-Devices-SDK\\lib\\" \
            -lPocoUtil \
            -lPocoNet \
            -lPocoNetSSL \
            -lPocoFoundation \
            -lPocoJSON \
            -lPocoWebTunnel \
            -lPocoXML
LIBS += -L"C:/OpenSSL/MinGW/lib/"

SOURCES += main.cpp \
    webclient.cpp \
    startuphandler.cpp \
    webtunnelhandler.cpp

DISTFILES += \
    Todo.readme

HEADERS += \
    webclient.h \
    startuphandler.h \
    webtunnelhandler.h

The problem code in question

#include <Poco/Util/PropertyFileConfiguration.h>
#include <Poco/AutoPtr.h>

#include "webtunnelhandler.h"

using Poco::AutoPtr;
using Poco::Util::PropertyFileConfiguration;

/* ... */

void WebTunnelHandler::setConfigFile()
{

  AutoPtr<PropertyFileConfiguration> pConf;
  pConf = new PropertyFileConfiguration("WebTunnelAgent.properties");//Error appears here

  int key1 = pConf->getInt("webtunnel.httpPort");//and also here

  return;
}

Now, I've compiled all the poco libraries with MinGW and Qt is also configured for MinGW and compiles and runs great with other parts of my program. I'm also happily using Qt 5.5.1 with the 3.1.6 Qt Creator. My happiness with Qt unfortunately doesn't help my issues.
I have looked at many a stack overflow question on similar topics, and have attempted to recompile the libraries as well as explicitely include the libraries in the .pro file. I also peeked into the Auto.h file and found that it ends up calling the null pointer exception likely due to the line pConf = new PropertyFileConfiguration("WebTunnelAgent.properties"); getting angry at me.
What are the causes of this error? And how does one fix this error?
Answer: Okay so I did manage to fix it. I realized that the order of libraries does in fact matter as there are some dependencies between libraries in this case. I also had to add another windows specific library to make it work. Here's the section of the .pro file that worked
LIBS += -L"C:\\My-Devices-SDK\\lib\\" \
            -lPocoUtild \
            -lPocoNetd \
            -lPocoNetSSLd \
            -lPocoXMLd \
            -lPocoJSONd \
            -lPocoWebTunneld \
            -lPocoFoundationd

LIBS += -L"C:\\My-Devices-SDK\\lib\\" \
            -lPocoUtil \
            -lPocoNet \
            -lPocoNetSSL \
            -lPocoXML \
            -lPocoJSON \
            -lPocoWebTunnel \
            -lPocoFoundation

LIBS += -L"C:/OpenSSL/MinGW/lib/"

win32:LIBS += -lIphlpapi

As I said above, Iphlpapi is needed as well as that poco order. Hope this helps someone eventually!
Answer: Linking order of libraries matters and that has nothing to do with Poco:

the linker searches and processes libraries and object files in the
  order they are specified.  Thus, 'foo.o -lz bar.o' searches library
  'z' after file foo.o but before bar.o.  If bar.o refers to functions
  in 'z', those functions may not be loaded.
Comment: Right you are! Sorry about that one. I honestly don't know why I specified the Poco libraries versus libraries in general. I've edited the answer to reflect that.


Is there a hook for triggering scripts when a particular notification is displayed?

Question: I'm trying to set up some system behaviors to occur when particular iCal or GCal events begin and end. Is there a way to hook into the notifications system (e.g., via a LaunchAgent) to make the Mac run a script when a particular notification fires?
Note that I'm not asking about triggering a notification from a script, but rather the other way around.
Answer: In calendar.app you're able to set a file to run instead of an alert. Try creating an Automator file, and select the calendar type


EclipseLink and database encoding

Question: I am a developer for a global application, which was deployed in a few countries whose languages were not a problem for us. But now, we're going to Slovakia, and we're having a bit of trouble with EclipseLink.
We've setup a small web application to test the text encoding on the database for their project. We're able to read data using EclipseLink, which was inserted directly on the database (SQL server), but when trying to insert using the EntityManager, EclipseLink sends a bunch of unicode chars instead, which are not 'translated' by the database, but inserted as is.
I'm kinda clueless so far, since I've tried to search on EclipseLink for documentation regarding this topic, but had no luck. Can you guys share some of your wisdom regarding this? Anyone had to support other languages using ORM frameworks, and can share their experience?
Thanks in advance!
Answer: As it turns out, the issue is dealt with at the DBMS level. The tables that contain textual data need an appropriate type in order to handle unicode characters; in the case of SQL server, this type is 'nvarchar'.

EclipseLink and database encoding


Best practice javascript and multilanguage

Question: what is the best practice for multilanguage website using DOM Manipulating with javascript? I build some dynamic parts of the website using javascript. My first thought was using an array with the text strings and the language code as index. Is this a good idea?
Answer: When I've built multi-lingual sites before (not very large ones, so this might not scale too well), I keep a series of "language" files:

lang.en.js
lang.it.js
lang.fr.js

Each of the files declares an object which is basically just a map from key word to language phrase:
// lang.en.js
lang = {
    greeting : "Hello"
};

// lang.fr.js
lang = {
    greeting : "Bonjour"
};

Dynamically load one of those files and then all you need to do is reference the key from your map:
document.onload = function() {
    alert(lang.greeting);
};

There are, of course, many other ways to do this, and many ways to do this style but better: encapsulating it all into a function so that a missing phrase from your "dictionary" can be handled gracefully, or even do the whole thing using OOP, and let it manage the dynamic including of the files, it could perhaps even draw language selectors for you, etc.
var l = new Language('en');
l.get('greeting');

Comment: if you don't want to role your own implementation give http://i18next.com a try. comes with proper plural, variable support and has even a own ui for translating the app.
Comment: better
    document.addEventListener('DOMContentLoaded', function () {
        alert(lang.greeting);
    });
Comment: About performance: Wouldn't that increase the runtime memory if you have say 10000 translations that you load every time with your file. Would a function lang('myword') not be more efficient where it loads the word according to the page? – Furthermore, if you need to replace parts within the translation phrase, it is easier to have a parameter with a function.
Answer: There are a few things you need to keep in mind when designing multilanguage support:
1 - Separate code from data (i.e. don't hard-code strings right into your functions)
2 - create a formatting hook function to deal with localization differences. Allowing formattable strings ("{0}") is better than concatenating ("Welcome to" + value), for a lot of reasons:

in some languages, a number is formatted like 1.234.678,00 instead of 1,234,567.00
pluralization is often not as simple as appending an "s" at the end of the singular
grammar rules are different and can affect the order of things so you should allow dynamic data to be appended after the translation hook: for example, "Welcome to {0}" turns into "{0} he youkoso" in japanese (this happens in pretty much every language, mind you).

3 - Make sure that you can actually format strings after the translation hook runs, so you can reuse keys.
4 - Do not, under any circunstance, hook database outputs to the translator utility. If you have multilingual data, create separate tables / rows in your database. I've seen people get this no-brainer wrong fairly often (usually for countries and states/provinces in forms).
5 - Create explicit coding practices rules for creating keys. The formatter utility function (which will look something like translate("hello world") will take a key as a parameter, and keys with slight variations make maintainance very annoying. For instance, you might end up with three keys in the following example: "enter you name", "enter your name:", "enter your name: ". Choose one format (e.g. no colon, trimmed) and catch discrepancies in code reviews. Don't do this filtering programmatically, as it can trigger false positives.
6 - Be mindful that HTML markup could potentially be needed in the translation table (e.g. if you need to bold a word in a sentence, or have footnote medical references). Test for this extensively.
7 - There are several ways of importing language strings. Ideally, you should have multiple versions of a language.lang.js file, switch between them with server side code, and reference the file from the bottom of the HTML file. Pulling the file via AJAX is also an alternative, but could introduce delays. Merging language.js into your main code file is not advisable, since you lose the benefits of file caching.
8 - Test with your target languages. This sounds silly, but I've seen a serious bug once because the programmer didn't bother to check for the existence of "é" in the key.
Comment: Your advises sounds great. The only thing that concerns me, is why you're adding all the stuff about database and tables, if OP asks about **Javascript** (client-side)?
Answer: function Language(lang)
{
    var __construct = function() {
        if (eval('typeof ' + lang) == 'undefined')
        {
            lang = "en";
        }
        return;
    }()

    this.getStr = function(str, defaultStr) {
        var retStr = eval('eval(lang).' + str);
        if (typeof retStr != 'undefined')
        {
            return retStr;
        } else {
            if (typeof defaultStr != 'undefined')
            {
                return defaultStr;
            } else {
                return eval('en.' + str);
            }
        }
    }
}

After adding this to your page, you can work with it like this:
var en = {
    SelPlace:"Select this place?",
    Save:"Saved."
};

var tr = {
    SelPlace:"Burayı seçmek istiyor musunuz?"
};

var translator = new Language("en");
alert(translator.getStr("SelPlace")); // result: Select this place?
alert(translator.getStr("Save")); // result: Saved.
alert(translator.getStr("DFKASFASDFJK", "Default string for non-existent string")); // result: Default string for non-existent string

var translator = new Language("tr");
alert(translator.getStr("SelPlace")); // result: Burayı seçmek istiyor musunuz?
alert(translator.getStr("Save")); // result: Saved. (because it doesn't exist in this language, borrowed from english as default)
alert(translator.getStr("DFKASFASDFJK", "Default string for non-existent string")); // result: Default string for non-existent string

If you call the class with a language that you haven't defined, English(en) will be selected.
Comment: eval('eval(lang).' + str) give an error on Safari but works on chrome.
Is there a workaround ?
Answer: Just found a nice article about i18n in javascript:
http://24ways.org/2007/javascript-internationalisation
Although a simple google search with i18n + javascript reveals plenty of alternatives.
In the end, it depends on how deep you want it to be. For a couple of languages, a single file is enough.
You could use a framework like Jquery, use a span to identify the text (with a class) and then use the id of each span to find the corresponding text in the chosen language.
1 Line of Jquery, done.
Comment: This sounds great, but it will be getting complicated if you already use the id elsewhere or you also have another code that manipulate elements of the same id.
Answer: After reading the great answers by nickf and Leo, I created the following CommonJS style language.js to manage all my strings (and optionally, Mustache to format them):
var Mustache = require('mustache');

var LANGUAGE = {
    general: {
        welcome: "Welcome {{name}}!"
    }
};

function _get_string(key) {
    var parts = key.split('.');
    var result = LANGUAGE, i;
    for (i = 0; i < parts.length; ++i) {
        result = result[parts[i]];
    }
    return result;
}

module.exports = function(key, params) {
    var str = _get_string(key);
    if (!params || _.isEmpty(params)) {
        return str;
    }
    return Mustache.render(str, params);
};

And this is how I get a string:
var L = require('language');
var the_string = L('general.welcome', {name='Joe'});

Answer: This way you can use one js code for multi language by multi word :
var strings = new Object();

if(navigator.browserLanguage){
  lang = navigator.browserLanguage;
}else{
  lang = navigator.language;
}

lang = lang.substr(0,2).toLowerCase();

if(lang=='fa'){/////////////////////////////Persian////////////////////////////////////////////////////

        strings["Contents"]                              = "فهرست";
        strings["Index"]                                 = "شاخص";
        strings["Search"]                                = "جستجو";
        strings["Bookmark"]                              = "ذخیره";

        strings["Loading the data for search..."]        = "در حال جسنجوی متن...";
        strings["Type in the word(s) to search for:"]    = "لغت مد نظر خود را اینجا تایپ کنید:";
        strings["Search title only"]                     = "جستجو بر اساس عنوان";
        strings["Search previous results"]               = "جستجو در نتایج قبلی";
        strings["Display"]                               = "نمایش";
        strings["No topics found!"]                      = "موردی یافت نشد!";

        strings["Type in the keyword to find:"]          = "کلیدواژه برای یافتن تایپ کنید";

        strings["Show all"]                              = "نمایش همه";
        strings["Hide all"]                              = "پنهان کردن";
        strings["Previous"]                              = "قبلی";
        strings["Next"]                                  = "بعدی";

        strings["Loading table of contents..."]          = "در حال بارگزاری جدول فهرست...";

        strings["Topics:"]                               = "عنوان ها";
        strings["Current topic:"]                        = "عنوان جاری:";
        strings["Remove"]                                = "پاک کردن";
        strings["Add"]                                   = "افزودن";

}else{//////////////////////////////////////English///////////////////////////////////////////////////

strings["Contents"]                              = "Contents";
strings["Index"]                                 = "Index";
strings["Search"]                                = "Search";
strings["Bookmark"]                              = "Bookmark";

strings["Loading the data for search..."]        = "Loading the data for search...";
strings["Type in the word(s) to search for:"]    = "Type in the word(s) to search for:";
strings["Search title only"]                     = "Search title only";
strings["Search previous results"]               = "Search previous results";
strings["Display"]                               = "Display";
strings["No topics found!"]                      = "No topics found!";

strings["Type in the keyword to find:"]          = "Type in the keyword to find:";

strings["Show all"]                              = "Show all";
strings["Hide all"]                              = "Hide all";
strings["Previous"]                              = "Previous";
strings["Next"]                                  = "Next";

strings["Loading table of contents..."]          = "Loading table of contents...";

strings["Topics:"]                               = "Topics:";
strings["Current topic:"]                        = "Current topic:";
strings["Remove"]                                = "Remove";
strings["Add"]                                   = "Add";

}

you can add another lang in this code and set objects on your html code.
I used Persian For Farsi language and English, you can use any type language just create copy of this part of code by If-Else statement.
Answer: You should look into what has been done in classic JS components - take things like Dojo, Ext, FCKEditor, TinyMCE, etc. You'll find lots of good ideas.
Usually it ends up being some kind of attributes you set on tags, and then you replace the content of the tag with the translation found in your translation file, based on the value of the attribute.
One thing to keep in mind, is the evolution of the language set (when your code evolves, will you need to retranslate the whole thing or not). We keep the translations in PO Files (Gnu Gettext), and we have a script that transforms the PO File into ready to use JS Files.
In addition:

Always use UTF-8 - this sounds silly, but if you are not in utf-8 from start (HTML head + JS encoding), you'll be bust quickly.
Use the english string as a key to your translations - this way you won't end up with things like: lang.Greeting = 'Hello world' - but lang['Hello world'] = 'Hello world';
Answer:

class Language {
    constructor(lang) {
        var __construct = function (){
            if (eval('typeof ' + lang) == 'undefined'){
                lang = "en";
            }
            return;
        };
        this.getStr = function (str){
            var retStr = eval('eval(lang).' + str);
            if (typeof retStr != 'undefined'){
                return retStr;
            } else {
                return str;
            }
        };
    }
}

var en = {
    Save:"Saved."
};

var fa = {
    Save:"ذخیره"
};

var translator = new Language("fa");
console.log(translator.getStr("Save"));
Answer: For Spring bundles and JavaScript there are simple solution: generate i18n array in template (e.g. JSP) and use it in JavaScript:
JSP:

And in JS:
alert(i18n["common.deleted"]);

See also Resolving spring:messages in javascript for i18n internationalization
Answer: You can use a google translator:

<input type = "text" style = "display: inline; margin-left: 8%;" class = "sear" placeholder = "Search people..."><button class = "bar">🔎</button>


Minecraft 1.14.4 Sky Mob Farms?

Question: I just wondered if anybody truly knows why and if, how much "Sky-Mob-Farms" got nerfed in the most recent update of the game.
I read a lot of YouTube comments saying that ideally the farms should be at the bottom of the world now.
I also tried making a mob farm in creative above an ocean biome at height 160Y and I didn't manage to spawn a single mob on my spawning platform in the sky.
Are all sky-mob farms broken these days, is my best bet just lighting up all my caves and put it somewhere near sea-level?
Answer: Mob farms in the sky didn't really get made worse (or at least not much). It's still useful to build them in the sky if you don't want to light up absolutely all ground, caves and more. The reason is that mobs only spawn within 128 blocks of the player, so you can stand around AFK very high up and only have that farm in the 128 block radius.
What was changed is how the spawning algorithm goes from the bottom to the top. Previously it first tried to spawn mobs within the lowest 16 blocks of height, had a limit and some random chance there, then proceeded with the next 16 blocks and so on. Now it handles every single block of height individually, so every block that your farm is lower makes it more effective and less lag-causing. Previously it didn't matter if you had your spawning platform at height 6 or height 14, now it does.
So in summary: Building your farm slightly lower now helps, before a bit of height difference didn't matter much. Building in the sky is still easier and building very low was always more efficient.

Minecraft 1.14.4 Sky Mob Farms?


High velocity mushrooms?

Question: So y'all know meteoroites burn up in our atmosphere I'm looking for an equation or something that will allow me to calculate how fast a substance can move before it starts to burn up. Specifically I'm asking because I want to calculate the maximum velocity a mushroom can reach before it becomes a roasted mushroom.
Comment: Mushrooms aren't very good projectile materials.  Are we assuming this is a "magic" mushroom that wont disintegrate under the aerodynamic forces?
Comment: [Aerogels](https://en.wikipedia.org/wiki/Aerogel) might be better.
Comment: Mushrooms have a parachute shape, so my guess is that they have a fairly low terminal velocity.
Comment: Obligatory XKCD: https://what-if.xkcd.com/28/
Answer: XKCD's "What If?" has a related scenario worth reading, Steak drop: From what height would you need to drop a steak for it to be cooked when it hit the ground?
As noted there, getting a singed surface is not too hard, but cooking is trickier since the time spent surrounded by hot air is not long. In the mushroom case the mass is lower and the surface area higher (plus, to cook mushrooms you need higher temperature IMHO than for a steak), so the effect might be even less.
The essay refers to this page/calculator of the stagnation temperature, giving formulas that are not terribly neat but soluble.
If we use the simpler ideal formula $$T_{stagnation}= T_{static} \left[1 + M^2 \frac{\gamma-1}{2}\right]$$ (where $T_{static}$ is the temperature at that level of the atmosphere, $M$ the Mach number $v/c_s$ where $C_s$ is the speed of sound, and $\gamma=1.4$ for a perfect gas), then for a burning temperature $T_{burn}$ we can just invert it and get that $$v_{burn} = c_s \sqrt{\frac{2}{\gamma-1}\left(\frac{T_{burn}}{T_{static}}-1\right)}.$$ For at atmosphere at 300 K with $c_s=343$ m/s and $T_{burn}=477$ K (this corresponds to oven roasting of vegetables) I get 589.1218 m/s.
But this is assuming a lot about proper heat transfer: I suspect that will be imperfect (as discussed in the what if) and the necessary speed is larger. It is also worth noting that this is far above terminal velocity so unless a force is accelerating the mushroom continually it will not heat up much.
Happy cooking!

High velocity mushrooms?


Where are Email Messages Stored?

Question: I need to restore my Apple Mail messages and mailboxes from Time Machine.  Where can I find these files on Time Machine?
Answer: The Mail.app stores all Messages in your User Directory:
<code>~/Library/Mail/
</code>
Depending on your OS Version there is a Subfolder, f.e. "V3" for 10.11 and "V2" for 10.10., containing Subfolders for each Mailbox.
The Library Folder is usually hidden, but you can access it in the Finder from the Menu "Go to" > "Go to Folder" (or CMD+SHIFT+G) and typing in the Path listed above.
Answer: You can actually restore mail messages directly inside Mail. Make the Mail application active, then enter Time Machine via the menulet. Works similar to file recovery in Finder.

Where are Email Messages Stored?


what are the steps to install magento module/extension,

Question: what are the steps to install magento module/extension, what is the state of compiler? on or off and is compiler should be on after module/ extension installation ?
Answer: Generally, you would :

Turn off compilation
Back up files (optional)
Back up database if it will be affected (optional)
Turn on the cache
Upload extension files per extension developer's instructions.
Refresh the cache
Log out, then log in.
Re-enable compilation if you are using it.

That should take care of the installation.
There is a free, comprehensive guide here that has more information : http://store.fooman.co.nz/ultimate-magento-extension-guide


Can I replace an existing town's mayor?

Question: I'm asking this question because in my mayor save file, my character's eyes are a kind that I don't like. It has been bothering me for a while, but I have recently found out that you can determine your eye type with the way you respond to Rover's questions at the beginning of the game. I would like to find out if I made a different save file with the eye type that I would like, and then delete my mayor save file, would my new villager save file become mayor?
Answer: Unfortunately, it's not possible to do delete the Mayor of a town. The only option is to re-create your town.
When Isabelle asks you "Shall we get you started?" on the main screen, the process of deleting a character is usually "I need help first..." -> "Demolish my home." If you do this on any other character except for the Mayor, that character and his/her house will be removed from the game.
However, if you attempt to do this as the Mayor, Isabelle will initially freak out, and then start to cry, explaining that the town cannot function without a Mayor. Instead, she offers the suggestion that if you really want to start over, you'll have to select "Re-create the town.", which will erase both the Mayor, the town, and all of its citizens.
Comment: @HyperAnthony Coincidentally, today I had the chance to go to my brother's town, who happened to have some pilot shades. Thanks for your help! ^u^
Comment: @Animal-Crosser I dislike the appearance of my character's eyes, but I fortunately came across a pair of Pilot Shades very early on in the game and haven't had to see that blank stare since.  Check the accessory shop daily, and maybe you'll have a similar experience.
Comment: I see you mentioned you have a brother who owns Animal Crossing also. I had an issue with the way my town was set out (I didn't know I could have picked from 3 other maps!) so I went to a friend's town who I trust and gave her a whole bunch of my stuff that I couldn't possibly part with and then restarted my game. Then I went back and collected it from her. If it bothers you that much, I recommend doing that :)
The only other issue is the museum and bells you may have stacked up. Painful to catch all those things you just don't care about anymore!
Comment: I understand. So the only option for me to create a new mayor would to be demolish the town? Or is there another way to change your character's eyes?
Comment: The only aspect of your character's eyes that can be changed is the colour. After having unlocked Shampoodle's for at least 14 days, Harriet will begin to offer you the ability to change your eye colour. Otherwise, if you're only concerned about the face, it would be better to restart.
Answer: This was pretty much answered by teacupgrunge in a comment which I didn't notice before but I feel it deserves a spot as an answer on the list
If you have a friend or sibling that you really trust, ask them for help then bring all of your items you've acquired and want to keep over to their world and start over. Then go back to their town and grab all of your stuff and bring it back.
If you are far along in the game, you will lose all progress in the museum and with all the shop upgrades. So for someone like me who is considering doing this but has been playing for a month now its gonna be rough but if you are only a few days into the game I think this option would work fine.
Honestly I think this is worth it for me because I don't want to have to look at my characters ugly mug all day or wear nothing but the jesters mask 24/7. But however you want to go about it is your choice.
Answer: If you don't like your eyes or face on Animal Crossing New Leaf, then another option (other than your town) is to choose "Make Over" in the hair salon. You can then choose a Mii face as your character and it is removable.
Answer: If you don't like your face but want to keep your stuff, I suggest making another account and using a face guide, then giving some of your stuff to the new account. Then you have a fashion model to play as whenever you want, plus you still get to be mayor. It's a win-win! :D
Comment: How exactly is that a win-win? If you want to do mayor stuff, you would have to switch back and forth between your "fashion model" and mayor. I'd say, that's quite tedious.

Can I replace an existing town's mayor?


How to install a new version of ubuntu over an already double boot ubuntu/windows?

Question: here is my question:
I've installed ubuntu in a partition of the same disk where it is windows 7.
Now i've grub that allows me to choose between windows and ubuntu.
I would like to replace this ubuntu version with another fresh one because i think it is too heavy for my hardware. I don't want to install just the lubuntu desktop but i would like to perform a fresh and complete install of Lubuntu instead.
Will Lubuntu new installation replace the ubuntu without any problem? For example will i have to reconfigure grub or the new installation will manage it?
Thank you in advance.
Answer: The new installation will take care of the grub entries. Make sure to install the bootloader in the MBR.
Just be careful while partitioning because if you have only a single<code>/</code> partition, you will lose all data that is present in your present home folder. just back it up and start off with Lubuntu installation.
Comment: i'm not going to modify partition, i want to use the partition i've been using for ubuntu and erase everything in there. Is it correct/possible right?
Comment: yes. that is completely possible.
Comment: Ok, i would like to flag this post like "answered" but i cannot do it because i'm a novice. Thank you! Bye


Staining pine table top how can I get rid of this spot

Question: How can I get rid of this spot? I sanded and thought I had gotten rid of it. I did not use mineral spirits before applying stain. Any idea on how to get this spot to darken?
Comment: That's classic stain 'stand out' and generally there's only one sure way to get the wood to absorb stain and that is to plane/scrape/sand enough material from the surface that you get below the contamination.
Answer: That's caused by some sort of contaminant getting on the surface (perhaps a glue drip?)  While sanding will work, I find the best thing to do is to use a wood scraper such as these scrapers to isolate the removal of the substance to just the area (instead of the whole table).


How do I convert a verb to adjective?

Question: I want to say "You need activate added user." but I don't know why I say it. I don't know any rule for which I can say added user.
Answer: Past Participles are used as attributive: adjectives placed in front of a noun.

The stolen baby was found by the police unharmed.

Dean's broken arm was set in plaster by the doctor at the hospital.

The required steps are clearly listed in the email I sent you.

In your case, you could say "You need to activate the added user." if you are talking of a user account previously added that needs to be activated.
Answer: Most past participles can be used as adjectives. An added user is a user that is added or that has been added. So you can say "you need to activate the added user". Note that you need to use the article the since you are refering to a specific user that has just been mentioned.
However I find this formulation awkward, although I can't articulate why. I prefer "the newly added user" (or more wordy alternatives such as "the user that you just added" or "the user [who was] added in step 3").
Comment: I agree the unqualified ***added*** sounds somewhat clumsy/unnatural in OP's context. It's okay in "ad-speak" *(breakfast cereal "with no added sugar", skimmed milk "now with added calcium", etc.)*, but they're in the sense of "additional ingredient", not "inserted into database".

How do I convert a verb to adjective?


Who owns the rain water in a federal state?

Question: I have read that in federal states like Australia and the US underground water belongs to the government. Unauthorized borehole being illegal even if you are the owner of the land. What is the case with rain water in these countries? Are you free to collect that or does that also belong to the government?
Comment: This issue intersects another issue: **theft of sewage services**. When a city provides water and sewer, water is metered and sewer is not - it's presumed to be approximately the volume of water purchased.  When you collect rain or ground water, that monkey-wrenches that metering/billing system, so the city has a stake in asking "are you putting this down the drain?"
Comment: A factory canning, say, soup, could separate their city water consumption for cleaning equipment, washrooms for employees, etc,  and water hat winds up in the soup can.  They can then avoid the sewage portion of the water bill on the latter water consumption.
Answer: Water ownership (rights) in the US is determined by local law, and things can be different for catching rainwater vs. extracting underground water. In Washington state, you have to have a right to take any amount of surface water, but you can take state underground water without a right in amounts less that 5,000 gallons per day (non-agricultural) or non-commercial irrigation of a half-acre or less. Collection of rainwater is managed at the county level and depends on purpose. In general (by policy of the Dept. of Ecology which is authorized to interpret the law in this domain), you can collect rainwater if it is used on the property where it is collected, but it must be collected from a structure with a different purpose (e.g. runoff from a roof, not a structure simply designed to scoop up all of the rainwater). Your county can prohib you from drinking it. This paper (360pp) emitted by the AG in 2000 gives various details about water law in Washington.
But ultimately, nobody owns the water. You can temporarily use it, but when you're done with it it can be temporarily used by someone else, and you cannot reclaim the water as your rightful property. Once the water flows out of the state, not even the state government exercises control over the water unless there's relevant inter-state law about water usage (which there is).
Comment: Off course ownership and usage rights is not the same. I realise that now


How can I disable the screenshot feature from a keyboard that has the "print screen" button?

Question: I'm using MacOs with a Logitech ergo k860, which has a "print screen" button.
Since is very near to the backspace button I'm often pressing it by mistake. Is it possible to tell MacOS to ignore the signal that is sent from the keyboard?
Answer: You can use hidutil to remap the PrtScr to something else.
I wrote a very similar answer and provided a shell script that simplifies this command. You can copy and paste to your system.  You just need to change the SOURCE and DESTINATION variables. For this, you'll need the hex values of the keys to be remapped.  I've provided them below:

PrtScr = 46
Backspace = 2A

(These are just the last 2 digits of the hex value for simplicity: i.e. 0x700000046)
Just replace the Print Screen key another Backspace key and when you press it (incorrectly), will be like Backspace was pressed instead. Alternatively, you can set it to the Null value (00) to make it do nothing.
Comment: Not exactly a drop-in solution. I suppose you're alluding to something like this which is not formatted correctly: hidutil property --set '{"UserKeyMapping": [{"HIDKeyboardModifierMappingSrc":0x70000002A, "HIDKeyboardModifierMappingDst":0x700000046}]}}'. Hard to know if I'm mapping my backspace to print screen or vice versa....
Comment: Thanks for this answer. I will soon dig into it to see if it helps me answer https://apple.stackexchange.com/questions/461781/using-a-windows-keyboard-how-can-i-map-the-print-screen-button-to-open-flames.
Comment: FYI, that comment is backwards, and turns the backspace key into something else.
Answer: Alternately, if you install Logitech Options+, you can just map the Print Screen key to execute no action.


Loop group and affine grassmannian

Question: Suppose $G=GL(n) $ and let $LG$ be the loop group and $Gr_{G}$ be the affine grassmanian. It's a fact mentioned in books and notes on affine grassmanian that these are not schemes but rather ind-schemes. My question is that how do we see that $LG$ and $Gr_{G}$ are not schemes, which properties of a scheme do they not satisfy.
Answer: I don't want to be too trite, but they lack the property of being schemes. There are no locally ringed spaces with open coverings by affine schemes representing $LG$ or $Gr_G$.
Given that $LG$ and $Gr_G$ are ind-schemes, there is a notion of open immersion, so we could rephrase the above to say: There is no surjective morphism $U \to LG$, resp. $U \to Gr_G$, such that $U = \coprod U_i$ is a disjoint union of schemes, and each $U_i \to LG$, resp. $U_i \to Gr_G$, is an open immersion.
If you're asking for a proof of non-representability, I'm still pretty new at this and I don't have one right now. But it should be immediately clear by construction, at least for $LG$, that it is not a subscheme of infinite-dimensional affine space.

Loop group and affine grassmannian


Can I replace the main breaker in an electrical panel with a smaller one?

Question: I have an older 60amp fuse box in a rental property that is wired as a sub panel off my main 100amp service. I would like to upgrade to a new circuit breaker panel so tenants can not pull out the 15amp fuse and up size it. The only box I can find at my local hardware store is rated 100amp (main lug and main breaker). If I replace the 100amp breaker in the box I found with a 60amp breaker would that be fine? I assume that the box is rated up to 100amp but anything lower would work too.
Answer: You will also likely need to replace the cable with larger gauge wires, though without knowing what's there right now it's impossible to say for sure.  Also, whenever you replace old electrical equipment, you are generally required to adhere to the latest code, so it's possible there are other changes you will need to make too.  This might include AFCI breakers.
If you are unsure, always best to check with a licensed electrician.
Answer: Yes, "down-rating" panels by installing a lower amperage main breaker of a type that meets the panel's listing is fine -- in fact, you can often order the exact same panelboard from the factory with different main breaker amperage options, or main lugs -- and then change it out freely in the field depending on installation conditions.
Answer: Electrically, that's fine. I have no idea whether code would object.


Not able to activate conda environment through os.system command in python

Question: I want to activate activate a conda environment before running my python file through os.system command, but unfortunately, I am not able to activate the conda environment.
Following is the command I am trying to implement:
import os
command="python run.py"
foldername="/home/ritish/DeepSpeech/DeepSpeech-master/20140421/test_folder/Test_on_Voice/core_files/raw_file"

files=list(os.listdir(foldername))
if files:
    os.system("conda activate deepspeech3")
    os.system(command)
else:
    print("No Files to Run")

I am getting the following error:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

 * Serving Flask app "core_files" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 119-628-161

Answer: Maybe you can try this:
os.system('/bin/bash/ -c "source ~/miniconda3/etc/profile.d/conda.sh && conda activate deepspeech3 && your command"')

~/miniconda3/etc/profile.d/conda.sh is the path where your Anaconda/miniconda is installed.


Will there be two Mashiachs?

Question: I've always thought that the Mashiach is one. But I recently heard from a friend that there is Mashiach ben David and Mashiach Ben Yoseph. And that one will bring the jews from the diaspora and the other will reconstruct the Temple or something like that. I don't know the sources of this and I've never heard anything like this, but is this true in some way?
Comment: http://judaism.stackexchange.com/questions/49030/does-the-idea-of-moshiach-ben-yosef-negate-the-anti-missionary-argument-against
Answer: Well, according to our tradition, the term "Mashiach" describes the anointed monarch. So, we are waiting for the monarchy to be restored, with everything related - full independence and religion freedom(e.g. freedom from idolatry).
In our sources it is said that IF we merit to get the glorious ruler - we'll get Mashiach ben David, but if we not - we will get Mashiach ben Yosef - e.g. the hidden one, like in Egypt.
But any way if it will be Moshiach ben Yosef, afterwards will be Moshiach ben David for sure - as it is predicted by our prophets.
So, we are waiting for the monarchy, but it could be established not necessarily  straight ahead.

Will there be two Mashiachs?


strange result in simple arithmetic using eclipse (java)

Question: When i want to calculate

0.9623 - 0.9619

it returns:

4.0000000000006697E-4

Why is that? and how can i avoid this?
I tried casting to float but didn't helped.

  System.out.println(0.9623 - 0.9619);

prints to console:

4.0000000000006697E-4
Comment: [Compulsory link](http://floating-point-gui.de/).
Comment: Because not all decimals can be represented in binary. The 6697 at the end is the error.
Answer: It prints the correct answer. 4.0000000000006697E-4 is 4.0000000000006697 * 10^(-4) which is 0.0004, your expected answer.
You could use DecimalFormat df = new DecimalFormat("#.####"); to make the compiler show just four decimal places. Here is a good example
Answer: This is normal.
You are returning a double in scientific notation.
The println method in this case will print out the equivalent of String.valueOf(yourDoubleValue)
Real literals are implicitly interpreted as primitive doubles unless specified otherwise.
To force interpretation to float you need to append f to your literals, although it won't change the fact that your result will be printed in scientific notation and with possible loss of precision:
System.out.println(0.9623f - 0.9619f);

Output
4.0000677E-4

I suspect what you ultimately want to print is:
System.out.println(new BigDecimal("0.9623").subtract(new BigDecimal("0.9619")).toPlainString());

Output
0.0004

More on BigDecimal here.
Answer: I don't know the context of your code but if decimals are important in your case, I would consider using BigDecimal especially if it's for financial apps. You can configure the rounding mode and have a better precision.
Answer: Use System.out.printf("%.4f",0.9623 - 0.9619); which will print the number with 4 decimal places. BigDecimal does tend to be overkill, and has a significant time penalty if you are doing a lot of mathematical calculations.


US Bequest Taxation

Question: Is there some summary article on using variation in US bequest taxation as natural experiments? Has there been variation over time or over different states? Is there perhaps a paper that already has used this?
Answer: Australia

In 1979, Australia abolished federal inheritance taxes. Using daily
  deaths data, we show that approximately 50 deaths were shifted from
  the week before the abolition to the week after. This amounts to over
  half of those who would have been eligible to pay the tax. Although we
  cannot rule out the possibility that our results are driven by
  misreporting, our results imply that over the very short run, the
  death rate may be highly elastic with respect to the inheritance tax
  rate.

Did the Death of Australian Inheritance Taxes Affect Deaths?
Sweden

Does taxation affect the timing of death? This is an interesting
  example of how behavior might be affected by economic incentives. We
  study how two changes in Swedish inheritance taxation 2004–2005 have
  affected daily all-cause mortality. Our main result is that mortality
  decreased by 17% the day before the expected tax repeals began.

Living to save taxes
USA

This paper examines data from U.S. federal tax returns to shed light
  on whether the timing of death is responsive to its tax consequences.
  We investigate the temporal pattern of deaths around the time of
  changes in the estate-tax system periods when living longer, or dying
  sooner, could significantly affect estate-tax liability. We find some
  evidence that there is a small death elasticity, although we cannot
  rule out that what we have uncovered is ex post doctoring of the
  reported date of death.

Dying to Save Taxes: Evidence from Estate-Tax Returns on the Death Elasticity

US Bequest Taxation


Quartz Trigger new thread?

Question: Does a quartz scheduler create a new thread for each of the triggers or only a single thread which takes care of all the threads ?
Answer: Quartz uses a configurable thread pool to execute the scheduled tasks. So threads should be recycled between the job executions. How many threads there are in parallel can be configured as is described here:
http://www.quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigThreadPool
As you can give implementations to the ThreadPool interface yourself, you can, however, deviate and generate a "ThreadPool" that does no pooling at all. (The Interface to implement is described here: http://www.docjar.com/docs/api/org/quartz/spi/ThreadPool.html)

Quartz Trigger new thread?


Is it true that under certain conditions, Mg can reduce SiO2?

Question: Is it true that under certain conditions, Mg can reduce $\ce{SiO2}$ and the latter the former? What are those conditions?
Comment: http://meta.chemistry.stackexchange.com/q/261/4945 and http://meta.chemistry.stackexchange.com/questions/253/should-we-revisit-the-url-slug-issue
Comment: Take a look at the link of the question you've asked. And take a look at [this meta post](http://meta.chemistry.stackexchange.com/questions/149/ce-prepended-to-equations-in-url-slug/151#151).
Answer: Yes it is true.
Conditions are temperature in the 650 to 850 degrees C range.
There is a cool looking youtube video of the reaction, not that that makes it true.
For a more serious discussion see Production and Purification of Silicon by Magnesiothermic Reduction of Silica Fume
and Ordered Mesoporous Silicon through Magnesium Reduction of Polymer Templated Silica Thin Films
Answer: Yes, it is true below $\pu{1683 K}$, the melting point of silicon, the $\Delta_\mathrm{f}G^\circ$ curve for the formation of $\ce{SiO2}$ lies above the $\Delta_\mathrm{f}G^\circ$ curve for $\ce{MgO}$, so, at  temperature below $\pu{1683 K}$, $\ce{Mg}$ can reduce $\ce{SiO2}$ to $\ce{Si}$.
On other hand, above $\pu{1683 K}$ the $\Delta_\mathrm{r}G^\circ$ curve for $\ce{MgO}$ lies above for $\ce{SiO2}$, hence at temperatures above $\pu{1683 K}$, $\ce{Si}$ can reduce $\ce{MgO}$ to $\ce{Mg}.$


Does LAPACK offer routines for Krylov sub-space based solvers and nonlinear solvers?

Question: I have skimmed through the LAPACK user guide, but I could not find if LAPACK offers routines for Krylov Subspace based methods (such as CG or BiCGSTAB etc) and Newton method based nonlinear solvers. Also, are iterative methods available in LAPACK in general?
Answer: As far as I know, there are no such methods in LAPACK. Since LAPACK is the linear algebra package, no nonlinear solvers are included.
However, you can use the underlying BLAS for implementing iterative methods. For nonlinear solvers using Jacobians (e.g., Newton's method), the matrix factorizations of LAPACK may come in handy.
You may want to have a look at PETSc, though. This library implements many iterative methods (e.g., CG, GMRES, BiCG) and nonlinear solvers (e.g., Quasi-Newton, trust region Newton, Richardson / Picard iteration, Anderson mixing).
Comment: Thank you for the response. I actually use PETSc and SLEPc for my research, but I just wanted to confirm if LAPACK has any such implementations.
Answer: LAPACK doesn't include any iterative solvers.  The routines in LAPACK are for eigenvalues, matrix factorizations, and solutions of systems of equations involving dense matrices while iterative methods are generally used for matrices that are large and sparse.