On which classes of graphs is resource constrained shortest path (RCSP) NP-hard?

Question: I'm looking to link a problem I'm working on to a known NP-hard problem.  I think I can model my problem as a resource constrained shortest path problem.  However, the structure of my graph is not completely arbitrary.  Thus, it will be useful to know when RCSP becomes hard.  Is it hard for a DAG, for a planar DAG, for a DAG with bounded degree?  Any help would be greatly appreciated!
Comment: I don't know if the actual resource is relevant to the hardness result. However, the resource constraint is of the following form.  There are some number (M) of forbidden sets, to which each vertex may belong.  The constraints should encode that the satisfying shortest path doesn't pass through *all* of the vertices in any of these M sets (i.e. if forbidden set S contains k vertices, the shortest path may be adjacent to up to k-1 of them).  Thus, each link adjacent to a constrained node holds that node's contribution to all of its forbidden sets and we seek a SP respecting these constraints.
Comment: Flipping through the literature on the problem, I've noticed a few things:
1) possible alternate names: constrained shortest path (CSP), quality of service routing (QoS)
2) the "standard" problem uses a cost on each edge, and a constant bound on the sum of costs on the shortest path
3) the problem is NP-complete on acyclic graphs
Comment: Does it matter what the resource constraint is ? for example, is it in the form of a "number of links" constraint ?
Comment: This is not constrained shortest path. CSP has a pseudo-polynomial time solution.
Answer: I don't know if you're still interested in this (old) question, and if I understood well the resource constraints you gave in the comment; however it seems that your problem (which is slightly different from usual RCSP problems) is NP-complete for planar (undirected or directed or directed acyclic) graphs of max-degree 3.
The easy reduction is from 3-SAT. Given a formula $\varphi$ with $n$ variables $x_1,...x_n$ and $m$ clauses $C_1,...C_m$:

add a resource constraint set $M_k^+$ with two vertices for each positive literal $x_k$ in $\varphi$ and a resource constraint set $M_k^-$ with two vertices for each negative literal $\bar{x}_k$ in $\varphi$;
start building a graph from a source node $s$ and for each variable $x_i$ split the path in two lines: the upper one traverses one vertex of all the $M_k^-$ that correspond to a negative literal $\bar{x}_k$; the lower one traverses one vertex of all the $M_k^+$  that correspond to a positive literal $x_k$;
then for each $C_j$ split the path in 3 lines that traverse in parallel the 3 vertices corresponding to the literals of $C_j$ and that are picked from the corresponding $M_k^+$ or $M_k^-$;
finally add a sink node $t$.

A path from $s$ to $t$ exists if and only if the original formula is satisfiable (i.e.  without loss of generality you can ask for a path of length $\leq |V|$).
Informally when traversing the variable section $x_i$, if you pick the upper line (true assignment) then you must "use" one of the vertices of all the $M_k^-$ resource constraint sets that also contain a vertex that can be used later to traverse (satisfy) a clause containing $\bar{x}_i$. If you pick the lower line (false assignment) then you must "use" one of the vertices of all the $M_k^+$ resource constraint sets that also contain a vertex that can be used later to traverse (satisfy) a clause containing $x_i$. When traversing each clause at least one of the three vertices must be contained in a $M_k$ that has not be "used" yet (i.e. at least one of them can be used to satisfy the clause).
The following figure should make the reduction clearer. The resource constraint sets $M_k$ are represented with distinct colors (and for every color there are exactly 2 vertices).

$C_1 = x_1 \lor \bar{x}_2 \lor x_3$
$C_2 = x_2 \lor \bar{x}_3 \lor x_4$
$C_3 = \bar{x}_1 \lor x_3 \lor \bar{x}_2$
You can also easily make the graph directed, acyclic and bipartite. Let me know if you need further details (or if I completely misunderstood the problem :-).
As noted by Saaed the problem is fixed-parameter tractable with respect to $k$ (just consider all possible subsets of constrained nodes and for each combination run the shortest path algorithm).
Comment: @Saeed: right, I'll edit the question. I use [yEd](http://www.yworks.com/en/products_yed_about.html) (java app) ... you don't get professional drawings if compared to those produced by tikz (using TikZiT), but you can draw sketches very very fast  (it took me ~5mins for the above).
Comment: Also it's not bad to mentioning that it's FPT to $k$, just consider all possible subsets of constrained nodes. But what is your graph drawing tool? Do you have a suggestion for good and fast drawing tool in linux? (except graphviz or tikz)
Comment: Thanks ;) Many times I need a tool for fast drawing, I think this is quite fine.


Heat when dissolving solutes in water

Question: Why do certain solutes dissolved in water release heat and other solutes absorb heat?
Answer: To understand this phenomenon first we must point out that there are very different solid substances and solvents. Different combinations of them lead to different interactions and properties.
Anyway for the regular case - ionic or soluble compound in water - there is at least two steps to realize the solution:
Edited Answer:

Break the solid structure (eg. the crystal lattice). This step generally absorbs energy (endothermic, see lattice energy);
Solvate the compound. Because there are interactions between matter, the solvent might organize itself around the compound (solvation shell). Those molecules involved are not any more available, they are tied to the compound, they are not any more free water. This step generally releases energy (exothermic, see solvation energy). You can think about this step as a reaction of the solvent to recover form the intrusion by coating the intruder with one or several layers of its molecules. Then it 'feels' if there were only water. You will find details of the complex solvation process in good Physical Chemistry book.

Succeeding these two unit steps leads to dissolution. Solubility is the thermodynamic limit beyond that you cannot dissolve further molecule of a substance. Off course this is related with every substance present in the solution and available free water. Solubility are generally expressed for pure substance only.
When you realize your solution, speaking of heat exchanged with the environment, you experienced the balance between those two reactions. This is why the heat balance can lead to a global endothermic or exothermic reaction.
Comment: Breaking a crystal lattice is endothermic. Solvation is exothermic - talking about enthalpy. Entropy terms then play a role as well. Your answer is good, but it says that breaking the crystal lattice is exothermic, and solvating is  endothermic. Isn't it the other way round??
Comment: Thanks to point out this mistake. I double checked it in Atkins Physical Chemistry. Answer has been edited.
Answer: Enthalpy of hydration is exothermic, Lewis acid-base neutralization.  Entropy of dissolution can be either positive or negative. Negative - ordering effect of ion on solvent is greater than the entropy increase of the crystal (highly ordered) lattice breaking down. Positive - increase in entropy because the solvent hydrogen bonding is disrupted.  Dissolving KOH is a very large exotherm,  Dissolving urea in water is a very large endotherm.  This is descriptive and qualitative,
http://www1.lsbu.ac.uk/water/kosmos.html
We invite the physical chemists to put a quantitative mathematical model on it.
Comment: "Entropy of dissolution can be endothermic" is quite a poor way to word it. Endo and exothermicity are related to enthalpy only, so perhaps you could clarify your sentence? And I'd like to reinforce that the linked site is exceptional. It is definitely one of the most complete descriptions of a single substance I have ever seen.
Comment: Entropy cannot be qualified as endo or exothermic, those terms are for Enthalpy only. Please rewords for the sake of your answer and the exactness of thermodynamic.
Comment: Entropy at J/K-mole is ~1000-fold smaller than enthalpy at J/mole (KJ/mole typical), but temperature takes up a lot of slack.  Water is extremely ordered re its large specific heat via hydrogen bonding, offering a large free energy sink and temperature drop when disordered other than by adding energy as heat.

Heat when dissolving solutes in water


Generating random points on a route

Question: I am trying to generate random points on a route from one point to another. What I have till now is, given a source and a destination, I can get a route using Google's API. But how do I get the coordinates of random points on the route?
Answer: I'm not sure what tool you are using, but look into linear referencing methods.
For example, if you are using PostGIS, here are 10 random points along a linestring:
SELECT ST_Line_Interpolate_Point('LINESTRING (10 20, 50 60, 80 30, 140 60)', random())
FROM generate_series(1,10)

Or if using Shapely:
from random import random
from shapely.geometry import LineString
line = LineString([(10, 20), (50, 60), (80, 30), (140, 60)])
for i in range(10):
    pt = line.interpolate(random(), True)
    print(pt.xy)

Comment: I am using Google JavaScript directions API. Right now, I am planning to use a python sdk and pass the directions data to `shapely`.
Answer: Write a function that returns total length of a route, and another that interpolates a point at an arbitrary distance along a route.  Use a random number generator that generates a random distance d along the route such that 0.0 < d < length and passes it to the second function.

Generating random points on a route


Email signature is set but does not appear in messages I compose

Question: This question: Customize a User's Signature indicates that it should be possible for CiviCRM to automatically include an email signature if one is set for the sending user. I have set a signature set for the sending user, but nothing appears when I compose a message. I know that I can include it in the message using a template or manually insert a token into my email, but this is harder for my users to remember to do. They expect it to "just work" as shown in the above question. What is going wrong here?
Answer: Jeremy,
This was regression error introduced because of change in code. This is now fixed in later version of CiviCRM and should be available in next version. You can either apply the patch or wait for next release.
Answer: Not a direct answer to your question but maybe intersting for many users:
We have developed an extension that provides a set of features for using signatures in CiviCRM.
Please keep in mind that this extension is currently still in beta/dev stage and has an issue when merging contacts.


Looking for Cities population datasets for the state of Arizona

