Why does velocity change or accelerate in the presence of force?

Question: I know that $F=ma$, but why? Why does velocity change in the presence of force? Please answer it based on the fundamental level if possible.
Answer: At first, you need to know 'What is force?'
The external cause that causes a stationary object to move or a moving object to stabilize or to change the value and direction of velocity of a moving object is called Force.
As force is the reason of changing velocity or speed, speed changes when force is applied on an object.
Comment: Thank you for the answer
Answer: Well okay, this is a tricky one.
First recall when is the equation $F=ma$ valid. You may know that it is valid in a special class of frames of reference, known as inertial frames. So now the question is- what is an inertial frame?
If I say that an inertial frame is one, in which the equation $F=ma$ holds, I have told you no new information. So I have to tell you something else.
A frame of reference, in which a particle will keep on moving a straight line trajectory with a constant speed, when all the external influences are taken away from it, is an inertial frame. Note that since I cannot take away all the external influences away practically, so the definition is actually some sort of a limiting case. This is new information- I predict that there exist frames of references, in which particles taken away from external influences move in straight lines.
Now the obvious question is- what if there are external influences present in such a frame of reference? Well, the particles won't follow those special trajectories, that is, their velocities will change. What is a way to quantify the external influences? Certainly, if the rate of change of the velocities is zero, then the external influences are zero. How about equating the rate of change of velocity to the external influence? That is a sensible thing to do. But now we see that for identical external influences, different particles' velocity changes differently. To iron out these differences, we ascribe a quantity called mass to each particle.
So we DEFINE force such that $F=ma$.
Note that the only way to observe whether a force is acting on a particle is to see if the particle is accelerating.
Newton's second law is a way to DEFINE forces.
Answer: Physics is the discipline that studies nature, using observations and measurements, and develops mathematical models that can map  the measurements and also predict knew measurements.  If the predictions are true, the model is validated. If wrong the model is modified or replaced by a better mathematical model.
Mathematics is the discipline that has theories that are self contained. It starts from a few axioms and develops the self consistent formulas . The theories need no validation after completed it is self evident that they are consistent.
Physics uses mathematics as a tool adding extra axioms, laws, postulates and other axiomatic statements so as to pick from the plethora of mathematical solutions those solutions that fit the data and are predictive. These axioms etc come from experimental measurements and observations.
Newton's laws allowed us to use mathematics successfully in order to predict the behavior of matter in our observations. $F=ma$ is one of Newton's laws. thus the answer to a "why" this law is "because" it is necessary to pick up the correct solutions for the data.
You ask:

Why does speed change in the presence of force

Mathematics allows us to rewrite the second  law as $F=dp/dt$ where $p$ is the momentum of a moving mass,  ( $p=mv$ $v$ the velocity ) . So the answer to "why" is: "because" it is necessary to assume this axiomatically in order to pick up the correct solutions for the data.
Answer: It is the nature of some interactions between bodies that they cause changes in the states of relative motions of those bodies. There isn't a deeper reason for this as far as we know. Interaction is the fundamental concept. Why do things interact? "They just do" - it's part of what they are. There has to be some interaction, I'd think, after all, in order for life and complexity to exist in a universe.
"Force" is a concept created to measure the effect of certain types of interaction. When an interaction is contributing to the change in the momentum (not velocity or acceleration directly), we say that the interaction is "exerting a force" between the objects. The question of why that velocity changes in the presence of force is because momentum is what generates velocity (spatial translation), and so then changes in momentum likewise produce changes in velocity.
Perhaps another way to think of it is this. Objects have positions. Those positions, like anything else, can do only one of two things with time: they can either stay what they are, or change. If they change, that's motion. If they stay where they are, that's stasis. So because there's logically only two possibilities, then it makes sense that one of those two must get realized in a real universe, and so also it should not be a surprise that things in that move in various ways. And so long as a motion is suitably smooth and continuous, you can assign to it an acceleration by pure mathematics.
What is somewhat interesting is that the Universe doesn't seem to require an interaction to change positions of objects, at least not if we define interaction as necessitating "two or more bodies" (I do think it's sensible to talk of "self-interaction", in which case we can talk of an "autokinetic interaction" which translates momentum into changes in position). It only requires interaction to change velocity! Without any interaction with others, they can seemingly keep doing that themselves, forever.
This is not a given! We can easily imagine worlds where that this doesn't happen - in fact, the ancient Greeks thought that that was how the world worked, given that all objects on Earth seem eventually to come to rest, and they imagined that the few celestial motions (like the stars and planets) they could observe required interaction with some sort of external "movers" to make them go, without which they would grind to a screeching halt just like a wheelbarrow without a pusher. The world could have been that way, but it really wasn't.


How to control this VDO speedometer

Question: I have this VDO speedometer and I would like to control it with digital signal. I do not want to use hall effect sensor (HES) (or any sensor at all) because I already have car's speed. I would like to send signals to speedometer's pins and have speed displayed. HES connects to 8 and 6 pin, but electronic control (probably from ECU) is only connected to 8. I tried both configurations manually - I connected +12V or GND to it - needle barely moved. I tapped it with constant speed - same result. What would be correct way to control this thing? What digital signal is supposed to come from ECU to this speedometer?
Comment: Then do some serious research on VDO and their products and find the input signal expected. Good luck.
Comment: So test the original wires that supplied it and evaluate the signal. Did that for a rev counter once and built a driver circuit using a hall effect…
Comment: I do not have original wiring - I bought the speedometer and now I want to use it
Comment: I tried supplying PWM to 8 pin - no matter duty cycle, at 490Hz I get 20km/h
Answer: Found out - speedometer is controlled by frequency. One km/h needs about 25Hz. So at 1000Hz I got 40km/h.

How to control this VDO speedometer


Activate objects that are hit - Blender Fracture Modifier Build

Question: I am trying to do a cgi door break effect, and I am having trouble with the collision. I am using the blender fracture modifier build and have so far been able to break the door. I am using a set up in which the object that is to be broken is animated until the other object comes flying at it. The problem is, once the object ceases to being animated, the entire door falls down due to gravity when I only want the shards to. I am using constraints and need a way to only let the shards of the door that is hit fall.
Answer: You could try to set the object flying into the door to be a trigger and the door should be animated and triggered. Both settings are in rigidbody physics Panel in the FM build. This way only the shards the incoming object will touch should be activated.


How many trained skills does a 1st tier cypher character have?

Question: I am preparing a Monte Cook's Cypher system campaign and would like to know how many skills a starting 1st-tier character would be trained in?
Comment: Are you joining a CSR campaign in-progress (or about to begin)? Or are you preparing to GM a CSR campaign?
Comment: I will be running the campaign. It will be set in WWII and the players will be French soldiers/spies...:-). That way, they get to "fight" against the Germans, the British, the Japanese, the Americans and the Germans again....Hope the system indeed lends itself to a modern setting. So far, it seems very fantasy-focused to me.
Answer: The answer varies based on some factors. The system does NOT provide any automatic levels of training which are universal to all characters. Instead, Training is found exclusively within abilities listed for each Character Type, Descriptor, and Focus. Not all of these offer Training, and some offer more than others. This is pretty balanced with other abilities, though.
Character Types
Each of the four Types has an option among its starting abilities for a type of Skill to be considered Trained in. These are still chosen abilities, not automatic. For Example, a Warrior may choose "Physical Skills" as one of his starting abilities, which allows him to be Trained in two skills from the list provided in the ability description on page 25.
Character Descriptors
Some of the Descriptors provide Trained status in one or more areas. These seem to always be a specific area of focus related to the descriptor. For example Doomed (page 70) provides Trained Status in three different areas, perhaps to offset the terrible drawback of being Doomed.
Character Foci
Some of the Foci provide Training in certain areas related to the specific Focus. For example, the Focus "Conducts Weird Science" (page 109) offers the Tier One ability "Scientist," which lets the character be trained in one area of scientific knowledge of his choice.
Notes
Some areas of Training are for different situations rather than discrete abilities. This can create overlap. Any time Training can apply from two different abilities, the character will be considered Specialized. For example a "Warrior who Battles Robots" might be trained in Medium Weapons, and also Trained in fighting robots. (Not at Tier One, but this is just for an example.) If he fights a robot with a medium weapon, he is Specialized.
There are no extra bonuses for a third overlapping area of Training.


Is preemptive war illegal or just politically untenable?

Question: In the lead up to the Iraq war, and to a lesser degree in the discussion before the military action in Libya in 2011, there was much discussion in the United States about the possibility that any action would be a preemptive war/war of aggression.  Is such an action itself illegal in the United States or any other country, or just something that would be politically untenable for a western democracy?  If it is illegal, is that the result of a treaty or federal statute?  Are there other countries that have different laws with respect to preemptive war?
Comment: We have now had 2 presidents back to back reelected despite initating a preemptive war.  And one did it with out UN or Congressional backing.  That same president got a peace prize.  I fail to see how it could be politically untenable in reality... though I can see how it would be logically.
Comment: I tried to answer, but the question is basically unanswerable conclusively since you (like the international legal profession) never actually nailed down what "preemptive" means.
Answer: To use the word "illegal" presumes that there is an authority which has the ability to state what is "legal" and what is not. The present world system operates on agreement and consensus, but only has as much power as the member states choose to cede to it.
There are several treaties and conventions (UN High Charters, Geneva Convention, etc...) but these do not have any more force of law than countries choose to give it.  If they withdraw from any convention or treaty, there would be public censure, but no actual "legal" action that an authority could take. Whether or not the 'rest of the world' chose to go after such a state is a different matter, but that is diplomatic action, again, not 'legality.'
The United States, for example, has not signed on to the International Court of Justice (for fear that its soldiers may be prosecuted).  As such, if a foreign country wants to prosecute an American soldier, the only authority it has to do so is the authority that United States allows the other country. Likewise, the United States refused to participate in the League of Nations, and thus could and would ignore its actions.
Technically, the Kellogg-Briand Pact outlawed war - in 1928.  It was just a treaty.  See how effective it was?
The situation could be likend to membership in a church.  Churches can, in theory, can impose punishment on its members - but because people are free to join and leave churches as they choose, in practice there is no church discipline.  A member who violates the agreed upon rules can be censured or expelled, but beyond that, there is no power to force or compel.
States that enter into "illegal wars" can be censured, sanctioned, yelled at very, very, loudly - and if the rest of the world so decides - invaded or attacked.  That said, that isn't a matter of legality. It's a matter of force.  As Clausewitz said - "War is just Diplomacy by other means."
Comment: This answer does not answer the question. I think it is presumed in the question that the state did not withdraw from any international conventions.
Answer:
There is no federal US statute that says anything about legality or illegality of "preemptive" war. All that's needed for war to be "legal" is following Article One, Section Eight of the Constitution (practical details listed on the Wiki) and/or possibly War Powers resolution (as far as I know, the latter was never actually tested in front of Supreme Court, and many Presidents ignored it - see Wiki - while Congress insists on it).
In other words, if Congress declares war on innocent nation X, that is fully legal inside USA. Mind you, that may cost some people re-election if enough people object to such an action.
As far as treaties and international law, a very thorough treatement can be found here: http://www.dcbar.org/for_lawyers/resources/publications/washington_lawyer/january_2003/war.cfm
A short version of that article is basically "it's fuzzy and mostly depends on which expert you ask to interpret things"
The main law which seems to apply is UN Charter article 51:

