Medieval army vs Legions- who would have the advantage?

Question: Something I've considered- set in a fictional world where two cultures clash- one whose military is styled after the legions of Ancient Rome fighting against an army based on England or France in the Middle ages, (bowmen and infantry led by knights with lances). Assuming they had comparable numbers, who would likely be at a disadvantage technologically speaking?
Comment: [Reminder to close-voters](http://meta.worldbuilding.stackexchange.com/q/3773/6986): The problem cannot be fixed if the OP isn't made aware of it.
Comment: That being said, I believe the problem being identified here is that this is a question of military analysis regarding real-world, historical entities, rather than an attempt to build something. Additionally, numbers and technology aren't always deciding factors; the skill and foresight of a commander can often be the determining factor in battle.
Comment: Is this about a single battle, a campaign, or a war? Do these cultures know of each other before or it's a violent first contact?
Answer: Military professionals know that it is a rare instance where technology alone decides the issue on the battlefield. Even today, we see the high tech military forces of the West being fought by insurgents armed with infantry small arms, improvised explosive devices and communicating over the cell phone network. Roman weapons like the the glades and armour (either chainmail or later Lorica segmental wasn't fundamentally different from weapons and armour of the Medieval period.
The primary difference between the Legions and a Medieval army isn't really in technology, but rather organization, strategy and tactics. The classical Roman legions were a heavy infantry force with a small component of cavalry and ranged weapons like archers, supported by professional engineers and access to heavy weapons ranging from scorpions to catapults of various sizes.

Replica Scorpion
The Roman Legion was also supported by an efficient system of roads and logistics stretching across the Res Publica and later Imperium, not to mention ships and naval support.
A Medieval army was organized differently. Without the massive bureaucracy and logistical organization that characterized the Legions, a Medieval army would have great difficulty taking to the field for extended campaigns. Being forced to "live off the land" made the general shape of a campaign into a giant raid (known as a Chevauchée), whose main purpose was to despoil the countryside and deprive the agricultural produce and other wealth to the "owning" side. The Knights and Men at Arms were not professional soldiers the way the Milites and leaders of the Roman Legions were, but were still skilled and fearsome fighters with a lifetime of very specialized military training behind them. Mercenary soldiers and "Yeomen" could be quite deadly as well (English and Welsh longbowmen were particularly good examples of this).

Yeoman Archers are hired for their skills
Tactically, the Medieval army could probably move faster given the larger percentage of mounted men and the coverage the much larger proportion of archers could provide, while the Romans would be able to use  defensive tactics to stand their ground and the flexibility of their Manipular formations to react to movements by a Medieval army, trusting i their ability to absorb the shock of contact and then grind the enemy down with their deliberate advance. If the battle took place in Roman times, the Romans could use their logistical advantage to sustain themselves, while depriving the Medieval army of supplies (they would have to get them from fortified Roman cities and military camps), while if a Roman Legion was operating in Medieval times, they would be the ones cut off from supplies and support.

A Legion drawn up in formation. In battle, the maniples and centuries could rapidly move around the battlefield rather than fight as a single, solid mass
So the real answer is the Romans have an advantage due to organization and technologies such as engineering to build roads, erect fortified camps and move and store supplies.
Comment: @BertHaddad 'Foraging" is pronounced 'pillaging' or 'looting.'
Comment: Why would a medieval army move faster? It would have to leave it's supply train and infantry/archers behind. Yes, the cavailry may move faster - but the army is limited by the slowest element.
Comment: @TomTom medieval armies often didn't have supply chains, instead relying on foraging to support themselves.
Comment: @BertHaddad Not true. Yes, for food - but what about all the rest? What about the food soldiers? You take the "medieval army" down to "everyone on horses" - ONLY. Once you add all the rest - you are again bound by the slowest element.
Comment: I saw this question when it got posted, and I thought there was something wrong with this answer. I finally noticed it. The only way I had this come up as considering some vast alternate history, where the two civilizations clashed, one medieval and one lat classical (Roman).
Answer: Rome really had two great weaknesses in campaigning:
Firstly, they weren't too successful against Cavalry.  This was most evident at Carrhae when the Parthian horse archers slaughtered a good chunk of the legions, while the heavy Cataphract charge finished them off.  Also at Cannae, where Hannibal's cavalry chased off their own horsemen, and wheeled around to slaughter 30,000 foot legionaries in a single day.  Medieval Knights were some of the best heavy cavalry in the world, so this would be a major advantage for the Medieval side.  They also maintained some cavalry archers, though the Muslim armies of the era (and later the Mongols), were much more reliant on them.
One example Battle you may want to read about is the Battle of Manzikert, in which Turkish horse archers defeated the Byzantine army.  True, the medieval Byzantine army wasn't exactly like the Roman Legions, but I believe it was somewhat similar, and it's lack of mobility made it vulnerable and gave the mounted enemy the initiative.
The Roman's other great military weakness was their inability to deal with asymmetric warfare and ambushes.  This was most evident in their great military defeat at the Teutoburg Wald, where a Germanic force ambushed and destroyed several legions.  Medieval armies weren't all that fond of these tactics, but their reliance on excellent archers and cavalry would have likely given them the option to pursue this path.
Finally, the Longbow was a critical invention which allowed the British to win several great battles against the French in the 100 Years War (notably Agincourt).  A large, slow-moving Roman Legion would have been sitting ducks if faced by massed Longbow fire, and would likely have collapsed (the Tortis formation, where they locked their shields, gave some protection, but the slaughter at Carrhae shows it wasn't nearly enough.
Ultimately, the Romans would almost certainly win a hand-to-hand, face-to-face fight, but Medieval warfare no longer revolved around that, and the heavy Knights and Longbowmen would likely make short work of the Legions before they could close for battle.
Still, it would have been fascinating to see.  The Roman's best bet would have been to:
1) Recruit Longbows as auxiliaries.
2) Develop a shield that can block a bodkin arrow.
3) Fight on the defensive, making use of stakes and earthworks to blunt enemy Cavalry charges.
With these conditions met, the Romans would likely prevail.
Comment: By 1070, when the Battle of Manzikert rolled around, the Byzantine army had little to no similarities to the Roman Legions. By introduction of themes in the 700s had all but eliminated whatever remained of the professional heavy infantry. That strength of the army of 1070 was levies of mounted landed nobility (Cataphracts), recruits from the north (the Varangian Guard, at the time mostly English, and other units) and mercenaries. It was not substantially different from contemporary western armies.
Answer: Depends on when in the Middle ages you're talking about, and when in the Roman period you're talking about.
Because Ancient Rome lasted for quite awhile and there were advances in armour and fighting techniques.
Same too for the Middle Ages, it lasted for quite a while, and there were advances during the time period as far as warfare and metals were concerned, especially when it came to the longbow, which wasn't in wide use for most of it.
But, I am going to assume that this clash is going to be Rome at the height of tech vs. Middle Ages at the height of tech.
Most Roman legions used chain mail, which is NO defense against the longbow, used at the height of Medieval warfare. Yes, they did have some troops that used segmented armor, but the design was not great against arrows. If you look at the armour used in the Middle Ages, you'll see that the best stuff is curved, but Roman armour wasn't designed that way.
The shields of Romans were mostly made of wood, and surprisingly, would be somewhat effective, up to a point, in at least catching arrows.
In both the Roman army and Medieval armies, most troops did not have full armor.
Now, Romans have always excelled is in discipline and tactics, whereas the discipline in Medieval armies could sometimes be a bit rag-tag. Armies were outfitted in Medieval times at personal expense of Lords or of the men under them, to fight under the King for a cause. But Romans were more centralized and uniform when it came to equipment, training, and their supply chain.
Cavalry is going to be a strength on the Medieval side--because Romans were never well-known for horsed combat, though at the height of the Roman empire, they DID have mounted cavalry, and it was pretty good for its day, they may be outclassed by knights, just because there's a little more emphasis on horsed training.
But, surprisingly, Romans did have lances, and they were comparable in length to the ones used by Medieval knights. The Roman horses were also outfitted in armor, just as the Medieval ones were.
A seasoned group of Crusaders would be an equal match for a comparable group of Legionnaires.
Then, we come to the development of artillery in the 1300s! It was this advance, besides the longbow, that changed warfare and tactics forever. This is going to make things very difficult for your Romans.
So who has the advantage? I believe this would actually be close thing because they have advantages in different areas, but I am going to have to give it to the Medieval army!
Comment: `Cavalry is going to be a strength on the Medieval side--because Romans were never well-known for horsed combat...` not _entirely_ true--after the split, the Eastern Roman Empire used [Cataphracts](https://en.wikipedia.org/wiki/Cataphract). Agree with the rest
Comment: @nzaman No one considers the Medieval Byzantines to be 'Roman.' They no longer spoke Latin (as a primary language) or controlled any of Italy, and the army of that era had very little in common with the Republican or Early Imperial legions.
Comment: @kingledionThe Byzantines considered themselves Roman of course. The culture  changed a bit, as cultures do over a thousand years, but it's still Roman culture.
Comment: @nzaman The Eastern Empire copied cataphracts after having massive trouble with that kind of super-heavy cavalry.
Comment: @nzaman Medieval will have them beat--some of it just due to advances in saddles.  Yes, Romans had heavy horse and lance, I acknowledge that, but it never was the strongest point about them--I specifically mention "Roman horses were also outfitted in armor, just as the Medieval ones were" so I am not ignoring this, I just think that, historically at least, there's a reason why Romans were never WELL-KNOWN for it.
Comment: `Most Roman legions used chain mail`... at the height of the Roman Empire the armor Lorica Segmentata was used, which was thin strips of armor linked together into metal bands. It was much lighter than chain mail. However, I'm not sure of its effectiveness against longbows. But the testudo formation had very good defense against archer fire.


Is "increment" perfectly synonymous with "increase"?

Question: My advisor replaced all the occurrences of "increment" with "increase" in one of my papers. Is it true that "increment" can always be replaced with "increase"? If not, please show me some examples.
Comment: People will always ask about "perfect synonyms". And we always have to tell them, there is no such thing. Synonyms only exist *in context*. Antonyms only exist *in context*. Hypernyms only exist *in context*. For the simple reason that all these -nyms are about *meaning*, and words only have meaning *in context*. Without context, a word as simple as *cat* can mean a dozen things; it is not even synonymous with itself. Likewise, *man* can be the antonym of *woman*, or the antonym of *boy*, or the antonym of *God*, or the antonym of *animal* — even though a man *is* an animal and not a plant.
Comment: Show us your background research effort.
Comment: @RegDwighт: You are such a cool cat. Those are great examples, showing why this question sorely needs at least one or two excerpts from the paper in question. (Incidentally, _man_ can function as an antonym of _woman_, as you said, or as a hypernym of _woman_ as well.)
Comment: This is not a real question until it is edited to include the OP's efforts at research.
Answer: No, increase cannot always replace increment. In mathematics, increment can refer to a decrease.
An increase, on the other hand, always refers to the act, amount or rate of getting larger.
That said, in common usage, an increment is an increase, generally with the specific connotation of being:

one of a series of regular additions or contributions

Consider the following sentence:

John added to his savings account in increments.

Here increment expresses something that increase by itself does not. It would generally be understood as:

John added to his savings in a series of identical amounts.

In common usage, then, increase has a broader meaning than increment. Depending on the context, increment may be a more accurate word than increase - or it may be misleading.
Answer: It depends on what you want to write.

Increment is the unit of measure or the process of increasing

Sometimes there is no difference and they are interchangeable, but 'increment' indicates an increase in regular steps, whereas 'increase' has a wider, more general usage.
This means that sometimes only 'increase' is the correct word to use.
Answer:
My advisor replaced all the occurrences of "increment" with "increase" in one of my papers. Is it true that "increment" can always be replaced with "increase"?

No, increment cannot "always" be replaced with increase. However, that doesn't mean that your advisor was wrong: increase is a more "generic" word, and it may indeed have been the more appropriate word in the usages in your paper.
Unfortunately, you haven't taken the time to provide even a single example from your paper, so there's no way for us to tell if these replacements represent improvements.  We don't even know if you are talking about a noun or verb usage of these words.
In short, increase can be used as a verb, meaning to go up. The word increase can also be used as a noun, meaning a single instance of making a value higher.  So, I could say either of these:

Betty, we are going to increase your pay.  (used as a verb)
Netty, you are going to receive a pay increase. (used as a noun)

But the word increment would not be appropriate in either of those sentences.  The word increment implies one of a series:

Eddy, we are going to increase your salary $2000 per year for the next three years. Each increment will take effect on January 1st.
Comment: @RegDwigнt But what about the words "yeah" and "yes"? These words have exactly the same meaning, and I can't find any context in which the meaning would differ. If you answer any question with both, the meaning will always be the same, yes.
Comment: Both words can be used to answer a question in the affirmative, but one is more informal that the other, so I wouldn't say they are entirely interchangeable in all contexts. Plus, there is the famous ["Yeah, right" joke](https://www.ling.upenn.edu/~beatrice/humor/double-positive.html), which wouldn't exactly work with, "Yes, correct."
Comment: No, you wouldn't use these two words in all SOCIAL contexts, but this is not important linguistically. What's important is that these two words have the exact same meaning in all of the contexts(Even in your 'Yeah, right' example 'yeah' alone means 'yes').  They both mean "yes" and this is what I was trying to prove when I've heard the statement that there are no perfect synonyms.


What is good block size for file cache on Linux?

Question: The device block size is usually 512 bytes while the filesystem block size is often 4096 bytes. Why are they different? Why are 512B and 4KB good choices for device and filesystem block sizes? What block size would work best for caching disk reads in a userspace library?
Answer: The device block size is the block size with what the system is talking with the HDD controllers. If you want to read/write the HDD, it happens so:

Read:

CPU -> HDD controller: "Please send me the data of block 43623626"
HDD controller -> CPU: "Done, here it is: 0xfce2c0deebed..."

Write:

CPU -> HDD controller: "Please write this data to block 3452345: 0xfce2c0deebed..."
HDD controller -> CPU: "done"

Here the block number means the name of the 2354242th, 512-byte block.
Theoretically, it could be possible to use any block size. Most devices are using 512-byte blocks, and some of them, particularly large HDDs are using 4096-byte blocks. Some optical media are using 2304byte blocks.
The important thing is: the block device controller doesn't know anything from the filesystem on it. It can only read and write blocks, in its block size, to his medium. This is what the block device driver uses to provide the block device for the kernel: essentially a single, large byte array. It doesn't matter, how is it partitioned or which fs is using it.
The filesystem block size is the block size in which the filesystem data structures are organized in the filesystem. It is the internal feature of the filesystem, there isn't even a requirement to use block-oriented data structures, and some filesystems doesn't even do it.
Ext4 uses most typically 4096byte blocks.
Furthermore, disk IO data is handled typically not directly by the processes, but with the virtual memory of your OS. It uses extensively paging. The VM page size is typically 4096 bytes (might be different on non-x86 CPUs), it is determined by the CPU architecture. (For example, newer amd64 CPUs can handle 2MB pages, or dec alpha used 8192 byte pages).
To optimize the data IO, the best if all of them are the multiply of eachother, yet better if they are equal. This typically means: use 4096 byte fs blocks.
It is also important: if your block device is partitioned, the partitions should begin/end of exact page sizes. If you don't do it, for example your sda1 starts on the 17. block of your sda, the CPU will have to issue TWO read/write commands for all page read/write operations, because the physical and the filesystem blocks will overlap.
In the most common scenario, it means: all partitions should start or begin on a sector divisible by 8 (4096 / 512 = 8).
Note, typically the low level block IO happens not in single block read/write operations, instead multiple blocks are sent/received in a single command. And re-organizing data is typically not a very big overhead, because memory IO is typically much faster that block device IO. Thus, not following these won't be a big overhead.
Comment: The exact overhead is dependent on your system, it will be at most some %s and surely below 10%. In a professional scenario, it simply doesn't worth a repartitioning. LVM uses 4MB data blocks, it is multiple of anything, this is yet another reason to use LVM instead of the fossil partitions.
Comment: All right I like what you said. So I plan to make it 4096 bytes. But I couldn't control how much and where the application wants to read. For example, the application may read across my block boundaries and this misalignment is inherent right? As a cache I can only try to be consistent with the underlying system, but have no control on those sit over me. Is there a huge performance difference between using `read`/`write` and directly `mmap` the block device?
Comment: @Cyker It doesn't matter, how your app handles file IO, the fs or the block layer will convert them to full-block operations. File read/write copies-writes data between the block cache and the app memory, while mmap maps directly the pages. Thus, mmap is mostly faster, but not always. With read/write, you have more control, what exactly should be read/written, in mmap the VM heuristics will be used, which are quite good, but won't be ever so good, than an app which is programmed by you, knowing what should be done and why.
Comment: @Cyker What I see a significant performance improvement: many filesystems and processes have a braindamagedly low write cache sync timeout. For example, ext4 syncs write cache in every 5 seconds!!! Or: postgresql makes an fsync() after every write operation! I can't understand, why need anyways high quality softwares to be so... dirty. It totally shocks me. These all can be turned off, but not these are the default setting!


Generally speaking what might one expect from a J-pole based on PVC covered in tinned braid?

Question: Would the skin effect provide benefits or would capacitance/inductance cause problems?
Comment: What band is the J-pole for?  Does the tinned braid include a metal foil layer?  How would you get the tinned braid, would you pull the center conductor and the insulator out from coaxial cable, and then shove a narrow piece of PVC pipe inside?  Please edit the question to give us more information.
Comment: I understand where you're coming from.  This is a Q-and-A site and not a forum, so we like questions that could help other people who have similar questions in the future.  Questions that are well-researched and well-written get upvotes.  Yours probably got a downvote because it's a one-liner.  By the way, a great place to get feedback on ideas that aren't fully-formed yet is the [ham shack](https://chat.stackexchange.com/rooms/11162/ham-shack), our chat room, where there are a lot less rules.
Comment: OK, I'm just trying to decide if it's worth trying. I don't understand the reason for the downvote.
Comment: Can we assume that what you're asking is, *Is what you described better than a J-pole made from copper water pipe?* Kindly edit your question to add these details. As it is, it's unclear what you're asking.
Comment: It was downvoted because it needs more details. From https://ham.stackexchange.com/help/closed-questions: "Needs details or clarity - sometimes we need more information in order to help solve your problem.

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.

Edit your post to be more specific about what you're looking for, and be sure to address any concerns that other users brought up in the comments."
Comment: https://ham.stackexchange.com/help/asking
Answer: For HF (e.g., 3MHz), the skin depth effect is <50 x 10^-6 m even for aluminum, and it is thiner for higher frequencies, so braid should be fine.
The bandwidth of the J-pole is affected by the diameter of the radiating element.  The band is wider at higher frequencies, so to cover the 2m amateur band, you need about the diameter of rg58 shield.  HF bands, being narrower, can stand a narrower diameter wire and still cover the band.
Having said that, I've made 20m and 10m j-poles, but I don't think a 160m j-pole is reasonable.  :)
Comment: Haha! That DEFINITELY means we have to try it somehow! ;-)
Comment: You mention aluminum. Does this apply to tin, which is what we're discussing here?
Comment: Tin is irrelevant here.  "Tinned" braid is probably nickel plated copper or something like that.  (Although it could be tin.)  The plating layer is less than the skin depth, so it's mostly copper.  My mention of aluminum is because it's a good conductor with a thick skin depth.  Most other good conductors will be thinner.
Answer: RF will flow through the outermost layer of tin, in either tinned copper braid or tinned copper wire. Thus, very little current will actually flow through the highly conductive copper in the center.
The conductivity of copper is much better than tin. Tin is only 17% compared to copper at 100%. Will you notice a difference? The only way to tell is with two different J-poles and a proper test setup.
See this answer about tinned braid vs. solid copper. Note what might happen when the braid gets corroded and the individual wires get insulated from each other.
Comment: If that is the case, why bother EVER tinning copper braid? Why are all the ground cables tinned?
Comment: @NonYaBidnezz To prevent corrosion. When copper corrodes, a poorly conductive oxide layer forms on each strand. Seems I read that that's bad when RF is involved. Perhaps there is another reason. In any case, I sprayed a clear coating on a shiny copper tank circuit strip in a homebrew 2m linear amp for that reason. (Silver plating would have worked.) However, this begs the (rhetorical) question, Will the coating break when flexed?


