Do routers validate the IP packet length?

Question: Do routers verify the actual IP packet size with that mentioned in the packet?
Comment: If you feel that my answer helped you, you could [Accept the answer](http://meta.stackexchange.com/a/5235/) by clicking the grey check box to the left of my answer.
Comment: Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
Answer: Routers should check the IP length, but are not required to.  If they check, they are required to drop mismatches between the value in the IP header and the actual packet length.  Routers should depend on link-layer payload detection, and compare with the IP header per RFC 1812.
This is covered in RFC 1812 - Requirements for IPv4 Routers, Section 5.2.2: IP Header Validation:

<code>  Additionally, the router SHOULD verify that the packet length
</code>

<code>  reported by the Link Layer is at least as large as the IP total
  length recorded in the packet's IP header.  If it appears that the
  packet has been truncated, the packet MUST be discarded, the error
  SHOULD be logged, and the router SHOULD respond with an ICMP
  Parameter Problem message whose pointer points at the IP total length
  field.
</code>

<code>DISCUSSION
</code>

<code>  Because any higher layer protocol that concerns itself with data
</code>

<code>  corruption will detect truncation of the packet data when it
  reaches its final destination, it is not absolutely necessary for
  routers to perform the check suggested above to maintain protocol
  correctness.  However, by making this check a router can simplify
  considerably the task of determining which hop in the path is
  truncating the packets.  It will also reduce the expenditure of
  resources down-stream from the router in that down-stream systems
  will not need to deal with the packet.
</code>
Comment: IF the router validates the checksum, doesn't that imply length checking?  Otherwise, how does it determine where the checksum is?
Comment: Checksum offset calculation != length enforcement.  The RFC clearly makes total IP length checks optional, but encouraged.  There's a difference between knowing the offset to the checksum (ie required for enforcing valid checksum) and the activity of enforcing length consistency.  When this was written (1995), routing was very commonly performed in software; every non-essential forwarding operation was subject to potential elimination by the implementation.  Since ICMP messages and logging are required when dropping in this circumstance, it's actually a nontrivial requirement.


Should I be concerned about health (bacteria/lice) after having birds fly directly over me?

Question: Yesterday a flock of birds (crows) passed over my head. I've heard that there are many bacteria and lice in the feathers of birds. So I'm thinking about whether to wear or launder the clothes that I wore. What do you recommend I do? Is it ok to wear it again?
Comment: Yes, you're fine wearing the same clothes again.
Comment: @Remi.b Thank you for you answer, Sorry for asking one more question, But can I ask If you are answering that it's ok because there is no pathogens on my clothes or It's ok because the pathogens on my clothes can't infect me? I'm sorry for making you to answer twice.
Comment: I'm answering (commenting actually because I don't think of my comment as a full trustworthy answer) in the sense that most people have birds flying over their heads regularly and no one has never seemed to really suffer from it. You probably don't have any pathogens on your clothes. If you did, those would be crow pathogens, not human pathogens anyway.
Comment: @Remi.b Sorry for late reply. I see! Thank you for your additional comment at my a bit vesatious request. Thank you
Answer: The situation and context is of some minor importance: Did you encounter the birds in close proximity, such as startling them from the ground and receive a cloud of dust and feathers as they departed? Did they fly dozens or hundreds of meters overhead?
While it's true that many birds have some population of feather lice (Mallophaga), even in healthy birds, they are harmless to humans.1
All animals, including humans, are hosts to vast populations of bacteria. Of these, the majority are innocuous or even necessary or helpful. That said, microorganisms can be the cause of illness and moreso if they are unfamiliar to your immune system.2
Wild animals can be carriers of disease, and one should always exercise caution when handling or working with animals. Getting bitten, scratched, or even removing a carcass from a roadway, for example, has certain risks associated.
Note that most situations where illness or health problems arise usually involve contact with fluids, breaks in your skin, etc. Our skin and immune systems are remarkably efficient at keeping pathogens out or neutralized. Unless you were in direct contact with the animals and/or were injured in some way, or had a sneeze or excretion come your way, you should be fine. (And even if you were in direct contact you would likely still be fine. An injury such as a scratch from a wild animal should be disinfected and monitored.)
References

Temple, S. A. 2001. Form and Function: The External Bird. In Handbook of Bird Biology (S. Podulka, R. Rohrbaugh, Jr., and R. Bonney, eds.) The Cornell Lab of Ornithology. Ithaca, NY.
https://en.wikipedia.org/wiki/Bacteria
Comment: Sorry for late choosing the best answer. Thank you for a very specific answer, and your proofreading of the title as well. And well, the crows were right above my head. My question would sound more too much worrying than now If the crows were several hundred meter over my head X) Thank you for your consideration again.


Does par value include interest?

Question: Is it only the principal amount, original cost of the bond at the end of maturity date or does it include the whole sum with the interest payments?
Comment: Better explore the concepts of dirty price and clean price.
Answer:
Does par value include interest?