Question: Looking for cities in Arizona especially I'd like to have them with that has population attributes. I've checked Arizona's geospatial websites and none of them I have found.
Does anyone know where I can find them ?
Answer: What about using the TIGER/Line Files consolidated by city? LINK  They are available by state.  FTP is blocked at my current location so I can not link you closer to the actual data.
Alternatively you could use the census block line files and simply aggregate all of the census blocks into whatever unit you liked.  I am assuming that the census blocks follow the city boundaries, which they may or may not.
Not sure how to get links into comments so the edit is in response to the first questions:
It depends on what type of analysis you are looking to do with the data, but in general, polygon to point should not be an issue. ArcMap (Info) has a feature to point tool.  Alternatively, ET Geowizards (free functionality) can handle this.
Comment: I forgot to mention the above is that I rather them to be in point. Would oonvert the polygons to point be a problem ?
Answer: GeoNames will probably be useful. It offers three different Cities datasets as text files. The most detailed includes cities that have population of at least 1,000 or are the seats of an administrative division (e.g. local capitals). Each record includes population and have a single coordinate-pair, so they are easily imported as points.
Answer: Look into the National Historical Geographic Information System; it is an excellent resource to access contemporary and historical Census demographic and geographic data.  You can get any Census enumeration unit you want and select any number of demographic attributes that are easily merged in.  I imagine you'll want the Census-designated places file.
The data are available as polygons, which you can convert using Feature to Point with an ArcInfo license; however if you aren't licensed for ArcInfo there are many scripted solutions floating around the web to do this.  I use this script, others may have different solutions:
<code>import arcpy, os
from arcpy import env
workspace = "Your workspace here"
env.workspace = workspace
inputfc = arcpy.MakeFeatureLayer_management("Your polygon fc here")
projection = "Path to the projection you want here"

arcpy.AddField_management(inputfc, "X", "DOUBLE")
arcpy.AddField_management(inputfc, "Y", "DOUBLE")
rows = arcpy.UpdateCursor(inputfc, "", projection)
for row in rows:
    feat = row.getValue("shape")
    cent = feat.centroid
    row.X = cent.X
    row.Y = cent.Y
    rows.updateRow(row)

del row, rows

env.workspace = "in_memory"

outtable = "temp"
xylyr = "xylyr"
arcpy.CopyRows_management(inputfc, outtable)
arcpy.MakeXYEventLayer_management(outtable, "X", "Y", xylyr, projection)

outname = "points"
outfc = os.path.join(workspace, outname)
arcpy.CopyFeatures_management(xylyr, outfc)
</code>
Answer: Rather than going through Census 2010 data you can see here:
Arizona cities
an database of 2000-2009 population of Arizona cities.
Than you can download from here the urban areas of US and extract only Arizona urban areas. Then you can join the table with the shape in SAGA or QuantumGIS.
Cheers,


How to make bootable pendrive for Kali Linux in UEFI system?

Question: I tried making a bootable pendrive for Kali Linux in order to dual boot Kali Linux with Windows using Rufus on my laptop. I am using GPT drive and UEFI system. But Rufus gives the error that the ISO image does not support efi system. So how do I make a bootable pendrive for efi system?
Answer: Download Kali 2016.1 Rolling Edition it supports UEFI and in Rufus choose the option in which MBR and UEFI are both defined.


Sending coins without wallet just address

Question: My wallet is not working and is not showing I have any amount of money in my account. I have the wallet address and the transaction record showing that the money is in my account. How can I send this money to another wallet to save it?
Comment: This answer to a similar question may help you. https://bitcoin.stackexchange.com/a/67800/71255
Answer: By wallet i am assuming its not on exchange. And by coin i am assuming you are talking of Bitcoin. So if your coins is stored in bitcoin core qt wallet then you can reuse the private key to sign the transaction.
So if my assumptions is correct than you can go to debug console in your QT wallet and type
dumpprivkey XYZ
where xyz is your address which you are saying you know it.
Once you have your private key with you you can use API
1) createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}
2)signrawtransaction  <hexstring> [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...]
3)sendrawtransaction <hexstring>

checkout apis available in Bitcoin to know more.
Answer: To spend a cryptocurrency like bitcoin, you need to sign a transaction with the private keys (which are controlled by your wallet software). Just knowing the address the funds are sitting in does not help you do this, you'll need to get your wallet working in order to move the coins.
Comment: if you are tech savvy, then there is a possibility to find the private key in your corrupted (depending on wallet), that you could then use in another wallet and spend funds from there. Search the forum a bit, there are many entries on lost private keys or corrupted wallets.


When jumping into water, how deep should the water be to survive?

