Is there a way to propose an edit without automatically applying it?

Question: The site automatically applies edits to the questions when the edits are made by users with a high-enough reputation.  But there are times I am not sure if an edit I would make would be inline with the OP author's intent.  I also don't want to make an edit and, by doing so, mis-attribute to them an opinion which they don't hold.  Is there a way to make a suggested edit?  Or to make an edit and voluntarily have it become valid only after a review?
I understand that this can be done with comments. However, it can be much more difficult to convince someone to change their question than it would be to show them a change, and then have them agree that the change expresses what they meant to say, but in a better way.
Answer: No, once you earn the Edit Questions And Answers privilege, you may no longer suggest edits.
When I'm attempting edits that I'm not entirely sure are in line with the OP's intent, I try to post a comment with a link to the revision history and a short explanation of how the edit can be reversed.  I think this is a good enough solution.
Answer: One possible solution is to have a sockpuppet (AKA a secondary account) suggest edits.
Here are some rules you should follow with a sockpuppet if you are doing this1:

Do not use it to do anything other than suggested edits.
Do not review your own edits in the review queue.
Make it clear that the account is your sockpuppet, preferably with a link to your main account.

It may be worth noting that after 500 approved edits you will no longer be able to suggest edits to posts. At that point I would recommend deleting your sockpuppet and making a new one.
1: Some of these things are not required, per say, but I would still recommend them. Some things I mentioned here are required, and will get you banned or suspended if you don't follow them.
Answer: One clever trick is to submit an edit and then immediately roll it back, accompanying it with a comment for the OP to review the edit history and decide for herself.
So,

the post was in state of revision #41,
you submit a rev. #42
and then rollback to rev. #41, producing rev. #43.
If your original edit is convincing for the OP, the only thing the OP needs is reverting it once again to revision #42, producing rev. #44.

An obvious caveat is that "race condition" is possible. If someone else submits an edit over rev. #43, it would require effort to merge. However, if the post is not very actively edited, you are pretty much safe.
Also, if, for some reason, OP has somehow missed your comment, your entire effort may silently get buried under a mass of other edits.
Comment: I would think that this is a bad way to propose an edit as it would needlessly bump the question to the top of the question list when it isn't needed or wanted.
Comment: Duh!  It's so amazingly amazing, I think I'd like to steal it.  Even in case of a race condition, this just proposes another alternative version of the post.


How to play youtube vidoe using SWFLoader?

Question: How can i play youtube video using SWFLoader?
Currently, i can play only 1 video at a time (suppose its name is A), if i try to play video B it doesnt play it. but if again i play vidoe A, it works.
Any guidance?
Thanks
Answer: if you download "Adobe Tour de Flex" you have a lot of tutorials and working examples also about YOUTUBE API for Flash, this is a working example:
http://tourdeflex.adobe.com/holly/YouTubeSample/YouTubeEmbedPlayer.html
Having Tuor de Flex in your Pc you can also see the code (MXML or AS3)


Applications of Fourier Transforms in Number Theory

Question: I'm looking for applications of Fourier Transforms in number theory.
Comment: You might take a look at:  Montgomery, Hugh L. *Ten lectures on the interface between analytic number theory and harmonic analysis*. CBMS Regional Conference Series in Mathematics, 84. Published for the Conference Board of the Mathematical Sciences, Washington, DC; by the American Mathematical Society, Providence, RI, 1994. xiv+220 pp.
Comment: Even ordinary Fourier analysis is ubiquitous in *analytic* number theory, including the analytic formulas for class numbers of quadratic number fields.  For numerical methods, see Odlyzko et al on computing many zeros of the Riemann zeta function and analogues.
Comment: Just applications of the Fourier transform itself or of more abstract harmonic analysis (e.g. over locally compact groups etc.)? There is a really huge body of work using abstract harmonic analysis in number theory.
Comment: Prime counting functions such as the fundamental prime counting function $\pi(x)$, Riemann's prime-power counting function $\Pi(x)$, and the second Chebyshev function $\psi(x)$ all have Fourier series representations. Please see https://math.stackexchange.com/q/2380164 for a fair amount of insight into the theory and value of Fourier series representations of non-periodic functions.
Answer: Do you know the Riemann zeta function ?
$\displaystyle\frac{\log \zeta(\sigma+2i\pi \xi)}{\sigma+2i\pi \xi}$ is the Fourier transform of the prime counting function $\displaystyle J(e^u) e^{-\sigma u} = e^{-\sigma u}\sum_{p^k \le e^u} \frac{1}{k}=e^{-\sigma u}\sum_{k\ge 1} \frac{\pi(e^{u/k})}{k}$


How to animate the opacity of a texture painting

Question: I painted a red circular spot using texture painting over a UV Sphere with an image texture. Is it possible to animate the opacity of the red spot?
Answer: You need to find a way to mix the basic material and your spot image texture, for example use a MixRGB and plug the Alpha of the Image Texture in the factor socket, then find a way to vary the alpha value, here with a Converter > Math (Multiply):
Comment: I found an addon named Texture Paint Layers in which there is an option to change and animate the opacity of each layer.
Comment: oh ok, anyway I think it just automatically generates some nodes setups, it's always good to know how they work
Comment: Thank for your answer and yeah absolutely ! Its great to know the mechanism


MySQL user passwords in PHP

Question: How do I prevent exposing MySQL usernames and passwords in PHP code when establishing a connection?
Comment: Duplicate of http://security.stackexchange.com/questions/48590/reasonable-way-to-store-encrypted-passwords-in-a-webapps-database-linux
Answer: Hanky 웃 Panky brings up good points. However, I'd like to add to them:

You can mitigate damage by restricting connecting accounts by roles. Let's say you only allow searching on your website. Allowing only SELECT statements for that particular account will prevent anything else from running. This doesn't work if you have an account for each: SELECT, UPDATE, INSERT, DELETE, as an attacker could combine the privileges and cause serious damage.
You can also deny anyone except those with appropriate admin access to the website, whose login will likely be independent of the webhost. IP-based deny all, allow from , for example. Note that this won't completely protect you if you've been breached, nor will it protect you if your web host is the one accessing the database.

Only those with root/admin/shell access to your website can obtain the username and passwords, unless you improperly chmodded the files. If any of those are true, you have much bigger issues than having your MySQL user/pass known.
Comment: Also, another option is to prevent the app to use `DELETE`, and to use `UPDATE table SET is_deleted = true` instead. It's far easier to recover if anything goes wrong, since the application doesn't have evil privileges.
Comment: +1 for different SQL accounts. There's no need to give an application the access to `DROP TABLE` if it never uses it for example. If a cron must drop tables, then make that cron executed on a machine which isn't connected to the web.
Answer: It is never a good idea to store passwords in source code. Source code has the horrible tendency of becoming public. This can happen by an exposure in your version control system (google aws key github to read some horror stories), you share the source code with someone, a but in your PHP configuration serves your source code, etc...
Also, you should be able to change your password on an independent schedule from source code upgrades. Something storing them in the same file prevents.
Instead, put the password in a configuration file. This file should be outside of the web root to reduce the likelihood that it will be incorrectly served to the user. Secure it with appropriate OS permissions. You can pass the password to your PHP via an environment variable.
Answer: The typical answer is: store them in configuration files because code files are often published. A new trend seems to be to store it in environment variables, if you can control those when starting the server. On shared hosting this is not the case, and then configuration files are a fine option. After all, once someone gets to your filesystem, they could also change your source code and thereby do anything anyway.

MySQL user passwords in PHP


Shift the file while writing?

Question: Is it possible to shift the contents of a file while writing to it using FileWriter?
I need to write data constants to the head of the file and if I do that it overwrites the file.
What technique should I use to do this or should I make make copies of the file (with the new data on top) on every file write?
Answer: If you want to overwrite certain bytes of the file and not others, you can use seek and write to do so. If you want to change the content of every byte in the file (by, for example, adding a single byte to the beginning of the file) then you need to write a new file and potentially rename it after you've done writing it.
Think of the answer to the question "what will be the contents of the byte at offset x after I'm done?". If, for a large percent of the possible values of x the answer is "not what it used to be" then you need a new file.
Answer: Rather than contending ourselves with the question "what will be the contents of the byte at offset x after I'm done?", lets change the mindset and ask why can't the file system or perhaps the hard disk firmware do : a) provide another mode of accessing the file [let's say, inline] b) increase the length of the file by the number of bytes added at the front or in the middle or even at the end c) move each byte that starts from the crossection by the newcontent.length positions
It would be easier and faster to handle these operations at the disk firmware or file system implementation level rather than leaving that job to the application developer. I hope file system writers or hard disk vendors would offer such feature soon.
Regards,
Samba

Shift the file while writing?


How many volcanic eruptions would be necessary per year to neutralize global warming?

Question: Volcanic eruptions sometimes cool the earth. How many eruptions of what magnitude, locality  and type would be required per year to neutralize Global Warming?
Comment: Please submit to what-if.xkcd .  I'd love to see Randall's analysis!
Comment: @CarlWitthoft as you so requested email sent
Answer: Volcanic eruptions release both stratospheric ash, which reduces insolation at the ground, and carbon dioxide, which has a long-term warming effect. The ash falls out of the atmosphere after a few years, but the extra carbon dioxide is brought from underground into the biological carbon cycle more or less in the same way as the carbon from fossil fuels. My understanding is that over geological timescales volcanic eruptions have a net warming effect.
For example, the 1991 eruption of Mount Pinatubo released tens of megatons of sulfur dioxide and hundreds of megatons of water; it seems reasonable to estimate that it also released tens of megatons of carbon dioxide, a few parts per thousand of the current fossil fuel output. So I revise my initial hunch: that carbon dioxide output sounds safe to neglect compared to our fossil fuel use.
Aerosols from that eruption are credited for a 0.5 ºC temperature drop for the years 1991–1993. We could define "one pinatubo" as an event that causes a temporary change in temperature of one degree Celsius for one year; a permanent change in temperature would be measured in "pinatubos per year." In that case, the current predictions correspond to one or two pinatubos per year by midcentury, and two to six pinatubos per year by 2100.