Is this called multilayers pulley?

Question:

Is the B pulley in this picture called "multi layer" or "stacked" pulley? What is it look like in real life? In this problem, which circle is counted as its size? Is it the one attached to strings (red arrow) or the most outside circle (blue arrow)?
Answer: I am not sure to say whether this is called a 'multi-layer pulley'. But as you can see there are only three pulleys labelled as 'A','B' and 'C' in this figure. Probably, pulley 'B' consists of two disks welded together.
And I am here trying to answer your second question.

...which circle is counted as its size?

This question shouldn't be asked. First you need to understand why pulley 'B' rotates faster than the others. Yes, it is because it is the smallest pulley here, somehow. Let's look at this more scientifically. For simplicity, consider the system that contains pulleys 'A' and 'B'. The velocity of any point of the string which connect these two pulleys should be a constant. Let it be $v$. And the points on the pulleys where they touch the string have this $v$ velocity. It means that the points on the circumferences of the circles has $v$ velocity. The question asks 'what pulley rotates fast?'. In other words, 'which pulley has the maximum angular velocity?'. As $v=\omega r$, $\omega \propto\frac{1}{r}$,when $v$ is constant. It means the circle which has the minimum radius, rotates faster. It is literally pleasing to say, 'smallest circle rotates fastest'.
Thus here as an answer to your question, you can assume that the smaller circle is counted as pulley's size. It is because the rope is attached to the smaller circle(as you say). But it is meaningless to say that.
P.S.
This image was found on wikipedia:

Regarding your image, I suppose there should be two slots, excluding large circle, as two belts are attached.
Hope this helps.
Comment: Thank you a lot
Comment: @Hmm, you are welcome and you can accept or upvote an answer instead of saying 'thanks'. https://physics.stackexchange.com/help/someone-answers
Comment: I always upvote those who answer me. It's just that you need 15 reputation to cast a vote, so it not showed

Is this called multilayers pulley?


How to debug command Line Dataloader error

Question: We have been using command line data loader for the data migration to salesforce. Recently I have the updated the security token for the API user which we are using for the migration from the insertion to salesforce has been stopped. Do I need to update my config files since I have security token change? . If I have to update the config files with the security token what is the procedure? The password has not been changed only the security token is reset. Where I can see the exact error since the insert has not been made to salesforce?
Answer: As security token is updated,
you will have to encrypt the password (password + security token) and have to update the config file with encrypted password.
The link below will give some idea on configuration required-
Automating data loader
Hope this helps..


Can someone help me in understanding what actually plasmons are?

Question: This question might have been asked several times but I am confused on this topic. What actually are the plasmons? Do they only exist in the case of metals or they can be found even in semiconductors? They are even classified as bulk and surface plasmons. What is the difference between them?
Answer: Think of an electromagnetic wave reaching a bunch of electric charges. The oscillating EM field will couple to the movement of free carriers, making them oscillate. Of course, moving charges also generate an electromagnetic field, and since these carriers are oscillating, the EM field will oscillate too: that is, we have another EM wave.
In the case of bulk plasmons (I prefer calling them plasma oscillations, to distinguish them from Surface Plasmons), this happens in general. Light hits a metal and carriers in the metal start oscillating. If carriers can move at the same frequency of the incident EM field, they will screen the field inside the material, and that's why metals have high reflectivity for certain frequencies. Back to the previous explanation: when the light hits the metal, bulk electrons oscillate and generate a field that propagates in the opposite direction, which is the reflected light. This is how reflection works in an atomic level. However, note that carriers don't move freely, there is some resistance. Due to this, the frequency at which they can oscillate is limited from above by what we call the plasma frequency. Above this frequency, the metal becomes more transparent. This is a cool way of understanding why optical experiments are interesting to "shed light" on the electronic properties of materials, and the reason why the optical conductivity is important to study Strongly Correlated Matter like Mott insulators, Charge density wave states and Superconductors.
But let's go back to the light hitting the sample. At the surface the story changes. When people refer to surface plamsons they normally talk about surface plasmon polaritons (SPP). The fundament is the same, oscillation of carriers coupled to an incident EM wave, but the effects are different. Here the momentum of the light influences these SPP, and we tend to refer to the cool plasmons that can be used as wave guides and to confine light as those with high momentum, where light-matter interaction is strong (for a formal description I recomend you Principles of Nano-Optics, by Novotny). These oscillations can even create standing waves at the surface that can be observed using near field optical microscopy (SNOM), here's a recent beautiful example: https://doi.org/10.1038/s41467-021-21193-5
As for semiconductors, they can hold plasmons, but here the temperature of course plays an important role. Insulating materials are normally described by the Lorenz model and metals by Drude Model; semiconductors use a mixing of both.


Surface area of a torus

Question: One can generate a torus as follows: $\vec{g}=((b+a\cos u)\cos v, (b+a\cos u)\sin v, a \sin u)$. To find its area, we can use a surface integral of the form $S=\iint_{D_{uv}} {\lVert \frac{∂g}{∂u} \times \frac{∂g}{∂v} \rVert \, du \, dv}$. However, in the case of torus the integral becomes seemingly unnecessarily tedious to evaluate. Are there nicer approaches to evaluating the surface area using a surface integral?
Answer: $$\frac{\partial\vec{g}}{\partial u}=(-a\sin u\cos v, -a\sin u\sin v, a \cos u),$$
$$\frac{\partial\vec{g}}{\partial v}=(-(b+a\cos u)\sin v, (b+a\cos u)\cos v, 0).$$
Without surprise, these two vectors are orthogonal, and the norm of their cross product is the product of their norms, $a(b+a\cos u)$.
Integrating on $u,v$ both in range $[0,2\pi]$, noticing that the average value of the cosine is zero, will yield $$(2\pi)^2ab.$$
Nothing really tedious.
Comment: Even without verifying orthogonality, you can factor the $b+a\cos u$ out of the partial derivative, and the cross product isn't too terrible.
Answer: Another way to proceed would be by writing out the surface integral using differential forms. To this end we need to set up a chart and a coordinate system on the Torus. Fortunately we need only one chart and the coordinate system can be made global (using the coordinates already introduced in the question $u,v$), the surface integral will be
$$
S=\int_{M} ab~ du \wedge dv
$$
The integration runs over the coordinate range of the open cover $M=T^2$, that is $u \in [0, 2\pi], ~v \in [0, 2\pi]$ leading to
$$
S= ab \int_0^{2\pi}du \int_0^{2\pi} dv = 4\pi^2 ab
$$
Answer: Use Pappus theorem. If the radius of the transversal section of the torus is $r$ then its perimeter is $2\pi r$ and Pappus theorem states that the surface of the torus (it is a revolution surface) equals $A=2\pi r \cdot 2 \pi R$ where $R$ is the radius of rotation that generates the torus. In your case this is
$$
A = 4\pi^2 ab
$$
Comment: But how to _prove_ Pappus's theorem would seem closer to the meaning of the original question. There are of course ways of doing it other than the methods that we now know as integral calculus; otherwise Pappus couldn't have done it. ${}\qquad{}$
Comment: Thanks, this is very useful. But I'm wondering if there's a better way to find the area using a surface integral. Sorry for not being precise.
Comment: Indeed, actually using Pappus theorem was my first answer, but the OP asked the use of a surface integral. I believe that Pappus did not have integrals at his disposal as we know them but relied on Cavalieri's principle and the use of the indivisibles.
Answer: Choosing a toroidal coordinate system the computation of area is I believe most easy. However, a hybrid between spherical and cylindrical coordinate system can be adopted.
Let radius at crown be $b$, $R$ tube radius, $r$ variable radius of cyl coordinate system, and $\phi$ the latitude of spherical system. Area of torus =
$$ \int_{b-R}^{b+R} \int_{-\pi}^{ \pi} R\, d\phi \cdot 2 \pi\, dr = 2 \pi R \int_{-\pi} ^{  \pi} ( b- R \cos \phi)  d \phi = 2 \pi R \cdot 2 \pi b. $$
This is essentially surface area generation by rotation  using Pappu's theorem.
Answer: In fact this problem necessitates only a simple integral, you just have to integrate (b+cos(s))2pia ds from 0 to 2pi. It is a matter of adding an infinity of circles of infinitesimal width ads. The radius of those circles is in average b, but it can be as much as b+a (outer ridge of the torus) and as little as b-a (inner ridge of the torus). For any s, the radius of the circle will be b+cos s, if we choose s so that s=0 corresponds to the position where the radius is maximal. I was very troubled at first to realize that the cosine term becomes zero when we integrate, so that the formula boils down to the absurdly simple 2pia times 2pi*b, big perimeter times small perimeter. We understand why it is so simple if we consider any horizontal slice of the torus. It will be made of two circles, of radius b+cos(s) and b-cos(s), where s is the angle corresponding to one of the two circles (any will do, just keep the same s for both circles). The cosine terms will always cancel! Magic!

Surface area of a torus


How do i delete the elementary OS boot on my USB?

Question: I have already installed Elementary Os. But when i want to format the USB the files are protected and i cannot delete them.
Thanks for your answers.
Comment: Hi, welcome to the site! Which OS are you using when you try to delete the files, Elementary or your previous OS? Also, is your Elementary installed _on_ the USB, or somewhere else?
Answer: SilverWolf is correct.  As long as Elementary OS is installed on your hard drive (or SSD) you can safely reformat your installation USB drive.
One way to do this is through GNOME Disks
a. Go to AppCenter, search for GNOME Disks.
b. After GNOME Disks has installed go to
Applications -> Disk
c. You will see your drive list on the left column.
d. Select your USB disk (make sure you choose the correct disk).
e. In the middle column, click on the stop icon (square).
This next step will clear all of the data on the USB disk.  Be sure you want to proceed before continuing.
g. Click on the minus icon to the right of the stop icon.
h. Press the Delete button to delete the partition.
i. Press the plus icon, then click the Next button to continue.
j. Enter the volume name and leave the type as FAT.
k. Now click the Create button.
NOTE: With a USB disk you do not need to erase the media.
l. Finally, click the play icon to remount the device so it can be used by Elementary OS.