No - that is the amount of "principal" that you receive when the bond matures.  Interest that you receive from coupons on or before maturity is separate.
Comment: So the principal amount is the same thing as par value?
Comment: @Dan Essentially, yes, although "par value" is more commonly used for bonds, since it's often different that the amount paid for the bond, versus a loan where you give a set amount of money and get paid back over time..

Does par value include interest?


Why is carrying a heavy object more taxing on the body than pushing the same object on wheels?

Question: Where is the "extra help" coming from when rolling the object on wheels?
Comment: do the wheels take some of the weight? Have you checked if pulling is better than pushing with a wheelbarrow?
Answer: Your example illustrates the fact that physical effort does not necessarily equal physics work. Even just holding a heavy object without even walking with it is taxing and yet no physics work is done
Hope this helps
Answer: In principle, carrying a weight at a uniform speed on a level surface should not require any energy (if we ignore friction from the air and floor, which is fairly negligible at small speeds). Whether you are carrying the weight by hand or on a wheeled device, no work is being performed.
The reason why humans still feel like they are expending energy when carrying weights has to do not with physics but with biology, and specifically the way human muscles work. As Feynman explains in chapter 14 of the Feynman Lectures:

The word "work" in physics has a meaning so different from that of the word as it is used in ordinary circumstances that it must be observed carefully that there are some peculiar circumstances in which it appears not to be the same. For example, according to the physical definition of work, if one holds a hundred-pound weight off the ground for a while, he is doing no work. Nevertheless, everyone knows that he begins to sweat, shake, and breathe harder, as if he were running up a flight of stairs. Yet running upstairs is considered as doing work (in running downstairs, one gets work out of the world, according to physics), but in simply holding an object in a fixed position, no work is done. Clearly, the physical definition of work differs from the physiological definition, for reasons we shall briefly explore.
It is a fact that when one holds a weight he has to do "physiological" work. Why should he sweat? Why should he need to consume food to hold the weight up? Why is the machinery inside him operating at full throttle, just to hold the weight up? Actually, the weight could be held up with no effort by just placing it on a table; then the table, quietly and calmly, without any supply of energy, is able to maintain the same weight at the same height! The physiological situation is something like the following. There are two kinds of muscles in the human body and in other animals: one kind, called striated or skeletal muscle, is the type of muscle we have in our arms, for example, which is under voluntary control; the other kind, called smooth muscle, is like the muscle in the intestines or, in the clam, the greater adductor muscle that closes the shell. The smooth muscles work very slowly, but they can hold a "set"; that is to say, if the clam tries to close its shell in a certain position, it will hold that position, even if there is a very great force trying to change it. It will hold a position under load for hours and hours without getting tired because it is very much like a table holding up a weight, it "sets" into a certain position, and the molecules just lock there temporarily with no work being done, no effort being generated by the clam. The fact that we have to generate effort to hold up a weight is simply due to the design of striated muscle. What happens is that when a nerve impulse reaches a muscle fiber, the fiber gives a little twitch and then relaxes, so that when we hold something up, enormous volleys of nerve impulses are coming in to the muscle, large numbers of twitches are maintaining the weight, while the other fibers relax. We can see this, of course: when we hold a heavy weight and get tired, we begin to shake. The reason is that the volleys are coming irregularly, and the muscle is tired and not reacting fast enough.
Answer: Carrying a heavy weight feels more strenuous and uses more energy because your muscles are resisting the force of gravity on the load, as well as supplying the forward momentum for it. When you put the load on wheels, as the Viet Cong did with their bicycles on the Hoe Chi Minh trail, then provided you have a smooth, flat surface to travel on, you only have to provide the forward momentum. The energy you would otherwise use in resisting the force of gravity on the load is no longer provided by your muscles. That accounts for the load, but of course you still have the force of gravity on your body to deal with.
Comment: "The energy you would otherwise use in resisting the force of gravity" ---- the question is all about why energy is required to do that. It is no use just saying "you would use energy" when the question is "why do I need to use energy?"
Comment: @Andrew Steane : Perhaps you should read the question again, muscle verses gravity or wheels verses gravity would seem to be the proper answer


How to resolve "You have not started an Objectify context" in JUnit?

Question: I've got some Objectify test code running in JUnit and I'm getting this error:
java.lang.IllegalStateException: You have not started an Objectify context. You are probably missing the ObjectifyFilter. If you are not running in the context of an http request, see the ObjectifyService.run() method.
    at com.googlecode.objectify.ObjectifyService.ofy(ObjectifyService.java:44)
    at com.googlecode.objectify.impl.ref.LiveRef.<init>(LiveRef.java:31)
    at com.googlecode.objectify.Ref.create(Ref.java:26)
    at com.googlecode.objectify.Ref.create(Ref.java:32)
    at com.netbase.followerdownloader.repository.DownloadTaskRepositoryImpl.create(DownloadTaskRepositoryImpl.java:35)
    at com.netbase.followerdownloader.repository.DownloadTaskRepositoryImplTest.setUp(DownloadTaskRepositoryImplTest.java:45)

