Other uses of weak references?

Question: I know that weak references are a good candidate for memoizing potentially large sets of data, and Wikipedia's article on weak references only lists "keeping track of the current variables being referenced in the application" and the statement "Another use of weak references is in writing a cache".
What are some other situations (more specific than just "caching results") where the use of weak references is A Good IdeaTM?
Comment: Why is this community wiki? It's a serious question!
Comment: It's CW because there is no one correct answer.
Answer: The primary correct use for weak references is to identify things whose importance derives from the existence of strong references to them.  The two most common scenarios are either:

An object holds a reference to something not because it "cares" about the object in question, but rather because other entities which do care about the object might want it to do something with it.  If after awhile nobody cares about the object anymore, there's no reason why other entities should continue to manipulate it on behalf of "all the entities that care about it".
The memory cost of holding many references to the same immutable object may be much lower than the memory cost of holding references to many identical objects, and comparing references to the same object may be be much faster than comparing identical objects.  The memory cost of creating an immutable object, abandoning it, having it get collected, and creating an identical object is essentially the same as the cost of creating an object and later returning a second reference to it.  Returning a reference to an existing object which would have to be retained anyway is a big win; returning a reference to an object which was eligible for collection but hadn't been collected yet may or may not be a win (it's usually a slight win, but in a generational GC it can sometimes hurt performance slightly); in many cases, the latter benefits would not be sufficient to justify keeping an object alive longer than would otherwise be necessary.
Answer: In Flex, use weak references to avoid memory leaks.
If an event handler is a member of a short-lived instance object, passing the handler as a strong reference to an object which will live longer may keep the short-lived instance alive unnecessarily.
Answer: I use weak references for a few things...
I like to create "Weak Events" in .Net to avoid observables from keeping observers alive too long.
I have also used weak events to detect memory leaks.
Answer: In Python, the garbage collector uses reference counting to decide when to "destroy" or otherwise deallocate an object.  A normal circular reference can result in objects never being garbage collected because their reference counts respectively stay at 1 or higher; but using weak references will allow both/all objects to be properly cleaned up when they go out of scope.

Other uses of weak references?


System architecture - Java Backend, Database, Mobile Apps

Question: I´m building Java backends with Spring, Hibernate and RDBMSs for a while now. Also I´m regularily working on mobile applications for iOS and Android.
So I have a full stack of technology to use for this task, however I am looking for something maybe more advanced that better fits the requirements. I was having some thoughts about it, but I better first explain how my current systems work and then how I want my upcoming systems to look like.
Currently using

Spring Framework to connect everything together
Hibernate with Entity beans for persistence
MySQL or others as RDBMS
DTO objects created with Dozer
RESTful API to expose services
DTOs are transferred in JSON format

This setup works. But I have the feeling that it´s just too much work and life could be simpler with other technologies.
What I am looking for
On the mobile site, I want to receive data for the current screen that I could easily cache. JSON is something that is already serialized and that would be easy to save to disk in the mobile application, without using yet another database. So the question is, how could I store the data in the backend, so that I can more easily receive it, without using entity beans, DTOs and Dozer to convert between them? Isn´t there another database solution which already delivers JSON? What about graph databases for example, like OrientDB or Neo4J?
I definitely want to go with Java and Spring, and I am open to a replacement for Hibernate, RDBMS and entity beans and DTOs.
Looking forward to your answers!
Answer:
Your current design (This setup works) has niceties which a good system should have. tiered and good separation of concerns.
If I understand your requirement correctly then, you argument is, if my end data format is JSON then why not store the data in JSON format which will get you rid of lot of plumbing code/effort in the middle tier.
It will directly enable you to fetch the data from the storage and pass it on the requesting client. These are your requirement in nutshell. Please correct me if I am wrong.
Now JSON is more of textual notation and less of storage format. Jason is generally consumed by the View tier of MVC architecture as its easy to render on the screen using Javascript.
Your reasoning of using a NoSQL DB which directly delivers JSON is credible given that tye end client is going to be mobile app.
Overall architecture looks good and highly optimized for Mobile access.
Now coming on the NoSQL JSON storage, following are the Document Store NoSQL DBs which support JSON interface
i. CouchDB
ii. JasDB
iii.SchemaFreeDB