"Nothing in the present charter shall impair the inherent right of individual or collective self-defence if an armed attack occurs against a Member of the United Nations…."

The rest is, basically, lawyering and semantics. Historically, self-defense was usually applied to preemptive attacks when the target's threat was imminent; however the "what is imminent" obviously changed in practice from early 1900s when you could observe massed troops to 2010 when you have technology suitcase nukes (or a cargo ship with a nuke onboard); or tactics like civilian airplanes used as weapons.
Again, there is no clear unambiguous law or treaty on the topic, it's all highly dependant on interpretation of fairly vague clauses.
I'm fairly certain that Germany and Japan post-WWII had laws to the effect that the military may only be used for defensive purposes. Again, the devil is in the detail - "defensive" can be interpreted quite broadly, as it actually WAS in Germany post-1990.

The role of the Bundeswehr is described in the Constitution of Germany (Art. 87a) as absolutely defensive only. Its only active role before 1990 was the Katastropheneinsatz (disaster control). Within the Bundeswehr, it helped after natural disasters both in Germany and abroad. After 1990, the international situation changed from East-West confrontation to one of general uncertainty and instability.
  Today, after a ruling of the Federal Constitutional Court in 1994 the term "defense" has been defined to not only include protection of the borders of Germany, but also crisis reaction and conflict prevention, or more broadly as guarding the security of Germany anywhere in the world
Comment: Suitcase nukes? Are you referring to dirty bombs?
Comment: @gerrit - No, my physics education is sufficiently advanced to know the distinction between a nuclear device and a RDD ( radiological dispersal device) :))) . A definition of suitcase nuke is [on the Wiki](http://en.wikipedia.org/wiki/Suitcase_nuke) if you wish clarifications
Comment: Looks like the lightest are 45 kg, that's a pretty heavy suitcase.
Comment: @gerrit - would YOU sacrifice something as insignificant as having to lug 45lb for a worthy cause? :)
Comment: ... also, that's unclassified. Technology does have a tendency to improve, especially miniaturization and lightness wise.
Comment: 45kg, not 45lb, is not easily hand-carried onto an airplane, for example. I'm not sure nuclear weapons can be downscaled arbitrarily far. But this discussion is not really relevant or on-topic here.
Answer: "Planning, preparation, initiation or waging of a war of aggression or a war in violation of international treaties, agreements or assurances" is the crime against peace, and it's not important, what are the laws of particular country. The officials of such country can be prosecuted by any other country as war criminals.
You can see http://deoxy.org/wc/wc-ilaw.htm or anything similar, the best are printed academic publication, but I have them only in Polish, so I can't cite them directly here :)
However, the 'preemptive war' is a tricky term, because it suggest self-defense which is not forbidden by international laws. The problem is, how to define self-defense and where is the border between preemptive self-defense and the aggression.
The term 'war' may be used internally, especially in political campaigns, but on international level it is avoided and the term 'intervention' is often used. Especially 'humanitarian intervention'. In Libya there was the civil war, so it was easy to present one side as innocent victims and the other as oppressors and use it as pretext for intervention.
Answer: No, preemptive war is not illegal, if a court is unbiased, it should aquite a person who ordered a preemptive war given the person proves that the other side was preparing a war of aggression.
Yet this is not applicable to Libya, because it was not preparing a war against the US, and the US even did not claim so. Waging pre-emptive war is only allowed with the aims of self-defense against an inevitable attack.
Comment: Lybia wasn't a war of US vs Lybia. It was European powers on the side of one side of civil wars vs the other side of civil war. Obama was just "leading from behind" (and this comes from someone who thinks Obama should be impeached for that little adventure)


Beginner animating: why are my rig controllers not deforming my character mesh properly?

Question: I have a character rig and mesh that seems to have been working fine, but in the current scene, something is different. The hand controllers are the easiest to spot - I have a weapon object with a Child Of constraint to the hand.ikR controller, and as I move the hand controller in Pose mode, the hand mesh gets offset from the weapon. Mesh seems parented to the Rig properly, and other character mesh/rig sets in the same scene are working properly. What's going on?
Answer: It took a little bit to track down the problem, and it turned out to be a pretty simple issue. The character Rig object, in object mode, reported its Scale to be other than 1. Worse, X/Y values were different than the Z value.
So if this is happening to one of your rig/mesh sets: before you go thru the weight painting, editing the mesh, digging deep into the rig structure... just drop back into Object mode, and check the Rig object's scale. If it is anything other than 1, that might be your issue. It looks to me like a rookie mistake, but if there's any other rookies out there running into this, perhaps I can save you some time.
Comment: Now the answer would be a real solution if you would not only advise the people to check if the scale is 1, but also what to do if it is not - since you called this a beginner issue.
Comment: Heh - myself being a beginner, I wouldn't know what to check next after verifying the scale. Looking for a weight paint issue would be my next guess, but my luck with getting that right has been mixed.
Comment: Well, you posted a question and found an answer - it's not absolutely necessary to go through all possible issues and solutions. But for a beginner it might be interesting what he should do after he found out the scale is off. What did you do? Applied the scale? Scaled it back to 1?


Dummy variable's p value interpretation

Question: I have a question related to the significance of the dummy variable. Some background context: I am writing my thesis and I have hypothesized the following. My first hypothesis hypothesizes that the independent variable (IP) which is the institutional pressure has a positive relationship with CSR (my dependent variable). I was able to find statistical evidence to support the hypothesis. For my second hypothesis, I wanted to compare the CSR performance of companies in two countries, Russia and China. And my second hypothesis hypothesized that the dependent variable's score would be higher in Russia compared to China as Russia has a higher institutional pressure compared to China. In order to do so, I created a country dummy variable where 1 denotes Russia and 0 denotes China and ran the GLS regression analysis. I was able to find a positive relationship however there was no statistical significance that was found ( p-value < 0.0509). I am struggling with understanding how to interpret the result in this context. If the first hypothesis is statistically significant, shouldn't the second hypothesis also deliver the same result? How do I interpret the statistical insignificance in relation to the dummy variable? I'd really appreciate it if anyone could shed some light on this. Thank you so much in advance!
Answer:
p-value < 0.0509