How do I resolve this for test code?
Answer: Jeff Schnitzer answered this here: https://groups.google.com/forum/#!topic/objectify-appengine/8HinahG7irg.  That link points to https://groups.google.com/forum/#!topic/objectify-appengine/O4FHC_i7EGk where Jeff suggests the following quick and dirty workaround:

My @BeforeMethod starts an objectify context (ObjectifyService.begin())
My @AfterMethod closes the objectify context

Jeff suggests we use ObjectifyService.run() instead but admits it's more work.
Here's how my implementation looks:
public class DownloadTaskRepositoryImplTest {
    // maximum eventual consistency (see https://cloud.google.com/appengine/docs/java/tools/localunittesting)
    private final LocalServiceTestHelper helper =
        new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()
            .setDefaultHighRepJobPolicyUnappliedJobPercentage(100));

    private Closeable closeable;

    @Before
    public void setUp() {
        helper.setUp();
        ObjectifyRegistrar.registerDataModel();
        closeable = ObjectifyService.begin();
    }

    @After
    public void tearDown() {
        closeable.close();

        helper.tearDown();
    }

Comment: @Michael...where did you get the "ObjectifyRegistrar?"
Comment: This solution just can't work, "ObjectifyRegistrar" doesn't exist
Comment: ObjectifyRegistrar presumably means calling ObjectifyService.register().
Answer: I also had this issue and noticed that I had not added the ObjectifyFilter to my web.xml
<filter>
    <filter-name>ObjectifyFilter</filter-name>
    <filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>ObjectifyFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

I also had to include Objectify and guava jars in my WEB-INF>lib directory and include them in my build path.
Comment: This may be my problem.  Where does this go in web.xml??
Answer: I was facing the same error and this solusion worked for me

I have an app based on Endpoints that uses Objectify. When I leave it with the default/automatic scaling, everything works great. Once I enable basic scaling, though, I get the following exception when executing the endpoint method:

[INFO] java.lang.IllegalStateException: You have not started an Objectify context. You are probably missing the ObjectifyFilter. If you are not running in the context of an http request, see the ObjectifyService.run() method.
[INFO]  at com.googlecode.objectify.ObjectifyService.ofy(ObjectifyService.java:44)
[INFO]  at com.myco.myapp.dao.datastore.OfyService.ofy(OfyService.java:62)

The good news is that this goes away when you enable RequestDispatcher
  support in the web.xml file like so. I think this is a documentation
  issue, then, but I didn't know if everyone would agree if I edited the
  Wiki page directly. Here is the proposed web.xml entry, which worked
  for me:

   <filter>
    <filter-name>ObjectifyFilter</filter-name>
    <filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>ObjectifyFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>FORWARD</dispatcher>
</filter-mapping>

Answer: Improving michael-osofsky answer, I add this to my ofy helper class
public static void registerDataModel() {
    try {
        factory().register(Profile.class);
    } catch (Exception e){
        e.printStackTrace();
    }
}

and remplace
ObjectifyRegistrar.registerDataModel();

for this
OfyService.registerDataModel();

OfyService.java
public static void registerDataModel() {
    try {
        factory().register(Profile.class);
    } catch (Exception e){
        e.printStackTrace();
    }
}

Answer: As Jeff Schnitzer says in the link provided by Michael Osofsky:

In your tests you should have some notion of a 'request' even if it is just conceptual. If "each test is a request by itself", then you can use @Before/@After in conjunction with ObjectifyService.begin() to demarcate the requests. However, this is probably not actually how your tests work - it isn't how my tests work.

He then goes on to say:

This would be prettier with JDK8 closures but the idea is straightforward - you're wrapping some unit of work in a context which represents a request. It would probably be smart to add even more context like authentication in that wrapper too.

I came up with the following implementation of his idea.  With the solution below, you can ensure each call to a servlet handler gets a fresh Objectify session while still making your servlet handler calls in a single line of code.  It also decouples your tests from explicitly worrying about Objectify, and allows you to add additional non-Objectify context around your servlet handlers.
My solution below works with Objectify 5.1.22.  I tried using Objectify 6+, but I had problems that seem to be related to this.
First, define a custom Supplier that is able to capture the exceptions thrown by a servlet handler.
  @FunctionalInterface
  public interface ServletSupplier<T> {

  T get()
    throws ServletException, IOException;
  }

Next, define a wrapper method that accepts your new custom Supplier as an input, and wrap the call to ServletSupplier.get() in a try-with-resources block that calls ObjectifyService.begin().  You must also register your entity classes before calling ServletSupplier.get().
  public <T> T runInServletContext(ServletSupplier<T> servletMethod)
      throws ServletException, IOException {

    try (Closeable session = ObjectifyService.begin()) {
      ObjectifyService.register(MyObj.class);
      return servletMethod.get();
    }
  }

Finally, anywhere in your tests that you call the servlet handler you should do so using the wrapper method.
  MyObj myObjPost = runInServletContext(() -> getServlet().doPost(request, response));
  // Assert results of doPost call.
  MyObj myObjGet = runInServletContext(() -> getServlet().doGet(request, response));
  // Assert results of doGet call.

