vectorizing a script with cellfun

Question: I'm aiming to import data from various folder and text files into matlab.
clear all
main_folder = 'E:\data';
    %Directory of data
TopFolder = dir(main_folder);
    %exclude the first two cells as they are just pointers.
TopFolder = TopFolder(3:end);
TopFolder = struct2cell(TopFolder);
Name1 = TopFolder(1,:);
    %obtain the name of each folder
dirListing = cellfun(@(x)dir(fullfile(main_folder,x,'*.txt')),Name1,'un',0);
Variables = cellfun(@(x)struct2cell(x),dirListing,'un',0);
FilesToRead = cellfun(@(x)x(1,:),Variables,'un',0);
    %obtain the name of each text file in each folder

This provides the name for each text file in each folder within 'main_folder'. I am now trying to load the data without using a for loop (I realise that for loops are sometimes faster in doing this but I'm aiming for a compact script).
The method I would use with a for loop would be:
for k = 1:length(FilesToRead);
    filename{k} = cellfun(@(x)fullfile(main_folder,Name{k},x),FilesToRead{k},'un',0);
    fid{k} = cellfun(@(x)fopen(x),filename{k},'un',0);
    C{k} = cellfun(@(x)textscan(x,'%f'),fid{k},'un',0);
end

Is there a method which would involve not using loops at all? something like cellfun within cellfun maybe?
Answer: Yes. This it going to be pretty scary since C depends on fid depends on filename. The basic idea will be:
deal(feval(@(filenames_fids){filenames_fids{1}, filenames_fids{2}, ...
  <compute C>}, feval(@(filenames){filenames, <compute fid>}, ...
  <compute filenames>)));

Let's start with computing the filenames:
arrayfun(@(x)cellfun(@(x)fullfile(main_folder,Name{k},x),FilesToRead{k},...
  'un',0), 1:length(FilesToRead), 'uniformoutput', 0);

this will give us a K-by-1 cell array of filenames. Now we can use that to compute fids:
{filenames, arrayfun(@(k)cellfun(@(x)fopen(x),filenames{k},'un',0), ...
  1:length(FilesToRead), 'uniformoutput', 0)};

We stick fids together with filenames in a K-by-2 cell array, ready to pass on to compute our final outputs:
{filenames_fids{1}, filenames_fids{2}, ...
  arrayfun(@(k)cellfun(@(x)textscan(x,'%f'), ...
  filenames_fid{2}{k},'un',0), 1:length(FilesToRead), 'uniformoutput', 0)}

Then we're putting that final cell array into deal, so that the results end up in three different variables.
[filenames fid C] = deal(feval(@(filenames_fids){filenames_fids{1}, ...
  filenames_fids{2}, arrayfun(@(k)cellfun(@(x)textscan(x,'%f'), ...
  filenames_fid{2}{k},'un',0), 1:length(FilesToRead), 'uniformoutput', 0)}, ...
  feval(@(filenames){filenames, arrayfun(@(k)cellfun(@(x)fopen(x), ...
  filenames{k},'un',0), 1:length(FilesToRead), 'uniformoutput', 0)}, ...
  arrayfun(@(x)cellfun(@(x)fullfile(main_folder,Name{k},x),FilesToRead{k}, ...
  'un',0), 1:length(FilesToRead), 'uniformoutput', 0))));

Errm... There's probably a nicer way to do this if you don't mind about keeping filenames and fid. Maybe using cellfun instead of arrayfun could also make it more concise, but I'm not very good with cellfuns, so this is what I came up with. I think the for loop version is more compact anyway! (also, I haven't actually tested this. It will probably need some debugging).
Comment: I agree, the loop version seems to be way more compact.
Answer: folder = 'E:\data';
files = dir(fullfile(folder, '*.txt'));
full_names = strcat(folder, filesep, {files.name});
fids = cellfun(@(x) fopen(x, 'r'), full_names);
c = arrayfun(@(x) textscan(x, '%f'), fids);  % load data here
res = arrayfun(@(x) fclose(x), fids);
assert(all(res == 0), 'error in closing files');

but if the data is in csv format it can be even easier:
folder = 'E:\data';
files = dir(fullfile(folder, '*.txt'));
full_names = strcat(folder, filesep, {files.name});
c = cellfun(@(x) csvread(x), full_names,  'UniformOutput', false);

now all the data is stored in c

vectorizing a script with cellfun


Where is Gmail Archive option in Evolution?

Question: How can I easily archive my gmail account emails in Evolution? I would like a solution easily as gmail archive. After lot of googling the only solution that I found is manually sending to the All Email Folder :/.
Answer: Since October 2014, Evolution supports archiving. Archive action is available via the message menu (right-click on the message) and the default shortcut is Ctrl+Alt+A.
From this post:

Archive like Gmail does
If you use Evolution with a Gmail account, and you want the same functionality as the Gmail archive button, you can accomplish this by setting the Evolution archive folder to point to the Gmail "All Mail" folder, which will cause the Evolution archive action to behave as Gmail's does.
To use this functionality (with or without Gmail), simply select the messages you want to move, and click the "Archive…" button:
This is also available via the "Message" menu. You can also activate with the Control-Alt-a shortcut.
Comment: I tested this and it works, but I recommend putting the most basic content here and link the post for reference
Comment: Not sure if that shortcut is correct for older versions, but evolution 3.26.1 has the keyboard shortcut set to Ctrl-Alt-A (not Shift)
Answer: Had trouble setting this up until I found this related question & answer

Open Evolution Preferences under the Edit menu. Under Mail Accounts click once on the account in question and click the Edit button on the right. This will open the Account Editor. Click on Defaults and you should see there under Special Folders a setting for the Archive Folder which may be unset. Click the button to choose a folder to archive messages to. Now CtrlAltA should archive an email.