Your USB disk will now be blank and ready for use.
Good luck.


Don't show latest content on frontpage

Question: How do I make it so Drupal doesn't automatically show latest content on frontpage?
Answer: One way -- possibly the easiest way -- is to create a page containing whatever you want to be displayed on the home page, then going to www.yoursite.com/?q=admin/config/system/site-information if you're using Drupal 7 (or www.yoursite.com/?q=admin/settings/site-information if you're using Drupal 6), and then changing Default front page from node to node/1 (assuming the page you created was normally located at www.example.com/node/1).
Answer: The best way depends on what you want on your home page.
If you want a page of content, then creating a node and setting it to the home page at admin/config/system/site-information is the best way.
However if you just want a page of blocks, with no node content, there are better ways.
This is because creating a blank page and assigning it to the home page is a bit of a hack, and it means the system is wasting resources doing the node load and everything else that goes with it, for an empty node.
So instead you could use:

Panels - Add a panels page and assign blocks where you want
them.
Empty page - Allows you to create empty pages, by
assigning them a path and a page title. You can then assign blocks
using drupal core blocks or using the context module.
Front page - Allows you to do a bunch of things, like set the home page
content, or set the page to use for the front page. The only real
reason to use this one is that is allows different front pages per
role. So if for example you want a different home page for logged in
users, use this module.

Then after you have one of those module set up, you can set the front page to your panels page/empty page at admin/config/system/site-information.

Don't show latest content on frontpage


How to change habit of saying "she" for male or "he" for female in conversations