Answer: Just in case someone ends up here (as I originally did) looking up the same problem but for the ktor "main.kt" server instead of unit tests...
After looking at the ObjectifyFilter source code, I added
val closer = ObjectifyService.begin()
... real service here ...
closer.close()

around my actual servlet code and that fixed the problem.


How much leeway do I have on ERD?

Question: I am following up on this thread.  I have found a few rims that match the ERD (604) of my rim, and if necessary I can use one of those.  But I would like to consider others as well.  How much leeway do I have in the ERD for my rim?  If I get one with an ERD of 604±X, what's an acceptable X?  Or maybe it's 604+X and 604-Y where X!=Y.  Or maybe I'm overthinking it. :-)  So, in summary... how much leeway do I have?
Comment: Here's an anecdote: my previous rims had ERD of 548mm, the new rims are 550mm and bike shop had no issues swapping between these. Your mileage may vary.
Comment: This answer largely depends on the threaded length of the spoke you're using.
Answer: Unless you measure your spokes and calculate for the hub and ERD, you have no certainty on leeway.
It depends entirely on the spoke length. One build might have spokes just long enough, then a new rim with a 1mm bigger ERD would need new spokes. A different build might have spokes that are just off being too long, then a new rim would need an ERD no smaller than the existing rim.
Comment: Thank you very much.  I think I have some measuring to do.
Answer: I wouldn't want to change more than 2mm in ERD, ideally either exact or 1mm, personally though, I would want exact or new spokes. This is slightly biased given that I like building my own wheels.
If you check the spoke calculation for a rim of 604 ERD and a hub and you change the ERD by 4mm, using the same hub, the spokes change by 2mm (aprox). This was on a 32h, 3x front wheel.
2mm is enough to make the wheel snap spoked more than it should is too small or not be able to tighted properly if too long.
Now, whether X=Y or not also depends on whether they rounded up or down on the spokes. ie 290.7 being rounded to 290 or 291. Some people round down, osme round up and some use the maths approch to rounding.

How much leeway do I have on ERD?


Is this correct please?

Question: "Ich spiele gern Rugby jeden Tag".    Please let me know if this sentence is correct.  I know that "Jeden Tag" can be placed at the beginning -- but can we put "gern" and "jeden Tag" after the verb?
Vielen Dank im Voraus!
Answer: I mean the "jeden Tag" sounds like it's tagged on to the sentence. Like "Ich spiele gerne Rugby" is already a full functioning sentence, so yes you can use the gerne after the verb. But as said the "jeden Tag" at the end sounds not horribly wrong, but somewhat dissonant.
Maybe try something like,
<code>"Ich spiele gerne Rugby, wenn (es mir) möglich (ist) jeden Tag.".
"Ich spiele gerne täglich eine Runde Rugby."
"Ich spiele täglich Rubgy und mache das sehr gerne"
</code>
Comment: I agree putting "jeden Tag" at the end sounds odd, but what's wrong with "Ich spiele jeden Tag gerne Rugby." and "Ich spiele gerne jeden Tag Rugby.", both of which sound natural to me? (The second one slightly shifts the meaning, though, in that the "gerne" now expresses a preference for playing rugby being a daily activity, rather than a preference for playing rugby itself.)
Comment: The first sentence still sounds a little odd to me, but if I'd replace "jeden Tag" with other temporal specifiers like "immer wieder", "Sonntags", "in den Ferien" and so on then it sounds ok. The combination of "jeden Tag" and "gerne" seems to always make it sound as if you like it as a daily activity and not just for  the activity itself. Though I agree "Ich spiele gerne jeden Tag Rugby" also sounds quite nice.
Comment: "as if you like it as a daily activity and not just for the activity itself" - interesting, precisely that is my impression from the *second* sentence ("gerne jeden Tag"), whereas the first one ("jeden Tag gerne") sounds entirely neutral to me, as if just praising the activity itself.
Comment: Yeah I can see what you mean, "jeden Tag gerne" can be read as "Jeden Tags auf neue freue ich mich Rugby zu speilen", but something aobut the combination "Ich spiele jeden tag gerne Rugby" still feels odd, like as if one of these words is too much and cannot exist as it's own clause either. But I can't pin down exactly what it is.

Is this correct please?


Which to use, 'washroom' or 'restroom'?

