Confusion regarding wavelength of stationary waves

Question: Imagine, we have an air column and the the temperature of the air was the same outside and inside the column. If sound waves from a tuning fork then enters the air column, the speed of the standing wave would have to be the same as the waves outside the pipe as well. We know, that for a STANDING WAVE, its wavelength is determined by the geometry of the pipe. Since frequency must be constant, in this case, how would then the wavelength of the standing wave change to ensure the wave speed is constant, assuming resonance takes place? What if the geometry of the air column was such that the wavelength could not be setup to keep the wave speed constant? Or is this scenario not even possible? If so, why not?
Answer:
Since frequency must be constant, in this case, how would then the wavelength of the standing wave change to ensure the wave speed is constant, assuming resonance takes place?

The wavelength of the standing wave won't change. What will change will be how efficiently the wave from outside couples to the standing wave resonance.
The acoustic impedance at the point of excitation of the column will depend on length of the column relative to the standing wave wavelength. The coupling from free air to the standing wave will depend on the ratio between the free air impedance and the impedance of the column. If the coupling is inefficient, part of the wave will scatter away from the column rather than contribute to the standing wave.
Answer: I believe your reasoning is fundamentally wrong.
What is wrong?
The fundamental wave equation relating wave propagation speed, $c$, frequency, $f$ and wavelength $\lambda$ is
$$ c = \lambda f \tag{1} \label{wave-speed} $$
Despite the relation shown in equation \eqref{wave-speed} the quantities included cannot change arbitrarily. It is known that wave propagation speed $c$ depends solely on the medium of propagation for linear waves in non-dispersive media. For completeness stating the generic form of the equation to be that of equation \eqref{generic-wave-speed} below
$$ c = \sqrt{\frac{B}{\rho}} \tag{2} \label{generic-wave-speed} $$
where $B$ represents the internal forces of the medium in some sense (for example in fluids it is the bulk modulus and strings the tension) and $\rho$ the density of the medium (in the generic 3D case it is the volume velocity but for 1D strings it is the linear density).
This means that for the speed of sound to change one should change the medium of propagation. This means that the left hand side of equation \eqref{wave-speed} won't change in your problem.
What is left to change is the wavelength $\lambda$ and frequency $f$. For the equation to hold though they must change in a reciprocal way so that their product will remain constant (for the equation to hold). As you already stated in the question, the frequency $f$ is a characteristic of the source and cannot change arbitrarily (at least for linear waves). This leads us with the conclusion that neither the wavelength $\lambda$ can change since $f$ does not change.
What is happening
In order to reach a description of the phenomenon that will take place we have to resort to forced oscillations since this is what is actually happening (you excite a system with some external excitation function).
From a macroscopic point of view, the description of the phenomenon is this: The source will excite the pipe system at whatever frequency the source radiates. If the frequency happens to coincide with one of the natural frequencies of the pipe then the amplitude will be maximised. Otherwise the amplitude will be smaller.
One could very well ask "how smaller is smaller"? For an "ideal" system with no attenuation the amplitude will be infinite at a very specific frequency but this is as far from reality as you can get. There is no system without losses, which when present in the system will both reduce the maximum attainable amplitude and broaden the resonance curve. This behaviour is depicted in the following image (source: Acoustics - An Introduction by Heinrich Kuttruff).

Note that higheq $Q$ values represent lower losses in the system. As you may be able to see when there are high losses in the system the amplitude does not change significantly when you move away from the resonant frequency. Thus, for a realistic system (at least in a first order approximation sense) you will see amplitude being increased when closing in to the resonant frequency and dropping when you move away, with the exact amplitude being dependent on the characteristics of the system.
Impedance
To parallelise this explanation to the (very well expressed) one in another answer, when you reach the frequency of excitation comes closer to the natural frequency of the system, the impedance presented by the pipe will become smaller and will go closer to that of the surrounding air. In the ideal case with no losses, the impedance will become equal to that of the air and all energy will go "into" the pipe system and this is why the amplitude will become infinite.
In the more realistic system with losses, at resonance (excitation frequency becomes identical to the natural frequency of the system) the impedance presented by the pipe will go as close as possible to that of the surrounding (or that of the source if the latter is attached to the pipe) and the energy transfer towards the system will become maximum.


How to handle AllServersUnavailable Exception

Question: I wanted to do a simple write operation to a Cassandra instance (v1.1.10) on a single node. I just wanted to see how it handles constant writes and if it can keep up with the write speed.
pool = ConnectionPool('testdb')
test_cf = ColumnFamily(pool,'test')
test2_cf = ColumnFamily(pool,'test2')
test3_cf = ColumnFamily(pool,'test3')
test_batch = test_cf.batch(queue_size=1000)
test2_batch = test2_cf.batch(queue_size=1000)
test3_batch = test3_cf.batch(queue_size=1000)

chars=string.ascii_uppercase
counter = 0
while True:
    counter += 1
    uid = uuid.uuid1()
    junk = ''.join(random.choice(chars) for x in range(50))
    test_batch.insert(uid, {'junk':junk})
    test2_batch.insert(uid, {'junk':junk})
    test3_batch.insert(uid, {'junk':junk})
    sys.stdout.write(str(counter)+'\n')

pool.dispose()

The code keeps crushing after a long write (when the counter is around 10M+) with the following message
pycassa.pool.AllServersUnavailable: An attempt was made to connect to each of the servers twice, but none of the attempts succeeded. The last failure was timeout: timed out
I set the queue_size=100 which didn't help. Also I fired up the cqlsh -3 console to truncate the table after the script crashed and got the following error:
Unable to complete request: one or more nodes were unavailable.
Tailing /var/log/cassandra/system.log gives no error sign but INFO on Compaction, FlushWriter and so on. What am I doing wrong?
Comment: Do you see excessive CPU or disk usage on that node?  It's possible that the JVM garbage collection isn't handling it well, although I would expect the logs to show something about that.
Answer: I've had this problem too - as @tyler-hobbs suggested in his comment the node is likely overloaded (it was for me). A simple fix that I've used is to back-off and let the node catch up. I've rewritten your loop above to catch the error, sleep a while and try again. I've run this against a single node cluster and it works a treat - pausing (for a minute) and backing off periodically (no more than 5 times in a row). No data is missed using this script unless the error throws five times in a row (in which case you probably want to fail hard rather than return to the loop).
while True:
  counter += 1
  uid = uuid.uuid1()
  junk = ''.join(random.choice(chars) for x in range(50))
  tryCount = 5 # 5 is probably unnecessarily high
  while tryCount > 0:
    try:
      test_batch.insert(uid, {'junk':junk})
      test2_batch.insert(uid, {'junk':junk})
      test3_batch.insert(uid, {'junk':junk})
      tryCount = -1
    except pycassa.pool.AllServersUnavailable as e:
      print "Trying to insert [" + str(uid) + "] but got error " + str(e) + " (attempt " + str(tryCount) + "). Backing off for a minute to let Cassandra settle down"
      time.sleep(60) # A delay of 60s is probably unnecessarily high
      tryCount = tryCount - 1
  sys.stdout.write(str(counter)+'\n')

I've added a complete gist here


Clip .hdf (MODIS) rasters by shapefile

Question: I am trying to do a temporal analysis on vegetation quality so I downloaded a MODIS .hds raster from earthexplorer.
When I opened the file into ArcMap 10.2.2, it came as a group of 11 rasters.
I stuck on clipping those rasters by my shapefile and combining them into one. (tried, clip raster by shapefile, composite bands...)
Answer: Clipping *.hdf files in ArcGIS may not be a good idea as ArcGIS doesn't deal with HDF files very well. I would recommend you convert the HDF files into some other formats (eg, tif) first and then clip them in ArcGIS.
Comment: Hi. Thanks for the kind answer. I found this little tool called Modis Reprojection Tool, that helped me with MODIS data instead. It can be found here: https://lpdaac.usgs.gov/tools/modis_reprojection_tool

Clip .hdf (MODIS) rasters by shapefile


Is it possible to crack any MD5 hashes (without salt)?

Question: We all know currently MD5 hash can be cracked but I was wondering if any hashes can be cracked since most crackers are searching in their database instead of cracking, so let's pretend we get a document that has near 1400 characters and we generate an md5 hash, is it possible to get the document by cracking the hash or the hash cracker can only crack short string?
Answer: "Cracking" a cryptographic hash doesn't mean recovering the original document. Since there are an infinite number of potential original documents for each hash value, that's never possible. Cracking a hash means finding some document that generates the hash, whether or not it's the original one. And yes, it's possible that MD5 can be cracked in this way -- it's not recommended for use.
Comment: `And yes, MD5 can easily be cracked in this way.` only for low-entropy predictable values, the best preimage attack for MD5 still has complexity over 100 bits
Comment: @AndrolGenhald Yes, I've edited the answer to acknowledge this.


Costs of storing an empty dynamic array of length 2**256-1 vs length 4

Question: If the array is completely empty, is it more expensive to store uint[] of length 2**256-1 vs of length 4?
Comment: If the array is completely empty, then its length is 0. So please clarify what you mean.
Comment: with empty, foo[1], foo[2], foo[3] are not set to any value
Comment: Also, what do you mean by "expensive to store"? The cost is inflicted when you actually change a value in the array, not for keeping that value in there.
Comment: If you don't set them to any value, then how can the array length grow?
Comment: foo.length = 2**30
Comment: Well, you pay gas changing array values (to non-zero values), so - no. That shouldn't cost you anything.
Answer:
if the array is only being used below foo[n], and the length is longer than n, is anything above foo[n] adding storage costs?

No.
Arrays use the same storage scheme as mappings. The slots to write to are hashes of the contract address, the position of the variable established at compile-time, and the index. Uninitialized values are not written and they will return 0x00... if accessed. For clarity, Solidity arrays enforce a rule that a contract can only access indexes < length, i.e. don't go past the end.
Generally, the EVM and Solidity are very conservative about writes and they won't reorganize data unless your contract tells them to.

is anything above foo[n] adding storage costs?

Not if there is nothing there.
Try this:
pragma solidity 0.5.16;

contract ArrayStuff {

  bytes32[] d;

  function makeHuge() public {
      uint massive = uint(0)-uint(1); // biggest uint possible
      d.length = massive;
  }
}

