Python shared libraries - Cheetah namemapper.so not found

Question: I'm using Python Cheetah for template generation and I can't get it to use the compiled _namemapper.so library that is installed. I am running on CentOS 5.4 with Python 2.4 installed, using Cheetah 2.4.3. I cannot for the life of me get Cheetah to use the _namemapper.so file that I built during install:
Filling conf/asterisk/sip.conf.ect -> conf/asterisk/sip.conf ...
/usr/lib64/python2.4/site-packages/Cheetah/Compiler.py:1508: UserWarning:
You don't have the C version of NameMapper installed! I'm disabling Cheetah's
useStackFrames option as it is painfully slow with the Python version of NameMapper.
You should get a copy of Cheetah with the compiled C version of NameMapper.

However, I have the shared library sitting right next to the NameMapper modules:
$ ls -ltr /usr/lib64/python2.4/site-packages/Cheetah/ | grep -i namemap
-rw-r--r-- 1 root root  12376 Jul  1 20:17 NameMapper.py
-rwxr-xr-x 1 root root  36982 Dec  1 09:55 _namemapper.so
-rw-r--r-- 1 root root  12541 Dec  1 09:55 NameMapper.pyc

I've tried adding this directory to /etc/ld.so.conf.d/python-cheetah.conf, and the _namemapper.so shared library is not found.
Any ideas?
SOLVED
Thanks @alex-b. Turns out I had compiled Cheetah on a 32-bit machine and was attempting to load the shared library on a 64-bit machine. D'oh!
>>> from Cheetah._namemapper import NotFound
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: /usr/lib/python2.4/site-packages/Cheetah/_namemapper.so: wrong ELF class: ELFCLASS32

Then I ran into the next problem:
>>> from Cheetah._namemapper import NotFound
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: /usr/lib/python2.4/site-packages/Cheetah/_namemapper.so: undefined symbol: PyUnicode_FromFormat

And it turns out that Cheetah doesn't work so well on Python <= 2.6, so I will be upgrading.
Answer: Sometimes it's useful to use strace to print out open calls to trace the search path used by Python.
eg.  If the name of the module you're trying to import is namemapper, the following will show the paths searched for the namemapper module.
strace -e open python -c 'import namemapper'

This may give you some clues as to why your module is not being used.
Edit: corrected spelling of module name in the strace command-line above.
Comment: Great trick, thank you. I tried this and confirmed that the shared library is found when I import Cheetah.NameMapper:

open("/usr/lib/python2.4/site-packages/Cheetah/_namemapper.so", O_RDONLY) = 4
open("/usr/lib/python2.4/site-packages/Cheetah/_namemapper.so", O_RDONLY) = 5
Answer:
Make sure that _namemapper.so is in one of the paths in sys.path when your script is invoked. It's possible that something is misconfigured (can be another python installed somewhere, for example, in your home directory).
import sys
sys.path

If the library itself is indeed loaded, try checking if it's of the correct version. It seems that Cheetah tries to load particular functions from _namemapper (Utils/NameMapper.py:288):
try:
    from _namemapper import NotFound, valueForKey, valueForName, \
         valueFromSearchList, valueFromFrameOrSearchList, valueFromFrame
    C_VERSION = True
except:
    C_VERSION = False

If this fails, C_VERSION is set to False, which gives you this warning. Try importing these symbols from _namemapper yourself, it may be that your _namemapper.so version is wrong.
Comment: >>> import sys
>>> sys.path
...'/usr/lib/python2.4/site-packages'...]

and

ll /usr/lib/python2.4/site-packages/Cheetah/_namemapper.so
-rwxr-xr-x 1 root root 28864 Oct 12 08:59 /usr/lib/python2.4/site-packages/Cheetah/_namemapper.so


Name of the modular group