Question: I'm from India; in our office we refer toilet to 'Wash-room' and 'Rest-room', which is the correct form to use and if there is a difference, what is the difference between the two words?
Answer: If the room only has sinks for washing, it's a washroom. If it has toilets, it's a restroom. If the room is in your home, it's a bathroom. Here's an odd idiom of the US. If someone asks, "May I use your bathroom," the person is asking to use the room to eliminate, not to bathe. So, a room in the home with a toilet & sink is called a bathroom, even if it lacks a tub or shower.
Answer: I would either use two words or one (rest room or restroom), but I wouldn't use a hyphen with either.
I think either restroom or washroom could be used. In the U.S., bathroom is also used, even if there is no tub or shower in the room.
Someone might be inclined to use washroom instead of restroom or bathroom if they were only going in to wash their hands, but that's only a technicality that you might hear on occasion, not a fixed rule that should be applied or assumed.
There's also the term powder room, which would only be used for ladies. I believe the term is out of vogue now.
This Ngram shows that "bathroom" is a rather prevalent term. I'm not surprised; it's the choice I would probably use most of the time.
This Ngram shows how often all the rest of the terms are used – although this data is taken from a written corpus and therefore may not accurately reflect how natives generally speak.
Comment: In the U.S. -- at least the places I've lived -- "bathroom" and "restroom" are the conventional terms. Yes, they're euphemisms, we say "bathroom" even if there is no bath tub and "restroom" even though there is rarely a convenient place to rest. "Washroom" would be understood but I think is rather out of date. "Powder room" is definitely out of date.
Comment: I believe the use of washroom when speaking is more common in some regions similar to the way some folks use soda, pop, or cola depending on what region they're from. Powder room for my family refers to the room in a house that has only a toliet and a sink that is intended for visitors to use. We would say "I painted the powder room over the weekend." but if we were visiting friends, we would ask where the bathroom is, not the powder room. They might not have a house with that type of bathroom. Real estate agents might refer to it as a half bathroom.
Comment: Your same Ngram in American English: https://books.google.com/ngrams/graph?content=go+to+the+rest+room%2Cgo+to+the+restroom%2Cgo+to+the+powder+room%2Cgo+to+the+washroom&year_start=1920&year_end=2008&corpus=17&smoothing=3&share=&direct_url=t1%3B%2Cgo%20to%20the%20rest%20room%3B%2Cc0%3B.t1%3B%2Cgo%20to%20the%20restroom%3B%2Cc0%3B.t1%3B%2Cgo%20to%20the%20powder%20room%3B%2Cc0%3B.t1%3B%2Cgo%20to%20the%20washroom%3B%2Cc0   and ......
Comment: ....in British English: https://books.google.com/ngrams/graph?content=go+to+the+rest+room%2Cgo+to+the+restroom%2Cgo+to+the+powder+room%2Cgo+to+the+washroom&year_start=1920&year_end=2008&corpus=18&smoothing=3&share=&direct_url=t1%3B%2Cgo%20to%20the%20rest%20room%3B%2Cc0%3B.t1%3B%2Cgo%20to%20the%20restroom%3B%2Cc0%3B.t1%3B%2Cgo%20to%20the%20powder%20room%3B%2Cc0%3B.t1%3B%2Cgo%20to%20the%20washroom%3B%2Cc0
Comment: Looks like _"restroom"_ is spreading.
Answer: The word we use for the room in which we evacuate our bowels and bladders depends very much on the culture we happen to be in. There is no definitive  answer to your question.
Comment: @Tetsujin: I did this in Australia - I asked for the bathroom, and my slightly puzzled host showed me to a room with a bathtub & a sink. I, greatly dumbfounded, had to explain that the room lacked the fixture I had in mind. After brief consultation, we discovered that the room I wanted was the toilet (or "dunny"), a tiny room just outside the back door. This was a few days after I had scoured an empty terminal at the Auckland airport for a restroom, toilet, lavatory, privy, public convenience, *anything*; at last, in my final desperation, investigating one of the places tersely labeled "WC."
Comment: +1 Brits find it quite amusing to hear it referred to as a bathroom... when it doesn't contain a bath. As a youth I first discovered one of these polite euphemisms after a visitor asked where he could wash his hands. I innocently pointed to the nearby kitchen sink.
Comment: @Tetsujin - I cringe to think about what may have happened next ;^)
Comment: Is there a lot of variation across regions that speak British-English for the name of that room with the toilet in it? In the US, restroom would be pretty universally understood and polite, even though the person hearing it might refer to the room as a washroom, bathroom, or toilet when they're speaking.
Answer: In Canada, the term for the room with the toilet is a "washroom." In the United States, it's generally "restroom" or "bathroom," though people generally understand if you say "washroom."
In the United States, signs in stores that show you where you can use the toilet almost universally use the term "Restroom."

Which to use, 'washroom' or 'restroom'?


Why do some materials shrink when their temperature increases?