Incredible, this is the closest I've seen someone get to the nominal value.  Please keep in mind that The Difference Between "Significant" and "Not Significant" is not
Itself Statistically Significant.  Though you have failed to reject the null (by a hair's worth) I would look at the confidence interval for the effect to see what sorts of effects are consistent with the observed data.

I am struggling with understanding how to interpret the result in this context. If the first hypothesis is statistically significant, shouldn't the second hypothesis also deliver the same result?

No, not necessarily.  The differences between China and Russia could be too small to detect reliably with your dataset.

How do I interpret the statistical insignificance in relation to the dummy variable?

If the model is
$$ CSR = \beta_0 + \beta_1 \mbox{IP} + \beta_2I(\mbox{Country=Russia}) $$
Then a failure to reject the null means that, from these data, we can no conclude that $\beta_2\neq0$.  That does not mean that $\beta_2=0$, only that from these data we could not find evidence to the contrary.
Comment: @Sarah regarding interpretation of the confidence interval, I think you're going to find [this](https://discourse.datamethods.org/t/language-for-communicating-frequentist-results-about-treatment-effects/934) resource very useful.  That interpretation of the p-value is incorrect, and I would encourage you to search for highly upvoted answers on the interpretation of the p value.  "Marginal significance" is not a term I condone.  I would simply report a failure to reject the null and interpret the effects consistent with the data from the CI (see link for more).
Comment: Thank you very much for your very helpful answer! Regarding the confidence interval, at (95% confidence interval)= (-0.377) to 19.619. How would I interpret these values? And, I saw a post earlier that suggested that p-value means the country dummy variable seems to account for other country-specific factors, what does this mean in this context? How do I discuss this "marginal significance" in the results sections?  Thank you so much in advance!

Dummy variable's p value interpretation


Verifying digital signature on PDF

Question: What is the best way to verify digital signature on downloaded PDF files? I am using 19.04.
Comment: It seems that Okular works fine.
Answer: As of now, the best solution I found is the Adobe Reader DC snap, which uses wine:
https://snapcraft.io/acrordrdc . Only, take care of not disconnecting the network for this snap, as the installer suggests doing to avoid updates (possibly not working), because this obviously prevents signature verification.
I have been trying the "native" Adobe Reader 9, Master PDF Editor and PDF Studio Viewer but I found them incomplete. Adobe Reader 9 apparently has an outdated verification method, Master PDF Editor appears to verify the signature but still shows a "?" rather than a "Valid signature" mark in my PDF, and PDF Studio Viewer marks the (supposedly valid) signature as Invalid because of not supporting the signature handler (Adobe.PPKLite::ETSI.RFC3161).
This is based on PDFs from only one authority, but for non-experts in digital signatures and certification methods, it appears that the snap is the best option if one only wants to verify a signature and go on.
Answer: I think the best way is to open a .PDF in LibreOffice. If PDF is signed, it shows a message and one can check the signatures by clicking "Show Signatures".

Example: to verify signature metadata, at LibreOffice 7+ Draw. It shows a bar when we open the document:

click at "Show Signatures" and "View Certificate details...".

PS: to validate the signature, see https://superuser.com/a/1163219
Answer: I am using procertumSmartsign app that verifies signatures compliant with European eIDAS standard in PDF, XML (both internal and external signatures) and any other files (external signatures):
https://www.support.certum.eu/en/cert-offer-smart-sign/

Please note that European eSignature hierarchy is different than in other parts of the word.

Verifying digital signature on PDF


Retrieve data from a Cursor

Question: I have a database with only one table : notifications (which contains an id, a title, a note, etc)
I'm trying to have an Activity that displays the title of the notifications through a ListActivity. And when the user clicks on one of the title, it displays the whole notification.
I have a Cursor that retrieves data from the database :
public Cursor getAllNotifications() {
return db.query(DATABASE_TABLE, new String[] { KEY_ROWID,
        KEY_DAYOFWEEK, KEY_HOUR_BEG, KEY_HOUR_END, KEY_ROOM,
        KEY_TEACHER, KEY_NOTE}, null, null, null,
        null, null);
}

In the class that extends ListActivity, I have a private String[] notificationsList;
but I don't know how to retrieve the data because the getAllNotifications() method returns a Cursor.
Answer: Use
cursor.getString(/**columnindex**/);

And similar functions :
Refer http://developer.android.com/reference/android/database/Cursor.html

Retrieve data from a Cursor


Download Manager With Slow Download Speed Ubuntu 14.04

Question: I have got a wireless connection to the internet. I have got two operating systems, one of them is Ubuntu 14.04 and the other one is Windows 7. My problem is, the downloading speed of the Ubuntu is much slower than the downloading speed of the my Windows OS. I can download 5 times faster with Internet Download Manager on windows than downloading the same file with FatRat, FlashGot, SteadyFlow, Axel, Uget, and even Wget on Ubuntu. It seems that the Ubuntu downloading speed is too slow. The same thing does NOT hold for loading web pages.
The other problem is, whenever I try to download something with ubuntu I get two options, one would be to download the file via one of the external programs that I have installed like Axel which would be gone through it via FlashGot on Firefox. Is not there any way to make the program like Axel or SteadyFlow to popup automatically whenever I click a download link? Just like internet download manager.
Comment: Same problem with a wired connection?
Comment: @davidbaumann Yes, nothing changes when I use the wired connection. However, if there is any configuration which can make the download speed faster I would be happy to hearing it.
Answer: You need to do more in these applications than IDM, for example in IDM they try to use as many connections as possible (this can actually get you banned from some servers) whereas uGet default is to use 1. Edit your settings for uGet to use more connections for the file you are trying to download.
As for the auto-load thing, sure. FlashGot add-on for Firefox can do this.
For example set the default option in FlashGot to be uGet and then download something. The popup that asks to complete download also has a check box to remember that setting, check that and the next time it will auto-load uGet.
Answer: You need to setup repositories from where you can download software in maximum bandwidth. Here is how:
<code>Unity(DASH_board) > software and updates > Ubuntu Software > Download From > Other > Choose Best Server > OK > OK.
</code>
Reload cache and try again downloading software.


Is there a way to detect if the guest user on web page has opened my mobile application to enhance his user xp

Question: I have a website and mobile applications Android & IOS, all platforms are connected to the same database, what we are trying to do is to enhance the user experience by showing him specific products based on his selections however right now we can do this a cross all platforms only if the user is logged in using his user ID, now my question is if there a way to identify the guest users without signing-in? maybe if the user is signed in with the same google email on his phone and his browser I can get his token? or something similar even if its 3rd party tools. Right now I'm not even sure where to start or what to search for.
Comment: Are you asking how to identify a user by some third party credentials _without_ the user explicitly being made aware of and consenting to this? That's a big no no.
Answer: No, you will not be able to get any reliable identifier to link users across devices unless they log in.
While smartphones do hold a lot of such information, the operating systems and browsers will not make this information available to you for privacy reasons.
You can use unreliable probabilistic fingerprints to show similar recommendations to similar users, but this can be quite problematic. For example, if you show similar recommendations to different devices on the same network (e.g. to members of the same household), this could leak information about one user's preferences to other people. Nevertheless, such cross-device linking is a big concern in the advertisement industry, especially for the problem of attributing conversions on one device to ads on another device.
If you want a reliable identifier, you'll have to ask the user. For example, to get the user's Google account, ask them to "log in with Google". Such OAuth log in is often the lowest-friction way to create a user account. But if you make a log-in mandatory, note that this is still friction (and a privacy problem) that might turn some users away, potentially decreasing the value of this approach. Beyond some point, trying to wring out more conversions and more revenue from a user base will backfire.
My recommendation: focus on what is best for the user. If the users want to sync their recommendations between devices, give them tools to achieve that. If the users don't want this, don't force it.
Comment: but how come when i search for something on my web browser sometimes i see ads about it on my phone, there must be something linked if im signed in the same email on my phone and my web browser, maybe there is away to request from google such info ? or atleast to validate if its the same user only, i dont need anything else except id or token
Comment: any suggestions
Comment: @HossamHassan That's the probabilistic linking I mentioned. The advertisers likely see that both devices are on the same network/IP address, so they probably belong to the same household. So the advertiser infers that the user of the second device might share some interests with the user of the first device. But this linking is not possible with absolute certainty unless the *user* voluntarily provides some identifier.
Comment: @HossamHassan Assuming Google for a moment, _Google_ decided what ads to show you, not the website itself. Websites just make an "ad space" and let Google fill it in as it pleases. The website doesn't identify your user credentials, the Google ad loader does. The decision which ads to show based on your Google identity is Google's own decision, not that of some third party website like your app.


How to clear cache externally?

Question: I'd like some help how to clear the cache using an external script. I have a script that adds nodes each night, and I'd also like it to clear the views cache so - without having to make out by myself the MySQL query.
Answer: If you are running a script, you'll likely benefit from using Drush.  With the Drush php-eval and php-script commands, you can easily call a snippet of php code (such as the examples shown in other answers to this question) after bootstrapping Drupal.  Without Drush, you would have to set up a web service and use wget or curl to run your code, or try to call the Drupal bootstrap code yourself.  Better yet, Drush even comes with a built-in command to clear the cache, so you don't need to worry about writing any php code at all, if that's all you want to do from your script.  Just use:
cd /path/to/drupal/sites/default && drush cache-clear all

You may also wish to learn about site aliases; if you define an alias called @site, then you can instead use:
drush @site cache-clear all

Comment: Drush seems like the clear solution here, though OP wants to clear Views cache.  Try `drush cc views` in your script as a user with the correct access.
Comment: Yes, you are correct about `drush cc views`; however, Drush commands by convention usually call API functions directly, without access checks; it is not usually necessary to specify a user.
Comment: Unfortunately, I do not have that kind of access on this server. Otherwise I really much enjoy Drush!
Answer: If you just want to clear one or two particular cache bins you can use cache_clear_all() (assuming your script has Drupal bootstrapped):
cache_clear_all(NULL, 'cache_views');
cache_clear_all(NULL, 'cache_views_data');

Comment: Since it is a non-Drupal script, I'll probably do it like that, and include() the necessary files. Thanks!
Answer: I suggest register menu and externally call it ,in call back of it put your code(clear cache )
function yourmodule_menu() {
    $items = array();
    $items['customclearcache'] = array(
        'title' => 'clear cache',
        'description' => 'clear cache',
        'page callback' => 'yourmodule_clear_cache',
        'access callback' => TRUE , // or any access you need
    );
    return $items;
}

 function yourmodule_clear_cache(){
   cache_clear_all(NULL, 'cache_views');
   cache_clear_all(NULL, 'cache_views_data');
   drupal_set_message(t('cache clearing completed'));
   drupal_goto("node"); // or any page you want
}

and you can clear cache with calling this url : yoursite.com/customclearcache.
Also if you installed drush clear cache with it drush cc all
   //first go to your installed site path
  $cd /path/to/drupal
   $drush cc all

Comment: Make sure to check access, repeatedly calling that url could otherwise easily bring your site down
Comment: @Berdir , yes, I am agree with you, this just a way can get idea and develop it.
Comment: The script is outside of actual Drupal code. This would be perfect for my module, but not in this precise case. But thanks!
Comment: A callback like this should check some secret token and ideally an anti-csrf token to avoid abuse.
Comment: @greggles yes I agree with you , or specified access callback ;)
Comment: Access callback is good if you can, but in a job it's probably not great. A CSRF token is also important to avoid being tricked into visiting the url.
Answer: Best way to clear the cache externally is by using Drush commands.
You could use drush cc in the terminal and it will ask you what exactly you want to clear. In example it will ask for:
Enter a number to choose which cache to clear.
 [0]   :  Cancel
 [1]   :  all
 [2]   :  drush
 [3]   :  theme-registry
 [4]   :  menu
 [5]   :  css-js
 [6]   :  block
 [7]   :  module-list
 [8]   :  theme-list
 [9]   :  registry
 [10]  :  views

Select you option and you could clear the cache externally.
For more details about the drush and commands of it you could visit drush GitHub page.
Answer: If you want to clear the cache externally, the easiest way is to use drush, for example:
drush -y cc all

which would clear all Drupal caches (but not all caches). In Drupal 8: drush cr.
Other way is to write a simple script which would truncate/delete all tables which starts with cache_, for example using the following one-liner:
echo "SHOW TABLES LIKE 'cache%'" | drush sqlc --extra=--skip-column-names | xargs -L1 -I% echo "DELETE FROM %;" | drush sqlc --extra=-v

