running several system commands in parallel in Python

Question: I write a simple script that executes a system command on a sequence of files.
To speed things up, I'd like to run them in parallel, but not all at once - i need to control maximum number of simultaneously running commands.
What whould be the easiest way to approach this ?
Comment: @S.Lott. Limiting the maximum number of processes seems reasonable. Imagine you have 100k processes to launch, you'll want to run them spawn all of them at once? even if the OS could cope with it...
Comment: @S.Lott If the processes that are being launched are database intensive you might get a speed up by running a small number in parallel, but after a certain point contention will result in a slow down.
Comment: @S.Lott If the system command is sftp, for example, then you might want to run a limited number of processes in parallel. Given the question references a system command my reference to a database was probably not helpful, but that's why I've been in this situation in the past.
Comment: @unholysampler: This question is neither related to multithreading nor to thread pools.  Threads *might* be one solution to the given problem, but a bad one in my opinion.  I will remove these tags again.
Comment: related: http://stackoverflow.com/questions/3194018/subprocess-with-multiple-parallel-jobs
Comment: "but not all at once"?  Why not?  The OS can handle the workload.  Why make it more complex?
Comment: @tokland: "Imagine you have 100k processes to launch".  I can imagine that.  Does it apply to this question?
Comment: @Andrew Wilkinson:  While true, how does that apply to this question?
Comment: @Andrew Wilkinson: While true, how does that apply to this question?
Answer: If you are calling subprocesses anyway, I don't see the need to use a thread pool.  A basic implementation using the subprocess module would be
import subprocess
import os
import time

files = <list of file names>
command = "/bin/touch"
processes = set()
max_processes = 5

for name in files:
    processes.add(subprocess.Popen([command, name]))
    if len(processes) >= max_processes:
        os.wait()
        processes.difference_update([
            p for p in processes if p.poll() is not None])

On Windows, os.wait() is not available (nor any other method of waiting for any child process to terminate).  You can work around this by polling in certain intervals:
for name in files:
    processes.add(subprocess.Popen([command, name]))
    while len(processes) >= max_processes:
        time.sleep(.1)
        processes.difference_update([
            p for p in processes if p.poll() is not None])

The time to sleep for depends on the expected execution time of the subprocesses.
Comment: @Mannaggia: Your suggested code has mismatched parens.  Assigning the generator expression to a temporary variable shouldn't make a difference.  Turning it into a list comprehension should fix the problem -- I'll update the answer.  (The error is probably caused by a rare race condition.  Editing the code and trying again won't tell you whether the race condition is fixed.  It might just not have occurred in that particular run, but would occur again in the next one.)
Comment: thanks! this seems to be what I need - and very simple. However I should have pointed out that I'm on Windows and it seems os.wait() is not supported. Any easy workaround for it ?
Comment: @user476983: Windows unfortunately does not allow to wait for the termination of *any* child.  You can work around this by polling all child processes once per second or so (depending on how long the execution of the child processes takes).
Comment: it seems there is a problem with the line line "processes.difference_update(
p for p in processes if p.poll() is not None)". This causes "RuntimeError: Set changed size during iteration"
Comment: Solution: "tmp=p for p in processes if p.poll() is not None)" and then "processes.difference_update(tmp)". This is a bit strange but it works. I am using python 2.7.
Comment: @Sven, yes, I used in effect a list "tmp=[p for p in processes if p.poll() is not None]" and there is indeed a missing parenthesis in my example above.
Comment: This approach does not work in python2.6 (still ubiquitous on RHEL6, for instance) due to this bug: http://bugs.python.org/issue2475
Answer: The answer from Sven Marnach is almost right, but there is a problem. If one of the last max_processes processes ends, the main program will try to start another process, and the for looping will end. This will close the main process, which can in turn close the child processes. For me, this behavior happened with the screen command.
The code in Linux will be like this (and will only work on python2.7):
import subprocess
import os
import time

files = <list of file names>
command = "/bin/touch"
processes = set()
max_processes = 5

for name in files:
    processes.add(subprocess.Popen([command, name]))
    if len(processes) >= max_processes:
        os.wait()
        processes.difference_update(
            [p for p in processes if p.poll() is not None])
#Check if all the child processes were closed
for p in processes:
    if p.poll() is None:
        p.wait()

Comment: I think you should delete this and add it to Sven's answer via an edit. Is this bad form on SO?
Comment: `Glory be to those that answer`
Answer: You need to combine a Semaphore object with threads. A Semaphore is an object that lets you limit the number of threads that are running in a given section of code. In this case we'll use a semaphore to limit the number of threads that can run the os.system call.
First we import the modules we need:
#!/usr/bin/python

import threading
import os

Next we create a Semaphore object. The number four here is the number of threads that can acquire the semaphore at one time. This limits the number of subprocesses that can be run at once.
semaphore = threading.Semaphore(4)

This function simply wraps the call to the subprocess in calls to the Semaphore.
def run_command(cmd):
    semaphore.acquire()
    try:
        os.system(cmd)
    finally:
        semaphore.release()

If you're using Python 2.6+ this can become even simpler as you can use the 'with' statement to perform both the acquire and release calls.
def run_command(cmd):
    with semaphore:
        os.system(cmd)

Finally, to show that this works as expected we'll call the "sleep 10" command eight times.
for i in range(8):
    threading.Thread(target=run_command, args=("sleep 10", )).start()

Running the script using the 'time' program shows that it only takes 20 seconds as two lots of four sleeps are run in parallel.
aw@aw-laptop:~/personal/stackoverflow$ time python 4992400.py

real    0m20.032s
user    0m0.020s
sys     0m0.008s

Comment: I don't like using threads for this.  They are completely unnecessary -- you are starting subprocesses anyway.
Comment: Threads are cheap though, and a semaphore makes tracking the number of running processes extremely simple.
Comment: Yeah, the code looks nice, especially when using the `with` statement.  A drawback is that in the case of really many processes, you will unconditionally start a whole lot of threads first.
Answer: I merged the solutions by Sven and Thuener into one that waits for trailing processes and also stops if one of the processes crashes:
def removeFinishedProcesses(processes):
    """ given a list of (commandString, process),
        remove those that have completed and return the result
    """
    newProcs = []
    for pollCmd, pollProc in processes:
        retCode = pollProc.poll()
        if retCode==None:
            # still running
            newProcs.append((pollCmd, pollProc))
        elif retCode!=0:
            # failed
            raise Exception("Command %s failed" % pollCmd)
        else:
            logging.info("Command %s completed successfully" % pollCmd)
    return newProcs

def runCommands(commands, maxCpu):
            processes = []
            for command in commands:
                logging.info("Starting process %s" % command)
                proc =  subprocess.Popen(shlex.split(command))
                procTuple = (command, proc)
                processes.append(procTuple)
                while len(processes) >= maxCpu:
                    time.sleep(.2)
                    processes = removeFinishedProcesses(processes)

            # wait for all processes
            while len(processes)>0:
                time.sleep(0.5)
                processes = removeFinishedProcesses(processes)
            logging.info("All processes completed")

Answer: What you are asking for is a thread pool. There is a fixed number of threads that can be used to execute tasks. When is not running a task, it waits on a task queue in order to get a new piece of code to execute.
There is this thread pool module, but there is a comment saying it is not considered complete yet. There may be other packages out there, but this was the first one I found.
Answer: If your running system commands you can just create the process instances with the subprocess module, call them as you want. There shouldn't be any need to thread (its unpythonic) and multiprocess seems a tad overkill for this task.
Answer: This answer is very similar to other answers present here but it uses a list instead of sets.
For some reason when using those answers I was getting a runtime error regarding the size of the set changing.
from subprocess import PIPE
import subprocess
import time

def submit_job_max_len(job_list, max_processes):
  sleep_time = 0.1
  processes = list()
  for command in job_list:
    print 'running {n} processes. Submitting {proc}.'.format(n=len(processes),
        proc=str(command))
    processes.append(subprocess.Popen(command, shell=False, stdout=None,
      stdin=PIPE))
    while len(processes) >= max_processes:
      time.sleep(sleep_time)
      processes = [proc for proc in processes if proc.poll() is None]
  while len(processes) > 0:
    time.sleep(sleep_time)
    processes = [proc for proc in processes if proc.poll() is None]

cmd = '/bin/bash run_what.sh {n}'
job_list = ((cmd.format(n=i)).split() for i in range(100))
submit_job_max_len(job_list, max_processes=50)

Comment: Quick query man. I was trying your solution. Basically trying to pass one shell script with multiple commands in the solution listed above.
The value mentioned in the range(100), it just executes 1 command for 100 times. Which basically doesn't satisfy what a parallel approach should be. Please correct me if I'm wrong; just starting Python so lot of confusions. Appreciate the help.


Use of ULN2003 for LED current drive

Question: I'm trying to use de IC ULN2003 to logically drive the current of different LEDs from a logic input. I have searched for the data sheet but i don't understand how the IC works. I know that there is a Darlington pair for each Input-Output set but I don't understand what should be connected in the COM input of the IC. Can somebody explain me this?
Answer: Take a look at this firstly: -

It shows the common pin connected to all the individual outputs via individual diodes. Now see this diagram - they have used common but also they've used external 1N4004 diodes: -

Don't ask why they did it this way - it seems to me that the internal diode should be as good as the 1N4004. Anyway the diodes catch the "back emf" from the inductance of the motor or relay or solenoid or electromagnet when the transistor is turned off.
If you are just driving LEDs or non-inductive loads you can use it with common tied to the highest voltage or leave it open.
Comment: The internal diode is "as good" as the external one only if the relay is physically close to the driver. The schematic lacks an important detail: potentially long wires between ULN2003 and the diode+relay combo. In absence of the external diode, and if the relay is far away, the flyback current will flow through the loop formed by the diode on the chip, the wires going to the relay, and the relay coil. Such a loop is an EMI concern. By placing the diode right next to the relay, the flyback current loop's area is minimized.
Answer: COM is a COMmon rail for flyback voltages from inductive loads or for input protection, if you are driving LED's you can leave it disconnected.
Answer: If there is any inductance on wire leads to LEDs , it can result in a dangerous reverse voltage on LED, thus the common clamp diodes are tied to V+.  LED's can only handle -5V, or Vcc +5V, which can be exceeded when L di/dt exceeds this during rapid shut-off such as if L is > 1 uH and di/dt>5*10^-6. Although load capacitance can also limit this rise time, so not a big issue. Circuit cable determines this characteristic.
Comment: Not true. If a LED is connected to a ULN2003 and is activated, the current flows from anode to cathode thru lead inductance. If the transistor open circuits, the action of the inductor is to maintain the same current (and flow direction) until the energy stored in the magnetic field is exhausted. This, I believe force current to go in the opposite direction thru the LED therefore it cannot become reverse biased.
Comment: Are you sure about that?