Question: In my vision it would seem quite logical that all materials expand when temperature rises.  Because the particles get more energy and travel larger distances when moving.  But apparently there are some materials that tend to shrink as temperature increases.  Why?  Which ones?
Comment: @rmhleo, altough this is not the best example: water between 0 and 4 degrees celius has a negative expansion coefficient meaning its volume decreases.
Comment: should shrimp not be shrink?
Comment: Well, can you mention the ones you know?
Comment: Well I think we have particular explanations for particular cases, but I don't think there is a general way of predicting which ones and why. It must be due to variations of intermolecular potentials with average motion of molecules The less kinetic energy of the molecule the more relevant the potentials are and more features can manifest, which are smeared out for haigh temperatures.
Answer: Water has a very narrow range of temperatures over which it expands when cooling rather than contracting (IIRC +2 to 0 Celsius).  This occurs due to the way the highly polar molecules "line up" with each other near the freezing point.
For a more interesting example, consider a number of rubber compounds which shrink as they warm up.  In this case it's due to cross-linked molecules which paradoxically "relax" to a smaller configuration as they heat up.  I'm not familiar with a good online set of diagrams for this; if I find one I'll post it.
Answer: I imagine alot of negative expansion coefficients occour at phase transitions. Probably the temperature increase causes the material to overcome an activation energy and a change in lattice structure occours. In these cases one would not expect these processes to be reversible.
Comment: and for a liquid ?


Quest mode in Bejeweled 3

Question: I am now at 83% on the quest mode with all options filled in relic #1. What do I need to do now? Do I continue to try and get every green dot in each relic to completion? I read elsewhere here something about how you needed to get to 80% completion in quest mode to get BEYOND the chair. I got beyond 80% but I am not seeing anything else open.
Answer: There are 5 levels (relics) in the Quest Mode. Once you complete enough puzzles for a relic, you can pass to the next one. The Chair relic is the last one, and once you complete enough puzzles in total (i.e. more than 80%) including the Chair relic, you finish the Quest Mode.
Comment: I am at 92%. First 3 relics all complete, 2 games left on crown and 1 left on chair. BUT despite I am over 80%, I do not get the left arrow to proceed beyond QUEST mode to ??? Not sure if I am supposed to get the upper left arrow on QUEST mode to even engage for anything. It might be only to move across the 5 relics?? I only need 2 reg badges and 3 more elite badges. Guess when that is done, game is over? Kind of boarded at this point now. Looking for more for $20!
Comment: Seeing now in my badge area that I need to as of yet COMPLETE QUEST mode to get Hero's Welcome badge. So ? then still is about completion of Quest mode - if completion of Quest mode is 80% or > in Quest mode play with all 5 artifacts revealed (which I have and outlined above in detail of what my Quest mode now shows), how come since according to all I read says I have completed Quest mode, why don't I have the Hero's Welcome Badge?
Comment: I don't know what the problem is on your side, but I have completed the Quest Mode just as I explained in my answer. What you can try is to complete *all* puzzles to see if the game lets you finish the mode.

Quest mode in Bejeweled 3


horizontal asp.net menu displaying as a vertical list

Question: http://i44.tinypic.com/5ureav.png
When my pages render occasionally the horizontal menu displays like that.  Why?
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
    EnableViewState="false" IncludeStyleBlock="false"
    Orientation="Horizontal" ClientIDMode="AutoID">
    <Items></Items>
</asp:Menu>

It generally does this when a page is loading a lot of data, but when the data finishes loading it never goes back to horizontal.
Testing with IE 7, 8, and 9, and Chrome.
I looked around the internet and found some people saying it was the z-index but adjusting didn't help.
I'm using "developer tools" in IE8 to troubleshoot further and found some javascript calls that didn't succeed.  I have no idea what they mean.

Error produced
'Sys.WebForms.PageRequestManager' is null or not an object

Error produced
'Sys.Webforms.Menu' is null or not an object
I believe that the remaining errors are all cascades from these two.  Do you think I should replace the jscript libraries with updated ones?  Could it possibly be browser related since I'm using IE8  (not in compatibility mode).
Another odd bit of information that might help is, when I build the solution in Visual Studio 2010 on WinXP Pro on my development environment it works fine, but when I publish it to the server (IIS 7.5, Server 2008 R2) it breaks.  At first I thought it might be data lag, but the connection string on the server should be faster than the connection string on my dev environment.  Server uses Localhost as the target, my dev workstation uses the server path... so I don't think its the data lag.
Answer: I had this same problem.
I solved it by making the RenderingMode="Table" under the asp:Menu control.
Example:
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal" RenderingMode="Table">
        <StaticMenuItemStyle CssClass="menuitem" />
        <DynamicMenuItemStyle CssClass="menuitem" />

You will have to fiddle a little more with css (deleting the 'ul' and 'li' attributes in your css).
Creating
 <StaticMenuItemStyle CssClass="menuitem" />
 <DynamicMenuItemStyle CssClass="menuitem" />

In menu control (as shown above) also helps with css formatting.
For some reason the menu list is creating this problem. This is at least a workaround.
Comment: I know this is an old question, and hope that this comment/question will still be seen and replied to.

