PMML XML Model == same as config file or implementation?

Question: there is the PMML standard defined as XML Schema for Data Mining Model portability between different DM software. My question is, does this xml file serve as a sort of "config file" with the specifics of the underlying domain-model relation (with the specific model implementation logic for the data mining problem concerned), for the other software that you want to import your model?
Or is the PMML model the implementation itself, I mean is there any logic implemented to execute the model with the PMML xml file itself (e.g if you add some test data and let it run through your xml) or must there exist an implementation of the learning algorithm in the software and the PMML is just the configuration of the specific model?
Answer: Essentially, the PMML is just a set of formulas (and the corresponding coefficient values).
The story goes something like this:

You develop a model capable of taking some inputs and outputting certain coefficients that correspond to a certain formula.
Then, these ouputs are turned into a PMML file (an XML-based encoding of your model's outputs).
We can now say, "please evaluate this formula, using these coefficients. As input for the independent variable(s), please use these attributes from my dataset here."

Take a very simple linear regression, for example.

The PMML consumer application parses your PMML file, and finds

model =
coefficient = <5.46>
X = < attribute:  colour of the leaf >

It now goes ahead and scores the formula for the reggression

Note: there's got a to a file somewhere in your application which contains a column called "colour of the leaf"
And, there you have it.
Comment: What I didn't add, but will, if anyone thinks it is necessary: the whole point of PMML is to standardize model consumption. This way, one does not have to dance between languages and environments to implement models where needed. For instance, R&D creates a model and hands off to engineering as PMML. Then engineering can implement in a matter of minutes, in principle. This would not be the case if engineering had to take an R script and turn it into a Java analog.


Initiate login from Terminal?

Question: Is it possible to login to another account from Terminal? I don't mean having a shell prompt as that user; I mean as if I went to the account switcher menu and changed using that.
Comment: What are you trying to do? A miox of apps running as different people on the screen?
Comment: @Mark No; I'm essentially looking for a way to switch users similar to the login screen. Like how you would go to the login screen and log in as a user you'd be taken to the desktop of that user. That but from Terminal.
Answer: Show the login screen (without logging out):
<code>/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
</code>
Switch current user (replace 501 with the correct UID):
<code>/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 501
</code>
(found at http://www.chipwreck.de/blog/2008/01/26/fast-user-switching-via-commandline/.)

Initiate login from Terminal?


How can I configure my iPad so that it doesn't stop uploads after getting auto-locked?

Question: I'm trying to upload a file to Google Drive and SendAnywhere, which would take over an hour. However, I cannot disable auto-lock on my iPad (iPadOS 13) (the maximum auto-lock period is 15 minutes), and whenever the iPad gets locked, uploads are stopped.  How can I configure my iPad so that it doesn't stop uploads after getting auto-locked?
Answer: Unfortunately there's no setting like that to configure.
You can ensure that your iPad is not set to Low Power Mode (check in Settings > Battery).
Besides that, the rest is up to the app developer.
Answer: Run another app that will prevent sleep.
SatNav apps would be good for this.
Make sure you've got enough power, of course, or are plugged in.


What are the ingredients (spices) of Sri Lankan curry powder?

Question: In the following accepted answer you can find the ingredients of the Indian curry powder.  I usually cook with Indian curry powder, however, I recently received some Sri Lankan curry powder.  The aroma is different when I use Sri Lankan curry powder, (in my opinion, better,) and it tastes different too.  Does anyone know the spices used in making Sri Lankan curry powder?
Comment: The differences results from ethnic diversity, not geographic proximity.
Comment: Sri Lanka is a small place (of the size of West Virginia) and I am sure that the differences are minute.  Perhaps, the question is what makes it different from Indian curry powder. (Notice that India is a much larger place but I would still call it Indian curry powder.)
Comment: The term "Sri Lankan" curry is somewhat ambiguous; I have found that northern and eastern Tamil curries have a different character from those in the predominantly Sinhalese areas.
Answer: Most of the recipes I've made for Sri Lankan curries typically have pandan, dry curry leaves, fennel, green cardamom, mustard seeds, cloves, cumin, coriander & black peppercorns.
Comment: Nearly ten years on, you *still* can't get pandan anywhere in the UK, & boy, I've tried:\ I have to get my SriLankan kick on import & buy the entire spice blend, including the pandan.
Answer: There are two main types of Sri Lankan curry powders, yellow and black. Yellow curry is much like stereotypical Indian curry powder, whereas black curry powder is roasted.
Also, in my experience, Sri Lankan curries tend to be hotter than Indian (and more than one friend of Indian heritage has expressed surprise that I enjoy Sri Lankan food, since they find it too hot.)


Why would philosophical agnosticism and pragmatic atheism be considered more rational than philosophical agnosticism and pragmatic theism?

Question: I'm referring to the accepted answer on this post. The answerer states that

If one is both attentive to empirical scientific studies and to philosophical investigations of the limits of knowledge, then the only rational position is philosophical agnosticism plus pragmatic atheism.

Here, I'm assuming that a philosophical agnostic internally holds agnostic beliefs (regardless of how they act upon them), a pragmatic atheist acts as if they were an atheist (not celebrating religion, etc.), and a pragmatic theist acts as if they believe in a God. I'm also assuming that you could be philosophically agnostic and still choose to be pragmatically theistic or atheistic. Ultimately, the most rational option is that which is most adequately in accordance with reason or logic.
Given these definitions, I was wondering if the highlighted claim above can be supported logically. It seems to me that it can't.
I have two main points:
[1] Between atheism, theism, and (soft) agnosticism, the only rational philosophical position is agnosticism. This is because we have no way of knowing whether any given religious scripture is 'reliable'. In Pascal's wager, the idea is that, assuming we have no evidence either way, we can conclude that

if God exists and you don't believe in God, you go to Hell
if God exists and you do believe in God, you go to Heaven
If God doesn't exist, nothing happens regardless of whether or not you believe in God.

Therefore, Pascal concludes that the most rational option is to believe in God.
However, this fails if I ask you to put a truth value on the claim that "The Devil wrote the Bible and anyone who refuses to believes in God goes to Heaven." We have no way of ranking these claims, so we cannot say that this option is any less plausible than the option where God wrote the Bible and anyone who believes in it goes to Heaven. Hence, because the Bible is not sufficiently 'reliable' as evidence of God, there is no way of truly knowing if believing in God sends you to Heaven or Hell. Therefore, philosophical agnosticism is the only rational option.
[2] In the event that you have to choose between being an atheist or believing in God, your likelihood of being correct increases if you are an atheist, in the same way that, for instance, asserting that "God has green hair" is a false claim makes you probabilistically more likely to be correct than if you assert that it is a true claim.
However, I don't see why [2] makes you more rational for being pragmatically atheist. We know that rationality != correctness simply because you can hold a belief that is both irrational and correct. If I said that "God has green hair" is a true claim despite having no evidence to support it, and if it turned out that God exists and does have green hair, that doesn't mean that I held that belief rationally.
Furthermore, assuming you accept the premise of [1], it is equally irrational to be an atheist as it is to be a theist. Therefore, if you are philosophically agnostic, it doesn't matter whether or not you are pragmatically theistic or atheistic. Hence, pragmatic atheism cannot be more rational than pragmatic theism, and can only be equally rational.
The main justification for the claim that pragmatic atheism is more rational is that

...the track record of all detailed predictions for every major religion are astoundingly bad...so there is essentially no evidence in favor and very much evidence against hypotheses that any historical religion is actually meaningfully divinely inspired.

But again, if we rely on the Bible as being "unreliable" in order to conclude that philosophical agnosticism is the only rational position, then how can we logically support the claim that all predictions made based on religion are inconsistent? For one thing, God could exist and the Bible could be a trick. For another, the Bible could be consistent and we could be perceiving it too narrowly, just as quantum mechanics came into play once we realized that classical mechanics was too narrow at the atomic level.
From this, I would conclude that, for a philosophical agnostic, the pragmatic effects of believing in God can't be any different from the pragmatic effects of being an atheist, since you cannot make any pragmatic decisions based on your beliefs in either case. However, I can find no further discussion on this topic.
Comment: Because rationality isn't about finding out what *can* be true, it's about finding out what's *actually* true. (More specifically, it's about acting on what's actually true.)
Comment: @SydneyMaples, so just a follow-up: So, you'd consider spending a lifetime of thinking about, feeling toward, and acting in terms of--all of which require taking time out of your life to accomplish--something for which you have no evidence a rational use of one's time?
Comment: God is more than capable of making Himself known to those who seek him through humility and repentance. Not only that, He has also promised to do so.
Comment: I think you're going to have to define those terms before we can give you a good answer.
Comment: @JeffUK that's fair, which terms would you like me to define? I'm using the terms from the post I linked to. I'm under the assumption that philosophical agnosticism and pragmatic atheism just means that you are an agnostic at heart but you act pragmatically as an atheist
Comment: @Veedrac could you elaborate on your point? For the reasons stated in my post I don't see why it is necessarily more rational for an agnostic to act as an atheist instead of a theist
Comment: @Veedrac I think you're confusing empiricism and rationality, rationality is entirely interested in things that can be shown to be true through logic and reason.  Empiricism is interested in things that HAVE been shown to be true.
Comment: @SydneyMaples Could be useful to start with defining "Philosophical Agnosticism", "Pragmatic Atheism", "Pragmatic Theism" and "More Rational"
Comment: @JeffUK thanks, updated the post. hopefully I made things clearer
Comment: Is there no threshold for behavior that begins to seem irrational to you when following--that is, pragmatically implementing--a specific theistic belief?  For example, is tithing rational absent evidence? Celibacy?
Comment: @Chelonian Sure, there are irrational beliefs. A pragmatic theist doesn't need to abide by strict religious beliefs. They can believe there is probably a God, but be generally agnostic. In the sense that they are pragmatically theistic, they may be inherently spiritual, or they may go to Church, pray, etc. They could be agnostic or disbelieving of the validity of certain principles, such as celibacy. I don't think that the existence of irrationality in religion makes all pragmatic theists irrational. On balance, I think that pragmatic theism may bring more utility than pragmatic atheism.
Comment: @Chelonian I used to be a pragmatic atheist, and am now a pragmatic theist. I am happier than if I were a pragmatic atheist, generally experience more awe (and, hence, feelings of inspiration), get along with philosophical theists and philosophical atheists (the latter by nature of being philosophically agnostic myself), and use pragmatic theism to channel and direct love towards people. As a philosophical agnostic, I do not involve any notion of God in my intellectual life or personal goals. If my goal is to maximize utility, pragmatic theism is the rational option for me.
Comment: @SydneyMaples A rational agent is one that runs an algorithm that attempts to find decisions of maximal quality from the evidence it has. Rational agents don't believe in god, because god is evidently not real, so any algorithm that convinced itself that god exists would not be a strong decision procedure. See section 1.1 of [Logical Induction](https://arxiv.org/pdf/1609.03543.pdf) for a discussion of properties that a rational agent should have.
Comment: @JeffUK Rationality is about decisions. Empiricism is about evidence.  I think section 1 of [Logical Induction](https://arxiv.org/pdf/1609.03543.pdf) (just the first part) might clarify this for you. A rational agent needs to reason about uncertainty *in general*.
Answer: Since you probably do not have a very good working definition of God you are probably going to have to come up with your own tentative idea.  Then the question is whether you think there is something tangible that could be anything near your idea.  If you think there is anything that could distinguish itself beyond neutral meaninglessness then you should probably incline to pragmatic theism, manifesting as continued search or hope for understanding/inspiration.
Comment: I'm more responding to the post I linked to, and the notion of God introduced in Pascal's wager. I'll edit my original post to make it clearer.
Comment: @SydneyMaples Nevertheless if you examined what you thought you were talking about by saying 'God' you might find even the proposition of existence to be questionable.  To suppose existence is to jump the gun; that is to say at the centre of your conceptualization of God existence might not be necessary, for example.
Answer: For the specific deity listed (the God of the Bible), there are rational reasons to hold atheist beliefs: the deity is claimed to be omniscient and omnipotent, but omniscient beings are incompatible with quantum mechanics and omnipotent beings are logically impossible.
Comment: I'm inclined to downvote this answer as too specific to a particular theology to be of any philosophical use, but I'll withhold my vote as I think I understand why the question has invited it.


Is 10 years data enough for forecasting?

Question: I want to forecast demand for the cement industry. I have data for 10 years- Monthly data. Is that desirable for forecasting?
Comment: Why don't you try building a model for the first 9 years of data, and use the 10th year to validate your model?
Comment: The 10th year may not provide particularly good validation, but it'd be better than nothing - with small data sets there are always limitations.
Answer: You can forecast a time series based on a single historical observation, by simply extrapolating this observation into the indefinite future (the so-called naive no-change forecast). Or you could even forecast time series with no historical observations whatsoever, in your case e.g., by estimating the current size of the industry and assuming a certain growth rate.
Of course, forecasts based on very few data points will likely not be very good. Usually more historical data translates into better forecasts. So your question really isn't whether 10 years of data is enough for forecasting, but whether this is enough for your forecasts to be good enough. And that, in turn, depends heavily on what you want to do with your forecast.
Then again, 10 years is quite a lot of data. The question really is whether any more data will improve accuracy. I'd imagine that the cement industry may have changed a lot over the last decade, so 11 year old data may not be comparable to more recent data. Your forecast accuracy will likely be influenced much more by how well you can forecast the future economic growth and industrial policy in China.
Comment: As per your explanation, minimum data like that of two years can be used to forecast.

Initially the company provided me with their monthly sales and price data of two years but not sure of how accurate the forecast will be, I thought of doing it for the entire cement industry as the data I am getting from various sources is for 10-20 years.
Comment: The dependent variable being production of cement

The independent variables selected are Production of( Coal, steel, electricity, Oil),GDP, Inflation rate, Interest rate, Import export.

My question is: Should I go for the two year data which the country has provided me with or should I take the data for the entire industry. ( I can change my aim from specific to general).

Thanks!
Comment: If you do causal forecasting, you will need to forecast your causal variables, too. Keep that in mind. In your specific case, I'd recommend building *two* models, one including prices and two years of history, the other one excluding prices but using ten years of history. Forecast out using both models. Then [average the two forecasts within each future time bucket](http://stats.stackexchange.com/a/154201/1352). Averaging forecasts very often improves accuracy.
Answer: It is good that you have 10 years of data, but you should consider what many ignore and check your data for changes in variance.  You can use Tsay's test to do this and then use WLS to estimate, if necessary.  See more here Outliers, Level Shifts, and Variance Changes
in Time Series www.unc.edu/~jbhill/tsay.pdf
You should also check your model to see if the model is changing using the Chow test for structural breaks as patterns change over time within the data due to policy, competition or unknown factors. See more here http://en.wikipedia.org/wiki/Chow_test


Saving diskspace in bitcoin with a sort of snapshot of the blockchain

Question: I am reading that some people try to save diskspace in what information is stored in the blockchain. I am wondering if it is possible to save such a diskspace in taking a sort of snapshot of the blockchain where only all the wallets and their worth in BTC at time T_0 is saved, rather than their full transaction history. We would save the blockchain up to time T_0 in some archive and move on with the snapshot as a starting point for the next blocks, and repeat this process so that the current blockchain never takes too much diskspace.
Answer: There is no need.
If disk space is an issue, run a pruned node. Those still fully validate all transactions, only don't store them after validation.


How come I cannot ask a question?

Question: Looking at the privileges list, it looks like I should be able to ask questions along with answering them. However I get a red box on the right, telling me what questions are desired and how to format. Am I doing something wrong or is there a bug/downtime?
Comment: Your profile is not blocked from asking questions. Does the red box come up when you try to submit the question? If so it is providing guidance on question quality - have you tried following the guidance by updating your question?
Comment: Yes. I added  tags, spaced it out with more newlines, and it looks plenty good to me. It would be great if the guidance could single out the actual problem.
Comment: the guidance is automated, so it has some heuristic rules but its actual intelligence is limited.
Comment: http://pastebin.com/2vfbtRf9 ?
Comment: That looks like it should work - and you have a title along the lines of "Does TEA require 32 rounds?" - I can't see why this wouldn't work.
Comment: can you take a screen grab when you try to post the question and get the error message so we can see what is happening
Comment: Thanks for looking! http://imgur.com/LO0gSOp
Comment: @blah44, what happens when you click the red button that says "Post Your Question"
Comment: @MikePennington - nothing! Page refreshes and looks the same when finished loading.

Answer: Given your screenshot, you're attempting to post a question with the tags tea and feistel, which do not exist. Creating tags requires 300 reputation points.
The boxes on the right are shown to everyone. They're guidance, not error messages. Pay attention to the actual error message when you attempt to submit the question:

Creating the new tags 'tea feistel' requires at least 300 reputation. Try something from the existing tags list instead.

A question that requires specific tags such as tea and feistel is too specialized for this site. Questions on the design and implementation techniques of cryptographic algorithms are suitable for Cryptography Stack Exchange. Questions on the actual coding belong on Stack Overflow. Your question is borderline; most questions on the Cryptography site contain math rather than code, but since your question is focuses on modifying the algorithm rather than on a coding issue, it is more suitable for Cryptography.
Be sure to use the proper formatting tool: despite its name,  is not a very good tag to use for code, since it doesn't format the content verbatim. Use 4-space indentation for literal formatting (as used by the {} button or the Ctrl+K shortcut), or
 tags. Pay attention to the preview below the editor window (which you've shrunk down to be practically empty, drag the bottom of the editor window up to make more room for the preview), make sure it comes out right. Another formatting tip: don't use bare URLs, hyperlink some English text, like [TEA source from Wikipedia](http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm) (which renders as TEA source from Wikipedia).
Comment: @blah44 The error *is* shown — I reproduced your question while not logged in and copy-pasted the message. It appears in a sort of bubble next to the tag entry box.
Comment: Aha! Thanks much. It seems like "need more rep to add a tag" could be singled out and listed as an error, which would help this situation.
Comment: huh, maybe safari is being silly. Ah well, sorry for all the noise!

How come I cannot ask a question?


How do singers find the first note of the melody?

Question: I find myself hitting the first note of the melody correctly when my singing teacher starts playing the song's chords on the piano, but I have no idea how I did it or how I found the first note. How do singers find the first note when the accompaniment begins playing and they begin singing? What is the theory behind that?
Comment: To avoid getting the wrong answer, please clarify a bit. Do you mean that the pianist plays a few chords and then you enter, and you're wondering how you find that melodic pitch from those chords (the answer will have to do with the power of tonal context)? Or do you mean that, even without being given a starting pitch, you're able to hit the first note immediately as the piano starts (the answer will have to do with pitch memory)?
Comment: This seems closely related to [an earlier question of yours](https://music.stackexchange.com/q/125887/78419), as well as others about deriving melodic pitches from chords. To make sure answers are as useful as possible, please make sure we know what we're *not* talking about here!
Comment: How do singers find **any** note?! It's not like most instruments where fingers on a certain place will produce the correct note.
Comment: @Tim I broadly agree, but while fingers are not involved, a certain physical/bodily coordination will produce a certain note. When I'm very practiced with a particular song/piece/melody, I find that muscle memory takes over and I can come to the same starting pitch each time even without accompaniment (I don't have perfect pitch).
Answer: The intro establishes the basic tonality of the song, it tells you where 'do' is (if you think in terms of 'do, re, mi...)  or where the I chord is (if you know a bit of 'theory').   The intro doesn't HAVE to end on a tonic or dominant chord, the melody doesn't HAVE to start on do or any other note of the tonic chord. We just need to get our bearings. The dart board is over here, maybe low on the wall, maybe high.  Focus on it, then go for maybe a 1, maybe a 5, maybe a bulls-eye!
Then, how does the singer actually produce the note that's in their 'mind's eye'?  Well, if I said 'sing a high note' or 'sing a low note' you wouldn't have a problem.   It's just a matter of refining that skill.   Many people do it naturally.  Some never get it!
Comment: Heh, I was thinking of dart boards as a metaphor, though to make a different point: Someone who plays with the same board regularly can probably hit it blindfolded since they're so used to the context; as long as you place them in the same spot, they know how far away it is. In the same way, tonality is "the context"; whether they understand it or not, if you give them a ^1, they know how to start "Three Blind Mice" by finding the ^3. But I'm going to hold off on turning it into a full answer until I'm more sure that's what OP is going for.
Comment: The intro establishes the basic tonality - even if you have NO theory! Of course it helps, but the vast majority of people who sing in amateur situations have no theory.
Comment: @Tim That doesn't seem to disagree with anything I said!
Comment: 'if you know a bit of theory' - nit picking, maybe..?
Answer: The question's a little vague, but when playing an introduction, the accompanist will usually play a V harmony to bring in the vox. That then means the I will follow, and most songs will use either ^1, ^3 or^5 to start the song. That narrows it down considerably. However, see my comment. Maybe that's a more pressing question to get answered!
Comment: I'd only add the idea that only playing V is not always sufficient.  V by itself could be misunderstood as being I, and even V-I or I-V could sound exactly like I-IV or IV-I.  In my experience a foolproof intro includes both IV and V (and more specifically the scale degrees ^7 and ^4, which points our ears directly to the tonic.
Comment: @nuggethead - V7 is pretty conclusive though.
Comment: indeed it is!  I forgot to mention that, but V7 is that conclusive because it contains ^4 and ^7 already!
Answer: There are multiple aspects to this question, as there is a ton of music which will necessarily behave differently. So I will give multiple answers:

By listening to specific key notes in the accompaniment and taking intervals of this (the interval approach)
By inferring the correct functions to the harmony given by the accompaniment (the harmonic approch)
By feeling (the intuitive approach)
By a tuning fork or something similar

Let's talk first about the most intuitive ones, 3 and 2. If you know piece well you will know the accompaniment and just "know" the notes by heart. Also singing a specific pitch will require a specific configuration of your vocal muscles. Singing requires you to intrinsically "know" how to setup your vocal muscles to produce exactly that pitch. And when you learn a piece you will learn the feeling of this configuration, which means that with a piece you know well you should be able to find the starting pitch plus/minus something without any external help. So when hearing the accompaniment there will often simply be only one note that fits both the tonality and the body feeling.
Now, if you do not know the piece well enough but if we have clear and simple harmonies you will be able to find a tonal context, from which you can derive specific notes.
If things get more complicated one thing you often find in choir practice is to establish a key note in the accompaniment (or other voices) from which you take a specific interval.
Finally if you've got a quite complex or atonal accompaniment you'd use something like a tuning fork to find the correct pitch.
Comment: It's interesting that if I play an intro in a different key, no.3 can't kick in. No.3 is probably the one most used by non-trained singers - and also many experienced ones, too.
Comment: I would argue that #3 is always just #2 (maybe even a bit of #1), done unconsciously or even without being taught the underlying principles. When children learn a language they also learn its grammar, long before they study it.


Is there an end in Hill Climb Racing?

Question: Is it infinite? Has anyone seen its end?
Comment: I think that the answers to the question "Are the levels of Hill Climb Racing procedurally generated?" (https://gaming.stackexchange.com/q/235624/145662) provide some well cited and authoritative answers to this question.
Comment: Most are endless, some have an end.
Answer: Hill Climb Racing is indeed infinite - there is no end goal or finish line. Instead, it is a game based purely on high score.
Comment: Do you have a source for this? It just keeps generating road?
Answer: One of my friends got the game when it was new.  It did have a finish line back then and he's sure there is still one but he thinks it is way beyond what any of the vehicles can reach.
Answer: Every 20 levels, you will arrive to the starting point without feeling, because the stage is designed to have a starting point that is similar to the finishing point.
Comment: Sounds like he might be saying that it doesn't end because you just go back to the beginning again. Maybe: "Every 20 levels you will be returned to the starting level without noticing, because it is designed so that the last stage and the first stage are similar." Something like that.
Comment: What are you trying to say?
Answer: It most definitely has an end. I've made it in one level a long time ago but I don't remember which one. I trust that they may have made it longer but there is an end as it's a set course. If it was infinite the track would be generated at random instead of being the exact same every time. It doesn't make new tracks as you go so it is set in the software of the game. So yes I believe it most definitely has an end and since they made it farther than it used to be it is beyond the car's capabilities. That's why they added the garage so you can build the perfect car for each course!
Comment: That doesn't necessarily mean it's infinite. You can seed a PRNG, which will generate the same pseudo-random numbers in the same order every time.
Answer: There is an end in Space mission it says space survivor.
If you ride the neon dragon(neon),survive the troll(ragarnok) and Collect all 10 treasures i.e become jungle king (jungle)the level is pretty much accomplished
Answer: Hill Climb Racing is currently never ending. The goal is to see how far you can make it, therefore getting a higher score, how much money you can collect, and how many vehicles and parts you can unlock.

Is there an end in Hill Climb Racing?


How to avoid opening two browser windows?

Question: I'd like to avoid the possibility to open two application windows (or tabs). It is, if my app (LAMP+Javascript) is installed on http://www.domain.com and the user is browsing the page http://www.domain.com/user/ he/she cannot open another window like http://www.domain.com/system/. If he/she opens another window, the application should show an error message.
Is that possible?
For curious people: I need this behaviour because my app uses some session data to identify sequences of actions. If the user opens a new window on the same browser, normally everything is right, but if he/she starts a new sequence, the previous one (in the other window) will be lost.
Answer: You cannot prevent someone from opening your website twice.
You might by able to use a new session key for every page, but that can get a bit hanky...
Answer: As mentioned above — you cannot prevent someone from opening your website twice. Yet your problem is, as I see, to actually mare sure that every browser session is unique. There are many approaches to reach this, one could be to generate a random number by the client and send it via ajax to the backend to be used instead of a session-id, you might have some persistence problems, but these are all easy to tackle.
Answer: While it is correct what all others said here that you cannot prevent someone from opening your website twice, there might be a workaround for you. Note that this is not a 100% solution and will require you to develop further code based on this.
As far as I understand you have the following problems:

How to determine if a user has your page open with a window/tag that shares session data (i.e. two tabs in Chrome, 2 Chrome windows etc.) - that is the easiest part though.
How to determine if a user has your page open in a different browser (i.e. open in FF & Chrome at one time) - that is the tricky one.

However - you could use LSO - Local Shared Objects to accomplish this. These are Flash based cookie similar data pieces stored at the client's side. AND THEY ARE CROSS-BROWSER & CROSS-DOMAIN COMPATIBLE. You can find a nice library called EVERCOOKIE for using them here.
By setting such a cookie you will be able to trace the user even if he opens a new window or even if he opens your page in a different browser, as far as the browsers share the same Flash installation etc.
Note that this will not prevent someone in opening two windows directly, but it enables you to send him to the same sequence state as he is in the other window for example.
You should also be aware that this is not a 100% solution. There will always be some trick to get around this, although I think normal users would not be able to get it...
Answer: The only way I can think of doing this is to hide / remove content if the user is logged in somewhere else
So you would a) need the user to login ... and b) record when the user logged in ... and c) record when the user logged out
There are still problems with this method - when do you decide when the user has closed the browser and should be removed from the "logged on" list ...
In short the answer is you cant reliably stop this ....
Answer: I would do it using sessions on the server side (i.e php) , and utilize the load and window.unload events to set and destroy sessions.
If a session is already created, then any window that opens up after that , should check for the session value, and force a close after showing an error message.


Ubuntu Touch/Phone sim card contacts import

Question: Im looking for a possibility to import the contacts saved on my sim-card into my bq ubuntu phone, I've no idea how to do it, can u help me pls?
Answer: I have not been able to import contacts from my sim-card to the bq ubuntu phone, but you may work around this issue by:

synchronizing contacts on your sim-card and android phone with google mail,
adding a google account to the bq ubuntu phone through the menu: \system settings\accounts,
allowing the account to access the google contacts list and synchronizing with the bq ubuntu phone.

All your contacts are then available in the bq ubuntu phone contacts list
Answer: Go to Contacts of your Android Phone and select Import/Export, Export. After this action a *.vcf file will be created and contains all your contacts.
Install Dekko email client on Ubuntu Phone, email the *.vcf file to your account, and open this file in Dekko. Import will start automatically.
Comment: worked for me, not sure, why rating is -1?
Answer: to export from android, search the google store for "contact export". this will save your contacts in csv, vcf, pdf to your phone. you then copy from phone to pc via any means you prefer: wifi, blue, usb.


Using residue theorem to prove the integral identities

Question: For this problem $\int^\infty_0 dx/{(x^3+1)}$, the answer divides the contour into three sections, which I found is really hard to understand. The question I have is why do we need to do that? Is there any simpler way to solve this problem? Like if we could just find the poles for it and we can then simply apply residue theorem to it? Thanks.
Comment: http://math.stackexchange.com/questions/367772/integrating-frac11z3-over-a-wedge-to-compute-int-0-infty-fracdx1?rq=1
Comment: The poles for $1/(x^3+1)$ are easy to find.  The hard part is to "simply apply" the residue theorem, given that this is an integral from $0$ to $\infty$.
Comment: Aren't them the simple poles? And if that so, we can use the formula to calculate the residue?
Answer: The problem is that you are looking for a simple formula and one doesn't apply here.  Evaluating integrals via the residue theorem requires two things: an integrand and a contour.  In this case, we want a contour that produces the integral in question.  The contour is not a semicircle, which is what I assume is what you seem to use all the time.  The reason for this is that the integrand is not symmetric, i.e., odd or even.
There are at least two well-known ways to work in this way.  One is, as you say, to define a three-piece contour.  The contour here is a wedge of angle $\alpha$ and radius $R$.  What we do is define
$$\oint_C \frac{dz}{1+z^3} $$
where $C$ is the wedge.  Then the integral is equal to
$$\int_0^R \frac{dx}{1+x^3} + i R \int_0^{\alpha} d\theta \, \frac{e^{i \theta}}{1+R^3 e^{i 3 \theta}} + e^{i \alpha} \int_R^0 \frac{dt}{1+e^{i 3 \alpha} t^3}$$
OK, note that if we are going to recover our original integral without doing any others, it should be clear that we want $e^{i 3 \alpha} = 1$, or $\alpha = 2 \pi/3$.
Note that the second integral has a magnitude that is bounded by $(2 \pi/3) R/(R^3-1)$, so that  the integral vanishes as $R \to \infty$.
Now, by the residue theorem, the contour integral is $i 2 \pi$ times the residue of the poles of the integrand inside the contour.  In this case, the only pole is at $z=e^{i \pi/3}$.  Thus,
$$\left ( 1-e^{i 2 \pi/3} \right ) \int_0^{\infty} \frac{dx}{1+x^3} = \frac{i 2 \pi}{3 e^{i 2 \pi/3}} $$
Thus,
$$\int_0^{\infty} \frac{dx}{1+x^3} = \frac{\pi/3}{\sin{(2 \pi/3)}} = \frac{2 \pi}{3 \sqrt{3}}$$
A second way is more general but also more work.  In this case, form the integral
$$\oint_C dz \frac{\log{z}}{1+z^3} $$
where $C$ is a keyhole contour of inner radius $\epsilon$ and outer radius $R$.  Here, we use the multivaluedness of the log to return a value of the integral we want.  In this case, we find that the contour integral is equal to, in the limit as $\epsilon \to 0$ and $R \to \infty$,
$$\int_0^{\infty} dx \frac{\log{x}}{1+x^3} + \int_{\infty}^0 dx \frac{\log{x}+i 2 \pi}{1+x^3} = -i 2 \pi \int_0^{\infty} \frac{dx}{1+x^3} $$
Now set this equal to $i 2 \pi$ times the sum of the residues of the integrand at the three poles of the integrand.  I leave it to the OP to work out that the answer is identical to that I derived above.


Does the entire surface of the earth contain organisms?

Question: Does the entire surface of the earth contain organisms?
My teacher mentioned that in some parts of the earth, there aren't any organism. Is this true?
Thanks in advance.
Comment: have you questioned their claims? can they tell you where these places are? Obvious place to start checking is hostile places, but there are a lot bacteria & other unicellular organisms that can withstand extremes, e.g. Thermophilic bacteria live in very hot places such as black smokers
Answer: That will depend on many things. How do you define surface? Is one meter underground still "surface"? How about a kilometer?
Also, how large an area are we talking about? You could probably find a square millimeter in, for example, Antarctica that has no organisms. I don't think you would find a square kilometer with no organisms though.
There are organisms (called extremophiles) that thrive in the most hostile environments we know, they can survive extreme heat, cold, acidity, salinity etc. I found this very nice list:

Cold – The McMurdo Dry Valleys in Antarctica are some of the coldest, driest deserts on Earth, with average annual temperatures of
  -20oC (-4oF) and less than 10 centimeters (4 inches) of precipitation a year. Scientists have found bacteria in liquid water pockets
  embedded about twelve feet deep in "solid" lake ice. Some of these
  bacteria use chemical nutrients from particles of dirt in the ice and
  use energy from sunlight for photosynthesis.
Hot – Large concentrations of microbes thrive in Yellowstone National Park's Grand Prismatic Springs, a hot spring with water
  temperatures up to 90oC (188oF). Other hot springs in Yellowstone are
  extremely acidic, yet are home to many different kinds of bacteria and
  microbes. Many of these microbes use chemical nutrients in the waters
  and energy from sunlight for photosynthesis. Deep underground –
  Scientists have discovered bacteria living in ground- water 5
  kilometers below the surface in deep gold mines of the Witwatersrand
  Basin in South Africa. These microbes thrive in cavities and cracks in
  rocks. Scientists are also are investigating life within and below
  permafrost in north- ern Canada.
Bottom of the sea – Scientists have found abundant life clustered around hydro- thermal vents on the ocean floor, including bacteria,
  mussels, clams, shrimp, and giant tubeworms that can reach ten feet in
  length. Water pouring out of the vents in the complete darkness
  thousands of feet under the surface of the sea can reach temperatures
  of 113-120oC (235-248oF). The high pressures keep the water from
  boiling. Bacteria use chemicals in the vent's water, primarily
  hydrogen sulfide, as their energy source instead of sunlight. Other
  creatures survive by eating the bacte- ria or each other.
High Acidity – The water in the Rio Tinto in southwestern Spain is very acidic, a result of chemical reactions between the water, and
  iron and sulfur minerals in the ground. The river has a deep red
  color, like wine, because of iron dissolved in the water. Microbes
  living in the water use chemical reac- tions with iron and sulfur
  minerals to generate the energy they need. Products from these
  metabolic reactions contribute to the low pH in the environment. Many
  algae and fungi also live in the acidic waters.

As far as I know, there is no evidence of life in molten lava. Apart from that though, just about every habitat you can find on the earth has been colonized by life. Ask your teacher what parts of the earth she is talking about, and report back here.
UPDATE:
MCM's very interesting answer prompted me to do some more research. It seems that life has now been found even in the Atacama (taken from Azua-Bustos
et al):

For a long time it was thought that regions of the Atacama could not
  uphold any type of life forms. However, recent culture-independent
  methods (metagenomics, transcriptomics, in situ hybridization, etc.)
  have improved the sensitivity for life detection. Thus, microorganisms
  have been found even in the driest areas of this desert, which makes
  scientists wonder about the true limit of water availability needed to
  sustain life as we know it. In this review, we summarize the efforts
  devoted to the characterization of microbial life in the Atacama
  Desert.

So, it seems that life can exist even in the Atacama. That leaves only molten lava...
Reference
Azua-Bustos et al, Life at the dry edge: microorganisms of the Atacama Desert, FEBS Lett. 2012 Aug 31;586(18):2939-45
Comment: The bottom of the sea is (relatively) crowded with life, even away from hydrothermal vents. http://en.wikipedia.org/wiki/Whale_fall
Comment: @JeremyKemball of course it is, my point was that an underground volcano spewing sulfuric acid and with the pressure found at half a kilometer underwater is hardly an environment that kends itself to life.
Comment: A fair point. I've gotten so used to hydrothermal vent = oasis I kind of forgot that they're toxic pressure cookers.
Answer: Barring the very obvious surfaces (the pits of active volcanoes), the only place I'm aware of that might not contain life is the Atacama Desert near the Andes Mountains in Chile and Brazil.
Whereas other places that seem inhospitable - Antarctic, Hot Springs, regular deserts, extremely high altitudes, etc. - the basic necessities for life still exist (carbon, water, nitrogen). In the Atacama, though:

The average rainfall in the Chilean region of Antofagasta is just 1 millimetre (0.04 in) per year. Some weather stations in the Atacama have never received rain. Evidence suggests that the Atacama may not have had any significant rainfall from 1570 to 1971...  Studies by a group of British scientists have suggested that some river beds have been dry for 120,000 years.

It's the driest place on the planet. It's drier than every other desert by a long shot, and is so dry that NASA occasionally uses it to simulate Mars.

In 2003, a team of researchers published a report in the journal Science titled "Mars-like Soils in the Atacama Desert, Chile, and the Dry Limit of Microbial Life" in which they duplicated the tests used by the Viking 1 and Viking 2 Mars landers to detect life, and were unable to detect any signs in Atacama Desert soil. The region may be unique on Earth in this regard and is being used by NASA to test instruments for future Mars missions. The team duplicated the Viking tests in Mars-like Earth environments and found that they missed present signs of life in soil samples from Antarctic dry valleys, the Atacama Desert of Chile and Peru, and other locales.

So while life might exist in the Atacama (signs of life do not always point towards currently-existing life), it's hiding extremely well. Probably beneath the topsoil, where no multicellular organisms have ever been spotted and unicellular organisms may not exist at all.
Ultimately your teacher is correct, although whether they meant the Atacama or erroneously considered other places on the planet you'll have to ask them.
Comment: A fascinating place - still I'd be suprised if a ribosomal rna PCR reaction showed up nothing - bacterial spores and simple animals like rotifers can survive for decades without water.  the volcano caldera and maybe the tops of mountains like K2 are good ideas though!
Comment: Heh, nice, +1. However, [recent research](http://www.ncbi.nlm.nih.gov.gate1.inist.fr/pubmed/22819826) has found life in the Atacama. See my updated answer.
Comment: @shigeta and terdon -  Yeah, I doubt there's any place on the planet that hasn't seem at least *some* biproducts or spores on it through dispersal and human activity, but as far as actively growing and consuming resources I don't think anything has been confirmed in some parts of the Atacama (though edges of it saw enough rainfall to briefly support wildflowers in 2011).
Answer:
Sterile! Lake Vostok's microbes elusive in first measurements of surface water
A first analysis of the ice that froze onto the drillbit used in last
  February's landmark drilling to a pristine Antarctic lake shows no
  native microbes came up with the lake water, according to Sergey Bulat
  of Petersburg Nuclear Physics Institute (Russia). The very uppermost
  layer of Lake Vostok appears to be "lifeless" so far, says Bulat, but
  that doesn't mean the rest of it is.   Bulat reported what he calls
  his team's "very preliminary results" on Tuesday, at the 12th European
  Workshop on Astrobiology (ENEA 2012), in Stockholm, Sweden, at the
  AlbaNova University Center. Bulat and his colleagues counted the
  microbes present in the ice sample and checked their genetic makeup to
  figure out the phylotypes. They counted fewer than 10 microbes/ml —
  about the same magnitude they would expect to find in the background
  in their clean room. And three of the four phylotypes they identified
  matched contaminants from the drilling oil, with the fourth unknown
  but also most likely from the lubricant.   Bulat hopes to get clean
  samples from the ice frozen in the borehole below where the drill bit
  stopped. That won't be until next May (2013), if all goes well after
  the next Russian drilling expedition in December-January. Even if the
  top of the lake ends up being empty, Bulat suspects microbes will come
  from lower water depths, or from sediment samples at the bottom of the
  lake.   Lake Vostok is a stand-in for icy bodies that might harbor
  life, like Jupiter's moon Europa. Gerda Horneck of the German
  Aerospace Center (DLR) said that any result from Lake Vostok is
  important for astrobiology, and the search for extremophiles that
  could give hints of what life could be like elsewhere. "Let's see what
  comes out next round," she told me at the end of the meeting on
  Wednesday.

http://www.scoop.it/t/amazing-science/p/3031509753/sterile-lake-vostok-s-microbes-elusive-in-first-measurements-of-surface-water

More info on Lake Vostok:
http://earthsci.org/education/Lake_Vostok/vostok.html
Comment: Welcome to Bio.SE! It's always a good idea to check that you're using quotes to support *your* answer rather than to write one :)


long short portfolio sharpe ratio

Question: What is the proper way to caluclate sharpe ratio for the long short portfolio? When I calculate daily return with no cost, I use this formula: (return for long k.mean()+ (-1)*(return for short k.mean())/2
So can I use this formula to get daily sharpe ratio?: all daily return with no cost/all daily return's std
If this is wrong, what is the right formula?
And how can I get the annualized sharpe ratio of long short portfolio?
I tried this: one daily return/all daily return's std for each date and divide by date number
Comment: Isn't the Sharpe ratio just a function of a series of historical returns?
Comment: Can you clarify what your formula means? What is k.mean, where is the variance? (return for long k.mean()+ (-1)*(return for short k.mean())/2
Comment: (1) Find the daily returns (2) Find their mean and standard deviation and compute the (daily) Sharpe Ratio (3) Annualize the sharpe ratio by multiplying by $\sqrt{252}$ the sqrt of the number of trading days per year
Answer: Let's assume stock "A" yields a 5% return and stock "B" yields a 6% return, they both have standard deviations of 10% (per annum) and a correlation factor of 0.5.
You decide to short stock "A" and long stock "B", let's assume you short "A" for an equivalent of 50% of your portfolio's value and use the proceeds (including your portfolio's value) to buy "B" for an equivalent of 150% of your initial margin. You have weights -50% in A and 150% in B.
By doing -50% * 5% + 150% * 6%, you will find your portfolio's return.
Your standard deviation for only two stocks can be simply calculated by finding the square root of the "portfolio variance formula", keep in mind that you must know your correlation factor.
return : 6.5%
std : 3.5%
risk free rate: (let's say 2%)
Then,
Sharpe = (6.5% - 2%) / 3.5% = 1.29
If your values are daily, then the sharpe ratio can be roughly annualized by multiplying with the square root of 252 (number of trading days).

long short portfolio sharpe ratio


Need help to newbie to understand MIL-STD-461

Question: why only 10khz-10Mhz is used for CE102 test ?
why not other frequency range is used for CE102 test ?
Comment: Where can one read this standard without paywall?
Comment: CE101 is between 30 Hz and 10 kHz. CE102 is 10 kHz to 10 MHz. It has to stop somewhere. What range would make sense to you, if not those?
Comment: @AlexandervonWernherr It can be found here http://everyspec.com/MIL-STD/MIL-STD-0300-0499/MIL-STD-461_8678/
Answer: CE tests measure absorbed currents from the grid due to pulse or nonlinear loads with harmonic content, using local AC lines.
This can then radiate this noise to nearby radios causing interference in reception, (e.g. AM, SW bands) Also, with many similar loads on the grid, this may create excessive Neutral currentsresulting in winding thermal issues in Distribution Transformers (DT) designed for 50 or 60 Hz.  Thus the CE (Conducted Emissions) test limits these interference issues with limits.
To test this you need a line voltage rated differential coil inductance and grid Cap( called a LISN for Line Impedance Stabilizer network to look like a "Pi" filter. This can raise grid source impedance and shunt ingress noise from grid, so egress (emissions) of current are converted to Voltage (V=IR with R=50) measured in uV but in dBm on Spectrum Analyzer (SA) converted from power using 50 Ohms.

simulate this circuit – Schematic created using CircuitLab
So you need; LISN, preamp(maybe) and SA then compute dBm to uV (@50 Ohms) to chart results.  The LISN raises the ource impedance well above 50 Ohms so this is accurate.  There are other methods too.
 Ref
(not exactly as shown and resonant f of LC is well below 10k shown on graph)
This test procedure is used to verify that electromagnetic emissions from the EUT (equip. under test) do not exceed the specified requirements for power input leads, including returns.


How long should I ride?

Question: I am 24/Male and I have been riding since a year. Recently endurance riding has interested me. I have done two rides of 20 km each. Now I am planning for a 46 km ride.l My question is, should I go for it? or should I do some more 20 km rides?
Comment: Generally speaking, someone who is in decent overall condition and has their butt broken pretty well should be able to do about 50 miles (80 km) in a day, on reasonably level ground with rest breaks (of both kinds), food, and water.  Much beyond that and you need to build up gradually, though.  And I've also found that one can generally do about 1.5 or 2x what one is acclimated to, with relatively little difficulty.
Answer: Go for it - you're young and riding over the last year will give you an idea of your capabilities.
Do make sure your bike is maintained - having a mechanical is no fun.  Take your spares/tools and food and water.
If the distance is challenging, think of it as an "out and back" which is each-way only 3 km longer than your normal rides.  It becomes two rides in one day, with a bit of a rest at the half way.  For me, there's a nice pie shop about 60 km away, so that's two rides with a 30 minute light-lunch stop in the middle.
Pacing is good, don't go too hard out in the first half.  But the rest at the half way will help a lot and the ride home will always feel shorter than the ride out.
You'll never find out what you're capable of if you keep doing the same trips and distances.  Extend yourself and push some limits.
Comment: Another way to "push some limits" is to do the same distance more often: for example, "20 km ... twice a day", or "40 km ... 5 days a week", or "50 km ... 2 days in every 3".
Answer: The key is going to be how you felt after those 20km rides.
Assuming you were OK, the longer ride should be fine though you'll be tired and you'll ache in unexpected places. If you had any pain on the short rides you need to deal with that first - probably by adjusting the bike. Going from a 1 hour to a 2 hour ride (roughly, assumed times) you may well want to carry (more) water and an energy snack just in case.
Answer: I've been where you were 3 years ago.
Basically you can keep going. Your body will tell you it's limits. Make sure you listen to it. Aches and pains in your joints or tendons are an important signal not to be disregarded. Muscle ache however is a sign that you're improving. By going for longer distances you'll train your body in several ways and you will be able to go further and further.
A good rule of thumb is, if you are comfortable riding distance X then you can also do 1.33 * X if you have to. This is generally the advice I read when people want to reach a set distance. So if you want to do a 100km run, then train to be able to do a 75km run while coming home feeling ok. Once you reach this point you are ready to do the 100km.
So in your case if you are now comfortable with 20 you can probably do 25 and come home tired. Once you're comfortable with 25 (should take only a few trips) you'll be good for 33. and so on. The first few steps up will only take several (2-4) trips. Once you reach 60-80km distance it will take longer / will take more training to be able to increase though.
However, if you've been doing these 20km rides for a year you probably are already coming home very fresh / not tired at all. so you probably can skip a step or two. Before going on the 46km, see if you can do 34 and check when you get back if you are tired or exhausted. If you're just tired then you're ready for 46 :)
Once you go for multi hour bike rides I can recommend you start looking into bringing food and water. Dehydration happens fast when you cycle longer distances, and unless you keep your heartrate low you'll slowly use up your stored short term energy stores.
Specifically to your question: given your age and the fact that you've done a year of cycling already, just go for it. There is no shame in taking a break for a few hours at the halfway point. Make sure you bring food (bananas are your friend) and plenty of water. (750-1000ml an hour if you cycle fast). Just keep your legs moving and you'll get there.
Comment: I loathe bananas, specially when they've got black spots and a bit squished.  But the class of bite-sized foods known as Bliss Balls work really well as bike food.  And strangely the banana ones taste best.

How long should I ride?


Unable to restart lsyncd after killing it

Question: I noticed that I was not getting new backups on our DR, so I took a look and saw that lsyncd was stuck on the server that sends to the DR via lsyncd. Our backup logs showed endless errors of "Waiting for child process to terminate." I eventually killed the lsyncd tasks since they were stuck and have since been unable to restart lsyncd. The backup to DR is configured through /etc/lsyncd.conf.
When I run status on lsyncd after I run
systemctl start lsyncd.service

I get the following error:
[root@backupsteve bin]# systemctl status lsyncd.service
● lsyncd.service - Live Syncing (Mirror) Daemon
Loaded: loaded (/usr/lib/systemd/system/lsyncd.service; disabled; vendor preset: disabled)
Active: inactive (dead)

Apr  3 17:22:19 backupsteve systemd: Started Live Syncing (Mirror)
Daemon.
Apr  3 17:22:19 backupsteve systemd: Starting Live Syncing (Mirror) Daemon...
Apr  3 17:22:19 backupsteve sh: Error: failure getting absolute path of [/usr/local/cherbles/archive/plause/backups/dr551-prod/sftpdrop2/latestbackup/]
Apr  3 17:22:19 backupsteve sh: Error: Cannot access source directory: /usr/local/cherbles/archive/plause/backups/dr551-prod/sftpdrop2/latestbackup/

I am able to browse to the ../dr551-prod/sftpdrop2/latestbackup just fine.
 and see the backups. It is just a link to the latest backup folder. This particular backup (dr551-prod) entry in the .conf file is towards the middle, but it errors on this one immediately for some reason. There are probably 20 servers in front of this. I do not have any instances of lsyncd running and I have stop/started it a good bit of times.
Answer: The problem was with part of my .conf file. There was an error in the code so each time it tried to start it failed trying to go to a directory that didn't exist.  Maybe that will help yall!


What is the Lagrangian for a relativistic charge that includes the self-force?

Question: The usual Lagrangian for a relativistically moving charge, as found in most text books, doesn't take into account the self force from it radiating EM energy. So what is the Lagrangian for a relativistic charge that includes the self-force?
Comment: This question may be relevant:
http://physics.stackexchange.com/q/9212/
Comment: I wouldn't go as far as what Qmechanic says, but it is clear that one must abandon classical *Maxwellian* description of electromagnetism. It is actually quite an active research topic whether there can be non-linear theories of classical electrodynamics that can treat self-force. For an example, see M. Kiessling, _J. Stat. Phys._ (2004) vol 116 p1057. Kiessling has a second paper in the same issue of the journal starting on p1123 dealing with the quantum version of the procedure.
Comment: To properly address self-energy issues, one has to abandon a classical description and consider full-fledge quantum-electro-dynamics (QED) and renormalization.
Comment: @Willie is the problem that an acceleration is modelled as the cause of the proper self force? Usually, proper force is the cause of acceleration, and independent of the acceleration it causes.
Answer: classical electrodynamics mainly deals with two kinds of proplems: a) The action of a field on a charged particle and b) the fields arising from the motion of such a field. Of course, this can only be approximative but it turns out that a lot of phenomena can be described in this way.
However, you are right, an entire treatment would include a) and b) simultaniously - including the whole dynamics of such a system with radiative reaction (or, the Abraham-Lorentz-Force and its relativistic counterpart).
But as Qmechanic pointed out in a comment, there may be no fully consistent way to do so within the framework of classical electrodynamics. Jackson (Chapter 16) states:

The difficulties presented by this problem touch one of the most fundamental aspects of physics, the nature of an elementary particle. Although partial solutions, workable within limiting areas, can be given, the basic problem remains unsolved.

Thus, you will have to search for a really satisfactory answer within the description of Quantum Electrodynamics. Otherwise, you may include the effect phenomenologically. This was done e.g. by Barone and Mendes in Lagrangian description of the radiation damping (PRA, 2007) and they give a Lagrangian of the form
$$\mathcal{L}=\frac{m}{2}\dot{\mathbf{r}}_1\cdot\dot{\mathbf{r}}_2 - \frac{\gamma}{2}\epsilon\left(\dot{\mathbf{r}}_1,\ddot{\mathbf{r}}_2\right)
-V\left(\mathbf{r}_1,\mathbf{r}_2\right),$$
with $\gamma :=  2e^2/3c^3$, with $\epsilon = \epsilon_{ij}dx^idx^j$ beeing the Levi-Cevita tensor, and the $\mathbf{r}_i$ arise from the special treatment of the problem used in the paper employing some kind of image phase-space representation of the system. Furthermore, $V\,$ is the potential related to the Abraham–Lorentz–Dirac-Force which is given explicitely in the paper.
Answer: It is the usual CED Lagrangian for a charge and electromagnetic field; it includes the free field Lagrangian, a free particle Lagrangian and the interaction Lagrangian $jA$. Self-action is encoded in it when you consider the system as a whole, as coupled unknown variables. Of course, it yields rubbish: an infinite "electromagnetic mass" that you need to discard.
I say "rubbish" because, on one hand, we define the charge as a stable, fixed entity; on the other hand we introduce a self-force to get some dynamics due to it. Our definition contradicts our intentions.
EDIT: The infinite "electromagnetic mass" in the charge equation takes simply into account the self-induction effect that prevents the charge from accelerating ;-)
Answer: Solving both, Lorentz force and Maxwell's equation, does include radiation reaction. Radiation reaction emerges from the interaction of the charge with the field it has emitted itself, the self-field. If you do not want to solve Maxwell's equations and treat the fields as external, you can use Lorentz-Abraham-Dirac equation with some known inconsistencies for unphysical initial conditions, or the Landau-Lifshitz equation as approximation. Some authors claim that Landau-Lifshitz equation is not an approximation but agrees with solutions Lorentz-Abraham-Dirac equation for physical initial conditions. Lorentz-Abraham-Dirac and Landau-Lifshitz equations cannot be derived from Hamilton's principle because radiation emission is a dissipative process. For a pedagogical review see http://arxiv.org/abs/gr-qc/9912045.
Answer: I would say that it is already in the Lagrangian, problem being: in the classical ED lagrangian you describe point-like particles, and the self interaction is classically described as the classical lorentz force a charge creates on itself if it is a sphere-like particle, considering retarded potentials. A classical solution would be to include the shape in the lagrangian, but the lagrangian is local, so it deals with points. If someone talks to you about QED, it is because classically you reach the conclusion that the reaction creates a mass like term opposing acceleration, and this mass can become infinite, in QED you also have some infinites, but you can remove them. Nonetheless I would say you remove it because what actually interests QED is the measure you make, and you never really reach the size of a point while measuring, but it might be an over interpretation.
BUT I have a good news for you there exists a classical formulation that includes the retroaction, to the expense of retrocausality, or waves flowing backward in time, or a kind of action at a distance: it is the lagrangian you can find in the Feynman-Wheeler absorber theory. very interesting but Feynman abandoned it.
Answer: If the charge is point-like then its classical self-energy is infinite. As the self-force comes from the gradient of potentials, the result is undetermined.
Consider a theory with a local interaction. Then we must take into account some field, e.g. the electromagnetic field. Now for a massive relativistic particle moving at constant velocity there is always an inertial frame of reference where the particle is not moving. Therefore the magnetic field vanishes and the electric field is that given by Coulomb's law, i.e.
$$\mathbf E(\mathbf r)=\frac q{4\pi\epsilon}\frac{\mathbf r}{\Vert \mathbf r\Vert^3}.$$
Since the particle stays at $\mathbf r=0$, the force is undefined.
So far the only massless particle known is the photon, which is neutral.
Comment: Potential energy enters into the Lagrangian...
Comment: Yes, the potential energy is a part of the Lagrangian but it depends on not-yet-determined variables there. One does not use it for calculations because the Lagrangian serves first of all to get the equations. In particular, from CED Lagrangian and the Noether theorem it follows that the total energy is conserved, and this energy includes a self-action contribution. The force is a term from equations of motion, not from the Lagrangian.
Comment: -1  The OP question is about Lagrangian.
Comment: The OP is talking about radiation reaction http://en.wikipedia.org/wiki/Abraham%E2%80%93Lorentz_force and is asking about Lagrangians, not forces.


Natbib + Chapterbib

Question: I want to put a separate bibliography at the end of each chapter, called "References", and a global bibliography at the end of my report, called "Bibliography". I'm using Natbib and tried Chapterbib. But it doesn't seem that Chapterbib can create a global bibliography at the end. Is there any other package that I can use to achieve this formatting?
I know the duplicate option of Chapterbib. But it is still separated by chapters at the end.
Answer: You wrote:

But it doesn't seem that Chapterbib can create a global bibliography at the end.

Short answer: Yes.
Longer answer: You can have both a global bibliography as well as per-chapter bibliographies. Here's an excerpt from pp 3f. of the user guide of the chapterbib package:

7 Overall bibliography: To have a cohesive bibliography
  for the whole document, plus individual bibs in the chapters, put
  \bibliography commands in the included chapters plus in the root
  file. Make sure the \bibliographystyle for the overall bibliography
  appears first, before any chapters are included. Run LATEX; run
  BibTEX on the root file; run BibTEX on each included file; run LATEX;
  run LATEX. This produces an independent 'overall' bibliography which
  only makes sense for various 'named' bibliography styles; a numbered
  style, or one with any type of automatic enumeration (like Me2007a,
  Me2007b) will give unrelated numbers in each bibliography and lead
  to confusion.
BibTEX will complain about multiple \bibdata commands when it
  makes the whole bibliography, but it should obey the first. If you don't
  want to see any error messages from bibtex, or if you don't want to put
  the main \bibliographystyle command first in the document, then
  use \usepackage[rootbib]{chapterbib} when you run LATEX first;
  run BibTEX on the root file; change to \usepackage{chapterbib};
  run LATEX; run BibTEX on each included file; run LATEX; run LATEX.

Natbib + Chapterbib


Having an issue with horizontal scrolling in Google Spreadsheets

Question: When I try to scroll horizontally in Google Spreadsheets using the track pad, nothing happens. However, if I scroll vertically first, I can then scroll horizontally if I don't pick up my fingers from the track pad. This seems like a simple event handler bug on their part. Is anyone else having this issue or know a fix?
If it's relevant (probably isn't), I'm using Firefox 26.0 on a MacBook running OS X Mavericks.
Comment: Can you reproduce the problem with Safari or Chrome?
Answer: It seems to be a known Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=948510 (Alas, it was opened more than year ago…)
Answer: On the spreadsheet menu. There is help->Report issue.
It sounds like the track pad is doing something strange, because all works when I use a mouse.
Answer: the trick is to freeze pane row 1, then you can scroll as much as you like on a google sheet :)