Question: I've been studying the hyperbolic plane and the action of the group $PSL(2,\mathbb{R})$ on it.
I found that the modular group $PSL(2,\mathbb{Z})$ is a discrete subgroup of $PSL(2,\mathbb{R})$ so it's Fuchsian.But where does the name of the Modular group come from?How is it related with the Modulii spaces?
Answer: If you wish to study flat structures on the torus $T^2 = \mathbb{R}^2 / \mathbb{Z}^2$, i.e. Euclidean metrics on $T^2$, it comes down to studying lattices in $\mathbb{R}^2$, i.e. discrete subgroups isomorphic to $\mathbb{Z}^2$.
Lattices can be normalized in some fashion. One useful normalization is to rotate and scale the lattice so that $(1,0)$ is a shortest element (not necessarily unique).
Suppose we have a lattice $L \subset \mathbb{R}^2$ has been normalized in that fashion, i.e. $e=(1,0)$ is a shortest element. Then the lattice is determined by its "modulus", which is the (almost) unique point $p=(x,y) \in L$ such that $|p| \ge 1$ (since $(1,0)$ is a shortest element) and $-\frac{1}{2} \le x \le \frac{1}{2}$ (since one can always add multiples of $(1,0)$.
Now if you work your way through these definitions you'll see that the set
$$\{p = (x,y) \,\bigm|\, |p| \ge 1, \quad -\frac{1}{2} \le x \le \frac{1}{2} \}
$$
turns out to be a fundamental domain for the action of $PSL(2,\mathbb{Z})$ on the upper half plane $\mathbb{H}^2$ by fractional linear transformation (and, of course, $PSL(2,\mathbb{R})$ is the whole group of orientation preserving isometries of $\mathbb{H}^2$). Furthermore, the non-uniqueness of the choice of $p$ (given the lattice) is exactly the gluing relation on the fundamental domain given by the two transformations under which the edges of this fundamental domain are identified with each other, those two transformations being $z \mapsto z+1$ and $z \mapsto -1/z$.
Thus, the quotient space $\mathbb{H}^2 / PSL(2,\mathbb{Z})$, also known as the "modular space", is the set of "moduli" of normalized flat structures on the torus, and the group $PSL(2,\mathbb{Z})$ is known as the "modular group".
Comment: Thanks for the answer,ı worked  on the fundamental domains and figured out these but ı wasn't aware of the meaning of the modular space in the sense of the torus.

Name of the modular group


Adding HTML markup to elements in a ZendFramework 2 fieldset

Question: I'm sure I'm missing something obvious, but I've been banging my head for a while now.
What I want to do is pretty simple. Say, I want a shopping cart that can hold many items, represented in a ZF2 Form. I create a Form for the shopping cart, and then a fieldset class for the items, then put that item fieldset in a Form Element Collection.
This all works fine, BUT I want to wrap the individual elements of the item fieldset with HTML markup. Put divs around them, put them in a table, whatever.
For the life of me I can't figure out how to do that. In my viewscript, I could iterate through the collection to get the item fieldsets one at a time, then iterate through the fieldsets to explicitly echo the individual item fieldset elements, wrapped by whatever HTML markup I want.
BUT that doesn't deal with the template, and I'm using the template to create additional items, and the template doesn't have the HTML markup that comes from the view template.
I would have thought there would be some way to tell the item fieldset itself how to render itself -- sort of like using a "partial" view template that works in the same way as the page view template, echoing each item fieldset element explicitly and putting whatever else markup -- but this partial view should be attached to the item fieldset itself and rendered for each fieldset in the collection (and the template).
Is there an obvious way to do this I'm just missing?
Thanks.
Answer: Your forms and fieldsets are used by the form view helpers to render the correct HTML markup.
You would need to create a custom (just extend) Zend\Form\View\Helper\FormCollection and depending on what your needs may be, also a custom Zend\Form\View\Helper\FormRow that you then attach to it.
If you look at the code for the form collection you will see that they generate the HTML using the same method you describe doing yourself, however its already done for you; you just need to modify the bits you need, such as the render() method or properties like $wrapper or $templateWrapper etc.


Why is it said that antiparticles are a result of combining SR with Quantum theory?

Question: I did understand the historical reasons for the discovery of antiparticles in this context. But are antiparticles really a 'consequence' of combining special relativity and quantum theory? Why isn't it better to say that the existence of antiparticles are consistent with QM and SR?
Comment: Mathematically, it is different to say that it is "consistent" than "it is a consequence". in the first case the antiparticles could or could not exist, in the second, they have to exist.
Answer: This is a very interesting question. Galileo once stated that "our Universe is a "grand book" written in the language of mathematics".

But are antiparticles really a 'consequence' of combining special relativity and quantum theory

Yes, they are, in that the relativistic mathematical formulation of quantum theory suggests that antiparticles emerge from this mathematics.
In going from standard quantum mechanics to quantum field theory, we introduce the Klein-Gordon equation $$\pm \sqrt{m^2c^4+{\vec{p}}^2c^2}\; \psi = i \hbar \frac{\partial}{\partial t} \psi$$ and the Dirac equation $$(\beta m c^2 + c {\vec{\alpha}}\cdot {\vec{p}})\Psi = i \hbar \frac{\partial}{\partial t} \Psi$$
These equations have solutions that represent both positive and negative energies. We are familiar with positive energies, but this appearance of negative energy solutions represented a possible conundrum, and so a closer look at was happening was required.
Negative energies were nonsensical, and to make a long story short, these negative energy solutions are explained by the existence of antiparticles.

Why isn't it better to say that the existence of antiparticles are consistent with QM and SR?

It's OK either way. The existence of antiparticles is consistent with the combination of QM and SR, and the mathematical formulation itself also predicts the existence of antiparticles.
Comment: Your rendering of the Klein-Gordon equation appears to explicitly discard the negative energies, replacing them with corresponding positive energies.
Comment: I've written the equations down for completeness.  The square root sign in the first equation has an implied $\pm$ in front of it. Solving these equations will go beyond the scope of what the OP was asking.
Answer: Due to QM, you must have wave equations.
Due to SR, you must have relativistic dispersion for your waves. That means,
$$ E^2 - p^2 = m^2 $$
with $E = \omega$ the energy/frequency of the particle/wave (in natural units, this is the same quantity), $p$ the momentum / inverse wavelength, and $m$ the mass of the particle/field.
Unlike its nonrelativistic approximation
$$E = m + \frac{p^2}{2 m}$$
(I've taken the first two terms in the series corresponding to rest energy and the first kinetic energy term) that leads to Schrodinger equation (with $m$ an unobservable shift in the particle's phase that is usually subtracted from the Hamiltonian for convenience), the full relativistic dispersion relation is quadratic in $E$, not linear.
That means that for any theory that is both Quantum Mechanical and Relativistic, we always have negative-energy solutions that correspond to positive-energy solutions.
This is probably a better statement from the mathematical point of view. QM and SR combined give rise to negative energy solutions, not necessarily anti-particles.
To actually make sense of these negative energy solutions, you need the second-quantized formalism (which is closely related to the first-quantized formalism, essentially you just take the Fock space built on top of the first-quantized space of states). Then your solutions can be interpreted as (superpositions of) creation / annihilation operators for two sorts of particles that must have identical properties except for charges which must be conjugate. That's your antiparticles.
I have no comment about anna's answer or "platonists" mentioned therein, I don't believe math molds nature or the other way around, I believe math is a way to model nature. This answer explains why it is usually assumed that QM and SR impose enough constrains on the types of models that you can built that you always should expect negative-energy solutions. One meaningful way of making sense of those is to introduce second quantization and antiparticles.
Answer: Here is another explanation, due to Richard Feynman and outlined in his Dirac Lecture (of which a video is actually available on youtube):
He starts with a space-time diagram, as used to track interactions and events in special relativity, and the equations to calculate probability amplitudes in quantum mechanics. He then sets up a problem in the diagram of a particle scattering off a potential, moving for a bit, and then a little while later scattering off a second potential which returns the particle to its exact same initial state.
He then calculates the probability amplitude for the double-scattering problem using QM and finds that for the probability to be nonzero, the second scattering must be located outside the light cone of the first scattering (this is magic).
This means that it is possible for an observer in a certain state of motion relative to the two scatterings to observe the second scattering before the first one has happened, and to conclude that between the two scattering events, the particle was traveling backwards in time. He supports this by drawing the two-scattering event from that frame of reference, which shows the world line of the particle zig-zag backwards between the two scatterings.
He then assigns an arbitrary electric charge to the particle and asserts that since particles can't travel backwards in time, the physical situation is indistinguishable from one in which an oppositely charged particle is traveling forwards in time.
The spacetime diagram that results has a particle moving forwards in time, minding its own business, while a short distance away a particle/antiparticle pair bursts into existence. The antiparticle then hits the original particle, annihilating it, and leaving the particle half of the pair motoring along in place of the original particle.
He then points out that even though there appeared to be three particles in play during the time slice between the two scatterings, there really was only one particle all along, whose world line was briefly kinked backwards in time before continuing on its merry way.
Hence therefore, Feynman concludes that putting relativity together with QM yields antiparticles.
Comment: Yes, that is a wonderful example/explanation, Niels. +1 You said that a video of this explanation by Feynman  is on YT? Is it the one titled "The reason for antiparticles"?
Comment: I don't remember the title, but it the *event* was called the *dirac memorial lecture*.
Comment: Yep. Thanks. I found it and the title is as I thought.
Answer: There are perfectly well-defined non-relativistic theories that contain anti-particles, and perfectly well-defined relativistic theories that contain no anti-particles.
Examples are a dime a dozen. Take a complex scalar field and turn on a Lorentz-violating interaction. Poof: now you have a non-relativistic theory that contains anti-particles. Conversely, take a scalar field and do Lorentz-invariant interactions only. Naturally, everything is its own anti-particle, and the system enjoys full relativistic invariance.
In conclusion, there is no connection between special relativity and anti-particles.
Not even field-theory is related to anti-particles, at least to the extent that you can define a satisfactory notion of "particle" for non-field theories. You can do e.g. a quantum mechanical model a la SKY with complex fermions. This is not a field theory, yet there is a perfectly sensible notion of anti-particle, as inherited from the charge-conjugation symmetry.
Comment: +1, this directly answers the OP's question. It seems most motivations given when introducing QFT and/or QM+SR are heuristic, rather than logically watertight. One quantum physicist I know, F.C., says they are justifications made in hindsight
Comment: @nielsnielsen Well I can cite Bohr: "An expert is a man who has made all the mistakes which can be made". Feynman was quite the expert and, as such, made plenty of mistakes. And I have something that he doesn't: access to 50 more years of knowledge.
Comment: I like this answer (+1).
Comment: Thanks for your answer. In mine I cited Feynman's derivation, which I believed without question because, well, Feynman, and it took me a long time to actually grasp what he was getting at (like I said, the outside-the-light cone argument is still magic as far as I am concerned). But your answer casts his in doubt. Any comments? best regards, Niels
Comment: Thanks for that. Does that mean that Feynman's derivation contains an error? I wonder what it is. -NN
Answer: It is a shorthand for "in order to mathematically model successfully the experimental data and the  existence of antiparticles, one needs both special relativity and quantum field theory".
Physisista who truly see it as a result belong to the class of "platonists" believing that mathematics molds reality, not that reality is modeled using mathematics.
Edit after a number of negative votes :
The historical fact is that if there had been no observations of particles with the exact same mass and opposite quantum numbers, there would be no incentive to model antiparticles, and any such appearing in mathematical models would have been sent to huge mass values, the way we do with super-symmetric  particles etc now. Data drives mathematical models.
Edit 2.
It is observed that the Dirac equation predicted the existence of antiparticles.  It is the correct fits  for existing data that validated the Dirac equation, and the theory predicted the antiparticles, but the antiparticles are not the "result" of the theory. They are the result of the theory fitting well and predicting the particle data of that time, so that its further predictions could be "trusted".
In my answers I try to ground models to observations, which is what physics is.
Comment: Combining SR and QM is a theoretical activity. So is the antiparticles being the consequence of this combination the theoretical part of physics. There's nothing platonic in saying that if one tries to combine SR and QM, there'll inevitably appear theoretical entities that could be interpreted as antiparticles. The fact that this result happened to match Nature is secondary.
Comment: But historically, isn't this what led Dirac to try and explain away the prediction his theory had made?  Also, how can you adjust the masses of the antiparticles in Dirac theory?  The whole construction forces the antiparticle mass to be the same as the particle mass
Comment: "In my answers I try to ground models to observations, which is what physics is" not at all – physics isn't just a collection of experimental results, it is a (hopefully, small) collection of models that explain all these results. Experiment is a way to confirm / falsify / refine theory.
Comment: @Prof.Legolasov   I did not say that physics is a collection of experimental results. Isay that experimental results to be modeled need mathematical theories. But it is the existence of observations that leads to the need of theories.  Just theories without experimental data to fit for validation  are science fiction.
Comment: @Ruslan  The historical fact is that if there had been no observations of particles with the exact same mass and opposite quantum numbers there would be no incentive to model antiparticles, and any such  appearing in mathematical models would have been sent to huge mass values, the way we do with supersymmetric etc now. Data drives mathematical models. I accept that is is difficult for people working with  mathematical modeling to keep this in mind, the beauty of the mathematics is mesmerizing.  In my answers I try to ground models to observations, which is what physics is.
Comment: @JerrySchirmer  I am not saying that physics theory cannot make predictions.  The reason for the theory is to describe existing data and predict new ones. It is the correct predictions for existing data that validated the Dirac equation, and the theory predicted  the antiparticles, but the antiparticles are not the "result" of the theory. They are the result of the theory fitting well and predicting the particle data of that time.


Darlington Emitter-follower used as a buffer

Question: I have a  circuit with a Darlington emitter follower used as a buffer between a common emitter amplifier and a low resistance load (speaker). i wanted to know if this arrangement could alone (with the corect values ofcourse) amplify an input from a microphone and give output at the speaker. could this arrangement be used for applications such as mobile phone speakers?
if i have an overall voltage gain of say, about 170? would this be enough to drive a speaker of less than 1watt power?
Comment: Can you show us the circuit? You don't have enough reputation to post it yet, but you can upload it somewhere and give us the link. Someone will stop by and edit it in.
Comment: A single-ended drive to a loudspeaker may burn out the coil - be aware of this. The amount of voltage gain required depends on the microphone as much as the speaker (and also the power rails of the output stage.)
Comment: A gain of 170 (44.6dB) will likely not be enough to boost the output of a professional, low-impedance mic to useful speaker-driving voltage, but it could work with a high impedance unbalanced microphone (which is also easy to use with your single-ended circuit). The circuit has to present a decent impedance to a high-Z microphone, however! High impedances don't come easily in BJT circuits: not without more complicated designs with differential input stages and massive global negative feedback. You might benefit from a JFET input stage.
Answer: A single common emitter will probably be not enough to supply sufficient (170×) gain. A Darlington emitter follower will only decrease that gain further (approx. 0.9×), so the quick answer is no.
Depending on your exact circuit, the voltage gain may be fairly easy to solve/increase. So show us the circuit.
Comment: [2SD2153](http://rohmfs.rohm.com/en/products/databook/datasheet/discrete/transistor/bipolar/2sd2153.pdf) and several more on DigiKey.
Answer: As far as I know, Darlington emitter followers only operate in one direction—no AC. Microphones and speakers need current flowing in both directions. If you only have one single-sided follower, it isn't going to work. I think that you might do better with an op amp or two.
Comment: Both op-amps (single-supply) and Darlington circuits handle the AC signal transmission in the same way, by AC-coupling the signal at either or both ends and providing DC bias within the amplification section. Hence, this isn't relevant to the question.
Answer: Darlington configuration is normally used between the pre amplifier stage and the output ( power ) stage is used to get a large amount of amperes ( current ) and acts as an insulator being with unity voltage gain so the signal comes from the pre amplifier maintains its strength on arriving the power amplifier means we have amplification to both voltage and current so the last power amplifier can voltage-amplify the high current signal to a level that enables operating the speaker with maximum power transfer from the power output amplifier to the speaker using matching between them.


we have several users on a WiFi. apparently one of them has hacked in and is denying service to others. what can be done?

Question: we have several authorized users on our WiFi (school). it appears that one of them has a program to deny service to others. do you know any of these programs and what can be done to prevent this?
Comment: If you're in a school, you should have an IT team. Get them to check where most of the packets are being sent and received, from what computer and who is logged in.
Comment: Who are you? student? teacher? IT guy? teacher who has to play IT guy because your school is too small to have a proper IT department?
Comment: What kind of authentication do you have set up on the network? If it's WPA-PSK then just change the PSK (password), if it's WPA-Enterprise then revoke their access on your radius server.
Comment: This: https://youtu.be/N22YyheMW-c?t=13s
Comment: @Jedi - it is specifically phrased as asking what programs may be used, but more importantly how to stop it and secure against these kinds of attacks.
Answer: There are several ways an attacker can deny people's access to Internet.
For example SYN flood or MitM.
MitM is more probable and much more efficient though, popular app WifiKill uses this principle (it makes the device(s) think that it's the router and then it drops all their packets)
I suggest:

start intercepting traffic
once you're sure that an attack has happened already, stop intercepting
open the capture file in Wireshark

Analysis:
Write down your router's MAC address and local address.
Type "arp" into the Wireshark filter box to see the ARP packets
If you see something like 192.168.0.1 is 01:23:45:67:89:ab
where 192.168.0.1 is your router's local address but 01:23:45:67:89:ab is not its MAC address, you are seeing an MitM attack based on ARP spoofing (which is what WifiKill uses)
You can use arp -a (on Linux) to see the local/MAC addresses.
I think you will see one MAC address twice if an attack is running (and of course the router's MAC will not be the value that you have written down)
What's really nice is that ARP packets in Wireshark are very easy to understand even for not-very-technical person.
You will see conversation like:
Who has 10.0.0.6? Tell 10.0.0.138
10.0.0.6 is at 00:17:f2:20:e6:bf

And SYN flood is obviously enormous amount of SYN packets in extremely fast rate.

Defense:
You can block their MAC address at the router, but be aware that they can change it.

apparently one of them has hacked in and is denying service to others.

Be sure you're using WPA2 without WPS. You can add MAC filtering, but note that it's easy to bypass. However, if the attacker obtained the wifi password from a legitimate machine, they might not be able to avoid being MAC filtered. Always use multiple layers of security.

Summary
The attack is most likely based on ARP spoofing, which can be easily detected if you have a packet capture sample.
To make sure this does not happen again, secure your network as much as possible.
Comment: @CaffeineAddiction I guess the \*cough\* mastermind behind this attack is someone who rooted their phone and thinks that using WifiKill to deny people's access to Internet is l33t h4x0ring. They might change their mind once they get caught though :)
Comment: This + a baseball bat
Answer: bobhum, you state " we have several authorized users on our WiFi (school). it appears that one of them has a program to deny service to others. do you know any of these programs and what can be done to prevent this? "
As it's taking place in a school you should have an IT dept. that you can voice your concerns & issues to re. this matter. Don't start running wireshark or other similar programs without proper authorization or you may be just as liable as the suspected culprit.
Also since it only "appears that one of them has a program " but hasn't been caught in the act, there may not actually be anyone doing anything malicious at all. The person or persons having access issues could try another device to access the network but will be logged with the same credentials. If the disruption no longer occurs, I'd look at the device more closely for crapware/malware, outdated hardware, driver issues... even something like IP conflicts.
Is this issue happening to everyone else at the same time ? Is there a microwave or cordless phone close to the router ?
If you're in a school that doesn't have an IT dept. which leads to many questions.... have your teacher go to the head of the school & explain what's going on.


Should I call or talk directly?

Question: In my office (i mean it's not mine) has a telephone where connect my room and my boss room, I want to talk something to her, Should I call or go to her room and talk directly?
Comment: Are you asking if you should call your boss or speak to her face to face when you have a question?  Without any additional information I would have to say "Yes".  Phone call vs walk to her office depends on the office culture and what you need to speak about.  Providing more information may give us the opportunity to give a better answer.
Answer: Face to face is usually best. There's much more nuances to a conversation in person. Just don't waste her time with inconsequentials.
If it's urgent and very minor I would ring rather than waste time if I just needed a quick yes/no answer authorising me to do something or a similar reason and her office was not within a few minutes walk.

Should I call or talk directly?


Why not implement Union-Find structure using root as the direct parent?

Question: I just learned about using UF with union by rank and path compression. A path can be compressed via attaching a node to its root after Find is called on the node. If the goal here is to flatten the tree, why not just implement the tree such that each node is directly attached to its root (instead of its true parent)? That way, maximum compression would be achieved from the start. What is the con of this as long as union by rank is used along with it?
Answer: Because then a Union operation would be very slow: when you Union two trees, you would have to reparent all of the nodes in one of the trees.
Comment: Suppose you did as you proposed, and reparent everything to the root node.

Exercise: Describe an algorithm to do it. Find a sequence of union operations that would give worst-case time, and find the amortised time per operation using this algorithm. If you get stuck, feel free to ask in this very question. You'll learn a lot doing this.
Comment: Doesn't unioning by rank solve this though? Because you're only reparenting the smaller of the two, the total work should be less than without using rank. Although perhaps not asymptotically.
Comment: Thanks for the advice. Does it end up being O(N) am. per operation?


comma before "if you will"?

Question: Should I set off the phrase "if you will" at the end of sentence with a comma? I can't seem to find this in any of the grammar and punctuation sites. It seems to be widely used. I come across it in my transcription work frequently.
Comment: Do you have some examples please?
Comment: Perhaps an example, if you will?
Comment: Here's a Language Log post related to OP's question: http://languagelog.ldc.upenn.edu/nll/?p=3239
Answer: If you're looking for Something In A Grammar Book, then this would probably fall under the general rule that many recommend of using commas to separate off what we might loosely call "sentence adjuncts" or phrases that, if they were removed, would not greatly affect the meaning of the sentence.
Or in other words, it would probably fall under the same general rule that recommended separating off the words "however" or "unfortunately" etc. from the rest of the sentence in a case such as:

I am, however, not entirely sure that this is the outcome we want.
Unfortunately, David will not be there.
The government's new Green Bill is failing, as it were, to see the wood for the trees.

Otherwise:

what do you think looks and feels best?

if you Google the phrase "if you will" for examples of how others use the phrase, what do they tend to do with respect to punctuation (and do you feel their decision is sensible/easy to read)?
Comment: Yes. It's certainly a pragmatic marker (separate from the proposition put forward in the matrix sentence), and of the subcategories 'easing conversational flow / seeking positive feedback' (the term 'hedge' also fits). Many of these parentheticals, especially those with more than one word, are set off with commas.

comma before "if you will"?


Anything similar to SqlSoup for Scala?

Question: Which existing Scala database API is most similar to SqlSoup for Python (part of SqlAlchemy)? What I see in SqlSoup: a convenient and largely portable database API where I don't have to specify schemas and all the types are inferred via reflection, yet I don't have to write raw SQL expressions. Also preferable is the fact that it's part of a more complete database package that does support "everything else" (schema specifications, ORM, etc.), and they share many of the same query abstractions. I imagine that Scala 2.9's Dynamic type may come in handy here. Thanks in advance.
Answer: The most similar is SQLAlchemy 0.6 http://www.sqlalchemy.org/news.html which supports Jython. That means that you can use SQLAlchemy on the JVM and call it from Java or Scala. Check this for more details http://www.rexx.com/~dkuhlman/jython_course_03.html#calling-jython-from-java
You will likely need to write some interface code in Jython.
The inefficiencies of SQLAlchemy come from the impedance mismatch between SQL and object oriented thinking. Now that you have chosen a non-object oriented language, maybe it is time to move away from SQLAlchemy clones and work on a threadpool to give you non-blocking access to SQL databases. Actors work real well when you break down the problem into lots of small simple tasks and SQLSoup seems too heavy for this.
Maybe you would also benefit from a memcache in front of your SQL database. Imagine that you need to process an SQL request through 7 steps to get the data in the form that you want. If you save all the intermediate results in memcache you may be able to reduce the number of times that you hit the SQL db. Actors lend themselves to a loosely couple design where you can replace an actor or insert two in the place of one.
Comment: We actually moved away from Python + SQLAlchemy for performance reasons - spent too much time hacking around the guts of SQLAlchemy. I guess I should have explicitly stated that I expect the API  to be in a compiled language (e.g. Scala, Java).

Anything similar to SqlSoup for Scala?


Why won't the Cerberus Network DLC detect Mass Effect 2?

Question: I bought ME2 recently on Steam and activated the Cerberus network DLC. The files it gave me to download don't detect ME2 as being downloaded. Anyone able to help with this?
Answer: Well, try re-downloading and re-installing ME2. I know it's annoying and time consuming, but I have experienced this Steam DLC problem with multiple games(including ME2) before, and this fixes the problem every time.
How to re-download Mass Effect 2

Go to the Steam folder in computer/hdd/Program files x64/32/Steam/appdata/ME2

DELETE FOLDER

Go to Library, go to ME2 and click Download.

NOTE: If you have not already synced with Steam Cloud, do so BEFORE you delete ME2, otherwise all of your progress and game data will be lost. See Steam Forums for how to sync with Steam Cloud.
Hope this helps!


Question with installing backup camera

Question: Hey yall im trying to install the backup camera that came with my GPS unit from amazon. The only issue is that there is no ground wire with the backup camera wires. The backup camera has the av male (which plugs into the screen unit) and splitting off just one red wire (which I am going to wire to the reverse light for power). My question is, will it be an issue that there is no ground wire too? Is there something I should do differently?
Comment: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
Answer: Motor vehicles typically use the chassis as earth/ground. You may find that internally, the camera has a wire running to a mounting bracket, with the expectations that the bracket is going to be attached to a body ground in some manner.

Question with installing backup camera


What is the difference between laptop screen and desktop screen?

Question: I have HP laptop with 17 inch screen and I bought a new screen 22 inch and connect it to my laptop. I noticed that the quality of text and content of the laptop screen feels better. Is there any thing that I can do for the new screen to make its quality similar to the laptop screen?
Comment: Connected with a VGA cable? Is the secondary monitor set to use it's native resolution? Right click on your desktop and select `Resolution` or `Properties` to view the monitor details.
Comment: Yes with VGA cable. I did right click.... But how can I know if it uses a native resolution?
Answer: Are you extending your desktop or duplicating it on both monitors?
If you are duplicating, the resolution will be the highest resolution supported by both displays, which means one display might not be operating at the native resolution (usually the larger one, because the smaller display the smaller the native resolution).
If you are extending your desktop, you should see two monitors when you open Screen Resolution settings (as canadmos suggested, provided you are using Windows). You can click on either and make sure they have their native resolution. Newer versions of Windows show "(Recommended)" after the native resolution.
If your 22" monitor is at its native resolution, then you might have a bad cable.
Comment: Second the bad cable part.  VGA cables can be slightly bad creating a bad image on the destination monitor.  Not bad enough that they don't work altogether, just bad enough that the image is bad.  Try another cable.


ISBN and international translations for sale in another country

Question: If I understand the ISBN correctly, if I as a publisher, created a Spanish translation here in the US, but was also selling it in, say, Brazil, do I need a separate ISBN issued from Brazil where the printing may occur, or do I just use a number I already own and assign it the translated version only? The physical place of printing the book doesn't matter? Can a 'joint' venture with a foreign publisher remedy the issue of being able to sell it in that country?
Answer: An ISBN identifies a publication. Every edition of a book must have a different ISBN. For example, the hardcover edition, the trade paperback, the mass market paperback, the ebook, and the audiobook, all have a different ISBN.
A translation, of course, is a different publication. But any edition can be sold worldwide. When I go to a bookstore in France and buy a book that was published (in English) in the US, that book (which was perhaps shipped from the US) will carry the same ISBN as it would if it were sold in the US. The fact that a book is shipped to and sold in another country does not make it a different publication.
For the ISBN, it also does not matter where a book is printed. Many books sold in one country in Europe have been printed in another country in Europe, where printing was cheaper. There may or may not be a note saying where the book was printed, and different print runs of the same book may be printed in different countries, but they still carry the same ISBN if they are the same edition of the book.
In your case, your book will be published wherever your publishing house has its legal address. This may be the US or Brazil or elsewhere. This book, with the ISBN number of the country of your publishing house, will then be sold in the US and in Brazil.
Only if your publishing house has a subsidiary in both the US and Brazil, and each subsidiary publishes its own edition of this book, will those two editions have different ISBNs. And they will have different ISBNs even when the books are absolutely identical except for the address given on the copyright page. They will also have different ISBNs if they are printed by the same pinter.
Answer: From what I understand, ISBN is released by your national agency. So if you are a publisher in Brazil, it is released by Brazil, regardless of the language. If you sell and ship your books across the world, they retain your ISBN number. But if you are a large publishing house with different administrative branches in different countries, then each of them might have their own ISBN.
Useful resources:

https://www.isbn-international.org/
http://www.iso.org/iso/catalogue_detail?csnumber=36563
https://en.wikipedia.org/wiki/International_Standard_Book_Number


a translation request

Question: I am preparing a toy example for my talk and it would be nice if I had this phrase translated to Chinese (simplified): "the wicked witch of Oz". Also, it would be nice if you could tell me which words in the English version corresponds to which words in the Chinese (simplified Chinese) translation.
Comment: You should learn to ask better questions. 伸手党 is usually frowned upon.
Comment: Hey, this is why you're getting negative votes: http://chinese.stackexchange.com/help/on-topic **Reason:** "[ ... ] asking for a translation of a word or passage without showing previous effort are not allowed." **Solution:** "We are happy to assist with your translation questions if you are having a specific problem. Please show your attempt at translation in your question and state which area you are having difficulty with."
Comment: seriously? negative vote?
Comment: I think this policy is right and wrong at the same time. Knowing how to translate from a language to another is not something that you can google/search for. So, no matter how much time I spend online, I will not find a correct translation. Also, I am not asking for a solution to a homework. You can keep voting each others' comments. But that doesn't prove that I am wrong. good day!
Answer: 奥兹女巫
奥兹(Oz)
女巫(the wicked witch)
Answer: I'm afraid the name "the wicked witch of Oz" may be confusing. Baum's original story has "The Wicked Witch of the East (in Oz)" and "The Wicked Witch of the West (in Oz)".
Oz, or Land of Oz: 奥兹国, 奥茨国、欧茨国、is almost meaningless in Chinese without referencing the common title of the book in Chinese 绿野仙踪
Since the Wicked Witch of the East dies early in the story, your "the wicked witch of Oz" may be understood as
绿野仙踪中的西国邪恶女巫
绿野仙踪: title of the story;
(中): (dative) in...;
(的): (genitive) of...;
西国: the West;
邪恶: wicked;
女巫: witch
Comment: very interesting answer. For me the Oz was enough as I was simply using it as an example to prove my point in a presentation.
Answer: If it's a toy you may name it "奥兹女巫手办"
Answer: 邪恶的(the wicked)女巫(witch)奥兹(Oz)
Please note that Oz is only a name so it has many translation versions, such as 奥子,奥兹.

a translation request


Hate myself more and more wish to die

Question: Shall I be reborn as a girl again?  I've had a rough life, gotten a CVA (Cerebrovascular Accident) recently, and am now half-paralyzed.  I feel tired of living. I guess God forgot me, given all this suffering that I've faced during this horrible life.
Comment: Many people who've experienced death and return promise us that this life is worth it *however much the pain*.  Here is one such (hope it helps you!!) https://www.youtube.com/watch?v=b-Euxh4Zgjc. I believe even the Buddha said something to the effect that "For Nirvana the body is needed"
Comment: I'm very sorry that you're having to go through recovering from a CVA. Please keep up hope and pull through. If you can, I hope that you can make use of the Dharma to help you in your recovery. I've edited some of the spelling and grammar in your post. If any changes that I've made are contrary to what you intended, please advise, and we can change them back.
Answer: You should keep on living, sorry. I have to deal with what my karma has to deal me as well. This is me now. Live forever! I am, I have no legs. I know that is nothing compared to a stroke. But you should stay strong and live on! Life is too precious you must live on Please!!!!
Answer: We do not have absolute control over our next birth. But that doesn't mean we cannot affect it.
Buddhists view each human life as a blessing that they received. In numerous occasions Lord Budhdha has taught us that a birth in this plane (Human) is an extremely rare thing and we should do our utmost to make the most of it.
How can you consider yourself unfortunate when you are born as a Human with capability to hear, discuss and understand Dhamma in an era where Dhamma still survives? That in itself is a huge blessing, only a very few gets to enjoy. And having the capability and platform to discuss Dhamma with someone who live half way around the globe, and having the capability to listen to a Dhamma sermon uttered on the other side of the world, hand having the means to listen to it over and over again at the click of a button. All these are huge blessings only a very few enjoy. So, first understand that despite the hardships you have faced, you are extremely lucky. Those hardships have brought you to this moment, this conversation... sometimes life slaps us so hard we just fall down and knocks good sense into us.
Like the saying goes - "When life gives you lemons, make Lemonade".
Few stories for inspiration:

This boy was paralyzed and bedridden but he managed to write books with the few fingers he could still control
He is a famous motivational speaker despite his birth difficulties

I went through a lot of emotional abuse due to my marriage and even considered suicide a couple of times which made me find, learn and follow Buddhism. Looking back it was the turning point of my life. And even if I get another chance, I would not change anything, as it has brought me to the peace I experience due to Dhamma. During those tough times the best rock to lean on is Dhamma. Because Dhamma will not fail you as long as you are honest to your-self. Dhamma does not judge you for things you did in the past. Even though Karma will follow you like a cart that follows the oxen, with the help of Dhamma you can play tricks and get away in the short term.
To arrive at a lasting peace we need to commit ourselves to attaining Nibbana, one step at a time. As Lord Budhdha taught us, Sunatha (Listen/Study carefully), Dharetha (Remember/Understand intently), Charatha (Practice) Dhamma. And you can turn your fate around. You can twist your misfortune into a fortune that would accrue good fortune for the rest of your sansara (the endless cycles of life). Please read my answer here on explanation of the paths towards Nirvana (the supreme bliss). IMHO, the best option is to target for Sothapanna (Stream-enterer) state in Sharawaka bodhi.
Remember, A Lotus flower in bloom will be clean and pure, and it will smell nice, but it was born in the murky depths of muddy and dark water. Could it have bloomed without the mud or murky water? No. It needs that murky, muddy water to bloom. But the Lotus flower never carries the dirt, mud or smell. Everyone has the power to turn their fate and be the lotus flower. I know and trust that you do too.
Answer: It's very seldom to gain a human life and as one only here is able to work ones way out of the circle of life, one shouldn't waste such seldom possibility, good householder.
It's not for one's misfortune to get early known the first Noble truth. All others around are caught in the same misery, but are just not aware yet. So may good householder eager strive to comprehend also the other three Truths to spend most blessed life and go beyond the wheel of birth, aging, sickness, death.
Don't seek for unification as it would break apart either. It's good to gain the Gems as one's refuge. It's a matter of honore onejs old merits that allowed to arrive right here and a matter of loving one self truly that one developes liberation gratitude and gain the deathless, no more subject to birth.
The first step is becoming a god by oneself by developing goodwill, compassion, sympatic joy and equanimity toward all beings, being actually in such position, one should not seek to act like a poor, demanding all around, but see that all gained had been given by others and caused them pain, sometimes liberal, often even forced. What one gives, one gains. So start to give, goodwill and acting on it.

Hate myself more and more wish to die


How can I switch between the Japanese and English dictionaries on iBooks?

Question: For whatever reason, my iBooks dictionary is stuck in Japanese. Even when I read English books, defining a word always causes the app to use the Japanese dictionary. My iPod's language is English, so I have no idea why this might be. Is there any way to switch it to the English dictionary?
Answer: This answer is for iOS 7, maybe 6.
The question might be stale, but the ANSWER (if folks are on iOS7, maybe 6) is this:

Look up a word in iBooks, or in any App that has 'Define' flyouts from text. You'll get to the Definition UI which is in Japanese… if you can't read it go for the button on the lower left.
At the bottom of the definitions, you'll see 2 'buttons', from Left to Right: "Manage" and "Search Web". You should see this whenever you get UI to invoke iOS's Dictionary (which is not an App like it is on OS X)
Hit "Manage" and now you have a list of Dictionaries that you can enable/disable. AFAIK, enabling and disabling is global, so if you do it in iBooks it'd be the same in TweetBot, etal.

To conclude: There's no direct access to the Dictionary.app in iOS, even in Settings.app. You have to define a word, and manage dictionaries from there.
Answer: Open the Dictionary app, then Preferences, then choose the dictionaries you want. You can even choose the languages to use when searching Wikipedia.
Comment: You seem to have missed that it is a iPod, not a mac, which us being asked about.


Controlling language in salesforce

Question: I have a custom object on which I have few fields and I successfully uploaded managed package which includes the custom object. Now I want to have the field labels for this object's fields appear in different languages. Is there any way to do so?
Answer: Yes, you can do this natively by leveraging Salesforce's Translation Workbench. Translation Workbench allows you to provide translations of (almost) all of the public-facing text that users of your package will see, including

Field Labels
Validation Rule Error Messages
Record Type labels
Page Layout section titles
and more...

Through Translation Workbench, you can select the Language(s) that you want to provide Translations for, and then Translation Workbench provides a single location where you can define all of these Translations - you can even mass import/export translations for one or multiple languages. Pretty nice, honestly.
THEN, where Salesforce really helps out Managed Package developers, is that you can take all of these Translations and easily include them in your Managed Package! Just go to Setup > Create > Packages, select your package, "Add Components", and select "Language Translation". This will then let you choose the Languages whose Translations you'd like to include in your Package.
To be clear, what you are doing here is including all translations you have done for a particular Language in your package --- as opposed to manually adding each of the individual component translations (which would be a tedious nightmare). (In addition, any translations you have provided of any of the Custom Labels included in your package will also be included when you select to add a translation).
So, jumping forward --- say that you've included Spanish Translations in your package, including a translation of the Label of one of your Custom Object's custom fields, say the field is Company_Number__c and the field label, in English, is "Company Number". Now, in one of your customer's orgs, one of the users changes their Language (from their User preferences) from English to Spanish.

Now, when they go to the Tab, Page Layout, or other locations where they might go to interact with your custom object, they'll see translated text for the field labels that you have included translations for in your package, such as the Company Number field. That is, they'll see something like "Número de Negocio".
Comment: Best explanation.
Comment: @zachelrath Does the user who installs the managed package need to activate the language in translation workbench after installation?
Comment: @Vignesh No, users do not need to activate languages, they will automatically apply.
Comment: @zachelrath, can you please answer this? http://salesforce.stackexchange.com/questions/116053/translating-using-translation-workbench-in-a-managed-package

Controlling language in salesforce


What are the options for Data Storage size in salesforce instance is reached or near limit?

Question: Hi All please share your experience related to Data Storage size in salesforce instance is reached ? Did you increase data size from salesforce (quite expensive option) or any other option like delete/archive unused old activities etc?
Comment: One of the big factor is double counting of Person Accounts and Contacts, please up vote this post asking Salesforce to stop double counting: https://success.salesforce.com/ideaView?id=08730000000BqwEAAS&sort=2
Answer: It all depends. In some cases Salesforce may let you slide for a bit on your storage size limit.
Realistically, it all depends on what data you have and how you're using it.
Are you a very heavy attachment user? Can you move older attachments to a different location - or remove them completely?
Do you have single object that's taking up most of the data storage?
Do you have a bunch of records that are historical in nature and always get summarized in reports? You could collapse a bunch of data so it's just the summary data.
I believe the estimate for each salesforce record is 2kb a record. That should identify just how many records you would need to remove.
Answer: This is a situation that I've hit a couple of times.
The first was for a customer and was around loading data into a temporary table for later processing, after which it was cleaned up.  As the data was short lived, we were able to exceed the limit by up to 10% at times without any ill effects.  Obviously if this had been an issue it would have resulted in users not being able to save records.  The way we worked around this was to persuade the customer to upgrade to Unlimited edition from Enterprise, which gives around 6x the storage limit per user license.  Its not a cheap way but definitely an option.
The second was a system that was monitoring the status and performance of multiple external systems via time series data.  This resulted in thousands of records being added every week and meant that it would not be possible to store more than two months worth of data.  Therefore I added monthly scheduled apex that collated the previous months data into average uptime etc across the month and stored this in a different object.  Another scheduled job then ran a couple of days later (in case of problems), extracted the last months time series data and emailed it to me as an attachment, then deleted it.  Thus while I'd lost the absolute granularity, it was straightforward to show annual trends and performance against previous months.
Answer: +1 on summary data, if your companies process can afford to lose some detail it definitely pays to merge historical data.
If you find your self at the point where you are required to maintain large record sets but dont have the space you can always move data offsite to Heroku and the like. Use Outbound Messaging to sync the two systems and create a web service to consume the data in salesforce through visualforce pages.


Mininun changes required in a directed graph to make path from 1 to n

Question: i have a directed graph. Basically, i have to find how many edges i need to change to opposite direction to make a path between 1 and n. So, i tried solving it by making the graph undirected and marking the directions as -1 or +1 and then going through all paths and finding which paths has minimum -1(s). I store graph data in adjacency list (because number of edges can be large) and perform dfs. I also stop travelling a path if its count of -1(s) is more than the previous minimum. I also stored in every element the previous count of -1(s) to reach it from start. and i stop if current count is more. If less, i update it and move on this path and update if the new count is minimum. But this approach is slow.
What else can i try?
Comment: I think [contests](http://www.codechef.com/AUG14/problems/REVERSE) are designed to be solved on your own.
Answer: Construct a weighted directed graph as follows. For each edge (u,v), there are an edge (u,v) of weight 0 and an edge (v,u) of weight one. Then, there is an path from 1 to n of weight k iff we can change direction of k edges to make a path. Thus, the problem can be solved by a shortest path algorithm. Since the edge weights are either 0 or 1, it can also be solved by BFS.


Mechanism of Acidity - Boric Acid

Question: How does boric acid behave as an acid? Is it a Lewis acid or a Brønsted-Lowry acid?
Comment: what are your thoughts/ideas on the question?
Answer: Boric acid is a Lewis acid, therefore when in water it accepts the lone pair from oxygen and becomes $\ce{(OH)3B^{-}-OH2^{+}}$.
From this compound a proton can be donated and this is how boric acid behaves as a Brønsted acid.
Answer: Wikipedia says boric acid is a Lewis acid. It later states that it is a tribasic Brønsted acid.
A Brønsted acid is a compound that is able to provide $\ce{H^+}$ ions. A Lewis acid is a compound that can accept an electron pair; it would need to be electron poor. Some molecules have both characteristics and either feature could be used in explaining the reactivity of the compound.
Tribasic means that there are 3 hydrogens that can be used. I'm believe that the author used the term basic acid to mean that the hydrogen is attached as a hydroxyl group instead of hydrogen bonded. Phosphorous acid is always written as $\ce{H3PO3}$, although it could be written as $\ce{P(OH)3}$.
Comment: The term "basicity" of an acid refers in this context to the number of conjugate bases. $\ce{H3BO3}$, when reacting as a Brönsted acid, is tribasic because the 3 conjugate bases $\ce{H2BO3^-}$, $\ce{HBO3^{2-}}$ and $\ce{BO3^{3-}}$ are formed in the dissociation steps. The term does not imply that the acidic protons are bound to an oxygen (OH group). $\ce{H2S}$, for example, can be described as a weak dibasic Brönsted acid.
Comment: It also says it's a "tribasic" Bronsted acid. I'm not clear on what that means and it appears there is quite a bit of debate still about its acidity. I just want the best supported answer.
Comment: Yes, but what's a tribasic acid? What's a basic acid?
Comment: Ah, thank you. There are the HS- and S^2- conjugate bases.

Mechanism of Acidity - Boric Acid


iPhone UIImagePicker Camera in Landscape Orientation

Question: Is there any good way to set UIImagePicker to landscape orientation? I tried to call setStatusBarOrientation after presentModalViewController like following,
[self presentModalViewController:picker animated:YES];

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: NO ];

However, the video duration view (00:00) on the right corner didn't rotate as orientation changed.
Answer: Unfortunately, according to the documentation, the image picker only supports portrait mode.
Answer: Apple doesn't support landscape for camera view. If you want anything shown as customised then add overlay view on it & transform that view to look as landscape view.
@Note:-overlay is also add as portrait thats why transformation needed.
Answer: I was able to create landscape camera view using the following code:
[self.view insertSubview:self.imagePicker.view atIndex:0];

self.imagePicker.view.transform =
    CGAffineTransformScale (
                            CGAffineTransformTranslate(
                            CGAffineTransformMakeRotation(M_PI/2), -90, -15),
                            1.2,1.2)
                            ;

Note that I am directly adding the imagePicker's view to the current view, not calling it as a modal.
self.imagePicker.view.transform seems to respond as expected to all CGAffineTransform function calls, though I can't speak to whether or not Apple approves of this method.


Meaning of "challenged"

Question: I'm translating a lawsuit (PDF). There are three sentences that use "challenged" and I wonder what it means in each case:

As to interbrand competition, Sylvania, unlike Schwinn, had an insignificant market share at the time it adopted its challenged distribution practice and enjoyed no consumer preference that would allow its retailers to charge a premium over other brands.

(Page 1, line 13.)

This was precisely the theory on which the Government successfully challenged Schwinn's customer restrictions in this Court.

(Page 3, line 3.)

This Court relied on Schwinn's market position as one reason not to apply the rule of reason to the vertical restraints challenged there.

(Page 6, line 7.)

Please reword in plain English because I'm not a native speaker.
Answer: In this context it means disputed (in a legal sense).

Meaning of "challenged"


Cell Complex of Cartesian Product

Question: Let $X$ and $Y$ be cell complexes. Then $X \times Y$ has the structure of a cell complex with cells the product of $e^{m}_{\alpha} \times e^{n}_{\beta}$ where $e^{m}_{\alpha}$ ranges over the cells of $X$ and $e^{n}_{\beta}$ ranges over the cells of $Y$. So firstly, I have seen many answers that say the attachment map for the cell $e^{m}_{\alpha} \times e^{n}_{\beta}$ is the corresponding map is $\phi_{\alpha} \times \psi_{\beta}$ where $\phi_{\alpha}$ is the attachment map of the boundary of $e^{m}_{\alpha}$ and $\psi_{\beta}$ is the attachment map of $e^{n}_\beta$. I don't think I understand the product map. Here are my issues.
1) If $e^{m}_{\alpha} \times e^{n}_{\beta}$ is a cell in the product then we must glue a disk of dimension $n+m$. Is it true that we know how to glue a disk $D^{n+m+}$ because it is homemorphic to $D^{m} \times D^{n}$ and we know how to attach the products of cells?
My main question is I really don't understand how this attachment map works.
I want to bring up an example to show where I am confused. The torus is a cell complex with 1 o-cell, then attaching two 1- cells. Then we attach a $2- cell$ along the wedge of circles following the path $aba^{-1}b^{-1}$. Now lets try to build the torus from knowing how to build $S^{1}$. For one $S^{1}$ let $e_{0}$ be the 0-cell and $e_{1}$ be the  1-cell with attachment map $\phi_{1}$. For the second circle denote $f_{0}$ as the o -cell and $f_{1}$ as the 1-cell with attachment map $\psi_{1}$. Lets now build the torus. So our only 0-cell is $e_{0} \times f_{0}$. So say we are at the stage with a wedge of two circles. How do we attach the cell $e_{1} \times f_{1}$ using $\phi_{1} \times \psi_{1}$?
Answer: I don't know why someone would say that the attaching map of $e_m \times e_n$ has the form $\phi_\alpha \times \psi_\beta$. That would seem to imply that the domain of the attaching map is $S^{m-1} \times S^{n-1}$, which does not even have the right dimension for the boundary of a cell of dimension $m+n$.
Instead the boundary of $D^m \times D^n$  is $(S^{m-1} \times D^n) \cup (D^m \times S^{n-1})$. You can convince yourself that this is homeomorphic to $S^{m+n-1}$, via the restriction of some homeomorphism from $D^m \times D^n$ to $D^{m+n}$.
So the attaching map for $e^m_\alpha \times e^n_\beta$ must be a function of the form
$$\gamma_{\alpha,\beta} : (S^{m-1} \times D^n) \cup (D^m \times S^{n-1}) \to (X \times Y)^{(m+n-1)}
$$
We already have attaching maps for the cells $e^m_\alpha$ and $e^n_\beta$  of the form
$$\phi_\alpha : S^{m-1} \to X^{(m-1)}
\qquad\qquad
\psi_\beta : S^{n-1} \to Y^{(n-1)}
$$
which extend to characteristic maps for those cells of the form
$$\chi_\alpha : D^m \to X^{(m)} \qquad\qquad \omega_\beta : D^n \to Y^{(n)}
$$
The definition of the attaching map for $e^m_\alpha \times e^n_\beta$ can therefore be given by the function
$$\gamma_{\alpha,\beta}(x,y) = \begin{cases}
(\phi_\alpha(x),\omega_\beta(y)) & \quad\text{if $(x,y) \in S^{m-1} \times D^n$} \\
(\chi_\alpha(x),\psi_\beta(y)) &\quad\text{if $(x,y) \in D^m \times S^{n-1}$}
\end{cases}
$$
and one should note that
$$(\phi_\alpha(x),\omega_\beta(y)) \in X^{(m-1)} \times Y^n \subset (X \times Y)^{m+n-1}
$$
and that
$$(\chi_\alpha(x),\psi_\beta(y)) \in X^m \times Y^{n-1} \subset (X \times Y)^{m+n-1}
$$
Seeing the formula for $\gamma_{\alpha,\beta}$, one could say that $\gamma_{\alpha,\beta}$ is the restriction to $(S^{m-1} \times D^n) \cup (D^m \times S^{n-1})$ of the product of the characteristic maps $\chi_\alpha \times \omega_\beta$.
But it is certainly wrong to say it is the product of the attaching maps $\phi_\alpha \times \psi_\beta$. I'm curious to know where you saw such answers.
Comment: Thank you Lee. This answer was so helpful. Unfortunately this map $\gamma_{\alpha,\beta}(x,y)$ doesn't give you much intuition how to build the product of two complexes from knowing how to build $X$ and $Y$. Also, if you want I can tag you in the answers that said the the attachment maps are the product of the attachment maps.
Comment: Well, I don't know about intuition, but the formula certainly gives you precise instructions. To get intuition, you could try constructing several examples using the formula. Perhaps the intuition comes in learning to visualize examples, starting with $D^1 \times D^1$ (the square), and $D^2 \times D^1$ (the cylinder). More complex examples tend to not be visualizable in ordinary $\mathbb R^3$ for different reasons, namely that most such examples do not embed in $\mathbb R^3$.
Comment: For example, try to visualize $Y_1 \times Y_2$ where both $Y_1$ and $Y_2$ are homeomorphic to "$Y$"; it's a challenge because this is a 2-dimensional complex (easy, right?) which is not embeddable in $\mathbb R^3$ (okay, not so easy...).
Comment: Yeah but I was hoping these specific instructions would help me easily calculate the product of chain complexes. For example, I can easily compute the cellular homology of the torus using the cell structure I described in my question. But say I wanted to compute the cellular homology of a torus using your map. Do these specific instructions describe the boundary operator in the cellular chain complex of a torus? I don't see how it does.
Comment: Yes it does. But, that's another question.

Cell Complex of Cartesian Product


Calculation of a covariant derivative and exterior derivative

Question:
I am reading these notes on differential geometry from a course at MIT. I have been verifying the computations for myself and I have a concern about the expression for $de^k$ on the final line. When I evaluate $de^k(e_i, e_j)$ according to the lemma, I obtain $-{\Gamma^k_{ij}} - -{\Gamma^k_{ji}}$ which is zero because the Christoffel symbols are symmetric in the lower indices. This would imply that $de^k = 0$ but that is not what seems to be written. Is there something that I am not understanding?
Answer: It is, I think, a bit misleading to call that a Christoffel symbols: in general if we have a local coordinate $(x^1, \cdots, x^n)$, then it gives you a coordinate frame
$$\frac{\partial}{\partial x^1}, \cdots, \frac{\partial}{\partial x^n}$$
and the Christoffel symbols is defined as (write $\partial_i$ for the coordinate vector for simplicity)
$$\nabla_{\partial_i} \partial_j = \Gamma_{ij}^k \partial_k.$$
In this case, $\Gamma_{ij}^k = \Gamma_{ji}^k$ as by the torsion free condition,
$$\nabla_{\partial_i} \partial_j - \nabla_{\partial_j} \partial_i = [\partial_i , \partial_j] = 0.$$
However, if $e_1, \cdots, e_n$ is an arbitrary basis, and $\Gamma_{ij}^k$ is defined as
$$\nabla_{e_i} e_j = \Gamma_{ij}^k e_k,$$
then $\Gamma_{ij}^k\neq \Gamma_{ji}^k$ (as $[e_i, e_j]\neq 0$).
Going back to your calculation, you have
$$de^k(e_i, e_j) = -(\Gamma_{ij}^k - \Gamma_{ji}^k),\ \ \ \forall i, j, k.$$
This implies
$$de^k = -\sum_{a, b} \Gamma_{ab}^k e^a\wedge e^b$$
as
$$-\sum_{a, b} \Gamma_{ab}^k e^a\wedge e^b \ (e_i, e_j) = -\Gamma_{ij}^k- (- \Gamma_{ji}^k)$$
(as in the summation there are both $e^i\wedge e^j$ and $e^j\wedge e^i$.)
Remark: It is my habit that I write $\Theta_{ij}^k$ instead of $\Gamma_{ij}^k$ if $e_1, \cdots, e_n$ are not coordinate basis.
Comment: So in essence the torsion-free connection only guarantees that the symbols are symmetric in the lower indices for the coordinate symbols?
Comment: Yes. @Memeozuki ${}{}{}{}$


Slow Blow vs Fast Acting Fuse

Question: Is there any way to tell the difference between a slow blow and a fast acting Fuse? I had one blow in my amp and I know its 125v 5a, but i'm not sure if it is a slow blow or fast acting fuse.
Is there any way to discern the difference after one has been blown?
Is there a different schematic symbol for the two?
Comment: Did you try to get the manual? The spec of the fuse will be there.
Answer: I was an electrical engineer in the 1950s, part of my work was concerned with testing and selecting fuses. I recently gave a talk to my local amateur radio club on the subject, and what follows is from the script I wrote for that talk. I think it is relevant to the discussion here.
A surge protection fuse must accommodate three overload regions. For a short circuit it must blow fast in the normal way. It must also blow for steady overload currents just like an F fuse, but it must tolerate continual brief over-currents -- say ten times its rating -- without blowing or deteriorating.
Three main techniques are used to accomplish this. The simplest is to increase the thermal mass of the element, using a thicker, and therefore longer wire (to get sufficient resistance to heat up), wound round an insulating core, with careful control of the spacing for consistent operation. Pictures of this type and the next are in @Russell McMahon's answer. I have not seen an explanation of  the fuse with the wavy wire.
The second technique employs a three part fusible element.The first part is a wire with a high melting point so that it will absorb surges, while still blowing fast on extreme overload. This is similar to an F fuse working at well below its rating, so it will not protect against overloads close to the rated current. The second part gets round this, providing the protection for currents that are closer to the rated value but not high enough to blow the thin wire itself, and consists of a lump of lower melting point material in series with
the main wire, that heats more slowly than the wire. The third part of the element is a stout spring of relatively high resistance material, helping to heat up the lump, and pulling it rapidly apart when it melts. The combination of lump and spring, with its relatively high thermal mass,  also allows the surge to pass, but provides the protection for longer term but lesser overloads. There are many variations on this design and it gives manufacturers a lot of parameters for adjusting the fuse characteristics. Occasionally, as in the image above, a by-pass wire across the spring is used to adjust the characteristics of the fuse.
The third method employs the 'M' effect. In the 1930s Prof. A.W.Metcalf (hence the 'M') researched a phenomenon where the tin alloy used to solder the ends of the fuse seemed to affect the time to blow, reducing it in a strange way. He found that a spot (the 'M' spot) of solder on a silver wire element did not affect the short circuit performance, but it did reduce the time to blow on a sustained lower current. In this case, at the lower temperature of the wire, the solder diffused into and alloyed with the silver to create a region of high resistance in the spot, which would glow red hot, with the wire rupturing next to it.  This, with suitably chosen alloys, nicely gives the characteristic needed for a surge resistant fuse. A problem with this type of fuse is that occasional currents just above the rated value may cause some unwanted diffusion to occur, altering the fuse characteristics without visible change.

Here is a picture of three M spot fuses, and yes there is a tiny spot on the top one.
Comment: Wouldn't the wavy wire's purpose be to increase the length of the wire, effectively increasing the resistance for the same diameter?
Answer: Usually the information is on the fuse itself. On most fuses, there is an inscription which identifies the fuse. For example, one of the fuses I have in my desk is marked as F10AL250V. That means that it's a fast fuse rated at 10 A up to voltage of 250 V. Another I have is marked T500mAL250V. That means that the fuse is slow acting rated at current of 500 mA for voltages up to 250 V.
The marking will be somewhere on the case of the fuse. On glass tube fuses, it's usually engraved (sometimes very badly) on the metal part of the body. There is no good way to non-destructively detect what type of fuse a fuse is if it is unmarked.
In addition to that, there are also FF fuses which are very fast, TT which are very slow and M fuses which are supposed to be medium.
Comment: @Vorac But that's in general unsafe. If the fuse was meant to be fast-blow and slow-blow is used, equipment would be damaged. If fast-blow is used instead of slow-blow, there will be no damage, but fuse consumption can increase, which is usually preferable to equipment damage.
Comment: Other than "Fuji5A" it has some sort of a symbol with a "T" inside of it, but I'm not sure if this is just a logo or something similar, or part of the labeling: https://lh5.googleusercontent.com/-FZpwEjf3oX0/TxEWa51gEMI/AAAAAAAAAEY/ENx2NGGrTzs/w703-h527-k/100_3245.JPG
Comment: Also, would there be anyway to tell on a schematic?
Comment: @Sean As far as I know, there is no separate symbol for fast and slow fuses. The strange symbol in the triangle at first reminded me of Japanese Katakana Te, but after some searching, it turns out that the Te I was thinking of (テ) is actually reversed. The symbol itself looks familiar to me, but I have no idea what it means.
Comment: @Sean, In the local electronics shop, I was told that fuses are normally slow-blow. So, as a last resort, I would look for the letter "F" and, if missing, would assume slow blow fuse.
Answer: Every slow blow fuse that I have seen as far as I recall, had a coiled wire for the fusing element.
Fast acting fuses have straight single wires.
This is is a generalisation which no doubt does not always hold, but it works in most case.
In a fast acting fuse the thermal dissipation in the wire acts to melt the wire portion that is carrying it. There is some effect from adjacent heat but much reduced from a slow-blow.
In  slow blow fuse the wire is (generally) coiled to provide proximity to  heat energy from the adjacent wire plus the cooling path is increased by having a much longer wire length and thus thermal path to the mounting points. The accumulated heat from adjacent sections helps blow the fuse. The slow blow fuse has "thermal inertia" whereas a fast blow has a very short thermal time constant.
Many slow blow images Here -  all glass ones that I looked at have spiraled wire.
Typical slow blow fuse. Here the coiled structure is clear. Sometimes it is visually less apparent.

I've seen it suggested by some sites only that slow blow use lower melting temperature materials - but this is not a certainty.
Fast blow:

Higher current, automotive:
Comment: I on the other hand have seen only few coiled slow-blow fuses. Almost all I've had the chance to work either look just like fast-blow or have a spherical element in the center of the fuse.
Comment: I have a little 3.15A slow-blow ('T' type) 20mm fuse here with a straight wire.  No coiled or wiggly bits at all.
Comment: @SimonB Does it have an "M spot" - maybe a very small one. See Harry's answer above.
Comment: @RussellMcMahon, I can't see one, even looking very closely.
Comment: The spherical element in the centre of the fuse is the "M spot", see my answer above.
Answer: T = slow burn fuse
F = fast acting fuse
TT = very slow burn fuse
FF = very fast acting fuse
Answer: Just in case any one is wondering the T stands for Timed which is the correct term for a "slow blow" fuse, F as mentioned stands for Fast.
If it's a Power Amp then it would make sense for the fuses to be slow blow (also called anti-surge), bearing in mind you have an inductor (the transformer) feeding large capacitors so there is going to be quite a surge at switch on. If you want to play safe use quick blow fuses but they may blow easily and often. The fuses are really only going to protect the transformer any way and possibly the rectifier to some extent, they are unlikely to prevent an output transistor being damaged as that will most likely happen first in the event of a fault, The transformer isn't going to overheat a great deal or catch fire before a slow blow fuse works :-)
Incidentally, A good design should have F or T plus the fuse rating marked on the PCB where the fuse holder is.
Comment: Ah! That's what the "T" stands for!
Answer: While all this discussion on types of fuses is very instructive, I wonder whether it answers the underlying question. I believe that the original poster wants to know what fuse to use for replacing a failed one.
The answer to this depends on the application.
The main purpose of a fuse, in any application, is to prevent a fire.
If the fuse is in the loudspeaker circuit, ie, in series with the loudspeaker as a load, then it needs to tolerate occasional overloads, but open on continued overload - so, medium slow blow.
If the fuse is in series with a transistorised power supply's pass transistor, then it needs to be a very fast blow.
If the fuse is in the mains input lead before any power supply unit, then it needs to sustain the start-up current required to charge the main filter capacitors - so, slow blow.
In summary, look at the application.

Slow Blow vs Fast Acting Fuse


Meaning of "...went as bad as you can go"

Question: In the movie Harry Potter and the Philosopher's Stone Hagrid says: "A few years ago there was one wizard who went as bad as you can go." What does "went bad as bad as you can go" mean? Why does he say "as bad as you can go"?
Comment: I edited the title of the question to make it match the actual quotation.
Answer: Went is the past of go, in all its senses.
Went bad is the past of go bad (= become bad, colloquially)
So Went as bad as you can go = became as bad as it is possible to become.
You here is an indefinite pronoun, equivalent to one, (but much more common than one in everyday speech)
Comment: And understand that "go bad"/"went bad" is an idiom, as when bananas go bad and turn black.


Load Testing - Socket Connection Aborted While Running The Load Test

Question: I am running a load test in order to see the performance of the WCF services during the peak time (heavy load). I am using the Step-Load where we push the virtual users Step-by-Step. When I start running the load test for the first few minutes the test runs smoothly and as the load increases by time, after some time all of a sudden the below error is triggering,
"Test method "XYZ" threw exception:
<code>System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host".
</code>
I tried lot of solution that I found online but non of them worked for me. I tried changing the default time-outs, maxconnections, maxconcurrent connections etc., in config files. I would really appreciate any help on this.
Answer: I had similar problems while ago when moved to WCF. It have probably something to do with the way WCF handles connections.
Solution for me was to move each test into separate ApplicationDomain.


Get Contract Address by Its ByteCode

Question: I have some bytecode and would like to find the contract address that it belongs to. Is there an easy way to do this?
Answer: No, the bytecode of a contract is generated by a compiler when your contract is compiled, not when it is deployed. When a contract is deployed, its address is deterministically computed based on the address of the creator. See this question for how contract addresses are computed.
Comment: @AnAllergyToAnalogyi think you are correct but not at 100%. It is possible to find the address. See my answer bellow.
Answer: It is possible but quite difficult do to so.
If you have the opcodes, you need to compile then to runtime bytecode. Then, you have to manually loop through each transaction, and check every transaction that is being sent to address 0. If the msg.data contains the bytecode you have, that means this is the transaction that created your contract. From there you can find the address of the contract.

Get Contract Address by Its ByteCode


Why does lightning strike objects on the ground or the ground itself?

Question: From my keen observation the water vapor in the cloud turns into ice particulate and bumps into each other so there is region with more electrons than the rest of the cloud, but lightning should form between these 2 potentials inside the cloud instead of striking someone or something on the ground? Why is the ground or object on the ground become positively charged whenever lightning occurs?
Comment: Lightning is generally divided into cloud-to-ground (CG) and intracloud (IC) lightning. Are you asking about what makes the difference?
Answer: Most of the time lightning is cloud to cloud. The ground is generally positively charged and when a cloud becomes negatively charged, lightning goes from ground up to the cloud.
Edit: because opposite Attract the cloud may reach down with a streamer but the positive charge goes up from the ground.
Comment: I don't agree with your last sentence. There is a plethora of high-speed imaging of CG lightning which shows leaders originating from the bottom of the cloud connecting to leaders originating from the ground or high towers.
Comment: @Newbie The ground is the positive source and because opposites attract the cloud may reach out with a streamer but the ground sends up the positive charge.
Comment: By the time we see lightning exiting the cloud the streamer generated due to breakdown in the cloud has developed into a leader. Nonetheless, streamers always exist in the tip of a lightning leader. Also, can you include the scenario for a +CG in your answer?


How do I disconnect the power from a USB host port from the shell?

Question: How can I from the shell remove and apply USB power to one of the host USB ports in my machine?
Answer: So it seems that this cannot be done, which I kind of already suspected.
The advice found in some places about echoing on and suspend to /sys/bus/usb/devices/usb?/power/level does not really remove power from the USB host port, it merely requests the device to go into suspend mode, and vice-versa.
I solved my problem by attaching a USB hub with an external power supply, and then cutting the USB 5V wire in the USB cable going from the host machine to the USB. Then I can turn power on an off from my device via an external power relay connected to the USB hub power supply.
Answer: This was asked on Stackoverflow and really should have been migrated here.
https://stackoverflow.com/questions/4702216/controlling-a-usb-power-supply-on-off-with-linux
Comment: Funny thing is, that answers is not correct. Echoing suspend to that file will _request_ the device to power off (or suspend), but there will still be 5V on pin 1 in the USB cable, thus the device will still draw power from the USB port.


Understanding this comparator circuit for AC voltage protection

Question: The circuit shown below is taken from this whole design. I understand the main idea. They want to measure some voltage condition and trigger something else with the comparator. R39 and C38 form a low pass filter. R37 is the pull-up resistor as the comparator's output is open collector. D19 and D20 are protection diodes as the input goes positive and negative. What I don't understand is the arrangement of the resistors R36, R38, R35, and R40. Why are R36 and R38 referenced to ground in the midpoint? How is the comparison process achieved? According to the reference design, the input AC voltage is 230 VAC 50/60 Hz.
Answer: The design appears to assume that L and N can be swapped. This is a common problem in countries with reversible mains plugs. The circuit, therefore, needs to accommodate live on either pin.
Let's ignore D19, 20 and C37 for a now.
With the junction of R36 and R38 earthed one of the comparator inputs will be grounded. Remember that the neutral is so called because one of the supply wires has been earthed or 'neutralised' at the supply transformer so its voltage will be close to zero. As drawn, 'AC_N' will be at zero volts and since the top of R38 is at zero volts the junction between them will be at zero volts. The comparator '+' input will now also be at zero volts. Any time AC_L goes negative the comparator output will switch high. The result is a squarewave which goes high when AC_L is negative and low when positive.
Reversing the input polarity inverts the result.
D19 does two things when AC_L goes positive:

It limits the voltage on IN- to one diode drop above that on IN+.
It causes the voltage on IN+ to rise above zero somewhat. This is probably a good thing as it gets the inputs away from operating at 0 V (although the chosen device will work down to zero on the inputs.)

simulate this circuit – Schematic created using CircuitLab
Figure 1. Equivalent circuit while AC_L is positive.
You can work out what happens on the negative half cycle or when the live and neutral are reversed.
Comment: Nice explanation. But regarding *'AC_N' will be at zero volts* ...with respect to what? AC_N can be 50V with respect to earth.
Comment: I wouldn't call that 'neutral' then! The circuit should accommodate that, I think.
Comment: Thank you both. I guess I need to study these kind of circuits more often for me to fully understand it. Honestly, I will read your comments again and again until I understand it because I haven't. So, this circuit is just to detect a zero cross needed for the PFC stage software? ZC_IN goes straight to a MCU pin.
Comment: @Blue_Electronx It is the MCU that does the PFC (PFC_PWM to control the boost converter), etc
Comment: I wanted to do some math, but I don't know the values of R35, and R36. The BOM list has a mistake regarding them. So, let's say input voltage is 230VAC, the voltage at the -IN would be dependent on the ratio of R35, R36, right?
Comment: Correct-ish. Don't forget that R40 and R38 are, effectively, in parallel with R36 so if, for example, all four were the same value then you'd have a 4:1 divider. (R35 being three times the resistance of the others in parallel.)
Answer:
Note that the whole shown circuit (so, +3.3V, +12V, ZC_IN, etc) should be considered live and thus dangerous).

The shown picture has cut off the name of the output that gives an important hint: ZC_IN, which stands for Zero Crossing in.
D19 and D20 clamp the floating line voltage to a floating 0.7V volt, where R35 and R40 limit the current through D19 or D20. I mean floating with respect to the circuit's ground. R36 and R38 'align' this floating 0.7V with respect to ground. So, the comparator will see a sine wave which matches the line voltage at the zero crossing, but will be clamped between -0.35V and 0.35V.
This zero crossing is required to make a good PFC.
Below a picture of the (clamped) voltages the comparator sees at its input terminals.
Comment: What resistors values did you use in your simulation?
Comment: @Blue_Electronx I don't remember exactly. I think I used something "standard" like R35=R40=10k and R36=R38=1k and D19=D20=1N4148. What components are being used in the real STEVAL-CTM010V1?
Comment: The published BOM list has a mistake regarding those resistors, so I haven't figured them out.
Answer: The depicted ground is not a chassis ground, it is a floating ground. R36 and R38 are bleeding resistors and they set this floating ground potential at mean voltage between N and L.
The chassis ground, which is also conencted to PE wire is depicted differently:


HID halogen headlmp controler

Question: Is there a specific name for a automotive headlamp controller that when energized, will start at , say 3volts & ramp to 12volts? This would usually be used for HID or high intensity halogen lamps to prolong lamp life.
Answer: HID lamps are completely different from halogen lights- they use a ballast with a a state machine to control the startup current profile after discharge is achieved. They operate around 100V so your 3-12V makes no sense. Here is what start-up looks like (from this site):

As to halogens- there is no evidence that ramping voltage at start-up will substantially extend the life of halogen bulbs (the fact they tend to fail at startup is not evidence), so I would say the appropriate name for such a controller would be 'scam'.

HID halogen headlmp controler


Recovering lost photos on iPhone 5s after restoring from iTunes backup

Question: I used to have an iPhone 4s and all the data from there is synced in my iTunes in my Mac. I just got an iPhone 5s yesterday and decided then to plug it to my iTunes. There was a welcome message and 2 options: whether to set up as new iPhone or set up as old iPhone (4s contents).
So to be able to make everything fast, I chose the latter, but then all the new photos in my iPhone 5s were deleted and were replaced with all the contents from my 4s. Is there any way I could retrieve it?
Answer: In my opinion, it is something that's really hard to do (or that might even be impossible), that's why, sadly, I think that you are not likely to get your data back.
Most of the time, when you erase some data on a storing device, actually, you don't really erase it but just hide it and give to the devices using it the authorization of writing on it, that's why, in some cases, you can get your data back.
Unfortunately, in your case, that's something much more complex for several reasons.
The first one is that getting back the data in the way I mentioned above needs to have an access to the storage at a pretty low level. Apple putted some restrictions on the iOS devices and for this reason I don't see any way to gain such a low level access without doing something dangerous and not allowed by Apple such as jaillbreaking your device (and even with this I'm not even sure you could gain this access).
The second one is that since you transferred some content from your iPhone 4s to your iPhone 5s, it might be possible that the photos have been replaced by some new content (so some or even all of your photos might be missing/corrupted).
The last one — which might be the biggest one — is that the storage is managed in a pretty special way in iOS for some security reasons and although I don't know what happens exactly when you restore you device, it might be possible that iOS protects the previous content by removing some keys that were encrypting your data, making it nearly (not to say completely) impossible to get it back.


Is the inclusion map always a module homomorphism?

Question:
Suppose $R$ is some commutative ring and $G$ a finite group so that $R[G]$ is the usual group ring. If $M$ is some $R[G]$-module, then we can inject $M\hookrightarrow M\oplus R[G]^n$ for some $n\geq 1$. Is this necessarily an $R[G]$-homomorphism?
Comment: Yes, the inclusion of a $R[G]$-submodule in a $R[G]$-module is a homomorphism.  Here of course the factor $M$ is a "submodule" by way of being a direct factor as a matter of convention, but mapping $m\in M$ to $(m,0)$ is clearly an injective homomorphism.
Comment: I think so...why wouldn't it be? You mean the map $m\mapsto (m, 0)$, right?
Answer: Yes, the inclusion of a factor into a direct product $M \to M \oplus N$ defined by $m \mapsto (m, 0)$ is always an injective homomorphism no matter what modules you choose for $M$ and $N$.  In particular, you can inject $M \to M \oplus R[G]^n$ not just for some $n$, but in fact for any $n$.
If $M$ and $N$ are $G$-modules then it would be a good exercise for you to write out the definition of the $G$-module action on $M \oplus N$ and the axioms that a homomorphism must satisfy, and then check that the inclusion map $M \to M \oplus N$ does indeed satisfy these axioms.


Compatibility with IIS and Apache -- PHP, Python, etc?

Question: I'm currently planning out a web app that I want to host for people and allow them to host themselves on either Linux/Apache of IIS6 or IIS7 (for the benefits of bandwidth, directory services [login, etc.]).
I see that PHP is supported on both platforms. I've heard people serving Django and Python in IIS using PyISAPIe. I'm not sure about Ruby/Rails on IIS until IronRuby ships. I don't have much Perl experience but understand it would run in IIS as well.
Anyone have input for me? Thanks in advance.
Answer: I have several production php5/6 applications that run on either windows/iis and apache/linux. switching between platforms has not been an issue for me. i test on a windows server talking to a mysql db on a linux machine. i deploy to a linux web server without issue. i cannot speak for rails or pytong as i'm not a ruby or python guy. however, they should work fine from what i understand of them. if i were you i'd pick the language you have the most experience with.
Answer: Your lowest common denominator for building apps to seemlessly run on both the LAMP and Microsoft stacks is PHP.
Perl is another option, it's well supported on both Windows and Linux/Apache. But I think I'd be choosing PHP over Perl because of support for FastCGI which improves reliability and performance on the Windows stack. Microsoft and Zend have been doing a lot of work on PHP for Windows so that you can write PHP apps and confidently expect them to run well on both platforms. The proof of the pudding of this is that Joomla, WordPress, phpBBS and many other of the well known open source PHP applications run straight out of the box on Windows.
Also as a developer and third line support engineer for a shared web hosting company, with a fair bit of experience in this area, I'd say that PHP on Windows is every bit as flexible, performant and reliable as PHP on the LAMP stack.
Finally, Ruby on Rails and Python/DJango aren't well supported options on IIS and will be non-existant on shared hosting platforms. This is mostly due to the amount of console access you'd need to knock things into shape to be able to run Rails/DJango.


Use Honeywell VisionPro without EIM?

Question: I just acquired a Honeywell VisionPro TH9421C1004 thermostat but I didn't get the Equipment Interface Module (EIM) with it.  Can I still wire this directly from my furnace?  It only has 3 wire connections: Data, R, and C.
Answer: No, you can't
Unfortunately, the Honeywell thermostats that use an EIM rely on it to translate either RedLink (for wireless versions) or a proprietary protocol (for the wired ones) to the 24VAC signals that a furnace understands.  So, since Honeywell discontinued the wired versions in favor of their RedLink counterparts, you'll need to hunt down a secondhand EIM for your thermostat.
Comment: since I only need it for a heat call, I can't just hook up the C & R?
Comment: @ChrisL -- you can't just hook up the C and R, the data line does complicated things instead of being a simple 24VAC on/off signal

Use Honeywell VisionPro without EIM?


How do we clean up low quality questions?

Question: Is anyone tracking the signal to noise (high-quality to low-quality) ratio for SQA questions?  My sense is it's going down; there seem to be a lot of "help me with my homework" and "save me from searching Google for the answer" and "please tell me how to do my job by answering this broad question" kind of questions.
Answer: I don't know of any concerted effort of quality control. I do know our "answered" ratio is currently at 86%, which is lower than it usually is. The number one cause of a low answered ratio is poor quality questions that go unclosed.
The easiest way to fix this is to clean up poor questions. Edit them so someone can answer them, answer them ourselves, upvote good answers on "unanswered" questions (questions that have low-vote answers are considered unanswered) are ways to salvage a good question. The not good questions simply need to be closed.
To close questions, we need two areas of attack. One area is to seek out the poor questions (the easiest of which is the Unanswered tab). The second area is the Closed Vote queue to tackle the ones identified by the seeker with the four additional close votes.
We're currently at 382 unanswered questions. We're also almost exactly two years after the last time user246 brought this up and it looks like we're not much further along, notably because no post cleanup effort was ever officially organized.
Do we collectively have time for a concerted effort to clean up the old posts? I guess that depends on what we're looking at for time. 382 questions would be roughly 20 hours (if we include the closers as well as the seekers) of work to properly identify and close all the poor questions. Of course, that means skipping salvagable or answerable questions instead of editing or answering them. It's also incredibly boring work to do (probably why it hasn't been done in a while). If it was spread out over a couple weeks it could probably get done. We'd want to keep track of progress to prevent duplication. We could either use comments on a meta post, or we could use the SQA chat room to keep track of that.
Comment: Chat room: http://chat.stackexchange.com/rooms/22957/sqa-cleanup
Comment: This post reminded me to choose answers for questions I asked in the past. I hope ratio will now be better ;-)
Comment: I just did the same thing.
Comment: We've cleaned up over 50 unanswered questions in two weeks! That's pretty good!
Comment: As I got from the Question and Answers of this post, we might need to train users of this community too (informing them time to time), mandatory site Tour, etc. this will help in improving the quality of the questions being asked and also users will not post duplicate questions.
Answer: This is most popular sharing community.Anyone can can share his own question.
Different quality members are present. One user's share question is to be easy for another users. It's not mean that this is low quality question.
Suggestion:-- You can categories these question type
               1. Recent Question 2. Recent Answered 3.Most Viewed 4. Most vote

If any question, any answer is not given more than 15 or 30 days  then you can send one reminder to question owner. After that if any changes is not done in question then removed this question.
Comment: I have to mostly agree with user246. There are definitely a lot of unanswered questions that are not low quality - and we should answer those if we can, promote them if we can, etc. But say someone joins and wants to help answer unanswered questions. How can they if they have to wade through 10 low quality questions before they find a good one they can answer? Chances are they leave after 2 or 3 low quality questions instead. And that's bad.
Comment: This is not about naive questions, Ranjit.  It is about questions are too broad,  or too opinion-based, or too ambiguous to answer because the author left out important details, e.g. asking for help with a Selenium problem but neglecting to show the code or the HTML.