Question: In my language, Indonesian, we don't use he or she. We only use one word, dia, but we know what we are talking about in the conversations. Now, in English language I have to use "He" or "She". But sometimes I called "she" to a male in a conversation or "he" to a female without realizing it.
I caught it sometimes and I changed it right away. I got embarrassed too sometimes.
Now, How to change that habit? Help please!
Comment: Welcome to ELL! First of all, take it easy when you make mistakes, so you can keep practicing cheerfully. (Mistake is the best teacher.) This is nothing serious. Most people will understand. Now, if you want to overcome this habit, I'm afraid that, afaik, there is no shortcut. You just need to repeat it enough times, until you got it right. One good trick to help reducing that number of times is to avoid the translation (back to "dia" in your first language). Just try to map the word he/him/his to men, and she/her/hers to women directly. Good luck.
Comment: Would it be not PC to suggest that girls and S's have more curves?
Comment: Songs are good for fixing meaning, pronunciation through sheer repetition. Think of [She loves you](http://www.youtube.com/watch?v=BOuu88OwdK8) (lots of girls faces in the beginning of the video too!) or [She said, she said](http://www.youtube.com/watch?v=DlKIsg_XdkI) And a much better song IMO.
Comment: What DamkerngT said.  When you speak, the choice of *he* or *she* will be largely automatic based on what you've practiced in the past.  That means you've got to practice.
Comment: (this is my hypothesis) I think this is rather a psychological slip, not a sign that you do not grammar or English. (In the sense of English as training, rather than usage). It happens to me too and I am quite proficient in English. It happens to others too, see here. Clearly, it is easy for someone to distinguish between a man and a woman and to associate a corresponding "he" vs "she".It might have to do with the fact that "he" and "she" sound almost similarly. And perhaps "he" takes less effort to pronounce than "she" since for the latter you have to move more the tongue.
Comment: When you are tired/distracted, you are more prone to mumble or take shortcuts in talking. In other situations, depending on the sentences you speak, "she" might be easier to pronounce than "he". So since it is psychological, I suggest you just have to use English more, i.e. just let it flow (this is an advice I don't usually give but in this case, I do).
Answer: Maybe if you remember female is a longer word than male, you can remember that female takes the longer pronoun she, and male takes the shorter pronoun he.


What is responsible for reviving of fallen brothers?

Question: In Battle Brothers, some fallen brothers are revived after end of battle. What is responsible for this? Stats? Perks? Something else?
Answer: Luck mostly
When a brother goes down in combat, there is 2 possibilities : he can either be dead for good, or have a chance to be saved at the end of the fight.
Your brother is dead for good if:

He dies of a fatality kill (decapitated or crushed skull)
He is revived as a Wiederganger
He is eaten by a Nachzehrer (while "dead" ; if he is swallowed while still fighting by a stage 3 Nachzehrer he can still be saved, provided you free him quick enough), or by the Kraken
He is poisonned to death by a Webknecht

And I think that's about it. Now, if your brother demise doesn't fall into one of these categories, he has a chance to survive with "only" a permanent injury. I don't recall the exact probability of survival, but it should be something between 30% and 50% and it doesn't depend on your stats. The only exception is if your brother has the "Survivor" perk, in wich case the chance of survival is of 90% ! However, if that brother already has all of the possible permanent injuries, he will die (and at this point, that's mercy !)
Answer: According to the source code (version 18.104.22.168):

Fatalities kill for good.
Basic chance to survive is 33%.
Survivor trait increases the chance up to 89.76%
Arena Veteran trait increases the chance up to 49.83%
If a brother has both Survivor and Arena Veteran traits, the chance to survive is 135.5% which means that he will always survive unless other conditions from this list prevent it.
A brother dies for good if he has all possible permanent injuries.
Surgeon follower guarantees surviving if a brother does not have any of the permanent injuries.
Slaves in the Manhunters scenario always die for good.
If a brother was auto retreating and killed, it is for good.


Are there laws serving a compelling government interest that create neither rights nor duties?

Question: There are laws, such as proclamations enacted for symbolic reasons, etc., that neither require nor prohibit conduct.  In other words, the law creates neither a right/benefit nor a duty.  Can any such law be characterized as serving a "compelling government interest," which is a test used in a constitutional strict scrutiny analysis.  Just one example of such a compelling statute would be interesting.
Comment: The harder question would be whether anyone would have standing to contest such a proclamation on the grounds that the suffered an actual injury from it.- even taxpayer standing would be hard to show. Some laws that would seem to create neither rights nor duties would be designations of the proper names of mountains and the adoption of other toponyms (e.g. city and street names), which might serve the compelling governmental interest of being able to accurately identify the names of places for all manner of purposes, e.g. a street named "Book Of Mormon Is True Avenue".
Comment: @Nate Eldredge A client of mine just opened a new consulting business and send a photo of himself in Office Depot with a mountain of new office supplies on an oversized cart. I can't even imagine what $150,793 of paper clips would look like.
Comment: What about a spending measure?  Say, a law authorizing the Treasury to spend $150,793 to purchase paperclips.  This could certainly serve a compelling government interest (the government really needs paperclips) but doesn't create rights or duties (except maybe for the Treasury itself).
Comment: Based on the "spending measure" and public (not private) property naming examples, which are about the government regulating itself, perhaps the question should be narrowed to laws creating rights or duties falling upon persons outside the government itself.
Answer: 36 U.S. Code § 301(a)

The composition consisting of the words and music known as the Star-Spangled Banner is the national anthem.

This, on its own, simply defines our national anthem, and even part (b) only says what people should (not must) do while it is being played.
36 U.S. Code § 302

"In God we trust" is the national motto.

36 U.S. Code § 101:

The President is requested to issue each year a proclamation...
Comment: I wonder if the second two examples count.  Does the motto, through other legislation, create a duty for the national mint to feature something on coinage?  Is a "request" of the President optional, or a "duty?"


Restart button in Python

Question: I am having trouble with python. I am making a text-based adventure game, and I am trying to make a restart function when you die. I am trying to count deaths by doing deaths = deaths + 1 whenever you die, but the only way to restart is to re-run the entire script, which resets the death counter. Does anyone know how to restart a script without re-running the program?
Comment: keep the death counter in the global scope, and put the game script in a procedure. Have a while loop that calls the game script procedure, and then wait for the game to end (either in a death or in a victory, and then handle the result (death: increment deaths, check if player wants to restart -- Victory: display a victory screen and ask to restart)
Comment: @Ben313         Thank you so much for your help. My script is running perfectly.
Comment: Could you persist the data out (akin to [bones](http://nethack.wikia.com/wiki/Bones) in nethack) and then let them rerun it, pulling in the updated data?
Comment: Rerun the script, but make the death count an argument it parses. If not set it defaults to 0, from then on when you restart it give it the new deathcount
Answer: You can call your script from another script, and when you "restart", use the reload built-in method.
<code>reload(mymodule)
</code>
This isn't truly ideal though for a game. What you're instead looking for is a level loader, with a main loop which handles state.
Does that make any sense? Its a fun challenge building your own level loader, and might be more effort than you want to put in.

Restart button in Python


Magento Including External library

Question: I have tried Joreon Vermeulen's method https://stackoverflow.com/questions/6417394/how-to-add-a-3rd-party-library-to-magento to autoload classes but to no avail. Now in my custom autoloader I get the class 'SnsClient.php' but this does not help Magento get the path. I can hardcode it for this particular file but then SnsClient.php uses a file in another folder. Magento is giving can't find error.  I understand that I have to only find a way to get these files path but I have zero ideas about it. Please help
Answer: You can put your classes in the lib folder but just make sure they follow the naming convention.  Class_Name_Here maps to the file Class/Name/Here.php relative to the lib folder
Comment: Yup that is what I ended up doing, should have updated question. Thanks anyways. I just had to add this in my helper function:                     include_once 'aws-autoloader.php';use Aws\Sqs\SqsClient;  to use SQS. Of course, I had to copy files to lib folder first. Asked a stupid question.

Magento Including External library


Is there a big difference between Yellow and Yukon Gold potatoes?

Question: After moving to Canada six months ago, I still haven't found Yukon Gold potatoes at the grocery stores. Instead I find Yellow potatoes and was curious as to whether or not they are considered to be the same or if they are completely different. I find that the texture is a little bit "harder" than the Yukon Gold potatoes but overall seem pretty similar. So, are Yellow potatoes the same as Yukon Gold and can they be used interchangeably?
Answer: They are often used interchangeably.  The truth is, yukon gold potatoes are a type of yellow potato.  They were developed in Canada.  You will definitely see them on store shelves here in Canada, but it can be seasonal, depending on your location.  I am in Winnipeg, and I find YG about six months of the year.
Comment: Yeah, I guess that was a little obvious.  Here in Manitoba, we grow a lot of russets and yukon golds, our soil lends itself to those varietals.  Can't speak to their availability in the far East.  However, they are very similar, so as long as you can get yellow potatoes, you should be OK.  Although, I must admit, I find the yukons to be just a bit nicer myself.
Comment: I live in the Maritimes and I have yet to see them in stores, but I shall keep my eye out for them. I had had the feeling that they were developed in the Yukon Territories, hence the name. ;)
Answer: Look for Maine Carola Potatoes. They are the closest to the actual Yukon in both flavor and texture. Maine grows lots of Yellow White and Russet potatoes. I'm willing to bet that some stores in the maritime have the Carola Potatoes.
Answer: In Ontario I find that yellow potatoes are not the same as Yukon gold! Yukons have a different texture and cook differently. I can't find them right now (late September) and am disappointed. Hope they are available soon!
Comment: Can you elaborate on what the differences are in texture and cooking? (Does one take longer, not hold its shape as well, etc.?)


Camera Coordinate To Screen Coordinate

Question: I want to convert the camera coordinate to screen coordinate. I have asked this question because my camera is 48m wide and 32m high but my screen is 480x320 pixels. So whatever collision point I get those are based on camera. Also I like to mention that my camera set at center of the screen. So I get (0,0) coordinate at middle of the screen. At collision time I put some particle effect but now that particle effect not at correct place in the screen. So someone from community please help.
Answer: How about using the project-method in the camera class.
camera.project(Vector3 worldPoint)

That projects the vector cameraPoint from world/camera coordinates into screen/window coordinates. The reverse method is camera.unproject(Vector3 screenPoint). Have a look at the libgdx camera class.
Comment: This is the right way to do it +1 :D
Answer: Taken from http://www.badlogicgames.com/wordpress/?p=2032
I'm only assuming that this will help based on your question...
Ray pickRay = cam.getPickRay(Gdx.input.getX(), Gdx.input.getY());
Intersector.intersectRayPlane(pickRay, xzPlane, intersection);

Answer: What you need to do is to translate the camera coordinates into viewspace.
In this particular case your Camera coordinates go from [-24,-16] to [24,16] and you want that to translate to [0,0] to [480,320].
Pseudo code:
view.X = camera.X * 10 + view.width / 2
view.Y = camera.Y * 10 + view.height / 2

Camera Coordinate To Screen Coordinate


How flat should bench aprons be?

Question: I'm building the Christopher Schwarz Knockdown Nicholson bench. This is my first foray into handtool building. I'm working on the aprons now and have cleaned up the boards and made them mostly flat on the faces. My question is, how flat is flat enough for the aprons? I understand that the top is the most critical and that generally flatter is better, but given that generally the aprons would be supporting boards while working edges and ends, is it important for it to be dead flat?
Comment: I would say no, but it's good practice for when you try to do the top...
Comment: How clear is the wood you're working with BTW? If you're having to deal with any serious knots here's a top tip to make that go easier: dampen them. This almost instantly softens the wood and makes planing through knots tons easier. This tip also works well for end grain in some species, and to ease planing in some highly figured woods.
Comment: Given it's a knockdown bench, I could always come back later to make the outside faces dead flat if I need them to be, and I'll have a workbench to work them on too!
Comment: The stock I'm using for the aprons and top is intentionally clear, very few knots, and I selected the truest to the eye boards for them as well. The knots that I've had to plane so far haven't put up too much fight, thankfully.
Answer: The simple answer is dead flat, with faces parallel, but that's too simplistic and it needs to be looked at a little closer if we're talking hand tools only.
There actually isn't a single standard for flatness or parallel-ness, despite how it might seem in the era of power tools with the enormous amount of time and labour they save in basic four-squaring operations. In some furniture work it's actually not vital for both faces of a board to be flat, or parallel, since e.g. only one face is visible, or interacts with other pieces.
You could think of this as an extension of that. So, how un-flat is acceptable given that:

the backs of the aprons interact with the halving joints/lap joints in the legs, so have to be flat enough for that to work;

the outer face of the front apron is a bearing surface when boards are held against it during edge planing (and for the occasional wide end that you can't shoot), so should be flat enough for that to work well.

This leaves the outside face of the rear apron as the only face where it can easily be argued that it doesn't need to be flat. You could even leave it rough from the scrub/jack plane if you really wanted. Especially if it'll rarely or never be seen.
But there's another way of looking at this given that you state they're mostly flat already — the bulk of the work has already been done and it's not much additional effort to get to flat, not if your longest plane's iron is good and sharp and you follow proper procedure. Assuming you're working on a decent surface for planing that isn't moving around on you a lot and robbing energy from each push!
Maybe it would help to see someone doing this for reals, so take a look at this video from Frank's Workbench, Stock Prep with Hand Plane vs Jointer/Planer.
Comment: Yea, I think the crux for me is doubting how little effort it will take me (a novice) to get to dead flat from mostly flat. For what it's worth, my current work surface isn't ideal for working on a 6ft board at all. Certainly any practice at this point would be good for me, but I also don't want to worry about things I shouldn't worry about!
Comment: Your point about leaving it a little rough reminds me of a tip I picked up about aprons.

Aprons want to be a little bit rough -- a la with a scrub plane. A smoother apron will have less grip to it whereas a rougher surface for an apron will offer some resistance to help hold work stable.
Comment: @YoStephen, I've heard the same rationale WRT workbench tops, but there's a difference between rough, like the sanding texture from 60 or 80 grit, and actually three-dimensional such as scalloped from a roughing plane. The only reason I was suggesting this was OK with the outward face of the rear apron is precisely because it serves little to no active function, esp. on a non-walkaround bench.
Answer: I would say this is down to the tolerances of your work and how out of tolerance your apron would be. The bench is after all an expression of your own process and preferences -- no more, no less.
Personally, I would want any workholding apparatus I'm on to be pretty reliably square, flat, and true. But that is because I would like to have the option to finely craft furniture and mill work with my bench. Any imprecisions in the tools in my process will be transferred into the work and will have to accounted for with addition checking and re-working as needed.
To illustrate this in the context of an apron, let's say I am edge jointing some stock for a table top and that my apron has some twist in it such that the right side protrudes out 1/4" or 6mm. I, as a right-handed person, will have it clamped to the left side of my apron with an end vice, supported at the bottom with pegs, and on the right side with a hold fast or two. As I am doing my jointing at my warped apron, the work will have stress on it to conform to the apron and the middle of the span will be somewhat less stable. I couldn't tell you how much error this will impart, but I would expect at least some mistakes from an unsupported stressed worm piece. This error, repeated on every work piece, will be something around which I will have to work. This means I'm going to have to add extra steps to make sure what I am producing on the bench is dimensionally true adding a lot of time over the many years of work I hipefully will be doing at my bench. I wouldn't want that personally, even though I will probably never do production work.
You may not share these aspirations though. For instance if you're making a bench for a plant nursery/conservatory and will be making shelves to water young plants and prepare seedlings, a bit of imprecision is totally fine.
My suspicion though -- since you're working off of a furniture makers' pattern -- is that you'd like to make some nice(-ish lol) pieces for inside your living spaces, your friends and family, and most importantly for your own satisfaction. I also suspect you're a hobbyist like me, meaning the bulk of your time is spent at your day job and chores. Free time is a precious thing. Setting yourself up at this early stage to have to work around as little as possible will have substantial compounding returns as you mature in the craft.
If that's the case I would strongly suggest flattening your apron. It's a considerably difficult task and I totally sympathize if you're feeling daunted.
It's also worth noting that, since your building a knock-down plan where the apron is a stand alone element, you could conceivably punt on flattening your apron to a later date when you're more experienced. There's probably trade-offs with having a warped structural element. But hey, you're not a machinist here and there's probably not reason to be counting thousandths of an inch in this. The most important thing is your enjoyment and that you're not stressing to the point you don't even want to swing a plane -- been there and it's no good.
You might also be able to outsource the work to a cabinet shop who have an industrial planer. When I was buying the maple for my own top I expressed such self-doubts to  guy ringing me up at the lumber shop and he gave me his card saying he runs a shop and would be happy to square the top if it was too much for me and my garage sale #7 plane and hardware store bubble level.
Hope that helps and I wish you the best of luck and fun on your journey into handtool woodworking!
Comment: All your assumptions are correct. My intent is to build nice-ish furniture for my family and a few good friends. I do care about accuracy, but I'm not protecting a reputation on anything I build. I think I'll likely get as flat as is reasonable now and then return to flattening after the bench build is complete, if needed. I should be able to remove a single apron and use the new bench to true it up more easily than on my current work surface.

How flat should bench aprons be?


How do we understand L C Oscillations (Inductor - Capacitor Circuit Oscillation) Intuitively?

Question: How do we understand L C Oscillations (Inductor - Capacitor Circuit Oscillation) Intuitively? How to intuitively understand the Phase Lag and Imagine What is happening in the circuit exactly without the analogy of SHM? Currently my understanding of L C Oscillation is only mathematical. I am convinced with the mathematics, but I am not able to explain it intuitively to other person that why it is happening so.
Answer: Let's start with a capacitor charged to $V_0$, with energy $U_E=\frac {CV_0^2}2$.
When we connect an inductor, the voltage on the capacitor is applied to the inductor and the current through the incductor starts to grow according to the known formula: $\frac {dI(t)}{dt}=\frac {V(t)} L$.
Looking at this formula, we can see that, as the capacitor is discharged and its voltage decreases, the growth of the current slows down. At the point, when the voltage on the capacitor becomes zero, the current stops growing, which means that it has reached its maximum.
Since the voltage on the capacitor crosses zero, when the current through the inductor is at its maximum, we can say that there is a $90^\circ$ phase difference between the voltage and the current.
So, as the capacitor (the analog of a mechanical spring) has just reached its neutral point and ran out of its potential energy, the inductor (the analog of a mass) has reached the maximum of its magnetic energy, $U_B=\frac {LI_0^2}2$, and, as the moving mass continues to move, the flowing current in the inductor continues to flow. This inertia is the reason the oscillations do not stop.
The next quarter cycle is symmetric to the first, both mathematically and physically, and the second half of the cycle is just a mirror image of the first half.
The $90^\circ$ phase shift between the voltage and the current signifies the fact that two quarters of each cycle, when the direction of the voltage coincides with the direction of the current, the energy is passed from the capacitor to the inductor, while the other two quarters of the cycle, when the current flows against the voltage, the energy is passed from the inductor to the capacitor.
Comment: you say that the inertia is the reason it does not stop, and this is all well and good for mass but what about charges, how are you defining inertia of charges?
Answer: Basically what is happening is the capacitor and inductor are passing energy back and forth.
The energy stored in a capacitor's electric field when its voltage is maximum (your first, fifth and ninth figures) is given by
$$E_C = \frac{1}{2}CV^2$$
When the capacitor losses all its charge it no longer has any stored energy (your third  and seventh figures). It becomes stored in the magnetic field of the inductor when the current is maximum, which is given by
$$E_L = \frac{1}{2}LI^2$$
Realistically there is alway some resistance in the circuit dissipating energy so the oscillations are damped until all the energy is dissipated in resistance and the current goes to zero.
Hope this helps.


Can redis fully replace mysql?

Question: Simple question, could I conceivably use redis instead of mysql for all sorts of web applications: social networks, geo-location services etc?
Comment: I just like the idea of having one database system.
Comment: You *could*, the question is *should* you? In my view, the answer is probably not for everything.
Answer: Nothing is impossible in IT. But some things might get extremely complicated.
Using key-value storage for things like full-text search might be extremely painfull.
Also, as far as I see, it lack support for large, clustered databases: so on MySQL you have no problems if you grow over 100s of Gb in Database, and on Redis... Well, it will require more effort :-)
So use it for what it was developed for, storing simple things which just need to be retreived by id.
Comment: how would I do something like get all keys starting with user ... where the value is less than 5?
Comment: Travis Glines: to be able to make that query store your data in a format that allows you to do so (a sorted set should work for that purpose). if you want to be able to make general queries, use a relational database.
Comment: @Travis Glines, well it's opensource, so you can implement it :-D
Comment: What's your opinion on that in 2017?
Answer: ACID compliance is a must, if data integrity is important. Medical records and financial transactions would be an example. Most of the NoSQL solutions, including Redis, are fast because they trade ACID properties for speed.
Sometimes data is simply more convenient to represent using a relational database and the queries are simpler.
Also, thanks to foreign relationships and constraints in relational databases, your data is more likely to be correct. Keeping data in sync in NoSQL solutions is more difficult.
So, no I don't think we can talk about full replacement. They are different tools for different jobs. I wouldn't trade my hammer for a screwdriver.

Can redis fully replace mysql?


Use of vapor barrier underneath a 3-season room

Question: I have enclosed a screen porch with airflow underneath into a 3-season room. I have installed OSB over the existing pressure-treated decking, with the intention of installing ceramic tile over the OSB. I have been advised that I should have installed a vapor barrier over the pressure-treated decking and under the OSB, which I did not do. Do I need a vapor barrier, and if so, can I attach 6 mil plastic to the underside of the joists to provide a moisture barrier?
Comment: Nothing wrong with OSB as a subfloor for tile as long as it has a suitable support structure (joists, blocking), and as long as you use an appropriate base for your tile (cementboard, hardieboard, etc.).
Comment: My opinion, is OSB is not a suitable subfloor for tile.  Remove the OSB, put down the vapor barrier then a 3/4 plywood with a 1/4 inch cement board. then you can tile.
Comment: You're telling me, @RMDman, that my contractor who just installed 3/4" T&G OSB subflooring in my bathroom addition shouldn't have done that if I was putting down tile?
Comment: If we are talking ceramic tile, unless there is going to be at least 1/2" of some type of cement board over it, then NO.  I would never tile over OSB.  (Frankly I never use OSB for anything.) From the question..." I have installed OSB over the existing pressure-treated decking, with the intention of installing ceramic tile over the OSB. "...
Comment: We still need an Answer, preferably to the vapor barrier question... Pondering reworking my own enclosed porch, so interested in general opinions about what to do with this kind of floor.
Comment: @RMDman, we're off topic, but tile _always_ needs at least 1-1/4" of subfloor. So an initial layer of 3/4" OSB is absolutely not a problem. It's implied and assumed that something will be installed over it.
Comment: Joe, what's the insulation and heating situation? Those are the critical factors here that you haven't mentioned. (In my region, "three-season" does not preclude heat and A/C for the two flanking seasons.)
Comment: Recommend you take a look at this question about a sunroom. https://diy.stackexchange.com/questions/221077/where-to-place-the-vapor-barrier-in-a-sunroom-floor
Answer: No, I would not install a vapor barrier under the floor joists.  IMO, doing so would tend to trap moisture on the inside of the vapor barrier.  And if that happened it would be almost impossible for it to dry out inwards toward the house with a ceramic floor.
Note that this not a whole lot different from having a room above an unconditioned crawl space, except that in your case you don't have a big source of moisture (no bare floor of a crawl space to contend with), and you have plenty of air circulation.
I would leave it open.
If you really feel the need to add something, consider a semi-permeable house wrap.
Comment: Joists hold up floors and are generally horizontal. Rafters hold up ceilings and are generally angled away from horizontal. ;)
Comment: I increasingly lean to cellulose insulation which simplifies the vapor barrier question down to "none works fine" rather than the delightful question of "which side is really the warm side, here?" But then, I don't see any insulation mentioned, so it might be more of an "extended summer" porch than a real 3 season - or it will be an expensive-to-operate 3 season with cold floors at the beginning and end of its use..
Comment: I didn't see anything about insulation mentioned either.  Which is why I limited my answer just to the vapor barrier aspect.
Comment: I originated the question regarding the vapor barrier issue below the 3-season room. To be more specific, the room will have no heat or A/C,, or insulation under the floor. The open space underneath the porch is approx 2' deep with a dirt base. I'm considering adding a vapor barrier under the joists, leaving a 10" - 12" gap between the vapor barrier and the pressure treated (PT) decking above. The OSB is sitting directly over the PT decking, which has gaps between boards of between 3/16ths and 1/4." The OSB is not painted on the bottom side. Any additional thoughts given this additional info?
Comment: I still would not add the vapor barrier the way you're suggesting, for the reasons I gave in my answer.  I think this is one of those situations where no vapor barrier is better than one in the wrong place.


What is the difference between job shop scheduling and resource constrained project scheduling?

Question: I read here https://slideplayer.com/slide/3353960/ that RCPS is a generalized version of job shop scheduling. I'm new to this area and I'm trying to classify a specific variation of these types of problems. Understanding this difference would be a good start.
Answer: There are three main structural differences between the classic job-shop problem and the classic RCPSP:
1) In the job-shop problem, resource consumption of tasks and capacities of resources (machines) are unitary, i.e. one machine can process only one task at a time. In the RCPSP, resource consumption of tasks and capacities of resources may not be unitary, so in general two tasks demanding the same resource may be executed in parallel.
2) In the job-shop problem, one task (operation) requires only one resource (machine) to be executed. In the RCPSP, one task may require several resources simultaneously to be executed.
3) Precedence constraints form chains in the job-shop problem, tasks forming a chain are called operations and the set of tasks forming a chain is called a job. Different operations of the same job require different machines for execution. In the RCPSP, the precedence constraints can form any acyclic graph.
Comment: If there is "branching" as you define it, then the problem is not job-shop anymore. Thus, definitions of jobs and operations does not apply here.
Comment: So regarding (3): a chain of sequential tasks is a job - but what if there is some kind of branching in the job logic sequence where an upstream chain leads to two separate branches? Would this be 3 jobs, each with a serial sequence of unique operations, or would it be 2 jobs where each job shares a few operations with the other job?
The concept of jobs vs operations is elusive in introductory discussions of this. Thanks!
Comment: just to clarify, does that mean that if the operations not in a direct, ordered sequence, then this is not a job-shop? For example, here: [link](https://api.intechopen.com/media/chapter/43001/media/image20_w.jpg), the precedence branches, where some parallelism is possible, and then the precedence reconvenes at the completion of the job. According to the precise definition, then this is not a job-shop. Is this correct?
Comment: In this link precedences incident to the source and the sink are not precedences between two tasks, they are artificial and do not count as precedence relations. This is job-shop.
Answer: From a practical point of view, Job shop scheduling defines as, processing of specific jobs on the machines in some stages which is called route (maybe involve reverse routes), That even may contain more than one machine in each stage (hybrid models).
Resource-constrained project scheduling defines as, allocate tasks to the resources that, in general, don't have a specific route.
In the job shop scheduling, the objective is to find an optimum sequence of the jobs on the machine (in each stage) to minimize specific aims (E.g. makespan). but in the RCPS, tasks are usually predefined by users and objective is to minimize the duration of the project. In the job shop models, sequencing of the processes is important while in the RCPS it may be or may not. Job shops (or hybrid) scheduling arise in the manufacturing system as a detailed schedule while RCPS comes from projects planning.
Indeed, you could find many related issues by googling. If you are interested to develop a practical scheduling model, I recommended the below reference.
Planning and Scheduling in Manufacturing and Services
Comment: You said "Resource-constrained project scheduling defines as, allocate tasks to the resources that, in general, don't have a specific route." But a "route" seems to be unique to a job, which is "routed" to machines which conduct operations according to the precedence rules. This is confusing to me, can you clarify?
Also, thank you for the reference to the book it's been very helpful.


Amortized analysis of red-black trees

Question: Is there an analysis of red-black trees using amortized analysis? I saw it mentioned somewhere as an example of amortized analysis but all the proofs that I know use a global approach ("black height") to demonstrate the O(log n) runtime of individual operations.
Answer: You may need to look at this report:
https://www.cs.princeton.edu/~fiebrink/423/AmortizedAnalysisExplained_Fiebrink.pdf
Each individual operation takes $O(\log n)$ but when you apply amortized analysis to a sequence of operations, you get something interesting.
Directly from this report:
"However, amortized analysis can be used to show that any sequence of $m$ insert and delete operations causes $O(m)$ structural modifications in the worst case (Cormen et al. p.428). It can similarly be shown that the total time for  $m$ consecutive insertions in a tree of $n$ nodes is $O(n + m)$ (Tarjan 1985)."
Comment: So the amortized runtime complexity is constant / O(1)?

Amortized analysis of red-black trees


How to backup an encrypted Core Storage volume off-site?

Question: Given a hard disk with an encrypted Core Storage volume (but not the decryption password, because the backup service should not have access to that), how would one go about backing it up in a way that allows for pushing it to a cloud storage provider (like Amazon S3) and for incremental backups in the future (because you don't want to to push a full 1TB every day when only a couple of blocks have changed)?
Answer: Proposed solution:
You have an Amazon EC2 instance, with elastic block store large enough to hold the whole of the image you intend to backup:
backup-host.yourdomain.com:
/mnt/EBS/my-desktop-backup/coreimage.dmg
/mnt/EBS/my-laptop-backup/coreimage.dmg

Where:
/dev/ebs-disk-001 -> /mnt/EBS/my-desktop-backup
/dev/ebs-disk-002 -> /mnt/EBS/my-laptop-backup
etc.
etc.

or
backup-host.yourdomain.com:
/mnt/EBS/my-desktop-backup_coreimage.dmg
/mnt/EBS/my-laptop-backup_coreimage.dmg

Where:
/dev/ebs-disk-001 -> /mnt/EBS

Your initial backup would take a long while to sync, but if you employ rsync to sync, then you can eventually have the remote image catch up to your local image's changes.
Once it is caught up, you can then initiate an EBS snapshot on Amazon's side for the EBS volume containing your encrypted image.
Rinse and repeat for each backup period + snapshot you want to have backed up to the remote server, taking the following items/requirements into account:

The Encrypted Image needs to be unmounted.
The remote image copy needs to be 100% synced with the unmounted local image.
The snapshot needs to be done with the remote EBS volume sync'd, filesystem buffers flushed, and with no changes pending.

With this, you will be able to do the incremental backups using Amazon's cloud technology.
S3 has some serious limitations, which would not suit your needs, for this particular purpose.
The EC2 instance, if fully backed by EBS, can be shut down when you are not doing a remote sync. Ie, when your backup kicks off, you can have it fire up the instance via Amazon's EC2 API, and get the dynamic name or IP address. Once it confirms it is up, it can kick off the rsync backup. When done, it can shutdown the remote image and initiate an Amazon EBS volume snapshot action.
Edit:
rsync does chunk/block level diffs for larger files. You can specify the size of the block diff:
--block-size=SIZE

You can also specify the data stream being sent to the remote server to be compressed, saving you on traffic.
Caveats about S3 vs EBS:
Unless the solution you employ supports splitting the single large file into segments and sending them in parallel, Amazon S3 throttles the data being sent down to under 400KB/sec after a certain size.
I employ rsync differential backups on my servers to S3 as compressed tarballs. Even at tarball sizes of about 500MB, S3 will throttle. In order to work around this, you need to split the file you are sending up into parts, otherwise, the backup to S3 will take forever.
Whereas an EC2 instance with EBS volumes will be faster and not require the need to split files, simplifying backup and restoration.
Comment: So rsync does chunked diffs and uploads only the parts that have changed?
Comment: @Thilo Yes, that's one of the key benefits of rsync. And you might want to check out Arq or any of the other backup solutions for S3.
Comment: @patrix: Yes, I am quite interested in Arq. But I could not find documentation on how it handles large files that only change a bit every time.
Comment: @Thilo It's in the second paragraph beneath "Wayback Machine" on http://www.haystacksoftware.com/arq/: "Only the changes are uploaded for each backup, minimizing network and storage usage". But I agree that changes could mean file-level as well. Maybe ask their support directly? And let's stop the discussion here now before a moderator jumps in :-) Ping me in chat if needed.
Comment: As noted in my answer, I would recommend against S3, having tried using it as a backup backend, there are multiple negatives to employing it, especially if you intend to do rsync/block diffs. I'll elaborate in the answer.

The ARQ software looks interesting. But I thought the question was how to backup an encrypted filesystem in it's encrypted form and not individual files.


How does changing armv6/armv7 architecture to armv6 affect my iPad app? Will there be performance/stability losses?

Question: I need to change the the architectures of "Any iPhone OS Device" from "Optimized (armv6 armv7)" to "Standard (armv6)" for a library. I'm not exactly sure what effect will this have on the performance and stability of my iPad app.
If I understand it right, the iPad has the armv7 architecture. I'm not so familiar with architectures, so I don't know what it means.
Comment: Why do you need to change it?
Comment: A highscore library I want to use, need this…
Answer: It shouldn't negatively affect the stability, but might slightly harm the performance on armv7.
Comment: Thanks for the answer - What does "might slightly harm" mean? When? My app uses coreanimation, quartzcore and other not graphic intensive tasks.
Answer: The stability will not be affected, however the code within your library will not take any advantages given by the compiler nor the processor.  This will not affect the libraries that you are using as they will be compiled for the specific hardware that your library is being run on.
If you are doing intensive math in your library, you might want to consider creating two versions of the library (one for each architecture) however it doesn't sound like you are.
Figuring out exactly how your library will be affected is going to have to be an exercise for you after you learn about the differences between the architectures and how the compiler optimizes your code for each one.
Long story short, as you have probably already realized, you will probably not see any differences based on how you mentioned you use the library, however it all depends on how you code.


Path integral of $Z_2$-orbifold free boson on torus

Question: The partition function of $Z_2$-orbifold free boson on 2-torus (parametrized by $\tau\equiv\omega_2/\omega_1$) is derived by  operator formalism. I want to consider it in the path-integral approach:
\begin{eqnarray}
Z=\sum_{\nu,u}\prod_{m,n}\sqrt{\frac{\pi}{-\lambda_{m,n}^{(\nu,u)}}}
\end{eqnarray}
where $\nu$ and $u$ taking values among $0$ and $1/2$ define various boundary conditions
\begin{eqnarray}
\phi(z+\omega_1)=\exp(i2\pi\nu)\phi(z), \\
\phi(z+\omega_2)=\exp(i2\pi u)\phi(z).
\end{eqnarray}
$\lambda_{m,n}^{(\nu,u)}$'s are the eigenvalues of Laplacian $\triangledown_\mu\triangledown^\mu$ with
\begin{eqnarray}
\lambda_{m,n}^{(\nu,u)}=-\frac{4\pi^2[(m+\nu)-(n+u)\tau][(m+\nu)-(n+u)\bar\tau]}{L^2(\text{Im}\tau)^2}.
\end{eqnarray}
For simplicity, we can consider the sector in which $\nu=0$ while $u=1/2$ since in this section there are no zero modes to worry about and $m,n$ can take any integer. Then
\begin{eqnarray}
Z_{0,1/2}&=&\prod_{m\in\mathbb{Z},n\in\mathbb{Z}}\sqrt{\frac{\pi}{-\lambda_{m,n}^{(0,1/2)}}}\\
&=&\sqrt{\frac{1}{\prod_{m\in\mathbb{Z},n\in\mathbb{Z}}[m-(n+1/2)\tau][m-(n+1/2)\bar\tau]}}
\end{eqnarray}
where $\prod_{n=-\infty}^\infty$a=1 is made use of. To calculate the denominator, one can define $q=\exp(i2\pi\tau)$ and then
\begin{eqnarray}
&&\prod_{m\in\mathbb{Z},n\in\mathbb{Z}}[m-(n+1/2)\tau][m-(n+1/2)\bar\tau]\\
&=&\prod_{n}\left\{\left[q^{-(n+1/2)/2}-q^{(n+1/2)/2}\right]\times\text{h.c.}\right\}\\
&=&\prod_{n\geq0}\left\{\left[q^{-(n+1/2)/2}-q^{(n+1/2)/2}\right]\times\text{h.c.}\right\}\prod_{n>0}\left\{\left[q^{-(n-1/2)/2}-q^{(n-1/2)/2}\right]\times\text{h.c.}\right\}\\
&=&\prod_{n>0}\left\{\left[q^{-(n-1/2)/2}-q^{(n-1/2)/2}\right]\times\text{h.c.}\right\}^2\\
&=&(q\bar{q})^{-1/6}\prod_{n=1}^\infty(1-q^{n-1/2})^2(1-\bar{q}^{n-1/2})^2
\end{eqnarray}
which means
\begin{eqnarray}
Z_{0,1/2}=\frac{(q\bar{q})^{1/12}}{\prod_{n=1}^\infty(1-q^{n-1/2})(1-\bar{q}^{n-1/2})}.
\end{eqnarray}
However, in the conventional introduction to conformal field theory, such as Eq.~(8.23) of ``Applied conformal field theory'' by P. Ginsparg, there is a $\tau$-dependence phase difference:
\begin{eqnarray}
\tilde{Z}_{0,1/2}=\frac{(q\bar{q})^{1/48}}{\prod_{n=1}^\infty(1-q^{n-1/2})(1-\bar{q}^{n-1/2})}.
\end{eqnarray}
I really cannot understand the existence of this little but essential difference. I notice that the phase difference is $1/16$ which might have its origin in the zero mode change of Virasoro generator $L_0$ when twisting the boundary condition, but I cannot let it make sense quantatively.
Comment: What happens to the sum over topologies in this case. In Ginsparg for example, the case where we have both periodic boundary conditions is discuss in great details. There, we need to make a sum over (m,n) which label the two windings around the circle. For the case with other boundary conditions, what happens to this infinite sum over topologies that does not appear anymore ? Thank you very much in advance!
Answer: You have to use zeta regularization to compute the sum $$\sum\limits_{n>0} \left( n - \frac{1}{2}\right) \, . $$
In other words, evaluate the regularized sum $$\sum\limits_{n>0} \left( n - \frac{1}{2}\right)^{-s} = (2^s -1) \zeta (s) \rightarrow \frac{1}{24}  $$
where the limit $s \rightarrow -1$ is taken.
After taking the square root, you obtain $(q \bar{q})^{1/48}$ as wanted.
Comment: Thanks for spotting the typo. As for the decomposition of the sum, in general this is not possible when regularizing divergent series. You can show that a regularization scheme that is stable ($\sum a_n = a_0 + \sum a_{n+1}$), consistent ($\sum a_n$ gives the expected result when the series is actually convergent) and linear ($\sum (\lambda a_n + b_n) = \lambda \sum a_n + \sum b_n$) is very inefficient (for instance, it can not give a value to $\sum n$). Therefore, one usually drops out the linearity assumption. Indeed, zeta regularization is obviously non-linear.
Comment: Many thanks, and my mistake seems to be that the summation of (n-1/2) was separately done upon n and (-1/2), which produces 1/6. But I cannot quite understand the wrongness of such separate summations. Perhaps, I should go to read the complex analysis more carefully. (By the way, may I point out a trivial typo in your answer where summation should be done over n>0 rather than n>1)


Changing the color ramp in arcgis javascript

Question: Using the arcgis javascript api, I am displaying geotiffs. What I want to do is change the color ramp in these images. I've looked through the api and I have not seen anything. Does anyone know where I can get some examples of this?
Comment: How are you displaying these GeoTIFFs? Are you connecting to an Image Service or are you somehow displaying them completely client-side using MapImageLayer?
Answer: If you want to allow clients to change layer appearance and behavior in your map service, you can enable dynamic layers after you've already published a map service. Dynamic layers can increase the amount of interaction that users are able to have with your maps.


Panama Transit Visa

Question: I am a Nigeria citizen. I am trying to obtain a Panama transit visa, but they don't have an embassy here in Nigeria. Is there a way I can apply for it online?
Comment: How long is your transit? https://travel.stackexchange.com/questions/181746/does-a-nigerian-need-a-transit-visa-for-a-14-hour-layover-in-panama-traveling-f
Comment: 14 hrs long. How can I apply for the transit visa required?
Answer: You can apply for a Panama visa "online". There is an online portal offering this service from the Panamanian ministry of foreign affairs, BUT it is only available in Spanish. You would have to choose one of the three embassies on the African continent for processing of your application, and may have to end up going in person for biometrics or an interview. The three representations in your area are:

Cairo, Egypt
Casablanca, Morocco
Pretoria, South Africa
Comment: If you feel it answers your question then please accept it. I understand it isn't convenient , but you can always contact the consulates before applying to see if it can all be done remotely. Here is the link to the contact info of the embassy in Morocco (https://mire.gob.pa/ministerio/embajada-y-consulado/rabat-embajada/) you can find the others in the same page
Comment: Thanks for your responses. It really helps.
Comment: Thanks for your response, very helpful. Sigh, this is a big task on my end, cos I reside in Nigeria, and I'm not sure if I will be able to appear in person for biometrics, thought it is an application that can be done online.

Panama Transit Visa


Croatian locale for Magento 1.9

Question: I have been searching for a decent Croatian locale for magento 1.9 but so far nothing. Could you recommend something?
Answer: You can find here a lost of all locale packages.
They are from 2 years ago and they were all downloaded from the magento commerce website when it worked.
I know they are old, but at least it's a place to start.
In addition to that, you can use this extension that will help you isolate the texts that require translation on module bases.

Croatian locale for Magento 1.9


How to Time In/Time Out With One Button

Question: I'm currently making a payroll system for our thesis and I'm having trouble when it comes to Time In Time Out. Our panel said that we should put only one button and one textbox. How should I do that. Thanks in advance.
Comment: get the button to write to a list or an array a timestamp so whenever the button is pressed the current date/time is logged. When you want to "total up" the time spent "in" (`time_in_total`, for example) you create a nested loop - the outer one iterates the entire array, the inner loop iterates over two array elements (1,2 then 3,4 then 5,6 etc.) and works out the time difference (your "time out" minus your "time in") and add this to a total - display this in your text box, for example.
Answer: You need a timer control and and a single start/stop button. On the first click of the button set the timer to enabled. Show the timer's elapsed time in your textbox. On the next click check if the timer is enabled then measure the timespan between now and when the timer was started.
Full example with code is here: http://markb.co.uk/creating-a-simple-stopwatchtimer-application-with-c-windows-forms.html
Comment: I already have a timer and a database connection
Comment: Use cases:

1. First use (Time in):

Button clicked -> Record time to database -> Set time variables to current time -> Start timer

2. Second use (Time out):

Button clicked -> Stop timer -> Record elapsed time to database -> Stop timer

3. Repeat case 1.

4. Repeat case 2.

How to Time In/Time Out With One Button


Tutorial for ajax form posting

Question: I am looking for a short and easy tutorial for posting form data using ajax & POST. More specifically for comments in a custom wordpress theme.
So far I have only found this: http://www.simonerodriguez.com/ajax-form-submit-example/ but the js file is huge so I think there is a lot of bloat (couldn't decipher it all). I've also searched on this site but most threads use jQuery or do not cover what I'm looking for.
Do any of you know a tutorial for this, or could anyone explain the basic code to me?
Thanks a lot for your help and suggestions!
P.S. please do not suggest jQuery as I am not using it and want to learn pure Js :).
Comment: this one is nice: http://www.javascriptkit.com/dhtmltutors/ajaxgetpost.shtml
Comment: @Sebas looks good indeed. I'll take a look at it!
Comment: @Sebas Pot that link as an answer. Perfect content. :)
Answer: <code>function initiateRequest()
{
  if(window.XMLHttpRequest) {
        return new XMLHttpRequest();
  } else {
        return new ActiveXObject("Microsoft.XMLHTTP");
  }
}