Use of ULN2003 for LED current drive


Electron speed in Atoms

Question: Is the speed of electrons in Atoms consistent in all Atoms or clusters/groups/individual elements, and if it is consistent in any atom, is that speed constant?
Answer: Quantum mechanically bound particles (like electrons in an atom or molecule) do not have well defined momentum.1 What they do have is a well defined distribution of momenta. This is one of the reasons that we say electrons are bound in "orbitals" and not in "orbits".
That distribution is the same for the orbital around the same type of atom (or in  the same type of molecule). Now, for atoms heavier than helium, there are more than one type of occupied orbital in the atom even in the ground state. So, it is not true that every electron in the atom has the same momentum distribution.2 All the 1s in carbon electrons have the same distribution. All the 1p electrons in carbon have the same distribution as each other but a different one than the 1s electrons. The 1s electrons in oxygen have a different distribution than the 1s electrons in carbon. And so on.
Molecular orbitals are distinct from atomic orbitals.

1 Physicists usually talk about momentum instead of speed in this context, but as almost all of these speeds remain much lower than the speed of light we can connect the two ideas by $p = mv$.
2 I've been talking as if you can tell electrons apart, but in reality you can't so there is room for some hemming and hawing about the way I am writing this. The distributions are associated with the state and not with the particle.
Answer: No, the speed is not consistent from atom to atom.  Electrons nearest the nucleus of highly charged nuclei move the fastest.
In the simplistic Bohr model of a single electron atom (H, He+, Li2+...), speed is proportional to charge of the nucleus.
As a consequence, relativistic effects are much more pronounced in heavy atoms.

Electron speed in Atoms


EU4 Where does AE got from colonial region with European power affect?

Question: So if I take Holland's provinces in Cuba will that increase my AE with neighboring countries in the colonial region or in Europe. In other words is distance calculated from the point of view of the province taken or the country?
Answer: I have no means to check now, so my answer is an educated guess at best. Countries which are interested in what happens in the Caribbean region will get AE against you. In this case, Holland and neighboring countries/colonial nations (especially if they share the same religion as the provinces you took). The further they are, the less AE they'll get (La Plata, for instance, will most probably close to none, if none at all).
I would not expect any European countries to get any AE. In any case, in the peace deal window, you can see how much AE your deal will generate, and in the cases where a coalition could form after the deal is sealed, you should see with which country(ies) you will get AE, and how much, if those country(ies) might be part of the coalition.


Microphone on Dell xps 13 9343

Question: I installed ubuntu 14.04 on my xps 13 (non touchscreen). The current kernal is 3.16.0-49, and bios is version A05. I have wifi and the trackpad working, but the mic no longer does. Does anyone know how to fix this? Thanks
Answer: The Dell XPS 9343 microphone is currently broken on kernel 3.16.

You have to use kernel 3.19 which contains a fix for the microphone.
There are two ways to do it :

Manually install kernel 3.19 on your current Ubuntu installation.
sudo apt-get install linux-headers-generic-lts-vivid linux-image-generic-lts-vivid

Upgrade to Ubuntu 15.04 (which has kernel 3.19).
I wrote a full guide on how to do it on this laptop.
Comment: Oh, it's you, your guide was wonderful and it's the only reason I have wifi on it.
Comment: Glad it helped =)
Answer: Something that worked for me (on Ubuntu 16.04 with kernel 4.4.0-87) was to install pavucontrol and set it as the 'fallback' on the input devices tab. It seems that the default audio settings controller in Ubuntu 16.04 wasn't picking up the internal mic properly, but pavucontrol spotted it fine (the levels were jumping when I made noise), and I just needed to set it as the default (fallback?).I got the idea from here even though I am not using archlinux.

Microphone on Dell xps 13 9343


How to Disable audio jack detection in Debian based Linux (Kali Linux)

Question: My audio jack is damaged, since it is damaged it always show the headphone is up, even if there is headphone, Is there anyway to disable audio jack detection, I only need in-built speaker and Bluetooth headphone, I want to disable the audio jack, I am using Debian based Linux
Answer: You might want to disable the "auto-mute mode" in the ALSA sound driver instead; that way, the state of the headphone jack would have no effect to the speaker use.
First, you'll need to identify the (current) index number of your built-in sound chip: run "amixer info -c 0" to identify the first sound card/chip, then increment the number to see any other sound devices. Once you know the number of your system's built-in sound chip, run amixer -c <N> sset 'Auto-Mute Mode' Disabled, replacing <N> with the correct number. After this, if your internal speaker is currently muted, you should be able to un-mute it using a regular audio mixer tool even if the audio jack currently detects a plug. This would allow you to still easily use the headphone jack later by just adjusting the mixer settings if the need arises.
Then run sudo alsactl store to make the new settings (disabling of auto-mute and unmuting of the speaker) persistent.
Or you might use the hdajackretask tool in the alsa-tools package to set the headphone jack to "Not Connected" and click on Install Boot Override to make it persistent. This would completely disable the headphone jack.
Comment: @telecoM bro a pop-up (Audio jack detection, which is very annoying)comes and goes every-time I open the laptop will this solution get rid of that too, bro what is meant by "regular audio mixer tool" , I am sorry actually I dont know that much bash script commands and when I run 'amixer info -c 0'  It says command not found


Is there a way to solve it by using exclusion-inclusion method

Question: How many functions $f:\{1,2,3 \cdots n\} \rightarrow \{1,2,3 \cdots n\}$ have no fixed points? Is there a way to solve it by using exclusion-inclusion method?
Comment: What do *you* get when you try to apply inclusion/exclusion formula? For example, set $A_i $ to be the set of all functions that fix $i $...
Comment: first I try to use inclusion/exclusion method to solve the problem just like Derangement problem does
Comment: Yep, can you please update the question with what you have calculated so far and where you are stuck. I guess the sum you get is big and you don't see the way to reduce it - at least we can check if you got that sum right.
Comment: $$ n^n-{n \choose 1}(n-1)^{n-1}+{n \choose 2}(n-2)^{n-2}-\cdots \pm {n \choose n} $$
Comment: Why $(n-1)^{n-1} $, for instance? Isn't it $n^{n-1} $? (You don't care where the other elements go.)
Answer: Huh... Exclusion-inclusion principle can be used, but it is a very convoluted way to get to the solution that is actually very simple...
So... applying exclusion-inclusion principle... from all functions take away those that fix 1, 2,... n, then add those that fix pairs etc. - you end up with:
$$n^n-\sum_{k=1}^n (-1)^{k-1}{n \choose k}n^{n-k} $$
which is:
$$n^n+\sum_{k=1}^n (-1)^k{n \choose k}n^{n-k} $$
i.e.
$$\sum_{k=0}^n (-1)^k{n \choose k}n^{n-k} = (n-1)^n$$
And, of course, this is correct by a simple combinatorial argument. (for $f (k) $ you have $n-1$ choices - any number but $k $).
Comment: Great solution +1


Overlaying a new library distribution in a Subversion repository

Question: I have a Subversion repository with a series of third party libraries and sources. As new distributions of these libraries become available I want to completely replace the old version with the new. What's the best method to "overlay" a new drop of a directory on top of the older one?
Answer: The only "clever" way to do it would be to use svn:external properties.


Energy Transformation in Flyback Transformers