Answer: TRUNCATE the cache_views table in the database.
Comment: Sorry. Didn't read carefully enough.
Comment: Its alright. But yeah, I didn't want to it like that, but rather using a "safe" Drupal function.

How to clear cache externally?


Supplementary exercises to sprints

Question: What are supplementary exercises one can do to increase sprinting speed? I've been working on my core and hip flexors so I can pull up my legs faster as well as squatting to push harder. It seems like the squats are not so helpful since they use the hamstring and require you to push from your heels, whereas in a sprint you're almost never on your heels. Basically, I've noticed that the weight on the squat bar has almost no correlation to my sprinting speed. Are there any replacements that people use to increase sprinting speed beyond those I've mentioned?
Comment: Welcome to Physical Fitness!
Answer: You could try plyometric weighted squats. Basically, jump squats, but with a weight on your back (or front if you prefer). I've found these to be excellent when trying to improve speed as you build a lot of explosive power, which is exactly what you need when sprinting.
What are plyometrics?
Plyometrics, also known as jump training or plyos, are exercises in which muscles exert maximum force in short intervals of time, with the goal of increasing power (speed-strength).
(Source: https://en.wikipedia.org/wiki/Plyometrics)
Procedure:
Go down in your regular squatting form, and come up about 1/3rd the way like you normally do. The rest of your ascent should be executed as fast as you can, followed by pushing off the ground with your toes (jumping), and then landing back gracefully. Keep in mind not to land back flat on your feet, but to start on the front of your foot and then land the rest of your foot back flat as you finish the landing (or you'll end up jerking your joints too much)
(Try not to be explosive from the very bottom, as that may lead to excessive strain)
Of course, start with a really light weight (when compared to your regular lifts). My regular back squat is ~350 lbs (about 160 kg) and I still don't go more than 100-110 lbs (~50 kgs) with the explosive ones.
But yes, they're excellent for building power and speed. Try them out and let us know how it goes.
Comment: Thanks! I'll add an update in a couple weeks if I remember.
Answer: Based on personal experience, the big lifts do help a lot.
Squats and deadlifts followed by a plyometric superset (e.g. vertical jump, or broad jumps) - the key here being not training to failure, but training until you feel your form starting to deteriorate.
But the one thing that I noticed help me get faster: Sled pushes and pulls.
The biggest reason for this would be because it strongly mimics your body position when running, and if you're intentional about it, you can practice your hip drive as well.

Supplementary exercises to sprints


Upload advanced custom field text link array with csv

Question: On my webshop I have to see a button with a link to ad pdf file.
For every product that button need to have a different link and a different button title name.
I built the webshop with woocommerce where I used Advanced Custom fields to show the buttons with a pdf link.
In ACF I used a link array.
On the product page I can change the title text of the link manually.
But.
There are more than 1000 products. So it's not possible to do this manually.
I imported a csv with the right header names. And importing the columns with links to the buttons works properly.
In the php code I used this standard acf code:
<?php
$link = get_field('link');
if( $link ):
    $link_url = $link['url'];
    $link_title = $link['title'];
    $link_target = $link['target'] ? $link['target'] : '_self';
    ?>
    <a class="button" href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>"><?php echo esc_html( $link_title ); ?>
<?php endif; ?>

So, what meta data I have to give in my csv file to fill in the link title?
--> The title on the button.
Answer: If you make a var_dump() on $link:
var_dump('
', $link);

then you will see all array keys and you can choose the one you need.


Starting freelance career as a programmer

Question: It's my second semester of college and I've taken some relatively advanced data structures classes and java programming. I have written a solid amount of programs in a variety of different languages over the past few years. I'd like to get a start as a freelance programmer/web developer. Where should I start?
Comment: Start by searching this site for the same question.
Answer: You will need to make your bones at all the freelancer sites and do the dirty work until you have a reputation then you will likely find some regular clients that you can make some decent money with. Any Angular experience?
Comment: Build something and put it on your website. If you don't have your own website, up to date, and  displaying either the work for other clients or your own projects, you are not going anywhere.
Comment: Hi Entre, I have the same query, and having angular experience. Any advice/suggestions ? Thanks.
Comment: I got my start (it was a long time ago) putting up signs on campus for tutoring and talking to professors about their needs. Lots of professors need people to write scripts, programs, etc. to crunch their research data.
Answer: I was writing recently on the topic: The ultimate guide to land a freelance gig – End to End
To start with you will need to:

Polish your freelancing portfolio
Learn more about the client you are going to pitch to
Learn more about the client you are going to pitch to
Prepare for the first meeting
Learn how to create an estimate
Answer: There are many Freelancing websites available on the Internet. I would not suggest where to start, but I can help with how to start it.

Portfolio is very important. Usually clients don't go with a fresher who freelances. To gain their trust we need to showcase our accomplishments. For example, you can post your photos or videos of your website designed, or a user simplified e-commerce website in low effort and budget etc.
If you get your first client, then gather his actual requirements and satisfy him with your quality deliverables. His feedback is very important to grasp other clients.
Always be in touch with your old clients. Because in software industry, all websites and software keep on updating with new features. So for sure he will have plenty of ideas to implement for the future. So grab all those opportunities.
Client will approach new freelancers only for cost-cutting. So you can't charge them much in early stages. Once your gain confidence, then you can demand more for it.

I would suggest to kick start with freelancer.com and upwork.com.


Running inverters from Hyundai Ioniq EV's 12V 180 watt rated sockets (two of them)

Question: Edit:
I am now planning to run an inverter from the battery which says 40Ah on it to a 400w pure sine wave inverter, with peak power 800w.  https://www.canadiantire.ca/en/pdp/motomaster-eliminator-400w-pure-sine-power-inverter-0112047p.0112047.html?gclid=CjwKCAjwi9-HBhACEiwAPzUhHCXsctIOh0fzWV6Xm9rxsTSZkAzlWs5CVjhcYpD2P2_j51BLSX6CoxoCOksQAvD_BwE&gclsrc=aw.ds#store=606
I am mainly going to use it for my laptop that draws 65 watts I believe, maybe 90 watts.
The mechanic is telling me to get 8 gauge wire, I am seeing as thick as 4 gauge when doing 800w / 12v = 66.7a and referring to a chart online.
He is also saying put an inline fuse that is slightly above that 66.7 number.  What is correct?
My inverters are rated up to 175 watts, I have one in each socket.
The sockets were just replaced because one time I guess I tried to pull too much by using an extension cord/power bar thing with a thick cable, laptop, extra monitor, vape battery charger all plugged into it and it melted some plastic parts in the socket.
I received a firm warning from the dealer saying, "This is an extreme fire hazard to use an extension cord as the 12V is only rated for 12V appliances like specialized mini-fridges, air pumps, etc".
So, I am plugging my laptop now directly into the inverter and then using the other socket's inverter for my extra monitor and vape battery charger.
The head mechanic explained to me, "With such a thick gauge cable in my extension cord trying to pull so much power, that caused the socket to overheat and melt."  I am not an electrician but that does not make sense.  The appliances like laptop, monitor, battery charger plugged into my extension cord/power bar are what is trying to pull too much power I thought so the way I have it now, should be safe?  Also, just plugging the extension cord/power bar into the inverter without any appliances should also be safe regardless of the thickness of the cable and wiring in it.
Can someone clarify?
Note:  I can put my car in Utility Mode when parked which then draws power directly from the large Lithium-Ion battery that is used for driving and that is what I normally do.
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Answer: You are right, the thickness of your extension cords is not what melted your car's sockets.  There was some other issue, such as the inverters exceeded the 180 watt rating of the socket, or the sockets were not designed properly, etc.  The root cause was, indeed, the wattage of too many devices connected to the socket, not the voltage.  The voltage can vary with the inverter, but it is the wattage that governs the limit of the sockets.
Also, a heavier gauge extension cord is desirable.  It will prevent the wires and the power bar from becoming warm with load.
Your final assumption is correct:  fewer connected devices will prevent the sockets from melting again.  To repeat, the voltages and wire gauge don't matter.  Your mechanics simply don't understand electricity.
Comment: That is good to know, my new setup is slightly noisier from the fans on two inverters but it seems to be running fine with laptop in one, monitor and vape battery charger in the other.  I have this way in case the laptop has a sudden surge from higher CPU usage.
Answer: What caused your sockets to overheat and then melt the support was drawing too much power and possibly loose / poor connections.
I would not use those sockets for any thing more than charging a smartphone or running a dash cam.
To provide the power to run monitors and laptops I would run a suitably fused direct supply, possibly switched with a correctly rated relay or manual switch, from the battery to a suitable connecting socket. Use a cable rated for 20A or so to avoid any overheating issues.
The mechanic was correct with the point about excess power btw.
Comment: Can my current setup of having a 175w inverter in each 12v 180w socket, with laptop in one inverter and monitor and small battery charging device for vapes in the other start a fire?  Or worst case, will it melt the socket part again or blow the fuse?  I remember reading that a laptop should come around 80w, monitor about the same or less and charging device less than either.  Also "loose/poor connection" means the way I plugged the inverter or any of my appliances or something related to the manufacturing of the socket?


Is gidazepam considered legal in Ukraine?

Question: I've checked the table of illegal drugs, and it seems like every other benzodiazepine is in there. But for some reason gidazepam is not. So is it considered legal (because I'm not sure)?
Answer: Yes, in Ukraine, it is legal for doctors to prescribe it, for pharmacies to sell it if prescribed, and for patients to buy it. It is registered with the State Register of Medicines of Ukraine. I've seen published cases where the facts mention prescriptions and sales in 2020. It is also frequently supplied through public procurement (as Hydazepam or Gidazepam).
As you already noticed, hydazepam is not on the effective list of narcotics, psychotropic substances, and precursors by the Cabinet of Ministers of Ukraine. I've even encountered a recent court decision citing an expert report from the end of 2019 stating that it doesn't belong to them under the list which was effective then.
In 2019, a procedure was adopted for determining analogous substances, which reproduce the psychoactive effects of the drugs from the above-mentioned list. But no list of such analogous substances has been published yet. According to the effective procedure, the list must be published at the website of CMHMDAMH.
Answer: Gidazepam is a low potency benzodiazepine orginally and presently produced in Russia and a few other CIS countries.  It is only available by prescription and is the drug primarily used for anxiety in CIS countries.  It is the only benzo that can be prescribed in those countries unless a patient is admitted to a hosptital. It is generally not available in other countries.
Comment: So, is that a yes or a no?
Comment: This does not answer the question.


Can strain gauges radially be mounted on 8 mm diameter shaft for torque measurement for effective result?

Question: I need to measure a torque on an 8mm shaft of an electrical motor on a prototypical device. The expected torque is ~15 Nm and for the data processing I intend to use an Arduino. One requirement which excludes commercially available torque sensors, is the available installation space in the device as well as weight limits and the price. Due to the small diameter, I am afraid that the curvature of the shaft could be too high for the strain gauges - is there any recommendation or best practice how to handle that?
Answer: Many off the shelf torque meters are basically just a socket extension bar with a strain sensor (or several) wrapped around the outside.
Can you quanitfy how much space you have available, with pictures?
15 Nm is a fairly small amount of torque to measure through the deformation of a metal shaft.  One way to solve this and also to increase the diameter (that your strain sensor has to fit around) would be as follows...
Add a hard-rubber coupling between your motor and the shaft it needs to drive.  The rubber will deform a lot more than the metal would do, thus increasing the sensor's effectiveness.  If you make the rubber a larger diameter (25mm perhaps if available space allows) then that should be less problematic for the strain sensor to wrap around.
A rubber shock absorbing engine mount (from just about any car) could probably be modified rather easily to this purpose.
One downside of this is that it would introduce some backlash into your motor drive.  This can be reduced by using a harder rubber compound).
Without photos of your device it's rather hard to imagine what would work for you.
Comment: Thanks for your answer. One can imagine the application as the shaft of a force feedback wheel for sim racing.
I also thought of inserting a component in between. Either changing the Young's modulus (material) and/or the geometry are certainly possibilities to change the underlying material behavior for adapting to the sensors properties.
One of the first thing I could imagine, is to drill a hole in the shaft so the deformation increases a bit by changing the geometrical moment of inertia.


Do Passives stack when added by Hellfire Amulet?

Question: The Hellfire Amulet introduced in patch 2.1 has a secondary affix that adds the effect a random passive ability for your class. If you do this on Monk and get Fleet Footed (Increase movement speed by 10%), will this increase movement speed if worn by a Monk who already uses Fleet Footed?
Comment: I don't think the passives stack.  Some of them would be extremely powerful at twice the values.  And your regular passive slots don't allow you to choose the same one more than once.
Answer: The devs had a chat a few days ago, and one of the things they discussed was Hellfire Amulets.  From the transcript:

The Hellfire Amulet is a regular amulet with the standard 4/2 affixes, but one of the secondary affixes rolls one of your class' passive skills. Enabling that passive for free. They don't stack, so you can't have say… Archery twice. But if you can get Archery on the amulet, then your Demon Hunter is free to pick another skill for your fourth passive. It's a lot of power and it's a way for players to find something else to do.

This is roughly at the 50 minute mark, and discusses the Amulet specifically.
Answer: I have tested this several time on the PTR and no it doesn't, passives effect don't stack with the Hellfire Amulet.


Google Apps spreadsheet script doesn't always finish iterating, works fine otherwise

Question: I'm trying to create a script that looks through a spreadsheet of student data one row at a time and emails a student and their parent if the student's grade is less than 60. The columns in the spreadsheet are: Student ID, Student Name, Student Email Address, Parent Email Address, Grade. There are 30 rows in the spreadsheet - I anticipate using up to 25 of them and leaving the rest blank. Some parent email address fields will be left blank, this is accounted for in the code. All of the students have email addresses.
The script actually works fine, except that it doesn't always finish running through all of the necessary iterations. It stops after a different number of iterations each time - sometimes it does them all, but usually it doesn't. There's no error or anything when it stops, it just stops popping up message boxes or emailing students.
Any idea why it stops running before doing all of the rows?
Here's the code:
function onOpen(){
  loadMenu();
}

function loadMenu() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  ss.addMenu("F-Watch Emailer", [{"name":"Send Emails", "functionName":"sendEmails"}]);
}