function createClearingHouse() {

    parameters = "name=" + document.getElementById("username").value;
    url = EnginePath + "/clearingHouse/persist"
    request = initiateRequest();
    request.open("POST", url, false);
    request.send(parameters);
    if(request.readyState==4  && (request.status == 200)) {
       alert("success");
    }
}
</code>
Comment: no this is not part of the code, just i have given heading. i will remove it
Answer: As I've been asked for it... Here is a quite complete link:
http://www.javascriptkit.com/dhtmltutors/ajaxgetpost.shtml
Cheers,
S.

Tutorial for ajax form posting


Are planets moving away from the sun?

Question: I saw on the tv show Through the Wormhole (hosted by Morgan Freeman) that the planets in our solar system have been continuously moving away from the sun for millions of years. however, when I try to Google about it, there isn't much written about it.
Is it a proven fact that the planets are moving away from the sun?
Comment: As the sun shines it loses mass and anything that loses mass loses some of it's gravitational pull.   The effect is quite small compared to the total mass of the sun though.
Comment: I don't know of experimental results, but since the Sun is losing mass through solar radiation and other solar wind, the planetary orbits should be expanding by a tiny amount. There could be other effects through tidal forces and gravitational radiation that could in principle affect this too, but I'd expect them to be even tinier still--esp. the latter, which should be just plain negligible.
Comment: Similar question asked here:  http://physics.stackexchange.com/questions/130374/changes-in-planetary-orbit
Comment: @Stan Liou Thanks for your comment. May I know, if the Sun is losing mass, would that decrease its gravity?
Answer: I asked a somewhat similar question but just about the Earth.  Here and in my question there's some links that you might be interested in.   Jupiter for example is thought to have moved closer to the sun during the late heavy bombardment, then back outwards.   So I suspect that through the wormhole didn't get that point quite right.   Observations by the Kepler Spacecraft in the hunt for exoplanets suggests that a number of planets in other solar systems have moved closer to their suns over time.
In general, there's a few parts to this question.
On the sun losing mass:
Yes, it is, but only a little bit.  See Here.  Their math isn't complete as they don't factor in coronal mass ejections or take into account the sun's expected increase in luminosity, but the gist of their point remains true.   The sun is only losing a tiny percentage of it's mass.  The effect on planetary orbits is pretty small.
Sunlight also creates a pressure against the planets, but this effect, isn't very much due to the comparatively enormous mass of the planets compared to the light and coronal mass ejection material that hits the planet.
Tides
Tidal effects can work either way depending on the rate of rotation compared to the planet's orbital rotation.  If the star turns ahead of the planet, the tidal force should push the planet slowly outwards, like the Earth is currently doing to the Moon.   If the planet moves around the star faster than the star turns, the tidal effect is reversed and it slowly pulls the planet in.  At our Sun's current rate of rotation it's moving ahead of all the planets, so there should be a small tidal force that pushes the planets outwards, but very very slowly.
Orbital debris and effective loss of angular momentum during planet formation.
If the orbit is littered with dust and comets, asteroids and such, the sun can gain mass faster than it loses it and the planets can effectively slow down as they move through the dust or orbital debris with more oblique orbits.   This may be the explanation for hot Jupiters and so many observed planets very close to their suns in other solar systems.
Planets can affect each other.
See here and a curious possibility here.   Planet to planet effects are tiny unless they are in resonance where the effect can be amplified and become significant over time.
Hope that's clear enough.  I can tidy up and provide additional links for reference if needed.
Comment: I would think that, compared with where the planets once formed, they have rather moved inwards. Total kinetic energy potential (whatever physics term) must be conserved. Some planets and many asteroids and comets have likely been ejected and hence the rest must have moved inwards.
Comment: @LocalFluff  That's a good point.   What I wrote definitely needs to be cleaned up a bit.   The way I wrote it "loss of angular momentum" is a bit strange as angular momentum is conserved,    But I read an article that planets fall in towards the sun because of debris in their path.   I'll try to find the article to make it more clear.

Are planets moving away from the sun?