Websocket library for python

Question: Hi I need a websocket server in python which supports the protocol used in chrome 16(protocol version 13). Tornado and twisted are not working. Websockify works but i can't find any documentation for it. I need minimal setup means lesser imports. Please help me out here thanks in advance.
Comment: Perhaps [gevent-websocket](http://www.gelens.org/code/gevent-websocket/).
Answer:
Maybe you could take a look to pywebsocket, it claims to support protocol version 13 and is designed for :

The pywebsocket project aims to provide a WebSocket standalone server
  and a WebSocket extension for Apache HTTP Server, mod_pywebsocket.

Autobahn is another implementation of websockets :

Autobahn WebSockets for Python provides an implementation of the
  WebSockets protocol which can be used to build WebSockets clients and
  servers

ws4py : Websocket for python :

Python library providing support for the WebSocket protocol defined in
  RFC 6455
Comment: i don't want to use standalone server and a WebSocket extension for Apache HTTP Server, mod_pywebsocket.
Comment: @user867609 : well, I added some other libraries to handle websockets. But if you don't want neither a standalone server nor apache mod, what do you need ?
Comment: sry I want a standalone server and ws4py dosen 't work on chrome 16(HyBi 13)
Comment: @user867609 : if you want a standalone server, why pywebsocket is not correct ? (you can launch it [without Apache](http://code.google.com/p/pywebsocket/source/browse/trunk/src/mod_pywebsocket/standalone.py))
Answer: Here are some examples of implementing a websocket server in Python. Be sure to read and apply the comments on the code of the following examples, because there may be some bugs:

http://popdevelop.com/2010/03/a-minimal-python-websocket-server/ : It has been tested on Chrome, according to the author of the code.
http://mumrah.net/websockets-in-python : At the end of this blog page, the author has included the URL to a Python implementation of a websocket server.
http://dev.enekoalonso.com/2010/05/22/more-websockets-now-with-python/: only works on Chrome, according to the author.
Comment: This one is not working I already tried. It works in only few old browsers
Answer: This page contains an implementation of a Python websocket server that can be used through imports:
https://github.com/AdrianGaudebert/python-websocket-server
You should know that the license for using this is MIT. It may only work with Python 3.0.
Comment: does it supports WS protocol version 13(hybi 13) used in chrome 16
Answer: WebSocket Echo example works on Chrome/16.0.912.63.
It uses txWS a simple library for adding WebSockets server support to your favorite Twisted applications.
Answer: If you are still interested in using websockify, there is a simple example of using it to build an echo server included](https://github.com/kanaka/websockify/blob/master/tests/echo.py).
You can run it like this (from a websockify checkout):
./tests/echo.py 8080

The browse to localhost:8080/tests/echo.html. Enter localhost, 8080 for the WebSocket host and port and hit connect. You should see the client sending messages and the server echoing them back (with a "You said: " prefix).

Websocket library for python


POJO fields disappearing when passed to client from endpoint

Question: I have a POJO that I'm using to pass some data that I've retrieved from a query from teh datastore:
public class User {
    public String email;
    public String username;
}

I set the data from the datastore query, and check that it's set right on the server side.
Then it is bundled into a CollectionResponse and returned from the endpoint to the Android client. Then the data is extracted.
The problem is that when it arrives on the client, email is set to null. The username field still has its data though.
I've tried it with getters and setters defined, with ApiResourceProperty set, but it doesn't help. The weird thing is that I have a very similar setup with another endpoint and there it all works no problem.
Anyone know why this could happen?
Answer: Please make sure that in your endpoint method you specify an HTTPMethod of "Post".
Example:
@ApiMethod(name = "setAnimals", path = "animals", httpMethod = "POST")
public AnimalResponse setAnimal(Animal animal) {}


Does the chromeview project need to be built from source before attempting to use cordova-android-chromeview?

Question: I am trying to build the example project on the cordova-android-chromeview project and I'm having a few issues. The most recent being that when deployed to the device, I receive the following runtime error:
04-25 10:29:29.593: D/CordovaActivity(1951): CordovaActivity.onCreate()
04-25 10:30:46.433: I/LibraryLoader(1951): loading: webviewchromium
04-25 10:30:46.443: D/dalvikvm(1951): Trying to load lib /data/app-lib/com.myapp.special-1/libwebviewchromium.so 0xb1d53778
04-25 10:30:46.443: D/dalvikvm(1951): Added shared lib /data/app-lib/com.myapp.special-1/libwebviewchromium.so 0xb1d53778
04-25 10:30:46.463: I/LibraryLoader(1951): loaded: webviewchromium
04-25 10:31:08.943: W/dalvikvm(1951): No implementation found for native Lorg/chromium/content/app/LibraryLoader;.nativeLibraryLoaded:([Ljava/lang/String;)I
04-25 10:37:40.423: W/jdwp(1951): Debugger is telling the VM to exit with code=1

If I read this correctly, it seems that some libraries that the app is expecting are not exposed to it. I'm not exactly sure how to track down which native files are expected. Nor am I sure how to generate ( or reference? ) the missing libraries.
I am using:

https://github.com/pwnall/chromeview
https://github.com/thedracle/cordova-android-chromeview
Building for Android 4.4

I am trying to run the Example project that came with cordova-android-chromeview using this syntax: ./bin/create ~/Desktop/myapp com.myapp.special MyApp
Is it possible that chromeview simply needs to be built from the chromium source? I hope not, but that's my current thinking.
Thanks in advance, any help would be appreciated.
Answer: First change Target to anything between 4.0 and 4.3. ChromeView does not work on Android 4.4 because there WebView is already driven by ChromeView.
If that does not help, make sure you copied the webviewchromium.pak to your project's asset folder.
Changing build target to Android 4.3 did the trick for me.


Joomla 3 Module Save Event

Question: I am searching for an event that is triggered after saved a specific Module, for a Plugin. Like the onContentAfterSave Event for the Content Group.
Is there such an Event, or how can I trigger such an event after save?
Answer: On the module you should create a dispatcher in its save method like this:
<code>$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger( 'onAfterMyModuleSave', array( $myModuleData, $insertid ) );
</code>
You can include any kind of data that you would like to handle in your plugin with an array like the example.
Then at your plugin you have to create a "listener" like this:
<code>public function onAfterMyModuleSave($data, $id)
{
  //do what you like here
}
</code>
Of course I recommend you first to check for any existing dispatchers in the module

Joomla 3 Module Save Event


Compiz - Can I Disable Switching the Workspace While Dragging a Window

Question: This bums me, cause I am a huge fan of window snapping. Whenever I drag a window to the left or right of my screen, the cube shows, and the window moves to the previous/next workspace. This interferes with window snapping, can I disable this or configure it in such a way that I will need to press a key combo while moving for this to happen.
Answer: Open the CompizConfig Settings Manager by running ccsm in your terminal or starting it from the launcher. Install it if it's missing (obviously).
In ccsm, click on "Rotate cube" and uncheck "Edge flip move".
This should lead to the desired result.


What does a group with no group id means?

Question: As part of my assignment I was asked to find a group called + and to write in brief what I think of it. This group in /etc/group
is shown as +:x:: which means it has no Gid and No users. But what does that means? what does having no Gid does to a group. I wrote that it might be invalid but apparently that's a wrong answer. I couldn't find the answer in any documentation or tutorial.
Comment: Look up NIS+, a directory service that may serve parts of that and other files when a line starts with a plus character.
Comment: I'm curious to know the answer, but isn't your teacher there to help you with that ?
Comment: I emailed him, he didnt reply ♂
Answer: In former times, when there was no
/etc/nsswitch.conf

this method was used to tell the passwd and group lookup routines to search the content of NIS (formerly known as YP).
If this line appears last, then the local file is searched first and then (if there was no match), NIS is searched.
See NIS+ documentation here: https://docs.oracle.com/cd/E18752_01/html/816-4558/adtable-86495.html even though NIS+ has been made obsolete and removed from Solaris in December 2009.
Comment: NIS is still in use and there are Unix systems without that configuration file, so "former times" may only refer to  Linux systems.
Comment: NIS is still in use, while NIS+ has been obsoleted, but modern systems use `/etc/nsswitch.conf` to control search methods and search order.
Answer:
I was asked to find a group called + and to write in brief what I think of it.

What you think is coloured by what operating system you use.
As a FreeBSD user you should appreciate these little history lessons, but they haven't been relevant for almost two decades and the course is seriously out of date.  Or as a Linux operating system user you should understand that some other operating systems may have had unusual mechanisms relating to this, but your operating system never has had.  (-:
Moreover, since + is not part of the POSIX Portable Filename Character Set, it is indeed invalid as a POSIX-conformant group name.  You are right to think that it is.  That is how it is alright to employ it for this purpose.  No actual conformant group name can conflict with it.
(This is the same reasoning that gives us mechanisms like using : to distinguish user/group IDs from user/group names in (some) places where there can be either an ID or a name.  : is not part of the POSIX Portable Filename Character Set, so  will never occur in (conformant) names and can be used to denote IDs, which otherwise are comprised of characters in that character set, and so cannot be unambiguously distinguished from names without some sort of extra information added.)
FreeBSD removed the + mechanism in 2000, having only had it in the first place for six years prior to that.
It is still documented in the OpenBSD and NetBSD User Manuals, so those are where to look for doco that tells you what the mechanism is.  Both still implement it, too.
As far as I can tell, the GNU C Library went straight from a file-only mechanism to an NS switch mechanism in 1996, and never had such a + mechanism.
The commercial Unices I leave as an exercise for the reader.  (-:
Further reading

group.   NetBSD File Formats Manual.  2007-06-21.
group.  OpenBSD File Formats Manual.  2012-06-20.
"Group Name". Base Specifications. IEEE 1003.1:2017.  The Open Group.
"Portable Filename Character Set". Base Specifications. IEEE 1003.1:2017.  The Open Group.
Jonathan de Boyne Pollard (2018).  /run/user/jim.  "Gazetteer".  The nosh Guide.  Softwares.
Jacques Vidrine (2000-09-06).  Add nsswitch support..  FreeBSD Source.  r65532.
Garrett Wollman (1994-09-20). My implementation of YP group file support, modeled after the password file support done yesterday. .  FreeBSD Source.  r2936.
Roland McGrath (1996-06-25). Ulrich Drepper has contributed support for an /etc/nsswitch.conf mechanism similar to that found in Solaris 2..  GNU C Library.


Why are there four types of execution?

Question: Why are there four types of execution? Wouldn't it be enough if there were only one type of execution? Lashes for example are only of one type and the standard 40 lashes.
Comment: It shows how arbitrary your categories are.
Comment: have heard once that it is related to being pogem in one of the four letters of the shem Havaya but not clear.
Comment: There's only one kind of burning.
Comment: Why are there about a dozen kinds of Korban?
Comment: what does korban have to do with corporeal punishment?
Comment: Four is often related to exile. Maybe some source has mentioned this connection?
Comment: @ray ye its in krias shmah, it also says that somewhere in kabbalah (thats probably what its reffering to in krias shma), no clue where though... it may also be somehow connected to the four elements sriefah=fire skillah=earth chenek=air (denying someone air) and hereg=water (i dont know why it would be default though)
Answer: There are different types of execution to highlight the various severities of the sin for which the sinner is being executed for.
As the Rambam writes (הלכות סנהדרין פרק יד):
<code>סקילה חמורה מן השריפה, ושריפה חמורה מן הסיף, והסיף חמור מן החנק.
</code>
"Stoning  is more severe than burning, burning is more severe than beheading, beheading is more sever than strangulation."
Similarly there are various types of "heavenly killing", e.g. כרת, מיתה בידי שמים, ערירי depending on the severity of the crime.
There are also different types of Korbanot, depending on the sin.
Even in monetary restitution we find that sometimes you pay what you damaged/stole and sometimes you pay more (חצי נזק) and sometimes you pay more; double, 4 or 5 times, and sometimes you get fined.
Comment: so why on other corporal punishments (lashes) is it the same regardless? this was part of the question. thnx alot.
Comment: I guess all 3 categories of people who deserve lashes (as defined in the Rambam in  הלכות סנהדרין פרק יח)  are considered to be of similar severity.
Comment: 1. why do you bring rambam and not the original gemmorah? 2. While the punishment is ordered the Mitzvos aren't, therefore I think your answer completely misses the question of WHY. If you'd prove that the Mitavos are ordered from less severe to more severe that would work. Maybe we can learn postfactum, based on the punishment about a Mitzvah...
Comment: This is a good beginning as it points out the relationship between the consequence of the sin (the type of execution by level as discussed by Rambam) and the variation of corresponding korbanot for each of the 4 general categories of transgression. Both type of execution and type of korban are about repairing the damage done (like all forms of monetary restitution found in Seder Nezikin). But you need to bring out why this relates specifically to 4 categories. This is because the 4 categories correspond to the 4 letters of each of G-d's names (יהוה, אדני and אהיה). See Siddur HaRamchal.
Comment: Volume for days of the week and Rosh Chodesh, page 60. It is explaining part of the kavannot for Kriat Shema and one of the things to have in mind when you recite the "Dalet" of the word 'Echod' in the first sentence of Shema.
Answer:
I think we should start off with the very idea of punishment. As we all know, the Jewish approach is not to punish for the sake of punishment or even threaten the rest of the nation, but to give the sinner the atonement he deserves.
As we also know, a sin's harm is two-fold: it does a damage to the world as well as to the sinner. I learned that there are 3 levels of personal spiritual "damage" to reflect the severity of the transgression:

External (monetary): as person's possessions are his "outer self" (therefore the money is called דמים as blood), some "low-level" sins can be simply repaid.
Surface: lashes are given as a "skin-deep" punishment for a "higher-level" sins.
Internal: the capital punishment is given for the "high-level" sins.

The corporal punishment (as I remember from some Kabbalic books, a clear source needed) is further divided into four to reflect the type of damage according to the 4 constituent elements of the human body (traditionally): fire, air, water, and dust. So if the sin comes from a person's "spiritual fire" or "damages his fire part", the fix/atonement would be שריפה, if it was the air - that would be חנק, the others are סקילה for the dust and הרג for water (never realized why the last).

I admit, even if I understand the analogy I couldn't understand the division of the sins into those four, for example, "הבא על נערה המאורסה אינו חייב עד שתהא נערה  תולה מאורסה, והיא בבית אביה. באו עליה שניים - הראשון בסקילה, והשני בחנק:"
NB As Danny noticed the Gemorrah (Sanh 50) tries to figure out the hierarchy of those four types also.
Comment: "as person's possessions are his "outer self" (therefore the money is called דמים as blood)" how is blood considered outer self?
Comment: @robev Money is called דמים to emphasize that a person's possessions are a part of his (bigger/outer) soul, just as blood is a part of his body. Sort of. Hence such importance of the monetary laws. I didn't say blood is outer self, I said money is outer self/outer soul.
Comment: Yes but you said **therefore** money is the same word as blood

Why are there four types of execution?


Prestige Transfer after starting MW3

Question: I realise that I can get prestige tokens in MW3 for having previously prestiged in MW2/BlackOps, but after playing MW3 for a while can I now go back to the earlier games and prestige in them again to get more prestige tokens?
Comment: I see no reason why it shouldn't be possible. On the other hand, you can just spend the same amount of energy on MW3 and prestige there.
Comment: @Bora I'm at level 70 in both games but haven't gone prestige again because I wanted to hang on to the later weapons
Answer: You don't get prestige tokens for each prestige rank you have.  You get a prestige token from having gone prestige in a previous game (so 2nd prestige in MW2 buys you no more prestige tokens then 10th prestige).
However, if you haven't gone prestige in a previous game (Modern Warfare, MW2, World at War, or Black ops), you can go back and prestige to gain an additional token.
Hope this helps!

Prestige Transfer after starting MW3


An ideal black body emitter will emit all wavelengths of radiation, but this requires infinite energy. How is this possible?

Question: I read that at a particular temperature, all black bodies emitted all wavelengths of electromagnetic energy but at different intensifies. This would require infinite energy and therefore violates the law of conservation of energy. How is this possible?
Comment: The sum of an infinite number of terms is not necessarily infinite.
Comment: Yes but if there is an emission for all frequencies, and there are infinite frequencies on a spectrum, there is infinite emission, how does this work?
Comment: This is alike the runner and the snail :)
Answer: The basic misconception here seems to be a misunderstanding of the meaning of the luminosity function $B_\nu$ (or $B_\lambda$). It is not a power function that gives the power at a frequency (or wavelength), rather, it is a power density function that gives the power (really, power density) per unit of frequency (or wavelength). This can be seen by dimensionally analyzing it, which reveals $B_\nu$ to have units of power per unit area per unit of solid angle per unit of frequency, or simply power density per unit frequency. In particular $h$ has dimension $\mbox{(energy)} \cdot \mbox{(time)}$ and $\nu$ has dimension $\mbox{(time)}^{-1}$ while $c$ has dimension $\mbox{(length)} \cdot \mbox{(time)}^{-1}$ and so combining all these in $\frac{h\nu^3}{c^2}$ yields $\mbox{(energy)} \cdot \mbox{(length)}^{-2}$ which is equivalent to $\mbox{(power)} \cdot \mbox{(length)}^{-2} \cdot \mbox{(frequency)}^{-1}$ since $\mbox{(frequency)} = \mbox{(time)}^{-1}$ and power times time is energy.
So there is not a finite amount of power density at any exact, specific wavelength. To get power density you must integrate, just as to get mass from mass density you must integrate. If you integrate "over a point" you just get 0 - so in a sense there is 0 power at any exact wavelength, just as a single point taken out of a finite mass density would have 0 mass(*).
That is, your mistake is in interpreting/understanding the math correctly. If you instead consider it as being like mass density, then you note that there is mass density at all points in a body, yet there is not infinite mass present. The same mathematical principles that govern that also govern this.
(*) (yes atoms, yes caveat, yes handwave - the point here is this is a mathematical misconception.)
Answer: The intensities are dependent on the frequency indeed. Total luminosity however is finite for any finite temperature.
Classical infinities from the Statistical Mechanics lead to creation of the Planck's law.
Answer: Mathematically, whe can prove the finitness of the power emitted from the blackbody. We start recalling the spectral radiance of a black body, given by the Planck's law
$$B(\nu , T) = \frac{2h\nu^3}{c^2}\cdot\Big(e^{\frac{h\nu}{k_B T}}-1\Big)^{-1} $$
that is the power emitted by the black body, per unit area and unit solid angle, relative to a single emitted frequency $ \nu=\frac{c}{\lambda}$; $h$ is the Planck's constant, T the temperature and $k_B$ the Boltzmann constant
The total power emitted, then, is found by integrating over the solid angle $\Omega$, the black body surface $S$ , and all the frequencies from 0 to infinity. So
$$ P = \int_0^\infty d\nu\int_\Omega d\Omega\int_S dS \frac{2h\nu^3}{c^2}\cdot\Big(e^{\frac{h\nu}{k_B T}}-1\Big)^{-1}$$
This integral can be proved to converge and it is exactly the Stephan-Boltzmann law
$$ P = \sigma T^4 $$
Thisshould be enough to convince you that it's only necesary a finite amout of energy. You can also take the limits of $B(\nu, T)$ for $\nu \to \infty$ and for $\nu \to 0$, and see that both tend to $0$. This means that the higher (or lower) the freqencies are, the smaller spectral radiance is. This means that a blck body hardly emis high energy photons, or very low eenrgy photons. This is easily understandable, at least for high frequencies, because to emit very energetic photos you need high energy phenomena,for example nuclear $\gamma$ decay. Moreover, energetic photons may easily pass across the black body without being absorbed or scattered.


How to update "Assigned To" field on Knowledge Article Version with Apex?

Question: If I use standard button on Knowledge Article Version (KAV) called Assign (api name: AssignKnowledgeArticleVersion), it successfully updates the Assigned To (AssignedToId) field, however, I can't seem to find a way to update that same field without using that button.
I tried using Apex to directly update AssignedToId on KAV record, however, that field is not writeable:

Field is not writeable: Knowledge__kav.AssignedToId

At this point, I would probably give up, but the standard Assign button is able to change this field, and Salesforce seems to have exposed a method KbManagement.PublishingService.assignDraftTranslationTask(..) that can replicate the Assign button's behavior.
However, when I tried using the above method the AssignedToId still remains the same, even though I'm not getting any errors.
Now, the weirdest part is, when I retrieve the KAV record in workbench using REST API /services/data/v45.0/knowledgeManagement/articleVersions/translations/RECORD_ID, there's an assigneeId field in the response that holds the correct value, so something does get updated when I call KbManagement.PublishingService.assignDraftTranslationTask(..) method. The problem is that that's not reflected in the AssignedToId field, but probably somewhere else in the system.

Ultimately, what I need to do is to update the AssignedToId field on Draft articles via code, so that I can report on that field and use it in List View filters. Is there any way to do that?
Comment: Have you tried to set 'assigneeId' instead of `AssignedToId`?
Comment: I tried it now and got back an error `Variable does not exist: AssigneeId`. Also, if I try to query that field I get back `No such column 'assigneeId' on entity 'Knowledge__kav'`.
Answer: Here's what worked well for me:
KbManagement.PublishingService.assignDraftTranslationTask(
        articleId, assigneeId, instructions, null, false
    );

Draft localized article is assigned as expected.
On force.com platform 48.0.


arm-linux-gnu-gcc Vs arm-linux-gcc

Question: What is the difference between arm-linux-gnu-gcc  and arm-linux-gcc
Which should be used for cross compiling a C program for ARM ?
Comment: could explain a bit more what do you mean by arm-linux-gnu-gcc and arm-linux-gcc ? on what distro are you working ? where do you find those name ? stuff like that
Comment: Beware that there are different versions of ARM that are actually not compatible, or at least not forward compatible, and distro package arm cross-compilers usually target armv7; although this is not indicated in the compiler tuple ('arm-linux-gnu-gcc').  You should be able to tell with `arm-linux-gnu-gcc -v`, look for the `--with-arch=` label.
Answer: If you only want to compile programs that run on their own on a processor ("bare metal" system), then all that matters is to have a compiler that produces instructions for that particular processor. "For ARM" is almost enough information, but not quite: you would also need to specify the version of the instruction set. Most ARM processors today are based on the same version (ARMv7) but even inside that there are many complications — some features (e.g. floating point, vector instructions) are optional and you need to specify whether to use them, and ARMv7 has in fact two instruction sets ("normal" ARM, and Thumb). Most distributions of GCC for ARM target ARMv7 with optional features and Thumb enabled by options.
If you want to compile programs that interact with other programs, then all the programs involved need to be able to communicate. Making system calls and, even more so, making library calls requires that the caller and the callee agree on the binary representation of data (e.g. endianness) and on how to pass data around (which registers to use for function arguments, how function calls affect the stack, etc.). The specification of how this works is called an ABI (application binary interface).
The general naming convention for GCC cross-compilers is CPU-VENDOR-SYSTEM-gcc (where the part before -gcc matches the system type of configure), but there is some fuzz about the VENDOR-SYSTEM part. Cross-compilers for ARM are usually called arm-VENDOR-OS-LIBC-ABI-gcc with some of the parts omitted. For example, arm-acme-linux-gnu-gnueabi-gcc would be GCC for ARM (v7 by default), for ACME's distribution of Linux, set to link against Glibc, using the gnueabi ABI. arm-linux-gnu-gcc indicates a compiler set to link against Glibc on Linux, with an unspecified ABI. arm-linux-gcc doesn't specify which libc is targeted.

arm-linux-gnu-gcc Vs arm-linux-gcc


Update column choices in sharepoint based on another list

Question: I was trying to update the choices available to be selected in a sharepoint list based on a value in a different list. For instance, I have the values 1,2,3,4 in list 1. If I add a row to list 1, there are now 1,2,3,4,5 in a certain column. I want to update the choices to be updated in the first list.
Comment: So you are talking about _lookup columns_. What exactly is your question?
Answer: I agree with moe, that sounds alot like you are talking about lookup columns, https://support.office.com/en-us/article/create-list-relationships-by-using-unique-and-lookup-columns-80a3e0a6-8016-41fb-ad09-8bf16d490632
Answer: I agree with moe and Kasper, you can create lookup column to achieve your requirement.
Eg: you have column1 in list1, column1 contain values (1,2,3,4,5).
You can create lookup column in list2 which get information from list1 and in column1 column:


What is the intuition behind $\mathbb{P} (A \text{ and }B) = \mathbb{P}(A) · \mathbb{P}(B)$ if they are independent events?

Question: I am unable to understand this formula intuitively.
Comment: Not really the point of your question, but what do you mean by "different ways to arrive at"? This is the *definition* of  independent events.  (Now, asking for an intuition behind this definition still makes total sense.)
Comment: @SilentMonk My point is, what is the *definition* of independence of events you are starting with? Because the identity you mention in your title is the standard definition of independence (so there is no need to derive it or arrive to it).
Comment: The selected answer is excellent, but I'll add a simple point: independence means the proportion $p$ of outcomes in event $A$ which are also in event $B$ is equal to $P(B)$ and vice versa ($p=P(B)$). I like to think of it in terms of sampling a population. Continuing with the blue-eyed/left-handed example: if you ask about the probability a random person is left-handed then it doesn't matter whether you are sampling from the entire population or from the population of blue-eyed people.
Comment: As jdods said, in other words, conditional probability is the key: http://math.stackexchange.com/a/1208283/162300
Comment: @ClementC. There was one explanation which used coordinate geometry to arrive at this particular equation.
Comment: @ClementC. Oh. In the explanation I read, used geometric probability to arrive at this equation starting from the basic equation of probability - P = n(event)/n(possible outcomes)
Answer: About $8\%$ of the world's population have blue eyes. Assuming there are $7.5$ billion people on this planet, that's six hundred million people with blue eyes.
About one in ten is left-handed. That makes $750$ million left-handed people.
So, let's pick one random person and look at the events
$$
L=\text{the person is left-handed}\\
B=\text{the person has blue eyes}
$$
We have $P(B)=0.08$ and $P(L)=0.1$.
Here is the core of why your formula is true:

Assuming that eye color and hand preference are independent, you would expect that just as a tenth of the whole population is left-handed, a tenth of all blue eyed people are left-handed.

Applying that idea to the usual formula $\frac{\text{good cases}}{\text{possible cases}}$ we get that the probability that a random person is both blue-eyed and left-handed is
$$
P(B\cap L)=\frac{\text{number of blue-eyed left-handers}}{\text{number of people in the world}}\\
=\frac{0.1\cdot\text{number of blue-eyed people}}{\text{number of people in the world}}\\
=\frac{0.1\cdot(0.08\cdot \text{number of people in the world})}{\text{number of people in the world}}\\
=0.1\cdot 0.08=P(L)\cdot P(B)
$$
As for why independency is needed, here is what happens in the two extreme ends of the dependence scale:

First case: No blue-eyed person is left-handed. Then by definition of $\cap$, we have $B \cap L = \varnothing$, so $P(B\cap L) = 0$. This is a lot smaller than $P(B)\cdot P(L)$.
In the opposite end: Every blue-eyed person is left-handed (while some left-handed people are not blue-eyed). Then $B \cap L = B$ (again, by definition of $\cap$) and $P(B \cap L) = 0.08$, which is a lot larger than $P(B)\cdot P(L)$.
Comment: Mmh, I just told you: "Blue-e**u**ed". In "First case: No blue-eued person..." . I should have include the hyphen in my comment! Sorry.
Comment: You might want to incorporate a counter-example where blue eyes are perfectly correlated with left-handedness, so that the $P(B \bigcap L) \neq P(L) \cdot P(B)$.
Comment: @svavil Good idea. Done.
Comment: Can't fix typo "Blue eued" (6 chars minimum for an edit). Perhaps the OP can?
Comment: @NicholasMiari I didn't even notice the typo in your comment. Anyways, it's fixed, thanks for letting me know. And I really don't know whether blue-eyed should have a hyphen or not.
Answer: It might be helpful to consider the definition of independent events as $$p(A|B)=p(A)$$
Whereupon the formula $$p(A|B)=\frac{p(A \cap B)}{p(B)},$$ which is more intuitively obvious, will then lead to the result you quote $p(A \cap B)=p(A)\cdot p(B)$
Answer: Imagine rolling a die and flipping a coin. These are independent events - neither affects the other. You can show all the possible outcomes in a unit square in which the area of each region shows its probability. Then the product rule for independent events makes sense. The darker shaded region has area
$$
\frac{1}{2} \times \frac{1}{6} = \frac{1}{12}
$$
for the probability that you toss a head and roll a four.

(This is NOT a proof - it's a device that may aid your intuition.)
Answer: You can find a thorough description on https://economictheoryblog.com/2012/12/26/stochastic-independence-versus-stochastic-dependence. The article describes the intuition behind P(A and B) = P(A) · P(B) and explains the difference between stochastic dependence and stochastic independence.
An example taken from the webpage states, in order for two events to be independent the occurrence of the event A cannot have any influence on the occurrence of the event B and vice versa. As an example let's assume event A is defined as earning more than 10.000 per month and event B is defined as getting six when throwing a die. Both events are not, or at least not as far as I know, interfering. The probability of having six when throwing a die is not changing if it is a person who earns more than 10.000 per month, nor is the probability for a person earn more than 10.000 per month changing if this person has a six when throwing a die.
Answer: If, for example, $P(A) = 1/4$, then event $A$ accounts for a quarter of all possible outcomes (weighted by probability).
If we restrict attention just to those outcomes corresponding to event $B$, then if $A$ and $B$ are independent we would expect $A$ to still account for a quarter of the outcomes: that is,
$$ P(\text{both $A$ and $B$}) = \frac{1}{4} P(B) $$
the same argument should apply no matter what $P(A)$ is; i.e.
$$ P(\text{both $A$ and $B$}) = P(A) P(B) $$
Answer: Independence means that $A$ has nothing to do with $B$, which means that if someone tells you that $B$ happened, you have no way of concluding anything at all about $A$. That means
$$P(A \text{ and } B)/P(B) = P(A).$$
which rearranges to the desired equality. (The left hand side measures the probability that $A$ holds in a world where $B$ is known to hold.)
Answer: Briefly: Clearly a logical "and" operation is harder to have happen than either of the events on their own. For probabilities between 0 and 1, what basic arithmetic operation produces a lower result than either of the operands, without possibly going below 0? Only multiplication.
Comment: But $P(A\land B)\leq\min(P(A),P(B))$ *always* — but sometimes it $=\min(P(A),P(B))$, sometimes it is $0$, and it can be various values in between.  But the rule $P(A\land B)=P(A)\cdot P(B)$ applies only in the case where $A$ and $B$ are independent.
Comment: @Scott: Notice for purposes of intuition I was careful to state "probabilities between 0 and 1" (i.e., strictly between those values). And independence is assumed as part of the OP's question.
Answer: The Theory of Probability is an axiomatic structure. As you can see in Definition 1 in section 5 in Kolmogorov's Theory of Probability, this formula defines what we mean by independent events. That is, it is not a theorem and it is not based on anything empirical. It just is. A definition is not something one arrives at. It is something one takes as given.
Saying "N events are independent" and "the probability of all of them happening is the multiplication of the probabilities of each" mean the same thing.
Answer: All of these other answers are very thorough and well thought out but I'd like to add a simple example to help your understanding. If you flip two coins, the probability of the first coin coming up heads is $1/2$. The probability of the second coin coming up heads is the same. If you want to know the probability of both coming up heads, you could draw a tree. The first coin has two possible outcomes (heads or tails) and each of these has two possible outcomes. This creates four possible states (HH, HT, TT, TH).  Returning to the decision tree, by multiplying the probability of both independent events together, you're finding the specific branch of the tree that matches the outcome you're looking for.


How to make yourself stop grinding your teeth during the day (without a guard)?

Question: If you've had a lifelong habit of grinding/clenching your teeth, how do you make yourself stop it during the day? For the night I know you can get teeth guards, but for the day you don't want to wear them all the time, so what do you do?
Comment: I'm afraid this question questions requires a mind hack, so it is off-topic here.
Answer: Have you looked into the reason why you do it?
For me I have it during the night when I am over worked or stressed.
Other than that I would:

Not lean on your jaw (elbow on something, jaw in hand)
Avoid or cut back on foods and drinks that contain caffeine, such as colas, chocolate, and coffee.
Avoid alcohol. Grinding tends to intensify after alcohol consumption.
Do not chew on pencils or pens or anything that is not food. Avoid chewing gum as it allows your jaw muscles to get more used to clenching and makes you more likely to grind your teeth.
-Train yourself not to clench or grind your teeth. If you notice that you clench or grind during the day, position the tip of your tongue between your teeth. This practice trains your jaw muscles to relax.
Relax your jaw muscles at night by holding a warm washcloth against your cheek in front of your earlobe.

NOTE
These are mostly treatments for night time teeth grinding and so on. This might help for the daytime part.
Teeth grinding/clenching is unusually common in high stress professions.
Clenching seems to be a natural human response to stress, but in those who are unusually susceptible to stress or who have highly stressful careers, this natural response can go very bad. Like grinding, clenching can lead to enamel degradation, tension headaches, jaw pain, and even tooth breaking or cracking.
There are however, other options to protect your teeth from daytime clenching. Some dental clinics and online retailers offer extra thin acrylic mouth guards that not only allow speech but are so thin and discrete as to be nearly unnoticeable when worn. Without any speech impediment or visual evidence, these ultra fine mouth guards can help protect your enamel and cushion your jaw from the intense force.
Comment: You know how sometimes people just have to keep some part of their body moving to some kind of beat just out of habit or boredom? Well in this case it's sometimes toes or feet, sometimes hands and thumb, sometimes making sounds with teeth. Or at least that's the only explanation I can think of. :) +1 thanks for the answer.
Comment: @Mehrdad Well I did read an article about how if you are awake it is easier to treat (seeing as you asked about teeth), because you are awake and more aware. But hearing from your comment it sounds like you can't sit still. Happy to help
Answer: Stick your tongue out a few millimeters between your front teeth (but with your lips still closed so it doesn't look funny). Then if you bite down you'll get immediate and unpleasant feedback to stop!
Comment: @Mehrdad good point! I was hoping that the OP's tongue could "relax" in that slightly-extended position, so it wouldn't take any concentration.
Comment: +1, although the shortcoming is that if you're actually remembering to do this then you can probably just avoid biting down consciously!


Clearing out Thunderbird on Ubuntu

Question: I installed thunderbird on Ubuntu and started downloading emails via POP just to have a backup on my local machine.  I downloaded about half of all the emails and then it said no more new emails and nothing else would come through.
I un-installed and installed Thunderbird again which of course did nothing.
Then I went into the .thunderbird/abcdefg.default/Mail and deleted pop.gmail.com.  Not sure it was a very wise thing to do but it didn't help.  I don't see any emails in my Inbox anymore but when I try to "get mail" it says "no new email".  How can I just start anew and re-download the complete email store from gmail?  I'm trying to have a complete backup of my emails that is easily accessible.  Anything else I can use besides Thunderbird?
Any help would be appreciated.
Answer: The first thing I would do, if I had web access to the pop mail server, is to check and see if there are any emails still on it.
It sounds like you have Thunderbird set up to delete emails after downloading them. You can check that by Clicking on Tools, then Account Settings, then on the email account you need, then on Server Settings. Now, look at the 2nd section down, and see if there is a check mark in the box that says Leave messages on server. If not, they were probably deleted after downloading.
If you did this on a Linux system, you are probably out of luck. If you did it on a windows system, you may be able to retrieve them after a complete System Restore.
Good luck!

Clearing out Thunderbird on Ubuntu


How can I recover a lost iDisk file?

Question: I recently had a file that was on my office computer (iMac) which was not syncing with my MacBook Air for some reason. I read that I should try to turn off iDisk and then re-activate. When I did this I lost the file that was on the iMac and can no longer find it.  This was a simple txt file with some important information in it.
Does anyone know if the file has been sent to a certain trash or similar? I would really like to recover this file if possible.
Answer: In answer to this I was recently looking through my desktop to clean some things up and noticed a directory labeled Previous local iDisks and within this directory contained the iDisk that had been removed.  Note I am on osx 10.6.8.
Hopefully this helps someone else out in a similar predicament in the future.

How can I recover a lost iDisk file?


If a slit is illuminated by light will the electron still preserve its interference pattern?

Question: Electrons in the double slit experiment show interference accordingly to their wave-particle duality but does illumination of those electrons by light change just their trajectory or also changes their behaveiour as wave-particles forcing them to lose their wave function?
Comment: This image is misleading. It implies that Slit A would make an interference pattern alone, which is not the case, you need both slits open for interference between Slit A and B.
Comment: @CharlesTucker3 But the slit B is also open, appart the fact that it is illuminated by photons(you answered that the photon could illuminate just one slit...)
Answer: The interference pattern will dissapear if the electron interacts with the photons (the illumination of the slit), because then there is a localized event happening and the trajectory of the electron, meaning which slit was taken, is clear.
If you send out only a few photons, the probability for interaction is small. No interaction in between means interference pattern. So it 's a question if something happens, and the probability for that will be proportional on the number of photons.
Comment: No, this is not what I meant... Every electron that you detect (by interaction with the light covering the slit) will not contribute to the interference pattern. Your assumption is that you will detect every electron coming through the illuminated slit. If this is so (requires a lot of photons), then you don't get an interference pattern at all.
Comment: Is it possible to illuminate just one slit, let say, by a narrow laser beam?
Comment: Of course, and every electron you detect will not contribute to the interference pattern.
Comment: So everytime the electron land on a place that is a part of the interference domain on the screen it has to arrive from the 'not illuminated' slit... but then we know the 'WPI'....
Comment: Do you have any experimental proof for your statements? Also your answer is rather vague.
Comment: In this answer it is not specified what kind of photons should be used, why localisation happens, what light intensity this would require, whether any experiment  was ever done to confirm what appear to be theoretical conjectures. This is why I would say that the answer is rather vague.
Answer: To find out where the electron goes, you have to accept first that the answer will be a probability distribution not a single point.
To find the probability for the electron to arrive at a point $P$ on the screen, you have to add two numbers, and then take the modulus square. These are complex numbers. Let's call them $a$ and $b$. Let $x$ be the location of the point on the screen where the electron is finally observed to arrive. Then the complex numbers (called quantum amplitudes) will depend on $x$, and the probability is
$$
\mbox{Probability(electron arrives at $x$)} = | a(x) + b(x) |^2
$$
First let's suppose there is no light illuminating the slits. In this case the formula for $a(x)$ and $b(x)$ is fairly simple: you just take the distance from the relevant slit to the point at $x$ and divide by the de-Broglie wavelength of the electrons, and this tells you the phase (after multiplying by $2\pi$). It is just like a wave propagating, which is why $\psi(x) = a(x) + b(x)$ is often called a wavefunction. Anyway you find
$$
a(x) = A e^{-i\phi(x)/2}, \;\;\;\;\; b(x) = B e^{i\phi(x)/2}
$$
where $A$ and $B$ depend very little on $x$, but the phase $\phi(x)$ is quite sensitive:
$$
\phi(x) = \frac{2 \pi x d }{\lambda L}
$$
where $d$ is the separation of the slits and $L$ the distance from the slits to the screen, and we assumed $L \gg x,d$ so that the combination $x/L$ is the angle subtended at the slits by the various places $x$ on the screen.
Now the interference pattern that is observed (when no light illuminates the slits) is very much to do with the phase $\phi(x)$. Because when $A$ and $B$ are equal (which is a good approximation in practice) we have
$$
\mbox{Probability} = |A|^2 |e^{-i\phi(x)/2} + e^{i\phi(x)/2}|^2
= 4|A|^2 \cos^2(\phi(x)/2).
$$
That $\cos^2$ function is the interference pattern.
Ok so now at last we come to what happens when light illuminates the slits. Let's take the case where light illuminates just slit $B$. The effect of this is to introduce a change to $b(x)$. The interaction between the light at the electron gives a momentum change to the electron, so that it now propagates away from slit B in a new direction (another way to analyze invokes the idea of entanglement, but I won't adopt that approach). The direction taken by the electron after interacting with the photon is such as to conserve momentum, so it depends on the change in momentum of the photon. But in order to hit one slit and not the other, the light beam has to have a narrow focus and therefore the direction of travel of the photon is spread over a range (an example of Heisenberg uncertainty principle, here applied to the photons arriving at the slit). Consequently the direction of travel of the electron after interacting with the photon is also spread over a range. This range of angles is about
$$
\Delta \theta \simeq \frac{p_{\rm photon}}{p_{\rm electron}}
$$
where here $p$ refers to momentum, and we assume $p_{\rm photon} < p_{\rm electron}$. This is the formula because the electron gets a momentum kick of about $p_{\rm photon}$ so its direction of travel is turned to the side by about $\Delta \theta$. Now recall that $x/L$ is the angle (i.e. the angle away from the normal to the plane of the slits) of location $x$ on the screen. The contribution to the wavefunction from slit B is now steered off by $\Delta \theta$, which means it is steered off by
$$
\Delta x = L \Delta \theta
$$
So now we have for the probability for electron to arrive at $x$:
$$
{\rm Probability} = 4 |A|^2 | e^{-i\phi(x)/2} + e^{i\phi(x + \Delta x)/2}|^2
$$
where we have to keep in mind that $\Delta x$ here is saying the amount by which $x$ may varying between one electron and the next as the interference pattern is built up. The maths may look complicated but the central idea is that the momentum-kick caused by the light shifts the interference pattern by a random shift that varies from one electron to the next. But when you add a bunch of randomly shifted interference patterns, the pattern washes out, because the bright regions of one pattern fill the dark regions of another.
Let's see how big this shift needs to be in order to wash out the pattern. It will require
$$
\Delta x > \lambda L/d
$$
(because that is the separation between the fringes). So it will require
$$
\Delta \theta > \lambda / d
$$
and therefore
$$
p_{\rm photon} > p_{\rm electron} \lambda / d.
$$
Now the de Broglie wavelength is related to the momentum by $\lambda = h / p$ where $h$ is Planck's constant, so we have
$$
p_{\rm photon} > \frac{h}{d}
$$
or in other words
$$
p_{\rm photon} d > h.
$$
The reason why I presented the mathematical details was really so as to make it clear that the statement in bold font above, about momentum kick, really does contain the physics here. There is no need to say "sometimes its a wave, sometimes its a particle" or anything like that. It is simply a case of one thing interacting with another, conservation of momentum, and the fact that the momentum kick involves a random direction taken either by the incoming or outgoing photon or both.
As I hinted above, the same result can also be calculated by keeping the quantum state of the photon in the calculation, and then you will get an entangled state and the issue becomes whether the possible final states of the photon are mutually orthogonal. If they are then the photon contains 'which path' information and the electron interference vanishes. This provides some nice further insight but the above calculation in terms of momentum kick is entirely equivalent.
Comment: +1 Nicely explained, Sir... specially the interaction b/w electron and photon
Comment: OK, as I understood the light does not collapse the wave function but only shifts the electron...Before posting for a bounty I asked if just one slit could be illuminated...so if yes, could a shift on the screen reveale the electron was kicked by light and eventually passed through slit B?
Comment: @JankoBradvica If the light is sufficiently well focused to be able to shine on one slit and not the other, or if the detection of the photon has high enough resolution to tell which slit the photon came from, then the momentum of the light will be spread over a range. This means the shift of the interference pattern will be sufficiently random to make the interference wash out, and then, yes, one can infer from the measured photon that the electron went to slit B.


Is the singularity of a black hole homogenous?

Question: When matter is dropped into a black hole, does the content of the matter impact the structure of the singularity? That is to say, other than the change in mass, do any of the singularity's properties change?
Comment: @ruakh feel free to edit the question if you see fit
Answer: A black hole singularity, in the description offered by general relativity, doesn't have any structure. It's a hole that's missing from spacetime, not some stuff that exists, spread over some region of spacetime. We can't say whether it has a particular size, or even how many dimensions it has, because the mathematical machinery of measurement breaks down. So since it doesn't really have any structure, it doesn't make sense to talk about whether that structure changes due to accretion of infalling matter. Even the mass of a black hole is not really a property of the singularity; it can be expressed mathematically as a property of the surrounding space.
Comment: Mass: And charge and angular momentum?
Comment: Would the holographic principal be a useful reference point for your last statement?
Answer: Your titular question and the first question in the body don't make sense according to the model; a singularity doesn't have a structure and so can't have a homogeneousness. To answer your final question:

That is to say, other than the change in mass, do any of the singularity's properties change?

Yes. You already know that dumping a few planets into the black hole will increase its mass. There are two other properties that you can change by throwing stuff into a black hole:

Making lots of spinning stuff spiral into the black hole will increase its angular momentum. Spinning black holes can have very strange properties.
Firing a stream of protons or electrons (or other charged particles) into the black hole will charge it. Charged black holes can also have strange properties, though we're not quite sure whether it's possible for a black hole to be charged enough for some of them to occur.

If a black hole is spinning and is charged, you need the Kerr–Newman Metric to model it. This is a generalisation of lots of other metrics; if you set the charge and spin to 0 you get the same results as the Schwarzschild metric.
Answer: A singularity is not a point property but a macroscopic property of a connected region.
For example, when integrating analytic functions along a circular path, the "basic" result is zero but the actual result depends on which singularities are enclosed in which direction.  The integration becomes undefined when actually crossing singularities but their dependable behavior comes about when you don't.
In a similar vein, there are no "point charges" or "continuous currents" but the respective surface and line integrals capturing electric and magnetic fields deliver results consistent with them.
In a similar vein, a black hole's environment is consistent with it having a certain mass, and that changes summarily as mass continues to go there.  In terms of being mostly indirectly observable through integral properties of the singularity's environment, it shares some annoying philosophical traits of quantum particles.
Comment: +1 for interpreting "singularity" as "near the singularity". Black hole perturbation theory is one tool which help answer the original question. Compare also BKL singularity in cosmology


How to create simple CRUD module in Magento 1?

Question: I'm new to Magento 1. I want to create 1 simple CRUD Operation module.
Answer: I can recommend you to give this a try: https://github.com/tzyganu/UMC1.9
even if it's discontinued and hasn't been updated in 6+ years, Magento 1 wasn't updated either so there is a high chance it will still work.
You can install the module in your magento 1 instance and follow the documentation to create your CRUD module.
It is more or less similar to creating a db table using PHPMyAdmin.


Optimal greedy algorithm solution for cell tower placement

Question: Supose we have $n$ customers with interval that represent their range. For example, $[1,8], [2,5], [4,6], [1,9]$ for each customer. For a customer to have range coverage, a tower must be present within their range. For example, for customer $[1,8]$ to have coverage, a tower must be within range $[1,8]$. I need to make a greedy algorithm that will generate a list of tower locations that will cover all customers with the least number of towers. For the example above, the optimal solution will be location 4 or location 5 because only one tower at either location 4 or 5 will cover all customers. The algorithm should have a worst-case runtime of $O(n\log n)$.
I have tried the following method and failed. First, calcuate the length of each interval and make a tuple of (starting point, length) and add it to a array in assending order in respect to length. So, for the example above the list will look like $[(4,2), (2,3), (1,7), (1,8)]$. This will take $O(n)$ time to process. Second, I picked the customer with the smallest interval and tried to place a tower in the customer's interval. However, a problem rises, because greedy algorithms do not calcuate multiple options and then choose the optimal choice I have trouble of where to place the tower in the customer's interval. I have thought of three choices: at the very left, at the very right, at the middle. The middle, is statistically the most optimal one but not always correct because if the customer's interval is at the boundary and every other customer's interval starts at the very right point of the current customer's interval, the very right point is the right choice for this situation.
Any help for finding the optimal solution will be very helpful.
Answer: Lexicography sort the list; i.e. Priority is based on the first and then second elements. For example $S_1=(1,8), (1,9), (2,5), S_4=(4,6)$.
Then, produce $\cap_{k=1}^iS_k$ where $\cap_{k=1}^{i+1}S_k=\emptyset$. Select from $\cap_{k=1}^iS_k$, delete $S_1,...,S_i$ and continue with the rest of the list.


How to share a file over "Windows Share" protocol from scientific linux?

Question: I have a file on my linux. I want to share it via "Windows Share" (IPMI can understand only one way of remote large files mounting). How to share my file over "Windows Share" from my scientific linux?
Answer: I don't know much about "Windows Share", do you mean the SMB protocol? I access files hosted on CentOS from Windows 7/8 machines with samba.  No client side installation needed.
https://www.samba.org/samba/docs/using_samba/ch03.html


Are valve guides normally reusable?

Question: A valve assembly diagram from my Tacoma FSM designates valve guides as non-reusable.

I was wondering if that is just a CYA or really the case.
Comment: How expensive are they? I would replace them considering how deep they are buried inside the engine.
Comment: the guides themselves are not that pricey but i think they need to be machined in...
Answer: They are non-reusable in the sense that if you take them out, you have to replace them. Valve guides are reusable until they are worn out; you don't replace them unless they are worn beyond usefulness. When they wear out, you can usually do one of three things: knurl; valve guide sleeve; new valve guide. You check the valve guide by the amount of side play there is in the valve when off-seat. The maximum amount allowed is going to be different for every engine. To understand the differences between the different fixes:

Knurl - Think of the handle of a ratchet where there is a cross hatch printed into it. This is the same thing for knurling a valve guide, only it's done on the inside where the valve stem rides. They do this to the inside and it squishes the portion of the valve guide out and replaces the space where material has been worn away. This is the cheapest and easiest fix, but unfortunately also lasts the least amount of time.
Valve Guide Insert - The original valve guide is left in place. The inside is reamed out just slightly and a new piece of valve guide material is driven into place. The new piece is then reamed out to size, which not only sets the size, but fixes it into place. This is a fairly cost effective way to fix the issue, with a minimal amount of effort to accomplish. This fix will last a long time (almost as good as a new valve guide).
New Valve Guide - The original valve guide is forced out of the head and a new replacement is put in its place. This is the best fix, but is more costly than the other two fixes. Since it is a new valve guide, it will last as long as ... well ... a new valve guide.

With all three fixes, you need to have a valve job done to ensure all of the valves and seats will seal correctly.
Comment: i didn't take them out
Comment: @amphibient - And you normally wouldn't. They are affixed and have to be driven out.
Comment: so then i don't have anything to worry about.  i just took the valves out to clean them and the ports
Comment: @amphibient - Usually not. If you pull the valve out so they are off seat, then try to wiggle them, what do you feel? If there is an appreciable amount of wiggle, they may need replaced. You'd need a machinist to tell you if they are out of spec. if they seem tight, don't worry about them, I'm sure they're fine. As long as you keep up with maintenance on your vehicle, they'll usually last a long time.
Comment: none of them wiggle.  some of them would not go in smoothly but then i would oil them again and they went in fine
Answer: Normally they are not reusable, what we do here is to either remove them by pulling or machining (drilling to rip them out) then insert new ones, factory made or made by a guy in a lathe using cast iron. But that's only if they are bad, otherwise I wouldn't touch them.

Are valve guides normally reusable?


Is toothpaste an issue on Shabbat?

Question: I heard that squeezing the toothpaste tube might be considered wringing. Does this have any basis?
Comment: No melacha is being done.
Comment: http://www.kosherimage.com/toothcare2.html
Comment: Yea,not anything about tube
Comment: I think it may be d'rabanon and come from memacheik (smoothing)
Answer: Some say yes, some say no.
The issue is not only wringing, but also whether the paste turning into froth is considered nolad, something new that came to be on Shabbat. For a comprehensive overview of the issues involved and which poskim have ruled what, see Yabia Omer Vol. IV O"H #30, where Rav Ovadia rules that it is permissible to brush your teeth using regular toothpaste on Shabbat.
For a summary of that responsum, here is the Yalkut Yosef 326:14:

Some Poskim ruled that even someone who brushes teeth with toothpaste every day may not do so on Shabbat for various reasons. One reason given for this is that when one brushes, the toothpaste becomes frothy with suds, and therefore this is an act of molid. Another reason given is that vigorous brushing might cause the gums to bleed.
Other Poskim ruled that it is permitted as long as one places the toothpaste directly into one's teeth and not on the toothbrush. Yet other Poskim ruled that even more leniently, permitting one to brush one's teeth on Shabbat just as one does on the weekdays and with regular toothpaste. They explained that it is not necessary to use special, liquid toothpaste, since brushing teeth is not an act of the melakha of memare'ah, nor is it an act of molid. Furthermore, this is not forbidden as an example of using medical treatments on Shabbat.
In practice, anyone who would feel uncomfortable if he does not brush his teeth on Shabbat because of bad breath or some other reason may brush them. This applies, however, only to someone who regularly brushes his teeth so that he will not necessarily cause his gums to bleed on Shabbat.
Comment: any clue what Hacham Ovadia says regarding using bar soap on Shabbat?
Comment: http://halachipedia.com/index.php?title=Cosmetics#Soap
Comment: @Ramin: Yes, he follows a responsum from the Rambam to argue that when it's necessary, like in a hospital, it can certainly be used. It's best to avoid it, but "there is no basis to protest against those who use it in all cases." See Yalkut Yosef 326:13

Is toothpaste an issue on Shabbat?


Clutch pedal on 1995 VW Golf is sticking

Question: The clutch pedal on my 1995 VW Golf 'sticks' in the half-way-depressed position after I release my foot from the pedal.  I believe that the clutch is fully engaged (unclutched) at this point, but a little nudge from underneath is necessary for the pedal to spring to its fully undepressed position.  How should this be fixed?  Maybe just a little WD-40?
Answer: Is the clutch cable operated or hydraulic?  On hydraulic clutches that's a common symptom of a failing master and/or slave cylinder(s).
Comment: IIRC, this car has a hydraulic clutch. this was my thought as well.
Answer: I had this happened on an 1995 Passat and it was the slave cylinder which got replaced and problem fixed.


How are user defined properties extracted from an ERWIN data model, and stored in the Ab Initio EME?

Question: I believe this can be done using the erwin 2 eme connector graph. What are the steps involved in setting this up? How are user defined properties stored in the EME?
Answer: You're right that the connector graph is the way to go. It's not hard to set up but it's not easy either. As you've seen, Stack Overflow isn't a very good place to get info about Ab Initio. You'd be better off posing your question to firstname.lastname@example.com or on the dedicated Ab Initio Forum accessible through the GDE. The Forum is monitored by numerous Ab Initio users and employees, and you're pretty much guaranteed to get a prompt response.


Why are there duplicate characters in Unicode?

Question: I can see some duplicate characters in Unicode. For example, the character 'C' can be represented by the code points U+0043 and U+0421. Why is this so?
Answer: As others have noted, your main fallacy here is confusing the Latin and Cyrillic scripts and some glyphs therein (namely C (U+0043 LATIN CAPITAL LETTER C) and С (U+0421 CYRILLIC CAPITAL LETTER ES) ). There are many such character pairs that look alike but are different characters. You will find plenty among Latin, Greek and Cyrillic, for example. Most of the time they only work in either uppercase or lowercase, though.
However, there are in fact duplicates, sometimes intentionally so. For example, the entire (ASCII) Latin alphabet is represented twice again in the 'Halfwidth and Fullwidth Forms' Unicode block between U+FF00 and U+FFEF. There are other such examples, though, most notably in the mathematical alphabet section on Plane 1 where there are three or four more Latin alphabets present.
There are other things that are in fact the same character but at different code points. For example, there is µ (U+00B5 MICRO SIGN) and μ (U+03BC GREEK SMALL LETTER MU). Those are usually linked by decomposition.
Unicode deals with an abstract concept called code point. The code point unambiguously defines a character and its script or group. It says nothing about how the corresponding glyph in a font would be rendered (which may vary wildly for Latin already). It also does not define how this code point is represented in a file or memory (i.e. as a byte sequence). That's a job for one of the Unicode Transformation Formats.

What is reason to have a similar looking character in two languages with different code points?

The main points of Unicode here are:

Compatibility to every previously existing character encoding. This has to ensure that there are one-to-one mappings for every character that was used in an encoding to a direct equivalent as a Unicode code point.
Faithfully and accurately represent every script that is used nowadays, later expanded to other scripts that were in use and need to be stored in computer systems.

So there is a very strong incentive to keep scripts separate and not try to map characters according to their appearance. Appearance can be tricky anyway. Take for example the Cyrillic letter 'т', which appears like a smaller upper-case Latin 'T' here. However, the usual way it is rendered when italicized: 'т' looks like a lower-case Latin 'm'. You really don't want to map such characters by appearance.
Comment: Not clear about the first reason you gave for the duplication of characters in Unicode. Can you please explain that in more detail?
Answer: If you look at the U+0400 to U+04FF code chart you'll find that U+0421 is a Cyrillic capital leter "es". It may look like a Latin C, but it's a different logical character.
Comment: @Sirish: they're similar-looking character in two different *scripts*, that's what Unicode deals with.  Not languages, scripts.  In fact, the C-shaped appearance of the Cyrillic ES is to be traced back to a specific form of capital Greek sigma in Byzantine times.  The similarity with Latin C is only incidental.
Comment: What is reason to have a similar looking character in two languages with different code points( I want to know about this as I have to develop a conversion utility between different encodings among which one is own companies own  proprietary encoding format)
Comment: @Sirish: They're different characters from different cultures, and they may well follow different rules. For example, the Cyrillic "EN" looks like a Latin "H" in capital form - but not in small form. They should be treated differently - the glyphs used to display them are incidental, really.
Answer: The letters LOOK the same, but are very different. U+0043 is the latin letter C, but U+0421 is cyrillic С (which corresponds to an S in the latin alphabet).
Because of their unrelated meanings, separate code points are required to prevent casing and sorting algorithms from being horribly context-sensitive - you would suddenly have to guess what language you were dealing with.
Answer: For the same reason that 0 and O look the same (in most mono-spaced fonts), but are encoded differently - they mean different things.
Comment: I had a typewriter without `1` and `0` :)
Comment: For a historical note (or perhaps not so historical outside the computer world) about the appearence of zero, see *[slashed zero](http://en.wikipedia.org/wiki/Slashed_zero)*.
Answer: U+0043 is the Latin representation of C, while U+0421 is the Cyrillic, meaning they are not actually the same letter, even though the might look the same.


Gmail filters for "-in" not working as expected

Question: I'm trying to filter my Gmail inbox for all messages that are not a part of a starred conversation.  If I search just for <code>-in:starred</code> and start combing through the first few pages of results, everything looks okay.  When I try to combine it with a date filter, I immediately see messages that should not be appearing.  Any ideas why this combination of search filters would be returning invalid results?
Comment: Switch off conversation view and see if you get what you expect.
Comment: Take out the word `AND`. Gmail is searching for it. It is not a boolean operator in Gmail searches.
Comment: Thanks for the tip! Unfortunately, the results I'm seeing are identical with and without the (needless) ```AND```.
Answer: Many times when search is finding conversations that you aren't expecting, the issue is conversation view.
If one message in a conversation meets the criteria, then gmail is going to show you the conversation, even though externally it doesn't seem to match the criteria.
For example: if there are two messages in a conversation but only one message has a star, then the GUI will show a star next to the conversation. However a search for is:starred  will find the conversation and another search for -is:starred  will also find the conversation.
If you temporarily turn off conversation view the results should match what you expect.


How do I use tamarind powder?

Question: If a recipe calls for tamarind pulp/paste/concentrate, can I substitute powder? If so, how much tamarind powder should I use?
Comment: I'm having trouble putting the difference into words, hence the comment. A large part of the tamarind flavor (in traditional dishes) is because of interactions with other ingredients. That doesn't really happen with dry powder.
Comment: Tamarind powder is very different in flavor and consistency, I would be very cautious in substitutions.
Comment: @metacubed If you can elaborate a bit that might be a good answer! I thought it might be usable to get similar tartness and when it's mixed into something the texture wouldn't matter too much.
Comment: I would agree that tamarind powder is not the best substitute, and I would add that whole tamarind is not that hard to deal with if you can find it.  In my experience, it only took one attempt to go from "What am I supposed to do with these giant peanut-looking things?" to "Oh, this is actually pretty easy."  If you really don't like the extra step, make more than you need and freeze the rest.  Also see [this question](http://cooking.stackexchange.com/questions/13444/how-do-i-use-whole-fresh-tamarind).
Answer: I would like to point out that the block, pulp, paste and powder each impart different properties to anything you cook or prepare.
The blocks of tamarind pulp are the tamarind fruit pods stripped of the outer husk and compressed tightly together. It is full of fibers and seeds.
The pulp is usually a processed version of the block and should be relative free of fibers and seeds.
The paste is further refined and has been sifted and strained to remove the fibers and seeds.
From what I understand the powder is the dehydrated juice made from the process of compressing the block.
To prepare a container of pulp from a block; break up as much as you need and reconstitute it by covering it with boiled water. 15-20 minutes is sufficient to allow it to soften. Push a bit at a time through a fine meshed strainer. We find that a spatula or small scraper is really helpful for this step. You're essentially rubbing the fibers (and seeds) against the strainer to separate the pulp from the fibers. The pulp falls through and the fibers stay behind.
In the end, you should have a bowl full of soft tamarind paste that is about the consistency of apple sauce. This is now ready to be used and can be stirred directly into your dish.
Save the water that was used to soak the tamarind. You can use it in your cooking in place of some of the water or broth.
How does this paste you made from the block compare with the powder... It doesn't... It seem in my opinion to be a completely different taste. I would not use the powder to prepare pad-thai or a Malaysian curry as it rarely imparts the same punch as freshly prepared pulp.
Answer: if you like more sourness in your dish you can actually same quantity to that of a actual paste pulp/paste/concetrate. If not I would suggest to do 3/4. Small Tip : Depends on what dish you are making, sometimes use of powder could be tricky and might not get well blended into the dish. So mixing it up with hot water prior to adding to the dish is a safe move and make sure it mix it really well, else eater could end up with a lump of tamarind. Hope this helps.
Answer: make a past out of the powder and use it. But always add half of what's called in recipe and later you can add to taste.
found this on a recipe - 1 teaspoon dried tamarind (or one-half inch fresh tamarind thinly sliced or diced)
Comment: Do you mean tamarind? You said turmeric.
Comment: @Jolenealasla I don't think you'd thinly slice or dice tamarind...
Comment: @Jefromi Yep, I was kind of thinking that too. Maybe frozen?
Comment: sorry about mixing up words (autocorrect), I get them in bars or slabs, seeds removed and packed like cakes from Asian stores.

How do I use tamarind powder?


Embedded Xinu for RPi

Question: I have completed with setting up the cross compiler but stuck with the compiling part. I have build all the gnu binutils and the gcc successfully in the directory: /home/admin/xinu/opt. But while running the command <code>$ make -C compile PLATFORM=arm-rpi</code>, I get an error- arm-none-eabi-gcc not found. Also it asks to read the README.compiling file.
I am doing this on ubuntu on my laptop.
Answer: It means what is says it can't find the compiler executable for GCC which is the executable file arm-none-eabi-gcc.exe.
The make utility hasn't been given the path to the executable and so it can't run the compiler. Basically it can't run what it can't find .... so fix the path.

Embedded Xinu for RPi


Can I add a garage outlet from existing interior circuit?

Question: I would like to add a receptacle to my garage.  Currently, all receptacles and lights in the garage are on a single 20A circuit that is solely dedicated to the garage.  For my new receptacle, I'd like to run it from a circuit that powers a couple of basement lights.  So at the end of the project, I will have a circuit that powers some basement lights and a receptacle in my garage.  Is this okay to do?  I've read about circuits needed to be dedicated to the garage, but I already have that.  Now I'm curious if I can add an additional receptacle from a different circuit.
Answer: You can do that.
If the circuit it's coming from isn't GFCI protected the receptacle will need to be, since it's in the garage.


Conditional expected value from a regression model using ordinary least squares

Question: I have a query regarding part (a) of the following question. I cannot figure out how to calculate the conditional expected value of collections for the month of Easter. Is it not possible to calculate the expected value for (a) with the given information, as no dataset is given with the question, is it possible to calculate the expected value for (a) without any data / only using the info provided below? If so could somebody point me in the right direction of how this would be done?
Any assistance or direction would be much appreciated.

4.    Suppose you were recently hired to be the controller for a religious order. Since your duties include managing short-term cash flows, you need a forecast of the timing and magnitude of offerings. You expect Easter Sunday will be an event in which attendance and general offerings are expected to be above normal.
To estimate the Easter Sunday effect on order cash flows, you estimate the following regression model using ordinary least squares:

<code>   COLLt  = b0 + b1 TIME + b2 DEaster + et

   Where:
           COLLt  = Monthly collections donated for general budget;
           Time = Time index;
           DEaster = Dummy variable equal to 1 for the month in which Easter occurs
                     and zero otherwise.
</code>

(a)   What is the conditional expected value of collections for the month in which Easter  occurs?
  (b)   Your expectations are that collections will be above normal for the month in which Easter occurs. Describe how you would test for this effect. Be specific in your description of testing procedures.

Therefore would (a) be something like:
$E(X|Y=y)
Coll_{t} = B_{0} + B_{2}(1) + E_{t}
X = B_{0} + B_{2}(1) + E_{t}$
or would you keep the B1 slope & time index also so answer is:
$X = B_{0} + B_{1} Time + B_{2}(1) + E_{t}$
Also in regards to part (b) the only way i can think of testing this is by comparing each month against easter to determine if the collections were above normal or comparing average collections from every month but easter against the easter collections. Any assistance with this would be great, stats is so difficult.
Answer:
is it possible to calculate the expected value for (a) without any data / only using the info provided below

On the information given, I believe the intent with this question is not numerical but algebraic/descriptive. That is, you could answer the question symbolically in terms of the correct combination of model coefficients.


Sudden reputation drop by 200pts not shown on SO/reputation

Question: May be I've been on hallucination, but a few hours ago my rep on SO was slightly above 3000 (I even remember getting a message about being able to vote for closing/reopening questions) yet now I found it being 2800-something but I don't see the decrease on stackoverflow/reputation. How is this possible? Is this a bug?
Answer: Your reputation has gone through a recalc process and hence it has recalculated your reputation completely. You would have lost reputation if you have deleted some questions or answers on which you had got upvotes.
Check the answer in this link - How often is reputation recalculated?
Comment: @6502 - No, when you delete a question or answer, you must've noticed that your reputation does not change. Its only when the recalc happens, that it will recalculate all the reputation again. This happens periodically. You do not know when it will again happen to your account. Similarly for everybody else too.
Comment: But you mean that reputation is not updated live when I delete a question or that a question has been deleted by a moderator? If it's the latter then wouldn't be nice to be at least informed about the issues? I think that at least a "top message" would be nice when something strange happens to your account.
Answer: Changes like this will now appear in your user profile, these changes will roll out to Stack Overflow soon (we're porting a few more things to the new data structures), it's only live on meta for the moment.


Voltage and current at Points Throughout a Circuit

Question: In a series circuit an electric field is created between both terminals of the battery . Is the movement of charges in a wire affected by the position of those charges within that wire? , eg would the charges at nearer the cathode have greater electric potential energy (and hence a greater acceleration) than those nearer to the anode ?
Comment: Voltage is always in reference to paths between two points (in electronics all paths usually have the same voltage so then its easier to talk about voltage between points). So I don't think electronics alone is enough to answer. (Sorry sloppy reading :( )
Answer: Once steady state is reached, the movement of electrons is dictated by field produced by local surface charges on the wire, not by the charges at the terminal of the battery.  The electric field, and hence the acceleration of the charge carriers, is constant throughout the wire.


Change command-line "environment" to programs command

Question: In a console, is it possible to change into a commands "environment"? To explain, I take "git" as an example. While programming and using a git repository, I change to the repos path and then do many "git" commands like "git x ...", "git y ... " etc. So what I want is to somehow change "into" git so that I don't have to type "git" all the time, only "x ..." and "y ...". Or is this a feature you normally wouldn't want?
Answer: What you are asking for is a "git shell". There appears to be one out there by the name git-sh.
There isn't a generalized solution that I know of, but git is not the only program with a custom shell just for running it's own commands. Similar examples might be mysql, telnet, ftp, etc. There are actually quite a number of  programs that do have their own built in shell environments and you have the choice of either feeding them commands as arguments or starting them as shells and running the commands internally.
Also useful along these lines is tab completion. A good tab completion library will have all the possible commands and arguments for a program like git at your finger tips.
Note: While "git shell" is the right terminology here, don't get confused by the "git-shell" project that is out there that is designed to replace the system login shell to give limited permissions for git actions only.
Comment: Ty! With your paragraph in the middle, do you mean that when I am typing "git ..." in the console and then do tab completion it is knowing the commands of git? I already wondered how this works because it does ;) So it is not actually checking the git program for its available commands?
Comment: @user905686 No. It's possible to parse the usage documents and built tab completion routines, but generally there is a library of possible completions and it just works off of those. If you have the right packages installed this should work for a lot of popular programs, but certainly not all.
Answer: You can define git commands as aliases in the shell. You need to make a choice when a git command is also a shell command, e.g. git diff, git mv, … The function all_git_aliases_on makes all git commands available without the git prefix, while the function unambiguous_git_aliases_on makes git commands available without the git prefix only if there isn't a shell command by that name.
The function git_aliases_off removes these aliases; if you had aliases by the same name as a git command (e.g. alias mv='mv -i'), they won't be restored, you need to set them again (add their definitions to the git_aliases_off function).
You may want to call unambiguous_git_aliases_on from your ~/.bashrc or ~/.zshrc, or to give toggle_git_aliases a short alias such as g.
git_commands=$(git help -a | grep '^  *[a-z]')
git_aliases=
all_git_aliases_on () {
  for x in $git_commands; do
    alias $x="git $x"
    git_aliases="$git_aliases $x"
  done
}
unambiguous_git_aliases_on () {
  for x in $git_commands; do
    if ! type $x >/dev/null 2>/dev/null; then alias $x="git $x"; fi
    git_aliases="$git_aliases $x"
  done
}
git_aliases_off () {
  unalias $git_aliases
  git_aliases=
}
toggle_git_aliases () {
  if [ -n "$git_aliases" ]; then
    all_git_aliases_on
  else
    git_aliases_off
  fi
}

Comment: Nice solution! It seems that this IS a generic one, the only thing you have to modify for other programs is maybe the first line, but with a little tweaking you could make a script that generates a respective script like above for a certain program, right? And, when you turn the aliases on like in your script, the original shell commands are still available, are they? Is it possible to turn them off then, too? Then it would be a git shell ;)
Answer: You may be able to do this by creating aliases in your ~/.bashrc file but be careful in the aliases you choose as this could cause you to override other command line programs/scripts.
Here is an example using ls:
  alias l = 'ls -Alh'

So when I type l on the command line, bash runs ls -Alh instead. So you could do something like:
  alias gx = 'git x'
  alias gy = 'git y'

in your ~/.bashrc then running gx would run git x.
I don't know of a generic solution that would work for programs in general though.
Answer: I would make a shell emulator. It's basically a small script that will give you a fake prompt and accept certain input values. For exmaple, it could look like this:
user@host ~$ gitshell
 Welcome to git-shell. Type help for command info
>> help
 help  - display this message
 x     - do x
 y     - do y
 exit  - close the shell
>> exit
user@host ~$

It's not hard to code (use python or perl or something), and once you place it in your $PATH you're set to go. It could be used for git, hg, svn whatever you want. Just an idea, it's what I'd do.
Comment: I guess that would be better to code using a framework for shells so you just have to provide mappings from aliases to actual commands. The [solution using bash aliases](https://unix.stackexchange.com/a/19209/10047) would be a simple one.


Cohomology of configuration space of a compact manifold

Question: There is a reference or a methode which by it we can calculate the cohomology of a configuration space of a compact manifold simply connected? It is possible to find a spectral sequence converging to this cohomology (but the Cohen-Taylor spectral sequence)?
Comment: What kind of configuration spaces do you have in mind? For example, the configuration space of k points in the 2-dimensional disc is the classifying space of the k-strand braid group, and there is a rather large literature on its properties including its cohomology. Is that an example of what you are asking about?
Comment: I mean how to calculate the rational cohomology of the configuration space of a compact manifold simply connected in general, or if it is possible determinate a model fot the configuration space, i know that Kriz and Totaro gave a model for the configuration spaces $F(M,k)$ when $M$ is a complex projective manifold, but in general case, it is possible to use the same technics to determinate it?
Comment: Let me rephrase my question. What definition of a configuration space are you using? For example, is the space of k-element subsets of the 2-dimensional disc an example of your type of configuration space? The terminology "configuration space" is not completely standard, hence the need to state what definition you are using.
Comment: @Lee Mosher: here configuration space means $F(M,k) = M^k \setminus \Delta$ where $\Delta$ is the "big diagonal".
Comment: I use the classical the following definition of ordered configuration space: Let $M$ an $m-$dimensional manifold. The space of ordered configurations of $k$ pointsis the space $$F(M,k)=\{(x_1,...,x_k)\in M^k ;x_i\neq x_j for i\neq j \}$$, and we ask to find the rational cohomology of this space.
Answer: Shameless promotion ahead. If you are interested in cohomology with base field $\mathbb{R}$, then:

For simply connected manifolds without boundary you have my paper and a paper of Campos and Willwacher. Both papers give so-called "real models" for the configuration spaces; these models are commutative differential graded algebras, and in particular the cohomology of the model is the cohomology of the configuration space.
For simply connected manifolds with boundary (and interiors of such manifolds, it's the same thing), we have a paper with Campos, Lambrechts, and Willwacher, where we also give a real model (several, in fact). If $\dim M \ge 4$ then this model is fairly explicit, otherwise it's complicated.

Besides all the models we give are equipped with a symmetric group action that models the natural symmetric group action on $\operatorname{Conf}_k(M)$, so if you are interested in unordered configuration spaces then you can compute their cohomology by considering invariants.
Answer: I would be extremely surprised if there was anything other than the Cohen-Taylor spectral sequence that you can do in this generality.
As you know, the first nontrivial page of Cohen-Taylor spectral sequence depends only on the ring $H^\bullet(M)$. I think it's written up somewhere that the higher order differentials are defined by Massey products on $M$. In particular the result you refer to in a comment that $H^\bullet(F(M,n))$ (or its associated graded) can be computed explicitly from $H^\bullet(M)$ extends to arbitrary formal manifolds $M$, not just smooth projective varieties. And if you give yourself a minimal model of $M$ you should be able to compute $H^\bullet(F(M,n))$ for all $n$ as well (but not a minimal model of $F(M,n)$ -- see the paper of Longoni and Salvatore).
Comment: The paper of Longoni and Salvatore shows that configuration spaces are not homotopy invariant in the non-simply connected case. I believe the question of whether the rational homotopy type of $F(M,n)$ is an invariant of rational homotopy type of simply-connected closed $M$ is still open. See the paper https://eudml.org/doc/116129 of Lambrechts and Stanley, which treats the $2$-connected case.


c program problem

Question:
Possible Duplicate:
c programming problem

I wrote a code for calculating the checksum of file. But when I compile it, it shows me problems which I'm unable to resolve.I'm using ubuntu 10.04 as my operating system.
My code for calculating the checksum is this:
#include <stdio.h>
#include <stdlib.h>

unsigned checksum(void *buffer, size_t len, unsigned int seed)
{
      unsigned char *buf = (unsigned char *)buffer;
      size_t i;

      for (i = 0; i < len; ++i)
            seed += (unsigned int)(*buf++);
      return seed;
}

int main()
{
      FILE *fp;
      size_t len;
      char buf[4096], file[] = "/home/manish.yadav/filename.c";

      if (NULL == (fp = fopen(file, "rb")))
      {
            printf("Unable to open %s for reading\n", file);
            return -1;
      }
      len = fread(buf, sizeof(char), sizeof(buf), fp);
      printf("%zd bytes read\n", len);
      printf("The checksum of %s is %u\n", file, checksum(buf, len, 0));

      return 0 ;
}

I saved it with name checksum.c and compiled it with the following command:
gcc checksum.c

I got the following message:

/tmp/ccatkZlp.o:(.eh_frame+0x12):
  undefined reference to
  `__gxx_personality_v0' collect2: ld
  returned 1 exit status

Now can anybody tell me what I'm doing wrong in this program ? what are these error and why they come ?
Please help me I'm completely stuck.
Answer: At the top of the file, right before the #include <stdio.h>, add
#ifdef __cplusplus
#error Compile with a C compiler
#endif

c program problem


Why don't poor districts train Career tributes?

Question: I know it's not technically allowed, but Districts 1, 2, and sometimes 4 do it, so clearly it's possible.  I don't really understand why the underdog districts wouldn't make any attempt at all to train kids in secret, especially in District 12, where Peacekeepers are lax and they are literally losing children every single year since Haymitch's victory.
Comment: Because they're too poor.
Answer: The issue was mainly one of resources.  Only wealthy people could afford to not have their children working.  The poor districts didn't have many wealthy people.  The resources for people in the poor districts were so limited that the families would starve without the children working and earning extra money, or by taking many tesserae (even then, things were tight for Katniss' family).  This was part of why the Peacekeepers were so lax in the poor districts, to be harsh ensures more people died, which would raise more anti-Peacekeeper sentiment.
In addition, to train a career tribute is to essentially turn them into monsters.  If you have a career tribute as a child, that kid is a psychopath.  They're raised to be merciless killers in the Games (the film has them being more sociable than the book, which portrays them as silent menaces).  It's understandable that parents in the poor districts wouldn't make the choice to put their children through that, even if they could afford it.
The book's introduction to career tributes may help the discussion here:

The exceptions are the kids from the wealthier districts, the volunteers, the ones who have been fed and trained throughout their lives for this moment.  The tributes from 1, 2, and 4 traditionally have this look about them.
Comment: +1. They didn't have the problem presented in your last paragraph, though. One boy and girl each year was chosen at the age of 12 to be a career. At the reaping, the boy and girl chosen to be careers from 6 years prior are now 18. They volunteer. if you're a career, you're 18, trained, and guaranteed a spot in the games.
Comment: Also, I don't really agree that training for the Games automatically turns a child into a psychopath, as obviously it would be clear that killing is only ok in the context of the Games (otherwise, 1, 2, and 4 would have an issue with being killed by their own Careers, I would expect!).  As mentioned above, there's no need to rely on luck that the best-trained child of each gender is Reaped; they volunteer.
Comment: It's mentioned in the books that most of the parents were willing to put their kids up for the reaping since a win would guarantee a luxurious life for the whole family. In fact, if I remember right, there was a voluntary "prereaping" to pick who would become a career.
Comment: Thank you for replying!

While a lot of kids in these districts did need to work, such as Katniss with hunting and trading, I still don't see why it would be impossible to train a few strong kids.  Katniss and Gale's families were unusually poor, since they were single-income homes with multiple kids in the poorest area of 12.  Even they managed to make ends meet--and, if you think about it, Katniss unintentionally trained by hunting.  Therefore, I think free time would only increase from what we saw with Katniss and Gale.
Comment: @GabeWillard There's no indication in the books that all the careers are 18, but they are described as being larger than Katniss.  They don't start training at 12, they are raised to do well in the Games.
Comment: I think there's another factor: Refusing to train tributes is a subtle act of defiance. Instead of offering up their children willingly, as volunteers, the poorer districts force the Capitol to choose names in the Reaping. They are telling the Capitol, "you may take our children, and we may be powerless to stop it, but we will not help you do it." So they may have decided not to train tributes as a matter of principle.
Comment: Thank you for that idea, RCB!  That actually makes the most sense of any explanation I've heard.
Answer: And every year before that as well!
There's an impression that, while the Peacekeepers are lax in D12, they aren't necessarily lax on the other underdog districts. Even in D12, it's fairly clear that the Peacekeepers are lax but not completely delinquent; and that they're allowed to be lax because D12 keeps its place.
(Minor spoilers for the latter two books)

 This is made clear as the series progresses, when the lead Peacekeeper for 12 is replaced in part in hopes of suppressing any budding sense of pride or rebellion following on from Katniss' and Peeta's victory. The Capitol has never been ignorant of the laxity in 12, it just didn't matter because 12 was behaving like a good little downtrodden peasant village.

They clearly look the other where, say, judicious, small-scale poaching is involved, but something like training for the Games would need to be hidden from their view much more carefully to avoid retaliation. The resources, in manpower, money and materials are likely lacking.

 It's also made very clear in the later books that the population of Panem is a tiny fraction of the former population of North America--small enough that both the Capitol and District 13 have maintained their truce as much out of fears of human extinction in another war as anything else! District 12 is governmentally the equivalent of a state or province, but population-wise little larger than a small town, mostly concentrated in one area. The impression we get of all the other districts is similar -- most of them consist of a single relatively small community with a specialized workforce that's expected to work hard simply to survive. This wouldn't leave much spare capacity for creating and operating a training program.
Comment: @AidanO -- You're welcome :-) I figured that there were likely to be a fair number of people reading this who have only seen the first movie and not read any of the books yet, as well as those who have only read the first book so far.
Comment: I'll have to think about that idea for awhile.  It's true that it's never really made explicit, so there are many possibilities (or else I wouldn't have needed to ask a question in the first place!  heh).  I guess one sticking point for me is that 4 doesn't always do it.  If they are known to be able to "get away" with it, I would think they'd use the huge advantage every time.
Comment: Thank you for replying!  I do agree with much of what you said, but I ran into the same point of disagreement with a friend (which led me here!):  I don't mean that there should be any kind of large, organized "training program."  All it would take would be a small effort to seek the strongest kids and help them learn some skills in private.  (I was picturing a basement, like a kids' Fight Club, but many locations could work.)  To not even attempt this on any level, even to teach kids how to throw a punch, is essentially to willingly give them for slaughter--that's what I can't get around.
Comment: I'm prepared to believe that it's happened, and that each time it has, there's been a mass, public slaughter of everyone involved. It's never made explicit, but it fits the brutality of the regime to a T, and also fits everyone's attitude that it just isn't a good idea.