8.You can evaluate any of these to suite your needs.
Answer: (full disclosure - I'm an engineer with Kinvey, a BaaS provider)
One option you might consider is using Backend-as-a-service. Most BaaS providers use JSON to transfer the data over the wire, which sounds like it would be compatible with your requirements.
In addition, you'll typically get a lot of common mobile app functionality baked in (i.e. push notifications, file storage and CDN infrastructure, user management, etc). This could be especially useful if you are building multiple apps, each with their own backend; rather than reinventing the wheel each time, simply spin up a new backend.
One last, but important note, would be pricing. A lot depends on your use case, but from what I've seen, a BaaS provider is usually significantly cheaper that rolling your own solution on AWS or some other cloud provider, especially since most providers offer a free tier.
Answer: Even though this question is a bit old, maybe a quick alternative for RDBMS: MongoDB. It is a document database with document-level locking. It scales really well.
Main point: it uses JSON as its document storage (actually the Binary JSON a.k.a. BSON, but that is just a superset). Inserting a document into the database is as easy as
db.collection.insert(JSON);

on the mongo shell and
DBObject bson = (DBObject) JSON.parse(JSONstr);
collection.insert(bson);

in the java driver.


What would a standing wave of light look like?

Question: I want to know what a standing wave of light would like and what properties it might have that are interesting.
Comment: https://en.wikipedia.org/wiki/Standing_wave#Visible_light
Comment: An 'intuitive' way is to think of something like the [interference pattern](https://en.wikipedia.org/wiki/Double-slit_experiment#/media/File:Double_slit_interference.png) except the distance between a peak and trough will be the wavelength of light, e.g., many hundreds of nm for visible light. So a standing wave of light will just be bands of light and dark, separated by it's wavelength.
Answer: The resonant cavity of a laser is a standing wave. It doesn't really look like anything in particular because the standing waves are not travelling to your eyes. However, you can let some of the wave escape the cavity to do all sorts of interesting things.
The most interesting property is the ability to control cats due to the tight collimation:
Other less interesting properties include that the light is coherent and monochromatic. It can also be very intense and easily focused. It can produce more heat at a target than in the cavity, thus allowing to thermally ablate materials.
Comment: Definitely. All that mumbo jumbo is useless fluff. Producing heat in a target, nah. Who cares that it is monochromatic? What even is coherency? Turning the _real_ rulers of the planet into quivering masses of energy totally focused in that spot instead of on demanding belly rubs? Priceless
Comment: Cats react to non-coherent and polychromatic light as well. The important property in regard to cats is the beam colimation (resonant cavities are good at colimation, too).
Comment: Why would standing waves not look like anything? Although they are not travelling, there is still an osscilating poynting vector that is non zero, so if I were to stick my head through one, I would still see something no? It's time average is obviously zero but that is very different than saying it is zero
Comment: I am not going to encourage people to stick their head in a laser cavity nor write the answer to assume that they might stick their head in a laser cavity. At no point did I imply or state that it is because the Poynting vector is zero.
Answer: This answer is about how a technical diagram of such a wave looks like, since with the naked eye you won't be able to see a standing wave of light for the simple reason that you can only see the wave part travelling in your direction.
If the two wave components of the standing wave are of the same wavelength like the red and blue one, the standing wave looks like the green one:

If we are moving with v=c/2 to the right relative to the setup so that the wavelengths get shifted and are no longer of the same frequency, the scene would be

so the zero points of the  standing green wave would have the lorentzcontracted distance to each other as they should and keep the correct position, but the rest of the wave beside the zeros would not look as uniform as if the observer was at rest relative to the two wave emitters.
Due to the relativity of simultaneity the hulls of the standing waveform (dashed) would be drawn in a wavier way like in the second image, where the shown setup (for example the inside of the laser pointer cavity from here) is moving to the left relative to the observer with c/2.
The colors are of course just for separation and do not represent the color of the lightbeams.
Comment: What are `the two wave components`?
Comment: @AnoE A standing wave requires two waves travelling in opposite directions. In the charts, the two waves here are shown in red (travelling to the right) and blue (travelling left).
Answer: A standing wave is formed when two (plane) waves of the same frequency travel in opposite directions. If you stand inside a plane wave of light, you see it as a "star": a point of light infinitely far away in the direction the wave is coming from. So if you filled a room up with an optical standing wave (not sure how you would do this... it'd be like building a room-sized lasing cavity), and then you stood in it, assuming the presence of your body doesn't ruin the wave, you would simply see a "star" in one direction and another "star" in exactly the opposite direction.
A laser is such a cavity where one wall is leaky, allowing one of the plane waves to exit as the laser beam. So it might be accurate to say a standing wave "looks like" two opposing laser beams.
Answer: It arguably doesn't "look" like anything. The standing wave in an optical resonator (e.g., a laser cavity) is trapped in the cavity. It isn't entering your eye. If we're talking about a laser, then the part that escapes the cavity and ultimately enters your eye† arguably is no longer a standing wave.
A diagram that represents a standing wave of light would look the same as a diagram representing any other standing wave.

† Do not stare into beam with remaining eye.
Comment: Well, if you were an electron in that resonator though you'd get pretty excited!
Answer: If you could stand at a node in a perfectly round monochromatic light two optic resonant cavity, you would see a small circle of light.   If you could stand at the anti-node you would see a large circle of light.
No monochromatic light source is prefectly round so inside a real resonant cavity the light will have a central beam and what we call junk light around the central beam that will bounce around in the cavity by not produce a standing wave.
As the light leaves the resonant cavity it's no longer a standing wave and its properties are changed by the optics the light goes through or bounces off of, so what you see outside of the resonant cavity isn't what you would see inside the cavity.
Comment: Aren't the nodes spaced apart by a wave length, i.e. something in the sub-micrometer range for visible light? How can you "stand at a node" or at an anti-node in this case?
Answer: The light in a laser cavity is standing wave. If we measure the intensity of light, we will get an image like this:

This picture is from Chang H C, Kioseoglou G, Lee E H, et al. Lasing modes in equilateral-triangular laser cavities[J]. Physical Review A, 2000, 62(1): 013816.
But if we observe the cavity with eyes, in fact we just get the light escaping from the cavity, it looks like:

This picture is from Guidry M A, Song Y, Lafargue C, et al. Three-dimensional micro-billiard lasers: the square pyramid[J]. EPL (Europhysics Letters), 2019, 126(6): 64004.
Here we used a microscope camera to take the photo.


Is there a way to surround a weapon in particles in minecraft bedrock edition

Question: I want to surround like a darkness particle around a netherite sword. And also wrap a golden sword in flame particles.
Comment: As far as I'm aware, there are no NBT tags that give a held or dropped item particle effects.

A few tutorials for background:

https://www.reddit.com/r/MinecraftCommands/comments/5emp37/player_particles_when_item_held/
https://www.youtube.com/watch?v=hEUu-GLtBlw

Basically, the technique seems to be:
 1. Identify everyone holding the useful item
 2. Run a repeating command block that generates particles offset from the player's facing direction.
Comment: Thank you for this, I couldn't think of another way to do it
Answer: There's really no way to do it that looks good, but it's certainly possible. The following answer was written with Java commands in mind, as I'm less familiar with the Bedrock versions. The underlying ethos still holds, however, and I'll get to why.
The best I've got is a repeating (or clocked impulse) command block that runs:
execute at @e[nbt={SelectedItem:{id:"minecraft:netherite_sword"}}] run particle minecraft:flame ^-.5 ^1 ^ .1 .1 .1 0 10

Basically, select every entity actively holding [item] and run particles offset from where they're looking such that the particles happen to be where the player (or entity's) hand is. It's enormously manual since zombies (for example) hold their hands in a different place than humans. You'd probably have to create a unique command for every entity type and it's simply not worth it.
It's got issues! And they're unlikely to be fixed by clever techniques! Basically, carat offsets (which are direction-sensitive) aren't able to trigger against the body.
Carat notation is a way to specify local coordinates relative to where an entity is facing. They're notoriously tricky to work with, which is why I almost never do.
First, carat offsets are dependent on your crosshairs. They'll trigger in different directions when you're in 1st-person or front/back-facing 3rd person. So if you switch your 3rd-person view, suddenly the flames will be in the wrong place. There's no NBT to determine which a player is using, so we're already screwed.
Second, particles aren't visible in front of held items in 1st person unless they're extremely close to your face. At that range, they'll look weird to other players.
Finally, carat offsets (whether they're anchored eyes or anchored feet) are rotated via a player's eyes. Since Minecraft lets you turn your neck, the particles off-center frequently. That looks like this:

Any way you look at it, there's no real way to isolate your sword hand.
Answer: Using Add-ons
Bedrocks add-ons are very powerful and they can help us solve this issue, too. You can not only create custom particle effects, but by modifying the players animation and animation controller (and potentially model) you can attach those particles to the players hand and trigger them on/off depending on the item they're holding.
Going in-depth on how to create custom particles and how to attach them to entities would be too much to fit here, but luckily there is official documentation that covers this:
https://learn.microsoft.com/en-us/minecraft/creator/documents/particleeffects
Using Commands
While Jakob Lovern's answer here already covers some of the pitfalls when you're only using commands, I'd like to point out some ways around those pitfalls to make it a little better. They're also only providing Java syntax, so here is the bedrock selector syntax:
@a[hasitem={item=netherite_sword}]

Now yes, while carat offsets are based on the players viewing direction and there is no way for us to know the direction the body is facing, using rotated we can at least eliminate the up/down axis and thus make it align much better at least as long as the player body is rotated somewhat in the same way as the head is. Using rotated ~ 0 will keep the yaw rotation, but eliminate the pitch.
execute at @a[hasitem={item=netherite_sword}] rotated ~ 0 run particle ...


Icons on Quick Launch show as blank pages - Windows 10

Question: I know this has been asked before, but no answer has worked for me.  I rebuilt the icon cache two or three times and the blank pages keep coming back every time I reboot.  If I click on the program icon, the correct icon returns, only to go to a blank page icon after a reboot. It's not all icons either, just the Office icons, Explorer, and Windows Live Mail icons. Can anyone help with this?  This is a brand new Dell computer and this has happened since day 1.  Thank you.
Answer: FIXED - If rebuilding your icon cache does not fix your problem, maybe this will.

Right-click on the blank page icon in your quick launch area and go to "Properties".
On the "Short Cut" tab, select "Change Icon".
Select the "Browse" button and browse to the executable of that program, probably in Programs.  Example- Internet Explorer - browse to Program Files (x86), Internet Explorer, then click on iexplorer.exe and select open. A whole new set of icons to choose from will open.
Select the icon you want. Click OK, then Apply.

The problem appears to be in the properties of your shortcut.  "Target" and "Start in" may be blank or have a strange string as compared to the quick launch programs with icons that work - they point to their respective executables.
Hope this helps!


How do I remove this shower drain?

Question: It gets blocked easily and I need to get this bit off so I can sort it but it's stuck.
Comment: Chances are the ring spins off, but I'm not sure what you're hoping to accomplish. Any blockage is not part of that assembly. It's in the plumbing beyond. Do you have access from below? Have you tried a plunger or drain cleaner (to dissolve a hair clog)?
Comment: Grout is something between tile, by the way. There is none in this photo.
Comment: You don't need to open it. Get some 'sink & plughole unblocker' from any supermarket. Pour the whole bottle in, leave overnight. Done.
Answer: Only the centre part in this picture rotates/unscrews. The outer ring looks like it will, but the lugs provide a space for water to run under the cover.
Unscrew the centre part anticlockwise with equal and opposite pressure on both the lugs at the same time. Try using both thumbs and hands first. If that fails, you need to find something which fits into the plastic and contacts the plastic lugs.
A rubber ball often works. I've even undone things like this with a small rubber dog ring/chew toy. The rubber grabs the lugs and provides good grip.
Be aware that there is always a risk of breaking it, if it is seized in place due to age/dirt/scale/etc.

How do I remove this shower drain?


What is the coolant fluid used in a 2015 BMW X 5–5.0i turbo coolant reservoir?

Question: What is the coolant fluid used in a 2015 BMWX 5–5.0i turbo coolant reservoir?
Comment: FYI there is no such thing as "turbo coolant". The car is a turbo, and needs coolant
Answer: BMW original anti-freeze concentrated fluid, part number is 83 19 2 211 914.
Must be diluted with clean water(probably distilled) in proportion 1:1


What are some good telescopes for a programmer?

Question: I've never purchased a telescope and I was considering buying one. However, I wasn't sure what to look for. I love to tinker and so a telescope that I can program with libraries such as SPICE would be great. Any ideas?
Comment: Welcome to Astronomy Stack Exchange! I feel like this question is sort of opinion based... What does everyone else think? (By the way, I have little to no expertise in telescopes, so I'm very sorry that I can't help)
Comment: You might want to start by doing some stargazing (or planet gazing) with binocs just to see if it's something you like doing.   Then decide whether you want to observe, or to get into photography.
Answer: One project you could work on is an Arduino-based Go-To telescope system. You could use, in theory, any scope that can accommodate the addition for this purpose. Also, it's my understanding that any Go-To system that can be connected to a computer can receive custom scripts you could write. At least, I know it's true for the NexStar system.
In my opinion, it's best to start with a simple Dobsonian telescope from a reputable dealer, without any programmable components. It will force you to learn the sky well before you start observing. And it will serve as an entry-level introduction to the world of telescopes.
Answer: What do you want to be able to see with it?
The previous answer recommending a simple Dobsonian is my usual recommendation.  An 8" or larger Dob is very easy to use and offers the best price to aperture ratio.  And aperture is the number one consideration in an telescope for visual observing.
When you start looking at computerized mounts, you find that you lose out on capability and quality unless you're willing to pay a lot more.  While you can get a decent 8" Dob for under $500 USD, any computerized (what we call GoTo) telescope in that price range will give you about half the aperture, and all around mediocre to poor quality.
Before buying any telescope, my first recommendation is always to find your local astronomy club and join up.  In the US, memberships typically cost $50 per month or less (usually less).  By going to star parties, you can get a look at a wide range of telescopes and learn their capabilities before you buy.
If and when you do get a GoTo telescope, I'd look into ASCOM (AStronomy Common Object  Model).  The ASCOM group is an open group of developers that work to provide a common interface for telescope control.  Each vendor has their own standards, but ASCOM seeks to bridge the gap.  There are drivers and plugins available to handle most of the popular vendors and manufacturers' hardware.  This goes not only for the telescope mounts themselves, but for some imaging systems, observatory control systems, planetarium software, motorized focusers, etc...  You can learn more about it here.


Is it possible to add a 1 pixel black border to a selection in GIMP?

Question: I have a map with countries of unique colours, I want to add a 1 pixel thick black border between them, I use gimp is this possible. Alternatively is there a free program I can achieve this in?
Thanks for any help!
Answer: Yes you can make a selection and do Edit > Stroke Selection. Set the stroke to 1px.
Alternatively you can draw paths manually using the Pen Tool, or turn a selection into a path using Select > To Path, do Select > None, and then use Edit > Stroke path. This usually results in smoother lines.
TBH, GIMP isn't ideal for this kind of work, and you may encounter some problems for example if you use Select by Color to make your selections. What actually gets selected might depend on the image.  It might also be better to add your strokes to a new layer so that you avoid editing the map layer directly.
Even better in the long run might be to redraw the map using vector software such as Inkscape which is open source and free. Then you can trace over the top of the raster map, deleting it after you've finished, and just add stroke and fill attributes to the vector shapes.
Here's a quick example made in Inkscape. Here I just drew the lines with the pencil tool, with snapping on. Then I used Inkscape's Shape Builder tool to create the individual shape objects, then I added fills, selected everything, then changed the stroke to 1px.


Does $\omega \wedge \mathrm{d} \omega=0$ (where $\omega$ is a non-vanishing $1$-form) imply $\mathrm{d} \omega \in \langle \omega\rangle$?

Question: Let $\omega$ be a non-vanishing (for clarification: nowhere vanishing) smooth $1$-form on a smooth manifold $M$, if $\mathrm{d}\omega \wedge \omega =0$, do we already have $\mathrm{d}\omega= \sum a_i \wedge \omega$ for some $1$-forms $a_i$?
Comment: @Ted Could you please post a solution : I don't understand what you suggest.
Comment: Hint: Extend $\omega$ to a basis for the $1$-forms.
Comment: I think I understand the hint (we would have for $d\omega= \sum a_j \omega_j \wedge \omega_k$ that $\omega \wedge d\omega= 0$ implies (by linear indepence) that all the  $\omega \wedge \omega_j \wedge \omega_k$ must vanish). But, being a beginner in differential forms on smooth manifolds: can we extend to a basis globally? Or does this suffices locally?
Comment: Dear @user110071 when you talk of basis, you must indicate of what vector space. If you consider the space of global differential $1$-forms $\Omega^1(M)$ you can choose a basis $(\omega)_i$ of it (with some $\omega_{i_0}=\omega$) but the subtle point is that the products $\omega_i\wedge \omega_j$ will definitely not be a basis of $\Omega^2(M)$ and you can't write $d\omega$ the way you do in your comment. That's why I believe that Ted's hint won't work.
Comment: @GeorgesElencwajg As I understand it, one wants that $\{\omega_i(p)\}$ is a basis of $T_pM^\ast$ for every $p$. Then $\omega_1 \wedge \omega_j$ is a basis of $\Omega^2(M)$ as a $C^\infty(M)$-module, isn't it?
Comment: Dear @Daniel: exactly, but as you very judiciously  point out in your answer it is impossible to find such a basis of $\Gamma(M,\Lambda ^2T^*M)=\Omega^2 (M)$ unless $M$ is a parallelizable manifold, a very rare occurrence  even among spheres, as you well know !
Comment: @GeorgesElencwajg Yes. That's where the second part of my answer helps, however.
Comment: @GeorgesElencwajg With a local frame on a coordinate patch $U$, $d\omega \wedge \omega = 0$ gives you smooth forms $a_i^U,\, 2\leqslant i \leqslant \dim M$ such that $d\omega = \sum a_i^U\wedge \omega$. Then take a partition of unity to glue $\{ a_i^U : U \in \mathscr{U}\}$ together.
Comment: @GeorgesElencwajg If I have $d\omega\lvert_U = \alpha^U\wedge \omega$, and take a partition of unity $\{\varphi^U : U \in \mathscr{U}\}$, then $$d\omega = \sum_U \varphi^U d\omega = \sum_U \varphi^U (\alpha^U\wedge \omega) = \left(\sum_U \varphi^U \alpha^U\right)\wedge\omega.$$
Comment: @Daniel. Yes, I agree, this is correct: why not post it as an answer in which you would also explain how to solve the local case on $U$, explaining how the non-vanishing hypothesis is used ?
Answer: No: $M=\mathbb R^2,\: \omega=xd y$
Edit
In the first version of the question "non vanishing" was in brackets and I interpreted the question as "not identically zero but maybe having zeros", as is indeed the case in my example..
Comment: This form is not nonvanishing.
Comment: I'm sorry I had the "non-vanishing" in brackets only at first, so now I see that for the statement to have a chance to hold (I still do not know if it is true), this is at least necessary.
Comment: Then $d\omega = (dx/x) \wedge \omega$.
Comment: Then $\mathrm{d}\omega = \mathrm{d}x \wedge \mathrm{d}y = \frac{1}{x} \mathrm{d}x \wedge (x \mathrm{d}y)$.
Answer:
But, being a beginner in differential forms on smooth manifolds: can we extend to a basis globally?

In general, no. On parallelizable manifolds, you can extend to a global basis in the sense that $(\omega(p),\omega_2(p),\dotsc,\omega_k(p))$ are a basis of the cotangent space at every point, but not on other manifolds.

Or does this suffices locally?

If your definition of manifold includes paracompactness (or second countability, which implies paracompactness for locally Euclidean Hausdorff spaces), then there exist smooth partitions of unity subordinate to every open cover of $M$.
You can then extend $\omega$ to a local frame on every coordinate patch $U$
 - meaning you find smooth $1$-forms $\omega_2,\dotsc,\omega_n$ on $U$ such that $\omega(p),\omega_2(p),\dotsc, \omega_n(p)$ is a basis of $T_p^\ast M$ for all $p\in U$ - and the condition $d\omega \wedge \omega = 0$ then implies that, with smooth functions $\beta_k$, we have
$$d\omega = \underbrace{\sum_{k = 2}^n \beta_k\cdot \omega_k}_{\alpha_U}\wedge \omega$$
on $U$. Cover $M$ with a family $\mathfrak{U}$ of such coordinate patches and find a subordinate smooth partition of unity $\{ \varphi_U : U \in \mathfrak{U}\}$. Then you have
$$d\omega = \sum_U \varphi_U\cdot d\omega = \sum_U \varphi_U (\alpha_U\wedge \omega) = \Biggl(\sum_U \varphi_U\cdot \alpha_U\Biggr)\wedge \omega.$$
Comment: +1 for drawing attention to the importance   for global forms $\omega_i\in \Omega^1(M)$ of having as values at a point $p\in M$ linearly  independent linear forms $\omega_i(p)\in T_p ^*(M)$


Difficulty in thinking properly during exams

Question: I am a student of science preparing for the JEE (India). When I normally practice problems, I find no difficulty in thinking straight. Solutions occur to me when I look at a problem, because for the most part, my fundamentals in Physics, Chemistry and Math are clear.
But each time I sit down to take a test, I experience some sort of blockage in the mind, as if I'm not paying attention to the question (when actually I am paying attention). I find it harder to work my way around a problem during the exam than I would during practice. Had this difference between practice and exam been little, I probably would have ignored it. But it is so huge that I can feel how drastically it is affecting my score. It just feels like somebody has switched off a valve in my mind, drastically reducing my brainpower. And it's so frustrating to come home from a test and find easy questions that I could have solved, but didn't because their simple solutions didn't occur to me.
Is it because of the pressure that comes with a timer going on or could it be something else?
And how do I deal with it?
Answer: I find that doing strenuous exercise, like an hour-long swim, before an exam relaxes me and calms the nerves.
Comment: @RitwikOjha I would echo this answer. The morning of my music performance exam I worked out and did some exercises and weight lifting. Also what helped me what eating a lot of oily fish, particularly salmon, which contributes to relaxation and a state of mental wellbeing. People often discount stuff like food and exercise and their effect on the brain but they can really help as exam prep.
Answer: If you are cramming for the exam, or studying up to the last minute, stop doing that. Let your mind have a chance to settle and integrate your knowledge. Otherwise you are liable to remember only the last thing you looked at.
Also, if you are "studying" by trying to memorize facts, find a different method. You speak of doing "practice problems". That is usually better than reading the book or memorizing.
But longer term, if you take good notes, you can also "study" by going through them and summarizing them in a smaller space, reducing 10 pages to 1, or to a few note cards. You are more likely to recall what you wrote than what you read.
Answer: Along with the previous good advice:

I would try "easing into problems" by rewriting the question within your answer space.  Often doing this gets your subconscious engaged a bit in the problem and it decreases the anxiety versus having to immediately spit out an algorithm.
Do more practice.  I know this sounds counterintuitive since you say 'I'm fine on practice, but not performance', but (a) even if this is true, "overdoing" the practice may compensate for your blanking and (b) it is INCREDIBLY common for students to say they do enough practice, but really...THEY DON'T.  An easy thing to do is to work 100% of the text's drill problems versus just the assigned ones. [One sneaky benefit is that teachers often use unassigned problems or at least the methods or tricks in unassigned problems on test questions.]
Use your practice/homework to somewhat mimic exam conditions.  Work the problems expeditiously (not frantic, but also not slow).  Be very strict about working all the sections problems, then checking the answers (not one by one, but whole section.)  If you do not have access to full answers, then try to purchase an answer book or at least go to office hours to use the instructors solution guide. Try NOT to look back for formulas or methods but after reading the section, write down a small "cheat sheet" of formulas/methods, memorize that and then set it aside, and then work the problems, closed book.  If you miss ANY problem for a conceptual reason OR a "dumb mistake", force yourself to work the entire problem over again, closed book.  That is the "punishment" for getting it wrong.

P.s.  Other study habits: read the section and work the drill problems BEFORE the lecture.  The lecture then becomes review.  Make sure you work every example problem as you read the text.  You may think this is inefficient time-wise, but I find that you end up saving time "on the back end".  In addition, you will master the subject much more strongly than if you rely on lecture as your initial learning tool and use the text as a reference.  In any case, you are not doing well and need to compensate.  So going a little overboard is worth it.  (But I actually still, paradoxically, don't think it is time inefficent...mastery learning ends up being way better use of your time.)


Modelling an application in Rails - mixing STI and polymorphic associations

Question: Please forgive me if this has been answered already but I've searched a lot and still require some clarification.
I'm building a Property Management tool using Rails 3.2. I already have a User model and authorisation/authentication code in place with full tests coverage.
I've just started drawing out the models/classes/tables and have gotten myself a bit confused.
Let's start with Users.
Modelling Users
I plan to have allow multiple companies to use this system. Each will have employees (users). These users will have different roles e.g. Manager, Agent, Accountant, Secretary etc. For the most part the data I plan to store for each of these users will be similar (or so I think at the moment) so I am leaning towards Single Table Inheritance and using the type to define the level of access each employee has.
Secondly, I plan to allow Landlord and Tenants to also log in to the system. Upon logging in they'll be able to view information about the property they are owning or renting - maybe keep their contact details up to date too.
I was thinking of using polymorphic associations to represent these users.
So the plan I have at the moment and would like some feedback on is to have
User < ActiveRecord::BASE
Employee < User (this will have a STI type column and allow for the different employee roles)
Landlord < User
Tenant < User
Is this the best way of approaching this problem or am I shooting myself in the foot?
I've had some people advise me I should have a 'roles' table and assign roles to the users - but I have a feeling this isn't the most elegant way to do this in Rails.
Properties
My next issue is with Properties. Right now I have a model for properties and when I add them they belong_to a User (i.e. they have a user_id foreign key). I then started thinking "what happens if the employee (user) that added the Property leaves the company or has their account deleted for some reason?"
So in this scenario is it best to forgo the User/Employee to Property association and just link the Property to the Company that the employee belongs to? This way I can all employee.company.properties to list out all the properties?
Landlord and Tenant associations
Let's presume we make Properties belong to a Company.
In terms of associations this is what I have in my head. Looking at it now I see that everything belongs to a company because one company using the system shouldn't be able to see the landlords/tenants/employees/properties of another company.
class Landlord < User
  belongs_to :company
  has_many :properties, :through => :ownerships
end

class Tenant < User
  belongs_to :company
  has_one :property, :through => tenancies #you can only live at one place at a time right?
end

class Property < ActiveRecord::Base
  has_many :tenants, :through => :tenancies
  has_many :landlords, :through => :ownerships
  belongs_to :company
end

class Company < ActiveRecord::Base
  has_many :properties
  has_many :employees
  has_many :landlords :through => :ownerships #not sure if through is required/works here
  has_many :tenants :through => :tenancies #not sure if through is required/works here
end

class Employees < User
  belongs_to :company
end

Properties
Also I'm guessing we'll have different types of Properties (Commercial/Residential) and of those there will be whole buildings, apartments within a building (single address) etc.
Like with users I'm planning on using Polymorphic Associations to define two subclasses CommercialProperty and ResidentialProperty and then use sti to define a type. If the type is "multi unit" then have a new model for units and an association whereby Property has_many Units and a Unit belongs_to a property.
Aim
I'm trying to make sure that my code follows best practice as much as possible so that when I come to add new features and expand I'm not left having to re-write large chunks of the app.
I would really appreciate your feedback.
Reference
Some of the posts I've read. Hopefully to help others trying to solve the same problem.
Designing a Rails application: single table inheritance?
Ruby on rails with different user types
Ruby On Rails User Model for multiple types
Answer: It's probably too late but you could also use has_and_belongs_to_many on User and Company and thus avoid STI altogether by using gems cancan and rolify.
It allows you to define finely grained access rights (abilities).
I know that it seems more elegant having different classes instead of roles, but it is not viable long-term strategy, it can become messy when logic becomes complex.
Other then that, the rest seems pretty solid, hope that helps :)


What's the proof for the existence of Angels as well as angelic hierarchy?

Question: It's said that most influential medieval work on angelic order was written by Pseudo-Dionysius the Areopagite. How much authority do his works still hold and what's the metaphysical foundation and necessity for the existence of Angels?
Comment: What kind of "proof" are you after? Most Christians would say the fact that angels are talked about in the Bible is all the proof they need.
Answer: St. Thomas's angelology based on Holy Scriptures
Fr. Garrigou-Lagrange, O.P., discussing St. Thomas Aquinas's sources in Reality: A Synthesis of Thomistic Thought ch. 22, writes:

It is sometimes thought that the treatise of St. Thomas on the angels is an a priori construction, having as its sole foundation the book of Pseudo-Dionysius, called De coelesti hierarchia. This is a misconception. Scripture itself is the foundation on which St. Thomas rests.

Pohle, God the Author of Nature and the Supernatural: A Dogmatic Treatise, pt. 2, ch. 3, §1, Article 1 "Existence & Nature of the Angels":

The existence of Angels is a truth so obviously founded in Scripture, Tradition, and the teaching of the Church that it seems superfluous to undertake a formal demonstration of it. We therefore merely indicate some of the many Scriptural texts in which it is expressly taught: Ps. 90:11; 102:20; 148:2; Matth. 4:11; 18:10; 22:30; 25:31; John 1:51; Heb. 1:4.

Proofs he's not a "pseudo"
Mgr. Darboy famously argued, in the beginning of his Œuvres de Saint Denys l'Aréopagite (1845), that "pseudo-"Dionysius is the actual St. Dionysius that St. Paul baptized in Acts 17:34:

Dionysius the Areopagite and a woman named Damaris and others with them.

Mgr. Darboy has so much data, both intrinsic and extrinsic evidence, in support of his position that the author whom for centuries councils (even heretics!), doctors of the Church, etc., considered authentic is not a "pseudo".
Opponents of his being St. Dionynius base their arguments on one data-point:According to Stiglmayr's Catholic Encyclopedia entry Dionysius the Pseudo-Areopagite, Stiglmayr & Koch (end of 19th cen.), after Mgr. Darboy (1845), allegedly discovered some Proclus verbatim in On the Divine Names! Well, how do they know Proclus (6th cen.) didn't plagiarize St. Dionysius?


How to evaluate equivalent insulation resistance of two cables?

Question: My guess was that the equivalent insulation resistance of two cables in parallel is same as the equivalent resistance of two resistances in parallel. But instead it is the sum of the two insulation resistances. What is the logic behind this?
Comment: Let's play a mind game.  Imagine that there is a battery connected to the parallel conductors.  Now imagine how any leakage current would flow from one conductor to the other.  The current has to pass through the insulation of the first conductor, then flow through the insulation of the second conductor.  In other words, the insulation resistances are in series.
Comment: Welcome. That is often referred by the DC breakdown voltage per mil of thickness. If you want dielectric losses at certain radio frequencies,or digital signal loss or phase-shift per meter, those are all separate issues. Please be specific about your question(s). Your wording is confusing. Two resistances in series is what you might be looking for.
Comment: Thanks @Dwayne Reid But how would the leakage current of one cable pass through the second cable? The leakage current flows radially outward right?
Comment: I'm re-reading your question and I may have misinterpreted what you asked.  Are we talking about two separate conductors that are connected to two different nodes in the circuit?  Or are the conductors connected in parallel with each other?  My comment is correct for the first case but not correct for the second case.
Comment: The conductors connected in parallel with each other.
Answer: You have to think of the path the leakage current would take, I think the comments you received cover this mostly.

simulate this circuit – Schematic created using CircuitLab
think of it like this imagine those two pi circuits are the cables, where the capacitors are the insulation at the start and the end of the cable and the resistor is the "normal" path for the current. Imagine you wanted to reach node 1 from node 2 or viceversa from the capacitors you gotta go through one capacitor reach the point where they have a common connection and then go through the other, so there is a path that goes through two capacitors so you can get from 1 to 2. This path would be the case that they appear to be in series and a voltage divider of some sorts will happen between them.
As one of the people in your comments mentioned if they are fully parallel cables so connect 1 and 2 in my schematic to, this reduces the problem of the leakage current only going through 1 capacitor to reach ground.
I have avoided using ground terminals on the circuit to make my explanation a bit clearer and there is purpose of using capacitors as "insulation" as well.


Do the classifiers need to be tuned at each threshold for ROC curves?

Question: Let's suppose that I have seven classification models (RF, SVM, ANN, DT, kNN, Logistic Reg, LDA), and I would like to evaluate their performance through various thresholds. Receiver operating characteristics (ROC) curve is one of the options out there to do this evaluation.
And a certain threshold (let's say the medium threshold) was adopted to tune the models and to select the salient features. Then, a classifier, such as DT (decision trees) could be with the poorest performance at this threshold but it "surprisingly" turns out to have the best ROC curve, which means it is the best over various thresholds (and it also beats SVM!).
So... Do I need to tune these classifiers and conduct the feature selection at each threshold when the ROC curves are generated?
Comment: Choosing the medium threshold seems strange, wouldn't that result in different false positive rates for the different classifiers?
Comment: Yes, it would lead to different FPRs (on x-axis). From your opinion, at which threshold the models should be tuned?
Comment: I would instead choose an acceptable FPR and see which model has the highest TPR
Answer: NO
The point of the ROC curve is to assess model performance across a range of thresholds. In that sense, the ROC curve and the area under it are measures of how well the model is able to separate the two classes. This is separate from applying a threshold and going with the classifications that arise from the two-step model that first makes predictions on a continuum and then uses a threshold to decide on the bin to which each prediction corresponds.
It might be that some thresholds are terrible for your task, and that is okay. If you get to a point where you have to use a threshold, you would just use a different one and be okay with the fact that some thresholds do not work. In fact, if you have a logistic regression that makes probability predictions on the interval $[0,1]$, setting a threshold of $-2$ or $+2$ puts you in a position where every observation is classified the same way no matter what modeling you do, which probably is not acceptable performance. In that situation, there is literally nothing you can do to tune the model to make varied categorical predictions.


C# shared memory between C++ application and C# application using COM object

Question: Is it OK/possible to have a shared memory in a COM object which will be consumed by applications built using C# and/or C++?
Can C# access shared memory in COM object without crash?
Thanks,
Adi Barda
Answer: Yes it is you need -- all you need to do is create a memory mapped file. If you can't do this in .NET directly, you need to do it in C/C++ code which you embed and call from your .NET application.
Making it crash proof requires understanding the underlying subtleties properly, for that boost::interprocess might help as it abstracts these quite well.
Answer: I don't really see what role the COM object plays in this.  But, no, there isn't anything that makes MMFs fundamentally incompatible with managed code.  They are merely very awkward to use since you need pointers to access them.
Support for MMFs is coming in .NET 4.0.  It is probably too soon to use that in production code.  But do make sure to take a look at the API so that what you do now is going to fit the API well when you switch.


Difference between mass and weight

Question: I already know that when I standing  on weighing machine it's measuring my mass not my weight, but when I take the same machine to moon it's will read different value. According to my information that the mass is constant!
How does it change?
You will answer me because it depends on gravity.
I said to you so we must  consider it weight not mass because mass is constant and not change with gravity force!
Comment: Hi Waleed. Your question has been addressed many times already. Note that a weighing machine measures **weight** not mass.
Comment: Hi Mr.John I'm so sorry for my bad pattern in question. my language is very week, I'm from sudan. Sorry again.
Comment: Hi Waleed. You don't need to apologise. Your question is a duplicate, but searching this site to see if your question has been asked before isn't easy. I didn't downvote your question and I think the downvotes are unfair. Have a look at the previous question and see if it does give you the answer you want.
Comment: Hi Mr. John.  Yes it's clear  now when I standing on weighing machine it's measuring my weight???
Answer: It depends on the scale.
Some scales (called balance scales) balance your weight against the weight of a known mass. Your weight is a force, calculated as mass x acceleration. The weight of the known mass is calculated the same way. Generally, there's some kind of adjustable leverage for the known mass. The scale is calculated by measured weight of known mass in the lab x multiplier used for leverage = weight of person on scale. So if the mass weighs 3 lbs, and there's a 50x multiplier at a specific notch on the scale, then the mass is putting 150 lbs of force on the lever in one direction. If the lever is balanced at that setting, that means you have to weight 150 lbs.
But there's an "error" here. The weight of the known mass depends on the acceleration in your reference frame. If you're on the moon, the mass weighs only ½ lb, so it's only putting 25 lbs of force on the scale, so you only weigh 25 lbs. But the painting on the scale doesn't change, so it's wrong. Technically speaking then, the scale measures mass, not weight, and the numbers should reflect mass. So instead of 150 lbs, it should read 68 kg, or 10 stones, etc. Of course, the scale isn't intended to be used outside of Earth, so the "error" is just a simplification. Because you're actually on Earth, and the scale knows you mass 10 stones, you do, in fact, weight 150 lbs.
Now, spring scales operate differently. In this case, your mass is accelerated by gravity to put a force against a spring of some type. The spring's compression/expansion rate is independent of acceleration, so the length of displacement is directly proportional to the force you're putting on it. If the spring has a rate of 100 lbs per inch, and you're displacing it 1.5 inches, that means you're putting 150 lbs of force on it.
If you move this to the Moon, gravity is only accelerating you at 1/6 g, so you put 25 lbs of force on the spring, and it will only displace 1/4 inch. This 1/4 inch displacement will be correctly measured as 25 lbs.
Addendum:
Technically, pounds are a measurement of force, and kilograms are a measurement of mass. In the real world, however, we typically use them a bit interchangeably. If I say "this has 200 lbs mass", I mean it's mass is enough that it would weigh 200 lbs on Earth. If I say "this weighs 68 kg", I mean it is putting the same force on the scale as a 68 kg object would on Earth.
So a spring scale, measuring weight, might use kilograms as the unit. Technically, that's wrong, because the scale measures weight, not mass. But as long as you're on Earth, the mass is correct. Just like the mass scale can correctly state your weight on Earth.

Difference between mass and weight


Why does OpenProcessToken fail with ERROR_ACCESS_DENIED

Question: I'm running a process as a user in the Administrators group, trying to get a process token for another process.  The other process is run by a user not in the Administrators group.  Here's the gist of the code I'm using.  pid in this code represents the process id of the non-admin process.  All of this is on Windows XP SP 2 and all on the same machine.  No remote access going on here.
<code>HANDLE handle;
HANDLE token;

handle = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,pid);
token = NULL;
OpenProcessToken(handle,TOKEN_DUPLICATE,&token);
</code>
Reference for OpenProcess here: http://msdn.microsoft.com/en-us/library/ms684320%28VS.85%29.aspx
Reference for OpenProcessToken here: http://msdn.microsoft.com/en-us/library/aa379295%28VS.85%29.aspx
OpenProcess succeeds, but no matter what I pass for the DesiredAccess argument to OpenProcessToken, it fails and GetLastError() return ERROR_ACCESS_DENIED.  I added some code to understand the privileges of the process running this code and to enable as many as possible, as well as to gather information about the process I'm trying to get a token for.  That involved requesting more access (READ_CONTROL | ACCESS_SYSTEM_SECURITY in addition to PROCESS_QUERY_INFORMATION) from OpenProcess and calling GetKernelObjectSecurity(handle).  Here's what I've got:
current user: PLEASE_T\dbyron (S-1-5-21-3405506234-1792454352-3826119157-1005)
current process: group 0: flags: 0x00000007 sid: S-1-5-21-3405506234-1792454352-3826119157-513 (PLEASE_T\None)
current process: group 1: flags: 0x00000007 sid: S-1-1-0 (\Everyone)
current process: group 2: flags: 0x0000000F sid: S-1-5-32-544 (BUILTIN\Administrators)
current process: group 3: flags: 0x00000007 sid: S-1-5-32-545 (BUILTIN\Users)
current process: group 4: flags: 0x00000007 sid: S-1-5-4 (NT AUTHORITY\INTERACTIVE)
current process: group 5: flags: 0x00000007 sid: S-1-5-11 (NT AUTHORITY\Authenticated Users)
current process: group 6: flags: 0xC0000007 sid: S-1-5-5-0-91553 (no account mapping)
current process: group 7: flags: 0x00000007 sid: S-1-2-0 (\LOCAL)
SeDebugPrivilege privilege enabled
SeTakeOwnershipPrivilege privilege enabled
SeSecurityPrivilege privilege enabled
SeChangeNotifyPrivilege privilege enabled
SeBackupPrivilege privilege enabled
SeRestorePrivilege privilege enabled
SeSystemtimePrivilege privilege enabled
SeShutdownPrivilege privilege enabled
SeRemoteShutdownPrivilege privilege enabled
SeDebugPrivilege privilege enabled
SeSystemEnvironmentPrivilege privilege enabled
SeSystemProfilePrivilege privilege enabled
SeProfileSingleProcessPrivilege privilege enabled
SeIncreaseBasePriorityPrivilege privilege enabled
SeLoadDriverPrivilege privilege enabled
SeCreatePagefilePrivilege privilege enabled
SeIncreaseQuotaPrivilege privilege enabled
SeUndockPrivilege privilege enabled
SeManageVolumePrivilege privilege enabled
SeImpersonatePrivilege privilege enabled
SeCreateGlobalPrivilege privilege enabled
I've tried to get every privilege possible, and I think the group information above shows that the process calling OpenTokenProcess is a member of the Administrators group.
Here's the information from GetKernelObjectSecurity:
control(SE_DACL_PRESENT | SE_SELF_RELATIVE, 0x00008004)
owner sid: S-1-5-21-3405506234-1792454352-3826119157-2807 (PLEASE_T\dummyusr)
group sid: S-1-5-21-3405506234-1792454352-3826119157-513 (PLEASE_T\None)
grant: mask(PROCESS_ALL_ACCESS, 0x001F0FFF), flags(0x00000000): S-1-5-21-3405506234-1792454352-3826119157-2807 (PLEASE_T\dummyusr)
grant: mask(PROCESS_ALL_ACCESS, 0x001F0FFF), flags(0x00000000): S-1-5-32-544 (BUILTIN\Administrators)
grant: mask(PROCESS_ALL_ACCESS, 0x001F0FFF), flags(0x00000000): S-1-5-18 (NT AUTHORITY\SYSTEM)
So it appears that the dummyusr (non-admin) process allows access to the Administrators group.  It's possible I'm misinterpreting the So why does OpenProcessToken fail with ERROR_ACCESS_DENIED?  I've tried changing TOKEN_DUPLICATE to TOKEN_QUERY but that doesn't change the result.
Am I missing a privilege?  What else would deny me access to an access token for this process?  I've tried this on a machine with no anti virus software and still I get the same result.
I also tried this running in system context.  The info about the current process in that case is:
current user: NT AUTHORITY\SYSTEM (S-1-5-18)
current process: group 0: flags: 0x0000000E sid: S-1-5-32-544 (BUILTIN\Administrators)
current process: group 1: flags: 0x00000007 sid: S-1-1-0 (\Everyone)
current process: group 2: flags: 0x00000007 sid: S-1-5-11 (NT AUTHORITY\Authenticated Users)
Note that the flags are slightly different for the BUILTIN\Administrators group.  The administrator process had 0xF and the system process had 0xE.  From http://msdn.microsoft.com/en-us/library/aa379624%28VS.85%29.aspx, the 0x1 bit means SE_GROUP_MANDATORY which doesn't seem relevant here.
By default the system context process also had some additional privileges:
SeAuditPrivilege
SeCreatePermanentPrivilege
SeLockMemoryPrivilege
SeTcbPrivilege
But I disabled them all and OpenProcessToken still succeeded in the system context process.
Thanks for your help.
Comment: (+1) good question. I have face these sorts of problems every few months when I write a new windows service -- and obviously each time I forget the dance.
Comment: Did you found a resolution? (except running as local service)
Answer: Instead of going into details head first, have you gone down the route of elimination ? -- run the process as LOCAL_SYSTEM and see if that does the trick. After all if God can't do it then no one can :P.
Comment: Good idea.  I tried it and of course it worked as the system account.  Unfortunately no light bulbs went on about why the admin account doesn't work.
Comment: Another sticking point in these matters is about how you are connected to the target computer. Remote Desktop Connections do not have "console access" by default. If you are indeed developing remotely: I would reccomend the /console or /admin switch (depending on version of windows) -- which you can provide to the RDP client via the connection string.
Comment: This is all on one machine.  No remote access going on here.
Comment: My two-cents are on a quiet antivirus hooking your OpenProcessToken(handle,TOKEN_DUPLICATE,&token);
calls
Answer: I guess that the SECURITY_DESCRIPTOR of the targeted process only allow the SYSTEM user to open his process token.
This would mean sadly that there's nothing you can do.
Answer: yes there is a solution you can run a service or an instance of your app as service. this way you will get your code running as system....
Another option (but more intrusive) since you are already admin, is to change the target process acl....


How is the a Fermi surface different from a Fermi sphere?

Question: How is a Fermi surface (a surface in reciprocal space separating the occupied electron states from unoccupied states at $T=0$) different from a Fermi sphere? Is Fermi sphere a special case of Fermi surface?
Answer: Yes, a Fermi sphere is just a special case (and almost always an idealization). The shape of a ``real'' Fermi surface is discussed in Mermin and Ashcroft, but a quick search on google image gives examples of what they really look like in solids.
Answer: When the system is perfectly periodic, the Fermi surface is the level set associated to the Fermi energy $E_{\mathrm{F}}$, i. e. consisting of those Bloch momenta $k$ for which $E_n(k) = E_{\mathrm{F}}$ holds for some band index $n$. Note that this definition also works for insulators where the Fermi energy lies in a spectral gap. But then the Fermi energy is the empty set.
For homogeneous systems where the Hamiltonian is just the free Hamiltonian $H = \frac{1}{2m} \bigl (- \mathrm{i} \hbar \nabla \bigr )^2$, then the only energy band is $E(k) = \frac{\hbar^2}{2m} k^2$ so that the Fermi surface is a perfect sphere.


cross compiler ldd

Question: I have created a cross compiled arm executable. I want to find the library dependency of the executable. I am using ubuntu natty and installed arm-linux-gnueabi tool chain, which does not contain ldd. Is there a tool available to view arm executables library dependancy in linux.
Answer: This is a bit of a kluge, but it's the best solution I could find, and it really works quite well for basic use - just save this script as "arm-none-linux-gnueabi-ldd" with your other cross tools.
#!/bin/sh
arm-none-linux-gnueabi-readelf -a $1 | grep "Shared library:"

Comment: Even my native binutils' readelf does the job (native objdump doesn't).
Comment: Sorry, but readelf cannot replaces ldd. Please see this http://stackoverflow.com/questions/11524820/what-is-the-difference-between-ldd-and-objdump . readelf -d outputs similar to objdump. Can anyone have better answer for this?
Comment: The -a option is a bit overkill, the shared library references are all in the dynamic section, the -d option.  Also, a tool like this or the objdump answer is correct, as a cross-compiler ldd won't work, due to how ldd works: it tries to half-run the executable tracing library loads, which won't work on a foreign binary.
Comment: @longbkit In order to get results closer to `ldd`, you have to call `readelf` recursively.
Comment: In Debian and Ubuntu the name of the program to read ELF binaries is `arm-linux-gnueabi-readelf`. Calling it with "-d" and greping "Shared library:" worked on my machine.
Answer: You could also use objdump and in order to just dump and search the header fraction of the binary. This may save you some milliseconds...
#!/bin/sh
arm-none-linux-gnueabi-objdump -x $1 | grep NEEDED

Comment: In Debian and Ubuntu the command's name is `arm-linux-gnueabi-objdump`.
Answer: Here is another option, you can set LD_TRACE_LOADED_OBJECTS environment variable to any value, say 1, and then you just run the executable, the output should be  its dynamic dependencies.
Answer: I found this and hope it can help a lot of people who are still searching for a true ldd solution. ldd is just a script with support of ld-linux library. So why not making your own ldd script? First you need to find ld-linux library in your system, which should be available. In my case it is /lib/ld-linux-armhf.so.3 so I put this into RTLDLIST as you can see in the script below.
And put this script in your device or board and you can have ldd which is very convenient to find dependents libraries for an executable.
Good luck!
#! /bin/bash
# Copyright (C) 1996-2011, 2012 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.

# This is the `ldd' command, which lists what shared libraries are
# used by given dynamically-linked executables.  It works by invoking the
# run-time dynamic linker as a command and setting the environment
# variable LD_TRACE_LOADED_OBJECTS to a non-empty value.

# We should be able to find the translation right at the beginning.
TEXTDOMAIN=libc
TEXTDOMAINDIR=/usr/share/locale

RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /lib/ld-linux-armhf.so.3"
warn=
bind_now=
verbose=

while test $# -gt 0; do
  case "$1" in
  --vers | --versi | --versio | --version)
    echo 'ldd (Ubuntu EGLIBC 2.15-0ubuntu10.3) 2.15'
    printf $"Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
" "2012"
    printf $"Written by %s and %s.
" "Roland McGrath" "Ulrich Drepper"
    exit 0
    ;;
  --h | --he | --hel | --help)
    printf $"Usage: ldd [OPTION]... FILE...
      --help              print this help and exit
      --version           print version information and exit
  -d, --data-relocs       process data relocations
  -r, --function-relocs   process data and function relocations
  -u, --unused            print unused direct dependencies
  -v, --verbose           print all information