function sendEmails() {
  var ss  = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  var range = sheet.getRange("B2:E30");
  var data = range.getValues();
  //Browser.msgBox(data);

  for (var i = 0; i < 30; i++){
    //set variables
    var row = data[i];
    var emailAddress = row[1];
    var parentEmailAddress = row[2];
    var grade = row[3];

    Browser.msgBox("email = "+emailAddress);

    //email student if necessary, return true or false
    if(emailAddress !== ""){
      var emailSent = sendStudentEmail(emailAddress, grade);
    }
    else{
      //Browser.msgBox("Student Email Field " + (i + 1) + " is Empty");
    }

    //email parent if necessary, return true or false
    if(parentEmailAddress !== ""){
      var parentEmailSent = sendParentEmail(parentEmailAddress, grade);
    }
    else{
      //Browser.msgBox("Parent Email Field " + (i + 1) + " is Empty");
    }
  }
}

function sendStudentEmail(emailAddress, grade){
  if(grade < 60){
    var subject = "Weekly F-Watch Email for Mr. Lipson's Class";
    var body = "Attention Students: If you are receiving this automated email, your term grade is currently below 60. Please check iPass and speak to me to make up any late assignments (please refer to my Late Work Policy). If you have any questions, feel free to email me.Have a good day, - Mr. L Note: This is the first in a weekly series of automated emails, and it's in beta. Please forgive any formatting issues. Also, beginning next week, this email will be sent to parents/guardians as well.";
    //MailApp.sendEmail(emailAddress, subject, body);
    //Browser.msgBox("Email sent to " + emailAddress);
    return true;
  }
  else{
    //Browser.msgBox("Email not sent to " + emailAddress);
    return false;
  }
}

function sendParentEmail(parentEmailAddress, grade){
  if(grade < 60){
    var subject = "Weekly F-Watch Email for Mr. Lipson's Class";
    var body = "Parent Email Text";
    //MailApp.sendEmail(emailAddress, subject, body);
    //Browser.msgBox("Email sent to " + parentEmailAddress);
    return true;
  }
  else{
    //Browser.msgBox("Email not sent to " + emailAddress);
    return false;
  }
}

Answer: Try using the debugger and stepping through the for loop that fails.
You can set a stop at any line in the code by double clicking near the line number in the script editor.  The debugger is run by clicking the icon that looks like a spider.
Answer: There are many undocumented limits, sometimes Utilities.Sleep(ms) can help


Saving data in bash?

Question: Ok so I was wondering if it is possible to save like a variable in bash. I am writing a script where you build like farms and mines and I was just wondering if it is possible to bring back those variables even after I stopped the program and then got back on. So lets say I have built 4 farms farms would be farm=4, can I bring this variable back somehow? I know how to make a page that you can make a high scores list on (Which I did for a guessing game.), but this I don't know if it is possible in bash.
Comment: Why dont you consider writing the values in a file. Bash variables seems like a bad idea for the kind of thing you are doing
Answer: You can write everything in a file in that format:
farm=4
myname=gniourf

And then source that file:
#!/bin/bash

# Recover the saved states:
source file_where_i_saved_my_stuff

# Now you can recover all your variables!
echo "$farm"
echo "$myname"

Edit
Since you want to know how you can save your variables, here's a quick hint, with a lot of stuff that hasn't been given in the other answer.
Alright, so you want to save some variables in a file, and be able to later source this file to recover the value of these variables. Of course, you'll have a lot of variables, and you don't want to explicitly write down the list of all the variables you'll have to save, which is error prone and retarded. I mean, nobody wants to do the following:
cat <<EOF > file_where_i_saved_my_stuff
variable1=$variable1
variable2=$variable2
...
variable1000000=$variable1000000
EOF

In fact, you don't want to do this at all for many reasons. Now, I'll address the solution:
The method relies on this stupid thing (together with good bash practice and knowledge): name all the variables you want to save using a prefix, e.g., variable_i_want_to_save_, so that you'll have variables like variable_i_want_to_save_number_of_farms and variable_i_want_to_save_color_of_granny_dress and so on. Do not use this prefix with variables you don't want to save.
Smart thing #1
bash has a wonderful thing: you can get the name of all variables that start with a certain prefix like so:
"${!prefix@}"

This will expand to a list of all known variables that start with prefix prefix.
Hence, in our case,
for i in "${!variable_i_want_to_save_@}"; do

will loop through the name of all variables that are prefixed by our wonderful prefix. Isn't that great?
Smart thing #2
If I am in the following situation:
a=1
b=2
variablename="a"

how do I get the value of the variable the name of which is the value of the variable variablename? Easy, use the "${!variablename}" construct. Look:
$ a=1
$ b=2
$ variablename=a
$ echo "${!variablename}"
1