For gmail, you'll want to use 'All Mail' as the 'Archive' folder.  You can do a similar thing with trash / spam - by default they map to the gmail trash/spam folders, but you can configure a folder to move them to.
Answer: You can simply click 'delete' to remove an email from the Inbox. By default the email will still be available in the All Mail folder. If you really want to delete an email (something you probably don't do as often as 'archive'), drag that email to the Google Mail trash folder.
Comment: Testing this out in evolution doesn't work as expected - my settings match those above (by default), and 'Delete' in evolution moves it to my gmail trash folder
Comment: That is true by default, but depends on how Gmail is configured, see dave's answer and the comment.
Answer: In the Settings on the Gmail website, you can set it to archive deleted messages so whenever you delete a message it will be archived on Gmail's server.
The settings can be found in Gmail -> Settings -> Forward and POP/IMAP with the label When a message is marked as deleted and expunged from the last visible IMAP folder. Here is a picture of the settings, it's the 3rd section.
Comment: Yes, there is an option Gmail->Settings->Forward and POP/IMAP that reads: "When a message is marked as deleted and expunged from the last visible IMAP folder: [x] Archive the message (default)"
Comment: Testing this out in evolution doesn't work as expected - my settings match those above (by default), and 'Delete' in evolution moves it to my gmail trash folder
Answer: I believe the issue you are having is related to the POP protocol.  You may want to check into IMAP:
http://mail.google.com/support/bin/answer.py?hl=en-GB&ctx=mail&answer=75725
I don't know if IMAP, works as well as POP via Evolution, but I don't see a reason it shouldn't.  The main thing that you need to make clear is whether or not you want your Evolution archive to directly correlate to your gmail account.
Because at the end of the day an archive is just a database. (aka a folder containing old emails).   And beagle or other search plugins can give you the same exact functionality as the web based service.


Published or released? [This book was "released in 1890" or this book was "published .." ?]

Question: What's the difference in meaning between publishing a book and releasing a book?
Answer: Both options can be used, see publish and release dictionary definitions.
Even though the word publish might just have become too old-fashioned for nowadays consumers and the use of the word release is on the increase, for books case, I'd rather use publish
If we were talking about a movie, music CD, or software then the word release would be more appropriate.
Answer: The short answer, to the effect of the opposite of the other answer here, is no. To elaborate, the synonyms listed by Google come daringly close to released:

make known, make public, publicize, bring to public notice/attention, announce, report, declare, post, communicate, impart, broadcast, transmit, issue, put out, distribute, spread, promulgate, propagandize, disseminate, circulate, air, blazon, herald, proclaim; disclose, reveal, divulge, leak

I'm not convinced that either would sound odd in that use case, but one point I ought to mention is that publishing can refer to the entire process of publishing-- the paperwork and all those sorts of things.
Comment: this point is important and that what I was asking about


C++ MFC ocx in a C# project, pointer parameters

Question: I have ported succesful a old MFC project made in VC6 to VS2010. This project makes an ocx file that I can use as activeX in a C# and paste into my winform (drag/drop).
No problem until there. When I try to find my routines everthing comes up. Some of the functions rendering images into this OCX control. For this routine I need to pass parameters.
Its a long type parameter in C++. This parameter is a pointer (that is used a lot in C++).
In c# in other hands we got some restrictions. Some data types cant be used. When I look to the type in C# I see its INT32. Due the conversion to int32 it removes my pointer from 0FF55885 is to 0.
What is the best approach to work with pointers in C# and how do I get rit of the conversion?
Edit: some more info
This is my c++ function:
AddPixelMatrix(long lID,..., long l2DPixelArray, long lWidth, long lHeight, long lColorArray,long lNofColors, long lStretchWithImage)
in my c#
axImgView1.AddPixelMatrix(parameter1,...); all parameters are type int
Answer: Any pointer can be marshalled as System.IntPtr.


When you go out in Tichu, does the current round continue?

Question: Pretend 10-10 is played and then I go out with J-J. Does the current round continue (players playing Q-Q or higher, etc), hence I would not claim the cards, or does it end (me still obviously being out) and the next player will lead?
Answer: Yes. The current round continues and someone else can win the trick, unless you're the third player to go out, in which a new round begins.
Answer: As Lobsang mentioned: yes, the round continues.
If everybody passes, you (player of J-J) would take the trick, then cede the lead of the next hand to the player next in order, since you have nothing left to play.


Android - Disable Forced DozeMode or AppStandByMode

Question: I have an application that uses a ForegroundService to send location updates to a server. Basically a tracker.
This ForegroundService has a Handler that periodically (using postDelayed) executes a block of code to send the location.
This works perfectly fine, when the app is in the foreground and even in the background, but I started to notice a delay when the phone is locked, with the screen off for about 15minutes. I mean, 15 minutes of no user activity and no charger plugged.
This is happening on a Android Q (v10) device. I'm assuming this would also happen on any device running Oreo onwards.
Let's make it clear... My app send the location every 30sec, but when entering what I suppose is the DozeMode or AppStandByMode, it continues sending the location, but every 2 minutes (more or less). If I turn the screen on, or plug-in the charger it inmediately come back to the 30sec pace. That's what makes me thing about the DozeMode or AppStandByMode. Moreover, if I leave the phone untouched, but with the charger plugged in, then this never happens.
As said, I'm pretty sure the DozeMode or AppStandByMode is kicking in, and I know I can whitelist my app to prevent that. But before going further I would like to reproduce this without the need to wait those 15minutes every time I want to test the behavior of my app.
So I "googled" how I can force this and here's what I've found:
For DozeMode (see source)

adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step deep

And continue to execute the last command until reaching IDLE state.
For AppStandByeMode (see source)

adb shell dumpsys battery unplug
adb shell am set-inactive packageName true

And query the state with this other command:

adb shell am get-inactive packageName

which I confirm it returns Idle=true
I also even do as this other blog suggest, issuing:

adb shell dumpsys deviceidle force-idle

I though I was not getting in this mode, but now it seems I am and I can not get out of it... See the update
UPDATE
At first I thought I was not entering the DozeMode... Now I can confirm I'm in, but it always triggers inmediately. (no more waiting those 15min)
Whenever I lock the phone and screen goes off, it automatically enters the doze mode and begin spacing the location updates. I plug the charger and then again sends them at 30sec.
I've try:

adb shell dumpsys deviceidle unforce
adb shell dumpsys deviceidle disable
adb shell dumpsys battery reset

and still the same.
Also:

power-down and power back up the phone
uninstall the app
change battery optimization to NOT OPTIMZE inside the app settings

Did I miss a step?
Comment: @KuLdipPaTel, I don't understand how that could be a solution
Answer: Except for Doze mode, Android 9 extended the concept of AppStandby with App Standby Buckets.
Along with network restrictions, an app that is in a low priority bucket will be affected in the frequency of running Jobs, triggering Alarms, and receiving FCM messages.
You can get your app's current bucket using this command:
adb shell am get-standby-bucket your.package.name
You can set the bucket and see how your app behaves using this command:
adb shell am set-standby-bucket your.package.name <never/rare>
I wrote an article that summarizes all changes regarding background process limitations over the years: https://rotemmatityahu.medium.com/workmanager-does-it-always-manage-to-work-fd8518655052
Comment: Thanks for your answer! I'll try that


Is it possible to export an image that can be zoomed-in on?

Question: I am using QGIS on a Mac.  I would like to export my map so that the viewer can zoom in on it, just as I view the map on my QGIS canvas.  I am not sure how to word what I want.  If you see the map from the zoomed-out perspective, the symbols all bunch together, you need to be able to zoom in to see the details.  Anyone have any idea if this is possible?  I tried to export a high res image in the proint composer, but its not nearly enough resolution.
Comment: What software will the recipient be using to view this map? What file format do you want the map in? Also, resolution of your image is dependent on the original source. You can only zoom in so far, and then things begin to pixelate.
Comment: You probably can't solve this problem in general - you'll need to be specific about the particular circumstance / data set that you're trying to convey here. Baltok's questions are a good start - please edit your question (just click edit below your question) to update the details.
Answer: If you need images that can be scaled without loosing detail you may want to try exporting your map to PDF through the Print composer. This is far from being optimal, first of all because a PDF map, when viewed at a small zoom factor, can be very difficult to read or entirely impossible. PDF has also poor support for detailed vector graphic features, so if e.g. a line feature has a certain width, that will be independent on the zooming factor and will lead to lines that are too thin or too heavy depending on the viewing scale.

Another possibility is to export the map in SVG format, again from the Print composer. The same limitations described above for PDF apply.


4e class tags -- good idea or confusing?

Question: So we've got [barbarian] and [shaman] tags. There has been some degree of tag war about them. Are they useful?
Answer: My sense: nope, because they are inherently undefined. Does [shaman] mean 4e shaman, 3e shaman, AD&D shaman, or Greg Stafford? Clicking the shaman tag will not give me a well defined list of questions.
Comment: agreed, not useful.  Too tightly scoped while also being too vague.
Comment: Tightly scoped tags are good, and while I disagree about vagueness I think there are better places to draw that line in the sand
Comment: But searching for "[shaman] [dnd4.0]" will eliminate all except the 4e shaman, won't it? I don't think Greg Stafford is honestly a problem - wouldn't we need to eliminate the [mechanics] tag for that same reason? You've got a much better case against [warlord], in my opinion: http://www.reapermini.com/Games/Warlord , and I'm not sure how I feel about that. But I'm not sure how I feel about truly ambiguous tags, anyway.
Comment: Hm. So I guess the question is should tags require multiple tag searches to be reasonably scoped? I don't know the answer. :)
Answer: I think they are useful. They allow someone to follow a theme fairly easily by going to tag, clicking it and seeing just those question. The purpose of tagging is to provide non-hierarchical information that allows easy, and intuitive searches.
To be an effective tag is has to be intelligible (easily understood by anyone who looks at it) and, at the same time, limit itself. The class tags like shaman, warlock or barbarian do exactly that, and provide a good deal more intelligence about the questions that contain them than others I could think of (natural-1, what  is that?).
As an aside I rather find the differences and similarities between games as enlightening as you find them annoying, which makes yet another good reason to keep the tags.
Answer: I think a system-agnostic [barbarian] tag promotes a useful search/browse workflow for players and game designers, if not necessarily people who are actually running games. "What kinds of things do barbarians do, irrespective of system?" is a question that can be answered most efficiently by examining questions tagged [barbarian]. If I'm new to R-pGs in general, and want more information about what barbarians are like, reading those questions will tell me how other players view barbarians. Similarly, if I'm writing my own R-pG, and want to see what mechanics other systems see as innate to "barbarian-hood," surveying a system-agnostic [barbarian] tag can be useful.
[dd4.0-barbarian] does not strike me as useful from a search/browse perspective. If we don't tag by class at all, I can search for "[dd4.0] barbarian." If we use system-agnostic class tags, I can search by "[dd4.0] [barbarian]."
Unfortunately, all that goes out the window when we talk about following. The following system is innately less functional than it could be. I don't feel like prefixed tags are a good answer to that lack of functionality, because it doesn't mesh well with my personal mental map of what tags do. Also, (danger: slippery-slope argument ahead) I don't see why, if [dd4.0-barbarian] is useful, we don't also want to tag the "when to use rage" question with [dd4.0-rules] and [dd4.0-combat].
Answer: I'm a fence sitter; I think the idea behind the tags is good but that the tags should be different.
When I was asking In what edition of DnD was the Barbarian's rage introduced? I originally was going to tag [dd-barbarian] but saw that [barbarian] already existed.
I think they should be present and we should prefix them.
Comment: Prefixes would make a lot of sense. I don't think they're too tightly scoped, personally.


Is there any simple proof of the no-ghost theorem?

Question: Is there any simple proof of the no-ghost theorem in string theory?
Comment: It depends whether the demonstration of the equivalence with the light-cone gauge spectrum - which is manifestly ghost-free - is simple in your opinion.
Comment: A couple of references: 1. P. Goddard and C. B. Thorn, Phys. Lett. B40 (1972) 235; 2. Green, Schwarz and Witten, "Superstring Theory, Vol 1"; 3. [Wikipedia](http://en.wikipedia.org/wiki/Goddard%E2%80%93Thorn_theorem).
Comment: [This Veneziano paper](https://www.sciencedirect.com/science/article/pii/0370157374900271), Physics Reports, 9C (1974), p. 199, illustrates in section 6 a summary of the proof with a comparison to analogous QED steps.
Answer: The proof using DDF formalism involves constructing a set of operators that commute with the Virasoro operators, and when applied to the ground state, they give all possible physical states. These operators $A^{i}_{n}$, where $i$ runs over $d-2$ transverse dimensions of spacetime and $n$ is an arbitrary integer generate among themselves what is called the spectrum generating algebra. These operators are in one-to-one correspondence with the transverse components of $\alpha^{\mu}_{n}$, which arise as coefficients in the mode expansion of the string with appropriate boundary conditions and are promoted to operators upon quantization.
The proof is broadly (and nicely) sketched out for the open bosonic string case using the DDF formalism, given in [1]. Using this formalism, it is shown that there exists no ghosts in the Hilbert space after implementing the old covariant quantization scheme in $d = 26$. The way this is shown is by making contact with states resulting from  implementing light cone quantization scheme, which is manifestly ghost-free. The same formalism can be used to prove the no-ghost theorem in $d=10$ for a string with world-sheet supersymmetry, as given in [2].
The two references do a very nice job in presenting the same, so there is no use replicating the proof.
[1]: Section 2.3.2, Superstring Theory, Volume I; Green, Schwarz, Witten
[2]: Section 4.3.2, Superstring Theory, Volume I; Green, Schwarz, Witten


What do I need to consider before making any class singleton?

Question: I am sure most of my classes like for rendering text, sprite, shapes are not going to need more than one instance. Is it adequate to consider only this fact that its only going to need one instance? Should i also consider other things?
Comment: I think rather than saying "I only need one" you should consider singletons when "I should only have one (at most)". Just because you (currently) only need a single instance of a class does not mean it will always stay the same. However if you know that you should never have more than one instance, then it probably should be a singleton.
Answer: Do you think you don't need more than one or do you think there must never be more than one?
The singleton pattern is mostly useful in situations where the existence of more than one instance of a certain class isn't just unnecessary but would actually cause bugs, so you want to avoid at all cost that there ever is a second instance of it.
Also consider the alternative to a singleton: A purely static class, which in C++ can alternatively be implemented as a namespace. This is usually far easier to use and write and results in far more readable code. The main drawback is that you can't have a pointer or reference to a namespace. But I could hardly think of a situation where you would want that and where a singleton would still make sense.
Comment: +1, the question author should consider: What could go wrong if I inadvertently create multiple of these instances?
Comment: [Game Programming Patterns](http://gameprogrammingpatterns.com/singleton.html) presents one handy use for a singleton over a static class/namespace. By using a singleton for platform-specific functionality like file system interactions, you can write a subclass for each platform, and centralize the platform-selection logic when deciding which to construct in the singleton's GetInstance method. That probably doesn't apply to the particular examples in the question - just a neat aside.
Comment: @GMGregory But is a file system abstraction really something which *must* be a singleton? You can have the same effect with a static factory method `FileSystem& FileSystem::createFileSystem()` which returns a `PS3FileSystem` on PS3 and a `WiiFileSystem` on Wii.
Comment: Sorry, I didn't intend to imply that this *must* be a singleton. I just thought I'd chip it in as an example of a case that might fit your closing sentence, if one chose to implement it that way.
Comment: @DMGregory In my opinion that is an abuse of inheritance. You're going to be compiling your code separately for different platforms (because this is C++), so you should implement platform-specific logic in different files and choose which file to compile based on your build's target platform. It's unlikely that the code for a specific platform will compile on other platforms anyway.
Answer: The book Game Programming Patterns (which you can read free online) has a good overview of considerations for when to use / avoid singletons.
The cautionary advice boils down to:

A singleton is a global variable, with all the trouble that comes with it: (this also applies to static classes)

Increasing the complexity of reasoning about your code, because now any two pieces of code that touch this singleton can indirectly affect each other, no matter how disparately they're separated in your code base.
Encouraging coupling between two systems. You probably want the SpriteRenderer.RenderSprite() method called only by your main render loop. But by putting it in a singleton, it's accessible anywhere, making it easy for a junior programmer to shortcut the intended flow of rendering and, say, try to render an impact sprite in a collision handler - now your physics and rendering are coupled, even if you had a neat messaging system that could have avoided the coupling. (We have a habit of reaching for whatever tool seems most direct, and singletons are very direct!)
Opening up to concurrency problems. Many modern games are multi-threaded, and a singleton is accessible to every thread, without knowledge of what the other threads are doing with it. This makes it easy to introduce bugs, or increase your code complexity with additional locks and checks.

Singletons solve multiple problems (convenient access, enforced uniqueness, lazy instantiation), when maybe we only needed to solve one. The extra features we didn't need can trip us up later.

A common problem is to implement a singleton for convenient access early in a project when you only need one, so the uniqueness isn't a problem or a feature, just an inoffensive side-effect. If later you have a use case for multiple (eg. going from a single instance of Player to a multiplayer mode) then you have a lot of refactoring on your hands. (This is in line with Philipp & UnholySheep's advice: are you sure you never want more than one?)
Lazy instantiation means the heavy work of constructing an instance could happen at an inopportune time in your game (eg. if you spin up your stat reporting service the first time the player picks up a collectible, it could cause a hitch in gameplay). If you know you'll need exactly one of these at all times, it might as well be a static class (or namespace as Philipp points out) so you skip any added complexity of a singleton, and your code is explicit about what's happening.

Check the article for some alternatives that may get the functionality you need without the singleton baggage. Singletons aren't necessarily bad, but the case you describe doesn't sound like one that needs a singleton solution.


What is the climate like 200 years after nuclear war?

Question: I know there would probably be an ash-based cooling period, but, how long would that last and then what happens? Is the post-apocalyptic desert even possible in a post-nuclear war world?
Comment: How severe was the war?  Ash-based effects on Earth run from as "mild" as the eruption of Mount Tambora -- the Year Without A Summer -- to its being a major factor in the extinction of the dinosaurs.
Comment: It also depends on what kind of nuclear war it is.  You get most ash from the firestorms caused by nuking urban targets.  You get the least by nuking sparsely populated missile silos and military bases.  So do combatants do counter-force attacks or counter-value attacks?
Comment: Technically, WW2 was a nuclear war, because two nuclear weapons were dropped o the enemy. It depends on how many nuclear weapons are actually detonated. There is some concern that the American armed forced are so poorly maintained that half of the ICBM's would not be capable of being launched. Certainly many Russian nukes would fail before launch. It is estimated by some credible sources  that about half of the cruise missiles America WANTED to send against Syria never made it for various reasons.
Answer: We don't know.
There will be several factors which affect the climate in different ways. There is no empirical data on which will dominate.

How many weapons and where? Arsenals are much smaller than they were at the height of the Cold War, and we can assume that Moscow, Washington, and places like Minot AFB are still getting overkill.
Firestorms could blow ash into the higher atmosphere and cause a nuclear winter. That could be just a brief effect, a few years or a decade, or it could lead to increased snow/ice cover and increased albedo. That lowers the temperatures further, and a feedback loop occurs.
Or the firestorms could lead to deforestation in some fragile ecosystems, and runaway desertification.
It could also be that the death of many humans reduces deforestation, instead.
In addition to direct climate effects, killing people and economies will also matter, but 200 years could be enough to get people back on their feet and emitting greenhouse gases as before.

Imagine you have a bucket full of water, with a couple of holes in it that cause a steady loss of water. There is also a water pipe above with slow leaks, steadily refilling it. The water level in the bucket is mostly stable. That's our climate.
And then somebody gives the whole Rube Goldberg contraption a good shake. Nobody can predict if the water level will rise and drop after that. Only that the shake is a very bad idea ...
So, for your story/setting, select what you want and info-dump a bit of technobabble.

You want it cold? Nuclear winter killed the thermohaline circulation.
You want it hot? Firestorms killed the rainforests.
You want a mostly normal ecology with a few sick trees and animals? The northern hemisphere is like the  Chernobyl Exclusion Zone.


When does "e" at the end of a noun change it to a verb?

Question: I was wondering about adding an e at the end of a word to change it from a noun to a verb. For example, cloth to clothe, and breath to breathe. Is this some special rule, or a quirk to the English Language?
Comment: _Grief_ / _grieve_, _thief_ / _thieve_; also _mouth_ and _house_, where there is no change in spelling, and _sooth_ / _soothe_, where now the noun and the verb are quite separate, but originally they were another pair like this. @NickelMonster, it is not "adding an _e_", it is voicing the final (fricative) consonant.
Comment: There is no 'rule'. These are vestiges of a former former system of inflection that was lost over the history and prehistory of the English language. It is not a productive suffix, just a few random remnants here and there. You can't take a noun such as 'path' and create a verb 'pathe' from it, for example. It is only possible with a few monosyllabic nouns that end in /θ/ (cloth, breath, bath … can't think of any others off the top of my head), by turning it into an /ð/ instead.
Comment: Back when verbs had syllabic endings in all forms, the alternation arose quite regularly as fricatives were voiced intervocally, but devoiced word-finally. The vowel alternation seems to be partly from cases where the noun and the verb are built on different ablaut grades, and partly from the Great Vowel Shift wreaking havoc on the poor, unsuspecting English language and randomly lengthening and shortening vowels here and there. _Life/(a)live_ vs. _to live_ is a case of the former; _cloth_ vs. _clothe_ of the latter.
Comment: Another interesting example is _safe_ / _save_, as it is an adjective/verb pair (on the assumption that _safe_ as a noun is a comparatively recent invention).  Some more noun/verb pairs: _grass_ / _graze_, _glass_ / _glaze_.
Comment: @JanusBahsJacquet But you could make 'path' into 'pave'. Are they connected?
Comment: @WS2: No. _Path_ is Germanic, _pave_ is from French.
Comment: @ColinFine, good examples! The underlying principle is the same of course: the final consonant (fricative mostly, but there might be non-fricative examples, too?) is voiced when the noun is verbed.
Comment: @JanusBahsJacquet: I can't think of any examples with stop-consonant final, and other continuants don't have voicing distinctions in English. There are examples where the vowel changes: the OP gave _cloth_, and there is also _bath_ / _bathe_ and (the other way round) _life_ / _live_.
Comment: And: _sheath_ / _sheathe_, _calf_ / _calve_, _tooth_ / _teethe_ (still retaining old ablaut), _proof_ / _prove_, _strife_ / _strive_ (with some meaning drift).
Comment: Related: ["to bath" vs "to bathe"](http://english.stackexchange.com/questions/206047)
Answer: (The key elements of the answer to this question are given in the comments following it.  This answer ties them together and adds some more detail.)
If you look at a fuller range of examples—

calf, calve; grief, grieve; half, halve; life, live; proof, prove; safe, save; serf, serve; strife, strive (with some meaning drift); thief, thieve;
advice, advise; clo[s]e, clo[z]e; glass, glaze; grass, graze; hou[s]e, hou[z]e; u[s]e, u[z]e;
bath, bathe; breath, breathe; cloth, clothe; mouth[θ], mouth[ð]; sheath, sheathe; tooth, teethe (still retaining old ablaut);  wreath, wreathe;

—then you notice several key points:

All examples end in -f, -[s], -th, not in any other consonants.
These consonants are always preceded by vowels, or, more rarely, by liquids (half, halve; serf, serve).
The voiced (-[v], -[z], -[ð]) counterparts are always found in verbs (whereas the unvoiced counterparts can be either nouns or adjectives, like close and safe).

The voicing alternation (like the vowel alternation of tooth, teeth(e)) is fossilized phonology of Anglo-Saxon.  Robert Diamond's grammar of the language gives part of the processes, clearly identifying the Anglo-Saxon fricatives (f, s, þ) as voicing between vowels:

He does not say (though from memory Henry Sweet does) that these sounds also voice in the context vowel-l/r-...-vowel.
Verb formation from nouns and adjectives created the intervocalic context in Anglo-Saxon, because the verbal suffixes were nearly all verb initial (e.g., infinitival -(i)an, first singular present -e, third plural present -on).  (Moreover, the past tense -d- also created a context for voicing, as per Diamond's cited passage.)
Together, these explain the three generalizations governing examples like the ones that the questioner gave:

As Diamond's discussion implies, these are the only three sounds of Anglo-Saxon that voice intervocalically, -f, -s, -th, which is why all examples end in orthographic variants of these consonants.  (E.g., there's no pinch, pinge.)
The rule of voicing operated only in special circumstances (e.g., vowel-...-vowel, vowel-l/r-...-vowel).  (E.g., there's no rinse, rin[z]e.)
Voicing occurs in verbs as, in Anglo-Saxon, verb formation triggered voicing owing to the shape of the suffixes. (Nouns and adjectives could occur without suffixes.)

Time has gnawed away at the rich morphology of Anglo-Saxon, so that the verb endings are now gone.  Nonetheless, their effect is still felt in a few examples that speakers simply have to memorize.
Comment: +1! A very good and thorough answer. One thing to note is that the voicing described here is similar to, but different from, the voicing that came about as a result of [Vernerian alternation](http://en.m.wikipedia.org/wiki/Verner's_law) in an earlier stage of the language. The result of Vernerian [s] > [z] show up in Old English as an s/r alternation, since inherited [z] became [r] in West Germanic. In the other cases, though, the results would be the same and quite hard to tell apart.


Can I swap the lock out on one suspension fork for the remote lock out on another?

Question: Both forks are rockshox. One has lock out, the other has remote lock out. Can I swap them around, and is it easy or are any special tools needed?
Answer: Yes, assuming they are both remote capable. Rockshox uses the same lockout on all the models I have seen. Should be no issue and will only take a small allen wrench. You will likely need to remove the grips, brake lever and shifter from your left handlebar.
IF the new fork is not capable you may need a remote lockout top cap, which is a bigger question.
Comment: Rockshox now offer a number of different systems.
Answer: Rockshox have three different damper compression systems and remote kits. It is possible that if you have a compatible kit you could transfer it. You have to swap the standard motion control compression damper for a remote motion control compression damper. This wouldn't require any special tools but would require a reasonable level of ability. It may also involve topping up specialised suspension oil if any is lost.
The systems are PushLoc, PopLoc and XLoc.

PushLoc for Revelation, Reba, and SID with Motion Control DNA
PopLoc for Tora XC, Recon Silver, Recon XC, Recon Gold and Sektor
XLoc for Revelation, 2012 SID WC, Reba, SID 120


Seriousness values on OpenFDA

Question: In looking at OpenFDA, I'd like to know the range of values for results.seriousnessother, results.seriousnesshospitalization, results.serious, and results.primarysource.qualification, as well as what they mean.
Comment: I think you need to add more context to this question so we can help to answer it.
Comment: David, what data are you talking about?
Comment: I've flagged this for Sean Herron, who works on the OpenFDA team.
Answer: If you take a look at our API documentation (http://open.fda.gov/drug/event/reference/), you'll see a complete reference for every field we return and the range of possible values. We follow the E2b specification for adverse drug reporting (http://www.fda.gov/downloads/Drugs/GuidanceComplianceRegulatoryInformation/Surveillance/AdverseDrugEffects/UCM350390.pdf).
For the specific examples you provided, here's what our documentation reads:
seriousnesshospitalization

This value is 1 if the adverse event resulted in a hospitalization,
  and absent otherwise.

serious:

1 = The adverse event resulted in death, a life threatening condition,
  hospitalization, disability, congenital anomali, or other serious
  condition.
2 = The adverse event did not result in any of the above.

primarysource.qualification:

An encoded value for the category of individual submitting the report.
1 = Physician
2 = Pharmacist
3 = Other Health Professional
4 = Lawyer
5 = Consumer or non-health professional
Answer: If you use our search tool you can find a graph (last one of 5) that tabulates the  results.primarysource.qualification into a bar graph for your search query. http://openfda.socialhealthinsights.com/
Answer: You might want to check out http://www.fda.gov/downloads/Drugs/GuidanceComplianceRegulatoryInformation/Surveillance/AdverseDrugEffects/UCM350390.pdf for more information on the data in these reports.

Seriousness values on OpenFDA


What is the correct form to address my "teacher"

Question: How can I call a person who teaches me English, because I always called him teacher, and yesterday my sister said me that it is incorrect, that I have to called him Mr. + last name. Is that true? Can you explain me, please? I am a English student from Argentina and normally we called them "teacher".
Comment: Welcome to ELL! Please, don't write your title in capital letters only. It is harder to read and people might interpret it as 'shouting'.
Comment: Is this classroom or individual instruction? And what is the level of formality that the teacher would expect?
Comment: BTW "my sister *told* me that it is incorrect". You can search other posts on ELL to get a better idea about *say* vs. *tell*.
Comment: Read this and see if it answers your question: http://ell.stackexchange.com/questions/77505/teacher-as-a-way-of-addressing
Answer: In an English school the students would normally address their teachers as your sister suggests:

Mr Jones
Miss Jones
Mrs Jones

or if they have a doctorate

Dr Jones

If you are being taught on a one-to-one basis then initially you could use those forms of address as a mark of respect. It is possible that the teacher may suggest to use their first name - my wife is a tutor and she tells her pupils to use her first name.
In the UK we rarely use the persons role as a form of address, so we would not say

Teacher

or

Master

However, some formal schools do use the titles of certain positions

Yes, Headmaster
Thank you Matron

This is not common in today's schools.
Comment: Just adding some caveats about America. Rarely, if ever, do we call women Miss X – if they're unmarried or retain their last name from before marriage we use "Ms." (said /mɪz/). In the formal schools I know of we usually call people Mr./Ms./Mrs./Dr. X regardless of how old and prestigious the school is.
Answer: In some schools teachers are called "Mr ..." or "Mrs ....", using only their title and surname. (Other titles such as Dr, Miss, Ms are common. The teacher would tell their class what they expect to be called.)
In other schools, teachers are called "Sir", "Ma'am" (pronounced "mahm") or "Miss". Whether names are used is part of the culture and ethos of the school Similarly whether female teacher are called Miss or Ma'am varies from school to school. Larger schools, are more likely to use "Sir". Since the pupils won't know the names of all the teachers. Use of "Sir" is therefore more common in city schools than in smaller rural ones.
A few schools, such as those following Steiner system of education, use first names.


How to determine which thread implementation binary compiled with

Question: Is it possible to determine if a binary  (static or shared and not stripped) is compiled with Linuxthreads or NPTL implementation ?
Comment: Sorry for the half published message ... I don't know what happened but the rest of it was cut and I noticed it later ...
Answer: There are many ways, but I'll cite two. Usually, a binary file, if not stripped,  contains symbols (function names, variable names, ...). These symbols are usually used to ease debugging and are stored using a certain format, DWARF for example.
The first method is to disassemble the binary and look for specific threading libraries related symbols. For example :
<code>    objdump -D ./YOUR_PROGRAM | grep -i thread
</code>
The second one is to hijack the threading library function calls using your own library and LD_PRELOAD. The concept is fairly simple, you write a library (.so) in which you implement the functions which you want to check for, let's say pthread_create or pthread_join, and reimplement it this way :
<code>    int pthread_create(pthread_t *thread,
                       const pthread_attr_t *attr,
                       void *(*start_routine) (void *),
                       void *arg)
    {
          int ret;
          static void *(*ext_pthread_create)(pthread *,
                                             const pthread_attr_t *,
                                             void *,
                                             void *);

          ext_pthread_create = dlsym("RTLD_NEXT", pthread_create);
          ret = ext_pthread_create(thread, attr, start_routine, arg);

          printf("pthread_create called !\n");

          return ret;
     }
</code>
All you have to do after compiling and testing your library is call yor program this way :
<code>    LD_PRELOAD=hooklib.so ./YOUR_PROGRAM PARAMS
</code>
If the function is called, you'll see the printf message on the standard output.
Comment: If I cannot execute the binary since it is different architecture objdump -D ./YOUR_PROGRAM | grep -i thread  is the only way ? What can I expect as output depending on implementation used ?
Comment: Yes, the `objdump` way will work ... but it's not very classy though. One, it necessitates a non stripped binary, and two you need to check for all threading library symbols (Pthread, OpenMP, Boost, ...). I believe the hook mechanism is much classier, but of course it requires a lot more code and the ability to run he binary (which can be done either by using a virtual machine, an emulator, ...). Honestly, most of the ways I have in mind need the binary to be run. The only static approach I can think of now is the `grep` one.
Comment: So what strings to look for to find out implementation? I tried one unstripped file and got lots of things with pthread which does not indicate neccesarily anything ?
Comment: Well, you should look for function names that create threads : `pthread_create` & `pthread_join` if it's the Pthread library. If `grep` finds something, well, you hit the jackpot. If grep outputs nothing, then there's no Pthreads calls.
Note : you should research the other threading libraries in case & also test the `clone()` syscall.
Comment: You might have misunderstood my question maybe. I was not asking to determine if software is written with threading . But determine which thread implementation. Linuxthreads or NPTL which are similar but different things.
Comment: No, I understood your question ... This is why I added the "Note". In your case all you'll have to do is grep the symbols/function names from those two libraries.


Children's short story about kid with reshapeable face

Question: I'm looking for a short children's story (or maybe an excerpt of a story) about a kid who realizes his (her?) face is suddenly shapeable like plastic or wax.  That's all I've got.  I remember reading it when I was maybe 9 or 10, back in the very late 70's, early 80's.
Comment: At least I now know that I didn't just make this story up in my own head!  Thanks for the reply - let me know if you ever come across it!
Comment: I remember that story. It may have been in Reader's Digest or Highlights. A boy went home from school, discovered his face was mold-able, could not make himself look like he used to. When he went to school the next day, he found that all of his schoolmates had the same ability. I wish I could give you the title but it was so long ago.
Comment: I stumbled across this today when it randomly popped into my head. I remember the book was a collection of short stories and the cover was a picture of a gnarled old tree. The story of the tree had to do with a witch or something. I'll keep looking.
Answer: I found it!  Actually, someone on another site found it. But here it is:  a story called "The Plastic Age" in an anthology called Adrift in Space and Other Stories published in 1974. An excerpt mentioned on Goodreads hints at his ability to mold his face:

When he awoke, Paul was unaware of the change that had come over him. He was a little groggier than usual, but otherwise, he felt fine. It was only as he began to dress that Paul noticed the change. His skin. Somehow, it was different. It felt smooth and pliable— like the plastic toys that lay scattered about the room.

Thanks to all who helped along the way!
Comment: Please, accept your own answer, ideally adding the matching details.


Properties of Frechet distance

Question: There is an old construction, apparently due to Frechet's PhD thesis (which is unfortunately written in French and in ancient notation), which turns the set of curves in a metric space modulo reparametrizations into a metric space itself.  The idea is that if $f$ and $g$ are curves in a metric space $X$ (meaning continuous maps from $[0,1]$ to $X$), then their distance is defined as
$$d(f,g)\equiv \mathrm{Inf}_{\phi,\psi}\mathrm{Sup}_{t\in [0,1]} d(f(\phi(t)),g(\psi(t))),$$
where $\phi$ and $\psi$ are orientation-preserving homeomorphisms from $[0,1]$ to itself.
 Most of the properties of a distance follow trivially from the definition, but I am having some trouble showing that $d(f,g)=0$ implies that $f$ and $g$ differ only by a homeomorphism.  Potentially we could merely have a sequence $(\phi_n,\psi_n)$ of homeomorphisms for which the the supremum converged to zero, but which did not converge to a pair of homeomorphisms $(\phi,\psi)$ for which it vanishes.  Why must the infimum be realized?  I believe it should be possible to show this using some kind of uniform convergence, and also possibly the compactness of $[0,1]$, but haven't succeeded.  For my own purposes I am especially interested in whether or not it is necessary to use the compactness of $[0,1]$ (I am trying to understand to what extent $[0,1]$ can be generalized to an arbitrary topological space in this definition).
Comment: I think, this is similar to what you are asking: https://mathoverflow.net/questions/260981/space-of-curves
Answer: In fact it is not true in this generality: the simple counterexample, inspired by a famous Aesop's fable, is: $X=\mathbb{R}$, $f(x)=x$, and $g(x)=\max(0, 2x-1)$ for $x\in I:=[0,1]$. The Fréchet distance is clearly zero: for $0<\epsilon< 1$ the homeomorphism  $ \phi_\epsilon :I\ni x \mapsto \max(\epsilon x, 2x-1)\in I$ gives
$\|f\circ \phi_\epsilon-g\|_\infty<\epsilon$. But of course for any  homeomorphism  $\phi$  from $I$ to itself  we have $f\circ\phi=\phi\neq g$, as the former is injective and the latter is not.
$$*$$
On the positive side, note that if for continuous $f$ and $g$ from $I$ to $X$ one has $f(I)\neq g(I)$, that is w.l.o.g. $f(t_0)\notin g(I)$ for some $t_0\in I$   , then for any homeomorphism $\phi:I\to I$, $d_\infty(f,g\circ\phi)\ge \min_{t\in I} d_X(f(t_0), g(t))>0$, so that the Fréchet distance $\tilde d(f,g)$ is non-zero.
Therefore, if $f$ and $g$ are  injective  and have zero Fréchet distance, then they are both homeomorphisms with the compact $f(I)=g(I)$  so $\phi:=f^{-1}\circ g$ is a homeomorphism $I\to I$ such that $g=f\circ\phi$.
(rmk: At this point one also sees that $\phi:I\to I$ is increasing, because a decreasing homeomorphism would always give a positive Fréchet distance between $f$ and $f\circ\phi$, for any non-constant curve $f$).
(Nothing changes if we replace $I$ with a compact space $K$, where in the definition of the analogous Fréchet distance the quotient is over all  homeomorphisms $K\to K$.)
Comment: I would like to advertise my old question again: there the distance between curves is defined in a slightly different way, it identifies more than just homeomorphic reparametrizations, and so the maps from your example define the same curve in that sense, but there still can be different curves with the same images.
Comment: Thanks for the answer and comments. In your most recent comment Pietro I believe you mean "surjective" instead of "bijective"? I need to think about how this distinction plays out for general compact K, at the moment I don't see a natural generalization of "continuous  non-decreasing surjection".
Comment: Yes, in the other question non-decreasing continuous bijective reparametrizations are allowed for the equivalence (but I focused on this question  only).
Comment: Yes sorry, indeed, I meant "surjective"
Comment: It seems that for general compact $K$ there isn't much to say for the "non-decreasing" version, but if $K$ is a compact metric space then perhaps an analogue of the continuous non-decreasing surjections is the closure of the set of homeomorphisms from $K$ to $K$ within the set of continuous maps from $K$ to $K$ in the uniform topology.
Comment: Incidentally it is surprising to me that the proof given in erz's answer to the other question is not 1) simpler and 2) easier to find - the Frechet distance seems to be a fairly standard topic in computer science, and is also important in general relativity (which is where I want to use it).  For example shouldn't some version of this proof go into the wikipedia page for Frechet distance?

Properties of Frechet distance


What happens to a spring holding two electric charges?

Question: Let's imagine a stretched spring with a negative Q charge at each end.
At equilibrium, the repulsive electrostatic force and the force exerted by the spring on the charges cancel each other. If we increase or decrease one of the charges, the length L of the spring will change, and this will make a bell ring. Now I suddenly run in a direction perpendicular to the spring. In my reference frame, a tiny attractive magnetic force will appear. The spring will shorten and the bell will ring. Is this correct ?
I know similar questions on the relativistic effect etc. have been posted, and I have read many, but it seems to me none answers my question.
Answer: The general rule is that whenever you change reference frames, $\textit{both}$ electric and magnetic fields transform exactly the way to prevent the paradoxes of the type you have described.
Comment: OK so does this mean that the force the charges exert on each other remains the same (= to the force exerted by the spring ) ? Which means that the electrostatic force increases by an amount equal to the magnetic force ?


Can I use grease pencil Object line art to do science schematics?

Question: I'd like to replicate the figure below with two cylinders and some rease pencil objects line art. Is there a simple way to do this?

Here is what I have done so far (I'd rather disable the shadows inside the cylinders):

and my blend file  if you wish to experiment with my setup.
Answer: I have one way for you to do this. Although, whether it is simple or not is up for interpretation.
First, let's identify what you want to create. A schematic or scientific schematic is basically known as a Technical Drawing. Rather than being visually illustrative, Technical Drawings are meant to be "constructively informative." That means viewers who "read" these drawings can build, assemble, or model whatever these drawings illustrate. Your schematic has two elements that you want to illustrate, a solid line and a dashed line that is better known as the Hidden Line within this field.
Because Technical Drawings are always drawn orthogonally, our first step is to make sure our drawing renders orthogonally as well. So, set the camera in your scene to Orthographic view from within the properties tab.

In your blend file, you added two separate grease pencil objects to create your line art. I only needed one grease pencil object with one material to hold your modifiers. For organizational purposes, I created two layers within this grease pencil object for you to handle the line art and the dashed line art.

Since your cylinders are generated through Geometry Nodes, I also consolidated your node trees into one single node tree for both of your meshes.

The Hidden Line is nothing more than an inferred line consisting of many smaller lines. To construct this dashed line with a grease pencil stroke, we need a lot of evenly spaced vertices built into this Hidden Line, so that our modifiers can generate these smaller lines. A quick fix was to increase your cylinder topology by segmenting them horizontally as many times as you segmented them vertically.
The first modifier we will add will be the Line Art modifier for these smaller lines. Since these lines are hidden from view, we need to select these non-visible lines by going into the Occlusion parameter of the Line Art modifier. Since there are actually two sets of faces obscuring the camera view, we will change the Occlusion Level Start to 1 and End to 2. 1 is for the first set of occluded lines and 2 is for the second set of occluded lines. Make sure the grease pencil object is set to In Front or the Occlusion parameter will not be available.
The next modifier to add will be the Dot Dashed modifier. This modifier will convert our Hidden Line into a proper dashed line. I made sure this modifier would only affect our Hidden Line by including the layer the dashed lines are contained in. The final modifier will be another Line Art modifier for the solid lines. For this second Line Art modifier, I selected Use Cache so that all the line art would be baked together.

Finally, to get rid of your shadows and meshes, I created a simple Transparent shader material. I made sure to link this material to Object so that I wouldn't have to add it into your node tree. To render in all modes, I "disabled" Blend Mode and switched Alphas for all Colors to 0.000

Hit Render and your schematic should be generated.

Blender 4.0.2
Comment: That's really nice ! (+1) Many thanks.
Comment: Happy to help. Now that I have another chance to look at this answer, I believe that we could have used just 1 mesh instead of 2 to make this diagram. All the line work was created from the modifiers anyway.
Comment: Hopefully, when geonodes works with grease pencils, that kind of tasks will be easier.


What are the limits on where a cricket batsman can stand in front of the stumps?

Question: Is there a cricket rule which states a maximum distance of how far down the pitch a batsman can stand to face the bowler?
Answer: There is no Law which specifies this, with the possible exception of anything to do with obstructing the field; the Laws of Cricket are in fact remarkably vague on what the striker may and may not do - it's self regulating by the fact that doing anything "strange" (e.g. standing half way down the pitch) will generally result in the batsman getting out very quickly.
Answer: There's no specific limit, but there is a protected area which starts five feet in front of the popping crease, and batsmen are prohibited from damaging this area. This is covered under Law 42(14).
Note, though, that this doesn't prevent a batsman from taking guard within the protected area, but he's going to have to be very very careful not to damage the pitch, and in most cases the umpire will intervene early. Usually just a quiet chat, pointing out spike or guard marks, and asking that he stays outside that area. That would generally suffice - I've never seen Law 42 invoked to punish a batsman taking guard too far forward. Running on the protected area, yes - many times!
Comment: Bowlers also cannot run on the pitch, they get warned
Comment: That is (almost) correct, but not relevant to the question of a potential limitation of where a batsman takes his guard.

Note that bowlers contravene Law 42 if they run on the protected area (not the pitch itself, note, the protected area is the small strip up the middle) regardless of whether they damage it. In practice, the umpire will apply common sense and warn the bowler that he's risking punishment.


Need to reorganize pictures in folders named by date

Question: Does someone know of any software/technique to reorganize image files in folders named by date?
Comment: Which operating system are you talking about?
Answer: Recently I had a similar need.
Specifically I wanted to move and rename files based on date the picture was taken, as follows:
E:\Pictures\DSC_001.jpg to E:\Pictures\2009\2009-04-23\2009-04-23-14h56m28.jpg
E:\Pictures\DSC_002.jpg to E:\Pictures\2009\2009-04-23\2009-04-23-15h32m14.jpg
E:\Pictures\DSC_003.jpg to E:\Pictures\2010\2010-02-22\2020-02-22-14h56m28.jpg
The motives for me for this structure:

I had 6000 files in the E:\Pictures folder. Even though I had used Namexif to rename all of them into YYYY-MM-DD-HHhMMmSS.jpg format, I would have still had 800+ subfolders under Pictures, had I not used year folders.
Had I used 2009/12/31/2009-12-31-23h59m59s.jpg format, it would have been tedious to surf around folders (on some months I have taken pictures only on few days)
The 2009-12/2009-12-31-23h59m59s.jpg format would have still produced too many subfolders to E:\Pictures folder and also to 2009-12 and other more popular months (all the many pictures taken on 24th and 31th of Dec would all be listed directly under 2009-12 folder).

YMMV.
After spending an hour trying out various graphical UI based programs, eventually what got the job done exactly how I needed, was ExifTool.
Here are the steps:

Download ExifTool.
Install it:

If you're on Windows, you should:

unzip the zip file,
rename exiftool(-k).exe to exiftool.exe
move exiftool to some folder in your PATH (I use C:\Windows folder) so that it is usable in every folder you're currently in (I use C:\Windows).

If you're on Mac, just install the app.

Open your terminal:

In Windows, press WinR and type cmdEnter,
On Mac, press cmdspace and type term↩

Navigate to the folder where your pictures are. On Mac you would type something like cd /Volumes/MyUSBDrive/Pictures. In Windows you would type E:Entercd Pictures.
Use your own folder path here, of course.
Now launch exiftool and let it do its job:
     exiftool -d %Y/%Y-%m-%d/%Y-%m-%d-%Hh%Mm%S.%%e "-filename<datetimeoriginal" . (the dot at the end refers to current directory)

Basically you're telling exiftool to read date taken (datetimeoriginal) information from within the picture file and use that information to rename the file, using YYYY/YYYY-mm-dd/YYYY-mm-dd-HHhMMmSS.ext format. Notice that there are slashes in the file format we specify -- this causes the file to be moved into respective folder structure, which is created on the fly.
You can move and/or rename files any way you like with this utility. If your requirements differ from mine, just refer to this page which contain nice examples from where I derived the command line I eventually used.
Comment: Note, for M4V videos I needed to use "-filename<creationdate" in the command above.
Answer: Came across this question searching for a solution to the exact same issue.
I found two programs to accomplish this:

Photo Move 2

There is a free version and a paid version. The free version only allows for a Year/Month/Day folder structure. The paid version allows for more folder options and some additional file types and handling options.

Photos2Folders

This is a free utility to move or copy photos from one folder structure to another. A few less options than the paid version of Photo Move but it does allow to specify up to 4 levels of folder structure.
Answer: You can use ReNamer with some rules.
Comment: You can also use AdvancedRenamer which has better support for ExifTool https://www.advancedrenamer.com/user_guide/exiftool
Answer: I know that Zoner Photo Studio should be able to do that, but I've never tried that. It supports a library mode and it can help you organize photos – it can move pictures taken the same day to individual folders.
Is this what you need?

source: Zoner: organize your photo collection
Answer: Open Windows Explorer > Go to Folder Containing Sub-Folders with pictures in it.
CAVEAT: Assuming your folders are labeled with different dates (and hence time).
Go To > VIEW > DETAILS > RIGHT CLICK ON NAME COLUMN ON THE RIGHT PANEL > SCROLL DOWN to "More" > DATE CREATED
Then sort by folder's date created.
Answer: You can also use DropIt to move your images and videos to specific folders based on the EXIF data. I like DropIt because I can preview what gets moved before I commit to the move.
https://dropitblog.wordpress.com/2012/07/31/how-to-sort-files-into-folders/


want user will logout from shell on exit of bash script

Question: I want, when a linux user exits from a shell script, that it  also logs out from the bash shell.
Is this possible?
Answer: Instead of starting the script normally, exec it instead. This will replace the login shell, so when the script finishes the user will be logged out.
Answer: End your script with kill -HUP $PPID
$PPID is the process ID of the parent process.
Comment: `$PPID` might fail if the script is run from a subshell, e.g. bash login shell → another bash shell → this script. Also why `-9` and not `-HUP`?
Comment: kill -9 closes all processes it can without letting them close their file descriptors, freeing their memory, etc... I don't think it's a good idea if the script does any I/O.
Comment: Yes, you are right. Feeling a little bit destructive today ;)
Answer: Depending on what you are trying to accomplish, you could use the script name instead of the shell in /etc/passwd.
The last entry in /etc/passwd (everything after the last colon) is the shell that is run when the user logs on.  By changing this to the name of your script, when the script ends, then by definition, so does the shell.
** Be very careful editing /etc/passwd however, as you could lock yourself out of your machine.  Apparently you can do this with
usermod --shell


How to calculate Earth's velocity vector in ECEF?

Question: I would like to write some AR mobile app that will show Earth velocity vector, but I have no any experience with astrodynamics. So how to calculate Earth's velocity vector in ECEF, having date and time as input data?
Comment: Actually, because the reference frame is Earth-fixed the center of the reference frame is the Earth itself, meaning it's not moving or rotating in the ECEF reference frame.  In ECEF the sun is moving relative to Earth and the center of Earth is always (0, 0, 0)
Comment: Two questions: velocity relative to what?  And how accurate do you need/want to be?
Comment: Yes, ECEF mean Earth Centred, Earth Fixed. And, yes Earth is not moving relative to itself, but Earth velocity vector is moving in that reference frame, because of Earth's rotation and because of Earth is flying around Sun. And I'd like to know how to calculate that vector in ECEF.
Comment: Velocity relative to Sun. Great precision is not required. And I don't need actual magnitude of velocity vector, only direction.
Comment: Do you mean how fast the Earth is revolving around the Sun?
Comment: I don't want to know how fast does Earth moving around Sun, I want to find direction of that moving in ECEF.
Comment: Does ECEF mean Earth Centred, Earth Fixed? If so, the Earth is not moving relative to itself... it does move at approximately 90 degrees to the sun though as it describes (almost) a circle around the sun. Is that what you need?
Comment: Vector of velocity of Earth relative to Sun can be build in ECEF and I think it will be rotating but I don't know how exctly. So this is the point of question.
Answer: To convert my comment into an answer now that I'm back to my desk:  The origin of the ECEF reference frame is the center of the earth, and the X axis goes through the center of the earth and the point on the surface at lat/lon 0/0.  Therefore, by definition the earth neither moves nor rotates in the ECEF coordinate space.
To try to provide what you're looking for, I'll offer the JPL Horizons interface.  Specify ephemeris type "VECTORS", target body "Sun [Sol] [10]", coordinate origin set to your current lat/lon location, and a time span starting at the current time with a step size in minutes.  That should give you a table of vector positions of the sun relative to your current location.  Take the delta between positions (or possibly just use a velocity vector instead of multiple position vectors) and reverse it and you should get your velocity vector relative to the sun.
Obviously this doesn't give you the math to do the calculations yourself, but it should give you the answers and maybe someone else can chime in with the math.


$1-\frac{1}{5\cdot 3^2}-\frac{1}{7\cdot 3^3}+\frac{1}{11\cdot 3^5}+\frac{1}{13\cdot 3^6}--++\cdots.$

Question: I want to evaluate the series
$$1-\frac{1}{5\cdot 3^2}-\frac{1}{7\cdot 3^3}+\frac{1}{11\cdot 3^5}+\frac{1}{13\cdot 3^6}--++\cdots.$$
I can rewrite this as
$$1+\sum_{n\geq 1} (-3)^{-3n}\left(\frac{3}{6n-1}+\frac{1}{6n+1}\right)$$
The answer should be $\frac{\ln7}{2}$. Although I can't see explicitly, since I get a log function, maybe it can be solved by differentiating some test function $f(x)$ and then substituting an appropriate number.
Comment: I can confirm that this series adds to $\ln 7/2$ based on numerical calculations.
Answer: For context and inspiration, let's remember that the linear factors in the power series for $\log(1+x)$ come from integrating a geometric series:
$$
\log(1+x) = \int_0^x \frac1{1+t}\,dt = \int_0^x \sum_{n=0}^\infty (-1)^n t^n \,dt = \sum_{n=0}^\infty (-1)^n \frac{t^{n+1}}{n+1}.
$$
So if we recognize our series as a special value of a power series, which turns out to be
$$
f(x) = 1-\sqrt3\biggl( \frac{x^5}5 + \frac{x^7}7 - \frac{x^{11}}{11} - \frac{x^{13}}{13} + \frac{x^{17}}{17} + \frac{x^{19}}{19} - \frac{x^{23}}{23} - \frac{x^{25}}{25} + \cdots \biggr)
$$
evaluated at $x=\frac1{\sqrt3}$, then we can work out what that power series is by writing it as an integral of a rational function:
\begin{align*}
f(x) &= 1 - \sqrt3 \int_0^x ( x^4 + x^6 - x^{10} - x^{12} + x^{16} + x^{18} - x^{22} - x^{24} + \cdots )\,dt \\
&= 1 - \sqrt3 \int_0^x (t^4+t^6)(1-t^6+t^{12}-t^{18}+\cdots)\,dt \\
&= 1 - \sqrt3 \int_0^x \frac{t^4+t^6}{1+t^6} \,dt = 1 - \sqrt3 \int_0^x \frac{t^4}{t^4-t^2+1} \,dt.
\end{align*}
Using partial fractions (well, telling my computer to use partial fractions), we obtain
\begin{align*}
f(x) &= 1 - \int_0^x \biggl( \sqrt3 + \frac{t-\sqrt3/2}{t^2-t\sqrt3+1} - \frac{t+\sqrt3/2}{t^2+t\sqrt3+1} \biggr) \,dt \\
&= 1 - x\sqrt3 - \frac{\log (x^2-x\sqrt3+1)}2 + \frac{\log (x^2+x\sqrt3+1)}2,
\end{align*}
and therefore the series we want is
\begin{align*}
f\biggl( \frac1{\sqrt3} \biggr) &= 1 - 1 - \frac{\log (1/3)}2 + \frac{\log (7/3)}2 = \frac{\log7}2
\end{align*}
as predicted.
Comment: Let aside I used both of the answers, I am thankful that you drew the motivation. (At any rate, because the calculation was easier, I chose the first answer. It was difficult for me to choose between easier computation and motivation.)
Comment: Yes, I realized later that it probably would make the calculation details easier if I had put some factors of 3 in my defining functions ... Rene Schipperus proved that correct :)
Answer: Consider the series,
$$x-\frac{x^5}{5\cdot 3^2}-\frac{x^7}{7\cdot 3^3}+\frac{x^{11}}{11\cdot 3^5}+\frac{x^{13}}{13\cdot 3^6}--++\cdots.$$
Differentiate this and get
$$1-\frac{x^4}{ 3^2}-\frac{x^6}{ 3^3}+\frac{x^{10}}{ 3^5}+\frac{x^{12}}{3^6}--++\cdots.$$
This is a geometric series, and sums to
$$3\frac{9-x^4}{27+x^6}$$
Integrating,
$$\int 3\frac{9-x^4}{27+x^6}dx=\frac{1}{2}(\ln(x^2+3x+3)-
\ln(x^2-3x+3))+C$$
Note that $C=0$ by letting $x=0$
Therefore
$$x-\frac{x^5}{5\cdot 3^2}-\frac{x^7}{7\cdot 3^3}+\frac{x^{11}}{11\cdot 3^5}+\frac{x^{13}}{13\cdot 3^6}--++\cdots.$$
$$=\frac{1}{2}(\ln(x^2+3x+3)-
\ln(x^2-3x+3))$$
Setting $x=1$ we get $\frac{1}{2}\ln 7$.


Do double-enchantments not work in 1.0?

Question: In 1.9pre, you could enchant items multiple times, but in MC 1.0.0, nothing even comes up when I put an enchanted item on an enchantment table. Has this been removed? Is it a bug? I am in SMP, if that's important.
Answer: Items could never be enchanted multiple times.
It was (and still is!), however, possible to get multiple enchantments at once (as long as you spend enough levels).
Comment: Perhaps you could make it more clear how to get multiple enchantments at once?
Comment: @Arkive The only way to get multiple enchatments is to spend enough levels at once. There are a couple of random factors that play into this, so there's not much more I can suggest other than, "always enchant with all the levels you have".

Do double-enchantments not work in 1.0?


ArcMap layout graphics

Question: When I try to copy graphics and text between .mxd documents, size of the elements (width, height, font size) change randomly. Anyone know how to transfer LayoutElements between .mxd without any distruptions?
Comment: Use ArcMap Templates (.mxt) should preserve graphics http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s90000002w000000.htm
Answer: Use the "Zoom Whole Page" button in layout view on both map documents before you copy / paste.

This will make all elements in the .mxd the same size.  By default when you paste elements into another map document they should be in the same exact position as they are in the original mxd.
Answer: mxt were only until 9.3. You can still use them in 10, but you can also just change the layout to any other mxd, it doesn't have to be a specific template file.
However, do not bother playing around with your legend or any other elements until you change your layout - as these elements will all go back to the defaults.
Answer: To copy/paste graphics between .mxd documents you need to set the layout zoomfactor and page size to the same values in both .mxd documents.
When using the same page size in both documents the answer of Roy to use the "Zoom Whole Page" button in layout view on both map documents before you copy/paste is perfectly valid. I found no good work-around for copying graphics between different page sizes other than setting both layouts to the same page size, than copy/paste the graphics and than setting back the page size.

ArcMap layout graphics


Food to bring to work and heat with a microwave

Question: As I'll be soon moving from a small town in which I can come back home for lunch everyday to a bigger city in which it would be best to bring lunch from home to work, I was wondering: do you know some good recipes that are easy to transport and also are microwave-able or reheatable?
Answer: Pretty much everything.
Pasta and Rice dishes are the easiest to bring to work
Vegetable dishes can also be fun (either cooked or raw (salads)
Cooked chicken is also very easy to prepare in advance and can be eaten cold or hot; other meat.
Fish/seafood is maybe an exception, I tend to prepare and under cook a portion the night before to finish cooking the the office microwave.
If you have a fridge at the office it make things easier (and safer); and if allowed, you can keep things like condiments, sauces for a few days.
Answer: Do you have a fridge at work? I like to bring the leftovers from my last supper. I bring curry sometimes and it's pretty good. That is if you have a fridge or I think ice packs could work if you don't have a fridge at work.
Comment: I don't, but ice packs could do the trick indeed!


Is there a SQL Server Profiler for SQL Server Express?

Question: Is there a SQL Server Profiler for SQL Server Expess? Maybe an open-source one? Or maybe just a tool that helps me see what query is passed to the database?
Comment: See also http://dba.stackexchange.com/questions/28213/download-sql-server-profiler-for-sql-server-management-studio
Comment: Now is thread closed, but one another link to working piece of software is here: https://expressprofiler.codeplex.com/
Comment: You can use MS SQL Profiler against SQL Express, so download an evaluation version of SQL Server full edition or buy the $50 SQL Server Developer Edition. Otherwise you can use the `sp_trace_*` procedures directly https://msdn.microsoft.com/en-us/library/ms187346.aspx
Answer: SP1 of SQL Server Express 2012 Advanced Services now includes the full SQL Management Studio, and this has the profiler.
Comment: It can be downloaded here
`Microsoft® SQL Server® 2012 Service Pack 1 (SP1) Express` https://www.microsoft.com/en-my/download/confirmation.aspx?id=35579
Answer: Ok, old question but maybe this helps other people with same problem.
You can activate the SQL Server Express Error Log in a way that it monitors all statements runned agaist every database. To do so you must run the following on an elevated command prompt (that is, a command prompt runned as administrator):
net stop MSSQL$SQLEXPRESS
net start MSSQL$SQLEXPRESS /T4032

Now, using the SQL Server Management Studio run the following:
dbcc traceon(3605, -1)

Now you can look at the ERRORLOG file within the Log folder of MS SQL folder (which may be "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\Log" for the default installation of SQL Server Express 2012).
Hope this helps someone (as it sure helped me)
Comment: This works very good.. thanks man
Answer: IIRC, the profiler is one of the features not available for SQL Server Express.
However, I'm also under the impression that SQL Server Express still supports many of the features of the for-pay editions, and it's just that they are disabled in the Express Edition of Management Studio.  So if you also have access to a full db and the management studio that comes with you might be able to point that profiler at your express installation.
In this case I suspect that won't work, since the profiler also depends on an extra provided by the database.  Still, it's worth a shot.
If it doesn't work there are some third party tools available that should be able to do what you want.
Comment: Yes - this works; you can even use the eval edition for a period of time. http://blog.tonysneed.com/2010/08/05/setting-up-sql-server-2008-express-with-profiler/
Answer: SQL Express Profiler will likely meet your needs. When this question was asked it was free, but it looks like it has recently changed to a paid license model.
Comment: This people are selling it for $5
Answer: Anjlab SQL Server Profiler is no longer free and it only worked on 2005 instances. I've wrote a basic SQL Server 2012 Profiler which works perfectly on 2012 Enterprise and 2005 Developer engine instances. You can download here
please give me your feedback.


What to do when moisture forms on the helicopter's canopy in a weather front?

Question: Moisture has condensed on the canopy of your helicopter as you fly through a weather front – what should you do?
Answer: That won't happen "flying through a front" where the temperature of the plexiglass is at at or warmer than the ambient air - you just get drops forming and streaming back.  What has happened to me though, is condensation when climbing into a warm humid inversion on a sunrise clear sky departure where the surface temperature was much cooler than in the inversion.  On my airplane which has a sliding bubble canopy, the outside of the canopy fogged up suddenly at about 200 ft agl as the cool plexiglass hit warmer humid air and it was like the canopy was covered in wax paper.  A bit alarming initially.  I just used the attitude indicator to stay right side up, helped by the opaque blue of the sky above, until it started to stream and clear up on its own after a minute or so.


Proof from Hubbard: Why restrict to the reals only?

Question: I'm reading through Hubbard and Hubbard's Vector Calculus, Linear Algebra, and Differential Forms, and in it the following theorem and proof are supplied. Now I followed the proof, but what I didn't understand was why the function $f$ was restricted to have the codomain $\mathbb{R}$. I didn't notice the hypothesis used anywhere and (if indeed the hypothesis is not needed) I can't see why the author wouldn't allow for a codomain of $\mathbb{R}^m$ more generally seeing as this is a book on multivariable calculus. The book is fantastic and it goes without saying that Hubbard is a far more capable mathematician than I am, so I'm wondering where I'm missing something here?
Comment: Yup, one could replace $f:X\to\mathbb R$ with $f:X\to\mathbb R^m$ and the Theorem is still true :)
Comment: Not only you can replace $\mathbb R$ by $\mathbb R^m$ in the proof, but also the case with codomain $\mathbb R^m$ follows from the case with codomain $\mathbb R$.
Comment: Hmm, that is curious then. Thanks for clarifying!
Comment: @AndréPorto can you elaborate on that? I can see how I could argue identically to the proof above to get the case for $\mathbb{R}^m$, but I don't see how it follows immediately (I only have theorems for coordinate-wise convergence being equivalent to convergence in the sense of sequences).
Comment: Check out my answer below
Answer: You can replace $\mathbb R$ by $\mathbb R^m$ in the proof, really by just replacing them, since the properties he used on the norm of $\mathbb R$ are the same on $\mathbb R^m$.
Also the case with codomain $\mathbb R^m$ follows imediatelly from the case with codomain  $\mathbb R$. To see that, fix $f: X\subset\mathbb R^n \to \mathbb R^m$ and consider its coordinate functions $f_1, ..., f_m$. Each $f_i$ is a continuous function from the compact $X$ to $\mathbb R$, so by the result with codomain $\mathbb R$, each one of them is uniformly continuous.
Given $\varepsilon>0$, for each $f_i$, we may fix $\delta_i>0$ satisfying
$$
|x-y|<\delta_i\ \Rightarrow\ |f_i(x)-f_i(y)|< \frac{\varepsilon}{\sqrt m}.
$$
Put $\delta=\min\{\delta_1, ..., \delta_m\}>0$. Note that
\begin{align}
|x-y|<\delta & \Rightarrow\ |x-y|<\delta_i,\ \forall i\in\{1, ..., m\} \\
& \Rightarrow\ |f_i(x)-f_i(y)|< \frac{\varepsilon}{\sqrt m},\ \forall i\in\{1, ..., m\} \\
& \Rightarrow\ |f(x) - f(y)|= \sqrt{\sum_{i=1}^m |f_i(x)-f_i(y)|^2} < \sqrt{\sum_{i=1}^m \frac{\varepsilon^2}{m}} = \varepsilon,
\end{align}
so $f$ is uniformly continuous.
Comment: Super, thanks very much!


Why does the chat bar show up when I right click on Minecraft P.C.?

Question: I am on P.C. and have been playing Minecraft recently. I play on the ihascupquake oasis mod and for some reason when I tried to right click the chat bar came up in the bottom of my screen so I pressed enter and it went away. I pressed another several times and the same thing happened (The chat bar came up when  right clicked.). In that time I couldn't break blocks as you can't do anything when chat bar is up. I went into chat settings and selected "Chat bar: Hidden" and the chat bar went away but I still couldn't break blocks. I left the game and came back several times - no change. Can someone please help me?
Comment: Check in the controls that the right click isn't allocated to chat
Answer: You shhould go into options and see what keys you have set for all the basic controls and reset them all back to normal.
Once you do that, "T" should be set for chat, right click should be for place and left click for break. My younger brother once had this problem and doing this fixed it.


What plastic shuttles have the closest resemblance to feathers?

Question: As in the title really - what plastic shuttlecocks best mimic the behaviour of feather shuttlecocks?
Comment: Are you looking for a comparison of feather shuttles versus plastic shuttles?
Comment: Nope, I'm looking for recommended plastic shuttles that most closely mimic the behaviour (flight pattern) of feathers.
Comment: "Feathers" as in feather shuttles? Just want to make sure I understood properly before answering.
Comment: Sorry, yes feather shuttles - should have made that clear!
Answer: According to this badminton site:

Note that while all feather shuttles have actual cork for the "cork"
  portion of the shuttle, some plastic shuttles use a firm foam "cork"
  as the part of the shuttle that you actually hit. Know that these
  materials have a great impact on how the shuttle plays and, if
  possible, I would recommend that you stick with shuttles with actual
  cork for the head. There are a number of plastic shuttle
  manufacturers but the Yonex Mavis line seems to be the most
  popular (though others from Carlton, Head, and Black Knight are
  popular as well).

From Yonex USA site, the flight pattern of the Yonex Mavis 370 comes close to that of an actual feather shuttlecock:

From one Amazon review for the Yonex Mavis 2000:

This is a very good shuttle if you are looking for durability. The
  flight is very near to a feather shuttle, but it falls just a bit
  short because there is nothing like the weight distribution of a
  feather shuttle from which you get better control and feel.

These links are all subjective, but all seem to indicate that nothing really matches the performance of an actual feather shuttlecock. Durability seems to be the largest advantage of the plastic versions. I hope this info will point you in the right direction for your search - please let us know which brand/model you decide on.
Answer: I know this post is a couple of years old but a British company has just started making these bird2 shuttlecocks.
Played with them for the 1st time today and my initial reaction is that they seem very good.
I'll update this answer if they prove to not be very durable.
N.B. I am in not affiliated with Bird2 in any manner.
UPDATE
Having now used this a fair bit they are really nice to play with and a lot more durable than feathers. However we managed to destroy 3 of them in a single session recently so they are definitely not as durable as standard plastic shuttlecocks.
Comment: Nice catch Fishcake !! I have to ask: are you affiliated?
Comment: No not at all, a friend I play with bought a tube at a trial price and we used them for the 1st time today.
Comment: @jacob Sorry did you mean affiliated with a badminton club?
Comment: Ah ok, nope not even heard of bird2 until we played with them.


If I pocket the queen and one opponent's C/m in the same shot, what happens?

Question: If I'm playing black and I pocket the queen and a white C/m in a single shot, do I get a chance to cover the queen? Or does the queen come back on the board? Or does the queen go to the opponent?
Comment: Is this covered [here](https://boardgames.stackexchange.com/q/28732/15483)? I don't know enough about carrom to tell...
Answer: Pardon the bump but the correct answer is:
Player loses their turn and the queen comes out. Any of the opponents pieces remain pocketed.
Actually this is hard to pin down. The official rules state that if a player pockets an opponents piece their turn is over. Since they would then not be able to cover the queen must therefore also come out. There seems to be no mention of any due or penalty, nor a specific rule covering this, so the pocketing of an opponents coin ending the turn appears to take precedent.
However according to Master Of Games website, this would count as a foul, the turn would end and the queen along with a penalty coin would be replaced. The pocketed coins would remain pocketed. The rules laid out on this site differ in many ways from the official ICF rule so take that into consideration.
Both rule sets state the turn ends and the queen is replaced, the only difference being whether or not the penalty is charged.
Answer: You can continue and get a turn to pocket the cover provided the white coin was not the last coin on the board.
If white coin was the last coin on the board then white wins the board. 4 points if his score is less than 22 and 1 point if score is more than 21.
Comment: This is incorrect. Player loses their turn when pocketing the opponents coin.


Black screen areas with gnome classic

Question: I've (re)installed ubuntu 12.04 on my eeepc-1000h. I've installed gnome classic.
Everything was going vell, but now, with screen resolution 1024x600, i've got in each side of the desktop, a black area (+-20px width): the mouse pointer goes there, but mouse clicks don't work; windows maximized don't use those areas. The panels seem not affected by this: they fit along all the screen.
How can I remove those black areas?
Can anyone help?
Answer: There is some problem with the overlay-scrollbar in gnome, try to remove it with:
sudo apt-get remove overlay-scrollbar
Comment: Removing is not necesarry. You can try to disable it first with `gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false`.

Black screen areas with gnome classic


Scale < 100% on Windows 10

Question: I would like to set my monitor's scale under 100%, but Win10 only lets me set it to 100% or higher. Why won't Windows let me do that? Is there any workaround to do that?
I am aware of the fact that scaling below 100% will result in merged pixels.
Comment: [How to setup custom DPI below 100% on Windows 7?](https://superuser.com/q/80151/241386), [DPI Scalling Windows 10](https://superuser.com/q/1213201/241386)
Comment: December 2022 workaround: https://pastebin.com/pEM3EWNY
Comment: @SHRX you could totally post that as an answer if you wanted :)
Answer: You must use a registry hack to get scaling values below 100%:
Open the Registry, navigate to HKCU\Control Panel\Desktop, and double-click on LogPixels to edit. If there is no LogPixels, create a new DWORD value and name it LogPixels.
Make sure the Base is set to Decimal.
The default value is 96, as in 96 dots-per-inch, which is "100% scaling". Values lower than that will be sub-100% scaling values.
Next, in that same Key, find Win8DpiScaling. It it doesn't exist, make another DWORD value and name it Win8DpiScaling. Then edit it as follows:
If the value of LogPixels is 96, then Win8DpiScaling should be 0. If the value of LogPixels is anything besides 96, the Win8DpiScaling value should be 1.
More information: https://www.tenforums.com/tutorials/5990-change-dpi-scaling-level-displays-windows-10-a.html
Comment: Thanks for the answer, sadly it doesn't seem to work anymore? I tried it several times but nothing has changed
Comment: Looks like this does not work in Windows 10. It's supposed to work just by logging out and then back in, but I also tried a reboot. @TrippKinetics: it's decimal 96, as noted by "Make sure the Base is set to Decimal."
Comment: 2022 update for Windows 10: https://stackoverflow.com/questions/69347409/how-to-set-dpi-scale-to-less-than-100-on-windows-10-with-multiple-displays
Comment: Quick common values: 76 = 81.25%; 72 = 75%; 48 = 50%; 64 = 66⅔%
Comment: Do you mean `0x96`, or decimal `96`?
Answer: It is possible with NVidia CPUs.

Launch the Nvidia Control Panel
Navigate to the 3D Settings
Locate "DSR-factors"
Select 4.00x
At the next setting ("DSR smoothing"), select 10%
Click "Apply" at the bottom of the Window
All screens turn black. Be patient.

As screenshot (sorry 4 German):

Open your display settings
Select the screen to modify
Select a higher resolution

Above, set the scaling to 150%
Apply the setting

As screenshot:

Here, it works fine with a Fujitsu P2410 WS, which has a 1920x1200. I am running it in a vertical mode (and have my OneNote opened there).
Be aware that the text is not as sharp as before.
Hint initially found at reddit
Answer:
The tl;dr:
Technical limitations aside, there are very solid user experience reasons why this probably isn't allowed.
No, Windows (10 or later) will not let you set UI scaling below 100%.
(even if a stable workaround were to be discovered, most users would probably be quite unhappy with the results)
While I would love¹ to be proven incorrect, the implications of scaling at less than 100% are so fraught that this limitation is unlikely to change in the near future.

Note: this answer was cross-posted from another site, since the question there has since been 'closed'.

Original source: How to set DPI scale to less than 100% on Windows 10 - With multiple displays

Update in 2024: According to other answers, using certain GPU software or other hacks may work in limited circumstances. (Hardware HDMI scalers could also be a possible workaround to emulate a high-resolution display.)

Background:
This has been the case for ages, likely since Windows first introduced the feature.
Compatibility with current software
The only ~purely technical~ reason I can think of:

The 100% scaling size likely uses the smallest base image (e.g. Explorer and Taskbar icons, mouse and text cursors) resources included in various existing Microsoft and 3rd-party applications.

User experience
Going below the 100% point may cause small UI text and icons, especially in application toolbars and the Taskbar to be blurred to the point of ambiguity.

Those fine lines in the taskbar 'Windows' menu icon? Blurred or gone.

Taken to the extreme, the UI ~might~ become so unreadable that the user is effectively prevented from being able to read the text even in the 'Settings' window and therefore is 'stuck': i.e. not able to navigate through 'Settings' to restore the original '100%' scaling mode.

(Luckily, Windows is never used to run any SCADA software where confusing two icons could theoretically cost money or lives.)

Performance:
Since those carefully-designed graphic assets don't exist, if sub-100% scaling were allowed, it would also likely cause extra CPU/GPU workload - that is why only certain fixed sizes of up-sampling are shown on the normal Display settings screen and why the Advanced scaling settings screen warns that custom scaling between 100-500% is "not recommended".

That might also apply to any fixed scaling option offered below 100%, and absolutely would for custom scaling sizes.

Some people enjoy reading:
Vector-based TrueType/OpenType fonts usually contain a ~lot~ of manual tweaking / hints to enable readable display of very small point sizes.
The marketing department & friends of the C-suite
Could they implement this at a limited range of options? 90%? 75%?
Perhaps - but it's extra testing for a horrible-looking edge case.

The existence of the option, even if only available as a registry hack, might cause some people to actually use it in kiosks and other public-facing displays; this risks the same sort of bad PR as when a BSOD is seen on the 'arrivals' screen at a train station or airport monitor.

Combined with the first example below, even a 90% option could cause trouble in some environments.

Example and tutorial:

Imagine how Windows might look displayed on one of those cheapo '1080p-supported' projectors that actually only contains an imager with a native pixel resolution of, say, 1024x576 (or even 480x234).

Windows thinks it can send 1080p, since that what the HDMI connection advertises, so it does: any text / vector content looks atrocious.
(At least in this case the user could normally² unplug the projector and reconnect to a normal monitor to restore functionality.)

See for yourself... while connected to any monitor (at that monitor's native resolution), with Windows set to 100% scaling:

Open Windows Notepad
Type or paste in any block of text
Now, use the Zoom Out command from the View menu³ five or more times in a row

While not an exact analogue, you may still see how hard it could be to read down-sampled text, even when very high-contrast (the best-case scenario).

    ¹: As someone currently typing this very answer on a 1080p connection to a 55" 4K television as a second monitor, I came across the question very much hoping this was possible. Sadly, logic intervened and killed my potential joy.
    ²: Unless the computer is actually stored somewhere locked or inaccessible, such as a NUC-style PC hidden above the false ceiling in a conference room.
    ³: Alternatively, press <CTRL>-<Minus> five or more times.
Answer: Unfortunately in Windows 10 there is no way to set lower DPI than 100%. Only way to make things smaller is setting resolution above default (or buying larger monitor). Sometimes it may mean to create custom resolution in you graphic card driver.
Comment: Why do write it can't be fine when there is a post describing how to do it
Comment: Please check out https://superuser.com/help/how-to-answer - your answer isn't very constructive I'm afraid.  If you can show research, and how you arrived at your conclusion, your answer is far more valuable.
Comment: The post describing how to do this applies to older versions of Windows. This is noted in the comments to the older answer here as well as the comments to the answer for [How to setup custom DPI below 100% on Windows 7?](https://superuser.com/q/80151/300293)

Scale < 100% on Windows 10


Potential energy of Hydroelectric plant before the dam was built

Question: So the energy potential of a Hydroelectric dam is the difference between the head and base. Before the dam was built where does all that energy go? I can understand that for a long valley that is dammed up the the energy was released from the headwaters to where the dam was built over a large area. However in a possibly simpler case of a waterfall, you have the "instantaneous" power of difference between the bottom and the head. Where is all that energy going? Is it just dissipated though vibration and sound?
Answer: The energy is converted to heat.  The friction of the water with the river bed, and with itself, converts the energy to heat.
Comment: So I see this answer. Can you add some figures for some prominent falls or temperature differences before and after to quantify?
Comment: @QueueHammer an example is worked out here: http://physics.stackexchange.com/questions/107266/energy-analysis-of-niagara-falls-in-linus-paulings-general-chemistry
Comment: Could the energy extracted by the plant have actually been reaching the river's drain before, and getting dumped into whatever sea/lake/ocean it terminates in? It would be nice to see a reference confirming that the properties of the water flow at the drain (volume/speed/temperature) are not changed significantly by building a plant 100km upstream.
Comment: But, for that matter, it also dissipates into sound, as the author of the question states.
Answer: Two energy sinks:

Heat, as stated in the other answer.
mechanical work on solids: rocks get ground to gravel, gravel to smaller grave etc.,
mechanical work on the fluid, it will mst likely flow faster downstream, unless all that energy is dissipated as mechanical work as described above

Let's take a closer look at the heat. We look at a reasonable upper limit for thermal energy imparted on the fluid, so no energy is lost to the surroundings, no mechanical work is done on solids and the flow velocity is the same before and after. Then the power of the river is $\dot{m}*g*\Delta H$, mass flow rate times local gravity time head. The thermal power expanded is $\dot{m}* c * \Delta T$, mass flow rate times thermal capacity times temp. diff.  With thermal capacity for water we get somewhere near 2,34 mK per m head difference.  Not that this value could in theory be larger after a rough patch in the stream with lots of dissipation, but it's very likely that heat echange with the surrounding will drown out this effect.