"
    printf $"For bug reporting instructions, please see:
%s.
" "<http://www.debian.org/Bugs/>"
    exit 0
    ;;
  -d | --d | --da | --dat | --data | --data- | --data-r | --data-re | \
  --data-rel | --data-relo | --data-reloc | --data-relocs)
    warn=yes
    shift
    ;;
  -r | --f | --fu | --fun | --func | --funct | --functi | --functio | \
  --function | --function- | --function-r | --function-re | --function-rel | \
  --function-relo | --function-reloc | --function-relocs)
    warn=yes
    bind_now=yes
    shift
    ;;
  -v | --verb | --verbo | --verbos | --verbose)
    verbose=yes
    shift
    ;;
  -u | --u | --un | --unu | --unus | --unuse | --unused)
    unused=yes
    shift
    ;;
  --v | --ve | --ver)
    echo >&2 $"ldd: option \`$1' is ambiguous"
    exit 1
    ;;
  --)       # Stop option processing.
    shift; break
    ;;
  -*)
    echo >&2 'ldd:' $"unrecognized option" "\`$1'"
    echo >&2 $"Try \`ldd --help' for more information."
    exit 1
    ;;
  *)
    break
    ;;
  esac
done

nonelf ()
{
  # Maybe extra code for non-ELF binaries.
  return 1;
}