It's also important to keep in mind that the change in carbon dioxide content of the atmosphere over the past century matters as much for its effect on atmospheric and ocean chemistry as for its effect on temperature. Carbon dioxide has nearly doubled in the atmosphere, from a historical fraction of around 250 ppm to 400 ppm today. This change is being reflected in the carbon dioxide dissolved in the ocean as carbonic acid; there are predictions that the oceans may become too acidic to support corals in only a few decades.
Answer: It depends on the eruption, location, magnitude , timing etc. Have a look at the great Krakatoa eruption in 1883.

In the year following the eruption, average Northern Hemisphere summer temperatures fell by as much as 1.2 °C (2.2 °F).[9] Weather patterns continued to be chaotic for years, and temperatures did not return to normal until 1888.

Note, the famous  climate models give order 1C changes in half a century or so, not in a year. These models are on a sliding scale, always fitting the previous and exploding in the future. This is from 2007

Figure SPM.5. Solid lines are multi-model global averages of surface warming (relative to 1980–1999) for the scenarios A2, A1B and B1, shown as continuations of the 20th century simulations. Shading denotes the ±1 standard deviation range of individual model annual averages. The orange line is for the experiment where concentrations were held constant at year 2000 values. The grey bars at right indicate the best estimate (solid line within each bar) and the likely range assessed for the six SRES marker scenarios. The assessment of the best estimate and likely ranges in the grey bars includes the AOGCMs in the left part of the figure, as well as results from a hierarchy of independent models and observational constraints.

I would not bet on the models being correct.

The eruption injected an unusually large amount of sulfur dioxide (SO2) gas high into the stratosphere, which was subsequently transported by high level winds all over the planet. This led to a global increase in sulfuric acid (H2SO4) concentration in high level cirrus clouds. The resulting increase in cloud reflectivity (or albedo) would reflect more incoming light from the sun than usual, and cool the entire planet until the suspended sulfur fell to the ground as acid precipitation.

So one such eruption  in five years seems good enough to cool the climate drastically, whether heated by natural cycles or not.
Let us hope that it does not happen.
Comment: So roughly, one krakatoa = five pinatubos.
Comment: @rob I guess so :). Hope our luck holds.
Answer: Search AGWunveiled to see volcanic events on graph with measured average global temperatures. Any effect is lost in random scatter except Tambora in 1815 (approximately 10X the next largest) which was followed by 'the year without a summer', 1816.


Random directions of the trajectories in a cloud chamber

Question: It is easy to construct a home-made cloud chamber. In observation, one finds that the directions of the trajectories are quite random. Does this mean that all the particles detected are secondary cosmic rays?
Comment: For the most part primaries don't make it to elevations where humans live. Remember that there are around 10,000 kg of atmosphere above each square meter of surface. That's a lot of shielding.
Answer: It turns out there is a lot of interesting physics involved in explaining this.
Cosmic rays are about 90% protons and 10% alpha particles (with small amounts of other objects). However these mostly get stopped by collisions in the upper atmosphere. The collisions mostly create muons, so the cosmic rays we see at ground level are mostly muons. Strictly speaking these are already secondary cosmic rays, so I guess that would make the tracks you observe in the cloud chamber tertiary rays, but lets overlook this nicety for now.
The tracks you see in the cloud chamber start when a high energy cosmic ray muon collides with and ionises an air molecule. The collision ejects an electron from the molecule and it's that electron that leaves the track. So the track starts at the site of the muon-molecule collision and fades out after a few cm as the electron loses energy.
So the question is why the high energy muon doesn't leave a track while the low energy electron does. And the answer is (as I've implied by mentioning the energy) that in general the energy loss per unit length is higher for low energy particles like the electrons that it is for high energy particles like the muons i.e. the electrons interact more strongly with the air in the chamber than the muons do.
The energy loss per unit length is described by the Bethe formula. Rather than just quote the complicated and largely incomprehensible formula let me just show the graph of energy loss as a function of energy from that Wikipedia article:

The energy of the muons created by the cosmic rays is around 4GeV at the Earth's surface so that's off the right hand end of the graph meaning that those muons interact only weakly. Offhand I don't know the energy of the electrons that leave the tracks, but I would guess they are around $1-10$ MeV and therefore they interact far more strongly.
Comment: Very interesting answer, and very well formulated, thanks John !
Comment: But why cannot the proton travel down to the sea level? It is less than 10 times heavier than muon.
Comment: @Jiang-minZhang: there is 100km of atmosphere in the way!


Sharepoint views: default vs allitems

Question: So I was working on a list and noticed a difference in the way the views load. The default view on the list is titled "allitems" and is set up perfect as of now. When I put the list on the team site page, it is added in with a different view than the default I just created (see pics below). How can I add in the list on a page so that the list displays the correct view?
Answer:
On the Team site page, edit the page and edit the list web part
choose the view you would like to add. (Screen Shot 1)

If you don't find a view that works for you, create another view (starting from the all items view) and it should show on the drop down to choose from! (Screen Shot 2)
Comment: I guess where I got confused was in the ribbon, where it says my current view: default, if I clicked on allitems in the ribbon it took me to the list and didn't change the view
Comment: you can always modify that view as well. Under the drop down, you will see Edit the Current View where you can choose all the columns you would like to see!
Comment: That's what I had been doing, but not that I know the view is hidden in web part properties I will save so much time. Thanks Again!
Comment: you are most welcome!

Sharepoint views: default vs allitems


Can I dedicate a patent to someone?

Question: What are the ways or steps via which I can dedicate my patent to someone else as an innovator? I have tried searching on the USPTO and it only tells about transferring the ownership. Another way I can think of is adding that person as the co-inventor but still this is not something considered as gifting the patent.
Comment: Do you want to acknowledge them or gift the patent ?
Answer: Only actual inventors can be listed as an inventor on a patent. Listing a false inventor could potentially lead to invalidation of the patent. Although this is unlikely, I would avoid this.
Unlike technical papers, it is not a thing to offer a dedication in a patent. In fact I've never seen it done. You could try just writing one in the the body of the patent, but the patent examiner may not allow it.
Answer: It would be very unconventional but you could probably thank a mentor in a sentence without messing anything up.

Can I dedicate a patent to someone?


Work and potential energy