You can see it takes about 42K gas to make a huge array.
There are some caveats about doing that. In theory, you have indexes to all of the slots. You can potentially scribble over anything if you can find the right hash collision. In practice, it would be prohibitively challenging to work out the index that will hash to the right slot in order to stomp on anything in particular.
Here's the hash function: https://solidity.readthedocs.io/en/v0.6.1/miscellaneous.html#mappings-and-dynamic-arrays
Hope it helps.
Answer: For storage it should be the same.
I presume you're asking theoretically.  If you actually create one of these things, it will enable you to access the whole of the storage available to the contract via the array - which means you could overwrite other storage variables.  I've seen this trick used a few times in "Hack this contract" competitions, and is one reason you should be very careful with variable sized arrays.
Comment: although changing the length of the array will invoke one SSTORE each time
Comment: the choice is between a longer array (not 2^256, more closer to 2^33 or practically usually 2^20), or, more frequent increase of the length. a better way to ask is, if the array is only being used below foo[n], and the length is longer than n, is anything above foo[n] adding storage costs?
Comment: so I ran some tests with this:  ```contract ArrayLengthGasTest {

    uint[] array;

    constructor (uint256 length) public {
        array.length = length;
    }
}```  with longer lengths there was *very slightly* more gas cost in the transaction, but this is because solidity charges *per byte* for non-zero transaction data.  It's basically negligible.
Comment: and if you really want an array of 2^20 elements, you should possibly look into `mapping`s which might suit you better.  I dread to think how expensive fully populating an array that big would be!!
Comment: it's populated per transaction per person. so, not very expensive. yes a mapping might be better, I had to use an array initially but have reworked the structure of the contract a bit so now it can be treated differently, and a mapping would be better. already made that change after your answer :)
Comment: *not very expensive per function call and caller


Jquery Image Rotator with iPhone-like Page dots

Question: I need a jQuery Image Rotator that rotates 4 images (fades in/out every 5 seconds or so), but it has the iPhone page dots to show which one is currently shown (Example of Dots). How would you do this? Any help would be appreciated.
Answer: Check out jQuery Tools scrollable:
http://flowplayer.org/tools/demos/scrollable/plugins/index.html
You could set up the container to only show one image a time instead of five, and use the navi plugin. Or roll your own, all you'd really need to do is match the index of the image shown to the index of a list item and assign an "active" class....
Answer: You can use Nivo Slider for this with small modifications.
Answer: I think any rotator with navigation could be easily made to look like this (replace the navigation text with bullets or images) such as:
http://www.gmarwaha.com/jquery/jcarousellite/#demo
(scroll down and click "Image Slider - External Controls" on the right navigation column for an example)
Another option may be the offerings that http://jqtouch.com/ provides.


Collisions in CSMA/CD Ethernet

Question: I am confused about collisions in CSMA/CD Ethernet. When would a jam signal be sent? Why are jam signals sent? If two simultaneous packet transmissions interfere with each other, the two transmitting nodes can know that the voltage is oversized so they can end their transmissions and then transmit a 32 bit jam signal, but why? Can someone write all the events one by one in time sequence?
Comment: does this need the "homework" tag?
Answer: First, beware that modern switched Ethernet LANs are not CSMA/CD anymore. CSMA/CD was a technique that applied to 10mbit/sec and 100mbit/sec Ethernets that used hubs, not switches. And honestly there were never many 100BASE-TX hubs around; everyone went to switches around that time. The Gigabit Ethernet (1000BASE-T) spec requires switches; there's no such thing as a GigE hub.
On modern switched Ethernets, you don't have a shared medium anymore. When you're plugged into a switch, the "collision domain" is only between you and your switch port. And if you're in full duplex mode, which is almost always true with switches, then you don't have any possibility of collision at all. If you can't have a collision, you'll never detect a collision, so you'll never have reason to transmit a jam signal.
So back in the days of hubs (and shared cables like thinnet/cheapernet/10BASE-2 coax and thicknet 10BASE-5), here's how it worked:
Imagine you have a large 10BASE-T LAN with lots of hubs and max length cable runs, maxing out the "repeater rule" of maximum 4 repeaters (hubs) between any two devices on the LAN. Due to signal propagation delays across the hubs, it can take the IEEE spec maximum of 232 bit-times for a signal transmitted from Host A to reach the furthest host on the network (Host B).
Now imagine Host A begins transmitting a frame, and by bad luck, Host B, way at the other end of the network, 232 bit-times away, begins transmitting a frame just 231 bit-times after Host A started transmitting. Because of propagation delays on the network, Host B didn't know that Host A was already 231 bits into its transmission when Host B sent the first bit of its preamble. Now Host B will detect this collision within the first, say, 32 bits of Host B's transmission, which could be about 232 to 264 bit-times sooner than Host A will detect it. If Host B happened to detect it on the first bit of transmission, and just stopped transmitting the moment it detected this collision, then it might not have stayed on the medium long enough for Host A to also detect it and realize that a collision occurred (you can't guarantee that the receiver will detect the collision on the very first bit of the collision). That would then mean that Host A would not know to do the right collision-handling procedure. So rather than just stop transmitting, Host B transmits the Jam signal so that it stays on the medium long enough to make sure Host A realizes that a collision occurred.
This is also the reason that Ethernet frames have a minimum length of 64 Bytes. This guarantees that Host A stays on the medium long enough that a collision can be detected all the way on the other side of the network, and the Jam signal from Host B can make its way all the way back across the network, so that Host A is still on the medium when the Jam signal comes through, so it is able to realize that someone collided with its transmission.
Comment: @Ashwin The switch would have to buffer one of the two frames it was receiving simultaneously (on two separate ports, so no collision) and the send one before the other to the destination host.
Comment: @GeorgeRobinson The IEEE did not remove the 64 byte minimum frame size requirement even though it does not serve as much of a purpose on switched Ethernet as it did on old half duplex hub-based networks.
Comment: Is csma/cd not required in full duplex connections? if yes, then why? Agreed that sending and receiving is done in two sparate cables, so there will be no collision if a device is sending and receiving at the same time. But what if a device receives data from two sources at the same time? Then there will be collision right?
Comment: Does this mean that in full duplex, switched Ethernet networks a Ethernet frame no longer needs to be at least 64 bytes? Secondly, if the gigabit Ethernet is full duplex, is there even a minimum frame size for gigabit Ethernet?

Collisions in CSMA/CD Ethernet


Watch showing Mars time

Question: Is it possible to for the mechanical workings of a watch to be changed such that it ends up showing Mars time?
Is the answer same for both a quartz and a mechanical watch?
Comment: Why do you think it might not be possible?
Comment: What do you define as "the time on Mars"? Earth has 24 time zones. Which of those is the official time of Earth to you? If you want to know how the equivalent is define for Mars, see https://en.wikipedia.org/wiki/Timekeeping_on_Mars. If all you want is a clock that runs slightly slower, of course that can be done, but it won't show "time on Mars".
Comment: just change the gear ratios for a 24 hour 39 minute 35 second day instead of a 24 hour day.
Answer: Based on CuriousOne's comments, and on Timekeeping on Mars

The average length of a Martian sidereal day is 24h 37m 22.663s (88,642.66300 seconds based on SI units), and the length of its solar day (often called a sol) is 24h 39m 35.24409s (88,775.24409 seconds). The corresponding values for Earth are 23h 56m 4.0916s and 24h 00m 00.002s, respectively. This yields a conversion factor of 1.0274912510 days/sol. Thus Mars' solar day is only about 2.7% longer than Earth's.
A convention used by spacecraft lander projects to date has been to keep track of local solar time using a 24-hour "Mars clock" on which the hours, minutes and seconds are 2.7% longer than their standard (Earth) durations. For the Mars Pathfinder, Mars Exploration Rover, Phoenix, and Mars Science Laboratory missions, the operations team has worked on "Mars time", with a work schedule synchronized to the local time at the landing site on Mars, rather than the Earth day. This results in the crew's schedule sliding approximately 40 minutes later in Earth time each day. Wristwatches calibrated in Martian time, rather than Earth time, were used by many of the MER team members.

With of the quartz clock, you could adjust the stepping motor to coincide with the length of a Martian day.

From Quartz Clock

Battery provides current to microchip circuit

Microchip circuit makes quartz crystal (precisely cut and shaped like a tuning fork) oscillate (vibrate) 32768 times per second.

Microchip circuit detects the crystal's oscillations and turns them into regular electric pulses, one per second.

Electric pulses drive miniature electric stepping motor. This converts electrical energy into mechanical power.

Electric stepping motor turns gears.

Gears sweep hands around the clockface to keep time.

For mechanical clocks, again,  as suggested above, an alteration in the gearing could allow for Martian day lengths.

Watch showing Mars time


Would a Nikon D70 with 70-300 lens be adequate for photos of my kids' sporting events?

Question: I don't have a lot of extra money but I am able to trade for this camera or pay $200. Would this camera be adequate for taken pics of my kids on the soccer/baseball/track fields? I really want a camera and can't afford the big money cameras. Do you think this would camera would work?
Comment: I have a point and shoot camera just didn't want to waste money on a camera that
Comment: It all depends on what type of quality you want. And also be aware that the D70 only accepts Compact Flash cards, although they are easy to find, and not very expensive (about the same as SD for the same capacity, although the CF cards usually have faster read/write speed)
Answer: It'll be great for daytime outdoor sporting events.
It won't be as good for night-time or indoor sporting events.  The reason for this is that for sports you ideally want fast shutter speed of 1/500s or better in order to freeze the motion.  Indoors, or under lights, you won't get that with that zoom lens.
Flash doesn't help at sporting events because the distance is too far, and image stabilisation doesn't help because it won't do anything for motion blur caused by the players moving.
If you find you have to shoot something like that indoors or at night, then you're mostly out of luck, I'm afraid, unless you want to spend significantly more.  You may get some success with a 105mm f/2.8 or something but it won't zoom, and other than that you'll be up for $$$$ to get a fast enough tele or zoom.
That said, your chosen lens will be better than any compact camera would be at an indoor or night sporting event - even a "superzoom" or "bridge" camera.
In other words, it's the best you can get without spending many times as much - which may not be worth it.  What you have will be great during the day, and you will get good shots with it.
Comment: well said. Was about to post pretty much the same when I read your answer. Owning a D70s myself, I can vouch for it as being a reliable, robust, and easy to handle camera that delivers very good quality (of course the lens you mount has a big influence on this, and most 70-300s aren't stellar, but you'd not get anything better out of that lens on a higher spec camera).
Answer: Would this camera be adequate for taken pics of my kids on the soccer/baseball/track fields?
Yes, absolutely.  When it was first released it was the only (Nikon) camera digital available to a great many people (certainly enthusiasts and amateurs doing exactly the things you want to do.)
Do you think this would camera would work?
Oh yes, I still carry mine as a backup and it works fine.  When it was new it was around the $1,000 mark IIRC and that does reflect in the construction, compared to the entry level cameras now it's a hardy little beast.  Photographers were snapping them up like hot cakes.
There are also a number of features on the D70 which aren't present on the newer entry level cameras which make it worth having.  One of the biggest plus points for me is the autofocus motor which allows you to use older lenses like the 70-300mm (which can be obtained more cheaply because the newer entry level cameras need lenses with AF motors.)
Coming from a point and shoot by the time any limitations of the D70 start to be an issue you'll be in a much better position to decide if you can / want to splash out on an upgrade and there will be an extensive market of second hand cameras available to upgrade to, and if not you've still got a perfectly reasonable DSLR.
Answer: Yes, it will work, and should be significantly better than a point and shoot.  The 70-300mm lens is not a great lens, but if you are shooting at a fast shutter speed in sunny conditions, it should be fast enough to capture sports.  The 70-300mm isn't going to be very successful when the light is poor, or for indoor sports.  I think for $200 that's not bad value if everything is in good condition - the D70 is a good camera.  Better options would be several times the price I would think.
Comment: I'd go so far as to say better options would be a waste of money for someone without experience, as they'll be unlikely to get the most even out of a roughly 10 year old entry level DSLR with a low end lens (nothing against any of that, we were all in that position at some point).
Answer: I would expect so.  I have a D40 that I use to photograph dimly and/or randomly lit concerts, and while I have to put forth some effort, I get some good shots.  The D70 could be considered a step up, and if you're shooting outdoors, I think you will be fine.
Answer: I say you push the ISO up to 3200, open up that aperture to five six, or however wide it can go, and slow the shutter down to, maybe, 1/10. Okay maybe not 3200. But somewhere up there. I dunno. Experiment. Then go black and white. But that might be better for the 70mm.


On proper use of Waves L2

Question: Should I use the L2 plugin as a limiter before or after rendering a project?I mean,which would be better for the project to run nicely?
Comment: Can you add some more detail to your tools, workflow and what you're trying to achieve?
Answer: Always run it as the very last plugin in the chain.
Even if you are going to be sending the mix away for mastering, setting both threshold & out ceiling to -0.3 will just prevent overs.
If even at those settings it's too hot, then pull back the entire mix earlier in the chain.
If levels are too low, you can use it to lift the overall levels, but I wouldn't. I'd compensate earlier in the workflow.
If you're attempting to do the mastering yourself, then there are two ways to go.

Mix & master all in one.
These days there's no real loss if you have to come back to the project to remaster later, it's all saved & can be restored in a few seconds.
Mix first, master later.
I'd still use it to just hold any slight overs. Then come back later & use it on the final stereo mix to do your mastering.

On proper use of Waves L2


Pi will not boot after unplugging external USB drive

Question: I successfully mounted an external USB HD by editing the /etc/fstab file as detailed here, and everything worked great, until I tried booting up my Pi without the drive attached. The Pi refused to boot so I powered it down, reconnected the drive - and it still won't boot. I'm not sure what to do - I can't undo my changes to the /etc/fstab file without first booting up the Pi, and I don't want to have to scrub the SD card and start again - can anyone help?
Comment: *"I can't undo my changes to the /etc/fstab file without first booting up the Pi"* -> You can modify fstab without the system running, although of course you would need another computer which can read ext4 filesystems.  Doing without one seems like an exercise in frustration as far as the Pi goes.
Comment: Can you please tell us what you entered into the `/etc/fstab` and also what the error message during boot is?
Comment: Do you can read the second partition that has an ex4 file system from another computer? Do you use a linux computer?
Answer: It's odd that reconnecting the drive won't allow boot to complete. Did you change the drive in any way after unplugging it, and before plugging it back in? If so, that would explain the issue. If this is the case, try to restore the drive configuration as it was before, and try booting again with it plugged in. If you didn't change the drive config, or can't recall the config changes...
It would seem you may have stepped into a hole :)  And as @goldilocks has indicated in his comment, without a system that can read ext4 filesystems, you may not be able to edit the errant line in your /etc/fstab file to recover. I've heard that Windows PCs are able to read ext4, but I can't confirm that personally. However, this thread suggests that you can, altho' it may require a third party app be installed. For Macs, you probably will need a third party app to read ext4. OTOH, many Linux systems will allow you to mount your SD card (possibly via a USB/SD adapter), and once you mount your SD card, you simply go to etc/fstab and correct your entry.
You probably can't tell us exactly what you put into your /etc/fstab file since it's not an entirely memorable character string, to say the least. However, I will hazard a guess that an option you omitted from your entry was this one:
nofail
It would be entered on the same line with the other options; here's an example of how it could be used, taken from an entry in one of my /etc/fstab files:

LABEL=SANDISK16GB /home/pi/mntThumbDrv exfat rw,user,nofail 0 0

Neither the documentation you followed, nor the man page (man fstab) state that omission of the nofail option will prevent the boot process from completing. And quite frankly, I don't know where the wheels come off, but I do know this:

If I don't have the nofail option in my /etc/fstab entry, and the thumb drive is not plugged in at boot time, I cannot connect to mt RPi using SSH.

But as one of the moderators here says, "Don't Panic" :)  The worst case is that you re-install Raspbian on your SD card, and start over again.
Finally, mounting drives in Linux has always struck me as far more complicated than it should be (but that's just me), and this GitHub page may be helpful.
Hope that helps - let us know if you have further questions.
Comment: Thanks so much for your help. I didn't make any changes to the drive so that part remains a mystery, but I followed your suggestion and installed 'extFS for Mac' (with a free 10-day trial) https://www.paragon-software.com/home/extfs-mac/ added the 'nofail' option to the line and everything started working again, the Pi boots whether the drive is attached or not.
Comment: @codebox: Happy to do it. I hope to get some answers as to how `nofail` figures in to boot failures, and why that's not covered in the docs. If I learn anything, I'll edit my answer here.


Are there any tools for feature engineering?

Question: Specifically what I am looking for are tools with some functionality, which is specific to feature engineering. I would like to be able to easily smooth, visualize, fill gaps, etc. Something similar to MS Excel, but that has R as the underlying language instead of VB.
Answer: Very interesting question (+1). While I am not aware of any software tools that currently offer comprehensive functionality for feature engineering, there is definitely a wide range of options in that regard. Currently, as far as I know, feature engineering is still largely a laborious and manual process (i.e., see this blog post). Speaking about the feature engineering subject domain, this excellent article by Jason Brownlee provides a rather comprehensive overview of the topic.
Ben Lorica, Chief Data Scientist and Director of Content Strategy for Data at O'Reilly Media Inc., has written a very nice article, describing the state-of-art (as of June 2014) approaches, methods, tools and startups in the area of automating (or, as he put it, streamlining) feature engineering.
I took a brief look at some startups that Ben has referenced and a product by Skytree indeed looks quite impressive, especially in regard to the subject of this question. Having said that, some of their claims sound really suspicious to me (i.e., "Skytree speeds up machine learning methods by up to 150x compared to open source options"). Continuing talking about commercial data science and machine learning offerings, I have to mention solutions by Microsoft, in particular their Azure Machine Learning Studio. This Web-based product is quite powerful and elegant and offers some feature engineering functionality (FEF). For an example of some simple FEF, see this nice video.
Returning to the question, I think that the simplest approach one can apply for automating feature engineering is to use corresponding IDEs. Since you (me, too) are interested in R language as a data science backend, I would suggest to check, in addition to RStudio, another similar open source IDE, called RKWard. One of the advantages of RKWard vs RStudio is that it supports writing plugins for the IDE, thus, enabling data scientists to automate feature engineering and streamline their R-based data analysis.
Finally, on the other side of the spectrum of feature engineering solutions we can find some research projects. The two most notable seem to be Stanford University's Columbus project, described in detail in the corresponding research paper, and Brainwash, described in this paper.
Answer: Featuretools is a recently released python library for automated feature engineering.  It's based on an algorithm called Deep Feature Synthesis originally developed in 2015 MIT and tested on public data science competitions on Kaggle.
Here is how it fits into the common data science process.

The aim of the library is to not only help experts build better machine learning models faster, but to make the data science process less intimidating to people trying to learn. If you have event driven or relational data, I highly recommend you check it it out!
Disclaimer: I am one of the developers on the project.
Answer: Feature Engineering is at the heart of Machine Learning and is rather laborious and time consuming. There have been various attempts at automating feature engineering in hopes of taking the human out of the loop. One specific implementation that does this for classification problems is auto-sklearn. It uses an optimization procedure called SMAC under the hood to choose the appropriate set of transforms and algorithm (and algorithm parameters).
Note that Trifacta offers a really easy to use tool for data transformation. It has a highly intuitive GUI that allows to set up transformation/ feature engineering maps. There is also a free trial version that can be used for reasonably sized problems.
Comment: auto-sklearn doc not working
Answer: Scikit-learn has recently released new transformers that tackle many aspects of feature engineering. For example:

You can do multiple missing data imputation techniques with the SimpleImputer (http://scikit-learn.org/stable/modules/generated/sklearn.impute.SimpleImputer.html), including mean, median and arbitrary value imputation in both numerical and categorical variables.

You can do multivariate imputation using several estimators, like Bayes, random forest and others (equivalent to R's MICE, Amelia and MissForest) with the IterativeImputer (https://scikit-learn.org/stable/modules/generated/sklearn.impute.IterativeImputer.html#sklearn.impute.IterativeImputer)

You can do categorical one hot encoding with the OneHotEncoder() from Scikit-learn

You can encode categorical variables by numbers with the LabelEncoder.

You can do Yeo-Johnson variable transformation with the PowerTransformer (http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.PowerTransformer.html)

You can do discretisation with the KBinsDiscretiser (https://scikit-learn.org/stable/auto_examples/preprocessing/plot_discretization.html)

There are potentially other feature engineering transformers in Scikit-learn and the developers update the library quite regularly.
As an alternative to the well known Scikit-learn library, there is a new recently released open source library called feature-engine. With feature engine you can:

Do mean, median, arbitrary, end of tail and random imputation in numerical and categorical variables
Do various types of categorical encoding, including one hot, integer, ordinal, mean encoding and weight of evidence.
Do various variable transformations including log, reciprocal, exp and box cox
Various types of discretisation including equal frequency, equal distance and tree based
Outlier handling.

More details in the github repo and docs (https://feature-engine.trainindata.com)
Disclaimer: I created feature engine and made it open source.
Another open source python package allows for different types of categorical variable encoding: https://contrib.scikit-learn.org/categorical-encoding/
Answer: You should consider checking the Azure Machine Learning platform. It is online and you can use it with a free account.
Azure ML provides you with a workflow by using modules in a graphic user interface. Many of them are related with Data Munging and you can easily clean your data. If there is something that you cannot do in the GUI, then you can just add a module which let you run custom R or Python script to manipulate your data.
The nice part of it, is that you can easily visualise your data at any time and check simple stats like the dataframe.describe() of the R.
Answer: Amazon Machine Learning is a tool, which I use for feature engineering some times.
As Amazon AWS services have shown a lot of promise and standard, I would definitely count on Amazon ML, with it's prospects and promises for making the workflow of data scientists simpler. But as of now, it's still small.
But, as you asked for a tool for feature engineering, so this is one of them.
Some FAQ's about/for using Amazon ML.


Caching in the ASP.NET MVC Framework

Question: I am fairly new at using the ASP.NET MVC framework and was hoping that I could find some help about best-practises when caching various parts of my MVC web application.  I know that stack overflow uses MVC and some pretty freeking awesome caching techniques, and its MILES faster than my app, even when running locally.
I have a few questions.

How does the caching actually work, and how do you "enable" it, and what are the various options.  What is the best kind of caching to use?
My app has a lot of database transactions, lists that regularly change.  I am worried about the timliness of page refreshes, in users not getting the most recent version of the data.  Whats the best way to strike a balance between web application speed and displaying "up-to-date" data?  What best practises have you guys found when having to deal with this issue?
How do I cache different parts (I assume views) with different caching settings?  I assume that it could be done with sub-controllers, but I have NFI how to go about doing this.
I am using the Castle.Windor integration to the controllers, I am not sure if this changes anything.
Any other best practises of notes of things to be wary/careful of would be greatly appreciated.
Answer: You might want to take a look at Phil Haack post for some donut caching. He's THE reference for ASP.NET MVC :)
Comment: There's also Stephen Walther and others on ASP.NET MVC. It's not just haacked.
Comment: Yeah... but there's nobody as noisy as Phil Haack. Maybe Jeff Atwood beats him on the noisy thing. But that's it.
Answer: From a "best practices" perspective, you will need to consider the same things you must consider in any application that uses caching.

Is the traffic volume high enough to benefit from caching?
How often does a particular piece of data change?  How crucial is timeliness?
Do I own the data-access layer? If so, can I trigger the refresh in the cache by the actual changing of the data and avoid a time-based expiration?

and the list goes on.
Answer: You can easily cache views using the OutputCache attribute. Any not frequently updated lists I cache as well using nHibernate caching mechanisms.

Caching in the ASP.NET MVC Framework


Integrated rate law graphs

Question: Why does the graph of $\ln[\ce A]$ vs $t$ produce a straight line for the first order rate law?
Also why does the graph of $t$ vs $\frac{1}{B}$ produce a straight line for the second order rate law?
Answer: The short answer is that the equations you describe as graphs are the solutions of the differential equations that define the rate laws in question.  If you don't understand what a differential equation is, any sensible answer is going to be problematic.
Assuming you do know what a differential equation is, we proceed!
For a first order rate law, the differential equation is something like:
$$-\frac{\mathrm d[\ce{A}]}{\mathrm dt}=k[\ce{A}]$$
Rearrange the concentration and time to get:
$$-\frac{\mathrm d[\ce{A}]}{[\ce{A}]}=k\,\mathrm dt$$
You now integrate both sides, with $[\ce{A}]$ as a function of $t$. This is a well-known integral, which is:
$$\ln [\ce{A}] = \ln [\ce{A}]_0 - kt$$
where $[\ce{A}]_0$ is an initial value for $[\ce{A}]$ at the start of the reaction.
Similarly, the differential equation for the second order rate law is:
$$-\frac{\mathrm d[\ce{A}]}{\mathrm dt} = k[\ce{A}]^2$$
Rearrange the concentration and time to get:
$$-\frac{\mathrm d[\ce{A}]}{[\ce{A}]^2} = k\,\mathrm dt$$
And again integrate to get:
$$\frac{1}{[\ce{A}]}=kt+\frac{1}{[\ce{A}]_0}$$
where $[\ce{A}]_0$ is an initial value for $[\ce{A}]$ at the start of the reaction.
This all comes from the following Wikipedia page, which has a lot more details: Rate equation
Answer: ]Wikipedia got it wrong for the 2nd order differential rate equation.
It should be this:
-d[A] / dt = k[A]^2 for a second order reaction, where there is no 2 by the k constant, and the negative sign denotes the disappearance of the concentration of A with respect to time, and where d[A] / dt means the derivative of the concentration of [A] with respect to time (dt).
Divide both [A]^2 and multiply by negative dt:
{1 / [A]^2} d[A] = -k dt
[A]^(-2) d[A] = -k dt ... This is a separable equation.(Actually, 0 order to third order and even three-halves order are separable differential equations.)
Integrate both sides with definite bounds.
(from [A]0 to [A]t ∫[A]^(-2) d[A] = -k (from 0 to t) ∫(dt),
use power rule of integration (only the first law is special because if you use power rule of integration on 1 / [A] you get a divide by zero error.) So in power rule of integration, you add 1 to the existing power which is -2 and then divide by the new power which is -2 + 1 = -1, so that gives us the integration [A]^(-1) / -1 or -1 / [A]. And when you integrate dt, you are really integrating t^0 dt, so you get t, and "k" is a constant (non variable) so it is not integrated ever in all the rate laws.
-(1 / [A]) {[from [A]0 to [A]t} = -kt {from t = 0 to t}
Since both sides are negative, divide both sides of the equation by -1, and everything's positive.
(1 / [A]) {[from [A]0 to [A]t} = kt {from t = 0 to t}
(1 / [A]t) - (1 / [A]0) = k(t - 0) = k(t)
Then some algebra, adding 1 / [A]0 to both sides and tada!!
(1 / [A]t) = (1 / [A]0) + k(t)
Now how do we graph this linear? think about it. If we substitute 1 / [A]t as "y" and (1 / [A]0) as "b" and k(t) is m(x), that's basically the equation of a line: y = m(x) + b.
So you redefine the axes with the vertical axis as 1 / [A], and the horizontal axis as time (t), and you expect a straight line if your chemical reaction is second order.
Theoretically, you should be able tabulate your data and calculate logarithms and inverses and make tables, and compare how well the scatter plots form a line to figure out which model is the best model. But, if you do not follow the reaction over enough time, then all the models could have good fits which is undesirable.
Not showing the work, but for the 1st order reaction, the integrated rate law is this:
ln[A]t = ln[A]0 - k(t),
where remember [A]0 is the conc of reactant A at time 0, and [A]t is the concentration of reactant A at any given time. So if I just replace the ln[A] as the units of the vertical axis, and the "t" as the units of the horizontal axis, then I get another y = m(x) + b line.
Once you get your axes right in a table, you just format, you just do a linear regression in Microsoft Excel, QtiPlot, R, etc...  to get the equation of your line to fit the model.
I hope I helped you understand this.

Here is how you integrate the first order rate law:
https://www.youtube.com/watch?v=smcyZ_r0A88

Integrated rate law graphs


How does a Short Authentication String (SAS) mitigate MITM attacks?

Question: Reading about Silent Circle, and more specifically Silent Text, I learnt that by implementing SAS, the likelyhood of a MITM attack is greatly reduced.  Could someone please explain how this works?  If there really is someone intercepting your text-based communications, what is to stop them simply modifying the SAS exchange?
https://silentcircle.com/web/faq-silent-text/#6
Comment: I'm unclear on how the use of the SAS raises the bar when the voice data can be captured before it is even encrypted. The baseband chip has low level access to all of the hardware on the mobile phone so your voice data can be captured and routed to a cell phone tower: https://theiphonewiki.com/wiki/Baseband_Device There is a lot more information about this on SlashDot and here:
http://www.ptsecurity.com/upload/iblock/083/08391102d2bd30c5fe234145877ebcc0.pdf
Answer: This question is best answered by reading the Protocol overview published by Silent Circle which describes how it works in much more detail.
In short, the SAS value is derived on each phone by hashing values obtained during the key exchange phase of the protocol. Silent Circle recommends that the SAS value be compared out of band, which makes it very difficult for someone to MITM the conversation.

Silent Circle recommends that users make use of an alternative method to establish the
  identity of the receiving party and verify that the user has the same SAS value. A phone
  call would be sufficient for this purpose since confidence building cues such as voice
  timbre and manner of speech are present. These cues make it difficult for an adversary
  to convincingly impersonate the other party without being detected. If the two parties are
  physically co-located, they may even be able to compare their short authentication
  strings by placing their devices side-by-side.
Comment: But the screenshots on the Silent Circle FAQ seem to show the users exchanging the SAS through text, which I believe would be classified as in-band. Doesn't that defeat the purpose, or am I still missing something?
Answer: My guess is that it's possible that the mechanism uses a token containing a tamper evident hash or seal of some description. This is not foolproof but it raises the bar in that the attacker needs to discover the token's protocol, extract the unique token I'd, change it, and then regenerate the hash.
If the client is not a browser then other techniques can be used to make reverse engineering the token and it's tamper-evident seal.


Quantum measurement in a strong magnetic field

Question: I have a thought experiment that has been puzzling me regarding a spin-$\frac12$ particle placed in an extremely powerful magnetic field (say 1000 T for the sake of hyperbole) directed along the positive $z$-axis. Now, we take a measurement of spin along the $x$-axis, which forces the particle to collapse into one of the states $|\rightarrow\rangle=\frac1{\sqrt2}\left(|\uparrow\rangle+|\downarrow\rangle\right)$ or $|\leftarrow\rangle=\frac1{\sqrt2}\left(|\uparrow\rangle-|\downarrow\rangle\right)$ with equal probability. Now, if we take a measurement along the $z$-axis, the particle will be found in state $|\uparrow\rangle$ or state $|\downarrow\rangle$ with equal probability. But this means that just via a sequence of two measurements, we have discovered how to give a particle a large amount of potential energy by aligning it antiparallel to the strong magnetic field with $50\%$ probability. Clearly, there is something wrong with my logic here, but can anybody tell me what it is? Ignore for a moment the experimental difficulties with measuring spin along a direction other than that of the external magnetic field, because this experiment could also be carried out with other kinds of conjugate variables such as position and momentum.
Comment: What is it that OP doesn't understand? Presumably 'parallel' means "in the low-energy eigenstate of the Hamiltonian $H=\gamma B S_z$" and antiparallel means the high-energy eigenstate. The system potentially ends in a state of well-defined energy which is higher than the (well-defined) energy that it started with, hence the apparent paradox. The question's phrasing seems perfectly fine to me.
Comment: How is this different from asking, "I have a compass and I put it in a magnetic field, it aligns with the field, now it has some potential energy??"
Comment: Because half of the wavefunction will now be *antiparallel* to the magnetic field without putting work in, and the antiparallel spins have much more potential energy.
Comment: The phrase "be antiparallel" is doing a lot of work here (potentially inappropriately). In what sense do you think the particle "is" parallel or antiparallel?
Comment: It might be helpful to review what the wavefunction means and what it doesn't mean. Grab an intro textbook like this one: https://www.amazon.com/Introduction-Quantum-Mechanics-David-Griffiths/dp/1107189632
Answer: Measurement requires an interaction between the measured system and some apparatus/external system. In this case you're discovering that measurement would cost some energy to perform, with the cost being paid by the apparatus.*
In the 1000 T magnetic field, the $|\rightarrow\rangle$ state precesses very rapidly into the $|\leftarrow\rangle$ state, at a rate of $\omega=\Delta E/\hbar$, where $\Delta E$ is the energy difference between the $|\uparrow\rangle$ and $|\downarrow\rangle$ states. So the measurement apparatus needs to perform its measurement comparable to or faster than $1/\omega$. To do so, it needs to couple to the spin with a strength comparable to or larger than $\omega\hbar=\Delta E$ (so that the action of that term in the Hamiltonian over a time interval ~$1/\omega$ is non-negligible). That coupling provides the missing energy.
*Including the interaction term between system and apparatus as part of the apparatus.


DRM or license management solution for 3D printing

Question: Is there any DRM or license management solution for 3D printing? I'm looking for something, that would help me limit the number of prints someone can make from my projects. Basically, I would like to sell the "right to make no more than X copies" of my design. I don't expect it to be bullet-proof (like Widevine L1 for video), but it should at least help me with license management.
Answer: Good luck with that.
Issues you will face:

using a G-code editor (or built-in printer software) to create multiple copies of the object in a single print session
user writing the printer file to an SD card, then block-copying the SD card
defining a "print". Specifically:
is #2 another functional copy of the object, or did #1 fail? Failed prints happen a lot.
is #3 another functional copy of the object, or was #2 damaged in post-processing? Like removing supports or left it in the acetone 5 seconds too long and it's now a blob.
is #4 another functional copy of the object, or was #3 tossed because the guy running the printer grabbed the wrong spool and made a perfectly good print in the perfectly wrong material/colour.
is #5 another functional copy of the object, or was #4 damaged in shipping?

The whole process is one-way. There just isn't a path for anything other than the end user to know what they pulled off the print bed. Unless you make the entire process from design software to printer you won't change that. And good luck selling it, 'cause the user base is rather strongly opposed to that kind of thing. For example, ANY kind of DRM in the product, from printer software to filament, is an immediate no-buy for me. I don't care if you are paying me to take it, I will find an alternative without that particular annoyance. And no, I don't use Microsoft or Adobe products either.
Comment: "a "safe" path between my business and another one" -> that's easy. Contracts. Have your lawyer and their lawyer play tennis.
Also, it would have helped greatly if you specified the scope you were looking for. A "one-to-one" scope is much different from the "one-to-mass market" scope.
Comment: Yes, a "full stack" solution from software to printer would be an option, the problem is I don't know any. I'm not interested in selling the DRM solution, I basically need a "safe" path between my business and another one. We are already working together, we just need to add some "accountability".
Answer: Generally: No
Let's face the obvious problems of the files exchanged and the files used for printing, and then look into why it is a bad idea in the first place.
G-code
G-code is in its design a .txt file that contains specific orders for a machine. There is a g-code command that forces the printer to delete the file (M30) but that needs the exact file path - and just does nothing if the path is incorrect. One could make a slicer profile, that after printing, deletes the file from the SD-card, but doing so as a user is only useful for one-off jobs and it can be prevented by the user by simply shutting down the printer before the line is triggered.
Because .gcode is essentially a .txt without any special features but a custom ending, it can't provide DRM beyond containing a self-delete-after-completion.
STL & OBJ
STL and OBJ are the most relevant exchange files. They are open source and not intended to contain any DRM.
Other formats?
Even with a different format, you would need both a proprietary 3D format that can only be read by your DRM-enabled slicer as well as a proprietary printer file type that both contain DRM. However, using a proprietary printer command type means you lock down your file to be only available to your printer family, which in turn makes this printer family less desirable, as it can't work with the standard g-code format.


Why the shortening of "fitted" to "fit"?

Question: Which is more correct, "it fit really well" or "it fitted really well"?  The short form is something I encountered when moving to the US, I never heard it in the UK.
Answer: The definition of 'fit' used here is given by the OED (5.a.) as:

To be of the right measure or proper shape and size for; to be
correctly shaped or adjusted to. Said esp. of dress; also fig.

One of the two earliest quotes for this definition in the past tense uses 'fit'; the other uses 'fitted'.

a1691 BOYLE Firmness Wks. 1744 I. 278 As much of the stone, as was contiguous to the
marchasite..fitted the marchasite so close as if [etc.].
1795 BURNS Song, Last May, a braw wooer, And how her new shoon fit her auld schachl't feet.

So both forms have been in use for a long time.
Searching COCA, COHA, and the BNC for "fit well" vs. "fitted well," I found "fit well" outnumbering "fitted well" by 20:1 in COCA (indicating American usage), 8:3 in the COHA (indicating older American usage), and by 2:1 in the BNC (for you Brits).  So either is fine, on both sides of the Atlantic, but "fit well" is much more common in modern American usage.
Comment: This definition is for the adjective; in the question, however, it appears as the simple past of the verb "to fit".
Comment: That definition is (word-for-word) definition 5.a. for the main sense of the verb 'fit'.  The OED lists the adjectival form separate from the verb
Comment: Thanks for confirming my suspicion about the US vs. UK stats.
Comment: So a quotation from Scots, a quite distinct dialect, is being used as evidence for this usage in "Standard" English?
Answer: I think there are two separate verbs here that are the same in the present tense but different in the past.

To fit the way clothing fits. "This outfit fits me fine. Did that outfit fit you? Yes it fit me."
To fit as in to equip. "We fit our men with the best rifles. I was fitted with the best equipment."
Comment: @Colin: yeah I'm not sure "fit" is the correct example, but your "spit" seems to be
Comment: Claudiu, you may be right, but I would want references for the accuracy of your claim. I would say that both 'fit' (cf 'hit') and 'fitted' are used, the former more in N. America than the UK. There are oher words that show this abundance: 'quit', for example. IN the case of 'spit' there clearly are two verbs: 'spit = expectorate' has past 'spat' in the UK and 'spit' in the US; while 'spit = run through' has past 'spitted'.
Comment: Your example 1 does not contain the past tense of the verb "fit."  What is the point of this example?
Answer: Just found this after hearing fit used for past tense again, it is an aberration that has infiltrated the language in the US, what can you do? If someone ignorant of correct language used made up words and conjunctions in every sentence they would be scorned if understood, but because Warren G Harding was a presidential candidate he was perceived to be better educated than most - so when he invented 'normalcy' in a campaign slogan instead of the correct 'normality' it stuck. Only Americans say normalcy, and the few Brits who copy them. As with to fit being used as in the old uneducated speech of the UK West country..."Oooh aaar, it fit me loist week it did" (ooh aaar it fitted me last week, so it did) That usage bled over the Atlantic with emigration and  is now the 'normalcy'. Unfortunately I have heard other verbs going the same way, tighten your belts for a bumpy future.
Comment: Please provide an authoritative source to support your answer. For further guidance, see [answer].


how to create an object particle that sticks to the top of the mesh selected?

Question: I am creating a doughnut in blender and I was trying to use the particle system to add sprinkles to the icing on top of the doughnut. but, when I add the object particle, they get added under the frosting and inside of the doughnut. I've tried messing with rotation, emission and a few other random things but I can't seem to figure it out.
Answer: You can gain better control over your particle placement with Weight Painting.
First, select your emitter object and make sure it has a vertex group attached. If there isn't one already there, add one with the plus sign, and if there is one there, consider renaming it to something like "Sprinkles" to make sure it's clear what it's for. You can safely select all before assigning it, because the weight paint will control the particles, not the selected vertices in the group, and we want to make sure all are available to paint on.

Now, enter weight paint mode. I noticed that when I assigned the vertex group, it set it all to "full weight" (red). If this happens for you, there are a few things you can do. Mainly, change the draw mode to subtract and either subtract away some sections you don't want particles on (mainly the edges - blender isn't perfect with particle placement, and will place some "out of bounds" - keep this in mind when painting), or paint it all blue and start again with the draw brush if you want to do it cleanly from scratch.

Paint the areas that should contain the sprinkles (I put most in the center of the "icing"), correcting as necessary by switching brshes.

Now that this is done, assign your particle collection.
NOTE- If the hair particles are all facing inwards (happens sometimes because of solidify modifier), either check the flip normals box on the modifier itself, or select the whole mesh in edit mode and pick mesh > normals > flip.
Now, scroll down to vertex groups, and under Density, select your "Sprinkle" group. This will make the particles appear only on the areas you painted that are not blue, with increasing density towards full red.


Are "willingness" and "being willing" the same thing?

Question: Willingness is often defined as "the quality of being willing." Does that mean that it's the same as "being willing"? We can say sentences like "Bob's best quality is his willingness to do what's right" which would suggest that they are the same, and phrases like "act of breaking glass" suggest that too. However, if I were to rephrase sentences like "he has the willingness to try new things" to "he has the being willing to try new things", the latter sentence seems wrong.
Comment: The rephrasing of rthe sentence you mention, "He has the willingness to try new things", is "He has the **quality of** being willing to try new things".
Answer: Willingness is a noun while being willing is more like a verb and is in the progressive tense. If, for example, we use "stand" as a verb and "road" as a noun, we could have the following examples:
<code>Bob stands on the road. [correct]
Bob roads on the stand. [not correct]
</code>
In other words, willingness (noun) is "the quality of being willing" while being willing (verb) is "having willingness".
Comment: By "being willing" I meant the gerund. It doesn't really have anything to do with the progressive tense.
Comment: In that case, I might suggest reversing the two words, making "willing-being" (which is really just a different way of writing "willingness"). Generally speaking, when a compound noun is constructed, the root is at the end while the modifiers come before. This comes from the Germanic roots of English, where for example kindergarten is made of Garten (garden) modified by Kinder (children).


Permanently disable WiFi power management in Ubuntu Server 18.04

Question: I have a small server set up that is connected to the network over wireless. I was able to configure wireless by installing wpa_supplicant and adding the required lines to netplan. I've been having issues with the server not responding right away to pings/ connection attempts after it has sat idle for a while. After installing wireless-tools I could see that iwconfig was reporting that power management was turned on.
As I understand it, I can disable it until the next reboot with
<code>sudo iwconfig wlan0 power off
</code>
How do I disable this permanently? I have tried creating an empty file called "wireless" in /etc/pm/sleep.d which didn't work. Other fixes I have seen for 16.04 reference /etc/NetworkManager which is not present on 18.04.2.
Answer: Workaround: try adding the command to /etc/rc.local so that it automatically gets executed at boot:
<code>#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

iwconfig wlan0 power off   ### this line added

exit 0
</code>
Have tested this on 16.04. If you face any issue on 18.04 let us know.
Another way reported is to install TLP and disable wifi power management there: https://unix.stackexchange.com/a/473753/45945
Comment: I had this need on 19.10 ubuntu and this appears to work fine at least over a couple days testing.


choose a db connection pool

Question: we want to use a db connection pool in our applicationl,however thear are so many open soure pools,like dbcp,c3p0,proxool and etc.
I have no idea which is better,any one have some experience about them?
Answer: I'd recommend using the one that is built into your Java EE app server if you're using one.  That's should be sufficient.  Why add another dependency?
I'd recommend using DBCP from Apache.  It'll work just fine for your purposes.
Answer: As author of BoneCP (http://jolbox.com), I invite you to have a look at the benchmark section on that site and judge for yourself.
W

choose a db connection pool


Can acid-base reaction occur if two compounds (one acidic and one basic) are added to each other while being in their molten states/pure form?

Question: I am a 14 year old school student and have been told that acid-base reactions occur in aqueous solutions only for they produce ions in aqueous solutions only and I can't help but wonder if they can take place if these two kinds of compounds are added to each other in their pure forms or molten states.
Comment: Does this answer your question? [Can acid-base reactions occur in a non-aqueous medium?](https://chemistry.stackexchange.com/questions/123828/can-acid-base-reactions-occur-in-a-non-aqueous-medium)
Comment: If they can intimately mix then there will be reaction. In solid state this is very slow, it can occur in molten state. There are also other solvents that support the formation of ions.
Comment: If can happen even in gaseous state.
Comment: To get an acid-base reaction, the reagents (and ions) must be mobile. They are not in the solid state. So mixing a solid acid an a solid hydroxyde will produce a reaction limited to the contact points, which can be neglected. If the reagents are molten, they are mobile. It looks like the situation in an aqueous solution. The reaction can take place, but it is not so fast as in aqueous solution.
Comment: Good question! I'm not an expert at all here but a quick look suggests solid state acid-base reactions are an active area of research - for instance https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiYlOu-xs2BAxWZUEEAHWc_D3cQFnoECCwQAQ&url=https%3A%2F%2Fdocs.lib.purdue.edu%2Fcgi%2Fviewcontent.cgi%3Farticle%3D2511%26context%3Dopen_access_dissertations&usg=AOvVaw29kNAMTEXg6UfIB_GmDZ15&opi=89978449 discusses solid state acid-base in pharmaceuticals, and https://en.wikipedia.org/wiki/Solid_acid touches on mixed phased reactions
Comment: Another example is the use of zeolites in a number of areas as solid state acids, including the multimillion pound  area of cracking in the petroleum industry
Answer: The key question we must ask ourselves is which definition of acids and bases we wish to employ. Since acid and base is a man-made label for chemical compounds, then we must familiarize ourselves with plenty of acid-base definitions that were proposed by different scientists over a century. You will study these definitions in higher classes. When we restrict ourselves to aqueous solutions, we are using a very narrow and limited definition of acid and bases, which is fine for elementary classes. Therefore the acid-base reactions can occur in any state.

Gas-phase: The classical reaction of ammonia gas with HCl gas to form a solid ammonium chloride. (At a deeper level, a trace of water makes the reaction very fast, and but water vapor is always present in air)

Solid-gas: Carbon dioxide reacting with solid sodium hydroxide to form sodium hydrogen carbonate.

Reactions in organic anhydrous solvents: Acid-base reactions occur all the time in organic solvents. No water is there (anhydrous).

Similarly molten salts will react with pure bases or if you can melt them. Nobody does it regularly but in rare synthetic cases, acid base neutralization has been observed Reaction of molten sebacic acid with a layered (Mg/Al) double hydroxide.
Answer: Water is not required for acid-base reactions. The materials do not need to be ionized to react.
The comments have already given you some good examples, like the reaction between ammonia ($\ce{NH3}$) and hydrogen chloride ($\ce{HCl}$), both gases at room temperature. They react to form ammonium chloride, $\ce{NH4Cl}$, which is a solid. There is no water involved and the result of the reaction is a very fine white smoke. This is actually a fairly common classroom demonstration.
Some elementary chemistry classes give an incomplete definition of a base, which only includes hydroxides like $\ce{NaOH}$ or $\ce{KOH}$. That would exclude the previous reaction, which involves ammonia. This definition is bad and is never used by real chemists, only in the classroom. But even under this definition, water is not required. Pure, dry $\ce{HCl}$ gas will react readily with hydroxides in their solid form. And if you were stupid enough to try adding molten sodium hydroxide to a pure liquid acid like sulfuric acid, the reaction would be very violent, and the whole caustic mixture would instantly explode in your face.
In fact, one reason to do a reaction in solution is to reduce the intensity of the reaction. You can safely mix very dilute solutions of acids and bases, while mixing the same chemicals at higher concentration could release too much heat too fast and explode.
Comment: Not to mention the "base" or "acid" could be water itself. We all know the precausions necessary when diluting, say, sulfiric acid (much heat release) or hydrochloric acid (less heat, but fumes) with water.
Answer: Looking more closely at the classic case of ammonia and hydrogen chloride gases without water:
Countess and Heicklen[1] carried out the reaction between gaseous ammonia and hydrogen chloride in anhydrous nitrogen, demonstrating the raction without need for either liquid or gaseous water. They give a rate constant for this reaction.
What actually happens is that the strongly polarized hydrogen from the hydrogen chloride first hydrogen-bonds to the nitrogen from the ammonia, thus forming ammonia-hydrogen chloride clusters. In the absence of water the initial $\ce{H3N–HCl}$ cluster is not ionic, but as the cluster grows further the hydrogen-bonded protons become fully transferred to make the $\ce{NH4^+}$ and $\ce{Cl^-}$ ions, which ultimately are assembled into the solid-phase lattice. This is discussed more fully here.
Reference

Richard J. Countess and Julian Heicklen, "Kinetics of particle growth. II. Kinetics of the reaction of ammonia with hydrogen chloride and the growth of pariculate ammonium chloride", J. Phys. Chem. ,1973, 77, 4, 444–447.


An asymptotic expression of sum of powers of binomial coefficients.

Question: Let $k$ be a fixed positive number and $n$ an integer increasing to infinity. Then  $$\sum_{\nu =0}^n \binom{n}{\nu}^k \sim \frac{2^{kn}}{\sqrt{k}} \left( \frac{2}{\pi n} \right)^{\frac{k-1}{2}}.$$  This is from Polya's Problems and Theorems in Analysis, Vol. 1, Part II, Problem 40. The proof provided in the book is too simple. It says details can be found in Jordan's Cours d'Analyse, Vol.2, 3rd Ed, pp. 218-221. However, I cannot find this edition online, and what's worse, there is not any English translations. Can anyone give a proof in detail?
Comment: Well, as usual, $C_{n}^{\nu }=\left( \begin{matrix}
   n  \\
   \nu   \\
\end{matrix} \right)=\frac{n!}{\nu !\cdot \left( n-\nu  \right)!}$.
Comment: @EclipseSun see [here](http://math.stackexchange.com/q/573537/129017) if this helps :)
Comment: To eliminate any ambiguity, $C_n^\nu = \binom{\nu}{n}=\frac{\nu !}{n!(\nu-n)!}?$
Comment: Exercise 9.18 of [Concrete Mathematics: A Foundation for Computer Science](http://www-cs-faculty.stanford.edu/~uno/gkp.html) by Graham, Knuth, and Patashnik may be the answer you are looking for.
Answer: That kind of asymptotics follows from the Central Limit Theorem. If we consider the binomial random variable $X=B(n,1/2)$ as the sum of $n$ independent Bernoulli trials, we have:
$$\mathbb{E}[X]=\frac{n}{4}, \qquad \operatorname{Var}[X]=\frac{n}{4}$$
from which the approximation:
$$\frac{1}{2^n}\binom{n}{n/2+r}\approx \sqrt{\frac{2}{n\pi}}\exp\left(-\frac{2r^2}{n}\right).\tag{1}$$
By considering the $k$-th power of both terms and summing over $r\in[-n/2,n/2]$ (the main contribute is clearly given by the central binomial coefficient and its neighbours) we get:
$$\sum_{r=-n/2}^{n/2}\binom{n}{n/2+r}^k \approx 2^{kn}\left(\frac{2}{\pi n}\right)^{\frac{k}{2}}\sum_{r=-n/2}^{n/2}\exp\left(-\frac{2kr^2}{n}\right)\tag{2}$$
and the claim follows from approximating the last sum with:
$$\int_{-\infty}^{+\infty}\exp\left(-\frac{2kx^2}{n}\right)\,dx = \sqrt{\frac{\pi n}{2k}}.\tag{3}$$
Comment: I know that (1) is correct, and from (2) I can derive (3). But I have problem to understand the validity to take $k$-th power of (1) and sum them up. Why is the asymptotic expression still valid after this operation?
Comment: @EclipseSun Excellent reaction... :-)
Answer: This is not an answer, but is too long for the usual comment format.
I have access to the reference given in the OP, so I looked it up,
but I was disappointed.
In those pages 218 to 221, C. Jordan nowhere considers sums
$\sum_{\nu} \binom{n}{\nu}^k$ for $k$ other than $1$. The strongest result
shown there is a form of the CLT : Jordan shows that for $p\in[0,1]$,
if $(\lambda_{n})$ is an integer sequence such that
$\frac{\lambda_n}{n^a}$ is bounded for some $a<1$, then
$$
\sum_{\nu=\frac{n}{2}-\lambda_n}^{\frac{n}{2}+\lambda_n}
\binom{n}{\nu}p^\nu(1-p)^{n-\nu} \sim_{n\to+\infty}
\frac{1}{\sqrt{2\pi p(1-p)n}} \int_{-\lambda_n}^{\lambda_n} e^{-\frac{x^2}{2p(1-p)n}}dx
$$
The key ingredient of the proof is that as $\lambda_n$ is sufficiently small
compared to $n$, we can use a Stirling approximation $\log(t!)\sim (t+\frac{1}{2})\log(t)-t+\frac{\log(2\pi)}{2}$ for all the integers $t$ we need.
The only way this can help in my view is that it suggests showing something
like
$$
\sum_{\nu =0}^n \binom{n}{\nu}^k \sim \sum_{\nu =\frac{n}{2}-n^a}^{\frac{n}{2}+n^a}\binom{n}{\nu}^k
$$
for some $a<1$ depending perhaps on $k$. That's still a big "if".


suggestion needed in doing an approval process

Question: I am having an approval process where whenever a record is saved i want to use a  trigger and send for email approval. I want to use inbound and outbound email services to update fields. I will send an approval form with a checkbox if a user replies to message it must update checkbox field and i want to write an workflow to send email that it was approved. How can i easily do the functionality instead of such long process.
Answer: This is something that can readily be done via the API using Approval Processes and Workflow. There's no need to write any triggers, create email services, etc. and doing so would be a poor use of Salesforce's resources and features. How to do what you want is described quite well in Force.com Fundamentals in the tutorials that take you through the process of creating a recruiting app.


Error 000539 in ArcGIS Desktop?

Question: I am using Raster Calculator in ArcGIS 10.4.1 in order to substract two raster surfaces. However, when I substracted the two surfaces an error 000539 was appeared! I tried to adjust the two surfaces in a specify extent, but clip and extract by mask tools didn't work as I wanted. I tried to fit the first surface into the second one, however, one more column was remained in the former surface.
Any suggestion?
Comment: Make sure that the coordinate system of the environment settings is the same as the input raster coordinate systems
Comment: I set the same coordinate system as my raster layer, and the same error appeared. I transferred the data in QGIS, following the same procedure, and there wasn't any problem
Answer: A colleague and I just had a similar error with rcexe. Looking at the error, it appeared to actually be a problem with NumPy. After a lot of investigation including looking at the path that the ArcMap python version is using, we realised that the path contained Anaconda. This meant that python was trying to use the NumPy version from Anaconda and not the ArcMap version.
Couldn't work out where the path was being set (as it was not in the windows path), but changing the folder name of the anaconda files fixed the issue.

Error 000539 in ArcGIS Desktop?


Use another theme template in my theme

Question: I want to use a different theme's portfolio page in my theme. I just want the content (portfolio layout of the other theme) but my own (active theme) header, footer, sidebar, and everything else. Is there a structured approach for this problem?
Comment: I don't think its possible but still see how experts respond to your query. But best way is to copy that template and related files , css , js into the theme you are using
Answer: Create child theme of the main theme you're using. That way you can override just the parts you want. Reference - https://codex.wordpress.org/Child_Themes
Hope it helps!

Use another theme template in my theme


python linting not working with eglot

Question: System:
Mac OS 12.5
Emacs 28.1 from homebrew
Python 3.9.13 using a virtual env
python-lsp-server

For some reason my linting, with error highlighting is not working with Python using eglot.
In the screenshot below (hello_broken.cpp) you can see that linting is working in C++ mode which is using clangd.
The middle pane shows that linting is not working for Python (hello_broken.py).  There should clearly be the same kind of error as in the Cpp file.
However, you can see that eglot is giving me the function intellisense for add.py as shown in the message buffer at the bottom.  Also, the go to definition functionality of eglot is also working.
Why isn't the linting working?  I don't really even know how to dig into this, but any help would be appreciated.  Thank you
Answer: Although I have pylint installed python-lsp-server was looking for pyflakes.  At this moment, I don't know if I can configure the server to use pylint instead.

python linting not working with eglot


The lateral surface area of a right circular cone is three times the surface area of its inscribed sphere. Find the vertex angle (cone)

Question: I am quite confused on how to attack this problem... It's not homework
I tried to use the equations of the surface area of a sphere and the lateral area of the cone to find the answer, but it didn't work... The image is just showing how a sphere is inscribed inside the cone. Thanks!
*by the vertex angle I meant the pheta shown in the image
Answer: Draw a line from the center of the sphere to the lower rim, and let $\alpha$ be the angle it makes with the diameter ending there. Then $a=r\tan\alpha$, and $\theta={\pi\over2}-2\alpha$.
Denote the distance from the vertex to the rim by $s$. Then $$s={r\over\sin\theta}={r\over\cos(2\alpha)}\ .$$
The area of the lateral surface of the cone is given by $$A_{\rm lat}={1\over2}\>2\pi r\>s={\pi r^2\over\cos(2\alpha)}\ ,$$ and area of the sphere is given by $$A_{\rm sph}=4\pi a^2=4\pi r^2\tan^2\alpha\ .$$
The condition $A_{\rm lat}=3A_{\rm sph}$ then leads to the equation
$$12\cos(2\alpha)\tan^2\alpha=1\ .$$
Letting $$\sin\theta=\cos(2\alpha)=:u$$ we have $\tan^2\alpha={1-u\over1+u}$, so that we now have to solve
$$12u^2-11u+1=0\ .$$
There are two solutions $u_{\pm}={1\over24}(11\pm\sqrt{73})$, both leading to an acceptable $\theta$-value $\theta_\pm=\arcsin u_{\pm}$.
Comment: Sorry but I still don't get it... can you explain it in more detail?
Comment: So does 12u^2-11u+1=0 find the pheta shown in the image? I only need the equation to find the pheta, which is already shown in the beginning of the explanation, but I am confused on this extra equation and don't know what to do with it.


Linux Driver: how do I access PCI sound card ADC and DAC

Question: recently I got interested in Linux Driver Development. I read LDD3 book, a number of articles and examples. So I decided that it is time to try something on my own.
So what IO aim for: I want to find out how to read the ADC data from my PCI sound card and how to write data to the DAC
I searched a lot for examples and they all end up using ALSA api from User Space. This is not what I want to do.
I want to create my own interface to the User Space, through which I will transfer the data and will configure the device.
So here are some questions:

Is this possible at all? Or I should stick to ALSA.
Some design guidelines will be very appreciated. (I have some idea how to do it but I need other opinions).
Where can I find some example code, tutorials, etc.

Thank you.
Answer: See Writing an ALSA driver, and the documentation of your hardware.


Exercising an American call option early

Question: I have seen the rationale behind why it is never optimal to exercise an American call option early, but have a question about it.
If the option strike price is $E=\$20$ and it expires at $T=1yr$, if the share price is $S=\$25$ at expiry, the profit will be $\$5$ per share.  However, what if at $T=0.5yr$ the share price was $S=\$40$ following a jump in the price. Exercising at this point would yield a profit of $\$20$ per share.
Would it not be more optimal to exercise early, in this case?
Comment: Why is this downvoted.  A genuine question isn't it?
Comment: Basically you'd make more money by selling the option than exercising. I am surprised no one actually gave a proof here...
Comment: Loving the answers here learning new information about stuff I thought I already knew!
Answer: Cases where exercising a call early makes sense:

There is a dividend payment the next day that is >= the interest on the strike price + a put with the same strike and expiration.  Exercise the call, buy the put, and sell a zero-coupon bond for (strike price + put price - dividend).  The transaction has a net 0 cashflow at time 0 and at expiry you will be long a share of stock and have to pay the bond off. If the stock is less than the strike price, you can exercise your put to get the strike price.  As long as the maturity value of the bond is <= the strike price, you are in a better or equal position to having held the option to maturity.

You cannot short the stock or sell the option and believe it has peaked.  If you believe that the stock has reached its highest point before the expiration date and you are unable to hedge by shorting the stock (including using a synthetic short), you should exercise early. Since you are giving up the implicit put (right to not buy if it is below strike), you must believe that the difference between the current price and the price at expiry is larger than the price to buy this put  + the interest on the strike price.  Note: this would also apply if you cannot short the stock or sell the option, or borrow at a good rate and are in dire need of money.

The market is not efficient and you have an opportunity for arbitrage.  There are a couple different ways this could happen, but if you can construct a series of purchases that give you risk free profit, congratulations, you have found a rare opportunity for arbitrage and should take advantage of it.

You will lose the option.  If the option is conditional on some external factor (eg. employment at a company), you should obviously exercise it before losing it, as long as it is in the money.

The risk-free interest rate is negative.  If for some strange reason, interest rates are negative, then the interest on the strike price is negative. If this is larger than the implicit put, buy the put and exercise the option.

You wish to be (subtly) charitable to the seller of the call.  If exercising early is disadvantageous to you and if it is a zero-sum game, then your loss will be their gain.  You could subtly donate to them by exercising non-optimally. They can simply sell another call, which will more than pay for the money they owe you (or else you are in situation 3 above) and they have made money.
Comment: This is easily the best answer in this thread, and deserves to be voted higher (especially given current interest rates in some countries).
Answer: If you think the stock is going to continue going up, just wait. If you think the stock has reached its peak, then short it in the open market. If the shorted stock continues to climb, you can always cover with your call option. If however the stock falls below your strike price, then let the option expire and cover at the market price.
It's this very ability to choose the buying price (strike vs market) when covering a short sale that makes the option valuable. But of course, you can do the same thing with a European option! That's why the American option gives you no added value over the European option. There is no benefit to exercising an American call option early.
Comment: @whitebloodcell works only when you're certain about future. ..
Comment: But my example describes a profit that wouldn't be possible if the option was European, why isn't that a benefit?
Comment: What are you talking about?! If you exercise now, you pay \$20 and sell at \$40. But the only reason to exercise now is if you believe \$40 is the highest the stock will get. It's foolish to exercise now if you believe the stock will go higher. If you believe the stock will max-out at \$40, then short it now and wait until the expiration to see what the market price is before buying it back. The market price could be *lower* than the exercise price, which is why you'd be giving-up money to exercise now if you believe it's going to fall further.
Comment: Okay, so say that the stock is going to go down to $15, lower than the exercise price - the option will be worthless, I'll make a loss. But had I exercised when the stock price was higher than the exercise price (not necessarily highest) I'd have made a profit. Isn't that more optimal than the loss that has been made by holding onto the option until expiry?
Comment: Do you know what *short selling* is? I've mentioned it twice because it's the classic textbook argument against early exercise. If the stock is at \$40 now and you believe it will drop to \$15 by expiration, short the stock now, let your option expire, and then buy back the stock ("cover your short" in industry jargon) on the regular market.
Comment: Great, thanks.  The rationale I read only gave the reason that you'll lose interest on the cash you spend to exercise the call option.
Comment: Right, that's another good argument. If you believe the stock will continue to climb, just wait since the cash for your margin deposit can accumulate interest. If you believe the stock will fall and you don't want to pay the short-sell interest, then just [sell the option](http://quant.stackexchange.com/a/3488/35), as @Alexey states.
Comment: If the stock peaks at \$40, then drops to \$15, why would it not be better to exercise and get the \$20 from the up leg, as well as short it and get \$25 from the down?
Answer: At the time of exercise, you don't know what the final expiry stock value is.
Consider the portfolio consisting of the option and $K$ zero coupon bonds worth $B_t \leq 1.$ At expiry its value is
$$
\max(S,K) \geq S
$$
since can you exercise and get the stock if $S>K$ and have $K$ otherwise.
So at all times previously,
$$
C_t + K B_t > S_t
$$
since it dominates at expiry. So
$$
C_t > S_t - KB_t > S_t - K.
$$
So the European option is always worth more than its intrinsic before expiry.
And the American is worth at least as much as the intrinsic so it's never sensible to early exercise.
Note that this does not require dynamic hedging.
(I discuss this question at length in my book  Concepts etc.)
Answer: Because if you sell, you will get a higher value than 20USD per share. You can think of the reason behind this added value is that having a deep ITM option is better than having a stock: your downside is limited. Therefore your option is worth more on the market than it's exercise value. This is why you are better off by selling it in your case (if you know that the price will drop to 25USD).
Answer: If you can dynamically hedge then you can monetize the value of your option without prematurely exercising it.  Before writing about Randomness and Black Swans, Taleb wrote a book on the topic.  The short version of the story is find the DV01 of your position, and take an opposite position with the same DV01.  (& if you want, line up the rest of the greeks)
If you can't dynamically hedge for whatever reason, then the "Don't exercise early" rule is not so black and white.  For example, executives have shorting restrictions on their companies.  In these cases, they may be restricted to exercising options early rather than dynamically hedging.
Comment: Could you please post a quote from the book by Taleb?
Answer: Because you would make a higher profit if you sold the option on the open market at that point in time, rather than exercising it at that point in time due to the time value of money.
Comment: This is already stated in a [previous answer](http://quant.stackexchange.com/a/3488/35).
Answer: The theoretical answer is:
If you feel you should exercise at $t<T$ then you can get $S_t-K$ (obviously $S_t>K$). But price of the option at any$t<T$ is $C_t>S_t-K$ always. So rather than exercising just sell the option and let someone else hold it.
But then practically there are transaction costs etc.
Comment: This is the most succinct and clear answer
Answer: You can only make a decision on whether to early exercise an American call option on an equity underlying with current information.  In your question you anticipate a movement in the underlying higher in the future.  This has no economic bearing on whether to exercise early. Given your inputs of $S=25$, $E=20$ and $T=1.0$ and assuming interest rate of $0$ and no dividends all you can say is that the option must be worth at least $5$ in the market.  There will be no early exercise.  Now what if $T = 0.02$ or approximately 1 week and tomorrow the stock goes ex-dividend for $2.00$?  Back before the OCC starting adjusting strike prices for large dividends you would exercise early to capture the dividend. Tomorrow the stock will be $23$ and the intrinsic value will go from $5$ to $3$. If you did not exercise early then you would lose out on $\$2$ by holding call option to expiration.
Answer: I think this is a common problem for a beginner in QF.
The holder has two ways to treat the stock if he exercises the call option earlier:

the holder holds the stock until maturity.
the holder think the stock is overpriced, and sell the stock immediately.

In the first case, the holder lost the interest from the cash and also the stock price may fall.
The second case is a little tricky. Suppose the stock price is 50, and the strike price is 40. Selling the stock will give you 10. However, a better choice is to short the stock (borrow and sell the stock gives you 50) and close the short position at maturity use money equal or less than 40 (because you have the call option, you at most pay 40 for the stock). Then you can make a profit more than 10.
So you see in either case, we have a better solution than just exercising it. For more details, please check Hull's book: section 9.5 Early exercise: calls on a non-dividend-paying stock.
Answer: For this, let us consider two portfolios:
A:One American Call (c) and Kexp(-r(T-t)) in money mkt and
B: The stock S.
Now, let us say we decide to exercise the Call early,
Value of portfolio A (by exercising at t1): (S(t1) - K) + Kexp(-r(T-t1)) < S = B
Now if we consider the portfolio A at expiry (time T):
Value of portfolio A (by exercising at T): max(S-K,0) + K = max(S,K) which is always greater than or equal to S (=B).
Hence early exercise is not feasible for American Call.
This is not true for American puts, to see this let us consider a scenario in which Stock price falls to 0, by not early exercising now, we cannot gain much (stock won't go below this). But, if we exercise now, we can gain interest on the amount received. Hence, early exercising of American Put is feasible in this scenario.
Answer: The short answer is that if you can exercise it and instantly get \$20, then this option is at least worth $20 at that time (any amount smaller leads to an arbitrage). This means that you can sell it for at least
\$20 dollars, which is why exercising is always no better than selling it to others. Exercising an American option can be an optimal choice - it is not hard to construct binomial models where at certain node(s) in the tree, exercising is an optimal choice. However, the catch is in those cases, exercising is AN optimal choice, not THE optimal choice, since the price of that option will be the same as the payoff at the time of exercise if exercising is indeed optimal. So technically, it's not true that it is never optimal to exercise an American option, rather whenever exercising is optimal, selling it will give you that value as well in theory.


What is the difference between PHPGraphLib and JpGraph?

Question: I am trying to generate simple bar charts to be displayed on a website. I am looking at PHPGraphLib and JpGraph. They seem fairly comparable and with proper configuration they can probably produce nearly identical charts. Is there a reason to choose one over the other? Are there are any real differences between the two? Are there alternatives I may be overlooking?
Comment: Semi-related: Does anybody know of any PHP graph libraries that -are- free for commercial use?
Answer: PHPGraphLib looks to be more light wieght, and not quite as capable as JpGraph.  If you just look at the examples and the documentation, you can see how much more JpGraph does.  If your goal is to be lightweight and you don't need the extras JpGraph offers, then go with PHPGraphLib.  If you want to have a lot of flexibility in the graphs you can generate, go with JpGraph.  I have used JpGraph for a ton of things, and its very versatile, and you can figure out how to do anything using the huge number of examples they include with the source.
Answer: jpGraph has far more capabilities than PHPGraphLib. On the other hand, PHPGraphLib is a lot easier to install and very fast. In fact, it is the only one that I was able to get to work immediately. It consists of only three files. I am still struggling with jpGraph and some truetype fonts that it cannot find. If PHPGraphLib has enough features for you, by all means, run with it. I wish I could.
Both of them are free for personal use, and a few hundred dollars for unlimited servers. Pretty good deal, and I think the developers deserve getting paid what they charge.


Length of prime number used in Pedersen Commitment

Question: I am writing a program using a Pedersen commitment scheme and all I'm missing is an appropriate length for my prime $p$. I have heard that a length of $2^{80}$ is ok, is that correct?
Answer: If you mean a prime in the neighborhood of $2^{80}$, well, that is incorrect.  A prime that small will allow someone to commit to a value, and then reveal another one.
A Pederson commitment is a value $g^x h^r \bmod p$, where $g$, $h$ and $p$ are public values, $x$ is the value being committed to, and $r$ is a random value.  To reveal the commitment, you publish $x$ and $r$.
To reveal a second value $x'$, one way to do this is compute a value $r'$ with $g^x h^r \equiv g^{x'} h^{r'}$, this is equivalent to $h^{r'} \equiv c$, where the attacker can compute $c \equiv g^{x - x'}h^{r}$.  If the attacker can solve his discrete logarithm to the base $h$, we can recover $r'$ and reveal his second value $x'$.
Now, for primes of 80 bits in length, this discrete logarithm is easily solved.  To make it impractical, you need a prime at least 1024 bits in length, preferably at least 2048 bits.
On the other hand, if you mean a prime that's $2^{80}$ bits in length, that is, around $2^{2^{80}}$, well, you'll find that is an impractically large prime to work with; computing $g^xh^r$ would be infeasible.
Answer: One would put a requirement for the group first, rather than one for just prime $p$. That is, require that taking a logarithm (calculate an index) to be hard in this group. For a multiplicative modulo-$p$ group, this would also require choosing a generator of an order $q$ such that $q$ is a prime, is large enough, and divides $p-1$. Alternatively, it would allow for a group of points on an elliptic curve.
Comment: One requirement would be that $g$ and $h$ be a part of the same subgroup (otherwise, the commitee can deduce some information on $x$).  Given that it's also important that no one know the discrete log $\log_g h$, it would appear wise to select $(p-1)/2$ prime (and select $g$ and $h$ to be random quadratic residues); alternatively, work in an elliptic curve with a prime order.
Comment: @poncho Yes, $g$ and $p$ must  be in the same subgroup for unconditional indistinguishability of commitment scheme to hold. One could use a subgroup of order $q$ such that $q$ is another large prime and $q | (p-1)$. My point is, there's more to implement than just pick a prime of an appropriate length.


SSH RSA and ED25519 keys passphrase issue

Question: I have two types of keys based on RSA and ED25519 keys.
however when I do
ssh -i ~/.ssh/id_ed25519 <server>

I get prompted to enter passphrase for RSA based key first then get asked for ED25519 key passphrase
Enter passphrase for key '~/.ssh/id_rsa':
Enter passphrase for key '~/.ssh/id_ed25519':

My both public keys are in authorized keys of the server.
What would be the reason for this
Also
~/.ssh/config

doesn't any settings and is totally empty.
Comment: Do you have the corresponding id_rsa.pub & id_ed25519.pub files as well?
Answer: The -i option of ssh specifies an extra private key to use.
To prevent ssh-agent from providing more identities, you can add the -o "IdentitiesOnly=yes" option to your command, but the default keys inside your ~/.ssh directory might still be tried.
The sure way to only use a specific key is to make an entry for the given host in the ~/.ssh/config file.


Opel Astra H CDTI 1.7 ISSUES

Question: When am speeding there is a car sign with spanner that comes on the dash board. I would like to know what exactly is the fault. Thank you.
Comment: Can you find a picture of the light you are talking about? You may be able to point the light out by taking a picture of the dash when you first turn the key on, but before you actually start it. What you are describing is probably the check engine light (CEL), but would like to make sure. Also, what do you mean by "speeding"? This is a very arbitrary term. Can you please throw in what year your car is? Have you had the OBD-II codes read? Even though the light goes off, your system should store the codes.
Answer: The car with a spanner warning light is an indication that your vehicle is due for service

Opel Astra H CDTI 1.7 ISSUES