add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
add_env="$add_env LD_LIBRARY_VERSION=\$verify_out"
add_env="$add_env LD_VERBOSE=$verbose"
if test "$unused" = yes; then
  add_env="$add_env LD_DEBUG=\"$LD_DEBUG${LD_DEBUG:+,}unused\""
fi

# The following use of cat is needed to make ldd work in SELinux
# environments where the executed program might not have permissions
# to write to the console/tty.  But only bash 3.x supports the pipefail
# option, and we don't bother to handle the case for older bash versions.
if x=`set -o` && test "$x" != "${x#*pipefail}" && set -o pipefail ; then
  try_trace() {
    eval $add_env '"$@"' | cat
  }
else
  try_trace() {
    eval $add_env '"$@"'
  }
fi

case $# in
0)
  echo >&2 'ldd:' $"missing file arguments"
  echo >&2 $"Try \`ldd --help' for more information."
  exit 1
  ;;
1)
  single_file=t
  ;;
*)
  single_file=f
  ;;
esac

result=0
for file do
  # We don't list the file name when there is only one.
  test $single_file = t || echo "${file}:"
  case $file in
  */*) :
       ;;
  *) file=./$file
     ;;
  esac
  if test ! -e "$file"; then
    echo "ldd: ${file}:" $"No such file or directory" >&2
    result=1
  elif test ! -f "$file"; then
    echo "ldd: ${file}:" $"not regular file" >&2
    result=1
  elif test -r "$file"; then
    RTLD=
    ret=1
    for rtld in ${RTLDLIST}; do
      if test -x $rtld; then
    verify_out=`${rtld} --verify "$file"`
    ret=$?
    case $ret in
    [02]) RTLD=${rtld}; break;;
    esac
      fi
    done
    case $ret in
    0|2)
      try_trace "$RTLD" "$file" || result=1
      ;;
    1|126)
      # This can be a non-ELF binary or no binary at all.
      nonelf "$file" || {
    echo $" not a dynamic executable"
    result=1
      }
      ;;
    *)
      echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($ret)" >&2
      exit 1
      ;;
    esac
  else
    echo 'ldd:' $"error: you do not have read permission for" "\`$file'" >&2
    result=1
  fi
done

exit $result
# Local Variables:
#  mode:ksh
# End:

Answer: I found a solution when running into [Sourceware.Bugzilla]: Bug 16628 - Segfault after a binary without pthread dlopen()s a library linked with pthread while working on a project (which involved porting some C++ code on ARM).
I'm using Ubtu 16.04, and for ARM cross compile tools I installed g++-4.9-arm-linux-gnueabihf (and dependencies, and also forced me to uninstall g++-multilib (and dependencies)). For testing (running) the executables, I installed QEMU (qemu-user-static).
According to [man7]: LDD(1) (which is just a shell (bash) script):

In the usual case, ldd invokes the standard dynamic linker (see ld.so(8)) with the LD_TRACE_LOADED_OBJECTS environment variable set to 1.

I'm going to exemplify on the data from the above bug report.
issue16417.cpp:
#include <string>
#include <iostream>

extern char **environ;

int main() {
    for (char **it = environ; *it != nullptr; ++it) {
        std::string str(*it);
        std::cout << "export " << str.substr(0, str.find('=')) << std::endl;
    }
}

build_issue16417.sh (removed flags unsupported by the compiler):
#!/bin/bash

_BUILD_TOOL_BASE_NAME=arm-linux-gnueabihf-g++-4.9
_FILE_BASE_NAME=issue16417

${_BUILD_TOOL_BASE_NAME} -pthread -std=gnu++0x -pedantic -ggdb -O2 -pipe -mtls-dialect=gnu2 -ftree-loop-distribution -ftree-vectorize -fmerge-all-constants -fira-loop-pressure -pedantic -c -o ${_FILE_BASE_NAME}.o ${_FILE_BASE_NAME}.cpp

${_BUILD_TOOL_BASE_NAME} -pthread -std=gnu++0x -pedantic -ggdb -O2 -pipe -mtls-dialect=gnu2 -ftree-loop-distribution -ftree-vectorize -fmerge-all-constants -fira-loop-pressure -pedantic -Wl,-O1 -Wl,--sort-common -Wl,--enable-new-dtags -Wl,--gc-sections -Wl,--hash-style=gnu -o ${_FILE_BASE_NAME}.${_BUILD_TOOL_BASE_NAME} ${_FILE_BASE_NAME}.o  -Wl,--as-needed -pthread -Wl,-fuse-ld=gold

Output:

[cfati@cfati-ubtu16x64-0:~/Work/Dev/StackOverflow/q006150000]> ~/sopr.sh
*** Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ***
[prompt]>
[prompt]> uname -a
Linux cfati-ubtu16x64-0 4.15.0-39-generic #42~16.04.1-Ubuntu SMP Wed Oct 24 17:09:54 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[prompt]> which arm-linux-gnueabihf-g++-4.9
/usr/bin/arm-linux-gnueabihf-g++-4.9
[prompt]> ldd /usr/bin/arm-linux-gnueabihf-g++-4.9
        linux-vdso.so.1 =>  (0x00007ffdf55c2000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f59b6c62000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f59b702c000)
[prompt]> dpkg -S /usr/bin/arm-linux-gnueabihf-g++-4.9
g++-4.9-arm-linux-gnueabihf: /usr/bin/arm-linux-gnueabihf-g++-4.9
[prompt]>
[prompt]> ls
build_issue16417_g++4.9.sh  issue16417.cpp
[prompt]> ./build_issue16417_g++4.9.sh
[prompt]> ls
build_issue16417_g++4.9.sh  issue16417.arm-linux-gnueabihf-g++-4.9  issue16417.cpp  issue16417.o
[prompt]> file ./issue16417.arm-linux-gnueabihf-g++-4.9
./issue16417.arm-linux-gnueabihf-g++-4.9: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=17e0f3d6ceaa13df4ac031e6581074757abee36c, not stripped
[prompt]> echo ${_QEMU_CMD}
/usr/bin/qemu-arm-static -L /usr/arm-linux-gnueabihf
[prompt]> ${_QEMU_CMD} ./issue16417.arm-linux-gnueabihf-g++-4.9
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
[prompt]>
[prompt]> ldd ./issue16417.arm-linux-gnueabihf-g++-4.9
        not a dynamic executable

As expected, (regular) ldd doesn't work for ARM binaries.
In the ldd script, there's a line (no other one references .sos) somewhere at the beginning:
RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"

As seen, it doesn't have the correct ld.so (so far there are only the i686 and x86_64 ones), so it can't handle ARM binaries. To make things work, either (note that for each option, sudo is required):

Add the ARM one at the end of the line
Create a copy of ldd, and modify that version (replace existing .sos with the right one)

I chose the 2nd variant. But where is ARM ld.so? As you probably guessed, it can be obtained from ${_QEMU_CMD} env var (after all, qemu needs it as well). On my machine it's: /usr/arm-linux-gnueabihf/lib/ld-2.23.so (libc6-armhf-cross required, but that should be installed by now). So, I copied ldd to arm-linux-gnueabihf-ldd, and replaced the above line with:
_LIB_PATH=/usr/arm-linux-gnueabihf/lib

RTLDLIST="${_LIB_PATH}/ld-2.23.so"

# @TODO - cfati: Not a fan of the line below (I think it's considered bad practice), but without it, it can't find the libraries locations.
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${_LIB_PATH}

Also posting the diff format (check [SO]: Run/Debug a Django application's UnitTests from the mouse right click context menu in PyCharm Community Edition? (@CristiFati's answer) (Patching utrunner section) for how to apply it):

[prompt]> diff --binary -uN /usr/bin/ldd /usr/bin/arm-linux-gnueabihf-ldd
--- /usr/bin/ldd        2018-01-15 04:49:13.000000000 +0200
+++ /usr/bin/arm-linux-gnueabihf-ldd    2018-12-04 19:34:19.499001000 +0200
@@ -26,7 +26,13 @@
 TEXTDOMAIN=libc
 TEXTDOMAINDIR=/usr/share/locale

-RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"
+_LIB_PATH=/usr/arm-linux-gnueabihf/lib
+
+RTLDLIST="${_LIB_PATH}/ld-2.23.so"
+
+# @TODO - cfati: Not a fan of the line below (I think it's considered bad practice), but without it, it can't find the libraries locations.
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${_LIB_PATH}
+
 warn=
 bind_now=
 verbose=

Try running the "new" ldd on the ARM executable, and voilà:

[prompt]> arm-linux-gnueabihf-ldd ./issue16417.arm-linux-gnueabihf-g++-4.9
        libstdc++.so.6 => /usr/arm-linux-gnueabihf/lib/libstdc++.so.6 (0xf66c6000)
        libc.so.6 => /usr/arm-linux-gnueabihf/lib/libc.so.6 (0xf65da000)
        /lib/ld-linux-armhf.so.3 => /usr/arm-linux-gnueabihf/lib/ld-2.23.so (0xf6fd7000)
        libm.so.6 => /usr/arm-linux-gnueabihf/lib/libm.so.6 (0xf6562000)
        libgcc_s.so.1 => /usr/arm-linux-gnueabihf/lib/libgcc_s.so.1 (0xf6538000)

Note: What comes next, is not part of the question / answer. Anyway, replacing --as-needed by --no-as-needed in build_issue16417.sh, yields:

[prompt]> vi build_issue16417_g++4.9.sh
[prompt]> ./build_issue16417_g++4.9.sh
[prompt]> ${_QEMU_CMD} ./issue16417.arm-linux-gnueabihf-g++-4.9
export LC_NAME
export LC_TIME
export LESSCLOSE
export XDG_RUNTIME_DIR
export LESSOPEN
export SSH_CONNECTION
export XDG_DATA_DIRS
export LOGNAME
export HOME
export SHLVL
export PAPERSIZE
export LC_MEASUREMENT
export LANG
export PWD
export LC_IDENTIFICATION
export QT_QPA_PLATFORMTHEME
export PATH
export MAIL
export LC_TELEPHONE
export LS_COLORS
export USER
export SSH_TTY
export OLDPWD
export LC_NUMERIC
export SSH_CLIENT
export SHELL
export TERM
export ANDROID_HOME
export LC_MONETARY
export XDG_SESSION_ID
export LC_ADDRESS
export LC_PAPER

:)
Comment: I flagged this as a useful reference that to check what libraries are being used on the target you can often just run `LD_TRACE_LOADED_OBJECTS=1 app_name`, to display the libraries it is referencing (and any missing ones)
Comment: @MichaelFirth: I knew about the env var (it's part of the answer), but that is based on the fact that the loader is able to handle the executable (which is not the case here).
Answer: As already said, by design ldd can only been executed on target. However, it is possible to mimic ldd behavior using readelf. A script called xldd was developed in crosstool-ng project. An independent version of this script is available here:
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

cross compiler ldd


Why a "100% chance" of rain?

Question: A 100% chance means it is certain, so it is not really 'chance' in that case. Someone I know said that rain is always uncertain, so why not say a 99% chance then?
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/142002/discussion-on-question-by-rudolphtheredknowsraindear-why-a-100-chance-of-rain).
Comment: (If you _really are_ a new user, you can ignore the following points, and just take the [tour], especially the part about "good questions".) 1. You posted a low-effort, imprecise question without showing any sort of research. 2. You made no attempts to improve your question while it was open, in spite of several suggestions. 3. You mention "other questions", but your bio https://imgur.com/ll0bFaj.png shows only one question as of today.
Answer: This is an excellent illustration of the difference between "subjective probability" ("credence") and "objective" or "frequentist probability" ("chance"). The Stanford Encyclopedia of Philosophy explains this well.
Specifically: the forecast does not mean that the forecaster believes with 100% certainty that there will be rain. Instead, it means that, when they simulate different weather patterns using some model or other, then subject to that model's constraints they will get "rain" 100% of the time.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/142003/discussion-on-answer-by-alphabet-why-a-100-chance-of-rain).
Answer:
A 100% chance means it is certain, so it is not really 'chance' in that case.

Well, as a matter of fact, it is. The "chance" should be considered as a unit of likelihood, which ranges from "no chance" (0%) to certainty (100%)
However, the whole system of weather forecasting is beset by uncertainty, and English is understood only in context.
Killing Time's comment is useful: https://sciencenotes.org/percent-chance-rain-mean/ You will see that meteorologists use the term 100% chance, and you can too.
Comment: Also, why deviate from the structure already in place of ... *chance of rain*?
Comment: Some things are absolutely certain, and chance doesn't play in to it. I am going to die, it is not a matter of chance. Rain is always less than certain. Unless it is already raining, then calling it 100% chance seems as silly as chance of death, when you are at a funeral. Dithering around serves no purpose.
Comment: This is outdated. Meteorologists now generally *don't* take area into account: https://www.tasteofhome.com/article/percent-chance-of-rain/
Answer: Consider "X% chance of rain" as a set phrase used at the particular interface between the technical-language of meteorologists and the casual-language of laypeople.
Sure, the "0% chance" and "100% chance" edge-cases run somewhat afoul of some semantics, but that is just what happens when technical language meets casual language.

A 100% chance means it is certain, so it is not really 'chance' in that case. Someone I know said that rain is always uncertain, so why not say a 99% chance then?

Breaking the mathematical rigor to patch over some semantics is not a good fix.  At best you're trading one kind of pedantry for another, and at worst you are outright misrepresenting the technical information.
Really, the better fix would be to say "near 100% chance" or "approaching 0% chance" or some other construction along those lines.  But, again, the issue is that "X% chance of rain" is just such a common set phrase that these kinds of edge-case rules are quite likely to be glossed over and forgotten.
Comment: A good answer that addresses the question.
Answer: This question and most of the answers and comments on this page confusingly combine two very different questions:
(1) Is rain ever really certain, and if so, in what way?
(2) Assuming that rain is certain, in whatever way is relevant, why don't weather forecasters just say so, rather than that there is 100% chance of rain.
The first question is a matter of science and philosophy. Only the second question is a matter of English language and usage.
Whether one will find it natural or strange to speak of certainty as 100% chance is a manifestation of a more general difference between people whose ways of speaking are shaped by an education or professional experience that revolves around analysing phenomena in quantitative terms, and those with other kinds of backgrounds. The differences that the latter group characterises as qualitative, may be quite spontaneously characterised as quantitative by the former.
Consider, for example, the difference between moving and standing still. To many people that is probably a very clear, definite, qualitative difference. Such people may speak of moving things as having this or that speed, but would never speak of the speed of an object that is standing still. A scientifically trained person, on the other hand, finds it quite natural to say that such an object has the speed that equals zero. In such a person's conceptual framework, the difference between moving and standing still is merely quantitative; it's the difference between having the speed of zero and having some other speed.
Similarly, the everyday framework for conceptualising probabilities has the concepts such as impossible, a chance of, likely, certain. The differences among these at first appear to be qualitative, and are spoken of as such. People who are trained to analyse probabilities in quantitative terms, however, think of them as a continuum between zero and one. In that framework, something that is impossible has the probability of zero, something that is certain has the probability of one, and everything that is possible but not certain has some probability that is between these extremes. A person who is accustomed to that framework thinks of 100% chance (i.e. certainty) as something that is only quantitatively different from 99% chance, and speaks accordingly; such a person feels no need to suddenly switch to using an entirely different term when the probability of something jumps from 99% to 100%.
Incidentally, the whole matter is not specific to English, as analogous differences between people of different educational/professional backgrounds can probably be found among speakers of any language.
(This answer is an a adaptation of the answer I posted some time ago to a different but related question.)
Comment: I guess it would depend on who the forecast is *for*. In a mixed audience, it should be for the majority. Generally speaking, most people do not have a quantitative background.
Answer: A coin with two heads has a 100% chance of landing heads, right?
I'd argue it can land standing up or even doesn't land at all.
Think of rain as a cake and chance as the ingredients. You might have 100% chance of cake, unless:

The baker falls ill
The baker falls
A dog tips over the ingredients
The oven breaks
The over catches fire and you get a lump of coal
Etc...

You don't have cake until the cake is present.
Don't forget that rain in your area doesn't translate to rain on your head.
At the end of the day it's CYA nomenclature of that respective field because weather reporters know how pedantic people like to be about the weatherman being wrong.
Comment: Yes. I'm just being pedantic about them not being right. Someone I know who used to read the weather forecast out to an Air Force base said that he was told: "*Never give a forecast more than 6 hours in advance.*" We should not express or expect unreasonable certainty. When I see a 10 day forecast I just laugh.
Comment: @RudolphTheRedKnowsRainDear But they are right, there is a 100% chance of rain until there isn't. Just wait till you learn about [puffery](https://rockcontent.com/blog/puffery-advertising-examples/). "100% of the 9 out of the 10 dentists who agree with this statement agree that our toothpaste is the best!" =)
Answer: A 100% chance of rain means that the chance of rain is over 99.5%. That is, typically, the probability is rounded to the nearest integer.  It is not possible for the probability of rain for tomorrow to be exactly 100%, since there is a non-zero probability that the Earth could be destroyed today. But, 99% would imply the chance is less than 99.5%, and would be wrong if the chances were 99.9%. One exception is when it is raining, then the probability of rain presently is 100%.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Comment: You need supporting evidence that the Earth could be destroyed today? Or that weather probabilities are given as integers?  Or that to provide integers one needs to round?
Answer: Means in other words:
In historical weather collection it rained on this date every time over years.
1.10.1999 rain
...
1.10.2003 rain
...
1.10.2022 rain
1.10.2023 > there should be rain with a chance of 100%
If in one of these years no rain had occured the chance would be lower than 100%.
Comment: This is not how weather prediction works. Historical data from previous years is nowhere near enough to tell what's likely to happen; weather is predicted using the movement of air in the surrounding area.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Comment: The issue in the question is with putting "100%" and 'chance' right next to each other, it's not about the weather.
Comment: @Hearth But longer forecasts, like the common 10 day ones, do simply 'predict' the average weather for that time period. What else could they do? So extending the forecast too far (more than about 3 days) is just pandering to people who don't know any better. They should cut the forecast off at a certain number of hours in the future and say, "We have no idea."
Comment: @RudolphTheRedKnowsRainDear It depends on the region. In my area (which has pretty predictable weather), forecasts out to six or seven days are pretty reliable. As I understand it, historical averages aren't used until you go beyond the ten-day forecast, though predictions near the end of the ten-day forecast might not be much more accurate than historical averages.

Why a "100% chance" of rain?


How to hold an umbrella to cover two people?

Question: When you're with someone outside and it suddenly starts raining and only one of you has an umbrella, you'll most likely squeeze under that umbrella with that person.
In my experience one of the people always get's more dry/wet than the other one.
If you are the one holding it: how to correctly hold an umbrella so that both people be equaly dry?
Answer: Generally, you want the umbrella to point in the direction where the rain is coming from, so you make use of most of the surface your umbrella can cover. Then the two people should stick as close together as decently possible.

Without wind it's easy, carry the umbrella between you and the other person, pointing up.
If there is any wind, it will move the rain sideways. It depends on the size of the raindrops and the strength of the wind by how much. The smaller the drops, the closer they will follow the air flow. You will have to pay attention, where the raindrops are actually coming from, as the area protected by the umbrella is not right under it, but is an extension of the direction of the rain. During strong winds, this can be horizontal, so don't worry if you hold the umbrella sideways of where you are. The advantage of transparent umbrellas will become quickly apparent when the wind is coming from the front. Make sure it's protected zone covers the two of you. It is usually a good idea if the person walking on the windward side will hold the umbrella. Also, keep in mind that the wind will cause eddies on the side to carry rain inside the supposedly protected area under the umbrella, so with wind you should hold the umbrella as close to yourselves as possible.
In build up areas on windy days, you will likely notice the wind eddying around structures. This will appear as if the direction of the wind is changing all the time. I think this is where umbrellas quickly become useless anyway. You can try and adjust where you point the umbrella. Usually, the wind will catch sooner or later under it and turn it inside out anyway. This is the time where you should think about finding other kinds of shelter. Having said that, @BenPen comments about a special 'Gust Buster' umbrella that lets the wind escape from the top, so it doesn't turn inside out as easily as others do.
Size matters, especially when sharing an umbrella. If it isn't large enough to cover the two of you, all that water which is kept away from the centre will drip down at the sides. If this drip happens to fall on you, it can be more penetrating than being exposed to the rain directly. You can not make the umbrella larger than it is, but you can spin it, so this drip off will fly away from you, rather than hit you.

So in short, unless there is no wind there is no one correct way to hold the umbrella to cover the two of you. It is rather a matter of paying attention to where the rain is coming from and to adjust the position of the umbrella continuously to provide cover equally. Also, you may want to consider getting yourself one of those extra large umbrellas, when you expect to share one frequently.
Comment: I have a "gust buster" umbrella, which lets the wind escape out the top(ish) so it does not turn inside out.  I have not been in hugely strong winds with it yet, but it does a great job as far as I've been able to see.  It's not super cheap, but if you are in one of those urban areas where the wind swirls, it keeps things manageable, and keeps you drier than with an inside out umbrella.
Comment: @BenPen Thanks for the hint. I included that in my answer, so it doesn't get lost.
Answer: It's a good question. While using an umbrella, the portion that you can save out of the rain is as highlighted below:

In order to get both of them equally dry, you should keep going side to side as shown below:

Or you must have a big umbrella like one of these:
Comment: The umbrella in picture 3 is not big, it is a storm umbrella, where the front and sides are short and only the back is the normal full size umbrella length. There are 2 people umbrellas, but this is not one.
Comment: img2 is the best way to go and what I always choose. But the boy on the left should hold the umbrella with his lefthand to center it. Or if he is 100% righthanded, he should be on the left side.


How are neurotransmitter receptors discovered?

Question: Many neurotransmitter receptors are known, for example 5-HT2a, Mu, NMDA, and so on. How have these receptors been discovered?
Comment: Now? Or originally?
Answer: Each receptor has its own story of discovery. I'll share here the methods used by Lefkowitz that led to the discovery of one of the first neurotransmitter receptors, namely the β2 adrenergic receptor (β2AR) from frog erythrocytes in 1981. With this I mean β2AR was among the first receptors that was identified, purified, and characterized both at the protein and DNA level.
Lefkowitz's team was the first to uncover the charactistics of a neurotransmitter  at the protein and DNA level. βARs are involved in regulating cardiovascular function. Lefkowitz was awarded the Noble prize for his early pioneering work on the discovery of these receptors.
His method was based on several steps, namely:

The development of a novel and specific radioligand binding assay to enable the measurement βAR-binding sites;
The identification of detergents to successfully solubilize a functional βAR from membrane preparations;
The synthesis of an affinity resin and photoaffinity ligands to facilitate receptor purification;
Reconstitution of the purified β2AR into phospholipid vesicles;
The demonstration that β2AR couples to, and activates the heterotrimeric G protein Gs and subsequent activation of adenylyl cyclase to produce cAMP;
Purified hamster β2AR was used for peptide sequencing that were subsequently used to synthesize oligonucleotides for cloning studies to isolate β2AR cDNA;

After β1AR, Lefkowitz's lab soon purified β1AR, α1AR, and α2AR.
References
- Benovic, Cell (2012); 151(6): 1148-50
- Lopez-Munoz & Alamo, Neural Transm (2009) 116: 515–33
Comment: It looks like nAChR was earlier by a couple years, compare https://neurotree.org/beta/publications.php?pid=8115 to references in https://www.mdpi.com/2218-273X/10/4/547 β2AR seems to be the first G-protein coupled receptor, though.