The ${!prefix@} and ${!variablename} expansions are explained in the Shell Parameter Expansion section of the Bash reference (you'll have to scroll down a bit to get there).
(Broken) Solution
Then you're good for a broken solution to save your variables in a file, like so:
save_data_to_file() {
    for i in "${variable_i_want_to_save_@}"; do
        echo "$i=${!i}"
    done > file_where_i_saved_my_stuff
}

This is really efficient and cool, but really broken if you have spaces or junk characters of any sort in your variables (which can (and should) appear). Oh dear.
Solution
The good thing for you is that bash has this wonderful printf command with its amazing format specification %q that will

quote the argument in a way that can be reused as shell input

(I got this from help printf). It's amazing, it's absolutely fantastic, just try it:
$ a=$'bonjour les amis !\ncomment ça va ?'
$ # You see, variable a has a lot of stupid characters:
$ echo "$a"
bonjour les amis !
comment ça va ?
$ # and printf does a wonderful job:
$ printf '%s=%q\n' a "$a"
a=$'bonjour les amis!\ncomment \303\247a va ?'

You couldn't dream of something as good as this. Or maybe you could, but please just admit it's awesome!
So, here you are with your wonderful way to save your variables in a file:
save_data_to_file() {
    for i in "${!variable_i_want_to_save_@}"; do
        printf '%s=%q\n' "$i" "${!i}"
    done > file_where_i_saved_my_stuff
}

Note that sourcing an external file like this leads to obvious security issues, so make sure you only use this method with care!
Comment: Some great techniques, but (a) `"${prefix@}"` should be `"${!prefix@}"` (and so on throughout the rest of the post), and (b) it's worth pointing out the security risk that comes with sourcing an entire file, given that it won't just perform variable definitions, but execute whatever commands are  present.
Comment: yes but I would also need a save command which is what I was looking for more
Answer: You can save all needed variables in a file (using here-doc):
cat<<EOF>/path/to/file
var1="$var1"
var2="$var2"
EOF

and to recreate your previous environment :
source /path/to/file

or
. /path/to/file

EXPLANATIONS

the place where to put the here-doc depends of your code, can be the last lines if you don't have to save variables in loops by example
the place to put the source command is the top of your script after the shebang

Help said :
$ LANG=C help source

source: source filename [arguments]
      Execute commands from a file in the current shell.
Read and execute commands from FILENAME in the current shell.  The
entries in $PATH are used to find the directory containing FILENAME.
If any ARGUMENTS are supplied, they become the positional parameters
when FILENAME is executed.

Exit Status:
Returns the status of the last command executed in FILENAME; fails if
FILENAME cannot be read.

NOTE
if you want for some reasons to dynamically generate the files with pattern matching on variable names :

by suffix : printf '%q\n' $(set | grep "suffix=") > save_file
by prefix : printf '%q\n' $(set | grep "^prefix") > save_file

Thanks gniourf_gniourf for printf trick.
Comment: well I have now tested it and I understand it now so thank you very much and I will actually probably use this later on too.
Comment: So I just put the second thing that in like the top of my script and file to the name of the place it in, correct? So it would be like this cat<>/path/to/savefilename and this could be like a save button correct? and then you load with the second. Am I doing this right?
Comment: Ok what I am saying is I use cat<>... as a save file. then I use source /path/to/file  as a loader is what I am taking from this
Comment: Added _NOTE_ for pattern matching on variables with prefix or suffix
Comment: Added your printf trick with my solution. Your parameter expansion can't deal with suffix AFAIK, nor regex.
Comment: @sputnick sure it can't, but it's useless if you're careful with your variable names.

Saving data in bash?


get the new vertices after rotating in JOGL

Question: I had rotate an object with openGL (JOGL).
Is there a simply way how I can get the new vertices?
Comment: Multiply the cpu-side vertices by a rotation matrix matching the opengl rotation.
Comment: thy it works :)
Answer: The easiest way to do this is to keep a copy of the vertices on the CPU-side, and perform the same transformations to your "local" copy. This can usually be done by accumulating the rotations and translations in a transformation matrix, then applying the transformation matrix to each vertex whenever you access them locally.
Comment: but now can i change the axis of rotation?
Comment: The same way you usually would. The transformation matrix is the sum of the rotations and translations applied to the vertices.
Comment: but i only can use one angle
Comment: that's my code:
Comment: public float[][] rotateMatrix(float angle, float x, float y, float z, float[][] matrix){
  for(int i=0;i<4;i++){
   for(int j=0;j<4;j++){
    returnMatrix[i][j]=(matrix[i][j]*rotationMatrix[i][j]);
   }
Answer: There is a way, but it is not easy:
set up an transform feedback buffer, and have it gather all the points emitted by the geometry shader.
Perform the matrix calculation on the vertex shader, pass the calculated vertices to the geometry stage and then emit them so that the transform feedback buffer catches them.
It's hardly worth it though, I'd go with what the other dude said: calculate it on the CPU.
Why do you want the vertices back? Do you want to apply additional transformations on them?
If so, you can just multiply the model matrix you used to draw the last frame with an matrix that corresponds to whatever transformations you want to do this frame.
For example, say that you want to rotate an object around the Y axis, making one loop every 10 seconds.
Then you just create an identity matrix and save this matrix, as "modelmatrix".
For every frame, assuming that delta miliseconds has passed since the last frame, you create a new identity matrix, and rotate it around ((delta/10000.0f) * 3.14f * 2.0f) radians around the Y axis.
Then you multiply your previously saved modelmatrix with this matrix, and make sure that this operation mutates modelmatrix, eg:
modelmatrix = modelmatrix * rotationmatrix.
Then you throw your rotation matrix away (or better yet, save it, and mutate it to the identity matrix so you don't need to allocate/deallocate the memory for 4*4 floats all the time).


Oxidation of hydroxyl groups of glucose

Question: In all oxidation reactions of glucose, it seems that the aldehyde group alone gets oxidised and none of the hydroxyl groups. In one reaction with nitric acid, the aldehyde group and the terminal hydroxyl group get oxidised but none of the remaining hydroxyl groups. I was wondering why this happens. Are the hydroxyl groups less susceptible to oxidation for any reason? If so why would that be? And also is there a difference is ease of oxidation of the terminal hydroxyl and remaining hydroxyl groups?
Comment: When there are various pathways then what is oxidised depends more on the oxidising reagent - as Matthew mentioned, you can oxidise or reduced in various ways. Do you want to know about mechanism of oxidation with nitric acid?
Comment: @Mithoron Yes i wonder why nitric acid doesn't oxidize the secondary alcohols to ketones
Answer: Aldehydes are easier to oxidize via radical mechanisms because of the ease with which one can break the C-H bond. The resulting radical is stabilized via delocalization of an oxygen lone pair.
Such stabilization is absent in an alcohol. The alcohol shows a similar moiety, but I think the stabilization in the aldehyde is greater because of the shorter C-O bond, which improves orbital overlap.
In a laboratory setting, alcohols tend to be more stable to air, whereas aldehydes can be prone to air oxidation.
Comment: Thank you so much for the answer! But why wouldn't the hydroxyl group be able to stabilise a carbon radical attached to it because it too has a  lone pair on it, would the attached hydrogen to the oxygen in hydroxyl affect it ability to stabilise the radical? Of so why? Also, what if the oxidation reaction is based on an ionic mechanism, how would difference in ease of the two groups be explained in this case?
Comment: That's a really good question. I think added an edit. I would think that the two-electron mechanisms more readily oxidize an alcohol (many reagents stop at the aldehyde, e.g., DMP). However, I would think that nitric acid operates via a two-electron mechanisms though I could be wrong here. If it were a two-electron mechanism, my guess is that the steric factors involved with being terminal versus non-terminal were at play...
Comment: The steric factors and orbital overlap concepts make so much sense! Thanks a lot for the answer!
Answer: OP's statement of "In all oxidation reactions of glucose, it seems that the aldehyde group alone gets oxidised and none of the hydroxyl groups" is not entirely true. For example, the step by oxidative cleavage with periodic acid ($\ce{HIO4}$) has been successfully applied in the constitutional analysis of sugars. The presence of several pairs of vicinal diols such as those in glucose during oxidation with $\ce{HIO4}$ can lead to the formation of complex product mixtures:

Accordingly, the oxidation reaction of D-glucose with 5 equivalents of $\ce{HIO4}$ gives five equivalents of formic acid and one equivalent of formaldehyde (Figure A). An analogous degradation of D-fructose yields three equivalents of formic acid, two equivalents of formaldehyde, and one equivalent of carbon dioxide (Figure B):

This oxidation is believed to be step-wise. For example, glucose (a hexose) contains a terminal aldehyde group ($\ce{C}$1) adjacent to a hydroxylated carbon. This setup tends to be oxidized to formic acid, $\ce{H-C(OH)2-CH(OH)R -> H-C(=O)OH + (O=)CHR }$, and an another aldose, which contains one less carbon atom than original sugar (here, it is the corresponding pentose). This formation can be explaned by a $\ce{C-C}$ cleavage followed by each $\ce{C-OH}$ oxidation to $\ce{C=O}$:

Now, this corresponding pentose also contains a terminal aldehyde group adjacent to a hydroxylated carbon. Thus process continues until $\ce{C}$6. The $\mathrm{R}$-group of $\ce{C}$6 is $\ce{H}$. Thus, final product is $\ce{R-CHO \ # \ H-CHO}$, which is formaldehyde. Additional description of this oxidation can be found in here.
Comment: Nice answer to some other question but it doesn't address the OP's question about nitric acid.
Comment: I still don't understand why the aldehydes are easier to oxidise than the hydroxyl groups with weaker oxidising agents like say Benedicts reagent, and also why terminal hydroxyl group alone is oxidised when aldehyde is protected and not the other hydroxyls? And what about nitric acid, why the selectivity of oxidation of only aldehyde and terminal hydroxyl groups? Is it because it isn't too strong an oxidising agent?
Comment: @ user55119 : True. But I am concentrating OP's concern about not oxidizing hydroxyl groups (the title and the first sentence of OP's text). So, I think my answer is appropriate as well.

Oxidation of hydroxyl groups of glucose


How do I get a list of all users who have uploaded a file

Question: My manager is asking me to get a list of all users who have uploaded a file larger than 10 Mb in the past 90 days  to each site we host.  I am new to SP so someone please help.
Comment: More info needed... SharePoint version? SharePoint Online? Selected sites/libraries, all Site Collections and all libraries?
Answer: While this may not be 100% complete, it should be close.

Go to your Enterprise Search Center (or do a search from a site search box and select "Everything".
Search for:
created>1/1/2018 AND size>10000000 AND IsDocument=true

Note that the "AND" must be in upper case.
You can mouse-over each document to see the user's name in the popup or see the list of user in the Author refiners on the left of the page.
Comment: one last tip I can think of is that search shows results you have permissions to so that may change the outcome. (unless your an admin) ;-)


Does the fractional quantum Hall effect always occur when the integer quantum Hall effect occurs?

Question: Does the fractional quantum Hall effect always occur when the integer quantum Hall effect occurs? In other words, is there an example of a material where the IQHE can be measured without the "noise" of the FQHE, allowing us to see the idealized IQHE as shown here?
Answer: The fractional QHE is an effect of the local Coulomb fields of impurities or inhomogeneities of the donator distribution that bind part of the total current locally.  Its probably impossible to produce a donator density as a regular sublattice without disturbations by the third law of thermodynamics.


Turn off framebuffer console in Ubuntu Minimal

Question: I'm trying to set up a VM based on Ubuntu Minimal to test out working with the framebuffer/DirectFB. I want the VM to only display what I put on the framebuffer, while I'm controlling the VM over SSH. So ideally, it boots to a blank screen without a console.
I enabled the framebuffer device by adding video=vesafb and vga=0x305 to the kernel parameters. The framebuffer is working, because "cat /dev/urandom > /dev/fb0" (over ssh) fills the screen with noise.
However, the VM still shows console 1/tty1, and even after I fill the framebuffer with data, there is still a blinking cursor.
How do I turn off the framebuffer console?
Answer: Try to add console=/dev/null as a kernel parameter, it should help.


Steam downloading large files whilst I'm on mobile broadband

Question: I have a CD copy of Napoleon: Total War, and installed it from disc. Now when I try to play, Steam starts trying to download files for it, 5 GB's worth. I'm on mobile broadband so I can't afford this. I have uninstalled Steam / Total War and then tried re-installing both, but still the same problem occurs. Any solutions?
Answer: You could tell Steam to not update games automatically, by right clicking on the game in your library and then clicking on Properties > Updates and choosing Do not automatically update this game
If for some reason, Steam still believes it needs to download something, you will possibly need to find a wireless or wired network other than the mobile one to download the remaining game data.
Comment: From my experience the problem is that once Steam starts updating, you cannot tell it to "stick with what you already got" later on. But maybe they improved on that meanwhile
Answer: Your best bet might be asking a friend who has it also installed for the file appmanifest_34030.acf (in Steam's subfolder steamapps, at least if 34030 is the correct ID of the game) and hope this is enough to make Steam believe it already has the game data. You may however still end up downloading some updates, whether you like it or not. Or your friend uses Steam's backup function and sends you two DVDs...


Take one more piece of luggage travelling from Dusseldorf to Yaounde Cameroon

Question: I would like to have one more piece of luggage travelling from Dusseldorf to Yaounde, Cameroon; what to do? I will travel on 29 September, and I'm in Bielefeld, Germany
Comment: Read the conditions, prepare the money.
Comment: As other commenters have said, "one more" than _what?_ Do you have the maximum allowed by the airline (e.g., 10 items), or the most that you can take for free (e.g., one item)? Please edit your question to include this information.
Comment: Call the airline?
Comment: @Alain Meli Provided you haven't already reached the maximum allowance per passenger permitted by your airline, you can normally either book and pay for additional luggage online or you can call the airline.
Answer: I'am assuming you haven't reached the maximum baggage allowance. I would go to the airlines website, log in to "My Trips" or something similar and then add an extra bag to your reservation. Be sure to add the bag for both ways of your trip.
Alternatively you can also do this at the Airport but charges will most likely be higher.
Depending on the airline, this will cost you from 20 $ to 300 $ (in my experience).


Remove uTorrent from Ubuntu 16.04

Question: I followed the steps found here How to uninstall utorrent 3.3 in ubuntu 14.04.2 LTS? but when I access the localhost server, uTorrent is still there. Did I miss anything?
Comment: For example, what do you mean by "uTorrent is still there"? How do you know? Can you also try the removal command with -v option, and add the output to the question: `sudo rm -rv /opt/utorrent-server-alpha-v3_3`.
Comment: It is, in fact, very possible, but we have no way to know, unless you provide more info. :~)
Comment: What info do you need? I basically just installed ubuntu, downloaded that utorrent .tar.gz file, extracted it using http://ubuntuhandbook.org/index.php/2016/09/setup-%CE%BCtorrent-server-ubuntu-16-04/ this tutorial, and then removed it using the provided answer. (I hope links are permitted).
Answer: Very likely you did not stop uTorrent process - utserver.
It will be running until stopped even if you deleted all uTorrent files.
Restart and it should be gone.

Remove uTorrent from Ubuntu 16.04


Do I need a special firewall on a personal computer

Question: I  was wondering about Linux security issues. Most people agree that a virus-scanner is not useful on a linux system, but what about a firewall? I am using Debian wheezy stable and before used Ubuntu 12.04. If I only have a personal PC which is logged into a secured WLAN, do I need a firewall and what is already set up on the two OS mentioned above?
Comment: I'm not sure I see the need for one, given that all distros include tools like `netstat`, where you can see exactly what TCP, UDP, etc ports are open and their status, and also where you can explicitly control known daemon processes. As near as I can tell, Windows users have firewalls because Windows 95 and early NT did not have the tools, or the documentation on what was listening, for folks to feel comfortable putting them on arbitrary networks.
Comment: You don't have to have one but it doesn't hurt, either.  See http://unix.stackexchange.com/questions/2546/debian-which-firewall-for-a-newbie?rq=1
Comment: You could use a router with custom software. Tomato is nice.
Comment: @BruceEdiger to centralize your policy.
Answer: Easy part first: There is no firewall set up by default on Debian or Ubuntu, or most Linux distros I know of.
Do you need a firewall on Linux? Probably not, because most programs on a Linux systems that are listening for incoming connections have to be explicitly started by someone, and were installed from package repositories run by the distro. And if you're on a trusted WLAN, your computer probably has a private IP address, and is connecting to a router using NAT with a public IP address, and that router also functions as a firewall.
Reasons you might need a firewall on Linux:

There are many programs that start a web server (or some other sort of server) so you can interface with the program from any machine. If you don't need to remotely interface with this sort of program, you could use a firewall to block all connections not coming from the computer itself.
You don't want your computer to respond to ping. Then you would use a firewall to drop all ICMP packets. You can also have your firewall drop all packets requesting connections to closed ports without your computer responding at all. This will make you invisible to (practically all) port scans if, for example, you were using the WLAN in a shady coffee shop.
You connect directly to the Internet with a public IP address and then join a bunch of IRC chat rooms daring the occupants to hack you.
You are being hunted by a nation-state.
Answer: You generally do not need a firewall ever.
A firewall (more precise a packet filter) is used to filter network packages, i.e. to allow some connections and disallow others.
Connection can be ingoing or outgoing.
An ingoing connection, i.e. someone else wants to connect to your computer, is only possible, if your computer offers some service. - For a private computer you just do not offer any services and no one else is able to connect to you. All without any firewall.
For outgoing connections, i.e. you are trying to connect to some other computer, you need some software to do so. For example you use a web browser to access some remote web server. - With all the linux distributions you typically install only software from the repository of your distribution of your choice. - As this software is usually open source, you can be pretty sure, this software is only doing what it claims to do. - A firewall will usually be of no help.
The only situation where a firewall makes sense is, if you want to offer some service to some specific part of the network. In this case you have to allow connection, but filer out those connection you do not want. - But even in this case there might be easier solutions like tcpwrapper or some configuration of your service.
You can use a command like sudo netstat -tupln to list all active services. Those might be bound to 127.0.0.1 which means they are only accessible from the same host or bound to 0.0.0.0 which means they are accessible from everywhere.
Comment: *Without* a firewall, there are no restrictions on incoming or outgoing packets, so it does not make sense to say you would *only* need one "if you want to offer some service to the network" but "filter out those connections you don't want".  If you don't care about filtering packets "you don't want" when you are offering *no services*, why would you care about filtering packets if you are?  The threat is more or less the same.
Comment: If you do not offer any service, all incoming connection are refused. - You do not need a firewall for that.
Comment: Unless you are going to check `netstat` every two minutes, you'll never know if and when *something* has opened a listening port for whatever reason.  Whereas if you use a firewall and log rejected packets, A) "something" won't work until you let it, B) you'll know when something outside tried and failed to connect to something inside.  Also, without the firewall, *anything* can engage in any kind of communication with *anyone anywhere*, and you'll never know about that either.
Comment: Linux is not Windows, where it is common to install obscure software from arbitrary web pages, with unpredictable behavior. On Linux you install software from trusted repositories, with typically well defined behavior. (Of course this doesn't automatically mean, you cannot shoot your self in the foot with this.) - Logging all failed connections from outside will usually result in a very long list, which usually is only useful to create FUD. - Guess we should sum it up as "the topic is controversal". ;)
Comment: Windows is more of a target, but http://unix.stackexchange.com/questions/96848/do-i-really-need-an-antivirus-on-debian-7/96861#96861 etc -- linux isn't *immune*.  Logging all blocked packets (particularly within a home LAN) should not amount to much, and allows you to notice if either your firewall config is hampering something, or if there is some intermittent mysterious "service" you didn't know about and would prefer to disable properly.  If there are other systems on the network that do some regular (rejected) polling, just create a special rule for them to skip logging.
Comment: I guess "the topic is controversal" will be the final answer for the time being. Nevertheless I am very thankful for your help, everybody!
Comment: _egress_ (outgoing) filtering is good nettiquete: if your host ends up being compromised, please don't allow it to be automatically turned into a bot.
Answer: It is indeed not a great idea to expose open ports when you do not need them.  It increases your exposure to security vulnerabilities in the relevant software.
You do not mention a separate guest WLAN, therefore I must assume that you will in future allow other devices such as a guest's laptop, or your own phone, to connect to the same WLAN.  In turn, you should assume that your guests laptops are not trustworthy.
Neither of the two OS's have any firewall set up to start with.
Ubuntu aimed to meet something called "No Open Ports" by default.  In a recent version, they are failing to do so.  (Bug for Rhythmbox on Ubuntu).
A standard install of Debian Wheezy listens to UDP port 111, because it runs rpcbind.  (As mentioned here )
I endorse checking your current open ports using ss or netstat.  I use the instructions here.  The two examples above are the main ones I would expect to find.
Definitely remove rpcbind if you are not using it.  rpcbind is only required for NFS2 and NFS3.  (It is not required for NFS4).  If you have a personal PC and you do not know what NFS is, then you are not using NFS.
You may as well also disable the DAAP plugin in Rhythmbox, if you are not using it.  (It is one method to access music over the local network.  So you can just disable it and see if you lose any music :-).
The disadvantage of running a firewall, is the troubleshooting required when it blocks something you do need.  For example if you want to use BitTorrent, you will need to configure your firewall to allow it, otherwise you will not be able to upload (and the tit-for-tat algorithm means this can slow your download).
I suggest a two-tier approach.  First learn how to check ss or netstat.  Make sure you disable/remove any programs listening on the network that you do not need.  Secondly, configure a firewall.
When something is not working and you need to troubleshoot it, you will be able to 1) re-check what programs are listening on the network, and 2) entirely disable the firewall in good confidence.
If your problem goes away, you will know it is a firewall problem.  You can start researching what ports you need to allow (or whether there is some more tricky problem :-).  And hopefully eventually configure and re-enable the firewall, so that you are covered the next time Ubuntu forget about their flagship security policy and open up a new port that you do not need :-)
The ufw firewall is available for both Debian and Ubuntu.  Ubuntu created it to provide an "Uncomplicated Firewall".