Rendering as Table (though most recommend against this) DOES solve the problem, but my beautiful menu buttons are turned in to ugly hyperlinks.  I lose all my formatting.  I've been tweaking the CSS to try to resolve this.  How do I take my menu ul li formatting and apply it here when I use RenderingMode="Table" ??  I have been googling for a CSS formatting tutorial or example and finding none.
Answer: As of Visual Studio 2010 / .NET 4.0, ASP:Menus render as bulleted lists (ul) rather than tables. You must have CSS that affects uls that is overriding the expected design of the menu.
Comment: Note that I assumed you are using .NET 4.0 based on tags in your previous questions.
Comment: You are correct, .net 4.  I'm looking through the CSS now.  Thanks
Comment: I updated my original post with some additional details about the errors.  I just found these using Developer Tools in IE 8.
Answer: I had the same problem. It turned out to be caused by the following line in my Global.asax file:
RouteTable.Routes.MapPageRoute("", "{*dummy}", "~/Default.aspx")

I wanted to send users requesting non-existing routes to the Default.aspx page. Apparently this has the unwanted side-effect that the browser can't find the JS-file needed to render the menu horizontally.


How can a joint with ball and socket type of movement be locked in place by a load

Question: Looking for a way where a joint with ball and socket or universal joint type of movement will freeze or lock in place, preventing movement, when a load is placed on the ball, and will unfreeze or unlock when the load is removed, restoring free movement.
Answer: I am trying to understand your question. In order to rotate the ball joint, you must apply a force. The ball joint could not move if it were to lock under any load. However, a joint that automatically locks for loads that are greater than some arbitrary threshold value sounds plausible.
I am not aware of any mechanism to have this behavior with a ball joint (I have asked some colleagues if they knew, let me know if there is), but the implementation can be quite complex even for 1-DoF joints (e.g. seat-belts).
If you must use a ball joint, an option for you could be an active ball joint mechanism such as ABENICS Active Ball Joint Mechanism prototype (very cool, but far from a mature technology). A more conventional approach could be using three active revolute joints. Otherwise, you will have to review your design requirements.
Answer: So a socket that is sliced much like a collet used in drills etc so that with no load the ball can move.
When loaded an external taper like a morse taper clamps the ball in the socket as the socket gets compressed by the taper.


How do you monitor PostgreSQL queries?

Question: I have an application which uses PostgreSQL. I want to monitor all the queries that the application sends to the database. Is there a way to monitor the queries sent?
Comment: https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-STATEMENT
Answer: You can point pgAdmin4 at your PostgreSQL server, it has a dashboard you can use. You can then drill down in a session to see the query.
If thats not what you are looking for then I guess a logging solution would be what you need like pg_stat_statements.
Comment: How would one log `pg_stat_statements`? I mean - if @Axel wants to monitor _all_ queries, and was going to do that by logging `pg_stat_statements`, how would they do so such that all queries were captured?

How do you monitor PostgreSQL queries?


Exporting ODBC System DSNs from a windows 2003 machine?

Question: Is there a way to export all the ODBC System DSNs from a windows 2003 machine?
Answer: System DSN information is stored under the HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI registry key. You could export that key to a .reg file and import on another machine.
UPDATE:
You can also do it programmatically. Here are a few examples:
http://www.codeproject.com/KB/database/DSNAdmin.aspx
http://support.microsoft.com/kb/110507
http://blogs.technet.com/b/heyscriptingguy/archive/2004/11/10/can-i-create-and-delete-a-dsn-using-a-script.aspx
Comment: @KyleJohnson I believe this will work with Windows 2008, but I don't have a version of 2008 to verify this at the moment. I've verified this under 64-bit Windows 7 if that helps at all.
Comment: Thanks Garett for your answer!
Comment: Does this depend on the server version you are exporting to? What if I am exporting to a Windows 2008 server?
Answer: I have just done this myself with a very simple bat script for 32bit ODBC sources
regedit /e c:\backup\odbc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI"

and for the 64bit sources or if you are on a 32bit operating system:
regedit /e c:\backup\odbc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI"

This backs up all of the DSN's however you could then specify the DNS you want.
Comment: On windows server 64 bit it's "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI"
Answer: System DSN's are stored in windows registry under HKLM\Software\ODBC\ODBC.INI node
So if you export this node to a *.reg file and run this reg file on a target machine, it should work.
The only thing, this reg file will contain some file paths which maybe computer specific, eg
c:\WINNT\System32\bla-bla-bla.dll includes WINNT folder which on target machine may be called like WINDOWS. So you will need to spend a bit time to make sure all paths in *.reg file are correct for target machine where you would finally import.
Answer: I wrote some Powershell functions for copying ODBC connections from one computer to another, they are posted (and kept updated) at:
http://powershell.com/cs/media/p/32510.aspx
# Usage:
# $srcConfig = Get-OdbcConfig srcComputerName
# Import-OdbcConfig trgComputerName $scrConfig
# Only returns data when setting values