Question: When we lift an object with constant velocity the work done by us is $mgh$, and that by gravity is  $-mgh$. The potential energy gained will come from the work done ( $PE =mgh$ ). But how can the object gain potential energy if the net work done is zero? If work by us is converted into potential energy then what is the effect of work done by gravity, where does it go?
Comment: Possible duplicate of [Work done by gravity on falling object does not seem to equal change in mechanical energy](http://physics.stackexchange.com/q/288273/)  and probably many others.
Comment: **If work by us is converted into potential energy then what is the effect of work done by gravity,where does it go?** I am probably misunderstanding your question, but as I lift a bowling ball, say 2 metres up from the ground, **what** work is being done **by** gravity?
Comment: You are doing work, not gravity.
Answer: Consider the object as the system.
To keep the object moving at constant velocity there are two equal and opposite external forces acting on it.
The force that you exert on it and the force of gravitation attraction on it.
You apply a force on the object and do work $mgh$ on the object and the gravitational force does the work $-mgh$ on the object.
Your work is positive because the force you apply and the displacement are both in the same direction.
The work done by the gravitational attraction is negative becuse the direction of the gravitational force is in the opposite direction to the displacement.
So the net work done on the object is zero and that means that the kinetic energy of the object does not change.
It is inappropriate to talk about potential energy in regard to the chosen system which is the object.
It is the object and Earth system which has the potential energy not the object alone.
When you do $mgh$ amount of work on the Earth and object you raise the potential energy of the system by $mgh$.
You might ask what about the gravitational attraction on the object (force on object due to Earth)?
Well that force is an internal force for the Earth and object system and has a N3L pair which is the attractive force on the Earth due to the object.
Answer: The change in PE is not given by the net work but just by the work done by the gravitational field (with negative sign). This is a definition.
You are probable confusing the change in PE with the change in KE which is indeed given by the net work (work-energy theorem).
In you case, the net wok is zero so there is no change in KE (constant speed). The work done by gravity is -mgh and the change in PE is mgh (PE increases).
Answer:
When we lift an object with constant velocity the work done by us is mgh

Yes, when you lift a brick you do work on it. You add energy to it. You increase its mass. Its mass-energy is increased, and we call the extra energy gravitational potential energy. It's important to note that it isn't in "the system", it's in the brick.
You can work this out if you imagine throwing a brick upwards. Momentum is equal and opposite, such that p1=m1v1 = p2=m2v2 where m1 is the mass of the Earth and m2 is the mass of the brick. However KE=½mv² so KE1 ≠ KE2. The Earth doesn't move in any noticeable way, so the brick gets just about all of the kinetic energy. As the brick slows down this is converted into potential energy. But again, it's in the brick. If you throw your brick upwards at 11.7 km/s, the brick along with all the energy you gave it leaves the system forever. Because 11.7 km/s is escape velocity.

and that by gravity is -mgh.

Gravity doesn't actually do any work on a body. We call it a force, but it isn't a force in the Newtonian sense. Imagine you threw the brick upwards at 10m/s giving it some kinetic energy. Gravity converts the kinetic energy into potential energy, which is mass-energy, such that at the highest point the brick is momentarily motionless, and its mass-energy is at a maximum. Then as it falls gravity converts some of this mass-energy into kinetic energy. When the brick hits the ground this kinetic energy is dissipated, and the brick is left with a mass deficit. See the Wikipedia binding energy article. When you separate two bodies you increase their mass. When one's smaller than the other, you increase the mass of the smaller body more.

The potential energy gained will come from the work done (PE=mgh).

That's right. When you lift the brick you do work on it and you increase its mass.

But how can the object gain potential energy if the net work done is zero?

It isn't zero.

If work by us is converted into potential energy then what is the effect of work done by gravity, where does it go?

The work done by us in lifting the brick goes into the brick. When it falls down gravity doesn't do any work, it just converts mass-energy aka potential energy into kinetic energy. When this is dissipated you're left with a mass deficit.
Comment: Individual objects do not store potential energy.  It is stored in the system.  You admit this yourself by referring to binding energy, and the necessity of discussing *two* objects in that context.  The *definition* of potential energy requires two objects.
Comment: @ John Duffield:  The experiment of moving one brick away from another differs only in scale from the experiment of lifting a brick away from the Earth.  So do we store energy in only the brick that we move in both cases?
Comment: @D.Ennis : no, when you separate two bricks you add energy to both. But when one brick is bigger than the other, you add more energy to the smaller brick.  When one brick is very bigger than the other, almost all the energy is added to the smaller brick.
Comment: Duffeld: So, even with this model it is not incorrect to say that the work is done on the system.   How widely accepted is this model?  What is its foundation?
Comment: @D.Ennis : the mass deficit is widely accepted, as is the idea the gravity is not a force in the Newtonian sense. Its foundation is relativity. However for some reason some will say mass is invariant, and tell you the potential energy is "in the system" rather than in the brick or bricks.  Some will tell you gravitational field energy is negative. It isn't, it's positive, which is why it [acts gravitatively in the same way as any other kind of energy](http://einsteinpapers.press.princeton.edu/vol6-trans/197). Binding energy is negative because there's less energy present in the bricks.
Comment: @garyp : individual objects _do_ store energy. _The mass of a body is a measure-of its energy-content_. When you lift a brick you do work on it. Then it contains more energy. When you drop it, some of this energy is converted into kinetic energy which is then dissipated, so you're left with a mass deficit. Then the object stores less energy. The energy is not in some disembodied location. When you throw a brick up in the air there is no mechanism by which the brick's kinetic energy leaves the brick to be somehow "stored in the system". Note what I said about escape velocity in my answer.

Work and potential energy


Kids/YA chapter book series with a group of kids from 2006ish and I think the title is an acronym or looks/sounds like the word "people"

Question: I don't remember much but the cover was pretty simple, just one color. Gave me Stargirl vibes.  It was about a group of kids. They had an acronym for what they called either themselves or the adults and it had the word people in it? It was a series of 3 or more books. One of them (or all of them?) have a spaceship involved. It was a super simple book, nothing like Series of Unfortunate Events or Hunger Games.
Comment: Did the kids have any sort of extra powers or did they just have a spaceship?
Comment: How old are the kids? What sort of things do they do or actions do they take? Are they based on Earth or somewhere else? Is this set in the near future or some different time period? What was "simple" about it (unlike ASoUE or THG)?
Answer: Possibly this is the AstroKids series by Robert Elmer. It's about some kids--Buzz, Miko, Mir, DeeBee, and Tag--who live on a space station. The kids call themselves the AstroKids, which doesn't contain the word people but it does contain the word kids.
They are simple books, maybe a second or third grade reading level. The covers are simple with one primary color, as you said. There are more than three--the boxed set I have includes five, but I believe there are ten altogether.
The first book is The Great Galaxy Goof.

Here a link to the whole series on Goodreads.


Number of VirtualBox virtual screens limited to two in contrast to other pc 4

Question: The number of VirtualBox virtual screens limited to two in contrast to other pc, how to increase the limit of a number of virtual screens?
Answer: It is dependant on the resolution the host pc uses, the internal graphics memory limit for virtualbox is 128MB and it suffices for about three 4k virtual screens and about 8 full hd 1980x1080  or cca five 2560 x 1440 virtual screen resolutions.
Edit: it automatically increases the memory limit by extending the monitors count, to 256 MB, yet it seems to be sufficing only to the values I mentioned above,
https://askubuntu.com/questions/587083/virtualbox-how-to-increase-video-memory


Extracting relevant information from a long string of ffmpeg data

Question: I'm aware later versions of ffmpeg seem to present this information in a more accessible form, but my application is running on an old version for many reasons right now.
Is it possible to extract

Format: flv (located after Input #0, )
Duration: 00:05:23.20 (located after Duration: )
Bitrate: N/A (located after bitrate: )
Video: h264, yuv420p, 640x360 [PAR 1:1 DAR 16:9] (located after Video: )
Audio: aac, 44100 Hz, mono, s16 (after Audio: )

In the knowledge that these figures/strings might change. It seems like a mammoth task in string searches to me, one I've often struggled with and eventually contemplated suicide. Is there a 'quick way'? or any widely applicable logic to getting this stuff.
<code>... [flv @ 0xa3d3440]skipping flv packet: type 18, size 268, flags 0 Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1) Input #0, flv, from '/var/www/vhosts/test/htdocs/5tester.flv': Duration: 00:05:23.20, start: 0.000000, bitrate: N/A Stream #0.0: Video: h264, yuv420p, 640x360 [PAR 1:1 DAR 16:9], 25 tbr, 1k tbn, 50 tbc Stream #0.1: Audio: aac, 44100 Hz, mono, s16 At least one o...
</code>
Thanks in advance for any help.
Answer: Use regular expressions and try to match your target strings... see preg_match_all
second way of achieving this is to use PHP's explode().
Comment: Could you give me an example for say, Bitrate?


Why do cats act like their food bowl is empty when there is still food left?

Question: So my cats - well, one more than the other - will whine and meow at me in a certain manner that I have come to recognize as, "There is no food in the bowl."  When they exhibit this behavior, I automatically check the food bowl.  Sure enough, there is food in the bowl, but the bottom of the bowl is visible.  Not only that, there is still plenty of food - probably enough for the day.
I know I am not the only one to notice this behavior.  There are even memes about it.

I think it is safe to say if multiple, separate cats exhibit this behavior, then it is an instinctual trait carried on from before domestication, not a learned behavior.  This is similar to cats (and other animals) walking in a circle before lying down.
However, I cant think of what that pre-domesticated behavior would be.  Any ideas?
Comment: This [video](https://www.youtube.com/watch?v=PKffm2uI4dk) mentions this,among many other things,  in a funny way :)
Comment: I think it's just hard for cats to get food from the sides of the bowl.  When I notice the bowl is like this I just shuffle the food more towards the middle and my cat will eat more of it.
Comment: Also, it's not likely that this is a specific "instinctual trait" or behavior.  Rather, it is probably the outcome of some more general tendencies.
Comment: Try getting the kibble back to the middle using just your tongue, or your hands in oven mitts.  This gives an idea how the cat is seeing the situation.
Comment: My cat always meows when the bowl is almost empty. If he can see the bottom of the bowl he automatically assumes the food is gone. Weird, I know. Sometimes I will shuffle the food to fill the space that is showing or just refill his bowl.
Comment: Is it possible that the dry food is not uniformly manufactured so that only (say about) one half of what you serve them isn't tasty? I've had this problem with several dry foods. I'm new here so I will also pose this as a separate question in case this will get attention
Comment: I have a cat feeder tree where they have to use their paw to get food out, then it drops down onto a big platter where they can eat it. All my cats know how to use it, but they complain if it isn't nearly overflowing with food.  This suggests to me it is a freshness issue, or cats are always trying to prepare for a long haul with without food.

For the latter, my theory is that since wild cats didn't have a reliable source of food and hunting is expensive (calories), they evolved to start looking for food long before the current food ran out. "Looking for food" changed, when to start didn't.
Answer: I have noticed this and wondered about it too.
My very vocal cat was crying at me the other day, since I was 30 minutes past the normal feeding time. I looked and they still had some dry food from the morning. I decided to experiment and went over and just shook their food plate making it sound like I dumped food on their plate. It is a flat plate so no whisker contact is involved.
This satisfied him and he stopped crying and ate happily. I believe some of it has to do with them noticing that the food adding event did not occur and becoming worried that there is a break in the normal pattern.
Taken a bit further; the patterns and the routines in which we care for and interact with our cats seems to be comforting to them. They may become a little upset when the routine changes or does not proceed according to schedule.
Answer: My guess has always been that kibble (dry food) gets stale when exposed to air, and the cats are asking for the fresher stuff from the bag.
Even if you store kibble in an open box, there's less surface area exposed to air than in a half-empty bowl, so any added food would seem "fresher".
I haven't noticed this behavior while meal feeding wet food, even when they sometimes leave leftovers after breakfast until I get home from work. In those cases they'll eat the leftovers before asking me for more food.
One difference between wet and dry food is that dry food tends to contain cereals/grains/carbs (it's VERY difficult to manufacture meat only dry food), and those foods are more sensitive to air conditions (going stale) than meat-based (wet) foods.
Comment: @Keltari it may be that you are mixing the fresher stuff with the stale stuff, creating a random reward structure. Or not! I have another theory I'm about to post!
Comment: Animals are not stupid. They learn tricks and get habits; the cat may have indeed noticed that the new food is fresher and that's how he prefers it. Cats are not served big quantities of food usually, their bowls have bigger surface areas and aren't very deep; they might not "dig" in the bottom of the bowl as much as dogs do. I agree with Zaralynda answer. But yes, you can add new food and shake the bowl... cat will still see it as new food... until he figures out what's going on!
Comment: Interesting.  Your theory is pure speculation, however I do see the logic in your statement.  Something in my gut says no, this isnt the reason.  I *suppose* I could test the theory.  It wouldnt be to hard of an experiment to set up...  I am curious to see other peoples answers though.
Comment: one of the reasons I dont necessarily buy the theory is the fact that that the food is always eaten out of the middle of the bowl.   Fresher food would be in the bowl under the other food stacked up on the sides of the bowl.  Im sure a cat could smell that and go for the food at the bottom of the pile stacked around the edge.
Comment: @Keltari I'm not convinced that a cat can smell 'staleness' - staleness is caused by a realignment of starch molecules, not a change from one material to another. From a cat's perspective, the food in the bowl is 'not good' and new food is 'good'.
Comment: FYI, staling is when starch molecules crystallize. The starch molecules need water molecules to form their crystal structure.  They get the water molecules from the gluten. As a result, the network changes, becoming rigid at room temperature and below.  Now I dont believe for a second that  "From a cat's perspective, the food in the bowl is 'not good' and new food is 'good.'"  I can shake the bowl, cover up the empty spot and the cats are content.
Answer: Whisker stress is commonly believed to be discomfort caused by the cat's (very sensitive) whiskers brushing against the sides of a food bowl. Ingrid King (an author who previously spent 10+ years working in a veterinary office) describes it:

Whiskers are extremely sensitive, and when a food bowl is too narrow and too deep, a cat is forced to put her face all the way into the bowl to reach her food. This causes her whiskers to bump against the side of the bowl, which causes discomfort. In extreme cases, cats may refuse to eat out of deep, narrow bowls altogether.

The pictures (not drawings) of the meme mentioned by the question tend to have very steep sides, so the cat will eat out of the center (where it's comfortable and the whiskers have plenty of room), but decline to eat the food on the sides (where the whiskers would rub against one side of the bowl).
I'm not entirely convinced about this.
I tried to find any research to indicate that whisker stress is a real phenomenon for an earlier question and could not find any scholarly (peer reviewed) articles about it. I just found multiple instances of cat owners telling other cat owners about it (and selling special bowls!).
Additionally, we give a bit of dry food in the Flower Slo-Bowl and sometimes the cats ask for fresh even when there is still food in the bowl. They do not eat directly out of the bowl, but have to spend some time "fishing" kibble out of the bowl and onto the floor, where they then eat it (we do this before bed so they are entertained while we sleep). They may just be asking for food that they don't have to work for (wet food meals are fed on platters), so it's hard to tell if this disproves the theory or not.
Comment: I think there's some truth to the whisker sensitivity thing but mine will stick her entire head in a high ball glass to drink my water.
Comment: @Kai - Some cats tend to push food in one direction as they eat - notably Persians.  Too smooth a bowl leads to them shoving it all out the far side onto the floor.
Comment: If you can find a bowl that is completely rounded inside, no corners, that might help, as food will naturally slide to the middle.  I had one like that for my cats years ago, but these days all I see is the bowls with corners.
Comment: again, an interesting theory.  I am not saying you are wrong, but there doesnt seem to be a way to tell for sure.  Its very vexing.
Comment: We feed our cats from plates for this reason; they do seem not to like deep bowls. But like yours, they still don't like crunchies that've been out too long. Entitled little punks...
Answer: From what I have read (and believe when I say I am no expert) cats have to have room for there whiskers because they detect so much as they eat. That is why they eat out of the center of the bowl and not the sides. My cats don't even eat to the bottom of the dishes I have currently because they are to deep for them and constantly complain until I shuffle the food around. For xmas they will be getting new and shallower dishes. Thank you for your time.
Answer: I'm pretty sure one of the reasons is because they want a different type of food. The other day I dished the cat out her regular dry food consisting of chicken and rice pellets. She stared at the bowl. Then I tried a tiny bit of canned tuna which she sniffed, stared at the bowl and then stared at me again. Usually she adores the tuna. Lastly I tried a wet chicken sachet. She sniffed the bowl and proceeded to happily munch away trying to scoop out every last bit and lick the bowl clean. I'm reasonably certain they get tired of munching on the same dry food all day, or indeed the same type of food in general. They like a varied diet much the same as us humans.
Comment: What you say is correct, cats do like different kinds of food, but this is not correct answer for the asked question.


How to update some fields on record on merge operation from "Find Duplicate" button

Question: I need to update some fields in my lead record only when the merge process runs through "Find Duplicate" button and not on normal update operation. Can it be achieved through trigger or do I need to create a custom button that carry out the merge functionality and then use some checkbox to update the record.
Answer: You can determine when a merge DML operation occurs from triggers, but not necessarily whether they're from the "Find/View Duplicates" button. This answer assumes you don't need to differentiate between other merge operations and "Find/View Duplicates" merges.
A merge involves the deletion of the losing record followed by the update of the winning record.  From the after delete trigger of the losing Lead record you can check for the existence of a value in the MasterRecordId field to determine whether the deletion is the result of a merge opration.
Per the Apex documentation:

The following is the order of events when a merge occurs:

The before delete trigger fires.
The system deletes the necessary records due to
the merge, assigns new parent records to the child records, and sets
the MasterRecordId field on the deleted records.
The after delete trigger fires.
The system does the specific updates required for the
master record. Normal update triggers apply.


Error opening in share point document properties with nintex forms in share point 2019

Question: Create a library
go to library setting -> advanced -> enable content types.
Click on the Document content type -> click on Document information panel
Make sure the check box is check to show the panel.
Upload a O365 document to the library.
Click on the elipsys -> Open in word
The document will open and the DIP will open, and the properties will load.
Add a Nintex form to the document library
Take the steps again to open the document from the library
Now the DIP opens, but the properties of the document never load.
enter image description here
Answer: Do contact Nintex support team if you're still facing this issue


What type of mirage is this?

Question: I am very new to the world of mirages and would like some information as to the type of mirage in this picture which I took this morning. It is the cargo ship African Kalmia which passed my location at about 10am (UK time) this morning. I also have some great video of it moving along above the sea but I can't upload the file here. I have taken a picture of a superior mirage from the same location which I uploaded to this site last month, it was of another cargo ship with an inverted image on top. In that picture there was a clear heat haze line but today there wasn't any visible heat haze so I'm somewhat confused.

Comment: [African Kalmia](http://www.cargos-paquebots.net/Revue%20de%20presse/0000_IMAGES-21/396-African_Kalmia.jpg)
Answer: All mirages work on the same principle as fiber optics: a negative gradient of refraction index will create a region of small grazing angles with almost total reflection which confines light rays into the refraction index region with larger index.
Some cargo ships have multiple crane towers, so it looks like you are seeing only the top of those towers reflected on the mirage reflection surfaces

What type of mirage is this?


How do we assume the direction of $u_{\theta}$ and $u_{r}$ in polar coordinate systems?

Question: Is there a way to correctly predict the direction of the unit radial vector and the unit transverse vector in problems like the one below or is it just better to take a guess and solve the problem base on your guess?
Answer: The unit radial vector is always away from the origin. The unit tangential vector is always anti-clockwise around the origin such that $\hat{r}\times\hat{\theta}$ is out of the diagram. Not knowing what the problem is about, I'd probably do it in Cartesian and then convert to polar unless there is something inherently circular about the problem. So if you need a "guess," it would be better understood to be a definition of the coordinate system. Alternatively, you may need to consider a general angle $\theta$ to solve your problem.
Answer: As a rule, $\hat{u}_X$ is always pointing in the direction along which $X$ grows. It works when $X$ is a linear parameter ($x$, $z$, $r$...) as well as when it's an angular parameter ($\theta$, $\phi$...)
So you can either decide the orientation of the parameter and deduce the orientation of the vector, or vice-versa.


Will I loose this content or the content will be saved?

Question: I'm new in drupal. I have one site that is running on drupal version 7 and now needs to be upgraded. My question is: I have big content in this site, after the upgrade will I loose this content or the content will be saved?
Comment: Which upgrade you want to do i.e. core minor or major upgrade. Currently which drupal core version you have?
Comment: There is a great and comprehensive [drupal docs](https://www.drupal.org/upgrade) to upgrade the site. By reading this docs you may know about complete process of upgrading ie *Major version* or *Minor version*. I also found another useful tutorial about [Drupal Upgrade](https://www.siteground.com/tutorials/drupal/drupal_upgrade.htm). Here is step by step procedure to upgrade the site.
Answer: No, you will not loose any content after upgrading the site. But before upgrading the site please take care of the following things.

Back up your database.
Back up your code.
Answer: Your content will be saved, but you should back up your database and all the code inside of your sites folder.
I used to do manual upgrades, but I found that upgrading via Drush is much easier.
drush up updates Drupal core and contrib projects and apply any pending database updates. drush up --security-only will only install security updates, which I find most useful when maintaining older sites.


Contacting EiC on social media

Question: I am in a very frustrating situation. My article is under review for almost 8 months and I didn't hear any response. The average review time for the journal is 3 months. The journal is highly reputed journal, and based on the average time one can expect a response within 2.5 to 4.5 months.
I sent several emails to Editor in Chief (EiC) but I receive same answer, a kind of auto response. Moreover, according to journal policy I can not know the name or contact information of Associate Editor (AE).
The EiC is with me on various social media plateforms like Linkedin and facebook. We had few conversations on various topics, but I never told him about my article. The question is can I discuss status of my article with EiC on social media in informal text messaging?  Is it ethical and fair? I want to expatiate the review process to same level as journal average time shows. I don't want to get an unfair advantage.
Comment: I ran into the handling editor of one of my papers at a conference, and I hadn't heard what was happening for a while so I reminded them that my paper was still awaiting decision. It turns out everything was done except telling me the result, due to busyness.
Answer: I personally don't think that neither "ethics" nor "fairness" are at stake here because if I understood your question correctly what you want to do is simply ask a question using an informal method of communication. I don't see how this can create an unfair advantage to you or even raise ethical issues since the question alone doesn't mean things will get done more quickly/unfairly. You simply want a status update on your paper.
However, I also don't see how such course of action can help you. You should also take into consideration that these things to take time and unless you have a pretty urgent reason, it might not be worth asking it again. Sometimes the EiC is having trouble finding a suitable reviewer for your paper or the reviewer itself isn't finding the time to read your paper (keep in mind that they're usually invited to do so, without any remuneration), sometimes older issues of the paper are delayed... my point is: whatever is going on, it isn't good for the EiC either and he's probably already taking the measures necessary.

Contacting EiC on social media


Does the inverse of an invertible homogeneous element need to be homogeneous?

Question: Let $A$ be a commutative ring, with unit, and suppose $A$ is graded over a commutative monoid $M$. (In particular $1\in A_e$, where $e\in M$ is the identity.) If $x\in A$ is invertible and homogeneous, does $x^{-1}$ need to be homogeneous as well? I've been unable to find previous questions mentioning this on MSE. The thing is that the only example of a graded ring I've ever worked with is the polynomial ring in $n$ variables, so I don't know instances of graded rings to look for counterexamples.
Answer: The other answer only works when $M$ has the cancellation property.
Here is the general case: If $A=0$, the claim is trivial. So assume $A \neq 0$. Let $d = \deg(x)$. Write $x^{-1} = \sum_{m \in M} y_m$ with $y_m \in A_m$. Then
$$1 = x \cdot x^{-1} = \sum_{m \in M} \underbrace{x \cdot y_m}_{\in A_{d+m}} = \sum_{n \in M}\, \underbrace{\sum_{m \in M,\, d+m=n} x \cdot y_m}_{\in A_n}.$$
The idea here is that, although the map $m \mapsto d+m$ might not be injective in general, we can still gather all preimages of a fixed $n$, in order to get a homogeneous decomposition.
It follows $\sum_{m \in M,\, d+m=n} x \cdot y_m = 0$ for $n \neq 0$ (which we do not need in the following) and
$$\sum_{m \in M,\, d+m=0} x \cdot y_m = 1.$$
Since $1 \neq 0$, we have $d+m = 0$ for at least one $m \in M$, but then this is clearly uniquely determined with $m = -d$, and the equation simplifies to
$$x \cdot y_{-d} = 1.$$
So $y_{-d}$ is homogeneous and inverse to $x$, hence it must be $x^{-1}$.
If $M$ and $A$ are not commutative, we can use a similar argument, but we also need to use $1 = x^{-1} x$ to conclude that $d$ is left and right invertible, hence has a unique inverse, and proceed as before.
Answer: Inverse element $x^{-1}$ is homogenous.
In fact we take homogenous decomposition $x^{-1}=y_1+\cdots+y_k$ where $y_i$ is homogenous element s.t. $\deg(y_i)\neq \deg (y_j)$.
Then $xy_1+\cdots+xy_k=xx^{-1}=1\in A_e$, but because of $\deg(xy_i)\neq \deg(xy_j)$ we get $k=1$. It means $x^{-1}$ is homogenous.
Comment: This argument is not completely correct. It becomes true when the grading monoid $M$ satisfies the cancellation property (ie $a+b=a+c$ implies $b=c$). This is the case in the vast majority of applications, though.


Move to SSL and have 2 x domains, make one canonical or not?

Question: This is an updated version of 2 x domains for same site in Google make canonical or not and I am posting it again as A) there is a new SSL aspect to the question and B) it's nearly 4 years old and things change.
To recap the current situation, a site launched in 1999 with a domain consisting of two, very descriptive words (let's say dog-toys.ie). In about 2001 I parked dogtoys.ie onto dog-toys.ie (client had radio ads and figured the dash may add confusion to the site name).  Also, for both domains, we have not made www canonical so www.dogtoys.ie/example.html or dog-toys.ie/example.html are the same page.
Based on advice here in March 2014 we did nothing and site continues to do well in Google. Searches show both domains have fairly even indexing:
<code>site:dogtoys.ie         About 3,500 results
site:dog-toys.ie        About 3,040 results
</code>
We are re-visiting this because of the general move to SSL which now factors into ranking, and browsers give a not secure warning on forms.
Should I redirect, using a 301 in htaccess,  http://dogtoys.ie to https://dogtoys.ie  and separately http://dog-toys.ie to https://dog-toys.ie? Is there a SEO hit with this?
Or, (my preferred choice) send http://dogtoys.ie or http://dog-toys.ie or  http://www.dogtoys.ie or http://www.dog-toys.ie to https://www.dog-toys.ie (and of course all pages)
Any advice / thoughts please - could we loose ranging by combining the domains?
Answer: Multiple changes at the same time can mess up things sometimes. At the other hand: changing everything to fix everything at once can be the best approach for you as well.
In the end, to my humble opinion, the best situation would be to redirect (301) all properties (non-www, non-ssl, and similar domains) to the preferred one. So http://dom-ain.com/page.html is redirecting to https://www.dom-ain.com/page.html
But if your current index/ranking is okay, and changing it step by step feels better for you, you could approach it like:

Make both (ssl and non-ssl) available / crawlable on all your domains.
Set the canonical to the preferred version.
If that went well, do the same for non-www and similar domains.
If you see most of them moved to the preferred ssl domain, you can set up redirects on the server.

Regards, Peter
Comment: Thanks Peter, seems a good plan. I'm confused by the last step. "If you see most of them moved to the preferred ssl domain" - do you mean if I see https://... appearing in the search results, without me doing any re-directs?
Answer:
Should I redirect, using a 301 in htaccess

Yes

Is there a SEO hit with this?

It can be small positive factor
Comment: Thanks. Are you saying I should continue to not make one of the domains canonical?


Can a term be both deictic and cataphoric?

Question: In a sentence like "Will you, Maria?" where there is cataphora, can you be both deictic and cataphoric? In general, can a term be both anaphoric and deictic?
Answer: Yes, depending on what it means for "a term to be both anaphoric and deictic". You is both referring to a context-specific thing (deictic) and also refers to a term that appears later in the sentence (cataphoric).
It could reasonably be thought that you carries a [+deictic] property since any sentence with you will necessarily reference something in the context. However, you does not seem to carry a [+cataphoric] property since you can come in a sentence where there is no cataphora.

You are smart.

In the above sentence, there is no cataphora since you does not refer to any term/phrase that appears later in the sentence. Cataphora seems to be a relationship between terms in a sentence, and thus the term itself is not cataphoric.


Can not get Raspberry Pi to send UDP Datagram

Question: Environment: Raspberry Pi 3; Raspbian Jessie (update/upgrade) today; coding in NodeJS (Javascript)
I do my development in Windows under Visual Studio 2015. The code works correctly there. The receivers all see the datagrams and Etherdetect (think wireshark) show the traffic as expected. When I move the code to the RPi the traffic never shows up on the LAN, Etherdetect sees nothing, the receivers see nothing.  The same nodejs environment is on the windows and RPi systems. The LAN is a single network.
The code looks like:
<code>var message = new Buffer(data);
var client = dgram.createSocket('udp4');
client.send(message, 0, message.length, "192.168.1.255", 3639, function () {
         client.close();});
</code>
Any help greatly appreciated.
Answer: I found the problem.  It seems on the raspberry pi you need to bind the socket and setBroadcast true.  socket.bind(port,function() { socket.setBroadcast(true); socket.send( . . . . .
Comment: any chance you have a Git repo or anything so we can see the full code?


How to display notification every week?

Question: I want to create a notification for users to remind them to open my app, in case they haven't opened it for more than a week. How can this be accomplished if my app isn't opened?
Answer: You can use AlarmManager to schedule and run your notification code. http://developer.android.com/reference/android/app/AlarmManager.html
You can find a lot of tutorials e.g. http://code4reference.com/2012/07/tutorial-on-android-alarmmanager/
So when your app starts you should cancel previous alarm and schedule new alarm to now + one week. This way alarm will be called(and notification displayed) only if app was not opened for more than week
Answer: you can try implementing push notifcations. Here is an example from parse. Very easy. You can also do your own. Push Notification

How to display notification every week?


Starcraft 2 update crash

Question: I'm trying to update Starcraft 2 to patch 1.3.1. Everytime it tries to write the patched files the entire system freezes and eventually also crashes.
The OS is 10.6.7 there is no log from starcraft itself most of the Times sometimes it tells me to Run the Blizzard Relais Tool. I tried fixing Disk permissions and Erlangung the filesystem. Also reinstalling didn't help.
Any ideas?
Comment: You will have to provide a lot more information, as Operating System version, Console output before/after the crash. etc. How do you expect anyone to come with a possible fix if you say "i try to update X and it crashes"…
Comment: Maybe someone had the Same Error before...
Answer: I had a similar issue. Starcraft has a temporary file that generally sits at /Applications/Starcraft II/Battle.net/Battle.net-patch.MPQ, when I deleted this file and started the repair tool at /Applications/StarCraft II/Support/Repair it worked beautifully.

Starcraft 2 update crash


short refrigerant pipe sweating, need insulation ideas

Question: I have noticed the refrigerant pipe that is inside the condenser, the one that connects to the compressor, was sweating the other day. I did read on here as far as energy efficiency goes it does not need to be insulated.

But please see the attached image, the pipe is turning green. Is that corrosion? Should I just insulate that small section? putting the insulation right up against the connector junction?
Comment: Copper patina   It will turn green but it's not corroding.   I would leave it as is.
Comment: technically it _is_ corroding, but that's certainly not a problem,
Comment: "Is that corrosion?", "Should I insulate?", and "What kind of insulation?" are really 3 different questions you're asking here. It seems that, so long as the condensate has somewhere safe to go (i.e. it's not going to drip onto wood & rot through something), there's nothing to worry about, but you may want to consider [edit]ing your post to focus on only one question.
Answer: The corrosion/patina on the copper might seem like a bad thing because you're used to rust on steel, but it's not the same process.  Rust on steel doesn't form a good bond on the metal, it expands, and it flakes off, exposing more steel that then rusts and flakes off, etc.  It's a destructive process.
Copper an aluminum corrode much, much slower because the compounds they produce are bound tightly to the surface of the metal and actually create a protective coating that prevents further corrosion.  Aluminum loves to bond with oxygen, so bare aluminum rapidly oxidizes (corrodes, "rusts"), but that forms a hard layer of aluminum oxide that keeps more oxygen out.  The process is similar with copper, but with different compounds.
Those AC components are produced like that with full knowledge that it will have rain and condensation on it all the time.  The patina won't be an issue and doesn't need anything to stop it.
Comment: wow! thank you so much, this is the most informative answer. you explained the reason of the appearance, the difference in corrosions, and the reason to leave it be. the answer is concise and informative.


Ubuntu 18.04 Desktop Remote Access Windows

Question: How can I access my Ubuntu 18.04 desktop server with Windows? Which RDP and VNC are best suited?
Answer: I've been using RealVNC for a while now on mutliple platforms. For a VNC connection, definitely consider it. You can download it from here. It supports all common platforms including Windows, Mac, Linux, Android, iOS etc. Install RealVNC viewer on Windows, and RealVNC server on Ubuntu.
Answer: The remote access programs are good if you have a complicated password because I have had cases that have hacked servers for these programs. After these attacks I started using anydesk and teamviewer (it is paid, the free version is useful if you connect a few times during the month) for my remote connection.
The programs that serve with the identification of the IP of my computer do not serve me because it is very easy to guess.
So, if you want to use remote access programs use long and complicated passwords, point them in a file where you organize yourself and put the file password.
Why do I use these programs? However simple it may be, they create an identification and random passwords that are changing, that if you want you can make them static, adding a password that only you know and the password that the program gives you will continue to change.
This is just my opinion, the decision is yours.


How temperature gradient is a vector?

Question: Everyone knows Temperature gradient is a vector quantity having direction from cold to hot.My confusion: why is temperature gradient vector if its direction is always fixed (as in the case of pressure) (Don't say that it is because it follows vector law of addition,I am searching for more concrete answer...)
Answer: A maybe more mathematical awnser: You can define temperature as a scalar field (e.g. on earth). So given a certain position on the surface of the earth (or in three dimensions if you wish, it does not change anything) you have a scalar, the temperature on this position. Now you can take the gradient of this field, and now you have a vector.
More directly on your question: 1) A vector is still a vector, even if he has a constant value.
2) Why is its value fixed? You don't know where the temperature is highest, or you can even define a time dependend temperature field, (on earth temperature is not fix, it changes quite obviously), then its gradient is not fixed either
Comment: First of all thank you...,secondly what is the meaning of the direction which is always certain, the nearest example of which I previously mentioned.
I don't know why you introduced the concept of the dimension and space here well in fact that was not necessary.The real concept that "the gradient of a scalar field is a vector" would have been more than sufficient.
At last but not at least I never said vector is not a vector if it has a constant direction, I wanted to ask What is the meaning of the direction if it is always the same no matter whatever happens..
Answer: Temperature gradient is actually an object called a one-form. A temperature gradient does not have a direction. Instead you combine it with a vector to get a scalar (the temperature change). It's the vector that gives the direction.
To take a simple 1-D example, suppose we have a temperature that varies along the $x$ axis as:
$$ T = 298 + x $$
so at $x = 0$ the temperature is 298K, at x = 1m it's 299K and so on. The temperature gradient is obviously 1 degree per metre. If we take a unit vector pointing to the right i.e. $\vec{x} = (1)$ and multiply this by the temperature gradient we get +1 i.e. the temperature rises by 1K when moving 1m in the positive $x$ direction. But suppose we take a unit vector pointing to the left, $\vec{x} = (-1)$ and multiply this by the temperature gradient we get -1 i.e. the temperature falls by 1K when moving 1m in the negative $x$ direction.
So you can't say that the temperature gradient has a direction. It's the vector you choose to multiply it by that gives a direction i.e. hotter in one direction and cooler in the opposite direction.
The example is rather trivial in 1D, but gets more interesting in 3D, and more interesting still in curved co-ordinate systems as found in general relativity. In fact a gradient is the archetypal example of a one-form used in many GR textbooks.
Comment: That's not quite true. One can define the gradient as the result of the metric-generated canonical isomorphism between cotangent and tangent bundles applied to the exterior derivative of a function (the one-form you describe), which provides a direction that's no longer arbitrary. This is a vector that's consistent with the elementary calculus notion of gradient, and so I think preferable to simply using it as a synonym for 'exterior derivative of a function', as you have here.
Comment: @StanLiou: your comment tells me I don't understand this subject as well as I thought. I'll leave my answer in place for now, but I will delete if you think it is misleading.
Comment: @StanLiou Nice ans dude, I checked a lot of book to catch it and was satisfactory.. John,  Don't delete it.. It is not misleading.. I voted it up because it was nice..

How temperature gradient is a vector?


Unsupervised Clustering of 6-d vectors

Question: I have 17k vectors, each having 6 points, I want to cluster the vectors based on nature of points, eg. linearly increasing into one cluster, convex in another cluster, concave in another, decreasing in another and so on. What would be a good strategy to do this? I need it to detect outlier vectors.
Answer: First of all, most clustering methods will be fine when used right. E.g. with correlation, or appropriate normalization.
Secondly, if you already have patterns in mind, use classification.
Third, in order to find outliers, clustering is not too helpful. Because it is not reliable enough. Rather use one of the clever outlier detection methods such as KNN, LOF, LOOP.
Don't forget detailed and problem oriented preprocessing to prepare your data as good as possible.
Answer: Try to fit several regression models, then collect the coefficients.
First,  build simple linear regression model (for each vector), collect coefficients. then fit a polynomial regression model collect model coefficients, then maybe fit such model model on scaled data, or normalized data.
Collect the model coefficients and perform a  cluster analysis on them.
In R you could use the broom::tidy() method to collect the model coefficients from 17k model fits. I don't know if there is a python equivalent for broom.

Unsupervised Clustering of 6-d vectors


Network and Security Associates v.s. CISCO Security Associates

Question: My college is expanding the Information Technology department to include Networking and Security as well as the CISCO Security. In my research online I have found different information for each everywhere I have looked. What I am wondering is: in a nutshell what is the difference (beyond one being CISCO focused, I get that much), and which one would be more beneficial. Because they are new programs that haven't been formalized my school cannot give me any information beyond what classes I can take now that are guaranteed to be in them. Thanks.
Comment: I completely understand about needing more information for a better answer, and I would happily provide more if I had it. Since they are future programs, the only thing they know about them is that they are going to be including them in the fall.
Comment: The Cisco class may follow a Cisco certification.  That can be a bonus.
Answer: Without further information we can't tell you which is better. However, by name, I guess the first one is better.
Why? Because it seems to be general whereas the second is only Cisco related.
You can do the first one and then get certified in Cisco.
Comment: The one good thing about vendor-specific training is that the course material tends to be well-written and tested, where a general education programme is dependant on the college's department. It is worth checking out just how good the existing material is.
Comment: Or, another way to put it, one is general, the other is vendor-specific. Vendor-specific security can be wonderful in that it gets into fine details, but it's the fine details in one specific device/software. Unless you are using that vendor's products, it might not be transferrable. General security gives a broader view and might cover areas that the vendor doesn't address.


How do you find the population size N based on the highest n values?

Question: For example assume $N$ people performed a selection test like GMAT. Assume the distribution of the scores is a normal distribution (but parameters are not known). If you have a list of the $n$ highest scores (approved people), how do you estimate $N$? Intuitively, it is totally possible to make such an estimation, if $n$ is equal to $N$ then you would expect the distribution of the n scores to be a normal (a few very high scores, a lot of average scores and a few very low scores) if $n\ll N$ then you would expect to see an almost linear increase in the number of scores as you look at the lowest scores (just a few high scores and a lot of low scores, where low here means low in comparison to the other available scores). The motivation is that in my country (Brazil), many times there is a test to get a public job and sometimes they do not publish how many people participated but publish a list of the $n$ people that passed and their scores. I would like to find a way to determine the $N/n$ (candidates per job position).
Comment: Are the parameters of this "normal distribution" known or not?
Comment: I think you are likely to have some good options (I don't know which one you are comparing to when you write "better," though). At a minimum you should do sensitivity analyses to see how much your estimates might depend on making a specific assumption about the distributional shape and parameters.
Comment: They are not known. Ideally I would not even assume it is normal. But since we are using only the extreme values of the real distribution, I don't think we have a better option.
Answer: This is a nice question. I'll give it a try... Denote by $\Phi$ the cdf of the normal distribution and by $\phi$ its density. The joint distribution of the $n$ highest scores $y_{(N-n+1)}, \dots, y_{(N)} $ is
$$ {N ! \over (N-n) !} \Phi(y_{(N-n+1)})^{N-n} \phi(y_{(N-n+1)}) \cdots \phi( y_{(N)} ), $$
(that is, $N-n$ values among $N$ below $y_{(N-n+1)}$, and the others where observed).
This is a bit puzzling at first sight: the usual setting would be that you know $N$ and $n$ and you want to infer the parameters of the distribution. Here you are interested only in $N$ so the MLE is obtained by maximizing
$$(N - n) \log \Phi(y_{(N-n+1)}) + \log(N!) - \log\left((N-n) !\right).$$
This is kind of intuitive: the grade of the last admitted $y_{(N-n+1)}$ and the number of admitted are all that matters.
A quick numerical experiment:
> N <- 1000
> set.seed(1)
> x <- sort(rnorm(N), decreasing=TRUE)[1:10]
> x
[1] 3.810277 3.055742 2.675741 2.649167 2.497662 2.446531 2.401618 2.350554
[9] 2.349493 2.321334
> f <- function(N, n = 10, xn = x[n])
+      (N-n)*log(pnorm(xn)) + lfactorial(N) - lfactorial(N-n)
> plot( 800:1200, sapply(800:1200, f), type="l")

This looks promising. Let's have a look on the properties of this estimator, again for $n = 10$:
> MLE <- replicate( 1e4, {x <- sort(rnorm(N), decreasing=TRUE)[1:10];
+        optimize(f, c(100,20000), maximum=TRUE, xn = x[10])$maximum} )
> mean(MLE)
[1] 1112.798
> sd(MLE)
[1] 393.086
> hist(MLE, breaks=40)

However from you edits to your question I think that you want to estimate both $n$ and the parameters of the normal distribution. This could be done by maximizing the log of above the joint density. However for your concrete application, the underlying distribution is unlikely to be normal. It is surely a mixture between the grades of diversely prepared candidates, and I am not optimistic about the possibility of obtaining good estimates.

So let's try that again, with unknown parameters for the normal distribution:
g <- function(N, mu, sd, X) {
  n <- length(x);
  (N-n)*pnorm(X[n], mean = mu, sd = sd, log.p = TRUE)
  + sum(dnorm(X, mean=mu, sd=sd, log=TRUE))
  + lfactorial(N) - lfactorial(N-n)
}

> optim( c(1000,0,1), function(theta) -g(theta[1], theta[2], theta[3], x) )
$par
[1] 292951.707061     -3.650634      1.498264

$value
[1] -13.78503

So the MLE says here that the best guess is a mean of -3.65 (instead of 0), a standard deviation of 1.49 (instead of 1, well, ok), and a size $N = 293 000$... hu... Well let's try again with $n = 100$: 10 observations is not much!
> set.seed(17)
> x <- sort(rnorm(N), decreasing=TRUE)[1:100]
> optim( c(1000,0,1), function(theta) -g(theta[1], theta[2], theta[3], x) )
$par
[1] 1031.1320174   -0.2112833    1.1694436

$value
[1] -321.6677

Not so bad...? but if I try again with set.seed(18), the estimate for $N$ is 5000...! I might be missing something, but for the moment I continue to be pessimistic.
Moreover, in the real world the grades are not normal. It is not rare to have a frankly bi-modal distribution, and the right tail is often quite special. The best students/candidates are far off the distribution, I have had multiple occasions to check this. So it is wrong to rely on the right tail for making these estimates: for example, if the $n = 20$ best candidates are all from a (relatively) homogeneous group of $100$ very smart and well prepared candidates, you will estimate only the size of this group; you won't have any information on the (much more numerous) less prepared candidates.
Comment: I used the (free) programming language R!
Comment: This is a nice idea, but it seems you are assuming the distribution is always *standard* normal, which almost surely is far from the truth. Your simulation seems to work only because it simulates standard normal variates, of course.
Comment: Well yes when I started this, from the formulation of the question I understood that the underlying distribution was known. Hence my last paragraph...
Comment: Also since we are estimating a distribution only using extreme data (highest values) I think it is best to just assume normal than something more sophisticated. Once I have an implementation I can test on real data where N is know. My intuition (I trust my math intuition) is that if n is not too small (n>20) then I think it is possible to have a decent estimate of N (at least a good estimate of order of magnitude 10,100,1000,10000 etc). Thank you so far.
Comment: I simulated data from a standard normal with $N = 1000$. Assuming that the parameters of the normal are known, the maximum likelihood is obtained by maximizing the second large expression in the text. If not, you need to maximize the (log of the) first large expression. $\Phi$ and $\phi$ are the cumulative distribution function and the density of the normal distribution, respectively.
Comment: This relies heavily on the right tail of the distribution. If the $n = 20$ best candidates are all from a homogeneous group of $100$ very smart and well prepared candidates, you will estimate only the size of this group; you won't have any information on the (much more numerous) less prepared candidates.
Comment: I agree, but I still think it is a very interesting extrapolation. Just trying to get the best information from available data. Is that Minitab? Thank you for your help.
Comment: @Mandrill to complete what I was saying, when a distribution is not normal, but "almost", the normal approximation can be ok when you compute the mean, the quartiles, etc... but for the extreme values, it can be a very bad approximation.

Anyway, if you still have questions on the code or anything, don't hesitate to come back!


When and how many times should we recite Bismillah in salah?

Question: When and how many times should we recite Bismillah in salah?
Comment: Whay exactly you mean by saying bismillah in prayer?
Comment: You should only say Bismillahir rahmanirraheem before a surah
Answer: Bismillah is not said in Salah anywhere except before the recitation of the Quran during qiyam.
And on this there is disagreement. Because of the dispute on whether Bismillah is a proper verse of Surah al-Fatihah and the other surahs. Some have held that it is not part of any Surah (except 27:30). Some have held that it is also a proper first verse of Surah al-Fatihah but not any other surah. And some have held that it is a proper first verse of every Surah except Surah at-Tawbah.
In short, the Hanafis and Hanbalis consider saying it to be recommended not obligatory. The Hanafis limit this to the one before al-Fatiha and do not consider it recommended to recite it before the second surah. The Shafi'is consider it obligatory, and this is also one view among the Hanafis. And the Malikis hold that it should not be recited and consider it makruh, although there are also some variants on this in the madhab.
For further details you can see:

Mawsoo'ah al-Fiqhiyyah (Arabic) or

Islamic Jurisprudence According To The Four Sunni Schools [page 333-334] (English)
Answer: Bismillah is recited before Surah Fateha, so total four times in fajar, twelve times in Zohar and so on. It is recited one time in each rakat.
Answer: Bismillah is recited at the beginning of Surah Al-Fatihah, which is a mandatory component of the prayer. However, there is no specific requirement to recite Bismillah before any other Surah in the prayer.
According to the majority of Islamic scholars, it is recommended to recite Bismillah silently before beginning to recite Surah Al-Fatihah in every Rak'ah (cycle) of the prayer. This means that Bismillah is recited once in each Rak'ah, at the beginning of Surah Al-Fatihah.
However, there is some difference of opinion among Islamic scholars on this issue. Some scholars believe that Bismillah should not be recited aloud in the prayer, while others believe that it should be recited both aloud and silently. Nonetheless, the majority of Islamic scholars agree that reciting Bismillah silently before Surah Al-Fatihah in every Rak'ah of the prayer is recommended (mustahabb).


who or how changes processor modes, CPU states, CPU privilege levels?

Question: I am reading about linux device drivers where it is mentioned that kernel runs in the privileged mode which gives it unrestricted access to all H/W. How does an user program is prevented from setting the CPU in this mode ?
Answer: If you want to understand this stuff, one of the best ways to approach it is to follow the Linux boot process Kernel Boot Process through the code.  For example, say you take Linux running on x86 architecture.  What happens at boot is that the BIOS gives control to a boot loader.  The boot loader in tern gives control to the kernel.
The kernel then goes through a process to boot up.  Initially most of the stuff is written in assembly language - see /arch/x86/boot/header.S
Then it goes to /arch/x86/boot/main.c.  Right at the end of the main function you'll see the call to go_to_protected_mode()
You can see that function in /arch/x86/boot/pm.c
So, once you boot into the kernel, it becomes the gateway for the CPU, and your code runs in the virtual machine provided by the kernel.  The user programs are prevented from running in  other modes by the fact that they have to do everything through this virtual machine.
Answer: User mode can change it's privilege mode only by generating some sort of interrupts. It looks that the purpose of the interrupt is to change the privilege mode of the program. Upon generation of any normal interrupt, the privilege mode is elevated and some kernel code starts running ..... Conclusion: By interrupting itself, user mode program cannot elevate privilege and keep running own code.... That is how this great security mechanism operates.
Billmic


Building 32-bit Qt Mysql plugin fails with MinGw

Question: I'm building a MySQL plugin for Qt 4.4.3 Open Source Edition (Qt documentation), and using command:
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro
make

I manage to build it to my 64-bit Qt just fine using 64-bit MySQL dev files (using nmake). However, 32-bit build (with mingw-make) fails with linking problems:
Creating library file: c:\Coding\Qt\4.4.3\plugins\sqldrivers\libqsqlmysqld4.a
tmp/obj/debug_shared/qsql_mysql.o(.text+0x10d): In function `Z5codecP8st_mysql':
...lots of same stuff...

The dev files installed by MySQL 5.1 32-bit and 64-bit library are also different: the 64-bit includes libmysql.dll and six .lib files, while 32-bit includes those plus six .pdb files. Relevant to this issue?
Is anyone able to build the 32-bit plugin with Qt 4.4.3/MinGW using MySQL 5.1? Suggestions?
Comment: Anyone care to try it and tell me if they succeed?
Answer: use mysql-noinstall-5.1.14-beta-win32
Comment: Thanks. I figured out it must've been the mysql package which was wrong, but apparently the new build is fixed. Thanks for testing it out.


What kind of htaccess rules would I need to accommodate files within folders?

Question: I'm rewriting my portfolio website urls by using the following code in a htaccess file,
RewriteEngine On
RewriteBase /

#remove enter code here.php; use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]

# remove index
RewriteRule (.*)/index$ $1/ [R=301]

# remove slash if not directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*)/ $1 [R=301]

# add .php to access file, but don't redirect
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]

It all works until I want to navigate to another page from the blog-post.php page
for example, let say I want to go to the about page the url becomes cgarcia.design/web/about and it should be cgarcia.design/about so the page can load properly. Now what would I need to change in the htaccess file to accommodate files within folders?
my nav structure is the following

work
about
resume
blog - posts folder - entry
contact

Thank you for any suggestions.
Answer: Add this to the ned of your document:
RewriteRule ^$ web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ web/$1


Controlling access to loading of a JAVA class at runtime

Question: I have a requirement to restrict access to loading of a particular class of a JAVA application, at runtime. Just wondering whether this is possible using JAVA Security Manager with a security policy. Also, if this is a possibility, I'd like to know how the permission configuration would look like in a JAVA security policy. I'd done some researching on this but couldn't really find any useful solution yet.
Answer: These two:
java.security.Permission
java.io.FilePermission
and providing you need to continue the application operating in some way without it you need to load classes using java.lang.ClassLoader and loadClass method to be able to throw it into an if-else to bypass potentially if simple instantiation is not involved.
Answer: I managed to come up with a custom permission implementation extending java.security.RuntimePermission class and get my requirement fulfilled. The only overhead (which is unavoidable) associated with the approach of introducing a custom permission is that, you need to hack into all your classloading implementations and add an additional check to evaluate your custom permission.


In Drupal Commerce how can you turn product select box options into images?

Question: As seen in the image below, how can I turn the product dropdown options into selectable images instead? Is there a module for this or does this have to be done via js/css?
Comment: I haven't tried this with Commerce, but some modules will allow you to write HTML directly into the select options.  This will break the translation system, but it's worth a shot if your site has only one language.
Answer: ok seems that this module does the trick:
https://drupal.org/project/commerce_fancy_attributes

This module provides a "Rendered term" attribute mode, that shows the
  rendered term instead of a radio button (degrades to a normal radio
  button when JS is off) on the add to cart form.
Example usage: 0) Enable this module. 1) Create a Color vocabulary,
  add a text field called "Color" that will hold hex values. Go to the
  "Manage Display" screen of that vocabulary, click the tab called "Add
  to Cart form - Attribute", enable only the color field (with the label
  hidden, and using the "Color" formatter). 2) Create several terms with
  matching hex colors (Black: #000000, White: #ffffff, etc). 3) Add a
  Color taxonomy_term_reference field to a product type. 4) When you add
  the color field on the product type, tick the checkbox "Enable this
  field to function as an attribute field on Add to Cart forms." and
  select "rendered term" as option of the "Attribute selection widget".
The Add To Cart form will now show the colors. Of course, imagefields
  can be used instead of "textfields holding hex values" rendered as
  images.
Comment: That's the module I'd recommend. Check out commerce kickstart to see an example of configuration
Answer: If you need images (not just colored blocks) as commerce product options take a look at commerce_options_as_images
I've created this module and use in on my projects.


Overriding ETag lookups?

Question: I would like to override Etag lookups, because apparently they are slowing down a page as the latency for each request is quite BIG!
Expires headers don't seem to do the trick...
any ideas?
Comment: How do you figure it's the fault of ETags?
Comment: I don't know why it is still making the lookups... I have given all files Expires Headers!!! :(
Answer: In the response object from the view you can set the ETag to whatever you like. This requires that you are using CommonMiddleware and USE_ETAGS is set to True.
However, if what you really want to do is to not call the view at all, why don't you just use the cache decorators and cache the result?
The code for etag handling.
Answer:
each request is quite BIG!

Unless you've got some really funky custom patches on your apache installation or a very weird filesystem, the effort of generating an eTAG is not dependent on the size of the file - by default Apache uses the inode number, mod time and size.
Usually conditional requests can actually slow down a site a lot - and should be avoided (preferable by stripping the if-none-match / if-modified-since request header). The one time this is not the case is where you publish very large files (e.g. video, PDFs). If you can't modify the request headers (e.g. using Apache<2.0), then you'd need to strip both the ETag and the last-modified from the response - or refresh the timestamps opn your files regularly.
The 'Expires' header is an HTTP/1.0 directive - there's very little HTTP/1.0 traffic going on out there - the little which is usually comes from badly configured MSIE6 browsers working through a proxy). You should be sending out Cache-Control headers.
Answer: I wish people would ask questions stating the version of apache they are running.  This can get confusing quite quickly.  Look at the FileETag directive (at least for apache 2.0 and 2.2).
FileETag none // will not generate and ETag for a file
See FileETag
Comment: There is nothing implying he's using apache.
Comment: Except that he tagged it Apache :P

Overriding ETag lookups?


How to ask forgiveness for bad intention?

Question: I am extremely sorry for disturbing you. I am asking the same question again. Nothing is working. I just can't be in peace. Yes what i wished at that moment, i actually meant it. I actually wanted woman to get cheated by their husbands  but later i changed my intention. But still I feel like i will get cheated by my husband too. Please help me. Please..
Answer: Tell them (o prophet),"My servants who have committed excesses against themselves (committed sins) do not lose hope in Allah's mercy. Surely Allah forgives all sins(with repentance). He is the most forgiving,most merciful.
Don't worry, Allah will forgive you,if you repent , everyone does mistakes but the best of them is the one who repents. You are sorry for this,so Allah will not punish you,he is very merciful.
Answer: Almighty Allah will forgive every sin except Shirk. You haven't committed any Shirk in this case. Repent by reciting Astaghfirullah more frequently. Try to do Sadaqah and make dua to the Almighty Allah to make things easy for you.
Answer: Allah forgives all sins. People who are saying he does not forgive except certain sins is not accurate at all, since Shirk is not forgiven when the person dies. But for your case, as long as you ask forgiveness, Allah will forgive you. And don't forget, Allah is how his believers think of. If you think Allah will forgive you the moment you say astaghfirullah, he will do so.


$f(f(f(x)))=x,$ but $f(x)\neq x$

Question: Let $f: \mathbb{R}\to \mathbb{R}$ be strictly increasing function such that  $f(f(f(x)))=x$ then by this $f(x)=x.$ Does the result fail if we drop the hypothesis that f is strictly increasing?
I find such an example if I change the domain and codomain to $\mathbb{R}^2$ and $f=rotation \ by\  120^o,$ but could not think of a map from $\mathbb{R}\to \mathbb{R}.$
Any help is appreciated.
Answer: Let $g:\mathbb{R^1}\to\mathbb{R^2}$ be a one-to-one mapping (which exists, because both sets have the same cardinality). Now set $f=g^{-1}\circ F\circ g:\mathbb{R}^1\to\mathbb{R}^1$, where $F$ is the rotation by $120^\circ$. So the result is not true: this is the desired counterexample.
Comment: Do you mean one-to-one and onto? Otherwise $g^{-1}$ doesn't make sense
Comment: @leibnewtz Yes, sure.
Answer: Define $f(0)=1, f(1)=2, f(2)=0$ and $f(x)=x$ for $x \not\in \{0,1,2\}$.
Answer: You can make $f$ act as a 3-cyclic permutation
$ f(x) = \begin{cases}
0  & \text{if $x = -1$ } \\
1  &\text{if $x = 0$} \\
-1 &\text{if $x = 1$} \\
x &\text{otherwise}
\end{cases}$
I suppose it's also possible to make a continuous version of this.
Comment: Continuous is not possible, because then f would be increasing.
Comment: Agree with @user345777 $f$ is obviously a bijection. A continuous bijection from $\Bbb{R}$ to itself is either increasing or decreasing. The 3-fold iteration of a decreasing function is itself decreasing which is absurd. So it must increasing and that case has been handled.
Comment: Sorry, it was a stupid guess. Can I ask you why it would be increasing?
Answer: If you allow yourself to consider the projective line (i.e., the reals with a point at infinity), then the function
$$
f(x) = \frac{1}{1-x}
$$
is a nice continuous solution to the problem (although you have to make sense of "continuous" for this extended line). Pierre Samuel's book on Projective Geometry has a nice exposition of this around page 58.
(By the way, this answer was inspired by @DonaldSplutterwit's deleted answer, although I might have stumbled on it myself, since I've been thinking about projective geometry and looking at Samuel's book today anyhow. Thanks, Donald!)
Comment: Then you could "cram $\infty$ into $\mathbb{R}$" using a variant of the infinite hotel paradox if you really wanted to, and then apply the same sort of construction as in Vladimir's solution.  Of course, that won't result in a continuous function $\mathbb{R} \to \mathbb{R}$.

$f(f(f(x)))=x,$ but $f(x)\neq x$


What TV shows would be best for improving English?

Question: English is my second language. I can speak,read,write English without any problem. But I am trying to find ways to level up my spoken English. I was wondering if someone can suggest a few tv shows or debates or something I can find on Internet (free of cost) that can help me further improve my English.
Comment: Perhaps you are looking for something beyond typical conversations? Is it public speaking you are looking for? I'm a bit curious since it seems like speaking is not a problem for you, and yet you didn't say anything about your listening skill level. If you have a strong listening skill, then virtually all the videos on YouTube can be your resource.
Comment: Yes speaking is not problem for me. I am not as fluent in English as I am in my mother tongue. But I want to.
I can debate better in my mother tongue than in English. So yes I am looking for beyond typical conversation which we find in tv series and movies.
Comment: I would say it depends on your taste. If you want to counter arguments during the conversation, then most of TV series could serve you quite well. (I watched things like *Simpsons*, *Fringe*, *CSI*, besides movies and news on my cable. I also enjoy watching video clips on YouTube too.) For public speaking, there are several good ones on the web (for examples, Steve Jobs). I don't know if you want to sound like a politician, but politician's speech is one of the greatest examples of public speaking, imho.
Comment: I did think of watching politician's speech but then I then I thought it might be just too boring. But I will give it a try.
Comment: Before making this question sounds too much like a chat, I will just make my last recommendations here on some political talks that aren't boring. If you can find the movie *Inside Job*, I recommend you to try it. You will find a more than decent narration and loads of witty speeches. (If not, you can still find some clips of it on YouTube.) For political speeches, try searching for "C-SPAN", and you will get the real stuff.
Comment: I see that my question has been put on hold as primarily opinion-based.. I understand that this is not a discussion forum but  I believe that as the name `English Language Learners` suggests, this question is fairly valid. How else would someone ask for resources? We have `English Language and Usage` for questions regarding English grammar and usage  etc
Answer: The answer to this can vary dramatically based on what form of english you are trying to improve: conversational, educational, political, etc...
Generally, news broadcasts have wide varieties of speech that would be useful and would run the whole gamut.
Many educational youtube 'shows' might also be helpful.  Perhaps the various Crash Course series on youtube would be helpful.  Much of what is said is in a more conversational tone but due to the educational nature you'd get some decent variety (and you'd be able to learn some cool stuff at the same time).
If all you're looking for is general conversational english, sitcoms might be your best bet.  I know several people who actually learned much of their conversational english from shows like Friends, which I'm sure you can probably find online.
That said, there is no real 'wrong answer' - though I'd avoid very localized tv shows (such as the recently popular 'reality tv' programs following southern crocodile hunters, fishers, moonshiners, etc) and shows which take place in the distant past which may use outdated language uncommon today.
Comment: Most of the crash course teach you basic grammar. (well that's what I think, I haven't undertaken any course as such.)
And yes sitcom shows like Friends and Seinfeld did help me a lot improving my conversational skills. Thank You. +1
Answer: When I was taking a Legal Writing class towards a Paralegal degree our attorney instructor always recommended the classic sitcom Frasier to help build vocabulary and general use of high level English. The dialogue is expansive and rich, infused with lots of "GRE" words as many call them these days.
Comment: I havent watched Frasier not yet. Since you said that your attorney instructor recommended it to help build vocabulary I think I will give it a try. Thanks +1


How to find the values that have changed in a form submission?

Question: How can I tell what values have changed in a validate hook of a form submission?
Answer: What I have done is to see if the value in $form_state['values'] is different from the #default_value in $form, like so:
if ( $form_state['values']['variable'] <> $form['variable']['#default_value'] ) { ... }

Comment: kinda what i said above, no?
Comment: Couldn't tell -- it seemed like only a flag to indicate that a change had occurred? I wanted more granularity.
Answer: Something that i do in my forms is set defaults.
Take:
    isset($form_state['values']['datacenter']) ?
    $selected = $form_state['values']['datacenter'] : $selected = 0;

$form['grid']['datacenter'] = array(
    '#title'            => 'Datacenter',
    '#type'             => 'radios',
    '#default_value'    => $selected,
    '#required'         => true,
    '#options'          => array(),
);

what you could do is check your #default_value to see if its not 0 in this case. so in your MYMODULE_form_validate($form, &$form_state) function, simply grab your $form_state values and if its not zero in this case, call some other function or whatever you want to do.


why subsidy is given why not govt direct discount the prices?

Question: I have a great confusion about the fundamental of subsidy . Why government give subsidy when it can also discount the price but it doesn't do so ?
Comment: How does the government "discount the price", in particular when if it is not the seller?
Answer: Supposing by "discount the price" you mean set a maximum allowed price that is lower than the current price.
At the current price supply is equal to demand, when the price drops, there will be less supply and more demand. Then there is more demand than supply and the government doesn't want this because some people don't get what they want. Subsidies solve this problem because the price will drop because a part of the profit isn't paid for by the consumer but by the government. Then supply and demand are equal and the price is lower.