How much memory does a C# reference consume?

Question: How much memory does a C# reference consume?
Does References consumes memory as much as the object itself?
Answer: A reference is implemented as a pointer, so in an application that runs in x86 mode (32 bit), a reference is four bytes, and in x64 mode (64 bit), a reference is eight bytes.
As the reference is just a pointer to an object, the reference is the same size regardless of what it is pointing to, or even if it doesn't point to anything at all (null).
Comment: Downvoter: Why the downvote? If you don't explain what it is that you think is wrong, it can't improve the answer.
Comment: @Ashigore: There is actually no overhead at all in a reference, it's just a pointer. Any overhead is associated with the object, like type information and garbage collection references.
Comment: I was going to answer this but I stopped when I started to wonder that there surely must be some additional overhead memory involved in the creation and maintenance of a reference beyond the pointer itself.
Answer: A reference consumes the native word size of the platform it is running on.
That is, 32-bit: 32 bits. 64-bit: 64 bits.
So no.. your object can be variable in size.. the reference will always be as above.
Answer: From C# 5.0 in a Nutshell: The Definitive Reference in page 22;

Reference types require separate allocations of memory for the
  reference and object. The object consumes as many bytes as its fields,
  plus additional administrative overhead. The precise overhead is
  intrinsically private to the implementation of the .NET runtime, but
  at minimum the overhead is eight bytes, used to store a key to the
  object's type, as well as temporary information such as its lock state
  for multithreading and a flag to indicate whether it has been fixed
  from movement by the garbage collector. Each reference to an object
  requires an extra four or eight bytes, depending on whether the .NET
  runtime is running on a 32- or 64-bit platform.