Where does Wordpress 4.x store custom css?

Question: I'm editing the custom CSS that my theme's author included via the built-in "Custom CSS" tab in the back end of Wordpress. I'd like to edit this info directly, though, with a proper text editor. Where is this info located? It's not in "style.css" in my child theme, and I can't figure out where else I should look!
Answer: You won't be happy about this: It's stored in the database (I just tried it), in the table named wp_options. Search the option_value field for something that's in your CSS (a class or id name, for example). But - at least in my case (when using the Divi theme) - it's saved together with tons of other settings in this one field...
Comment: Thanks.  I expected - but was hoping this wouldn't be - that this was the answer!
Answer: You could also make a child theme of your current theme, and place your styles in its style.css. Or copy and paste all of the custom css out of the theme's editor and work on it in a text editor, then copy back in and save.
Answer: You can view wordpress Additional CSS in the wp_posts table with post type = custom_css
Answer: similar question
table: wp_posts
post_type: custom_css
post_name: your theme slug
post_value: the css rules you want to change


Are OpenCL work items executed in parallel?

Question: I know that work items are grouped into the work groups, and you cannot synchronize outside of a work group.
Does it mean that work items are executed in parallel?
If so, is it possible/efficient to make 1 work group with 128 work items?
Answer: The work items within a group will be scheduled together, and may run together. It is up to the hardware and/or drivers to choose how parallel the execution actually is. There are different reasons for this, but one very good one is to hide memory latency.
On my AMD card, the 'compute units' are divided into 16 4-wide SIMD units. This means that 16 work items can technically be run at the same time in the group. It is recommended that we use multiples of 64 work items in a group, to hide memory latency. Clearly they cannot all be run at the exact time. This is not a problem, because most kernels are in fact, memory bound, so the scheduler (hardware) will swap the work items waiting on the memory controller out, while the 'ready' items get their compute time. The actual number of work items in the group is set by the host program, and limited by CL_DEVICE_MAX_WORK_GROUP_SIZE. You will need to experiment with the optimal work group size for your kernel.
The cpu implementation is 'worse' when it comes to simultaneous work items. There are only ever as many work items running as you have cores available to run them on. They behave more sequentially in the cpu.
So do work items run at the exactly same time? Almost never really. This is why we need to use barriers when we want to be sure they pause at a given point.
Comment: Are you sure that there are only ever as many work items running as you have cores available? According to [this page](http://software.intel.com/sites/products/documentation/ioclsdk/2013/OG/Basic_Concepts.htm), separate cores are compute units, which would mean that one core does not correspond in any way to a work item.
Comment: I am sure of this. It is true that there may be more 'in flight' work items than there are cores on the cpu -- this is actually what the work group is. In terms of simultaneous computation, a cpu core an only be executing one instruction queue at a given time. Even in non-opencl applications, threading is either faked via context switching, or it is realized through multiple core hardware (and sometimes with limited SIMD functionality).
Answer: In the (abstract) OpenCL execution model, yes, all work items execute in parallel, and there can be millions of them.
Inside a GPU, all work items of the same work group must be executed on a single "core". This puts a physical restriction on the number of work items per work group (256 or 512 is the max, but it can be smaller for large kernels using a lot of registers). All work groups are then scheduled on the (usually 2 to 16) cores of the GPU.
You can synchronize threads (work items) inside a work group, because they all are resident in the same core, but you can't synchronize threads from different work groups, since they may not be scheduled at the same time, and could be executed on different cores.
Yes, it is possible to have 128 work items inside a work group, unless it consumes too many resources. To reach maximum performance, you usually want to have the largest possible number of threads in a work group (at least 64 are required to hide memory latency, see Vasily Volkov's presentations on this subject).
Answer: The idea is that they can be executed in parallel if possible (whether they actually will be executed in parallel depends).
Answer: Yes, work items are executed in parallel.
To get the maximal possible number of work items, use clGetDeviceInfo with CL_DEVICE_MAX_WORK_GROUP_SIZE. It depends on the hardware.
Whether it's efficient or not primarily depends on the task you want to implement. If you need a lot of synchronization, it may be that OpenCL does not fit your task. I can't say much more without knowing what you actually want to do.
Answer: The work-items in a given work-group execute concurrently on the processing elements of a sigle processing unit.


Debug with Magento 2.4.4

Question: Hello i'd like to understand how to enable all possible error log that can happen in my Magento 2.4.4 in production mode since website is live.
I checked that in var/log folder there are usefull files but it's all there?
Thanks
Answer: In production mode Magento writes to log all designed messages except debug level. First of all you need to check var/log/system.log (in some cases more useful var/log/support_report.log) and var/log/exception.log.
Some Magento modules can write separate logs and they will be stored in the same var/log directory also (usually).
If you want to properly handle Magento logs I suggest to configure logrotate. It helps you to organize and archive your logs.
Also Magento writes Report log for any unhandled errors and writes into var/report directory.
I'm strongly suggest to don't forget to enable PHP error log on production and monitor it as well. See log_errors and error_log parameters.

Debug with Magento 2.4.4


Why doesn't Hera divorce Zeus and marry someone more faithful?

Question: This is something I don't understand. If Hera hates Zeus' infidelity, to the point of cursing his lovers and even trying to overthrow him, why not marry someone else?
Comment: Perhaps she enjoyed her status as queen of the gods.
Comment: @Harel13, of course she did. It is just a shame, because she never agreed to the marriage in the first place. Zeus raped her and she was ashamed of that, and reluctantly agreed to marriage. She must regret it from that day forward…
Comment: Hera is the _goddess of marriage_.  There is a scene in the musical _Evita_ where Eva Perón is diagnosed with ovarian cancer, but she and her husband refuse surgery because the "Mother of Argentina" just _has_ to have ovaries....
Comment: Could Greek women divorce their husbands?  (Roman women could, but there were a lot of differences.)
Answer: Zeus is more powerful than Hera and all the other gods. In fact, he is even stronger than all of them put together, if we take his word for it (Iliad 8.19-27). This is what Zeus says to Hera after he realizes that she had tricked him into falling asleep in order to help the Achaeans:

The sire of gods and men had pity on him, and looked fiercely on Juno. "I see, Juno," said he, "you mischief-making trickster, that your cunning has stayed Hector from fighting and has caused the rout of his host. I am in half a mind to thrash you, in which case you will be the first to reap the fruits of your scurvy knavery. Do you not remember how once upon a time I had you hanged? I fastened two anvils on to your feet, and bound your hands in a chain of gold which none might break, and you hung in mid-air among the clouds. All the gods in Olympus were in a fury, but they could not reach you to set you free; when I caught any one of them I gripped him and hurled him from the heavenly threshold till he came fainting down to earth; yet even this did not relieve my mind from the incessant anxiety which I felt about noble Hercules whom you and Boreas had spitefully conveyed beyond the seas to Cos, after suborning the tempests; but I rescued him, and notwithstanding all his mighty labours I brought him back again to Argos. I would remind you of this that you may learn to leave off being so deceitful, and discover how much you are likely to gain by the embraces out of which you have come here to trick me." (Iliad 15.14-33; there are similar speeches in book 8)

The myths have Hera trying to thwart Zeus many times, and she always suffers for it. She couldn't simply decide to get divorced from the king of the gods, if he didn't want her to separate from him.
Comment: Wow, that must really suck for Hera. She, after all, does deserve better, than a cheating scumbag.
Comment: @AmortalDemon I mean, you are aware that Hera isn't *real*, right? And I really don't think you can reserve the words "cheating scumbag" for any god - that would be making them too human. And while in myth they might seem very human, there is vast gulf between religious beliefs and practices and the stories told to convey them.
Answer: Hera is the goddess of family. By divorcing Zeus she would be breaking her own family further apart, therefore creating rifts between her children and the other gods and demigods. By refusing to divorce zeus, she is setting an example: she is the queen of the gods, and he the King. He may cheat, but he will be punished for it.


How does a LUT work, why is it used?

Question: I wonder how the LUT (look-up-table) works in digital design. Why do you use it? Could you give me an example of how to implement it, for example a circuit sketch or something? I Would be glad if you had pictures too.
Answer: A lookup table (LUT) is a fast way to realize a complex function in digital logic.  The address is the function input, and the value at that address is the function output.  The advantage is that computing the function only takes a single memory lookup regardless of the complexity of the function, so is very fast.  The disadvantage is that it takes memory, especially if you need high resolution for the function input.
For example, the sine function is often implemented as a table lookup.  If 10 bit angles are good enough resolution, then the whole function can be implemented as a lookup table with 1024 entries.  (Actually, in the case of sine, only 1/4 cycle is stored then negated or indexed backwards depending on the actual quadrant, but that is a aside specific to sine).
The function input can also be a combination of different input variables with the result expressed as a single integer.  For example, a 4 x 4 bit multiply can be implemented as a lookup table of 256 values.  The 8-bit table address can be the two 4-bit input values concatenated.
Comment: Instruction decode could also use a LUT (in a sense, the early use of microcode for implementing instructions was LUT-based).
Comment: @OlinLathrop Useful answer. If possible, can you point out a valid source that can be cited to highlight the plus sides of lookup tables? I need to write this it in a paper. Thanks.
Answer: Perhaps the best way to understand a LUT is to consider how one would enumerate all the combinatorial circuits which take two inputs and produce one output.  If one assumes that the inputs are hard-wired to other things so that e.g. "A and not B" is different from "B and not A", and functions which ignore one or both of the inputs may be useful [e.g. something will be wired to input B, but one may not care about what it's outputting], there are sixteen such circuits:
<code>0000 Always output zero
0001 Output (not A) and (not B)
0010 Output A and (not B)
0011 Output (not B)
0100 Output (not A) and B
0101 Output (not A)
0110 Output A xor B
0111 Output A or (not B)
1000 Output (A and B)
1001 Output not (A xor B)
1010 Output A
1011 Output A or (not B)
1100 Output B
1101 Output (not A) or B
1110 Output A or B
1111 Always output 1
</code>
Each of the above circuits may be described by the four digit binary value to its left: the first digit says what should be output when both inputs are high.  The second says what should be output if B is high and A is low.  The third says what to do if A is high and B is low.  The fourth says what to do when both inputs are low.
Rather than trying to invent some complicated scheme for allowing a device programmer to switch among various kinds of gates, FPGA manufacturers often have as their dominant logic type a circuit similar to the above (though often using eight bits to describe a three-input function, or sixteen bits to describe a four-input function).  The circuit is referred to as a LUT because the N input bits are used to "look up" one of the 2^N "mode select" bits.
An important thing to note when using LUTs as compared with some other types of logic circuitry is that even if one has a logic device like the above configured to output "A", it will really compute "(A and B) or (A and not B)".  As a consequence, if a device has e.g. a minimum propagation time of 2ns and a maximum propagation time of 5ns, then even if the A input remains constant, the behavior of the output will become unspecified 2ns after the B input changes and remain unspecified until 5ns after the B input is stable.  If the B output is feeding a flip flop which is clocked by the same source as its inputs, this glitch will be inconsequential.  If the B input is driving asynchronous sequential logic, however, such glitches may cause unexpected and undesirable behavior.
Answer: The look up table is often implemented with RAM or ROM cells in an array. The logic inputs are the address lines to to the array. The array data outputs become the logic outputs of the LUT. One determines the logic performed by the LUT based upon where in the array that 1's and 0's are written. The content bits for each output column of the array can be determined using standard logic synthesis techniques for the various combinations of the input bits. Note that actual logic minimization is not normally needed for a LUT because there are bits in the output columns of the array for every combination of the input bits.
You can get more good information concerning LUTs and their usages by referring to the various FPGA Logic Family Data Sheets from the likes of Altera and Xilinx. Their FPGAs make heavy use of LUTs for random logic generation. Typically FPGA LUTs are small RAM arrays that get loaded from a non-volatile configuration memory at time of power up.
Answer: One example that springs to mind is the sinewave look-up table. If you have a DAC and want to output a sinewave you can store several values that represent a sinewave in the first 90º of its waveform. These values can be stored in contiguous memory say from value 0 to value 90.
To produce the first 90º of the sinewave you incrementally read the values from 0 to 90 then for 91 to 180 you work backwards down the table then for the next 2 quadrants you start again but negate the values. This takes you to the start again.
DDS chips from Analog devices use this technique and if the definition of the sinewave is broad enough you can skip values to produce higher frequencies.
Comment: I believe the OP is asking about LUTs in the context of FPGAs/VHDL.

How does a LUT work, why is it used?


Search and Bubble Sort Array in Javascript

Question: Alright, so I'm really having trouble with this lab for my class.
Here's the problem:
Initialization: Randomly initialize a list of size 200 with integer values between 0 and 100.
Part 1: Search
You are to implement a function which searches a list for an occurence of a value. It should not depend on the list being pre-sorted.
Search
Section     Specification   Comments
INPUT:  list, value     An initialized list
COMPUTATION:
Loop over all elements in list.
    If current element equals value, store as index.
If value not found, ensure index is -1.

RETURN:     index   -1 if value not found
Prompt the user once for an element (an integer from 0 to 100) to search for.
Call your search function with the number to search for and the list.
Display whether the number was found, and if found, a location where it can be found within the list.

Part 2: Sort
You are to implement a function which sorts a list in ascending (0, 1, ...) order. You are not permitted to use JavaScript's sort() method.
There are many ways to sort a list of which you may implement any method you see fit, provided it sorts a list in ascending order. Below describes Bubble Sort, one of the most straight-forward approaches to sorting.
Sort
Section     Specification   Comments
INPUT:  list    An initialized list
OTHER VARIABLES:    swap
n   Indicates if swap occurred.
How far to search in the list.
COMPUTATION:
Set n to size of list - 1.
Set swap to FALSE.
Loop over element 0 through element n in the list.
    If current element > next element
        Swap current element and next element.
        Set swap to TRUE.
If swap is TRUE, repeat from step 2. n -= 1.
If swap is FALSE, return the now sorted list.

Gradually sorts a list.

nth item is correctly placed.
RETURN:     list
Call your sort function for your list. You are not permitted to call Javascript's sort() method.
Display the (sorted) list.

I'm not asking you to do my homework but can you please just point me in the right direction? I figured out how to do the bubble sort but the search part is what I'm mostly having problems with.
Comment: Hi Hannah, welcome to SO. Can you post the JavaScript code which you have written so far- or at least the pertinent parts of it...
Comment: At what step are you facing problem ?
Answer: function search(array, value)
{
    for (var i = 0; i < array.length; i++)
        if (array[i] === value)
            return i;
    return -1;
}

For Bubble Sort implementation please read this.
Also, you can use this solution:
function search(array, value)
{
    return array.indexOf(value);
}

Comment: With pleasure. Did you try this out?


Criterion for acyclicity of flag complexes

Question: Let $\Delta$ be a flag complex on $n$ vertices. Let $r$ be the smallest size of the facets of $\Delta$. Suppose that $2r>n$. Must $\Delta$ be acyclic?
Answer: It looks to me like you can prove the stronger property of contractibility by induction, as follows.  Let $\Delta$ be the independence complex of graph $G$, as guaranteed by the flag property.
If $\Delta$ is a cone, then $\Delta$ is contractible.  This will be the base case, along with dimension 0 (where $\Delta$ has a single point) and dimension 1 (where $\Delta$ is a 1-simplex).
Otherwise, every vertex $v$ has degree at least 1 in $G$.  Consider a fixed pair of vertices $v,w$ that are adjacent in $G$.  We'll use that the link of $v$ in $\Delta$ is the independence complex of $G \setminus N[v]$ (and similarly for $w$).  Now $\operatorname{link}_\Delta v$, $\operatorname{link}_\Delta w$ are contained in the independence complex of $G \setminus \{v,w\}$.
Since we remove at most one vertex from each maximal face in each case, $r$ goes down by at most one in each considered subcomplex, while the number of vertices goes down by at least 2.  So by induction, $\operatorname{link}_\Delta v$, $\operatorname{link}_\Delta w$, and the independence complex of $G \setminus {v,w}$ are all contractible.
Now $\Delta$ is the union of the faces that contain $v$, those that contain $w$, and those that contain neither.  So $\Delta$ is the union of the subcomplexes $\Delta_1 = v*\operatorname{link} v$, $\Delta_2 = w*\operatorname{link} w$, and $\Delta_0$ the independence complex of $G \setminus \{v,w\}$.  It now follows by e.g. Lemma 10.4(ii) of Björner's Topological methods that $\Delta$ is contractible.
I didn't immediately see the answer to the question of whether there's a sensible generalization of some sort to non-flag complexes.  The flag property is used above in where $\operatorname{link}_\Delta v$ is the independence complex of $G \setminus N[v]$; also in finding a pair of vertices that are in no common face.
(Updated over initial version to fix a problem with the facet sizes in the induction, in response to a comment of and off-MO discussion with @Hailong Dao.)
Comment: Perhaps the non-evasiveness has to be addressed further given that the proof changed.
1) the ones described in the problem.
 2) the ones obtained from removing a vertex, which give an additional local condition to relax the larger one, i.e there is a vertex with a pleasant link!

It seems like this imposes many conditions on the graph. Do you have a systematic way to construct interesting examples?
Comment: @JoséAlejandroSamper, as far as examples, look at the graph theory literature, under the name independent domination.  A nontrivial example can be constructed by attaching a large number of pendant edges to each vertex of a complete graph.  See e.g. _Independent domination in graphs: a survey and recent results_ by Goddard and Henning.
Comment: @JoséAlejandroSamper, I thought when I updated the post that I saw how to easily recover nonevasiveness, but now I no longer see it.  I'll delete my earlier comment claiming that it holds.
Comment: I still feel it should hold! Anyways, i like this property quite a bit. Do you know how close to tight is this?
Comment: Great, thanks Russ. This remind me of my paper with Jay, perhaps I should dig it out.


Why do we have to put the shellcode before the return address in the buffer overflow?

Question: I'd like to know why we have to put the shellcode before the return address in a buffer overflow. Logically the return address will point to the shellcode and will be executed, so the return address should be put before the shellcode. Can someone explain me?
Comment: The stack grows downwards in memory addresses.  Returns pop the stack and walk upwards into your shell code.
Answer: The buffer overflow, by definition, needs to overflow the buffer. This is to overwrite the return address at the end.
This gives a convenient location in which to drop the shell code. If you tried to add it afterwards, you might overwrite another memory address and then the program would crash in a different way.
So adding the shell code before the return address enables the return address to be written to to trigger a jump to the previously written shell code. To sum up, the buffer you're overflowing is often the perfect location to write your shell code without overwriting another important bit of memory.
Answer: The reason why you put the shellcode before the return address in your buffer overflow exploit depend on a few factors:

The size of the buffer
The flow of the application
Any tricks beyond a simple buffer + return address like having to do relative jumps will require some finesse

A common example of a buffer overflow may look like this:
"\x41"*1000 + "\xe7\x51\x78\xa2" + "\x90"*16 + "[shellcode]"
Here, I have overflowed the buffer with 1000 A's, landed in a place where I can control EIP to point to a location of my choosing, followed by some NOPs to give my shellcode room to unpack, and then ultimately the executable code. This is a relatively straightforward exploit. The return address would commonly be a JMP ESP instruction, which happens to be at the start of your NOP sled. The sled works until it hits the shellcode, and since the stack grows, it overwrites the NOP sled while it unpacks and you get execution.
However, it can be that sometimes you don't have that kind of exploit path and you have to do something different:
"\x90"*16 + [shellcode] + "\x90"*400 + [return address] + "\x90"*5
Here we have to put our shellcode at the beginning because a simple JMP ESP isn't possible. Instead, we have to find another instruction that allows us to jump to the beginning to get execution. Then we have some padding at both ends of the return address.
So the answer, without more details, is "it depends." It depends on the specific situation, what you have to work with in your exploit, the room you have, and the behavior of the application in question.


Wiring a ceiling fan with remote (5 wires) to 2 wall switches

Question: I replaced my ceiling fan (pull chains for light and fan) to a  TroposAir Starfire ceiling fan.
My house has 4 wires coming from the box, white,red,black and green.  There is 2 switches on the wall that controlled the fan and light independently.  Now with this new fan that goes through the remote it leaves one switch as a dummy as there is just one master switch that controls the main power and everything goes through the remote, with young children this is not ideal.  How to I wire this so the light and fan have their own switch?  The remote has 5 wires going in, 3 for the motor and 2 for the light.
Comment: What make and model is the fan in question?
Comment: It's a TroposAir Starfire.
Answer: The fan you purchased isn't designed to be wired with separate switches. It's designed to have an always hot hooked up to the remote unit in the fan that controls everything. If you want a fan and light to be controlled by the wall switches then you need to get a different fan without the remote unit since you can't just bypass the remove unit. There are smart devices out there that allow you to do both but you have to make sure they are compatible with your fan... and they're not cheap.
Comment: Ah that sucks, yea I bought a Bond to control it with my phone.  Ty for the reply


Dojox.grid.DataGrid filtering

Question: I've a DataGrid which contains data fetched from the server side. I need to filter the data based on some conditions. I've three checkboxes, on selecting the checkboxes I need to filter the data. For example I've three Checkboxes- Pending, Issued,Completed. When I uncheck Pending checkbox, the DataGrid should contain only Issues and Completed.
I'm able to filter a single element by using
<code>dataGrid.filter({status: 'P*'});
</code>
But I'm not able to give the OR conditions, I tried Piped character, still it didn't work. Can someone please suggest me a way to implement this.
Thanks in advance.
Answer: Look at using the dojo.data.AndOrReadStore.  It supports more complex queries.

Dojox.grid.DataGrid filtering


Long communication time of WCF Web Services within the same server

Question: Even if this question is a year old, I am still searching a good answer for this question. I appreciate any information that will lead me to fully understand this issue regarding low performances of communicating web services hosted on the same machine.
I am currently developing a system with several WCF Web Services that communicate intensively.
They are running under IIS7, on the same machine, each service being in a different Application Pool, with multiple workers in the Web Garden.
During the individual evaluation of each Web Service, I can serve 10000-20000 requests per minute, quickly and without any issues for the resource consumption (processor and memory).
When I test the whole system or just a subsystem formed by two Web Services I can't serve more than 2000 requests/minute.
I also observed that communication time between Web Service is a big issue (sometimes more than 10 seconds). But when testing with only 1000 requests per minute everything goes smoothly (connection time of no more than 60 ms).
I have tested the system both with SOAPUI and JMETER, but the times were computed based on system logs, not from the testing tools.
Memory and network aren't an issue (they are used very little).
Later on, I have tested the performance of 2 communicating WCF web services, hosted on two server and on the same server. It again seems that there is a bottleneck when the services are on the same machine, lowering the number of connection with from ten thousands to thousands; again, no memory or processor limiting.
As a note, I am working with quite big data in some cases and some of the operations needed are long ones.
I used perf.mon to see what's going on, for memory, processes, webservice, aspnet, etc. but I didn't see anything that could indicate what it's going wrong.
I also tried all the performance settings and tuning options I could find on the Internet.
Does someone know what can be wrong? Why the communication between Web Services could last so long? Why the Web Service which serves as an entry point in the system can accept 10000 requests/minute when is tested alone, but when communicating with another Web Service barely accepts 2000?
It's an IIS7 problem? Could my system perform better if each Web Service will be deployed on a different server?
I want to understand better how things internally function (IIS and WCF services) to improve performances for current and future systems.
Answer: You could try to collect data from WCF performance counters : concurrent calls, instances, duration, ... In addition, WCF throttling provides some properties that you can use to limit how many instances or sessions are created at the application level. Performance of the WCF service can be improved by creating proper instance.
Finally, in load testing, there are many configuations to apply to different component : max concurrent http connection, IIS limits, having many load clients... You load test is invalidated because of this.