Question: I am trying to understand how is energy transferred as a current to secondary of flyback transformer. First due to the dot convention and secondary side diode, current will not flow in secondary and energy is going to be stored in the core. But after opening the switch, how polarity changes? I mean the current in the primary wont change suddenly and will try to flow in the same direction, as well as the flux in the core. The created flux is going to force secondary current to flow in the same direction as it was closed. What causes the change in the secondary polarity? Can someone explain it?
Comment: For a coverage of the flyback converter, you can have a look at a seminar I taught some time ago at an APEC conference, [The Dark Side of the Flyback Converter](https://cbasso.pagesperso-orange.fr/Downloads/PPTs/Chris%20Basso%20APEC%20seminar%202011.pdf). It shows how energy transfers from the primary side to the secondary side and how the leakage inductance hampers this process.
Comment: Thanks. It is very nice source.
Answer:
and energy is going to be stored in the core

actually, in the magnetic field.
When the switch closes, the secondary diode will be reverse biased (remember the dots - winding polarities) and does not let the current flow.

But after opening the switch, how polarity changes?

Remember the basic inductor behavior: Inductors always generate an emf to counteract any change on the applied voltage. For example, if the applied voltage is suddenly removed then the inductor will generate a very high voltage with reversed polarity across its terminals.
Let's put this behavior in a flyback converter: When the switch opens, the primary inductor will not let the current stop suddenly and will generate a reversed and very high voltage across its terminals. So the voltage at the switch side of the inductor will be greater than the voltage at the supply side of the inductor. That's how the polarity changes.
The stored energy will be partly (or completely, hence the name DCM or CCM) transferred to the secondary. This will induce a voltage across the secondary winding.
Changing the polarities on the windings is the only thing that the flyback transformer can do because it has to transfer the stored energy. If the stored energy will not be transferred to the secondary then the core will never reset and will saturate eventually (Remember the B-H Loop).
Comment: Ok polarity changes in first inductor. But still no current since there is no path to go. Now, after cut off, initially we have no current both side. So the only thing that might cause secondary current to flow is the stored magnetic field. Then as far as I understand direction of the magnetic field should be effected from somewhere to change its direction (because the direction of magnetic field at first cycle (switch on) was to cause reverse bias the diode.) So is it: When voltage changes at input core magnetic field also reacts the change and collapses all stored enery to opposite directio?
Comment: @Ismail sorry for being late. When the switch opens, the primary current **must** drop to zero. Now remember the B-H loop: **The ampere-turns of the transformer cannot change without a change in flux density.** We know that the voltage on primary (and thus on secondary) reverses because of a negative change in flux density (dB/dt). When the voltage on secondary reverses, the diode becomes forward-biased and it'll allow the current to flow. **The magnetizing current of the primary will now be transferred to the secondary**. And it'll drop to zero linearly until the stored energy...
Comment: ...  is completely (or partly) transferred. So, `is it: When voltage changes at input core magnetic field also reacts the change and collapses all stored enery to opposite directio?` Yes. As I said above, the ampere-turns (i.e. H) reacts to change in flux density (dB/dt - thus voltage).
Answer:
I mean the current in the primary wont change suddenly and will try to
flow in the same direction, as well as the flux in the core.

That is correct except the current will now be flowing in the secondary because, in an ideal flyback transformer there is no path for current to flow in the primary. Maybe consider simplifying the flyback transformer to a basic inductor-switch circuit like this: -

Notice that I've re-positioned the secondary circuit in the left image to be inverted to help make the transition easier to the simplified inductor-switch model (on the right).

S1 is the MOSFET
S2 is the diode

The created flux is going to force secondary current to flow in the
same direction as it was closed.

That's basically where your error of thinking is. Just think about a normal transformer with two identically wound and 100% coupled windings: -

\$I_P\$ is naturally in the opposite direction to \$I_S\$. If it were the other way round then the output voltage would have to be inverted and, of course, that is not what the dots associated with each winding is about.
Picture from here.

What causes the change in the secondary polarity? Can someone explain
it?

If there is no voltage polarity change then there has to be a polarity change in current. If there is no current polarity change then there has to be a change in polarity for voltage.
Answer: Understanding transformers - as well the usually used ones as the ones in flyback circuits - can happen after a person understands that induction happens in the magnetic field around the windings. High permeability transformer core helps to keep the magnetic field inside a certain area and direct the magnetic flux through the windings.
The induction law states that as soon as for any reason a magnetic field changes there exists a circular electric field around the magnetic flux lines. In transformers the induced electric field has the same direction as the wire in the windings, so having plenty of turns collects a substantial voltage.
The induction law (in the vector field differential equation form) states also that the generated electric field has a polarity which tries to cause such current in the windings that the change of the magnetic field is reduced.
Thus if you break the current in the primary of a flyback transformer both windings generate a voltage. In the secondary there's a diode which allows the secondary output current. That current has direction and strength which generates at first just the same magnetic field in the core that you just tried to break by stopping the primary current. The current decays gradually as the magnetic field energy decreases; it goes to the output.
When you break the primary current the voltage over both windings jumps as high as needed to make the current possible. The current bulldozes its way through the insulations if needed. In flyback power supplies the diode in the secondary allows the current from the secondary charge the output capacitor. It's capacitance is so high that the voltage rises only very little, say less than 100 millivolts with one induced pulse. Induction lifts the voltage in the winding just as high as it's needed to charge the capacitor.


Hyperlink in SharePoint Document Library

Question: I have a document library that has additional columns filled with various types of data. One of these columns is set using a workflow in SPD as a hyperlink. For over a year this column did in fact appear as a hyperlink, as it should have. However, last week the hyperlink stopped appearing and in its place appeared HTML. Does anyone else have this same issue? Do you know of a way to fix it?
Answer: It seems that you are on the SharePoint online and calculated field was used to create the hyperlink which is not supported anymore by Microsoft. Have a look at this.
A possible workaround would be to:

Create a workflow
Build a string with appropriate URL/String
Update the item in the list (this means you will have to create another field and hide/remove the calculated field you currently have)

Updated
Workaround:

Create a new column, 'Hyperlink or Picture' type, ensure that it is
Hyperlink
Create a workflow variable (which you already have Link), just remove all the HTML it should be something like:  https://mytenant.sharepoint.com/sites/Shared%20Documents/Forms/EditFile.aspx?ID=[%Current Item:ID%]&Source=Pending%20Approval.aspx
Immediately after the url put a , (comma) and a space followed the text you want to display.  This should be like: https://mytenant.sharepoint.com/sites/Shared%20Documents/Forms/EditFile.aspx?ID=[%Current Item:ID%]&Source=Pending%20Approval.aspx, Click Here to Approve
Set the variable to the Hyperlink field created.
Comment: yes! this seemed to work. Very creative :) Thank you!
Comment: Thank you for the speedy response! Much appreciated.  To clarify my post from above, this IS a workflow, designed in SPD, not a calculated field, so that shouldn't be an issue.
Comment: Okay please update the question with the screenshot of the workflow so we can understand more.
Comment: this is updated with more information about the workflow.
Comment: It looks like MSFT stopped supporting this feature, even if it comes from a workflow :( https://sharepoint.stackexchange.com/questions/218102/june-13th-2017-microsoft-blocked-handling-html-markup-in-sharepoint-calculated-f
Comment: Sorry I forgot to mention that I have updated my answer and it works for me.  Have a look at the answer from work around. I will add some screenshots tomorrow
Comment: Did you manage to get this working?


Ac noise 2006 Honda pilot

Question: I have a 2006 honda pilot I've put the can of recharge in my ac itll get cold but when I cut the car off you hear a hissing noise coming from the glove department what can it be?
Answer: That could possibly be a leak.
One way to find out is to wait several hours and test again - if it has stopped working then there must be a leak... Also if the hissing as stopped.
Getting someone to put gauges on it and seeing if the readings drop will probably be quicker.
Answer: More than likely this noise isn't an issue. What you're hearing is the system equalizing through the system. In order for A/C to work, there has to be high pressure refrigerant which gets cooled, then it goes through an expansion valve as it enters the low side. This allows the refrigerant to cool, which then goes through the evaporator where the interior air flows over it and is cooled for your comfort. Without the pressure differential, your A/C will not work and there wouldn't be a noise, either.
I'm not saying there isn't a leak, I'm just suggesting if you've put refrigerant in and it's cooling now, the noise you're hearing is most likely the system equalizing. If the noise you are hearing was prominent enough for you to hear it, your system wouldn't stay charged for long and you wouldn't get the cooling benefit but only for a little bit (as the refrigerant would have all leaked out).

Ac noise 2006 Honda pilot


Do fowarded emails retain DMARC protection?

Question: Assume I ask someone to create a filter in their Gmail account that automatically forwards certain emails to my inbox. If the original email was protected with DMARC, would the forwarded email also be protected? Or does it lose the protection once it's forwarded? Does the response vary for other email providers (such as Microsoft, Apple and Yahoo Mail)?
Comment: What protection do you think DEMARC is providing for your emails?
Comment: @user10216038 Protection against spoofing the from sender field.
Answer: This depends on how exactly forwarding is done and DMARC is setup by the sender and checked by the recipients MTA. DMARC can be based on SPF or DKIM. SPF relies solely on the senders MTA source IP address, which will not be retained when forwarding. DKIM instead uses a cryptographic signature which will be retained and still work if the forwarding includes the mail as it is without any kind of changes regarding headers, encoding etc. This is often the case with redistributing but is not the case with inline forwarding.
In short: one cannot rely on it.
Comment: @ _Steffen Ullrich Thanks for your reply. So automatic email forwards based on preset filters would be considered 'redistributing' and should retain DMARC protection (assuming protection was setup using DKIM)? Are you aware if this varies for different email providers (Gmail, Outlook and Yahoo)? Thanks!
Comment: @BradfordGriggs: this is likely true for other email providers too. But no general statement can be made about this, i.e. one need to actually check.
Answer: DMARC depends on SPF (authorization of the sending IP address) and DKIM (authorization of cryptographic keys whose signatures prove legitimacy). If neither SPF nor DKIM pass, DMARC can instruct a spam filter to reject the message.
There are three ways you can forward an email:

Forward as an attachment (like reporting spam to SpamCop)
Inline forward (no headers are preserved, body changes too)
Use a forwarding service (like a new Bcc)

Regardless of how you forward an email, the sending IP will change, nearly always breaking SPF. Because of this, you cannot verify a DMARC policy trigger on the original message.
If you forward manually (as an attachment or inline), you're composing a new message. The DMARC protections from the forwarded message are therefore irrelevant.
If you use a forwarding service that does not modify any body content or any of the DKIM-signed headers, it should be able to pass DKIM and therefore DMARC, but only for DMARC configurations that do not depend on SPF.
If you're using an email forwarding service that implements Authenticated Received Chain (ARC), you could set up your spam filters to traverse it and trust its DMARC data. ARC is a simple mechanism in which a receiving server verifies the DMARC results and signs them. If you trust the ARC server, you can extend that to trust its DMARC results and then configure your server to key on them. (More practically, you could just ask the forwarding service to implement p=reject on their end so it's not forwarded to you).
Comment: @ _Adam Katz. Thanks for your reply. In short, unless a forwarding service employs Authenticated Received Chain (ARC), DMARC cannot possibly be forwarded regardless of whether it depends on SPF or DKIM. If the service does employ ARC it can include a signed message declaring the DMARC results. Are you aware whether Gmail / Outlook employ Authenticated Received Chain (ARC) when forwarding emails? Does it matter whether the emails were forwarded inline or using automatic preset filters as suggested by @Steffen Ullrich? Thanks!
Comment: @ _Adam Katz Also, do you disagree with the [conclusion of this article](https://easydmarc.com/blog/email-forwarding-and-dmarc-dkim-spf/)? It states that "DKIM: Email forwarding does not affect DKIM, as long as you have not altered the content and the structure of the original Email" and that "forwarding does not impact the DKIM Signature." Whether this would apply to Gmail and Outlook depends on whether they keep the original signature intact. But it looks like it is _possible_ to forward DMARC that relies on DKIM..
Comment: @ Adam Katz Please see [this FAQ from DMARC Wiki](https://dmarc.org/wiki/FAQ): "_However there is no reason for DKIM to fail. For DKIM not to fail, you must ensure that your mail server does not drastically modify the message. Typically, the only modification that preserves DKIM is to add new email headers to the messages without touching the subject or the body of the message. Headers protected by DKIM should not be modified in any way, and the message should not be converted from one encoding to another_"
Comment: Sorry, I've blurred the line between an email forwarding service and manually forwarded emails (inline or as an attachment). As you quoted, a forwarding service that doesn't modify the message will probably not affect DKIM but it will absolutely affect SPF. Manually forwarded emails will _always_ break both DKIM and SPF (and will lack ARC data). GMail definitely uses ARC in addition to DMARC. I can't recall if Yahoo and MS do (ARC is a draft). I have updated my answer.


example where complements are not conjugate (in group theory)

Question: In the Finite Group book by Isaacs, the concept of complement is defined as follows:
Given the normal subgroup of $G$, a subgroup $H \subseteq G$ is an even complement $N$ in $G$ if $NH = G$ and $N \cap H = 1$. If $H$ complements $N$ in $G$, obviously each conjugate of $H$ in $G$ also complements $N$. In General, however, a Normal subgroup of $G$ may have unconjugated complements. An example where the complements are not conjugated occurs in the Klein group. I'm trying to find another example
Comment: What about considering the alternating group $A_n$ and various odd involutory permutations in the permutation group $S_n$? When $n\geq6$ there are some of these that are not conjugated.
Answer: Consider $G=C_p \times C_p$, the direct product of the cyclic group $C_p$ with itself, where $p$ is a prime number. Let $H$ be any subgroup of $G$ of order $p$. Then any subgroup of $G$ of order $p$ different from $H$ is a complement of $H$ in $G$, and all these subgroups are obviously not conjugated since $G$ is abelian.


Create Startup Sound

Question: I know that this question has already been answered, but the method described here
is actually not working for me... o.O
I read in some other forums that a different formatting is required, but I don't know which... If anyone could help me with this...
I am running Raspbian's latest release as of 28/11/2014
Cheers
Comment: You should include a link to the other question, what do you mean by not working, what do the logs say if anything, is there any message in dmesg?
Comment: Sorry, the link to the other question is actually the word "here"... It's my fault, I didn't make it very clear...
Comment: When using the solution described in the link, as soon as i create the file and add the script in Nano, exit and save I get `chmod: changing permissions of '/etc/init.d/start-sound': Operation not permitted`
Comment: Ok, in the end I managed to find the rest of the script by using the formatting of another startup-script. (`##BEGIN INIT INFO` part was actually missing). I am going to share the script here in some time, so everybody who is still trying to figure out how to create a Startup Sound can use it...
Answer: You can create a startup sound using mplayer and a mp3 file.
Here is what you need:

Install mplayer

sudo apt-get install mplayer

Make sound directory in /etc

sudo mkdir /etc/sound

Upload the sound file as mp3 to the sound directory

sudo mv /tmp/soundfile.mp3    /etc/sound/sample.mp3

Copy and paste below line on command promp

sudo echo "mplayer /etc/sound/sample.mp3" >> /etc/rc.local

make sure to upload your mp3 file to your raspberry pi in /tmp/ directory
Comment: The file `rc.local` is actually containing something about my IP-Adress... I am not familiar with scripting, would you be able to show me what exactly to add in that file?
Comment: @BlackWhiteX I have updated my answer by formatting code and making it clear.
Comment: using your solution, when I type in `sudo echo "mplayer /etc/sound/sample.mp3" >> /etc/rc.local` I get `-bash: /etc/rc.local: Permission denied`
Answer: Instead of aplay use omxplayer which can read MP3, AAC, WAVE and a few others.
# /etc/init.d/start-sound

echo "Playing startup sound"
omxplayer /path/to/file.mp3 2>&1 >/dev/null &

omxplayer is pre installed with the latest (for a while now) and also you can do the same to play video to a selected output device.
If you get permission error try putting sudo in front of omxplayer
Answer: Add the command to play the sound at the end of /etc/rc.local

Create Startup Sound


Merging XML files

Question: How do I merge multiple XML files, without having redundant data? I have a project using OpenStreetMap, and the data dumps are in XML format. But becuase I plan to divide my target area in the map, then some nodes(points in the map) will be repeated in the XML files. I want to merge all that XML files, and prevent redundant data in the resulting merged file. Thanks in advance!
Answer: I would read each XML file (be it 2, 3,...,N files) into a map. Each time I read a new entry, I would check to see if it's in the map, if it is, make some determination as to which is the entry you want (or merge possibly merge them).
Then when you're done parsing each XML file, dump the map to a "merged" xml file.
These XML parsers may be of help.
http://www.grinninglizard.com/tinyxml/
http://www.xmlsoft.org/
Answer: Do you want to merge these XML files programatically, or do you want to merge them offline using some merge tool?  If it's the latter, Project: Merge might be able to help you.  It can merge two distinct XML files at a time, and can be run from the command line, so you could batch up all the files you want to merge and then just resolve conflicts as they appear.  (Project: Merge will run silently from the command line if there are no conflicts.)

Merging XML files


Does Jupiter rotate at the same speed at every depth?

Question: Jupiter rotates in less than 10 hours. Its rotation is differential, with the upper layers of the atmosphere spinning a bit faster at the equator than at higher latitudes. Do the inner layers of Jupiter rotate at the same (angular) speed as the outmost layers of the atmosphere?
Comment: Well, if the inner layers have the same angular speed then they have a lower linear speed.
Answer: No. The deep interior of the planet rotates as (nearly) a rigid body (Guillot et al. 2018), while the outer part of the planet undergoes differential rotation. Therefore the interior and exterior rotation cannot match at all latitudes simultaneously.
Comment: Quite a cool paper! I think this was about the time that single, well characterized value for the rotational period of Jupiter could be ascertained?


Removing one pane on a double pane leaded glass cloudy metal door

Question: We purchased a house with French Leaded glass front doors which we like very much. They are also double pane with one being very cloudy. How can we remove the one pane  inside plain glass to be able to clean. This is not a little leaded glass. This glass measures approximately six inches from the top of the door and approximately 10 inches from the bottom on metal doors.
Comment: Is this actually 'encapsulated double glazing'? Real leaded glass inside a modern double-glazed surround [or a leaded face on modern double-glaze]? If so, you need to have it rebuilt professionally - the gas has gone.
Comment: there are drill bits for making holes in glass. I fixed a foggy one by pulling back the trim and drilling two 0.25" holes in opposite corners of the pane, and feeding a fish pump's tube into one of them. It cleared away all the condensation overnight leaving a surprisingly clear interior surface that needed no further cleaning. I re-sealed with a square of scotch tape on a dry afternoon. I lost some R-value for sure, but it looks fine.
Comment: Pictures of the entire door and close ups of the trim and _any_ other detail that you think could _possibly_ be relevant would be extremely helpful.
Comment: @dandavis - doing that you just gave yourself an annual task, until such time as mould grows, then you've wasted one pane & need to replace it as part of the re-assembly. No-one will guarantee a drilled pane on a newly-sealed unit.
Comment: @Tetsujin it already needed replaced when i arrived years ago, and it's been fine as-is since, saving me at least the interest on the cost of an inevitable  replacement.
Answer: This is not a full answer - until we get confirmation of details - this is just to be able to show examples to my comments…
These pics from a job I'm currently working on, coincidentally.
This is what happens when the seal goes & the original gas-fill escapes. You first get condensation build-up, but after a while mould starts to grow. The only way to fix this is to have the panel stripped, cleaned & re-sealed.
Trying to dry out the condensation is going to be an annual event, until you have to eventually give up once it's no longer just condensation - just postponing the inevitable. Of course, if you've drilled one pane to facilitate the drying process… you then need a whole new pane. No-one is going to guarantee the job if you drilled it.

This is modern "fake" leaded glass. the leading & coloured elements are actually stuck to the outside face of a piece of plain glass, part of a standard double-glazed sealed unit. In this instance the inside pane is privacy glass, patterned. You can just see a part of the aluminium arc top left of the sealed unit. The alternative is that 'real' leaded glass is completely encapsulated inside two skins of modern sealed unit, in effect making it a triple-glazed unit. This is usually only done to 'rescue' an existing [probably very expensive] hand-made original pane. You can't seal real leaded glass as part of a regular double-glazed unit - it just won't stand it; it will bow inwards & very likely just leak the gas-fill in a week.

If you find a willing contractor, this task could be done in a day. Making up sealed units is not a particularly time-consuming task.


Identity verification prior granting access to personal data [GDPR]

Question: When receiving by E-Mail a Subject Access Request (SAR), which steps must be taken to ensure that the person requesting the SAR is the effective owner of the personal data?
Answer: You should make sure that the person making the request is actually the data subject. However, you have a lot of flexibility to create an approach that is appropriate for your specific circumstances.
Per Art 12(6), where you have reasonable doubts about the identity of the person making the request, you may request additional information to confirm the identity. The information that you request should be proportional to the data you are processing.
Per Recital 64, you should use "all reasonable measures" to verify the identity of the data subject who requests access. However, you should not keep data for the sole purpose of being able to respond to requests. (Compare also the data minimization principle and Art 11).
Per Art 11, you do not have to satisfy data subject requests if your data doesn't allow for identification. However, the data may still allow indirect identification if they provide enough contextual information.
If you are running some online service, then asking the data subject to log into their account is a reasonable identity verification mechanism – but that's only as strong as the "I forgot my password" mechanism that you've implemented. Effectively, it may be sufficient if the requestor is able to demonstrate that they can receive emails on an email address that you already have on file.
When you ask for identity verification, the one-month deadline for responding to the data subject request starts when you receive that verification. (This isn't explicit in the GDPR, but it's a reasonable consequence and e.g. the ICO says so in their guidance).


What is the best way to create a square grid in Unity?

Question: So I need to create a square grid like the one below. And be able to click on a square, the square you chose then is filled with a different color as well as all the squares right and below the square you have chose.
My question is what will be the most efficient way to create this grid either in 3D or 2D in Unity.
Comment: What have you tried?
Comment: I tired doing it with 2d sprites but found a problem when wanting to press and delete multiple sprites. Also tried using squares in a 3d space with a 2d view but keeping track of the different positions of each block and what need to be deleted after a square has been selected just confused me. Now I'm trying to do it with buttons?
Answer: The component you seem to be looking for is the TileMap.
A complete tutorial would be a bit too broad, and also redundant because there are many good tutorials for it available through your preferred search engine. So here just an overview:

A tilemap is empty at first. You need to paint tiles on it, either by hand or programmatically.
In order to do that, you need a tile image first. If you want a grid like this, you should create a sprite which is just a black rectangle with white fill.
Clicks on tiles can be detected by adding colliders to all tiles or using the technique described here.
When scripting, the Tilemap component allows you to access individual tiles with tilemap.GetTile and even has a convenient method for setting the color tint of a tile directly with tilemap.SetColor


Can a long stem be used safely with a short head tube?

Question: I picked up a 91 Rb-1 50cm down tube and 53cm top tube but the reach is a little short. A new stem was my best option so I picked one up. the height of the stem seems too long visually for the head tube but feels better. I understand the handling may be a bit different but would like to know if its safe?
Answer: If the quill stem is in the steerer tube at or past the minimum insertion length then mechanically this should be safe regardless of the height above head tube. This is assuming that the bike is still running a threaded headset and quill stem and the headset was correctly fitted with the fork.
I can't comment on the effect on handling and how safe the bike is to ride now.
Great bike by the way.
Comment: Another caveat would be that the stem should not be inserted so deeply that the wedge is projecting into the top of the fork.


If my path works on local why does it not after deployment to http?

Question: I have a a couple of delete buttons from the frontend which are processed via these functions:
protected void ibDel01_Click(object sender, ImageClickEventArgs e)
    {
        Classes.deleteFile(GridView1, "01", hplCorr01);

    }
    protected void ibDel02_Click(object sender, ImageClickEventArgs e)
    {
        Classes.deleteFile(GridView1, "02", hplCorr02);

    }

The I have main Classes.cs file which defines our deleteFile function:
public static string sDocumentFilePath = "~/Correspondence/";
public static void deleteFile(GridView gv, string sFileNo, HyperLink hpl)
    {
        string sID = gv.SelectedDataKey[0].ToString();
        string sURL = "CorrFile" + sFileNo;
        string sURLdate = "CorrFile" + sFileNo + "Date";
        Classes.deleteFileFromSql(sID, sURL, sURLdate);
        //delete from folder
        string sFile = hpl.NavigateUrl.ToString().Remove(0, 17);
        //Classes.deleteFileFromServer(hpl);
    }

    public static void deleteFileFromSql(string sID, string sURL, string sURLdate)
    {
        SqlDateTime sqldatenull = SqlDateTime.Null;
        string sSql = "UPDATE dbo.tbl_uploads " +
            "SET " +
                sURL + " = " + sqldatenull +
                ", " + sURLdate + " = " + sqldatenull +
                    " WHERE fID = " + sID;
        SqlCommand comm = new SqlCommand(sSql);
        comm.Parameters.Add("@ID", SqlDbType.Int).Value = sID;
        if (DBConnect.CmdExecute(comm, sSql)) { } else { }
    }

    public static void deleteFileFromServer(HyperLink hpl)
    {
        string sFile = hpl.NavigateUrl.ToString().Remove(0, 16);
        string sPath = HttpContext.Current.Server.MapPath(Classes.sDocumentFilePath);
        //string sPath = HttpContext.Current.Request.ApplicationPath;
        if (Directory.Exists(sPath))
        {
            File.Delete(sPath + sFile);
        }
    }

As we can see it's simple functionality that deletes (makes data empty on db) data for the specified columns (sURL). Now this works locally (IIS > localhost) but on the live it does not delete and in fact no action happens at all on the frontend nor does data get removed from the db nor does the physical file get removed from the defined directory. Is this a directory definition issue or security issue(application's secure paths)?
Structure:
The physical path locally: C:\Docs\VS2012\BABYAPP
Virtual local's URL: http:/localhost:0000/babyapp/admin.aspx
Local file uploads location: C:\Docs\VS2012\BABYAPP\Correspondence

The physical path for live: D:\motherapp\babyapp
Virtual live's URL: http://motherapp/babyapp/admin.aspx
Live file uploads location: D:\motherapp\BABYAPP\Correspondence

Any thoughts?
Comment: First of all your SQL handling is very insecure. It invites every guy who plays with SQL Injection. Take a look into SqlParameters. Debug your code. Then you know which path is used in ```Directory.Exists(sPath)``` and you can compare that to your expectations.
Comment: I understand before going live I will change all embedded sql to use Stored procedures and parameters. Under Script Documents when in Debugging we get two new resources pop up, one is called something like ScriptResource.axd?d=9d78zhfu etc. and the second one called is called http://localhost:0000/babyapp/userAdmin.aspx?_TSM_HiddenField_=ctl00_MainContent_ToolkitScriptManager1_HiddenField&_TSM_CombinedScripts_=;
Comment: Could it be that the live IIS has a different version of ToolscriptManager? In fact on local even when directory is wrong or removed in definition (e.g. public static string sDocumentFilePath = "~#122jibberish/";) it still deletes from the frontend i.e. file is not there anymore. This tells me that it could be a clientside only issue.
Comment: Our live box is dodgy and doesn't have the correct version of Visual Studio and just proves a more painstaking task moving files back and forth from local to live. Debugging locally there is nothing in Directory.Exists(sPath).
Answer: Probably reason
If the path is correct as you say, and works locally then the issue is on permissions.
To been able to delete the file, you must give on the directory/file the permission on the user under witch your pool is running
See here how you can do that:
How to set correct file permissions for ASP.NET on IIS
Alternative reason
Other reason that a file can not be deleted is because have been opened by some other program/procedure..
Some comments
The File.Delete Method throw exception if fail to delete the file, so probably the Directory.Exists Method fails also because of permissions, or you have exception that you miss.
from msdn:

If you do not have at a minimum read-only permission to the directory,
  the Exists method will return false.
Comment: I think you're right it's probably the Probable reason. I will have to tread lightly and note each step of permission as we don't want motherapp going down due to wrong permission settings. Quite possibly it could be the Alternative reason and Some comments reason if permissions would be related to the first reason. I will try the Alternative reason first by putting in downtime this afternoon and because it's safe but if it doesn't work I will try to fix it via Probably reason which would also mean it was a permissions issue from Some comments reason and resolve this too.


Maximum Liklihood Image Classification; Does this algorithm consider RGB Band values only?

Question: if it is correct that Maximum Liklihood classification algorithm takes into account RGB values of the bands only, then is it useless to stack other bandslike NIR SWIR etc prior to go ahead and use stacked image to retrieve landcover classes?
Comment: You need to state what piece of software that you are using. There are many implementations of Maximum Likelihood, however, it should be easy for you to test if the one you are using is only using RGB by simply running it once on a 3 band stack and again with the other bands stacked in as well.
Comment: I am using ENVI 5.3 to extract my Landcover classes, So my questions is explicitly confined to ascertain whether Maximum Liklihood Classification considers RGB bands only?
Comment: In the future, remember to add a ENVI 5.3 tag to your question. As for the question itself, I'm quite certain that the implementation of Maximum Likelihood Classification takes into account all available bands.
Answer: Maximum Likelihood Classification, in any remote sensing software, will consider all of the bands passed to the tool and not be limited to the RGB spectral space.
However, one thing to keep in mind is that Maximum Likelihood does not do very well with data in different scales so, for the best results, you want to match the bit-depth of your data. For example, if your NDVI is in a floating point (-1 to 1) and your source spectral data is 8-bit you would want to rescale NDVI to 0-255. Maximum Likelihood is also not a very good choice in algorithms when including ancillary data (eg., slope).
Comment: @ Mikkel Lydholm Rasmussen, in view of this ambiguity I should classify an extract of the scene using all of spectral bands with me and with RGB separately to check.
Comment: Not sure what the source of ambiguity is. If you are using ENVI there is absolutely no doubt that all of the bands passed to the maximum likelihood classifier will be used. I am really wondering where you got the impression that this was not the case.
Comment: Jeffrey Evans, the source of ambiguity is the result of this algorithm http://gis.stackexchange.com/questions/191158/how-to-classify-difference-surfaces-having-almost-similar-reflectance-responses  although there is vivid contrast between the spectral responses of these two materials (see spectral profile of the both) why does they were not segregated using the algorithm.
Comment: @Ben, but the post you are pointing to has nothing to do with a ML algorithm using only the RGB bands but, rather about spectral separability. Again, I have no idea where you got the impression that ML, implemented in remote sensing software, only uses the RGB bands. I have been working with remote sensing data for 25+ years and this has never been the case with any software I have worked with, which have been numerous. Your assertion that only the RGB is considered is just incorrect, otherwise a massive history of remote sensing would have just not been possible.
Comment: you are right, thank you for a brief outline for the understanding. It has helped me what I can't understand in the past.


microcanonical distribution

Question: We know that in an isolated system, the density matrix is the microcanonical distribution matrix. That this the possibility for all the states with energy in a certain interval is a constant?
But how can I deduce this from the postulate of equal probability?
Comment: Josh is saying it in a softer, vague way, but I will say it more clearly: it is not true that for an isolated system, the density matrix must be a microcanonical one. It may be but it is very unlikely. All other density matrices may describe an isolated system, too. That's why they exist. The words "microcanonical" and "equal probability" (among all states allowed in the microcanonical subset) are really synonyma, so any "explanation" why they're the same thing will be at most an an uninteresting tautology.
Answer: The assertion that the density matrix for an isolated system is that of the microcanonical ensemble implies the postulate of equal a priori probabilities since, as you indicate, it assigns equal probabilities to each of the energy eigenstates of the system.
I would then ask you the following question:  On what grounds do you assert that the density matrix of an isolated system is microcanonical?
One answer you could give is that the microcanonical density matrix is precisely the one that maximizes the (von-Neumann) entropy of the system.
So then the question becomes: Why is the density matrix that which maximizes the entropy?
The best answers to this come from understanding the von-Neumann entropy in the context of information theory.  More on that here.  You might also find the following related Physics.SE question interesting:
Why is (von Neumann) entropy maximized for an ensemble in thermal equilibrium?

microcanonical distribution


Energy density what volume?

Question: In a derivation of energy density for an electric field (see here) We get rid of the
$$\epsilon_0\oint(V \vec E \cdot d\vec a)$$
term by choosing a surface sufficiently far away so that this term vanishes. This leaves us with the expression:
$$W=\int\frac{\epsilon_0}{2}E^2d\tau$$
And then we can conclude that the energy density is:
$$u_E=\frac{\epsilon_0}{2}E^2$$
But let us say we did not chose a surface at infinity, but rather one relative close to the charge distribution. Would we still get the energy density? Or would we get an energy density that when integrated over the smaller volume (enclosed by the new surface) gives us the total energy $W$.
i.e. Does the energy density depend on the surface that we use, in either case please can you explain why?
Comment: you still have density given by $u_E$, so that the energy in a volume $V$ is the integral over $V$ of $u_E$, but the work done to assemble this configuration needs the flow term that becomes negligible at infinity, otherwise you would get the wrong result.
Comment: I think you are misunderstanding the statement. It is doing a simple substitution: $W=\int\frac{\epsilon_0}2E^2d\tau=\int u_Ed\tau$, which requires the definition $u_E=\epsilon_0E^2/2$.
Answer: I understand that in fact, your problem is
Does the energy density depend on the surface that we use?
In either case please can you explain why?
I followed the text that you indicate, and the answer is yes, the energy depends on that surface. After deriving the formula
$$W = \frac {1}{2} \sum _i q_i \left( \sum_{j \ne i, j=1} ^n \frac {1}{4 \pi \epsilon_0} \frac {q_j}{r_{i,j}}\right) \, ,$$
the author of the text said "We can now pull the charge $q_i$ out of the sum", and he pushes this charge to the distance $r_{i,j} = |\vec r_i - \vec r_j|$, where $\vec r_i$ is fix and $\vec r_j$ runs over the rest of the charges.
Then the author says that the expression inside the round parentheses is a potential $V_i$ that acts on the charge(s) $q_i$, i.e. at the location of the charge(s) that he pulled out from the bulk of charges $q_j$,
$$W = \frac{1}{2} \sum _i q_i \ V(r_i),$$
and he transform the sum into an integral. The integral is over the volume occupied by the removed charges. This is why the work depends on the radius of this volume, and ultimately the energy inside. Because with the radius, i.e. with how far you move the charges, changes also the invested work.

Energy density what volume?


No 'Add friend' facility on Facebook

Question: Found old friend on Facebook. Sent message. Message accepted. Facebook says 'you and so & so are not connected on Facebook'. How do we send a friend request?
Answer: I think your friend has a privacy setting for Who can send friend requests?. If your friend has set it as Friends of friends and you both do not have any mutual friends, you will not see Add friend button or if your friend has set it No One, in that case Add Friend button will not visible on his/her profile.
Another case is may be your friend already has friends to the limit (5000). In this case he/she will not be able to add more people as a friend.
People can select the audience they want to receive friend requests from in their settings. You might consider sending your friend a message and asking them to friend you.
To know about friend requests privacy see this Help Center article.

No 'Add friend' facility on Facebook


Present Perfect + Complex object

Question: Are these phrases equal to each other in their meanings?:

I have seen him do it (he finished doing smth)
I saw him do it (he also finished doing smth as in the first sentence)
Answer: No, they're not equal in meaning, but the difference is in how the speaker is choosing to relate to the events, not necessarily in an objective difference in the events described.
I have seen him do it means that the speaker is choosing to treat seeing him do it as having some relevance to the present. Some examples of what that might mean are:

it has only just happened,
the speaker believes that he has done it more than once, and still continues to do it
the circumstances in which he might do it are still in force, so it is possible the speaker could see him do it again

I saw him do it speaks about it as a completed action, with no present relevance. That doesn't exclude the possibilities above, but it more likely means that the speaker does not expect to see him do it again - perhaps he has gone away, or has used up some resource, or has been warned about doing it again.
Note that the choice does not say anything about whether "it" (whatever it was that "he" did) has present relevance. So for example, I find

I saw him break it: look, here are the pieces

more natural than "I've seen him break it: look, here are the pieces". The breaking then has present relevance ("He has broken it!"), but the seeing is a completed action.
Answer: No.

I have seen him do it.

Using a perfect tense indicates activity over some period of time. This sentence implies having seen him do it at various times in the past.

I saw him do it .

Using simple tense indicates an action at a single point in time. So he was seen doing it one time in the past. If more than once, it would need to imply that specific instances were known.

Present Perfect + Complex object


Streaming audio to Raspberry Pi radio

Question: I'm using this guide to turn my Raspberry Pi into an FM transmitter. I can record audio, scp it over and then play it using the method described in the guide. My aim is to use a microphone on my main PC to stream audio over the network to the Pi, with will pipe it to the PiFm program.
I can't seem to pipe in an audio file at all, even locally on the Pi. Here is the prescribed method for playing a sound file using PiFm:
sudo python
>>> import PiFm
>>> PiFm.play_sound("sound.wav")

I've tried adding fileinput to the PiFm.py file using this method but when I try to give it a WAV file as an argument, or pipe it in, I get the following error:
pi@raspberrypi ~/radio $ sudo python PiFm.py sound.wav
Traceback (most recent call last):
  File "PiFm.py", line 11, in <module>
    play_sound(line)
  File "PiFm.py", line 7, in play_sound
    call(["./pifm", filename])
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
    raise child_exception
TypeError: execv() arg 2 must contain only strings

Here is my PiFm.py file:
#!/usr/bin/python

from subprocess import call
import fileinput

def play_sound( filename ):
   call(["./pifm", filename])
   return

for line in fileinput.input():
    play_sound(line)

Answer: Try:
PiFm.play_sound(u'sound.wav'.encode('utf8'))

Streaming audio to Raspberry Pi radio


Time travel novel where a man falls asleep each night and lives a full lifetime

Question: I'm in search of the title of a novel I read in the '70s. A man falls asleep and each night lives a full lifetime. He realizes he has awoken in the present day when sees a white curtain blowing in window.
Answer: The business about a man waking up and seeing a curtain waving in a breeze makes me pretty sure that the story you're remembering is "Mind Partner" by Christopher Anvil.  The text is available online.
The protagonist repeatedly lives out a full life and dies, only to wake up in the same room.  E.g.

He breathed his last breath in satisfaction.
And woke up lying on a bed in a room where a light drapery blew back at the window and the morning sun shone in, and his clothes were folded on a chair by his bed.
Comment: Good suggestion! FYI, a scan of the original publication is available at archive.org (https://archive.org/details/Galaxy_v18n06_1960-08/page/n7). If correct, this question is a duplicate of https://scifi.stackexchange.com/questions/86616/short-story-collection-with-one-story-about-a-fictional-drug
Answer: This could be The Dream (1924) by H. G. Wells, although there is only a single dreamed lifetime actually recounted in the book.  Most of the books is spent on a description of this dream.  In the epilogue, the narrator, Sarnac, uses the dawn light leaking around the curtain at the entrance to his room as a metaphor for his awakening back in his own native time.
From the plot summary, per Wikipedia:

In circa 4,000 A.D., a biologist named Sarnac is taking a holiday among mountains and lakes with his lover, Sunray. With four other holiday travellers, they visit some 2,000-year-old "ancient remains [of war dead] that had recently been excavated" in a nearby valley. A little later, after a brief afternoon nap, Sarnac awakens from "a very vivid dream." The rest of the novel consists of Sarnac's recounting of the dream, with occasional discussion of its particulars with his companions. Sarnac's dream brings with it total recall of the complete life of Harry Mortimer Smith. Smith's life and the institutions that structure it are the subject throughout the novel of a running commentary from the point of view of the achieved Utopia of 2,000 years later.
Harry Mortimer Smith was born in 1891 or 1892 in the fictional town of Cherry Gardens, in an area bordering the South Downs on the southern English coast. His father is a greengrocer who has trouble supporting his family because of the ignorance of birth control. He profits from the sale of produce from the nearby estate of Lord Bramble, where Harry Mortimer Smith's mother's brother, Uncle John Julip, works as head gardener.
Harry unwittingly exposes this theft when he is sent to work at Lord Bramble's estate, and as a result his uncle loses his job and comes to depend on the Smith household. Uncle John debauches Harry's weak-willed father, leading him to yield to the temptation to drink and bet on horses. The only person in the household that Harry esteems is his older sister Fanny, whom he helps run away to rejoin a lover in London. Harry's parents are scandalised by Fanny's sudden departure; shortly afterwards Smith père dies after being struck by an automobile.
Harry and his sister Prue go with their widowed mother to a boarding house in the central London district of Pimlico run by Matilda Good, a friend of the family. Wells was proud of some of the minor characters he sketched in this part of The Dream.
By chance, in London Harry reestablishes contact with his sister Fanny, who has become the kept woman of an important publisher. This connection enables Harry to gain employment at Thunderstone House and the publishing firm of Crane & Newberry, where his star is still rising at the end of his life. In this part of the novel Wells analyses the importance of and limitations of popular publishers in the years before the First World War.
The conclusion of The Dream is chiefly concerned with Harry Mortimer Smith's love life. Just before going to fight in France he meets Hetty Marcus, the daughter of a farmer. They marry, but when Harry discovers that Hetty has been unfaithful to him in his absence and is carrying another man's child, he divorces her—despite the fact that he is still deeply in love with her. Wells uses the occasion to comment on English sexual mores of the day: "We had no sexual education at all, only concealments and repressions. Our code was still the code of jealousy—thinly disguised. The pride and self-respect of a man was still bound up with the animal possession of women—the pride and self-respect of most women was by a sort of reflection bound up with the animal possession of a man. We felt that this possession was the keystone of life. Any failure in this central business involved a monstrous abasement, and against that our poor souls sought blindly for the most extravagant consolations. We hid things, we perverted and misrepresented things, we evade the issue."
Harry Mortimer Smith soon marries a woman who works at his place of business. They have a child, and his career prospers. But he becomes involved with Hetty again, and his life is abruptly ended in the early 1920s when he is murdered by Sumner, her jealous husband.
In an epilogue, Wells's characters discuss inconclusively the possibility of human immortality and the possibility of memories surviving death.


What is this plant and why are the "leaves" yellowing?

Question: The leaves of this plant are thick and plump.
Answer: It is Crassula ovata, common name Jade or Money Plant. It is a succulent, and as such, watering should be done with care; the usual cause of yellowing leaves is overwatering, but these plants do shed leaves, so if the ones in the picture were shed from the bottom of the plant, this might be normal leaf loss. Some sun is beneficial, but despite what most houseplant guides say about needing sunlight, bright  daylight is fine, with a little sun if possible.
In regard to watering, let the surface of the soil dry out slightly between waterings, and when you do water, water well, allowing the excess to drain away freely. Empty any outer pot or tray after 30 minutes so the plant is not left sitting in water. Average  room temperatures are fine, but not below 10 degC at night, and preferably don't stand it near a heat source such as a radiator. More information here https://www.gardeningknowhow.com/houseplants/jade-plant/jade-plant-care.htm
Comment: depends what you mean by regularly - repot if the topgrowth is collapsing and needs support, or  if it becomes pot bound (roots hanging out of the pot, coiled around themselves when you turn it out of its pot, topgrowth obviously much, much bigger than the pot its in)
Comment: Bamboo to the rescue again! Thank you. I do leave that plant outdoors full time.
Comment: Does this plant require transfer to a new pot regularly?


Black Screen with an underscore at the top left of screen

Question: I remember locking the laptop with Super+L and after I return and open it, it shows me the above mentioned black screen. So I forced shutdown and now restarting it always gives me black screen with an underscore(_).
Answer: I get the same thing but mine had to do with adding a 5600 xt and the radeon drivers in 5.3 not working. Installing 5.4 fixed the issue. Too do this boot to 5.1 and install ukuu and use it too install 5.4 I haven't tried 5.5.


Es lebe vs Lang lebe

Question: I've seen both uses of the Konjunktiv I: Es lebe der König and Lang lebe der König
They both seem to mean Long live the king though.
Is there a difference between them or are they interchangeable?
Answer: Es lebe ... is more like hail to ..., let's hear it for... or a cheer for... (or closer to the word: ... shall live), while lang lebe is long live.
Answer: The crucial point is, that you are stating a wish here.

Lang lebe König ...

is fine. It is universally applicable, even if the addressed king is already of advanced age.

Es lebe der König...

is a fixed phrase best matching a newly proclaimed king, since he just started being king. Es lebe König Heinrich adds clarity, that the transition to king-ness is addressed. Another use would be for a severly  sick (wounded in battle, poisoned, etc.) person, to express, that you wish health. (Note, that both situations are also covered by Lang lebe...) For other situations the wish is not easily understood, since the person already lives.
The second phrase is therefore more appropriate for non-persons as love, democracy, tolerance, freedom etc., which don't really live, to show your sympathy.
Answer:
Es lebe der König! = May the king live!
  Lang lebe der König! = May the king live long! = Long live the king!

So, the meaning is quite the same.
About the grammar of both sentences:
Both sentences are imperative sentences, this is the mode for commands (»gehe fort« = »go away«) and wishes, as in you examples.
The word Es in the first sentence is an expletive pronoun. It is there just not to have the first position of the sentence being empty. In English there is one way to use expletive pronouns, like in this example:

It is raining.
Es regnet.

This English it and the German es do not refer to the producer of the rain. They refer to nothing. Both words are here just to put something in position 1 of the sentence. If used this way, this expletive pronoun is the grammatical subject of the sentence, and there is nothing else in the sentence that could be the subject or that would name the actor/performer of the action.
But in German you can use this expletive pronoun even if there is a word (or group of words) that could be the subject or that is naming the actor/performer of the action:

Es ziehen Wolken über den Himmel. = Wolken ziehen über den Himmel.
  Clouds are moving across the sky.
Es fährt ein Zug nach nirgendwo.(1) = Ein Zug fährt nach nirgendwo.
  A train goes to nowhere.

(1) Title of a German Schlager from 1972
And with the same pattern, but now imperative instead of indicative:

Es lebe der König! = Der König lebe!
  May the king live!

But you also can put an adverbial (adverbiale Bestimmung) on position 1 instead, and this is what happened in your other sentence. But this adverbial has a meaning (which »es« doesn't have), so it keeps existing in the sentence if you move the subject on position 1:

Lang lebe der König! = Der König lebe lang!
  May the king live long!
Comment: "Es lebe" is not imperative, it is present subjunctive (German: Konjunktiv I).
Comment: @IQV. Morphologically it is a subjunctive. Syntactically it is used as a hortative ("may the king live") not an imperative ("live, oh king").

Es lebe vs Lang lebe


Start service using System.Diagnostics.Process.Start

Question: I'm working with c# and try to run process using vb script.File is working fine when try to run System.Diagnostics.Process.Start(path); it works fine. I'm using window service when try to run using System.Diagnostics.Process.Start(path); it doesn't run my whole script i don't know it happening i have no idea why it is happening ? i also used wait command but still script file not execute completely
any idea?
Answer: You will need to debug the issue further, as it's almost impossible to tell what the problem is with the provided information.
You say "it doesn't run my whole script".  Does this mean that it runs part of the script?  At what point does the script stop executing?  What statement is the script supposed to execute at that point?
Without any other information about the problem, my thought is that this might be a user context or permission issue.  Services generally run under a system account, whereas applications that you launch yourself run under your own user context.
If this script is accessing a network share, then it might execute fine under your own user context, assuming that you have already accessed that network share and provided credentials, but attempting to access that network share from a service might fail, because the service is not running under your user context.


What's the drawback of SqlBulkCopy

Question: I have done some research for "The bast way to insert huge data into DB with C#" then a lot of people just suggested me using SqlBulkCopy. After I tried it out and it really amazed me. Undoubtedly, SqlBulkCopy is very very fast. It seems that SqlBulkCopy is a perfect way to insert data (especially huge data). But why dont we use it at all times. Is there any drawback of using SqlBulkCopy?
Answer: SqlBulkCopy does exist for Oracle v11 as well, but it's provided by the Oracle .NET assemblies you get when you install Oracle Client. The SqlBulkCopy class is basically implemented one by one, by the provider of the target database engine.
One HUGE drawback, though - there is absolutely no error reporting. If, for example, you've updated data in a DataSet, are flushing it back tothe DB with an adapter, and there's a key violation (or any other failure), the culprit DataRows will have .HasErrors set to true, and you can add that to your exception message when it's raised.
With SqlBulkCopy, you just get the type of the error and that's it. Good luck debugging it.
Comment: +1 Completely agree that debugging is an issue with BulkCopy. One approach I have is to "deconstruct" failed BulkCopy commands and inserting row by row in a finally block. That way I can pinpoint the offending DataRow as part of my Error reporting.
Comment: I figured out that for error reporting there is a way to get the individual failures back, but it does involve resubmitting the bulk copy in pages of one record and then catching and throwing all the exceptions (along with the culprit rows). It's not the most efficient, but it only happens when an error occured, so it's not too bad. See here for complete article: http://www.codeproject.com/Articles/387465/Retrieving-failed-records-after-an-SqlBulkCopy-exc
Answer: Two reasons I can think of:

As far as I know, it's only available for Microsoft SQL Server
In a lot of normal workloads, you don't do bulk  inserts, but occasional inserts intermixed with selects and updates.  Microsoft themselves state that a normal insert is more efficient for that, on the  SqlBulkCopy MSDN page.

Note that if you want a SqlBulkCopy to be equivalent to a normal insert, at the very least you'll have to pass it the SqlBulkCopyOptions.CheckConstraints parameter.
Comment: @BarryKaye: No, it's not. The name is `Bulk Copy` so you should be copying data for which the constraints are already be known to be correct, if not then you don't know what you are doing... :)
Comment: Yeah, SqlBulkCopy can only be used with MS SQL Server. This is also only one of drawback I know. Sometime it is not really big deal. For example: Our customers only use MS SQL Server and we only build applications for them with several classes that belong to System.Data.SqlClient namespace.
Comment: Why is `SqlBulkCopyOptions.CheckConstraints` false by default? - it's so counter-intuitive!

What's the drawback of SqlBulkCopy


SSRS 2008 - caching data used by multiple reports

Question: I am using SQL Server Reporting Services 2008. I have one dataset which is shared among several reports--each report groups or formats data differently. Is it possible to configure things so that the data is pulled from SQL Server when one of these reports is built and then cached within SSRS for a configurable period of time? Assume that I can select against database tables but can not create objects.
Answer: Here's another option, which although complex, might fit your requirements.
Have all of the reports use an XML data source. Then create that XML datasource as an ASP.Net web page or web service. Configure and use SQL Cache Dependency to control when the database would be queried again.
Now, any time any one of the reports asks for the data it will be cached in your "middle tier".
Answer: Unfortunately no.
Your main option would be to investigate "Report Snapshots" to explicitly cache the report (and indirectly the data)
Otherwise:

You could change the reports to have a lot of conditional formatting etc so you only have one report. Some caching will happen automatically per user session, but not much
Use the ReportViewer control in local processing mode, using ASP.NET to cache data
Answer: You can now in SSRS 2008 R2:
http://msdn.microsoft.com/en-us/library/ms170438.aspx - Shared DataSets
http://msdn.microsoft.com/en-us/library/ms155927.aspx - Report Caching in Reporting Services
Go SQL!


"Supported groups" in RFC 8446 (TLS 1.3)

Question: What is meant by "supported groups" in the section 4.2.7. "Supported Groups" of RFC 8446:
/* Finite Field Groups (DHE) */
ffdhe2048(0x0100), ffdhe3072(0x0101), etc:
Is the digits - 2048, 3072 (and groups) etc - are simply numbers of bits of the parameter p (module) in DF algorythm or something else ?
Answer:
Is the digits - 2048, 3072 (and groups) etc - are simply numbers of bits of the parameter p (module) in DF algorythm or something else ?

These names are references to the groups defined in RFC 7919; the actual digits refer to the number of bits within the prime modulus.  For example, ffdhe2048 uses a 2048 bit prime modulus.
Comment: Thank you very much!
Answer: They are referring to the parameters required to perform DH operations. For (EC)DH operations it takes a long time compute a set of secure parameters. Hence the parameters are "named" and then referenced using the name, an OID, or in the case of TLS, a set of two bytes (or one 16-bit word) that indicate the parameters used. This also cuts down on communication overhead, of course.
The key agreement operation is then performed with a non generic-public / private key value and the required set of parameters. This derives the master secret, the master key and finally the session keys that are used to encrypt the messages.
The standard itself references RFC 7919:

Finite Field Groups (DHE):  Indicates support for the corresponding
finite field group, defined in [RFC7919].  Values 0x01FC through
0x01FF are reserved for Private Use.

In particular Appendix A, which lists all the required parameters values for the various groups. The parameters themselves are usually present in the various cryptographic libraries and can be retrieved using a mapping name -> map of parameter values.
Comment: Thank you very much!


Is high TPI sheet metal screw stronger for thin materials?

Question: I just discovered that in addition to standard #10-12 sheet metal screws, there are #10-16 and even #10-24 versions available. I'm planning to use them on 0.06" thin aluminum, 0.12" nylon and a sandwich of both. Will a higher TPI version be more resilient to thread stripping with excessive torque? In my cursory analysis, higher TPI, given constant thread depth, should provide higher thread surface contact with surrounding material, resulting in a stronger bond. Is that correct?
Comment: Does this answer your question? [What is the strongest sheet metal screw for 1/16 inch aluminum sheet?](https://engineering.stackexchange.com/questions/52438/what-is-the-strongest-sheet-metal-screw-for-1-16-inch-aluminum-sheet)
Comment: @SolarMike Both questions were posted by me. The one here is more specific.
Answer: Yes. Thin materials and stronger fastening are both reasons fine pitched fasteners are used. I don't know about sheet metal but in normal fasteners, #10-24 is the regular coarse pitch. #10-32 is the fine pitch. But you won't even get 2 threads in the aluminum and I think you want at least 3-5.
Also, which material is going to be tapped? You only have thread the hole in the material farthest from the head of the screw/bolt.

given constant thread depth

Threads depths are not constant. You can tell by looking at the recommended tap drill sizes for the same diameter screw/bolt with different thread pitches.
Personally, I would try and find an alternative approach to tapping the the aluminum. Like a thin nut, or a PEM nut, or something else depending on the situation. Can you do something like use a pin instead of a screw and and flare the pin with a punch?
Comment: I'm looking for the simplest approach. There will be no tapping, just a pilot hole for a sheet metal screw. I just found and tested #10-16 on 1/32" aluminum sheet, and I couldn't strip the thread with a regular screwdriver. I consider that good enough. I ordered #10-24 SMS for comparison.
Comment: @PaulJurczak Even then the equivalent is to drill a larger clearance hole in the material closest to the screw head so it does not get tapped by the screw.
Comment: Yes, that's the plan. The mounting plate contacting the screw head has a large diameter hole, not engaging the thread.
Answer: You need at least 2.5 to 3 threads of engagement for the rated force. This only allows part of 1 turn.
The worm gear compression effect may warp the material. So a lower pitch or finer thread pitch will improve matters.   The weakest link is likely to be the thread rather than the sheet.


Using iPhone as a game controller for Mac for 3d games

Question: I'd like to be able to play Minecraft on my MacBook when there is no room for a mouse (eg on a train). I know that there are apps that let you use an iPhone as a game controller, but they seem aimed at playing classic games on an emulator. Is there an app that can effectively replace the mouse+keyboard combo for controlling a 3D first-person game?
Comment: I don't know of any apps that are good at controlling 3D games – in fact, I don't think there are any. Most likely because it's extremely difficult to play 3D games with a solely touchscreen controller.
Comment: Why not use the touchpad+keyboard on the Macbook?
Comment: @Arkive: I find it quite difficult to use the touchpad for 3D navigation. Do you use it with any regularity?
Comment: I use the touchpad on my Dell laptop very often for 3d navigation. Takes some practice, but it's not bad.
Answer: You might have already looked into this, though I didn't see it mentioned by name so I'll throw it out here anyway. Joypad for iOS will almost do what you want, but doesn't have mouse support. The developer posted a concept video showing him controlling Minecraft by tiling the iPhone to act as mouse input, but that was almost three months ago and the app hasn't been updated since. Might be worth keeping an eye on, though I don't know how practical tilting your phone around on the train would be, assuming it ever comes out.
That all said, have you considered using a virtual trackpad app for your phone? Something like Rowmote or TouchPad? This way, you could keep your left hand on the WASD, and just hold the phone in your hand and use your thumb to manipulate the trackpad, akin to an analog stick. I imagine it might be a little awkward, but no less so than trying to do everything on your phone.
Addendum: I originally included links to the apps in question, but as a new user I can't post more than two links. Rather than risk any showing of bias, I just removed the appstore links for the apps. Should be easy enough to find, though.
Comment: Addendum - the new update to [Joypad](http://itunes.apple.com/us/app/joypad-game-controller/id411422117?mt=8) does feature Minecraft support. new version is a little pricey. Haven't tested it myself.


Is Corba the same as SOA?

Question: I have been looking a lot at SOA recently. Isn't CORBA exactly the same thing as SOA?
Answer: In addition to the fact already mentioned, that SOA is an architecture, and CORBA a specific implementation.
CORBA doesn't implement SOA
the main difference is that CORBA is Object Oriented or Component Oriented and SOA is Service Oriented
The main technical difference (in my opinion) is that in SOA you pass messages (or data objects) and in CORBA you can pass generic objects (which can have methods)
so although you can implement SOA using CORBA (by limiting you self to a subset of the functionality), the standard way of using CORBA isn't service oriented.
Comment: +1 for this answer. I was torn in between but mentioning CORBA is geared towards component orientation nailed it for me.
Comment: Very well said; I think the crux is that CORBA is component oriented and not service oriented, and of course CORBA is a specific implementation of a certain kind of component-oriented remoting architecture, while SOA is not an implementation in itself.
Answer: The difference between CORBA and SOA is that CORBA is a specific technology, whereas SOA is a style of architecture.
Comment: @Zubair Yes - specify services no one will want, and make them as difficult to implement and use as possible. A secondary goal was to avoid providing usable reference implementations of things that people might actually use, such as strings. Disgruntled ex CORBA programmer (never, ever again) speaking.
Comment: @Neil, I like your comment :) I do think that most SOA implementations are complex, maybe one day something easy to use will be available
Comment: @Zubair - it's called REST :-)
Comment: Didn't CORBA have a whole philosophy behind it too though?
Comment: Corba is just one form of middleware to tie different services together. Web Services, Message Queues are a couple of others
Answer: SOA as a concept has been around for years, but was only more recently named as such. There are many technologies that can be said to implement SOA - either completely, or aspects of it. CORBA could be said to be one of them, although the term wasn't around when CORBA was created.
CORBA certainly implements are large part of the SOA surface area, but I don't think you could say it does so completely (whatever that means). SOA can be a bit vague.
Comment: The answer of Ophir Yoktan is way more precise.
Answer: While there is no "official" definition of SOA, part of the point of it is to decouple the various services from each other. This includes possibly decoupling the implementation (platform and technology) used in the service. As an example if one exposes a service via WebServices, any client be it java/python/.Net etc... could consume this service - but utilizing a RPC/remote procedure call framework will often tie you into a particular platform/implementation in order to call the service.
Corba does offer some of what SOA promises, but is at best a subset of what SOA is "meant to be"
The main difference though is that SOA is a general architectural concept, while Corba is a technology implementation of the RPC/Remoting concept
Answer: Not really.  SOA is an architectural style while CORBA is a particular technology with which you can implement SOA.
Answer: CORBA and SOA are both architectures. It is wrong to say CORBA it is an implementation. It is not. It is an architecture, a vision of systems build with objects. SOA is also an architecture, a vision of systems build with services. They both are ways to organize your systems as a collection of either objects or services. There are specific implementations for CORBA as well as for SOA.
They are both technologies. They both give you receipts and recommendations for structuring your systems and for managing complexity. There are tools developed by third parties to support these technologies for both of them.
The objects in a Common ORB Architecture (CORBA) provide services so you can think of a translation between Service Oriented Architecture (SOA) and Common ORB Architecture. They are not the same thing, but one can imagine implementing a software system with either the one or the other, making them, from a certain point of view, equivalent.
They are not the same thing in the same way as Object Oriented Programming and Structured Programming or Functional Programming are not the same thing, although one could use any of the above mentioned programming styles to implement a certain functionality.
Answer: They are inherently different because one depends on the technology (CORBA) and the other doesn't.

CORBA is an open standard developed by the OMG (Object Management Group) for the use ORB (object request broker) middleware with a great focus on interoperability (software platforms, hardware platforms and programming languages).
SOA is a style of software design where services are provided to the other components by application components, through a communication protocol over a network. The basic principles of service-oriented architecture are independent of vendors, products and technologies.

I had the same doubt as you because the definition of SOA is too broad and I can see many concepts of CORBA can be mapped naturaly to SOA's terminology. For example in CORBA, clients (objects)  ask to servers (also objects) to do some work through a communication protocol over a network. Moreover CORBA implementations provide general services like logging and event support. I think this link summarizes the relation between CORBA and SOA:

The first service-oriented architecture for many people in the past was with the use of Object Request Brokers (ORBs) based on the CORBA specification. The CORBA specification is responsible for really increasing the awareness of service-oriented architectures.

Is Corba the same as SOA?


Emergency brake metal latch has snapped off, can it be re-soldered?

Question: The hammer hook that fixes the emergency-brake has come off and I found that some mechanics re-solder them. Can garages also re-solder handbrake cable pieces? Can I have a go myself?
Comment: That is a really good graphic! :o)
Answer: It is likely that every decent garage will refuse to solder them, because the next defect will be their liability. Instead, they will happily offer to replace the entire cable assembly, including conduit.
Replacing brake cables is an standard job. Repairing them isn't, and likely it is even illegal
Assuming you have an older vehicle: Replacing the entire assembly, inclusive conduit, is advisable. Older cables are often contaminated by water and dirt ingress, resulting in cable wear and rust.
Comment: If you were to remove the damaged part and take it to a welding or machine shop, you might be able to get them to weld, braze, or solder it.  At that point it's just some assembly that you brought in.  They don't know what it is and the liability is yours.  But if it were mine, I'd replace it.
Comment: Agreed. Lots of liability involved. Besides, it would probably cost more in labor costs to try and fix it than it would to just replace it in the first place. You'd still have to completely remove the cable in order to get it fixed (well, most sane people would completely remove it).