Export Test Execution result to excel through developer console/ SFDC org

Question: I just did ran all tests. Is it possible to export the results (all failures and successes) into an excel sheet?
Answer: Its an Idea on Salesforce Community:

Export Test Results from Apex Test Execution Page
Please provide an easy way how to export the test results directly from GUI. For example, as a test manager you're onboarding new functionality and want to see how your tests are doing before and after the new stuff is deployed. You plan to compare the results in Excel (same values as now displayed on GUI).
Currently, you need to use either a SOQL query to ApexTestResult in Workbench, or copy from a print view. Print view is not good as it displays only a limited number of items, and selecting large number of items is arduous and error prone.


What is the difference between 「慎重 」「用心深さ」and 「用心」?

Question: I was originally looking up the word 慎重 and came across the other words. All three of them are translated as "discretion." What's the subtle difference and/or nuance among all three of them?
Answer: 用心 is mainly used as a suru-verb today, except in this idiomatic catchphrase and 用心深い. It refers to alertness against bad events, especially crimes.
慎重 (na-adj) and 用心深い (i-adj) are indeed similar in meaning, and sometimes interchangeable. The former is simpler and used whenever you need carefulness/alertness (like doing a math calculation or turning over a pancake). The latter is usually more about security and used with risks such as fire, thievery, fraud and natural disasters. 慎重な人 is a careful person who takes time before trying something new, whereas 用心深い人 is a guarded/cautious person who thinks they are at risk.

パンケーキを慎重に裏返す。
試験の回答を慎重に確認する。
窓を閉めたか用心深く見回る。
彼に騙されないよう、話を用心深く聞いた。

用心深さ is the level/degree of 用心, just as 慎重さ is the level/degree of 慎重. (See how to use さ)


How to use omniauth gem to get twitter user id?

Question: I have a web application using omniauth-twitter gem for authentication purpose. I have to fetch the followers and following of the authenticated user into database But I am not able to figure out how would I use twitter gem to get the list of followers/following
Answer: I figured if you add the following lines of code to your omniauth.rb file which you must have created in / config / initializers / omniauth.rb, you have a twitter client and you are all set to use twitter gem. :-) It's fun to play around with Twitter gem. For more code, check out my project on github.. https://github.com/suhasdeshpande/DigFollowers
<code>Rails.application.config.middleware.use OmniAuth::Builder do
   provider :twitter, 'Your Consumer key','Consumer Secret key'

   **Twitter.configure do |config|
    config.consumer_key = 'same goes here.. CK'
    config.consumer_secret = 'Consumer secret key'
   end**
end
</code>


Linux mint bluetooth headphone connect resets keyboard map

Question: So I have a ~/.config/autostart/keyboard.desktop file that tweaks my laptop keyboard layout on login. It does setxkbmap -option "ctrl:nocaps" amongst other things. This maps my caps lock key to ctrl. That part works fine. However, when I connect my bluetooth headset, somehow this setting is undone and my caps lock key goes back to being caps lock. I searched /etc/udev and there's only one script in there for a separate vendor that seems unrelated. How can I track down what's doing this, why, and how to avoid it?
Comment: I'm running KDE on Debian and having the same issue so it's not specific to Mint
Answer: So it seems doing this via an autostart script that calls setxkbmap is not the right approach. I found this answer that explains how to set this in gnome via gsettings command line or dconf-editor or the main keyboard layout options GUI, and setting it that way seems to persist across USB/bluetooth disconnect/connects.


What is the difference between kernel and user mode programming?

Question: I would like to know how a kernel programmer thinks about memory vs user mode programmer. I would also like to know a few differences between kernel programming and user mode programming.
Comment: You ask questions, but don't accept a correct answer at the end...
Answer: User mode programming refers to programming under the protection, supervision, and abstraction mechanisms of the operating system kernel. e.g: in user mode you can't write disk sectors, as they are "hidden" under the file system APIs. You can't write to physical memory addresses, as the kernel is in control of translating between virtual and physical memory, altough you can reserve memory for your own needs. Also, altough you can go low level (assembly) you can't execute instructions that are privileged, for example, trying to mess with processor caches, TBLs, and MMU.
Kernel programming allows you to program the system for low-level duties without any restriction. Hardware drivers for example cannot be programmed under user mode since they need to access hardware directly to do I/O, map memory regions,etc.
Of course you can't think kernel-mode as "less restricted" and go to develop applications in KM. Many system facilities for application programming are not available under KM, as the libraries required to interact with the user run in usermode. Also, those usermode libraries won't link to a kernel module.
This distinction may be more or less defined depending on the operating system. KM/UM is a nonsense in DOS, where programs were allowed to access system resources freely (at least in 8086/88 real mode -- this is not the case with DOS Extenders).
Answer: See Jeffs article on Understanding User and Kernel Mode
Answer: Perfect answer selected as answer. In a nutshell, according to my limited knowledge, in kernel mode, you are reading/writing bytes to physical addresses of a device like a VGA card. However, in user mode, you are writing to a file, i.e, if the operating system in UNIX like.


ratio of the number of saddle points to local minima

Question: As far as I know the problem with gradient descent algorithms for solving non-convex optimization problems is getting "stuck" in a local minima.
In the paper
Identifying and attacking the saddle point problem in
high-dimensional non-convex optimization
they argue that the more profound difficulty originates from the
proliferation of saddle points, not local minima, especially in high dimensional problems of practical interest.
I am posting this here because my question is a mathematical one:
"Consider minimizing a randomly chosen error function of a
single scalar variable, given by a single draw of a Gaussian process. (Rasmussen and Williams,
2005) have shown that such a random error function would have many local minima and maxima,
with high probability over the choice of the function, but saddles would occur with negligible probability."
So far so good
"On the other-hand, random Gaussian error functions over N scalar variables, or dimensions, are increasingly likely to have saddle points rather than local minima as N increases."
"The ratio of the number of saddle points to local minima increases
exponentially with the dimensionality N."
Why?
Intuitively that makes sense to me, but how would you go about finding or calculating this ratio.
Any help would be appreciated!
Answer: Mostly heuristics: Let $a$ be a critical point and write
$$ f(a+h)=f(a)+ f''(a)[h,h] + o(|h|^2)$$
Suppose (not obvious how to make this rigourous!) that
 $f''(a)$ is centered random gaussian (GOE(n)). Then the distribution function for
its eigenvalues is
$$ P(\lambda_1,...\lambda_n)= K \prod_{i<j} |\lambda_i-\lambda_j|
\exp \left( -\frac{1}{4\sigma^2} \sum_k\lambda_k^2 \right) .$$
If not for the product of differences the formula suggests that
integrating only over $\lambda_k\geq 0$ should produce $(1/2)^n$ of total probability. I think the product difference tends to amplify this behavior (since positive 'squeezes' together eigenvalues) but I don't really know how to make all this rigourous.