function Get-OdbcConfig {
param( $srcName )
    if ( Test-Connection $srcName -Count 1 -Quiet ) {
        # cycle through the odbc and odbc32 keys
        $keys = "SOFTWARE\ODBC\ODBC.INI", "SOFTWARE\Wow6432Node\ODBC\ODBC.INI"
        foreach ( $key in $keys ){
            # open remote registry
            $type = [Microsoft.Win32.RegistryHive]::LocalMachine
            $srcReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey( $type, $srcName )
            $OdbcKey = $srcReg.OpenSubKey( $key )
            # red through each key
            foreach ( $oDrvr in $OdbcKey.GetSubKeyNames() ){
                # form the key path
                $sKey = $key + "\" + $oDrvr
                $oDrvrKey = $srcReg.OpenSubKey( $sKey )
                # cycle through each value, capture the key path, name, value and type
                foreach ( $oDrvrVal in $oDrvrKey.GetValueNames() ) {
                        $regObj = New-Object psobject -Property @{
                        Path = $sKey
                        Name = $oDrvrVal
                        Value = $oDrvrKey.GetValue( $oDrvrVal )
                        Type = $oDrvrKey.GetValueKind( $oDrvrVal )
                    }
                # dump each to the console
                $regObj
                }
            }
        }
    }
    # can't ping
    else { Write-Host "$srcName offline" }
}

function Import-OdbcConfig {
param( $trgName, $srcConfig )
    if ( Test-Connection $trgName -Count 1 -Quiet ) {
        # open remote registry
        $type = [Microsoft.Win32.RegistryHive]::LocalMachine
        $trgReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey( $type, $trgName )
        # sort out the key paths and cycle through each
        $paths = $srcConfig | select -Unique Path
        foreach ( $key in $paths ){
            # check for the key and create it if it's not there
            if ( ! $trgReg.OpenSubKey( $key.Path ) ) { $writeKey = $trgReg.CreateSubKey( $key.Path ) }
            # open the path for writing ($true)
            $trgKey = $trgReg.OpenSubKey( $key.Path, $true )
            # cycle through each value, check to see if it exists, create it if it doesn't
            foreach ( $oDrvr in $srcConfig | where { $_.Path -eq $key.Path } ) {
                if ( ! $trgKey.GetValue( $oDrvr.Name ) ) {
                    $oType = $oDrvr.Type
                    $writeValue = $trgKey.SetValue( $oDrvr.Name, $oDrvr.Value, [Microsoft.Win32.RegistryValueKind]::$oType  )
                    $objObj = new-object psobject -Property @{
                        Path = $oDrvr.Path
                        Name = $oDrvr.Name
                        Value = $trgKey.GetValue( $oDrvr.Name )
                        Type = $trgKey.GetValueKind( $oDrvr.Name )
                    }
                }
            $objObj
            }
        }
    }
    # can't ping
    else { Write-Host "$srcName offline" }
}

Using these functions together you can copy all of one computers ODBC connections to another:
$srcConfig = Get-OdbcConfig srcComputerName
Import-OdbcConfig trgComputerName $scrConfig
It's possible to include only your favorite ODBC connection by filtering on the path:
Import-OdbcConfig trgComputerName ( $scrKeys | where { $_.Path -eq "SOFTWARE\ODBC\ODBC.INI\GoodDatabase" } )

Or filtering out ODBC connections you don't like:
Import-OdbcConfig trgComputerName ( $scrKeys | where { $_.Path -ne "SOFTWARE\ODBC\ODBC.INI\DatabaseIHate" } )

Import-OdbcConfig only returns data when setting values or can't ping target, if there's nothing to create it won't say anything.
Answer: If you can't find the registrations there, depending on if they are User DSN/System DSN, they can very will be in:

[HKEY_USERS\"User SID(dont' look for this, it will be a long
  number)\Software\ODBC\ODBC.INI]


How to measure the frame rate of an ARCore Android app?

Question: I am using the HelloAR sample application. The sample uses ARCore. I am running the sample on an Android Samsung Galaxy Tab S5e.
How can I measure the framerate (Frames Per Second) of my AR app? I need to graph the data, so ideally the output of whatever approach I take will give me some sort of CSV e.g. time,fps
I've tried looking at GameBench, but that requires me to fill out a form and wait for a "specialist" to get back to me... I have also tried dumpsys with framestats, but that only outputs 2 frames and very seldom updates. I have also tried some projects from GitHub (TinyDancer), but that does not work.
Any ideas?
Comment: GameBench employee here - shoot me an email at jake [at] gamebench.net
Answer: For measuring frame rate in ARCore 1.19 you can use getTimestamp() public method of a public class Frame. At 60 fps, every frame lasts approximately 16.67 ms (or ~16670000 ns).
public long getTimestamp()

Let's see what official documentation says:

getTimestamp() method returns the timestamp in nanoseconds when this image was captured. This can be used to detect dropped frames or measure the camera frame rate. The time base of this value is specifically not defined, but it is likely similar to System.nanoTime().

So, if a time difference between each current and previous frame is ~16670000 nanosec, frame rate is 60 fps. But if a time difference is ~33330000 nanosec, then frame rate is 30 fps.
Comment: Hmm, but this will measure the frame rate of the camera. I want to measure the frame rate of the application - how fast images are rendered/updated on the screen. The camera might capture at 60fps, but if there is some heavy processing, images will not be presented at 60fps, correct?
Comment: Test it, please. If a whole app delays (due to heavy processing), camera's frames delay too...