Question: How deep can I go if jumping from 50m?
Comment: This depends a lot on what you do once you're in the water.  For what it's worth, I've jumped into a deep lake from probably 30m high and hit the freezing cold thermocline.  It was shockingly cold and I started to panic because I went way deeper than I expected and swimming to the surface seemed like it took forever.
Comment: Apparantly at around 50m even the pros break bones.  See chart of records in http://en.wikipedia.org/wiki/High_diving
Comment: @BrandonEnright And on a related note, there's also shallow diving (incidentally, this is how I understood the question in the first place): http://en.wikipedia.org/wiki/Shallow_diving
Comment: If you watch underwater camera takes of high divers, you'll see that they quickly "curl" off vertical after going submerged.  As everyone's pointed out, surviving the initial impact is the hard part.  After that,  proper subsurface angling will bring you to a stop in (WAG) 10 meters or less
Answer: First one can get killed even by coming in contact (with speed from high altitude) with the water surface, which at this speed and momentum it appears as a "block of cement" (or more correctly, develop high enough forces to break your bones as per @dmckee's comment).
This depends what wil be the impact surface (that is why seals and olympic divers fall into water with a minimum surface of impact, i.e perfectly vertical).
Then the height (or depth) necessary is found by knowing the altitute of fall, plus the weight of the body. This enables to find momentum at time of impact with the water surface.
Momentum at time of impact plus the buoyancy factor of the water (which depends on amount of salt among others) gives the depth the body will reach. Then the safety depth is that depth by adding a safety margin (if you want an engineering approach and not just physics one)
Comment: This is too simplistic. You are neglecting the work done by the falling body in displacing the water, which will appear at large distances as both body waves and surface waves, plus in uplifting some water above the unperturbed water level. This work is provided by the falling body's kinetic energy, and this portion of KE need not be counteracted by buoyancy any more.
Comment: @MariusMatutiae, you are only partially correct (and by a small amount), in the answer it specifically mentions perfectly vertical impact, as such minimum amount of water thrown off (which in a sea or ocean does not make such a difference). So this is not as simplistic as you would make it seem. If the OP wants to provide specific numbers, specific calculations can be done, else answer follows the spirit of the question. Simple as that but not simplistic.
Comment: Thanks for your comment, Nikos, it illustrates powerfully my concern. You obviously make no distinction between streamlined and non-streamlined bodies (a dish and a pencil of the same weight need different depths) and obviously neglect horizontal water displacement, as if a ship could sail effortlessly into the sea.
Comment: @MariusMatutiae, sorry, dont see how this comes about? who said that a pencil and a dish will have same depth? certainly not me? In any case the answer involves perfectly vertical impact of body, as an olympic diver, feel free to add another answer
Comment: Thank you for your gracious suggestion. There is horizontal displacement of water also for idealized vertical impact.
Comment: @MariusMatutiae, ok no problem, objective is best answer for OP's question. If you dont want to post a new answer, you can make an edit on my post or comment on how to incorporate the  horizontal displacement into this answer. Cheers
Comment: @KyungaDaniellaLeemitless, yes exactly this is how navy seals and olympic divers do dives from high altitudes, but beware after some point even with vertical impact your legs will break
Comment: Aside: I really don't like it when people use phrases like *"it appears as a block of cement"* in these contexts, because they are simply wrong. You get very high forces, to be sure, but the dynamics are nothing like those of hitting a really solid object.
Comment: @dmckee, granted the phrase is more metaphor for the amount of impact to be expected than literal water transformation to cement. Any suggestions welcome
Comment: Not any really evocative ones. I just say "develop high enough forces to break your bones" and leave it at that.
Comment: @dmckee, edited answer to reflect comment
Answer: Assuming you do survive the impact with the water, according to this answer all you need is 4m.


"Approve (of)," "assent," "consent," and "grant"

Question: I wonder if there is any difference in using approve (of), assent, consent, and grant as verbs. Can anyone help?
Comment: Hi, Keerthy
Is it necessary to put 'verb' in the plural form? Or, just express 'as verb' or 'as a verb'?
Answer: "Consent" and "assent" are almost synonymous, and mean "allow" or "give permission for". They generally have to take a noun object, not a clause: "They consented to his doing it", not *"They consented that he could do it".
"Assent" is perhaps more formal in this sense; but in literary use "assent" can also mean "say yes", without necessarily implying permission.
"Grant" also gives permission, but you have to say what permission, or access, or rights are being given. You can't say *"They granted him to do it" or *"They granted him that he could to it", it has to be "They granted him permission to do it" or the like.
"Approve" has two different meanings. Without "of", it means "give permission for": "They approved his plan", "They approved his going ahead with it". It can't usually take a clausal object, so not *"They approved that he did it".
"Approve of" means "like" or "agree with", but has no implication of giving permission, or of the authority to give permission.
Comment: Hi, Colin
According to your explanation, these four words, without considering the syntax or collocation, seem to be synonymous when it comes to expressing 'giving permission'. Is that right?
Answer: "Consent" and "grant" mean that you allow someone to do something, while "approve (of)" and "assent" just mean that you like or agree with what someone is most likely going to do anyway.
Personally, I've never even heard of "assent" before though, and "grant" seems a little more...ceremonious?
Answer: As Google ngram shows (looking for past participles because some of these verbs can also be nouns), assent is the least used of the bunch, with grant and approve leading the pack.


Why do some mutual funds or indexes have an average effective maturity that is way larger (2-4 times larger) than the average effective duration?

Question: I would like to know if this difference occurs when the coupon payments are very large and/or if there are other reasons.
Answer: There are several reasons why the average effective duration might be significantly less that the average maturity:

Use of floating-rate bonds (they have very small effective durations)
Use of derivatives (i.e. bond futures or swaps)
Use of bonds with embedded options (callable/putable)

Any of those can be used to manage duration.


semidirect product of matrix group in GAP

Question: I am new in gap, please accept my apologize because of asking some simple questions. I want to know if we have two general linear groups, is it possible to make the semidirect product of them in gap. I have read GAP semidirect product algorithm and Semidirect Products with GAP.
Comment: Yes, the 2nd argument is crucial for this, and different automorphisms may lead to different products.
Comment: Have you read [Group Products](http://www.gap-system.org/Manuals/doc/ref/chap49.html) from the GAP manual? Have you tried to call `SemidirectProduct`? What happened then? Do you know in which way one group should act on another in the direct product you want to construct?
Comment: I want to compute semidirect product of GL(3,2) and GL(2,2).
Comment: Looks like then you have to use the 3-argument version of `SemidirectProduct` - see my question above regarding the action. You need to be able to answer that to decide what's the 2nd argument...
Comment: according to the definition of semidirect product to compute the G_1 semidirect product G_2 , we need to define a homomorphism from G_2 to Aut(G_1) ? I have no idea about the second argument? Is depends on my case I am working on that. right?
Comment: BTW, you may also try to search GAP Forum archives using [this link](http://www.gap-system.org/search.html)
Answer: Please see the Chapter "Group Products" from the GAP reference manual for further details. In particular, there is an operation SemidirectProduct and you should be looking at its three-argument version. In general, you have to know in which way one group acts on another, since different actions may lead to different semidirect products. In this case, however, there is only one way to do this, since there is only one possible homomorphism from G to Aut(N), and the construction may be seen from the following example:
gap> G:=GL(3,2); N:=GL(2,2);
SL(3,2)
SL(2,2)
gap> A:=AutomorphismGroup(N);
<group of size 6 with 2 generators>
gap> h:=AllHomomorphisms(G,A);
[ CompositionMapping( [ (5,7)(6,8), (2,3,5)(4,7,6) ] ->
    [ IdentityMapping( SL(2,2) ), IdentityMapping( SL(2,2) ) ],
     <action isomorphism> ) ]
gap> Length(h);
1
gap> SemidirectProduct(G,h[1],N);
Group([ (9,10), (8,10,9), (4,6)(5,7), (1,2,4)(3,6,5) ])

But now let us look at the homomorphism h[1] - it maps each element of G into the trivial homomorphism of N. So, what you get here is just a direct product of the two groups:
gap> Image(h[1]);
<group of size 1 with 2 generators>
gap> Size(last);
1
gap> StructureDescription(S);
"S3 x PSL(3,2)"
gap> StructureDescription(DirectProduct(G,N));
"PSL(3,2) x S3"

BTW, you may also try to search in the GAP Forum archives using this link.


How does maths consistency impacts on computer science?

Question: Lot of mathematicians have made several efforts to answer the question : are mathematics consistent ? Although we haven't yet had a proof of consistency, and surely we will never (Gödel second theorem), does this question has an impact on computer science ? I mean, does the work of those mathematicians, like Gödel's theorems or formal deduction systems, shows new answers or new problems in computer science ? What would happen in computer science if, for example, we found a paradox in set theory ?
Comment: It may be worth noting that computer science largely evolved out of work in formal logic, often related to these questions. For example, Turing's work but also Church's and Kleene's.
Comment: In CS say almost every problem reduces to "does this program terminate or not", which is a $\Pi_0$ sentence in arithmetic. If your theory of arithmetic is inconsistent, your theorems go wrong, and after that you can only run a program until it terminates, you can't prove (non)-termination in any other way.
Comment: To prove a program terminates or not : you can run it until it terminates, or use an axiomatic theory of arithmetic to find a proof it terminates (or a proof that it doesn't terminate). If your axiomatic theory of arithmetic is inconsistent, and you try anyway using it to prove theorems, things will go wrong (you will be able to prove a given program which does terminate, doesn't terminate)
Comment: @reuns Can't we prove (non)-termination if arithmetic were inconsistent because of Π0 sentences, or because inconsistency of arithmetic would lead to inconsistency of stronger theories, like ZFC ?
Answer: Absolutely nothing will happen. Computers will still work, experts in machine learning will continue perfecting their tools, and even theoretical computer scientists will go on happily proving their theorems. Most mathematicians will also not feel much difference.
While we are trained to think that we are carrying out our proofs in ZFC, in practice proofs in mathematics and computer science are almost always carried out in English. Even if a contradiction is discovered in set theory, it is extremely likely that the axioms can be amended in such a way that the contradiction disappears and no proofs are affected apart from those in very specialized fields of a foundational nature.
More controversially, one can argue that most mathematicians argue in a nebulous system which actually does not rely on ZFC at all. Indeed, the average mathematician and nearly all computer scientists have little recourse to ZFC during their research life. Making this claim less nebulous, one can (and people do) argue that virtually all proofs in non-foundational fields can be carried out in weak subsystems of ZFC that are in less danger of being shown to be inconsistent. A nice reading in this general direction is McLarty's What does it take to prove Fermat's last theorem.
Comment: +1 [Reverse mathematics](https://en.wikipedia.org/wiki/Reverse_mathematics) is a field that directly addresses finding what assumptions are needed (from one perspective) for representative theorems/areas of mathematics. And, of course, constructivists (even those with no philosophical qualms with classical logic) often work in much weaker logics (though still quite powerful in their own way). (Internal languages of) [pretoposes](https://ncatlab.org/nlab/show/pretopos) provide another perspective on sliding scales of foundational power.
Comment: I will say though that "absolutely nothing" is a touch strong. A contradiction found in ZFC is likely to at least cause concern for type theorists which is intimately related to much of programming language theory. PLT is at least close to a "field of a foundational nature". Design of type systems is already colored by the contradictions found in naive set theory.
Answer: This would have a huge impact on computer science. All of CS is either a branch of mathematics, or built on the foundations of mathematics.
Every algorithm correctness proof or complexity bound is proven using mathematics. An inconsistency would shake the field to its core.
Moreover, through the Curry-Howard correspondence, proofs are isomorphic to well-typed programs, so a ton of type theory would go out the window.
That said, there is hope. There are multiple foundations of mathematics: ZF set theory, ZFC set theory, Martin-Lof Type Theory, Homotopy Type Theory, etc. Much of Computer Science has been done in all of these theories (particularly in PL theory), so if one is proven inconsistent, it may not mean that all is lost.
Comment: While it would certainly be a big deal, I'm pretty sure this would have little impact on the majority of math, let alone CS. It's empirically clear that a lot of computational aspects of math (again, let alone CS) "work". This alone would already be a basis on which to found a non-trivial chunk of math and CS, particularly the practical aspects. It's not like the contradictions found in naive set theory led us to discard all, or really any, preceding math. Even the things that were demonstrably inconsistent, such as "infinitesimals", were later rehabilitated.
Comment: @dylan61 I think you're referring to the principle of explosion. Yes, in most logical systems if you have a contradiction, then you can prove anything. (Systems where this doesn't happen are called paraconsistent logics.) However, if a contradiction was found in, say, ZFC, mathematicians would simply switch to a different system omitting the aspects that caused the contradiction just like they did in the move from naive set theory to ZFC. As jmite pointed out, there are already several other possibilities that can recover much of math in practice, and often *are* the systems used in CS.
Comment: @dylan61 They would technically need to reprove the theorems, but as many of the theorems aren't even close to formal in the first place, as long as the new system is roughly similar to the old one, at least for the parts used for a particular theorem, they likely wouldn't do anything. It would just be assumed that the theorems would transfer over to the new system. There will be some results in "day-to-day" math that would skirt near the source of the contradiction which would need to be more closely reconsidered.
Comment: Any realistic contradiction found is likely to be found in some esoteric aspect that affects few mathematicians. Ironically, PLT *is* likely to be one of the more impacted areas of CS.
Comment: @DerekElkins Aren't maths aspects so tied that even an esoteric contradiction would lead to the destruction of everything ?
Comment: @jmite Thank you for this answer. I don't know about the theories you quoted (expect ZFC), can you give me examples of works that have been done in those theories ?
Comment: @DerekElkins Alright, i understand. If mathematicans, particularly computer scientists, needed to switch to other systems, would they reprove theorems, or redo some work that has already been done ?
Comment: "a ton of type theory would go out the window" -- I'm unsure about this. Even if, say, ZF(C) turns out to be inconsistent, type theory is based on constructivism, which could be unaffected by that. Surely we lose e.g. some normalization / consistency metatheorems since they are done within ZFC, but this does not mean that the type theory is inconsistent. Can you elaborate?
Answer: Let's assume that maths is inconsistent, and there is a proof that 1 = 0. Using that proof, you can prove that the runtime of any algorithm is zero.
That proof, however, doesn't change the runtime of the algorithm. So we would be in a slightly problematic situation: That we cannot use or trust proofs that are so complex that they can take advantage of this inconsistency. I think it is only very slightly problematic.
Comment: It doesn't change the runtime of the algorithm *on known inputs*. The problem is, there's know way to experimentally know the runtime on every input. So we use logic and proofs to find general formulas. But if the logic is shaky, how can we trust the formula?
Comment: Existing proofs are fine as long as they do not contain a contradiction. And a proof for (a and not a) would be massive. Meanwhile sorting required O(n log n) comparisons even if you prove it takes zero.
Answer: I think that the other Debaters answered the question concerning an impact of the consistency of mathematics on computer science.
But I have some comments to the following sentences:

Lot of mathematicians have made several efforts to answer the question : are mathematics consistent ? Although we haven't yet had a proof of consistency, and surely we will never (Gödel second theorem), does this question has an impact on computer science ?

Namely, I recommend the paper: T. J. Stepien, L. T. Stepien, "On the Consistency of the Arithmetic System", J. Math. Syst. Sci., vol. 7, No.2, 43-55 (2017); arXiv:1803.11072. There in this paper a full proof of the consistency of the Arithmetic System was published. This proof had been done within this Arithmetic System (of course, on the silent assumption that first-order logic is consistent).


How to Deny Root, Allow Specific Users on internal subnet, and Allow Groups from external, On SSH/SFTP

Question: In Centos 7,
What should our sshd_config look like to:
Deny Root AND Allow Specific Users(not in group) on internal subnet, AND Allow Groups from external?
Question is very specific!
Result we want: External ssh/sftp connections for our customers to land in their own Home/Root directories specific to them.
But do not want employees to access from external, only from internal subnet. Because employees have greater access to folder structures.
These are the configs we have been using, but they do not work nor do they make sense as the documentation does not elaborate enough.
1.This Config should allow bob and trev internally, and allow sftpgroup.
Instead it Allows the sftpgroup but does not allow other users:
(bob trev are not in the group)
Match Address 192.168.1.0/24
        AllowUsers bob trev
Match All
AllowGroups sftpgroup
PermitRootLogin no

Documentation says these commands are processed in this order: DenyUsers, AllowUsers, DenyGroups AllowGroups.
2.So if they are processed in this order then the below should work but it does not (bob and trev have no access), so what is the point of ordered processing, if the later command does not overide the previous. shouldn't it Deny All and then allow specific users. but it does not. I feel like either this is buggy or the documentation is incomplete.:
DenyUsers *
Match Address 192.168.1.0/24
        AllowUsers bob trev
Match All
PermitRootLogin no

The Match Address Command works I have tested it.
Answer: This is the config edits to sshd_config that delivers the desired result in the Question.
Allows specific Users Internally, Allows specific Group Externally,
but denies Groups Internally and Specific Users externally:
Match Address 192.168.1.0/24
        AllowUsers bob trev
Match Address *,!192.168.1.0/24
        AllowGroups sftpgroup
Match All
PermitRootLogin no


Can cinnamon rolls be frozen after they are shaped?

Question: Can you freeze cinnamon rolls after they are shaped? Also, about how long does it take for the dough to come to room temp?
Answer: I would use parchment or wax paper and then aluminum foil wrapped tightly around the pan when freezing. Do not freeze more than 2 weeks in a regular freezer as they may develop freezer burn taste. Then, instead of letting them come to room temp, I would warm them in an oven for 15-20 minutes and then ice/frost them.


Overnight Index Swaps (OIS) vs. Fed Funds Futures

Question: When calculating the probability of a certain target rate specified by the Fed at an FOMC release, I've generally read that it is typical to use Fed Funds Futures as proxies. I can find data on this on the CME's website. Bloomberg also has functionality to perform this calculation, but they use OIS's to estimate the probability. When comparing the two methods for a given FOMC meeting date, they give fairly similar, but not super close answers, say in the range of 5%-10% max difference. What is the theoretical basis of using OIS's is, as opposed to Fed Funds Futures? Is one more correct? Any source material is appreciated.
Comment: it is not clear to me why futures are used here. I've seen something similar, but use options to imply the rate's probability distribution. Regarding OIS and Fed fund Future, one is compounded rate and the other is an average rate, but the underlying rate are both the overnight rate
Comment: Here's a good link explaining the use of Fed Funds Futures for rate probabilities. I imagine OIS logic is similar, but don't know what market dynamics/conditions make the resulting probabilities different. https://www.economics-finance.org/jefe/fin/KeaslerGoffpaper.pdf
Answer: I think you have a little misunderstanding.  OIS just means the rate for fed funds.  Usually people are referring to "FEDL01 Index" on Bloomberg.  That's the VWAP of trades for the previous day in Fed Funds with participants lending to each-other.  That's all in the past.  That tells you nothing about the future.
The Fed Funds futures settle to the average over the reference month for FEDL01.  That's forward looking.  If you are looking at what the current market thinks Fed Funds will be at point X in time you have to navigate the Fed Funds futures.
I'll show you here the Fed Funds futures market right now:

And here's Bloomberg's use of these futures to calculate future rate path:
Comment: Oh, I'm not familiar with the CME FOMC watch tool.  But the Bloomberg methodology on WIRP is correct.  The CME tool might have a day count problem.  Given that we know the history of FED01L until today it's pretty provable.  I've validated Bloomberg's methodology myself many times.
Comment: This is not quite what I was talking about. I was referencing the  functionality in Bloomberg, but trying to make the question general enough to be answered by non-Bloomberg subscribers. I appreciate the help though! So as a Bloomberg user, I can rephrase: why does Bloomberg's  command calculate different probabilities than the CME's FOMC Watch Tool?
Comment: That's good enough for me! I'm still interested in why there is a difference, but for practical purposes, I wanted some confidence in choosing one or the other to follow.
Answer: All above is correct. Just adding my 2 cents as the former PM for WIRP...
These days Bloomberg's WIRP uses both Fed Funds Futures (US-Fut) and OIS (US-OIS) to back out the interest rate expected after a meeting. It then uses this forward interest rate in comparison to the prevailing target rate to estimate how much of a hike and or cut is 'priced in' to either market -- futures or OIS.
Both WIRP and CME's FedWatch used to try and estimate the 'probability' of a hike or cut but this was largely fiction, as the underlying probability distributions in these markets cannot be known (outside of Eurodollar options which were a proxy that was losing comparability by the day).
Differences between WIRP and FedWatch currently are that WIRP acknowledges that a probability can't be bootstrapped from the data, while FedWatch ignores the same. In addition FedWatch assumes that the interest rate will change on the day of the announcement (incorrect), while WIRP assumes that the rate will change the next day (correct). Finally, and likely the most biasing factor, is that FedWatch pushes the data through a conditional probability matrix that assumes a known distribution. Again, the data don't support this.
Differences between OIS and FFF on WIRP center on the assumptions that need to be made for the forward rate calculations. OIS is based on weekly and or monthly tenors, and often require the current Fed Funds rate to calculate (which, given the state of the market, can bias the output). FF Future's data is based on the average FF rate expected to prevail for the rest of the month and can be a cleaner read in calm markets (more volume).
If you're ever wondering which forward rate is more accurate (FFF or OIS), try comparing them to benchmarks like USS0FED1, 2, n. The WIRP data will lead, but they should be close.
See the WIRP help docs for more info.


Can explorers choose not to move?

Question: Can explorers choose not to move? So instead of rolling dice or playing an action can a survivor skip their own turn so they don't leave a room? One example would be to stay in the mystic elevator and then each turn use the mystic elevator to travel around the house.
Comment: You should break this up into separate questions for better answers
Comment: I've removed your second and third questions. They don't seem intrinsically related to the one I've left behind, and should be asked separately in their own questions. You can still retrieve their content in your [revision history](http://boardgames.stackexchange.com/posts/23755/revisions), which you can access by clicking the 'edited X time ago' link at the bottom center of your post.
Comment: Mind you, the second question about being able to not move monsters may be related, if you believe the same rules may be involved. (I don't play this game.) If it seems intrinsically related - i.e. makes no sense to answer just one and not the other here - add it back. Otherwise, you are requiring people to answer two unrelated questions, which mainly just cheats you out of a good answer if someone knows the answer to one but not the answer to the other.
Answer: Yes, you can choose not to move. The rules on movement state:

Moving
On your explorer's turn, you can move up to number of spaces equal to your character's
current Speed.

"Up to" includes 0 spaces.
Note that if you stay in the elevator for your entire turn, then the elevator will move again. From the FAQ:

Heroes must roll for their destination floor each time they enter the elevator, or at the end of each entire movement phase that they spend in the elevator without moving.

Can explorers choose not to move?


Want to import an STP file to blender with colors

Question: I want to transfer a CAD model to blender. It is in STP format. It has colors applied to it and I want the model along with the colors to be imported to blender. I am using "FreeCAD v0.15" currently to view the STP and to convert to other formats(STL,dae,obj),but unable to export to blender with colors. Anyone know of other methods that can do the job? Thanks in advance!
Answer: According to FreeCAD's Key Feature's it looks like you could just export to OBJ, DAE or IFC.
OBJ & DAE are natively available import options in Blender.
IFC does have add-on support in Blender, but from what I can tell it's last compatible version is 2.73 (add-on found here). If, howvever, you get the latest from IfcOpenShell's Github repo, they have updated the plugin for Blender 2.80. Blender also now has an IFC exporter which supports recording colour information in IFC format as part of the IfcOpenShell package (v0.6.0 branch).
If these aren't working as expected, then you should be digging further into FreeCAD's export options.
Answer: STL files only contain geometry information there is no way to export a STL file with color or texture.
However, if you can find the location the software you are exporting from has the texture file, (if it's a bitmap) you can import the image separately and set it as a blender material texture.


Are there any ways to force DNA-origami to create a geometric shape from non-nucleotides (not from DNA)?

Question: I mean, can we create with the help of DNA-origami figures that would not consist of DNA, but, for example, carbon? Is it even possible?
Comment: Can you explain your question in more detail, and link to the relevant study you mention? Carbon can be made into a geometric arrangement called fullerene, for instance, but that may be different than what you're asking. https://en.m.wikipedia.org/wiki/Fullerene
Comment: Using DNA-origami, we can get various nano-objects of the desired shape. Such objects consist of DNA. I ask, can we in theory with the help of DNA-origami get nano-objects that will not consist of DNA, but some other specific atoms, gold, carbon, etc?
Comment: Welcome to Biology.SE! Are you asking whether the folding of DNA in "DNA origami" can be used to manipulate other nanomaterials?  Or did you mean whether DNA structures can be used as a scaffold to pattern other nanomaterials? Something else? Please edit your question to clarify and add links to relevant papers.  ——— You may also benefit from taking the [tour] and then consulting the help pages for additional advice on [Ask] questions effectively on this site and then edit your answer accordingly. Thanks!
(Also note that DNA contains carbon — did you mean graphene or something similar?)
Answer: I interpret your question to ask this:
Can DNA origami be used as scaffolds for the guided assembly of other non-DNA structures?
Yes.  From what I've read, two- and three-dimensional DNA structures can be used for nanoparticle assembly and as a nucleation factor in the crystallization of proteins and minerals.  You can find these examples and more in a lengthy review from 2017.1  Specifically, read section 6.6, Programming the Structure and Conformation of Non-DNA Materials.

Fan Hong, Fei Zhang, Yan Liu, and Hao Yan. DNA Origami: Scaffolds for Creating Higher Order Structures. Chem. Rev. 2017, 117, 20, 12584–12640.


How does the museum get cleaned?

Question:
In Night At The Museum, the exhibits in the Museum of Natural History come to life and wreak havoc every evening. We see them causing extensive destruction on several different nights. However, sometimes this damage seems to be magically repaired, and goes unmentioned by the daytime staff of the museum, and on other occasions, the museum is left in a terrible state. Is there some explanation for this, or is it merely sloppy plotting?
Answer: There is nothing mentioned about how museum get cleaned every night after destruction but for the cleaning of destruction done in the end done by retired night guards.

Cecil, Gus, and Reginald are forced to become museum janitors to evade
  being sent to jail for their crimes. -  (Source :Wikipedia)

The same confirmation has been provided on IMDb So who cleaned up the mess in the Museum lobby?
Comment: The question is about the period before Cecil, Gus, and Reginald get busted. Sometimes, the museum seems to be perfect by opening, and sometimes it isn't.
Comment: @MichaelStern then we can wait for some better answer. Anyways will try to improve it later if got any information.

How does the museum get cleaned?


Can't charge or use my computer

Question: I have a EEE pc.  It won't turn on.  The blue power light on the adaptor turns on but I'm unable to charge the computer.
Comment: Does the screen flicker/any lights at all go on?
Answer: Without more details, I'd say the most likely bet is that your DC power connector is faulty. Did anything happen that may have damaged it (tripping over the cord, etc)? You might try to see if you can borrow a compatible power supply in order to verify that it is the Eee that is faulty and not the power adapter/power cable.
Answer: There could be something going on with the battery. The electrical circuit goes through your battery and if that circuit is messed up for any reason, re-seating the battery could fix it. If this doesn't fix it, I would have to agree with @jcrawfordor.
I have had this issue with a Lenovo T510 at my work before. I simply turned the laptop off, took out the battery, placed the battery back in the laptop, and turned it back on. Everything was fine after that.

Can't charge or use my computer


Two people having wronged one another in different occasions

Question: Person A wrongs person B, the case ends up it courts and then, for a whole different reason and in a whole different scenario, B wrongs A in a way which is worthy to make the case end up in court as well.
Can it possibly be that another and indipendent case from the first one will be opened up in court or will it influence the reputation and the fate of B winning the first case in which he's a victim? I mean, can these scenarios merge in a single case?
Jurisdictions: U.S, Belgium and Italy.
Feel free not to answer for all the 3 jurisdictions, and it would be a pleasure if three different users answer for each jurisdiction.
Comment: Are you really asking about criminal law as the tag indicates? The question sounds like one about a lawsuit brought by one party against another. The mechanics are very different in criminal prosecutions and in lawsuits by one party against another (which are governed by civil procedure).
Comment: I didn't know that the case I asked about had 2 different sub- scenarios as well.
Comment: FYI. Belgium and Italy should be almost identical in this respect. Both have civil codes derived from the Napoleon's Civil Code as opposed to the moderately different civil codes of Germany and Spain. Italy differs more from France than Belgium, but it is unlikely that there would be a material difference on this point.
Answer: In the United States, the answer is that B would probably get to decide whether to litigate the new claims separately or as part of the first case.
When someone A sues B, and B sues A back, B is bringing what we call a "counterclaim." In federal courts, this situation is governed by Rule 13 of the Federal Rules of Civl Procedure (the rules are roughly the same in most state courts):

(a) Compulsory Counterclaim.

(1) In General. A pleading must state as a counterclaim any claim that—at the time of its service—the pleader has against an opposing party if the claim:

(A) arises out of the transaction or occurrence that is the subject matter of the opposing party's claim; and
(B) does not require adding another party over whom the court cannot acquire jurisdiction.

(2) Exceptions. The pleader need not state the claim if:

(A) when the action was commenced, the claim was the subject of another pending action; or
(B) the opposing party sued on its claim by attachment or other process that did not establish personal jurisdiction over the pleader on that claim, and the pleader does not assert any counterclaim under this rule.

(b) Permissive Counterclaim. A pleading may state as a counterclaim against an opposing party any claim that is not compulsory.

The generally rule, then, is that if A's claims and B's counterclaim are about the same issue, B is required to file a counterclaim. These are called "compulsory counterclaims." Besides these, B is also "permitted" to bring claims that are not about the same issue. These are called "permissive counterclaims."
You're asking about a situation where a counterclaim arises "for a whole different reason and in a whole different scenario." In that case, the counterclaim would be considered permissive, so most jurisdictions would allow -- but not require -- B to present it as part of the litigation that A filed.
This means that the two lawsuits could become a single lawsuit, or they could be separate lawsuits. If they were maintained as separate lawsuits, the court should take steps to ensure that jurors in each case are unaware of the other, thus limiting the effect of either case on the other's outcome.
Comment: Ok, but if the lawsuits merge into a bigger one, then only one person will eventually pay for their own mistake, while the other will get away with their own one. I don't know whether there are any jurisdiction in which an ulterior wrong doing against the perpertrator would result in the right in them having the ultimate right over the victim of the first case, and hence, changing the latter as a perpetrator themselves, and hence again, erasing totally the rights that the victim of the first case had over the perpetrator of such case.
Comment: If B can decide whether to settle this as a merged litigation or not, it's more likely than they will chose to merge them because they have more chances to win the litigation altogether, without paying the consequence related to the first case, or they can also decide not to merge in order to have the chance to win at least one case and not losing the one supposedly merged, which will result for a injust loss for them as well, since they're going to lose with having undergone a wrongdoing.
Answer: Some general principles without details or authority (which I will look up if I get a chance to cite chapter and verse):
Civil Cases
In The U.S.
Person A wrongs person B, the case ends up it courts and then, for a whole different reason and in a whole different scenario, B wrongs A in a way which is worthy to make the case end up in court as well.

Can it possibly be that another and independent case from the first
one will be opened up in court or will it influence the reputation and
the fate of B winning the first case in which he's a victim?

When A sues B, and B has unrelated claims against A, then in common law jurisdictions, B has a choice. B can file unrelated counterclaims against A, or B can file a separate lawsuit. This risk involved in filing a separate lawsuit is that a later judge may decide that what looked like completely different facts to B actually involved a common nucleus of facts, in which case the separate lawsuit could be dismissed with prejudice if the first lawsuit produced a final judgment first.
If counterclaims are filed, any judgment for A is setoff against any judgment for B, resulting in a single net judgment.
If separate lawsuits are filed, and one produces a judgment for A against B and one produces a judgment for B against A, A can use the judgment against B as a credit to pay the judgment for B against A to the full extent possible. But, this would ordinarily be done via a writ of garnishment rather than via a setoff when the judgments are entered, because the judgments will not ordinarily be entered in both cases at exactly the same time.
The outcome of the A v. B case will only impact the outcome of the B v. A case when there is factual overlap between them in common law jurisdictions. Whichever case results in a final judgment on the merits first will bar all claims arising from the same general nucleus of facts that are present in another pending case. This is called "res judicata". Also, the specific conclusions of fact and law reached in the first to be decided case will be controlling as to the conclusions of fact and law necessarily decided to reach the outcome in the first case, if those issues are also presented in the second case.
But, since the key issue is when a final judgment is entered, not infrequently a simple lawsuit that is filed later will produce a final judgment before a more complicated lawsuit that is filed first.

I mean, can these scenarios merge in a single case?

Most countries have a procedure for consolidating cases involving the same parties under some circumstances. In Colorado, where I practice, there is a simpler procedure if all the cases are pending in the same court, and another more involved procedure involving a panel of the state supreme court, when the cases are pending in different courts. The federal courts in the U.S. also have such a process.
But, usually cases with the same parties will be consolidated only if they involve a common set of facts and circumstances.
In Belgium and Italy
Belgium and Italy should be almost identical on these issues respect, but I don't have a deep familiarity with either of them.
Both have civil codes derived from the Napoleon's Civil Code as opposed to the moderately different civil codes of Germany and Spain (almost all of the civil codes in the world has the civil codes of one of those three countries as a starting point). Italy differs more from France than Belgium, but it is unlikely that there would be a material difference on this point.
Criminal Cases
In the criminal law, any country with jurisdiction over a crime can prosecute it.
In common law countries (e.g. the U.S., England and Wales, Scotland, Norther Ireland, Ireland, Canada, Australia, New Zealand, to a lesser extent India, Pakistan and Bangladesh, and various U.K. territories), the usual rule is that all prosecutions by a single government (e.g. the federal government, or a particular state government) against the same defendant involving a single criminal episode in which multiple crimes were committed must be prosecuted in a single case with a single trial for that defendant.
But, if more than one criminal episode is involved, each may be brought as a separate criminal case with a separate trial in the respective courts with jurisdiction over the places where the crimes happened. So, if there is a car jacking in Denver County, a pimping operation in Mesa County, and a murder in Garfield County, all involving facts independent of each other, then there can be three separate cases against the defendant in three different counties.
If all of the crimes against a single defendant were committed in places that are in the jurisdiction of the same court, the prosecution could decide to try all of the outstanding cases in a single case with a single trial, but the defendant could usually object to this and have the case split up if presenting multiple unrelated charged would prejudice the decision making process on each individual count (e.g. by making the defendant look like a serial offender despite having no prior convictions of any kind).
The details above may not be precisely the same in Belgium and Italy, but they would be similar.
In criminal cases, A's wrongs to B never offset B's wrongs to A (except in the case of affirmative defenses such as self-defense involving the same incident). In terms of legal theory, this is because a criminal cases is not brought on behalf of a particular victim of the crime. Instead, it is brought on behalf of "The People" because that person violated a state or federal criminal law. If A criminally victimizes B, in the criminal law context, A harmed the People once. If B criminally victims A, in the criminal law context, B also harmed the People once. Two harms to the People don't cancel out and both can be prosecuted by the prosecuting attorney's office, usually in different court cases if the facts are unrelated.
This is legal theory would be mostly the same in common law and civil law countries. Some common law countries and some civil law countries allow victims of minor crimes rather than the state to prosecute these crimes in some circumstances, but that isn't terribly common in practice even in the minority of jurisdictions where it is permitted. And, even then, two wrongs don't make a right and both parties who committed criminal wrongs can be prosecuted independently of each other.
This said, it wouldn't be terribly uncommon in the U.S. for plea bargains to effectively cancel out criminal charges by dismissing charges against both parties when both parties committed crimes against each other, even though this is not recognized as a formal legal rule.


Why heavy elements don't sink to the core?

Question: If earth assembled out of space dust, how come we find heavy elements like gold, silver, uranium and bunch of others that are heavier than iron on the surface?
 I mean silicon (Si mass 28.084) being the crust makes perfect sense as it is lighter than iron (Fe mass 55.845).
   Shouldn't heavy elements been sank by gravity to the 'bottom' of the Earth when it was only starting to become a planet 4.54 billion years ago?
Comment: this question is more appropriate for the Earth Science Stack Exchange
Comment: This question is on-topic here and *can* stay, but it might very well find a better set of answers on Earth Science and I'll migrate if @LIUFA asks.
Comment: @dmckee Question already has answers, I believe it is best if it stays here. Thanks.
Comment: Quite good answers, too.
Comment: Am I the only person who's wondering if these two answers commute at all? I mean, they look good independently, but how do we tie them together to make a consistent picture?
Answer: The key to answering this question is the Goldschmidt classification of elements. Thirteen of the long-lived elements are siderophilic; they preferentially bind to iron. Those thirteen elements are significantly depleted in the Earth's crust compared to their prevalence on meteors, asteroids, and the Sun.
This list of thirteen does includes rhenium to gold, but it stops at gold. Eighteen of the long-lived elements are chalcophiles; they readily bind with a chalcogen other than oxygen (e.g., sulfur). Copper and silver, along with mercury to polonium fall in this category. These chalcophilic elements have a reduced tendency to migrate toward the center of the Earth because of their greater affinity for combining with lighter elements.
That list of thirteen siderophilic elements also does not include the lanthanides or actinides. These elements, along with a number of lighter elements, are lithophiles. The lithophiles have a very marked tendency to combine with oxygen, and with other lithophiles. These lithophilic elements have an even more strongly reduced tendency to migrate toward the center of the Earth than do the chalcophiles.
Answer: Actually, they are still currently sinking to the core. Earth's internal heat comes from a number of sources, and one of these is the release of gravitational energy from the heavy elements migrating further toward the center. A similar statement holds for other planets. This isn't the majority of the source of heat. Other sources are the original thermal inventory, and also radioactive decay. The intensified stratification of heavy elements toward the core and lighter elements toward the surface comprises a non-negligible source of heat, but still much smaller than those other sources.
However, this movement is generally happening in the mobile parts of Earth's center. Our planet's mantle has circulation currents, and I think we should call this a requirement for the separation process to happen. Of course the elements are significantly mixed together. It's only over very long time frames that the process happens.
Consider a lattice of atoms. With just about any material selection you make, the chemical bonds strength will vastly dwarf the buoyancy difference between different atoms of molecules. So we might wonder why the materials ever stratify, but this is because things get shaken up. Consider a pile of sand, where some grains are heavier. An undisturbed pile should have no tendency to stratify. However, if you shake it up for a long time, the heavy particles will move toward the bottom. The thermal flux from Earth's internal heat is the force that "shakes up" its elements.
Interestingly, the Earth's core and crust have their own unique reasons for being relatively stable... although not completely stable. The core has little thermal driving force behind it, because most of the heat production term comes from layers at larger radii. This promotes a very static state in the center. The crust is cooled to temperatures much lower than the interior, and generally rock is stable and solid here. Now both of these should come with a good deal of qualifiers. Obviously volcanoes shake up the crust, and the fact that I'm tying this exemplifies the fact that things do move on Earth's surface occasionally.
But exactly how stratified is Earth now? The density and gravity field strength follow directly from each other. It's not hard to get some data on this.

Here, you can see the density plotted over the Earth's radii. It is sloping very heavily, and the core is very dense, like Lead, but heavier. I find that impressive, but it could still get further stratified.
So let me present an alternative question: since the density of Uranium is around 19 g/cm3, why don't we get a pocket of pure Uranium at the center? Well there's just no mechanism to do that because nothing is shaking up the crust, and the driving force putters out to nothing toward the center.
Comment: As related in @DaveHammen 's answer, there are the affinities of the elements to consider, *ie*, what compounds and solid solutions do they form. After some of that is sorted out, then the relative densities and environmental stabilities of those compounds and solid solutions can be considered within the paradigm of your answer.
Comment: The density of the core is mainly a matter of pressure, not one of elemental composition. I would also think that the actual equilibrium distribution has to take the solution phase diagrams into account. Do we know those for heavy elements in nickel and iron?
Comment: @CuriousOne That's true, and I was walking a thin line with the comparison. The values for density should be considered "vacuum" values, constituting a minimum. While pressure increases density, the core under pressure is still less dense than Uranium metal in free space. The fact that densities combine in a non-linear fashion also obviously blows up the complexity, but I have no particular insight to share on that matter.


Restarting a 2D game

Question: I'm having trouble restarting a 2D game when the user presses the "New Game" button.
Structure of my game:
The game has several 'screens': Opening screen, instructions screen, main game screen, and a game-over screen.
Each screen is an instance of a class: OpeningScreen class, GameScreen class, etc.
There is a class named Main. This class has three roles.

It's the JFrame (the window) of the program.
It has the main method - first class to run.
It has a method that change's screens.

When the program starts, this class runs. When it first runs:

Creates a new instance of itself (it's a JFrame-type class).
Creates an instance of every 'screen-class'. The constructor of each 'screen-class' takes the instance of Main as an argument: (aka: GameOverScreen gameOverScreen = new GameOver(this)).
Creates a new JPanel named mainPanel, and adds it to the JFrame. Any screen to be displayed will be contained in this JPanel (The screens are also JPanel-type classes).

How the changeScreen() method works:
The signature of changeScreen() is this: changeScreen(JPanel from, JPanel to).
Whenever a screen needs to be changed, the current screen that is displayed calls this method, like so: main.changeScreen(this, main.InstructionsScreen). It removes the previous screen from mainPanel and adds the new screen to mainPanel. As said, these screens are created when the program launches.
This is the method that changes screens:
public void changeScreen(JPanel from, JPanel to){

    mainPanel.remove(from);
    mainPanel.add(to);

    mainPanel.revalidate();
    mainPanel.repaint();

}

My problem:
After a game is finished, the Game class calls the changeScreen method: main.changeScreen(this, main.GameOverScreen) .
This replaces the game screen with a game over screen.
Pressing the "New Game" button in the game-over screen, calls main.changeScreen(this, main.GameScreen) .
The problem: Pressing the "New Game" button in the game-over screen, indeed displays once again the instance of the Game class. But this is the old instance, so the game is not restarted. It's already finished.
I tried to do the following changes in changeScreen():
public void changeScreen(JPanel from, JPanel to){

    mainPanel.remove(from);

    if(to.equals(gameScreen)){
        gameScreen = null;
        gameScreen = new GameScreen(this);
    }
    mainPanel.add(gameScreen);

    mainPanel.revalidate();
    mainPanel.repaint();

}

This should reset the gameScreen object.
But this creates a delay of about 10 seconds when pressing the "New Game" button.
What would be a good way of restarting the game?
Thank you
Answer: You have to remove the child/instance. Guessing this is Actionscript 3 you should do removeChild and then make the child null. Try that out.

Restarting a 2D game


Process of water-bath food to pressure cooker?

Question: My daughter water bathed carrots and beets and then found out that they should be pressure cooked.  Can she just put them in as they are and pressure cook them, or should she start over the whole process of cleaning jars and new lids?  Will the food be too overcooked to process them again?
Answer: Ok. I've canned for 30 years. If the beets are pickled they are fine as long as they "popped". The vinegar acidity makes it fine for water bath. I've canned carrots using a pressure canner to "recommended" times. They were a disgusting mush. The only thing I pressure can now are meats and fish. Veggies I just sterilize the jars, cold pack the veggies, add boiling pickle juice or water, seal and then water bath process for 10 mins. When you open a jar it is pretty obvious if the food is spoiled. But this is not the "safe" way to can!  As of yet, I've not had a spoiled hat and no one has gotten sick. So just be aware that what I do is not recommended.
Answer: Water-bath processed non-acidic food has the potential to contain botulism.  As such it requires extra precautions when opening.

Check the seals.  Botulism produces gas which will weaken the seal.  If you can press hard enough on the lid to make it flex a visible amount, it might be tainted, throw it out.
Smell it (be careful not to touch the contents yet, botulism can be toxic enough that just dabbing a bit on your lip to taste it can be fatal!) Botulism produces a distinctive odor.  If it smells bad, throw it out.  Then wash your hands clear up to the elbows!
Boil the food in a pot on the stove.  The toxins produced by the botulism varieties that can survive water-bath canning will break down.  You need to get it boiling hot all the way through, not just warmed up.  My grandmother always said at least ten minutes, longer for things that are bigger than an inch across.  Be aware that boiling might not be hot enough at high altitudes, in which case you'll need a pressure cooker.
Feed a spoonful to the family dog and wait 20 minutes to see if it dies or vomits.  If it does either then throw the food away and, optionally, bury the dog.
Be aware that even at this point there's still a chance of food poisoning (though it should be only slightly higher than pressure canning if you've done everything right up until now)

If you've done everything properly, your vegetables will be mushy.  Live with it.  It's better than the alternative.
Or reprocess everything as though you were starting fresh (throw out the water, re-cook everything, and hot-pack the jars) and then use a pressure canner.  That will improve your odds of not poisoning yourself by at least a little bit, but this time around your vegetables will still be mush.  So you're going to have mush regardless, but if you pressure can them you won't have to re-cook them when you open them.
Theoretically you could just run the sealed jars through the pressure canner, but getting them hot all the way through is tricky.  It will definitely require longer than the recommended processing times.  Consider the recommended time for "cold-pack" as a minimum (if your canner/recipe directions even give such a thing) and again your vegetables will be mush.
Are you noticing a theme here?


Difference between router and gateway

Question: What is the exact difference between router and gateway? In Network configuration we set the default gateway IP address, but in reality we call the device configured with that IP address as router?
Answer:
What is the exact difference between router and gateway?

A router is a device/service that provides the function of routing IP packets between networks.
A gateway (in network terms) is a router that provides access for IP packets into and/or out of the local network.

In Network configuration we set the gateway ip address, but in reality we call the device configured with that ip address as router?

Specifically, the gateway you are likely referring to is the default gateway which is the router to which a client (or source device) sends IP packets that are destined somewhere other than the local network and for which the client has no "better" route.
A gateway always has to be a router, but a router does not have to be a gateway.
Comment: Because a gateway's purpose is to route packets into/out of a local network segment for other devices, it will always be a router. However a router can be attached to a local network without performing any sort of routing into/out of the local network segment for other devices. It could be using the connection to a local network segment for a number of different purposes (for example, including but not limited to, management purposes such as monitoring, reporting, logging, etc.).
Comment: Can you please elaborate the statement "A gateway always has to be a router, but a router does not have to be a gateway" in detail ?
Comment: @YLearn So, gateway if ever configured will have same ip as that of router ?
Comment: @BreakingBenjamin, assumption on my part is that by "gateway" you are referring to the default gateway configured on a device. Then specifically, the gateway would be configured as the IP of the router functioning as the gateway for that network or client.
Answer: Router describes the general technical function (layer-3 forwarding) or a hardware device intended for that purpose, while gateway describes the function for the local segment (providing connectivity to elsewhere). You could also state that "you set up a router as gateway". Another term is hop which describes the forwarding in between subnets.
It's just a matter of perspective, the device is the same.
Answer: A router is a layer 3 device i.e It cannot modify the IP address of the packet, it can only change the MAC Address it can route the packet, whereas a gateway could be NAT capable, or can act as a firewall in case of a NAT-capable gateway it can change the packet's IP address and more capable gateways can block traffic

Layer2 Devices - Switches
Layer3 Devices - Routers
Layer2- Layer7    Devices - Gateways/Firewalls/IDC (usually implement
DPI -deep packet    inspection)

Gateways are distinct from routers or switches in that they communicate using more than one protocol and can operate at any layer of the 7 layer OSI model of networking. - Wikipedia
Comment: Not sure this is strictly true when it comes to acceleration devices and transparent caching etc
Comment: If it is a router it is true, if we add special features and call it a router it is not true.Any router that operates above layer 3 is not a L3 Router
Comment: by that definition I don't think there are any routers left from any of the big manufacturers, sure they do routing but they also do a heck of a lot more
Comment: Yes, even so called switches (commercial) do routing and NAT. Definitions are only theroretical

Difference between router and gateway


What do kids call their living great-grandparents?

Question: How do kids address or refer to their great-grandparents, if they are still alive? (equivalent to "dad", "mom", "grandpa", "grandma") "Great-grandpa" sounds rather lame.
Comment: This is going to be culturally-specific, and may even vary from family to family.
Comment: @JohnF is exactly right; there's no standard name like "Mom" or "Dad" for great-grandparents. I was lucky enough to have three great-grandparents still alive when I was in high school. One great-grandmother was called "Nana" and another was called "Ma" (everyone called her "Ma" – her children, her grandchildren, and her great-grandchildren). Nicknames for grandparents and great-grandparents is something that is very family-specific. This is a good question, though.
Comment: My kids are half German so they have Grandma, Grandad, Opa, Oma.
Comment: I have to concur with the other commenters here that this is culture-specific, with one caveat: English is a language that loves its Ellipsis and thus tends to drop the "great" prefixes when all parties of a conversation have the relevant knowledge to follow along. Example: _My great-great-grandfather Joseph and my great-grandmother Allison are visiting. Grandpa Joseph let me borrow his car to take myself and Grandma Allison to the mall._ This will also happen in conversation; unless they have a specific epithet (like 'Nana' for Grandma Allison), which will get used instead.
Answer: Here in Pakistan, there are specific words that kids use to call the great grand parents.
However, as of what I know, there's no specific word in English which can be used for great grandparents.
It varies according to the culture and to the family. In some families, you would notice kids calling both their great grandparents and grandparents by one single name, that is "Grandpa" and "Grandma". In some, I have seen kids using specific words for their great grandparents like "Grandma Norma", any cute and simple word is used..
Answer: It is a rare situation. It is unusual for a child to have a close relationship with a great-grandparent.  The answer will vary from family to family.
I knew one of my great-grandparents.  I called him "Pop"* It was his nickname in the family. In other families a great grandmother might be called "Nana" or "Ma" and so on.
For a learner, this is even less of a problem.  You refer to your great grandparent in their language, not English.  And when talking about your family you refer to them as "great grandfather" or "great granddad" or "great grandpa" (depending on your relationships)

* If I called him anything at all, which was rare, for an 8-year-old, a 90-year-old man is unimaginably ancient, wrinkly and really rather scary.  He was certainly too old to "play" with, and 8-year-olds don't really enjoy sitting beside a bed and chatting.


How do I improve my jumping technique for jumping maneuvers?

Question: Many martial arts (taekwondo and karate being the most obvious examples) incorporate powerful jumping maneuvers as part of the standard set of techniques practiced within the art.  Many of these techniques are improved by a combination of height and speed (essentially, hang time to borrow a term from basketball).  While there is clearly a degree of phsycial talent and natural physique involved in having a "good" jump for martial arts, one can see a marked improvement from repeated practice of the maneuvers, indicating that there is some ability to train for a "good" jump.  So the question is this, are there any exercises that have been shown to improve jumping height and speed in a way that is suited to use in the martial arts?
Comment: You might get more comprehensive results in fitness.SE. Jumping is a fairly rich topic in sports science.
Comment: Plyometrics is... are? one of the best ways to improve jumping. I don't really see how you're specifically train "jumps for martial arts", although if you're specifically talking about spinning jump techniques, you'd probably want to incorporate that into the plyometrics. That said, watch out; I trained with a woman who broke her own spine doing a spinning technique :( (No paralysis or anything.)
Comment: I agree with Dave Liepmann. There's a lot of exercises out there for improving jumping height. Parkour incorporates a lot of these exercises in their training, as will other sports involving a lot more jumping than martial arts.
Comment: I'm with @DaveLiepmann. If this question were about martial benefits of jumping, I would think it belongs in here. As such, I think it's more of a fitness/athletics question at the moment.
Answer: Perhaps even more than jumping higher or farther, practicing the techniques you wish to use while jumping will help the most. The sharper the technique, the less motion and momentum you will waste while in the air. Get proficient at the techniques on the ground first before trying to figure out how to move your body in the air to get the same result. If you have the technique down, the remaining part of the equation will become how to get your body into a position to perform it and recover efficiently in the air.
Answer:
Duck walking will help in jumping and stretching
Jumping up from a squat position and then coming back down into the same squat position
Ankle weights will also help in jumping by providing resistance to overcome, providing additional force when the resistance is no longer present.

I've been teaching since 1973 Taekwondo and a few more Korean arts practice practice practice using ankle weights in kicks
Answer: From the viewpoint of science, if you want to jump higher, you need to generate more speed. And it's not a linear relationship between speed and the height of the jump (I think it is squared) which means putting in 2x speed will make you jump 4x higher
Another point to know is that the burst of power for a jump comes from ATP release. So this is not something related to stamina. You have to rest for a few mins in between your jump sets.
This is something I improved on by doing the following :
(the exercises in the order of difficulty)

Ankle jumps
Frog jumps
Tuck jumps
Squat jumps
Jumping over a stick which you hold horizontally with your hands. (Very difficult)

Along with this you must obviously do jump kicks/twirls to improve on the technique like raphael said
Notes :

Wear a supporter (jockstrap).
Always do jumps on a rubber mat - never on a hard surface.
If you aren't flexible you should work on changing that first.
Quality is more important than quantity.
A proper warm up and cool down can not be emphasized enough.
Use the skip rope for a warm up. Stretch to cool down.
It took me 6 months to double my vertical jump height.
I think it is okay to do just a little everyday (with a gentle progression, it takes 2 weeks for your body to adapt to a technique)
They should be done with short bursts of intensity with rests in between.
I used to practice jumping on the beach, first on dry sand then on wet sand.
Don't rely too much on your ankle for jumping. Your power should be transmitted from the thigh(generation of power) to your heel
Answer: Lose weight and pack on fast twitch muscles in your feet, calves and thighs. An area of muscles that are overlooked often when thinking of jumping is the hamstrings. Your hamstrings pull your knees back like a spring, straightening your leg and launching you into the air. Uphill sprints are great for this. But don't forget about actually practicing the jumping technique itself. You'll be amazed how much height you gain simply by applying proper form. I remember gaining a good 10 centimeters from one session in dance class (of all places) because our instructor pointed out the things I did wrong.


Gantt chart bar style changes on its own

Question: In MS project, when I updated the "actual finish" dates of some tasks, the formatting of Gantt chart bars on some of the following/dependent tasks automatically changed to be thicker/taller than they were. Why did this happen / what do the thicker/taller bars represent? Can I reset the formatting to the original?
Answer: I don't believe the bar changed it has merely shifted to the right and is showing more of the original bar.  If you compare the "unexpectedly changed" bar to the bar above it - I believe you'll see they are the same.  When you shifted the schedule, it is no longer partially hidden by the baseline bar.
Answer: July is right, it seems to just be a shift of your bars showing the bottom bar completely.  If you would like to change that bar to be thinner and higher, you can right click on your gantt and click on bar styles.  Have Tasks highlighted and change the Shape section at the bottom.


Magento 2 translate custom options

Question: I created for a few products some custom options. Is it possible to translate these labels of the custom options? I have a translation .csv file, but adding it there didn't seem to work.
Comment: I have same problem (Magento 2.1.5), the process listed by Fabian Schmengler seems right, but in reality this is an existing issue reported from July 2016 : https://github.com/magento/magento2/issues/5885
Answer: Product data is not translated with CSV files per language, but stored per store view. Each store view has one language, so you should use the store specific values for translation.
Now this not only applies to product attributes but also to labels of custom options.

In the upper-left corner set Store View to the view for the translation. When prompted to confirm, tap OK.
For each field to be edited, do the following:
a.  Clear the Use Default Value checkbox to the right of the
  field.
b.  Either paste or type the translated text into the field.
Make sure to translate all text fields, including image labels and Alt text, Search Engine Optimization fields and any Custom Options
  information.
When complete, tap Save.

Source: Magento 2.0 User Guide
Comment: The problem with custom options is that it doesn't have a 'Use Default value' button. The values are also greyed out and not accessible. I'm in products->catalog->{{just a random item}}->custom options

Magento 2 translate custom options


Multi-processor memory controller chips

Question: I am trying to find a controller chip for either SRAM or S/DRAM which can properly manage access of the memory from one or more devices (i.e. microprocessors). I have been up and down Google and all I have been able to find are academic discussions and silicon level IP. What I would like is an on the market IC which can accomplish this. Speed is not particularly important, I am mostly interested for curiosity/experimentation purposes, and less for practical aspects.
Comment: How about I2C or SPI SRAM? Your processor or device just has to wait until the I2C/SPI bus is released before using the SRAM device, which is pretty much in the protocol.
Comment: Just for clarification because I'm not sure if I understand you properly.  You want to have an IC that manages the RAM in a way that it can be accessed from multiple, seperate, microprocessors?
Comment: @Funkyguy correct. Again, more out of curiosity than anything.
Comment: Multi-port RAM's are reasonably available.  For example: http://www.idt.com/products/memory-logic/multiport-and-dual-port-memory
Comment: @markt I was looking more for a separate controller but that will accomplish the goal just as well, thank you
Answer: I think what you have in mind might be a "DMA controller". DMA = "Direct Memory Access". The microprocessors will need to be DMA-compatible.
An alternative would be to use bidirectional buffers for this particular memory bank, one set per microprocessor, and some sort of "shared memory bank active" semaphore or handshake between microprocessors such that no two are trying to access the same memory at the same time (a condition that could have all sorts of bizarre side effects); shared memory access isn't super-simple to implement, and timing for controlling that semaphore would be critical.
The low-tech way of accomplishing it would be to equip each microprocessor with a slot for SD cards (of whichever footprint). Then you could "sneakernet" the shared memory.
Comment: Your alternative suggestion is how I had imagined it might be implemented. I guess I was hoping that there was some sort of device out there that implemented all this, perhaps with handshaking signals along the lines of RTS/CTS from RS-232.

Multi-processor memory controller chips


Backtimer in smart contract

Question: I want to add a thing to my contract where every 10minutes all the ETH from a contract is sent to my wallet.
I don't know how to do it. Any help appreciated
Answer: There is no way to have timers in smart contracts. You'll have to write a script off-chain that sends a transaction to the contract telling it to withdraw. Alternatively you could just forward all payments to the contract to your address.
Comment: Yeah, I know, but I wanted to warn people that don't know it ;)
Comment: Well I am just thinking of something like a lottery - contract gets money and on a specific date sends all the money to a random person. The problem is that the lottery would be ran like every 10minutes. Thanks for your answer, but is there not even a way to get time from an external server or something?
Comment: The contract can get the current time from itself, it doesn't need to get time from an external server. But the contract has to be executed by a transaction.
Comment: Ok thanks, I'll work with it :) would upvote but I have no rep :)
Comment: No problem (: Feel free to message me on gitter @flygoing if you have any more questions
Comment: Be carefull, the contract has only the time from the block it is mined by. Not actual time.
Comment: @Andromelus the block timestamp isn't safe for use a RND or something like that, but there are reasonably reliable guarantees that timestamps will be less than 15 minutes after the actual time they are mined, and they'll always be after the block before them.
Answer: There is a way to do this.
The contract can get the time directly but cannot execute itself.
You can use services like Chronos, which allows you to schedule calls to your contract in a simple way. You will find examples of how to do exactly what you are asking for here look at the examples. This can be used on Rinkeby for testing. You can, for instance, request your contract to be called every N blocks.
Others services are available as well, like Oraclize and ethereum alarm clock
Example of how to do what you asked using in Chronos (contract balance should be enough to pay for gas or you can pre-charge you contract address using the functions of Chronos, you can always claim back what you don't use):
<code>pragma solidity ^0.4.20;

contract _Chronos {
    function registerCall(address contractAddress, uint256 callOnBlock, uint256 gasAmount) public returns (uint256);
    function clientWithdraw(uint256 value) public;
    function clientFunding(address contractAddress) public payable;

}

contract Client {
    function setCallrequest(uint256 blockNumber, uint256 gasAmount) public;
    function callBack() public;
    function withdrawFromChronos(uint value) public;
    function getDepositsFromChronos() public payable;
}

contract YourContract is Client {
    address public chronosAddress;
    address public admin;

    function YourContract() public {
        chronosAddress = address(0x4896FE22970B06b778592F9d56F7003799E7400f);
        admin = msg.sender;
    }

    function setCallrequest(uint256 blockNumber, uint256 gasAmount) public {
        _Chronos ChronosInstance = _Chronos(chronosAddress);
        uint256 costs = ChronosInstance.registerCall(address(this), blockNumber, gasAmount);
        require(address(this).balance >= costs);
        ChronosInstance.clientFunding.value(costs)(address(this));
    }

    function callBack() public {
        setCallrequest(block.number + 40, 200000); // 40 indicated how many blocks to wait to receive the call, 40 blocks * 15sec/block = 600 sec = 10 min

        admin.transfer(this.balance); // you may want to leave some ether in your contract to pay for the next call. The gas used is small but is not zero, in this example 200000 gas is passed. If this is not consumed the contract will save it and you can withdraw what you do not use. if the gas you pass is not enough the call is not executed.
    }

    function () public payable {}

}
</code>
Disclaimer: I wrote the code for Chronos.
Let me know if this works for you. hope it helps
Comment: Thanks. I currently don't have the development stuff. I just want to develop for this specific lottery, so it'll take a while to make. Thanks :)
Comment: you do not need to develop anything else, the code I show do what you asked for, you can add all your other functions to this contract, let me know if I can help.

Backtimer in smart contract


Will flashing a custom ROM on my Galaxy Nexus device wipe my data?

Question: I'm wondering if I flash a custom ROM onto my Samsung Galaxy Nexus device, will it erase all my data (musics, pictures, etc.) due to its memory singularity?
Answer: Flashing a CustomROM (usually any ROM different to the one you're currently running) requires you to do a complete Wipe (well, at least it is strongly recommended for stability reasons) -- so the answer is probably: Yes. Data on an external SD card usually is not affected -- but as far as I remember, the GN has no such thing.
You might wish to consult the following Q&As for more information:

How can I keep settings after flashing a ROM?
Do I need to revert to stock firmware and/or wipe data before installing a custom ROM?
Manually upgrade Galaxy Nexus 4.0.4 (yakjuxw) to 4.1

EDIT:
Just to be more clear: Data on (external|internal) SD-Card (the Nexus uses an internal eMMC instead of the external SD, if I'm correct) -- that is the place where you store your photos, videos, music files, etc. -- are not affected by the wipe. Just all "internal memory" -- i.e. the apps you installed, and all settings plus app data -- will be erased.
Comment: You will not lose your SD card partition with a normal wipe (on Nexus S, I have no reason to assume CWM would change that much for GNex).

It would be silly because it would nuke the backup you just made.
Comment: @Broam Nexus uses internal SD card *instead of* external, correct? So that's where you place your files (photos, videos, music...)? Then you are correct: That partition won't be affected. I will edit my answer to make that clear. Still, all user data (apps you installed, their data, etc.) are gone.
Answer: My understanding is that you'll need to unlock your bootloader in order to flash, and unlocking your bootloader will indeed wipe everything.
Comment: I've unlocked the bootloader which is a onetime only action. But flashing ROMs could happen many times.