Lunar eclipse redness not visible through telescope?

Question: I watched the total lunar eclipse on January 20-21 in North America. Looking at it with my eyeballs it appeared red. This is due to Rayleigh Scattering. When I looked at the eclipse through binoculars and a telescope, the color was washed out, and it looked like its normal gray. Is there an obvious explanation for this?
Answer: This is strictly related to psychology, and the physiology of the eyes. Specifically, if our eyes have nothing to compare the hue of a scene too, we assume it is color balanced. Also, the retinal pigments are depleted the stronger the color energy.
Comment: I loosely used the term "color balanced" to mean it gets adjusted for grey scale. See http://photobiology.info/Crouch.html for the depletion effect (its not necessarily the original pigment, but can be a chemical intermediate in the process)
Comment: Interesting the no comparison explanation makes sense somewhat, though I'm not exactly sure what "color balanced" means exactly. But can you explain more about depleted retinal pigments and stronger color energy?


GS4 - Stuck in a bootloop on stock ROM

Question: SGH-I337 I got recently is stuck in a bootloop. Itll post and then attempt booting and stay on the screen forever. As this phone is completely stock and never touched so usb debugging is not enabled. Factory resetting does nothing, the phone will not wipe the cache (it attempts then errors out and restarts itself). Ive tried flashing TWRP via odin but the bootloader is locked. Trying to use ADB logcat does not seem to work. What route should I take from here?
Answer: Run adb logcat during boot, record the output and post it here / try to find the cause of the boot loop.

GS4 - Stuck in a bootloop on stock ROM


How to achieve the correct posture if you're short, get a shorter stand or higher chair?

Question: I bought a digital piano with a fixed height stand and the top of the key are 28.75 inches from the ground. I need to get my elbow to be parallel with the key height, is what I got from online videos. So either I get an adjustable stand and set it at a lower height or get an adjustable chair and set it at a greater height (and be sort of standing). I've been using a dining room chair and my thigh is parallel when I sit on that chair. My elbows are about 25 inches from the ground when seated. I'm not sure what's the best approach.
Answer:
Adjustable stand
Adjustable chair/bench
Sit forward on the chair, so your feet can be flat on the floor
Footrest

In my experience, #3 is the most common issue, and the easiest and cheapest to fix. Pianists should sit as close to the front edge of the chair/bench as is comfortable. This allows for weight in our feet on the floor or footrest, which supports our back. It also makes it easier to move when we need to play in the high or low registers of the instrument.
Comment: It seems to me I would need to raise my seat another 2 inches. Hopefully I would still be seated somewhat.
Comment: @udeleng Allowing you would also be sitting at the front edge of your seat, lowering the keyboard would be a better option that raising your chair.
Answer: The two factors that are important are elbow height compared to keyboard level, but also feet on the floor. Let's be stupid: you could raise yourself and the keyboard another 6", and the arms wouldn't change. But your feet would be dangling!
So, let's start where the floor is.Heels resting on it, so you can work the pedal/s comfortably. Sitting (not slouched) will give you the elbow height, so then the keyboard height can be adjusted. I prefer elbows sligtly higher than the 'board, so gravity will help lower arms/wrists/hands when needed - most of the time.
Comment: Do shorter people playing at a real piano use a a higher seat + foot rest or how do they do it or do they semi-stand on the seat edge?
Comment: @udeleng - they tend to saw off the bottom of the legs of the stool. Then they have to do the same with the piano...  Or they could even use a raised board on the floor for their feet, which would get in the way of the pedals. Or take up a different instrument..!
Answer: Real pianos aren't adjustable.
Real piano stools ARE adjustable.
Unless this keyboard is the only one you'll ever play, I suggest you get used to a standard height instrument and an adjustable stool.   (Or sit on some books.)
Comment: Maybe higher floors?
Comment: Indeed.  Or stilts.


How to alter undirected, binary graph to have specific graph-analytical characteristics while keeping others constant

Question: I am working on a undirected, binary graph (derived from functional neuroimaging). I would like to alter this graph to change specific graph-characteristics (e.g. a specific value for the global clustering coefficient or the average minimal path length) while keeping all other graph-characteristics constant (or as many other as possible).
There are some references how to alter a graph to have a specific clustering coefficient (e.g. this question suggests Wang or the  block two-level Erdos-Renyi model). There are existing implementations for the clustering coefficient (here and here). Are there similar references with respect to average minimal path length?
Answer: You could the use the principle of the Watts-Strogatz model (Watts'98): in the article, they show empirically that randomly rewiring a very few links in a lattice allows largely decreasing the average distance while keeping a relatively high clustering coefficient.
In this model, a parameter p allows controlling the (expected) proportion of rewired links. For each rewired link, one randomly selects one of its end-points, then exchange it for a different (randomly drawn) node. You can find an implementation in igraph, see file igraph/src/games.c#igraph_watts_strogatz_game on their GitHub.
You could implement this simple mechanism, apply it to your own data, and study how playing with p affects the other topological proporties of interest. But intuitively, it seems hard to completely control one topological property without changing the others. For instance, in a previous work I studied how a different rewiring process (designed to produce a community structure) affects the average distance, degree correlation and average distance of a network, and the effects were very different, and sometimes very strong.


Yoast's WordPress SEO plugin is not showing the correct snippet

Question: I am facing a problem. I am not getting the snippet which YOAST plugin showed me. The snippet in Google search is different from what YOAST is showing. Check out the screenshots (http://imgur.com/a/ko5lQ). Let me know what is the solution of it?
Comment: How long has it been since you set it in WP SEO?
Comment: This question might be Plugin-specific enough to direct [to the Plugin developer himself](http://wordpress.org/tags/wordpress-seo?forum_id=10).
Comment: @m0r7if3r: 7 days.
Comment: Have you seen any of your other changes get implemented, ie: is it just the description that's missing, or has the rest failed to take too?
Comment: Other problem is that I am getting my tags in google search result whereas I have mentioned in YOAST not to index tags.
Answer: It is suppose to work this way.
Joost's plugin only gives you a great tool for you to optimize your snippet.
If you haven't done any optimizations whatsoever, like creating an awesome brief description of what your content is all about, Google will probably try to figure out what's the best bit of content by their own.
Just a minor edit, Google just released a video exactly replying your question: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=35624
Answer: Try getting google to recrawl your site, they only come by every so often and update their info then. You can do this with google webmaster tools if you have that setup, I'm sure there are other methods, but I don't know of them.
Answer: I would advise signing up for Google Webmaster Tools if you haven't already (easy to verify ownership of site with Yoast's plugin). They offer advice on topics like this and recommend NOT repeating the same meta description for every page. Google always reserves the right to change the snippet depending on your page or the keyword phrase being searched.
Comment: +1 on Google Webmaster Tools of course. But looking at the screenshot, this isn't exactly the case. OK, I might have been a bit harsh with my statement, but unlike other plugins, Joost's plugin actually gives you a pretty awesome way to **craft** your snippet _per post_.
Comment: I have already signed up to Google Webmaster. I have verified my site on Google, Alexa, Bing etc. Everything is fine. It is just that the snippet output was different.


Is there an adhesive that could used for larval fish?

Question: I am currently working on an experimental design that requires a larval fish (~ 4mm long) to be affixed on a metal wire tip on its dorsal side. Now, I was thinking of a glue or adhesive to do the job, but it doesn't have to be strictly these, anything that sufficiently attaches the fish to the metal wire tip would do. The glue/adhesive would have to work well on wet surface and, ideally, something that is not toxic. Any advice or ideas are welcome.
Answer: You could try methyl cellulose, which my lab and others use. It's not exactly an adhesive, but it is quite viscous. It's common enough that it's in the Zebrafish Book: https://wiki.zfin.org/display/prot/Methyl+Cellulose+Mounting . Obviously, be sure whatever you do is approved by your animal care and use committee.


Base a column on another lookup column

Question: I have a list with a lookup column (Reviewers). In my view, I want to have two columns (Assigned To and Review Complete) that are checkboxes. In the first (Assigned To), the manager selects all the users from the Reviewers lookup that are assigned to that file. In the second column (Review Complete), I want to have only those reviewers selected in the Assigned To column display and then they can check off their name when they have completed the review task for that item. Any help is appreciated.
Answer: By design, your needs cannot be realized. Because the Lookup column does not support getting value from another Lookup column.
Lookup Supported Column Type

Single line of text
Number
Date and Time

Lookup Unsupported Column Type

Multiple lines of text

Currency

Person or Group

Calculated

Hyperlink or Picture

Custom Columns

Yes/No

Choice

Lookup

Base a column on another lookup column


Why is mergesort O(log n)?

Question: Mergesort is a divide and conquer algorithm and is O(log n) because the input is repeatedly halved. But shouldn't it be O(n) because even though the input is halved each loop, each input item needs to be iterated on to do the swapping in each halved array? This is essentially asymptotically O(n) in my mind. If possible please provide examples and explain how to count the operations correctly! I haven't coded anything up yet but I've been looking at algorithms online. I've also attached a gif of what wikipedia is using to visually show how mergesort works.
Comment: It is O(n log n)
Comment: Even god's sorting algorithm (a hypothetical sorting algorithm which has access to an oracle which tells it where each element belongs) has a runtime of O(n) because it needs to move each element which is in a wrong position at least once.
Answer: It's O(n * log(n)), not O(log(n)). As you've accurately surmised, the entire input must be iterated through, and this must occur O(log(n)) times (the input can only be halved O(log(n)) times). n items iterated log(n) times gives O(n log(n)).
It's been proven that no comparison sort can operate faster than this. Only sorts that rely on a special property of the input such as radix sort can beat this complexity. The constant factors of mergesort are typically not that great though so algorithms with worse complexity can often take less time.
Comment: s/faster/with lower complexity/
Answer: The complexity of merge sort is O(nlog(n)) and NOT O(log(n)).
Merge sort is a divide and conquer algorithm. Think of it in terms of 3 steps:

The divide step computes the midpoint of each of the sub-arrays. Each of this step just takes O(1) time.
The conquer step recursively sorts two subarrays of n/2 (for even n) elements each.
The merge step merges n elements which takes O(n) time.

Now, for steps 1 and 3 i.e. between O(1) and O(n), O(n) is higher. Let's consider steps 1 and 3 take O(n) time in total. Say it is cn for some constant c.
How many times are we subdividing the original array?
We subdivide the input until each sub-array has one item so there are exactly log(n) "subdivision stages". We undo each subdivision stage with a "merge stage".
For example, if n = 8, there is a total of 3 merge stages: one where each pair of n/8 sub-arrays are merged to form a single n/4 sub-array, one where pairs of n/4s are merged to form n/2s, and one where the pair of n/2 are merged to form n.
What is the time cost for merging all pairs at each merge stage?
For this, look at the tree below - for each level from top to bottom:

Level 2 calls merge method on 2 sub-arrays of length n/2 each. The complexity here is 2 * (cn/2) = cn.
Level 3 calls merge method on 4 sub-arrays of length n/4 each. The complexity here is 4 * (cn/4) = cn.
and so on ...

At each merge stage, the total cost for merging all pairs is O(cn). Since there are log(n) merge stages, the total complexity is: (cost per stage)*(number of stages) = (cn)*(log(n)) or O(nlog(n)).

Image credits: Khan Academy
Comment: What do you mean with the conquer step that "recursively sorts"? The sorting is only done during the merge step. Both steps seem the same thing to me.
Comment: The tree has log(n) + 1 levels. However, in the lowest level there is no merge operation necessary. Therefore, why are there not only log(n) * cn primitive operations in total? In O-Notation that does not matter, but I am just curious.
Comment: @chriselgoog There isn't much utility in counting the number of levels. IMO it makes more sense to count the number of merge stages (which is exactly log(n)): if n=8, you can see there there are log(8) = 3 merge stages: merge pairs of n/8 to get n/4, merge n/4 pairs to get n/2, pair of n/2 to get n. At each "merge stage", a total of (cn) work is being performed (as Shantanu has explained). So the total cost across all stages is: (cn)*(log(n)).
Answer: Merge Sort is a recursive algorithm and time complexity can be expressed as following recurrence relation.

T(n) = 2T(n/2) + ɵ(n)

The above recurrence can be solved either using Recurrence Tree method or Master method. It falls in case II of Master Method and solution of the recurrence is ɵ(n log n).
Time complexity of Merge Sort is ɵ(nLogn) in all 3 cases (worst, average and best) as merge sort always divides the array in two halves and take linear time to merge two halves.
It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merg() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one. See following C implementation for details.
MergeSort(arr[], l,  r)
If r > l
     1. Find the middle point to divide the array into two halves:
             middle m = (l+r)/2
     2. Call mergeSort for first half:
             Call mergeSort(arr, l, m)
     3. Call mergeSort for second half:
             Call mergeSort(arr, m+1, r)
     4. Merge the two halves sorted in step 2 and 3:
             Call merge(arr, l, m, r)

If we take a closer look at the diagram, we can see that the array is recursively divided in two halves till the size becomes 1. Once the size becomes 1, the merge processes comes into action and starts merging arrays back till the complete array is merged.
Comment: Could you elaborate on the nature of the merge part of it and how it contributes to the O(n log n) performance?
Comment: I love this visualization of the sort!
Comment: The complexity of merge function is O(n),as is it takes 2 arrays as an input,compare them and give output in new. As it is comparing each element with every other element in the array,the complexity of this merge function comes out to be O(n).
Answer: Comparison based sort algorithms have a lower bound (n*log(n)), which means it's not possible to have a comparison based sorting algorithm with O(log(n)) time complexity.
By the way, merge sort is O(n*log(n)).
Think it this way.
[ a1,a2,         a3,a4,         a5,a6,          a7,a8     .... an-3,an-2,     an-1, an ]
   \ /            \  /           \ /             \  /            \  /            \  /
    a1'            a3'            a5'             a7'            an-3'           an-1'
      \            /                \             /                 \             /
            a1''                          a5''                       an-3''
             \                             /                         /
                          a1'''                                     /
                           \
                                              a1''''

This looks a reversed binary tree.
Let the input size be n.
Each a_n represents a list of elements. First line's a_n have only one element.
At each level, the sum of the merge cost on average is n(there exists corner cases which the cost is lower[1]). And the tree's height is log_2(n).
So, the time complexity of merge sort is O(n*log_2(n)).

[1] if sorting on a list that is already sorted, which is called the best case. the cost reduced to n/2 + n/4 + n/8 + .... + 1 = 2^log_2(n) -1 ~ O(n). (assume the length n is power of two)
Answer: Sorting is a NP-Complete problem in computer science (Non Polynomial problem). This means that, unless mathematically proven, you can't go below O(n log n) when sorting an list of elements.
Check this article in Wikipedia (https://en.wikipedia.org/wiki/P_versus_NP_problem)
Basically so far nobody managed to prove that (P == NP) and if you do, you first become millionaire, second you start world war III due to the fact that you will be able to break all the pub/private key security mechanisms used everywhere nowadays :)
Comment: That's not what NP means. Even BubbleSort is in P. You have to try hard to make a sort thats not in P (e.g. BogoSort)
Comment: Bogosort: Throw all the items in the air, then check if they are sorted. Repeat until sorted. To be sure the elements are sorted, repeat until the elements are sorted n times in a row :-)

Why is mergesort O(log n)?


Does a compensated semiconductor show behaviour characteristic of this state?

Question: Let`s say we have a wafer of compensated semiconductor material and another of the same semiconductor material with the same net doping level, but with only one sort of dopants, i.e. without compensation. Can we tell them apart by their behaviour (i.e. response to experiments) alone?
Answer:
At least some of the compensated levels should be visible in mid-IR
absorption or fluorescence spectroscopy.
Also if they retain a slight negative charge in the crystal, they
should attract and localise positrons so they would manifest as a
slightly slower decay in the positron annihilation spectroscopy
(PAS) waveforms. This is somewhat involved and will not discriminate for all types of defects.
The contaminating elements, no matter if charged, will reduce
electron/hole mobility, which will be observable when resistance is
complemented by Hall measurement. This should be complemented by:
...changing the temperature or chemical environment, during which the
balance of donors and acceptors can be broken and the dopants will
manifest themselves in the temperature (etc.) dependent curves.

Note that an authoritative answer would require more detailed knowledge of the material under study. A quantitative measurement will also require a reference standard of pure semiconductor of the same kind.
Edit: Great thanks to F. Hájek for his professional advice. He also suggests that the level of compensation could be visible in optical luminescence: https://www.sciencedirect.com/science/article/pii/0038109878915867
Comment: @my2cts No, I mean positrons, usually emitted by β⁺ decay of ²³Na. They annihilate within 100 ps − 1 ns in a material, which is long enough to settle at some defect with negative partial charge (ionized acceptor / vacancy / etc.). From statistics of their decay time, you get vital information on the defect character and semiquantitative concentration thereof.
Comment: Positrons? You mean holes.
Comment: How do you bring the $^{23}$Na into the lattice?
Comment: Most semiconductors indeed do not contain sodium. One can just sandwich the positron source with the sample(s), knowing the emitted positrons have sufficient kinetic energy to penetrate some 10−100 μm into the semiconductor slab. Alternately you can inject them with a well-defined energy using a moderator and high-voltage accelerator. Positrons can often be treated similar to electrons (until they annihilate).


Photo gallery on profile page?

Question: Is there a way, (or a plugin), that allows members to have their own photos on their profile page? I want to limit the amount of photos to perhaps 50. Any suggestions??? Thanks in advance!!!
Comment: Bump... Anybody?
Answer:
While answering this Q, stumbled upon this other one: add 'file upload' field to user details, which may be a duplicate and where Bainternet suggests Cimy User Extra Fields.

Advanced Custom Fields can do the job.
Without any premium Add-on* this can be solved adding Image fields to the Users pages:

^^^^
Which results in this:

<code>*</code> http://www.advancedcustomfields.com/add-ons/
The Repeatable Fields would make this less cumbersome. And just learned that there's a new add-on: Gallery, that seems quite interesting for managing images.
But, in those cases, I guess you'll have to create some jQuery to control the maximum allowed pictures.

You'll probably need/would-like to restrict the access to other users uploaded files.
See: How to hide media uploads by other users in the Media menu?.

Photo gallery on profile page?


What happens to generated but unsent transactions?

Question: I created a transaction in mew with nano s. I generated a transaction, clicked confirm on nano s, but missed the final step of clicking send transaction in the mew screen.  I can't find the transaction anywhere now, not listed in history...will this transaction eventually cancel and have my funds returned to wallet?
Answer: The transaction, as far as the blockchain is concerned, never existed. It's like recording a video and then deleting it -- you might as well not have recorded it. There shouldn't be any sign of your funds leaving your account.


Tridion 9.1 During Component Save, send to translation using Event handler

Question: I have a business requirement whenever the user saves a Component, it should send automatically to Translation Job using Event Handler. Does any one have an idea or already implemented this business logic?
Waiting for your valuable solution.
Comment: Sending something automatically for translation on a save event sounds to me like a really great way to give money to SDL. Often content is not ready to be sent for translation when it's saved the first time, and many other times it may be just a small edit that you don't necessarily want to translate (adding a comma, changing the order of some bullets, etc). Translation Manager and editorial governance on this is the way to go.
Comment: What's the setup (what are the moving parts) - and I'd suggest you don't just refer to the tags you've applied?
What have you tried - why didn't that seem to work? What have you read - no point in people spending their time advising links you've already read - as noted above? > Waiting for your valuable solution. Many people will have done this and as you state, there's value in a solution. I doubt people are just going to start pasting in generic solutions without more detail from yourself. Looking forward to helping when you've updated with more information https://stackoverflow.com/help/how
Answer: Please refer to the documentation link for more details
https://docs.sdl.com/816112/691717/sdl-tridion-sites-9-5/triggering-translations-from-event-system
Hope it helps !
Comment: Anand - Already referred and not helpful for me. thanks for reply
Comment: Can you elaborate more on why it wasn't helpful? Did you take a look at or have tried the examples and ran into some issue along the way?
Answer: I agree with @Nuno comments. It's not a good idea but technically it's doable.
Let me give you some ideas and references to start with. Using this below Component Save event you may need to call Translation Manager API to create the new job to add items to send for translation dynamically, you might need to identify the target Publication Uris also here it might be needed for creating a translation job.
<code>EventSystem.Subscribe<Component,SaveEventArgs>(HandlerForCommitted, EventPhases.TransactionCommitted);
</code>
Event Handler example refers to the SDL documentation.
To download the Translation Manager API reference documentation, download API reference documentation downloads.
Here are the translation manager reference DLLs you might be needed for Translation API.

Tridion.TranslationManager.V2.Data.dll
Tridion.TranslationManager.V2.TmService.Client.dll

SessionAwareTmServiceClient _client = new
SessionAwareTmServiceClient();

Refer to this answer for Translation SOAP Service netTcpBinding and endpoint. similarly, you will need to adjust based on your TM service version.
Note:
@Anand shared in his answer Translation Manager Event system examples reference useful in case if you want to hook the translation job. not for creating a new translation job.
I hope it helps.


Why do my bicycle brakes get worse and feel more 'squishy" over time?

Question: My bike has disc brakes connected to the lever by cable. I've found I've been tightening the screw by the lever more and more to the point that there's not that much more room to tighten.
Comment: @Andy P good point, I'm having a proper blonde day today
Comment: @DanK it has to be a cable system, hydraulics don't have an adjustment screw (barrel adjuster)
Comment: Are your brakes hydraulic, do you have a make or model of the brakes to help us work out what might be wrong. Even a pic would be a great help.
Comment: Then again, TRP HY/RD brakes have both cables and hydraulics, and shouldn't have the cable over-adjusted or [something](https://trpcycling.com/wp-content//uploads/2017/10/TRP-HYRD-Technical-Bulletin-English-Rev-B.pdf)
Comment: The underlying reason is "general decline". Why should brakes be different from ourselves?
Answer: On most cable disc brake systems there's a moving pad and a fixed pad.  The moving pad presses against the rotor and bends it slightly towards the fixed pad.  The rotor is made of rather springy steel, and is probably where the feeling you experience comes from.
The barrel adjuster only addresses wear to the moving pad, but the fixed pad also wears in use. The rotor has to bend more to contact the worn fixed pad. This means that tightening up the fixed pad is necessary (about every other time I tighten the barrel adjuster on mine, but it depends on the pads and mechanism).  It can be a bit of a pain as it's not very easy to get at.
Comment: I would expand the answer slightly, to indicate the barrel adjuster only moves the moving pad closer to the rotor. Over time the gap between the fixed pad and rotor will get larger through wear if the fixed pad isn't adjusted as well. This is why the OP noticed the brakes were more squishy (i.e., more rotor flex)
Comment: In  most cases the moving pad also has an adjuster.  The barrel adjuster whould not be used to adjust for wear. https://www.parktool.com/blog/repair-help/mechanical-disc-brake-alignment
Comment: @mattnz one very common (and often copied) design is the BB5 which does use a barrel adjuster for the moving pad, mounted on the moving caliper. So the barrel adjuster might or might not be the right way to adjust the moving pad. If the OP tells us which model I could be more specific. Until then I don't won't to suggest that what they've done so far is incorrect
Comment: @Rider_X good thinking. I've obviously spent too much time fiddling with them to explain properly.
Answer: There are two reasons why this happens with cable disc brakes.
The first is that the pads wear, and since cable systems are not self adjusting, you need to tighten the cable to bring the worn pads back closer to the disc.
Secondly, cables stretch over time, which again requires you to tighten the screw to take the slack out.
If you've reached the point where there is no adjustment left, then you need to check the brake pads don't need replacing.
If the pads are good, then you'll need to un-clamp the cable at the caliper and re-tension it that way.
Comment: I would stress that in some mechanical disc brakes it is *not* advisable to tighten the cable. One should instead use the pad adjusters to bring the pads closer to the disc, especially when the change is in the pad wear and not cable loosening.


i need to pull crankshaft timing gear on 1996 toyota 1.6 engine

Question: I need to put in front crankshaft seal on 1996 Toyota corolla I have to pull the timing belt gear off the crankshaft to do so I have searched everywhere and haven't found a answer any help would be appreciated
Comment: Welcome to Motor Vehicle Maintenance & Repair! Looking at it, the crankshaft timing belt gear is keyed. Most of the time when it's keyed, it is a snug fit, but should be able to pull it directly off by hand. I don't think there's any real way to put a puller on it to take it off. Just wiggle it by hand and see if it will come off.
Comment: IIRC you can use a steering wheel puller, there are two threaded holes. Maybe m8x1.0
Comment: there no threaded holes
Comment: @Ben - As far as I can tell, there's no bolt holes in it either. I viewed [this video for timing belt removal](https://youtu.be/YUcWsiDfFxQ) for a 97 Corolla, which I'd venture to assume is the same engine (correct me if I'm wrong). There's a really good view of the crank gear at [4:58 into the video](https://youtu.be/YUcWsiDfFxQ?t=4m58s).
Comment: @Pᴀᴜʟsᴛᴇʀ2 I must of been thinking of a different engine.
Answer: SI says to use two flathead screwdrivers with rags providing a cushion to work the sprocket off.
Place them in between the sprocket and oil pump housing and carefully pry the sprocket loose.
Comment: Sounds about right.
Comment: I would definitely suggest to use a proper sprocket puller as from my experience with 1.6 early mx5 engine I was trying to pull the sprocket out without a puller and ended up braking the sprocket lip
Comment: Sometimes you can heat the sprocket to make it swell a bit then it will slide off easily. They are not press fit.
Answer: i just did mine.tough to get it out, but i did get it out.This is what you have to do.There are no pulley that can go in to grab the gear.what you have to do is use a propane torch heat it up, then have a soft hammer i.e. a brass hammer, tap the edge of the gear rotate the crank shaft ,and tap with the hammer.you also have to put wd40 oil on the gear and shaft.the edge of the gear will get routed,but don't worry.after you get the gear outtake a chain saw file (round)then filed back the grov where the timing belt is going to seat.
Answer: It's easy to remove the old crank seal, and put a new one.
The tools you need is a self taping sheet metal screw because the crankshaft seal has heath sides.2)a screw driver 3)a pliers.
Use the screw, screw the edge of the old seal, screw it toll you get 1 or 2 thread, then use the pliers and grab the screw and pull.Vola the seal will pop out.
Then clean the hole wipe it clean, then add grease or oil on both the crank shaft and seal.Slide the seal until it reach the opening, then find any pipe bigger than the inner diameter of the seal, use the pipe and tap the seal in.And it's done


Reference book for Parallel Computing and Parallel algorithms.

Question: Please suggest some books on Parallel Algorithms which teach efficient programming techniques like the ones taught in Udacity course(Introduction to Parallel Programming with CUDA). Also wanted to know that from which reference book or papers are the concepts in the udacity course on Parallel Computing taught...? I wish to study more about such techniques which will make me an efficient parallel programmer...!
Comment: I just wonder why someone gave a negative vote to this question without giving any comment. The instructions for the tag "reference-request" specify "if you ask for pointers to material for self-study". Accordingly, this question looks perfectly legitimate.
Answer:
Also wanted to know that from which reference book or papers are the concepts in the udacity course on Parallel Computing taught...?

The History of Parallel Computing goes back far in the past, where the current interest in GPU computing was not yet predictable. Some important concepts date back to that time, with lots of theoretical activity between 1980 and 1990. Compared to the complicated trade-offs for current heterogenous systems, those old theoretical algorithms and concepts feel nice, powerful and easy to understand. Uzi Vishkin is a researcher who worked during that period, who still believes in those concepts (without overly compilicated trade-offs):

Alas, the software spiral is now broken: (a) nobody is building hardware that provides improved performance on the old serial software base; (b) there is no broad parallel computing application software base for which hardware vendors are committed to improve performance; and (c) no agreed-upon architecture currently allows application programmers to build such software base for the future

I recently learned about those old concepts, and corresponding interesting survey articles:
Parallel Algorithms (64 pages)
https://www.cs.cmu.edu/~guyb/papers/BM04.pdf
by Guy E. Blelloch and Bruce M. Maggs – 1996
Thinking in Parallel: Some Basic Data-Parallel Algorithms and Techniques (104 pages)
http://www.umiacs.umd.edu/users/vishkin/PUBLICATIONS/classnotes.pdf
by Uzi Vishkin – October 12, 2010
A Survey of Parallel Algorithms for Shared-Memory Machines (70 pages)
https://www2.eecs.berkeley.edu/Pubs/TechRpts/1988/5865.html
https://www2.eecs.berkeley.edu/Pubs/TechRpts/1988/CSD-88-408.pdf
by Richard M. Karp and Vijaya Ramachandran – March 1988
Limits to Parallel Computation: P-Completeness theory (327 pages)
https://homes.cs.washington.edu/~ruzzo/papers/limits.pdf
by R Greenlaw, H Hoover, W Ruzzo – 1995
Parallel Algorithms (347 pages)
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.466.8142&rep=rep1&type=pdf
by H Casanova, A Legrand, Y Robert – 2008
Answer: Programming Massively Parallel Processors is a good read. NVIDIA has also got some good tutorials. Amazon has got pretty good list.


Explanation of Merge Sort for Dummies

Question: I found this code online:
def merge(left, right):
    result = []
    i ,j = 0, 0
    while i < len(left) and j < len(right):
        if left[i] <= right[j]:
            result.append(left[i])
            i += 1
        else:
            result.append(right[j])
            j += 1
    result += left[i:]
    result += right[j:]
    return result

def mergesort(list):
    if len(list) < 2:
        return list
    middle = len(list) / 2
    left = mergesort(list[:middle])
    right = mergesort(list[middle:])
    return merge(left, right)

It works 100% when I run it. I just do not really get how the merge sort works or how the recursive function is able to properly order both a left and a right.
Comment: Check the animated gif on the wiki page: http://en.wikipedia.org/wiki/Merge_sort
Comment: Probably one of the cleanest code for merge sort. What is the source of this code? Link please.
Answer: I believe that the key to understanding merge sort is understanding the following principle -- I'll call it the merge principle:

Given two separate lists A and B ordered from least to greatest, construct a list C by repeatedly comparing the least value of A to the least value of B, removing the lesser value, and appending it onto C. When one list is exhausted, append the remaining items in the other list onto C in order. The list C is then also a sorted list.

If you work this out by hand a few times, you'll see that it's correct. For example:
A = 1, 3
B = 2, 4
C =
min(min(A), min(B)) = 1

A = 3
B = 2, 4
C = 1
min(min(A), min(B)) = 2

A = 3
B = 4
C = 1, 2
min(min(A), min(B)) = 3

A =
B = 4
C = 1, 2, 3

Now A is exhausted, so extend C with the remaining values from B:
C = 1, 2, 3, 4

The merge principle is also easy to prove. The minimum value of A is less than all other values of A, and the minimum value of B is less than all other values of B. If the minimum value of A is less than the minimum value of B, then it must also be less than all values of B. Therefore it is less than all values of A and all values of B.
So as long as you keep appending the value that meets those criteria to C, you get a sorted list. This is what the merge function above does.
Now, given this principle, it's very easy to understand a sorting technique that sorts a list by dividing it up into smaller lists, sorting those lists, and then merging those sorted lists together. The merge_sort function is simply a function that divides a list in half, sorts those two lists, and then merges those two lists together in the manner described above.
The only catch is that because it is recursive, when it sorts the two sub-lists, it does so by passing them to itself! If you're having difficulty understanding the recursion here, I would suggest studying simpler problems first. But if you get the basics of recursion already, then all you have to realize is that a one-item list is already sorted. Merging two one-item lists generates a sorted two-item list; merging two two-item lists generates a sorted four-item list; and so on.
Comment: I have been through 10-20 search results where they have scary graphical explanation. Paragraphs and paragraphs of text talking about general sorting. This exactly what I wanted. Cutting down tot the chase. giving me the meat of essentially what the idea is. Thank you so much.

Now I have to google a similar description of quicksort.
Comment: Excellent. Really nice walk-through of the basic unit of the merge sort.
Comment: I understand how the "sort" part of the algorithm works. I just don't understand how the algorithm takes those small sorted lists and does the "merge" part with them.
Comment: @user3932000 I don't really talk about the sort part very much. I'm mostly talking about the merge operation. Above, `A` and `B` are the inputs into the merge operation, and `C` is the output. Is there something specific that isn't clear?
Answer: When I'm stumbled into difficulty to understand how the algorithm works, I add debug output to check what really happens inside the algorithm.
Here the code with debug output. Try to understand all the steps with recursive calls of mergesort and what merge does with the output:
def merge(left, right):
    result = []
    i ,j = 0, 0
    while i < len(left) and j < len(right):
        print('left[i]: {} right[j]: {}'.format(left[i],right[j]))
        if left[i] <= right[j]:
            print('Appending {} to the result'.format(left[i]))
            result.append(left[i])
            print('result now is {}'.format(result))
            i += 1
            print('i now is {}'.format(i))
        else:
            print('Appending {} to the result'.format(right[j]))
            result.append(right[j])
            print('result now is {}'.format(result))
            j += 1
            print('j now is {}'.format(j))
    print('One of the list is exhausted. Adding the rest of one of the lists.')
    result += left[i:]
    result += right[j:]
    print('result now is {}'.format(result))
    return result

def mergesort(L):
    print('---')
    print('mergesort on {}'.format(L))
    if len(L) < 2:
        print('length is 1: returning the list without changing')
        return L
    middle = len(L) / 2
    print('calling mergesort on {}'.format(L[:middle]))
    left = mergesort(L[:middle])
    print('calling mergesort on {}'.format(L[middle:]))
    right = mergesort(L[middle:])
    print('Merging left: {} and right: {}'.format(left,right))
    out = merge(left, right)
    print('exiting mergesort on {}'.format(L))
    print('#---')
    return out

mergesort([6,5,4,3,2,1])

Output:
---
mergesort on [6, 5, 4, 3, 2, 1]
calling mergesort on [6, 5, 4]
---
mergesort on [6, 5, 4]
calling mergesort on [6]
---
mergesort on [6]
length is 1: returning the list without changing
calling mergesort on [5, 4]
---
mergesort on [5, 4]
calling mergesort on [5]
---
mergesort on [5]
length is 1: returning the list without changing
calling mergesort on [4]
---
mergesort on [4]
length is 1: returning the list without changing
Merging left: [5] and right: [4]
left[i]: 5 right[j]: 4
Appending 4 to the result
result now is [4]
j now is 1
One of the list is exhausted. Adding the rest of one of the lists.
result now is [4, 5]
exiting mergesort on [5, 4]
#---
Merging left: [6] and right: [4, 5]
left[i]: 6 right[j]: 4
Appending 4 to the result
result now is [4]
j now is 1
left[i]: 6 right[j]: 5
Appending 5 to the result
result now is [4, 5]
j now is 2
One of the list is exhausted. Adding the rest of one of the lists.
result now is [4, 5, 6]
exiting mergesort on [6, 5, 4]
#---
calling mergesort on [3, 2, 1]
---
mergesort on [3, 2, 1]
calling mergesort on [3]
---
mergesort on [3]
length is 1: returning the list without changing
calling mergesort on [2, 1]
---
mergesort on [2, 1]
calling mergesort on [2]
---
mergesort on [2]
length is 1: returning the list without changing
calling mergesort on [1]
---
mergesort on [1]
length is 1: returning the list without changing
Merging left: [2] and right: [1]
left[i]: 2 right[j]: 1
Appending 1 to the result
result now is [1]
j now is 1
One of the list is exhausted. Adding the rest of one of the lists.
result now is [1, 2]
exiting mergesort on [2, 1]
#---
Merging left: [3] and right: [1, 2]
left[i]: 3 right[j]: 1
Appending 1 to the result
result now is [1]
j now is 1
left[i]: 3 right[j]: 2
Appending 2 to the result
result now is [1, 2]
j now is 2
One of the list is exhausted. Adding the rest of one of the lists.
result now is [1, 2, 3]
exiting mergesort on [3, 2, 1]
#---
Merging left: [4, 5, 6] and right: [1, 2, 3]
left[i]: 4 right[j]: 1
Appending 1 to the result
result now is [1]
j now is 1
left[i]: 4 right[j]: 2
Appending 2 to the result
result now is [1, 2]
j now is 2
left[i]: 4 right[j]: 3
Appending 3 to the result
result now is [1, 2, 3]
j now is 3
One of the list is exhausted. Adding the rest of one of the lists.
result now is [1, 2, 3, 4, 5, 6]
exiting mergesort on [6, 5, 4, 3, 2, 1]
#---

Comment: brilliant way of explanation .. I couldn't understand your answer without @senderle answer, and couldn't understand senderle without your answer !.
Answer: A couple of ways to help yourself understand this:
Step through the code in a debugger and watch what happens.
Or,
Step through it on paper (with a very small example) and watch what happens.
(personally I find doing this kind of thing on paper more instructive)
Conceptually it works like this:
The input list keep getting chopped up in to smaller and smaller pieces by being halved (e.g. list[:middle] is the first half). Each half is halved again and again until it has a length of less than 2. I.e. until it's nothing at all or a single element. These individual pieces are then put back together by the merge routine, by appending or interleaving the 2 sub lists to the result list, and hence you get a sorted list. Because the 2 sub lists must be sorted, the appending/interleave is a fast (O(n)) operation.
The key to this (in my view) is not the merge routine, that is pretty obvious once you understand that the inputs to it will always be sorted. The "trick" (I use quotes because it's not a trick, it's computer science:-) ) is that in order to guarantee that the inputs to merge are sorted you have to keep recursing down until you get to a list that must be sorted, and that is why you keep recursively calling mergesort until the list is less than 2 elements long.
Recursion, and by extension merge sort, can be non-obvious when you first come across them. You might want to consult a good algorithms book (e.g. DPV is available online, legally and for free), but you can get a long way by stepping through the code you have. If you realy want to get in to it the Stanford/Coursera algo course will be running again soon and he covers Merge sort in fine detail.
If you really want to understand it, read chapter 2 of that book reference, then throw away the code above and re-write from scratch. Seriously.
Answer: Merge sort has always been one of my favorite algorithms.
You start with short sorted sequences and keep merging them, in order, into larger sorted sequences. So simple.
The recursive part means you're working backwards - starting with the whole sequence and sorting the two halves. Each half is also split, until the sort becomes trivial when there's only zero or one element in the sequence. As the recursed functions return the sorted sequences get larger just as I said in the initial description.
Answer: A picture is worth a thousand words, and an animation worth 10,000.
Checkout the following animation taken from Wikipedia that will help you visualize how the merge sort algorithm actually works.

Detailed animation with explanation for each step in the sorting process for the inquisitive ones.
Another interesting animation of various types of sorting algorithms.
Answer: basically you get your list, then you split it and then sort it, but you apply this method recursively so you end up spliting it again, and again until you have a trivial set that you can sort easily and then merge all the simples solutions to get a fully sorted array.
Comment: But how do you actually sort the "trivial set" and how do you "merge the simples solutions"? This doesn't explain either the merging or sorting of a ___merge sort___ and so doesn't answer the question.
Answer: You can have a good visualization on how the merge sort works here:
http://www.ee.ryerson.ca/~courses/coe428/sorting/mergesort.html
I hope it helps.
Answer: As the Wikipedia article explains, there are many valuable ways to accomplish a merge sort. The way to accomplish a merge also depends upon the collection of things to be merged, certain collections enabling certain tools that the collection has at its disposal.
I'm not going to answer this question using Python, simply because I can't write it; however, a taking a part of the "merge sort" algorithm seems really to be at the heart of the question, at large. A resource that helped me is the K.I.T.E's rather outdated webpage on the algorithm (written by a professor), simply because the author of the content eliminates context-meaningful identifiers.
My answer is derived from this resource.
Remember, merge sort algorithms work by taking apart the supplied collection and then putting each of the individual pieces together again, comparing the pieces to each other as the collection is re-built.
Here, is the "code" (look to the end for a Java "fiddle"):
public class MergeSort {

/**
 * @param a     the array to divide
 * @param low   the low INDEX of the array
 * @param high  the high INDEX of the array
 */
public void divide (int[] a, int low, int high, String hilo) {

    /* The if statement, here, determines whether the array has at least two elements (more than one element). The
     * "low" and "high" variables are derived from the bounds of the array "a". So, at the first call, this if
     * statement will evaluate to true; however, as we continue to divide the array and derive our bounds from the
     * continually divided array, our bounds will become smaller until we can no longer divide our array (the array
     * has one element). At this point, the "low" (beginning) and "high" (end) will be the same. And further calls
     * to the method will immediately return.
     *
     * Upon return of control, the call stack is traversed, upward, and the subsequent calls to merge are made as each
     * merge-eligible call to divide() resolves
     */
    if (low < high) {
        String source = hilo;
        // We now know that we can further divide our array into two equal parts, so we continue to prepare for the division
        // of the array. REMEMBER, as we progress in the divide function, we are dealing with indexes (positions)

        /* Though the next statement is simple arithmetic, understanding the logic of the statement is integral. Remember,
         * at this juncture, we know that the array has more than one element; therefore, we want to find the middle of the
         * array so that we can continue to "divide and conquer" the remaining elements. When two elements are left, the
         * result of the evaluation will be "1". And the element in the first position [0] will be taken as one array and the
         * element at the remaining position [1] will be taken as another, separate array.
         */
        int middle = (low + high) / 2;

        divide(a, low, middle, "low");
        divide(a, middle + 1, high, "high");

        /* Remember, this is only called by those recursive iterations where the if statement evaluated to true.
         * The call to merge() is only resolved after program control has been handed back to the calling method.
         */
        merge(a, low, middle, high, source);
    }
}

public void merge (int a[], int low, int middle, int high, String source) {
// Merge, here, is not driven by tiny, "instantiated" sub-arrays. Rather, merge is driven by the indexes of the
// values in the starting array, itself. Remember, we are organizing the array, itself, and are (obviously
// using the values contained within it. These indexes, as you will see, are all we need to complete the sort.

    /* Using the respective indexes, we figure out how many elements are contained in each half. In this
     * implementation, we will always have a half as the only way that merge can be called is if two
     * or more elements of the array are in question. We also create to "temporary" arrays for the
     * storage of the larger array's elements so we can "play" with them and not propogate our
     * changes until we are done.
     */
    int first_half_element_no       = middle - low + 1;
    int second_half_element_no      = high - middle;
    int[] first_half                = new int[first_half_element_no];
    int[] second_half               = new int[second_half_element_no];

    // Here, we extract the elements.
    for (int i = 0; i < first_half_element_no; i++) {
        first_half[i] = a[low + i];
    }

    for (int i = 0; i < second_half_element_no; i++) {
        second_half[i] = a[middle + i + 1]; // extract the elements from a
    }

    int current_first_half_index = 0;
    int current_second_half_index = 0;
    int k = low;

    while (current_first_half_index < first_half_element_no || current_second_half_index < second_half_element_no) {

        if (current_first_half_index >= first_half_element_no) {
            a[k++] = second_half[current_second_half_index++];
            continue;
        }

        if (current_second_half_index >= second_half_element_no) {
            a[k++] = first_half[current_first_half_index++];
            continue;
        }

        if (first_half[current_first_half_index] < second_half[current_second_half_index]) {
            a[k++] = first_half[current_first_half_index++];
        } else {
            a[k++] = second_half[current_second_half_index++];
        }
    }
}

I've also got a version, here, that will print out helpful information and provide a more visual representation of what is going on above. The syntax highlighting is also better, if that is helpful.

Explanation of Merge Sort for Dummies


Error syncing google calendar with iCal

Question: I am using OS X Lion, and have all my calendars (15) created in google calendar, but in my laptop I use iCal for syncing with my google calendars and working with them. The problem is that just for some of the google calendars that I edit and modify in iCal, if I create events in iCal (for the google calendars), the events dissapear past 10 seconds, although they seem to exist in google calendar. Any hints?
Comment: Does [this](https://discussions.apple.com/message/18007800#18007800) help?
Comment: the link is about alerts, but my problem is that whole events do not show up on ical while they do exist in google calendar
Comment: Is your problem related to "message with sound" (not supported by google)?
Comment: I do not know what you are talking about, can you add some link?
Comment: This is also for alerts, which doesn't sound like your problem.
Answer: In the google-forums, many people had the same issue. One answer seems to help many users, because of the number of upvotes:

I saw this earlier today and saw everyone said this was impossible.
  So, as my friend Barney Stinson would say "Challenge Accepted"

Go into iCal and export all calendars separately.
Go into Google Calendar (gCal) and create the same calendars from your iCal.
Import iCal events into the appropriate gCal calendars.
Delete all calendars from iCal. (You have them saved already so just incase it doesn't work, it won't take long to fix).
Go into iCal preferences and delete iCloud account.
While in iCal preferences, add your Google Account.
Choose the option to synchronize every minute (just so everything stays up to date).
While in the newly created account, tab over to "Delegation" and select all of your calendars, this way you can see all of them.
...You're done. You'll have to set all the colors again though. And because I may have OCD, make sure the iCal and gCal calendar colors
  match please.
Test it out! (It may not show up until you hit refresh)

You may be thinking, wait I deleted my iCloud, now my iPhone Calendar
  won't be up to date.
I fixed that problem too. Im a boss.
Here's what you do on the iPhone:

Go into Settings --> iCloud and turn off calendar.
Go into Settings --> Mail, Contacts, Calendar and create a Gmail account and choose the option to sync calendars. (Note: If you are
  using google to sync your contacts, then you're using and exchange
  account. You must keep the Exchange account to keep your contacts. The
  calendar, even though it may say on, won't sync unless you have a
  Gmail account hooked up.
Go into your calendar and if the calendars aren't selected, select them.

Source
Answer: Have you tried to see if you can replicate the issue with Mavericks? You're 2 versions behind and it's possible that this has been already addressed by either Apple or Google.
If you don't want to or cannot upgrade your computer now and have a fast USB drive of 32GB or more, you can install 10.9.2 on that, boot to it from your computer (hold the Option key while booting) and test without updating you system. There are many tutorials you can find to walk you through this step by step.  HTH
Comment: The thing is that I do not want to do the OS update. I am afraid my late 2008 macbookpro will experience some problems.
Comment: Please read my post again. I said you can install Mavericks to a blank USB drive and boot from it ***WITHOUT*** changing your Lion install. I think tje problem may be specific to Lion so this way you can troubleshoot without having to upgrade.
Comment: ok, I understand it now. I think I will have a look, thanks

Error syncing google calendar with iCal


Why did Major Nelson need to hide Jeannie from Dr. Bellows?

Question: I've been spending some time at a remote resort recently with little for company except a DVD set of I Dream of Jeannie. Why is it that Major Nelson has to keep Jeannie a secret from NASA and Col. Bellows, M.D? She is practically all-powerful, so it's not like she could be exploited by them, and you would think that people with such a dangerous mission would appreciate having a genie up their sleeves.
Comment: Whoever has the bottle controls the genie
Answer: Let's see - an astronaut has a genie that can go back and forth in time and all over the world and even in space.
Can you say, "Security risk?"
So you have that, along with two other issues:
1) Security risk
2) Threat (she can stop any weapons the US has and cause as much damage as she wants)
3) Potential weapon - if they could study her and understand why she has powers, they could harness them (or so would many think) so she'd become a lab rat.
Comment: @bitmask: Here we go back to the old argument that reality doesn't matter but perception of reality does.  Whatever her magic is rooted in, there would still be those who think they can figure out what it is and duplicate it.  Whether that's true or not doesn't matter - all that matters is if paranoid military minds think it could be true.
Comment: @bitmask Wouldn't stop the government from spending an awful lot of time unpleasantly probing and prodding her to find out that they can't.
Comment: Your third point is only valid if you assume her magic is rooted in some "advanced technology". If in that universe there is genuine magic, it might not be possible to---extract her powers.
Comment: @GabeWillard: Ah yes. Valid point.
Answer: As a non-human from another plane of existence, she's not actually a US citizen. She's actually an illegal alien.
Keep in mind: the show is set in the 1960's. And pretty much adheres to 1960's paranoia and social standards.
Her association with Major Nelson is a security risk in the (rather acutely paranoid) 1960's. Were it discovered that she was a non-human (as evidenced by her red and green blood), it would create a massive paranoid theory inspired sweep of all persons associated with government agencies.
Further, it would reveal multiple criminal actions by Maj. Nelson. At the very least, Major Nelson would be expelled from NASA. At worst, he'd be bound over for multiple national security violations, including foreign travel without authorization while on duty, multiple counts of theft, slavery, and unlawful cohabitation. It could be argued that he committed treason, even, though I don't personally think that would stick even as far as trial.
Further still, Major Healy would also be implicated as an accessory in many of the above mentioned crimes.
So, for fundamentally selfish reasons, Major Nelson needs to avoid it being discovered he's keeping an alien bond-slave in his home, and Major Healy needs to do so as well.
Then, there's the result of whatever information the Colonel and NASA gained about her. Knowing that there were genies, NASA would divert funding to acquiring more, and using them to obtain better craft, and NASA dominance in the space race.
Not to mention the dramaturgical reason: by having a nominally friendly faced superior who needs to be kept in the dark, it creates many opportunities for great dramatic and humorous moments.
Answer: According to legend (granted some legends may vary) the owner of the lamp was the master of the genie bound to the lamp, and when it comes to genie lamps, ownership can be obtained by whatever means necessary, theft by a higher ranking officer included. However in the TV show Major Nelson kept Jeannie's existance a secret not because he was afraid Dr. Bellows would take her, but rather because he feared he would have been drummed out of the Air Force and the space program for having a magic genie.
Answer: As far as alien I don't think so she's EarthBound meaning she's from Earth. Well she would be a security risk and and illegal alien I think NASA would see the benefits of having a genie at their disposal. Even though they were paranoid they will be able to observe Major Nelson in Genies actions and find out that Major Nelson Has majority of control over her. Most likely what would happen is they would all 4 Major Nelson the choice whether to get rid of Genie and send her back where she came from or leave the space program and possibly face charges of a national security risk. Due to Major Nelson's excellent see in the astronaut program he would be given some leniency. Although slavery wouldn't be a charge because he said Genie free when he first got her it's by her choice that she stayed. Most likely she would be deported or going through the process of getting her green card. However knowing how evil and messed up humanity is Kama maybe let you know soon actually has a legitimate reason for keeping Jeanne a secret. However that's assuming that Genie allows the government to do that. Remember she has the ability to make everyone forget what happened. Remember major Healey when he when they found out he had all this expensive stuff. However even the genie has to follow rules. If you remember after the series there was a movie where Heidi gave Jeanne a choice... let Tony Nelson die or Genie has to leave Major Nelson and all of his memories have to be wiped away of her get Genies cannot marry humans. But I'm going off topic here the point is it all depends but most likely there's the worst case scenario or NASA would find some use for her. Human beings are like a coin. there's heads evil and Tails good Humanity. Too bad most humans I choose heads
Comment: This answer could benefit from some paragraph separation.
Answer: Because it was the 1960's, Barbara Eden couldn't show her belly button, and it was unbecoming of an officer to live with (and own!) a beautiful, scantily clad, nubile, aryan woman that he wasn't married to. Nobody would have believed for a second that he wasn't doing what most of the male audience at the time dreamed of.
In fact, that was part of the gag, that he actually was an honest, upright, all-American hero who would never take advantage of the situation, despite the genie doing everything she could to get him to do so.
Especially because she really genuinely believed herself to be his slave, a very anti-American sentiment to be applied to a woman as described above. Do recall, this was at a time when the term "white slavery" was still in common use, and essentially meant white folks (generally women) kidnapped and sold into sex slavery- and this would appear very, very much like that.
Note that if he was merely dating her, this would likely be acceptable mostly (except the scantily clad bit). But two single folks of the opposite sex living together? Clearly living in sin. And thus unbecoming of an officer.


arcgis map address table with mobility data

Question: I have an excel table with mobility data from a few households....the columns are something along the lines of PersonID, HomeAddress, PurposeOfWay, WayNumber, StartTime, EndTime, DestinationAddress... Each person has a few ways associated with them. I would like to display this data somehow but I'm stuck. 1. person - 1. way - 2. way / 2. person - 1. way - 2. way - 3. way... and so on. I'm not sure how I should go about it? I used ArcGIS to geocode the home addresses...but what now?
Maybe someone has already done something similar and can point me in a direction?
Answer: This is a pretty broad question with a lot of sub-components that have been answered at other questions here. It might get flagged as too broad, but I'll try to give you some direction so you can either edit or come back with more specific questions.
You want to show lines on a map that represent Ways and symbolize them by person (or purpose, or number, or whatever).  You're going to need a few layers to do this, starting with a point layer of home addresses (sounds like you have) and a point layer of destination addresses.
Then you're going to need a line layer for the routes. The lines could be created yourself by digitizing, or if you have access to Network Analyst there are a couple of approaches you could take to automatically generate the lines for you. You'll need some sort of base layer of streets to follow - if digitizing yourself an ArcGIS basemap of streets would suffice, but using Network Analyst would require some line streets data (for instance TIGER data) that could be built into a network.  The digitizing yourself approach will be simplest but most time consuming. The Network Analyst approach will take more up front learning but be quicker to acutally solve/generate your lines.
The second major issue you'll face is joining your table data to your line data.  If each line is a unique route, and each record in the table is a unique route/person combination, your lines would need an attribute that could match up to that combination in the table. For example, a new field in the table that combines person and route as 1-3 or 2-5. Then an attribute in the line data with that same 1-3 or 2-5 value. With that present you can do a join/export to transfer the route information to the lines.
Comment: Hi Chris! Thanks for your answer! I know it is a pretty broad question and I wasn't sure how to word it but you captured my problem pretty well...I do have the start points and destination points...I also managed to get a roads layer. So I guess it is best to create a network dataset, generate the routes and then join the table to the routes? The tricky part as you already said is to join the table to the route. But thanks for the hints! I will try it! BJ


How to make a script auto install under Ubuntu

Question: I have pretty big assignment where I had to create some files for word frequency checks and a bash script connected with a crontab to make these function run under a specific set of folder every 5 minutes.
The last step here is to somehow compress these folders and scripts so anyone can easily install it on another computer, so some sort of auto installer for these scripts.
I'm not really sure what I should use, if a tarball can achieve this or if I need to use some sort of packet manager to be able to complete this step.
I would be really thankful if someone can explain the best way to complete this, and preferably some links to some documentation about this.
Thank you.
--
Just to clarify,
I need this to some how create the directories and subdirectories like it's looking now, and preferably have something that adds the function automaticly to the crontab record.
Answer: The proper way to do that is a .deb package. You would install the cron in /etc/cron.d/
You could also use a shar and add the commands you need to that. Or use tar, let the user extract it in a temp directory then tell them to run an installer. In that installer (which you would write) use either ordinary cp commands, or the install command.


Allow more than two analytics charts

Question: The analytics page has space for two graphs, and it helpfully remembers which two you've chosen and shows them every time you load the page. However, we're up to 12 available graphs now, and I'm interested in ~7 of them, so seeing them all involves a lot of clicking and page loads. Can we switch to a system where we can enable any number of charts and it shows all of them every time the page is loaded?
Answer: Actually...
I want one chart. I can always open another browser window to show another chart. I can even bookmark it. Two charts just makes the whole page load slower. To say nothing of the rest of the stuff on that page.
Now, I could easily envision a system that let you have anywhere from 1 to n charts, where 1 is what makes me happy and n is what gives you that warm and fuzzy feeling of total information overload. So if no one else likes my "one chart per page" idea, I'll still be happy if I can configure my own views to show less charts.
But really... I just want a page with a chart and a URL that ensures I can get back to it just the way I left it.
Comment: Get them to implement my "any number of charts" system and you have my permission to show only 1

Allow more than two analytics charts


possible link exchange and duplicate content on 2 domains

Question: I have two different domains, a forum and a blog, both about books and reviews. Tha last one is quite new, just about 2-3 months old. In the last weeks I've published several equal book reviews on both websites. For example there are two identical articles about Pride and Prejudice and the one on the forum has a link pointing to the one on the blog, saying something like "hey, this review has been published also in our blog, you can read it here".
Well, today I saw on Tools for Webmasters that both have been probably penalized since impressions on SERPS suddenly dropped down of about 50% on both sites and in the same day (6th February).
Now I got rid immediately of reviews on the forum, keeping only the ones on the blog but I'm not sure that it will be enough to make Google reconsider both domains. What should I do and how much time will it take to recover?
Answer: Do nothing and wait. If the duplicate content was really the issue then this will resolve it and your rankings will return in time. There is no timetable for this so we won't be able to give you one. But if you start to change other things then it becomes impossible to tell if this was really the issue or not and then correcting it becomes much more difficult.
Comment: What do you mean with "if you start to change other thing"? Should I stop from publishing new articles for some days?
Anyway I noticed a quite strange thing in Webmaster Tools. Since impressions dropped down, click decreased too but average positions for query searches didn't change in a considerable way. Here is a screen: [link](http://puu.sh/6OoGH.png).
Comment: As google always advise, if you have duplicate content you must use canonical. Anyway from what I understand Google will not penalised duplicate content.


Can a cyclometer be used with any bicycle?

Question: I just want to know if a cyclometer can be used on any cycle or just on those made for racing or touring. Thanks for your answer in advance.
Comment: The simple answer is yes!
Comment: All you need to do is calculate the rolling circumference of your front wheel for each bike.
Answer: The cyclometers I have owned counted wheelrevolutions by impulse of a circular lever on the cyclometer itself, most often mounted on the front fork. The impulse was from a solid peg mounted to a wheel spoke.
I have not seen such a cyclometer in the past 25 years.  Bike computers perform the similar functions, as well as others, depending on specific models.  Most bike computers operate from magnetic sensors which can be mounted or adapted to almost any cycle. Some feed the data from the sensor to a head unit mounted were it can be seen by a wire. In a few cases the supplied wire is too short to reach from a sensor (generally for pedal revolutions) to the head unit or alternative smart phone or watch read out unit.
Comment: We agree - a **cyclometer** counts wheel revolutions mechanically and can only tell you how far you've travelled.  They generally don't use batteries.   A **cycle computer** uses a magnet on a a spoke to count wheel revolutions and uses a small calculator to show speed and so on.
Answer: You can use a cyclometer or bike computer (or an activity tracking app on a smartphone such as Strava) with any cycle no matter what your riding style is.
More expensive computers use GPS to track speed and distance, but also support wireless sensors that attache to wheels and crank for speed and pedaling speed.
Less expensive ones use a sensor that attaches to the frame or fork and s small magnet attached to a spoke.


Responsive QGraphicsWidget

Question: My problem is a simple yet annoying user experience damaging one. I'm trying to display huge amounts (10 of thousands) of custom QGraphicsItems on a QGraphicsScene. I would also require a QGraphicsLayout, but to my understanding one could not simply put a layout on a scene, for that the layout have to be set on a QGraphicsWidget and then the widget added to the scene.
Now when I need to load a large number of items and prepare them to be displayed the scene just sits there empty, because I can't invalidate or repaint the aforementioned QGraphicsWidget. Only in the end it can be added to the scene otherwise any later change will not be displayed.
The goal: add some kind of layout management to scene -> {prepare an item -> add item to layout -> display -> prepare an item ->} repeat ...
But what I have: {prepare an item -> prepare another item ->} repeat ... -> add everything to layout -> set layout management on scene -> display
So the question: What way is there to create a responsive layout/container to the scene, one which repaints itself after a new child is added to it?
Answer: From Qt manual:

When the scene changes, (e.g., when an item moves or is transformed)
  QGraphicsScene emits the changed() signal.

It does not mention about addItem() and removeItem(). Hopefully, these are covered also.
If so your could apply the following:
A signal handler may "catch" the change and requests the repaint (e.g. by invalidate()) of the scene. (Un-)Fortunately, this does not immediately repaint the scene (with its parent view) but does queue a repaint event. Thus, the actual repaint is not done until the event loop is passed again.
(The event loop is part of the QApplication. If you stop your application inside a command initiated by the user interface you will find in the callstack something like this:
Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags)
Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags)
Qt5Cored.dll!QCoreApplication::exec()

)
You can force this by calling QApplication::processEvents(). (It's even static.) AFAIK, it is usually no problem if event loops are nested because they are prepared for this (as long as no non-terminated recursion is formed).
However, this probably needs some fine-tuning because too many repaints may slow down your application massively.
Comment: Thanks for the signal-slot tip, I will make use of it. Though on my problem it didn't help
Answer: Managed to find my error. It was in the custom layout I created for the QGraphicsWidget.
As the doc says on setting the layout:

All widgets that are currently managed by layout or all of its sublayouts, are automatically reparented to this item. The layout is then invalidated, and the child widget geometries are adjusted according to this item's geometry() and contentsMargins(). Children who are not explicitly managed by layout remain unaffected by the layout after it has been assigned to this widget.

After the layout has been set to the widget any new item added to it was not reparented to the widget, so they remained unaffected and not displayed.
Calling QGraphicsLayout::addChildLayoutItem(QGraphicsLayoutItem* newItem) link on every item inserted to the layout solved my problem.

Responsive QGraphicsWidget


Is it okay for a lecturer to set an assignment about the products of a company he works for?

Question: I just found out that the lecturer of an undergraduate course I'm tutoring in has given the students an assignment to evaluate a product from the company he works for.  To evaluate it, they need to read articles written by people in his company and write up a report.  They don't have alternative assessment options.  Is this okay?  It feels weird to me, but I suppose there's nothing wrong with it?  I just wish I'd known before because I would have mentioned conflict of interest to them, but we presented the papers as straight research papers (when they were actually written by the same people who sell the product).
Comment: Oh good. Thanks. It was just the secretive nature and it seemed like marketing because they'll be potential customers when they qualify (healthcare discipline), but those answers really make sense. Until I found out, I thought the assignment was really good and I suppose it still is. And no, there's nothing about assignment topics in the policy statement. So it's all good. Yay. :) It's slightly tacky though. Or maybe that's just me
Answer: It would be ethically questionable if the person who assigns the question gets to benefit from the assignment, directly or indirectly. For example, if students had to buy a product and the lecturer gets a cut of the revenue from his employer. Or if the company later uses student reports to improve the product or its marketing, and the instructor benefits from this.
On the other hand, if it's just an exercise in evaluating articles and writing reports, then what the topic really is doesn't matter all that much. After all, we give homework on all sorts of completely made up and contrived topics; why not use a real-world testcase, in particular if the instructor is familiar with it and can give actual and informed feedback? You might learn more from this example than you might if the instructor made up the documents you have to evaluate, or if you had to evaluate things the instructor is only marginally familiar with.
Comment: Yes, I think there is nothing wrong with students learning something by analyzing real companies. There is an ethical issue if the instructor stands to benefit from it. I'll update my answer by that last sentence.
Comment: "if the company later uses student reports to improve the product or its marketing" - if the homework is based upon a real-world test case, this might be hard to avoid, unless the homework is supposed to be kept secret. In my place, various assignments are specifically planned like this (to benefit an external sponsor who in turn provides equipment and context), and it is generally seen as a plus by students due to the practical experience (and possibly even professional contacts) they gain. However, students are told up-front about who is involved how, which does not seem to be the case here.
Answer: If the students are doing original work such as research on the current market or work to expand or improve the product it would be an issue. If the assignment was something simple and the professor assigned it due to his/her knowledge of the area, it's not as big a deal, but still may be ethically dubious. It's unlikely the students are specifically being exploited as unpaid labor by the professor, but it's still possible they violated the school's guidelines.
Your school should have an ethics policy or guidelines for what constitutes conflicts of interest that you can consult to see if any major rules were broken.
Answer: It is unlikely that undergraduates in the field would be contributing anything groundbreaking to the market research of the product. But if it were a graduate class, then, maybe. Based on what you've said, I assume the teacher is just teaching from something he or she knows intimately, which can often produce the best constructive feedback for his or her students.


Redis Stack Exchange how to delete or get keys by pattern

Question: I installed Stack Exchange redis client in C#.
I can only delete one key or array of keys but I don't know how to delete keys with prefix.
Or another solution can be first get all keys by pattern and then delete them. But I don't know how to get keys  by pattern too.
Answer: You can do as the following to batch delete items from redis cache. (StackExchange.Redis.StrongName v1.0.488)
foreach (var ep in _muxer.GetEndPoints())
{
    var server = _muxer.GetServer(ep);
    var keys = server.Keys(database: _redisDatabase, pattern: pattern + "*").ToArray();
    _db.KeyDeleteAsync(keys);
}

_muxer is instance of ConnectionMultiplexer
It does not delete by pattern as you asked but much faster than deleting each key separately.
Comment: How does this work in a cluster? We are getting twice as many endpoints (including the slaves) and deleting too many keys, should we filter for server.IsSlave == false ?
Comment: Haven't tried it but I think you should invoke the same servers which used in single delete methods.
Comment: Also reader should consider that there may be another databases if using cluster(_redisDatabase default is 0)
Comment: It works. One thing to add I had a problem slowing me with direct connections to master/slave nodes. For me helped disabling vpn on local machine or running the code on prod machines. IP addresses could not be resolved for some reason.
Comment: What's the DI for `_muxer`?  I am using `services.AddStackExchangeRedisCache` and tried DIing `ConnectionMultiplexer`, but it comes back as null.
Comment: I've been using this approach for old .net and am not sure how it's registered in .netcore. This may help maybe: https://stackoverflow.com/questions/56272957/what-are-the-key-difference-in-using-redis-cache-via-connectionmultiplexer-and-a
Comment: How do you get the _db ? ToArray() also doesn't seem to exist on the current version of the driver.
Comment: the database comes from the connection so presumably you can: `_db = _muxer.GetDatabase();` you can read through how it's done in the MS wrapper: https://source.dot.net/#Microsoft.Extensions.Caching.StackExchangeRedis/RedisCache.cs and it's mentioned in the docs:
https://stackexchange.github.io/StackExchange.Redis/Basics
Answer: Deletion is separate by key, unless you are flushing the entire database.
Key scanning is readily available on the IServer API, and is discussed much more here: https://stackexchange.github.io/StackExchange.Redis/KeysScan
However, it should still usually be avoided in production - that isn't the intended use-case for redis.
Comment: Your documentation link is dead.
Comment: @ErroneousFatality fixed, ta


WordPress: remove #038 from shortcode

Question: Simple example of a shortcode:
function s_print( $atts ){
    return 'http://abc.com/?foo=1&bar=2';
}
add_shortcode( 'my_shortcode', 's_print' );

And it returns:
http://abc.com/?foo=1&bar=2

This function inserts a link to page's body via shortcode [my_shortcode], but & is always changed to &#038, and this breaks the link (it's not working anymore).
I googled a lot. There are some solutions:
wp_specialchars_decode($foo);
remove_filter('the_content','wptexturize');

But those seems to be only for use in theme (functions.php) and it doesn't work for a shortcode (I tried adding it before or inside the shortcode function).
I don't want to fall to last solution, which is commenting some lines in WordPress formatting.php file because I'm working on a plugin which will be used by many people.
Answer: I had a similar problem that I addressed with the clean_url filter.  See the edit on my answer here.
It wasn't in a shortcode, so I can't guarantee it'll work in your particular situation.  Might be worth a shot though.
EDIT by oyatek
(modified solution from the link aboove):
function so_handle_038($content) {
    $content = str_replace(array("&","&"), "&", $content);
    return $content;
}
add_filter('the_content', 'so_handle_038', 199, 1);

Comment: Solution described by the link didn't work for a shortcode, but I modified it a little bit and it worked! Thanks a million! I thought it's hopeless! Let me add a solution to your answer.
Comment: In my case it worked with `clean_url` instead `the_content`. Thank you!
Answer: The fact is when you use the Visual Editor, the & will be changed to &. But if you use the Text Editor, single & followed by no character remains the same while &sth will be changed to &sth.
Altogether & will be changed to either & or &. I think the solution above:
function so_handle_038($content) {
    $content = str_replace(array("&","&"), "&", $content);
    return $content;
}
add_filter('the_content', 'so_handle_038', 199, 1);

is a sort of overkill, because so_handle_038(); decodes all &s and &s in the $content while in your case, you need to decode only those in the $atts array. Your shortcode entry is probably like this:
[my_shortcode url="http://abc.com/?foo=1&bar=2" /]

and the $atts will be:
array( 'url' => "http://abc.com/?foo=1&bar=2" )

or:
array( 'url' => "http://abc.com/?foo=1&bar=2" )

so you only need to decode $atts['url']:
html_entities_decode($atts['url']);

before you try to do anything on it.
Answer: This one was a bandaid hack which I used, basically to fix the issue in wordpress (As I had my link inside of an iFrame), I went to Bitly and created a link WITHOUT the ampersand & sign!  So finally I ended up getting a link that DIDN'T have any of the & signs but STILL pointed at the same location (Plus I got free tracking via Bit.ly for the link so DOUBLE bonus as I can check how many times the link was clicked).  Not the "Best" solution, but heck it worked for me and I didn't have to waste time trying to figure out some other solution for the & symbol in Wordpress.

WordPress: remove #038 from shortcode


Shortcut to change keyboard layout in Linux Mint (Cinnamon)

Question: I would like to have a keyboard shortcut that goes to the next keyboard layout I have "saved". Like Windows+Space in Microsoft Windows and Gnome.
Answer: This was a pain to find, but if you left-click the system icon, then choose "keyboard settings" and then "Layouts", there is an "Options..." button.  Click that, then a popup will show where you can scroll down to set the shortcut to just about anything:
Answer: Yesterday I upgraded to Linux Mint 20 from Linux Mint 18.3. After then I spent a couple of hours finding the keyboard shortcut to change the keyboard layout.
Here are the screenshots of steps to enable the preferred shortcut key to change the keyboard layout in Linux Mint 20:
Step 1: Right-click on the language flag in the Panel and click the Keyboard Settings.

Step 2: Click the option button under Layouts tab.

Step 3: Choose your preferred layout under Switch to another layout section.
Answer: The shortcut is shift + capslock in mint 19.1
Answer: I'm not sure if this is what you mean, but when you open Keyboard layouts, there are shortcuts for switching between them. Default alternative shortcut is Ctrl+Alt+K.
Answer: If, like me, you don't like any of the shortcuts on the list then you can do the following:

Install xkb-switch:

Install the dependencies:

sudo apt install libxkbfile-dev
sudo apt install cmake
sudo apt install g++
sudo apt install git

Clone the repository:

git clone https://github.com/grwlf/xkb-switch xkb-switch-master
cd xkb-switch-master/

Build and install:

mkdir build && cd build
cmake ..
make
sudo make install

Update the program cache

sudo ldconfig

Test it's working

Running xkb-switch -p should display gb (or whatever your current layout is)

Set up your desired keyboard shortcut

Navigate to keyboard settings (System Settings -> Keyboard)

Switch to the "Shortcuts" tab and select "Custom Shortcuts" under "Categories"

Press "Add custom shortcut", and set the command to xkb-switch -n

Set the shortcut you want using the "Keyboard bindings" section (I use Crl+Alt+K)

Test the shortcut to make sure it's working!

Hope this helps someone, it took me ages to find this solution.


Standard deviation around mean rather than mode or median?

Question: Why is standard deviation calculated from arithmetic mean and not from other measures of central tendency? I do get that standard deviation is to calculate dispersion, but why not use mode or median when at times it might be a better measure of central tendency. That will effect chebyshev's equation (68% of values lie within +/- one standard deviation from mean), so that is the reason or something else?
Comment: The arithmetic mean plays a unique role in the Central Limit Theorem; no other property of distributions can substitute without substantially narrowing the scope of that theorem.  See https://stats.stackexchange.com/a/3904/919 for an explanation.  Indeed, measures of dispersion about other locations are often used for specific purposes: median absolute deviation about the median (the MAD), for instance.
Comment: Carl Friedrich Gauss did this about the mode, calling the square root of the average of the square of the deviation *error medius metuendus*.  For a unimodal distribution this leads to [Gauss's inequality](https://en.wikipedia.org/wiki/Gauss%27s_inequality) which he found several decades before Chebyshev.  If we call this  $s_{\hat X}$ then [it is possible to show](http://www.se16.info/hgb/mode.pdf) that with a unimodal distribution you have $\sigma \le s_{\hat X} \le 2\sigma$.
Answer: For one, distributions more readily have a finite mean than a median or mode. Primary school analyses of these concepts for samples can obscure this issue with random variables. For the median to exist, you either require some value to have a CDF of exactly $\frac12$ (which is far from guaranteed for discrete distributions), or define how we fudge a median from values that get us as close as possible. For exactly one mode to exist, you need a unimodal distribution. For the mean to exist, you only need $\int_{\Bbb R}xdF(x)$ to be finite, with $F$ the CDF. What's more, if you want to define something analogous to $\Bbb E(X-\mu)^2$ with something replacing $\mu:=\Bbb EX$, why stop there? Do we want to define the "median-variance", for example, as the median of $(X-m)^2$, with $m$ the median of $X$? That adds further constraints, hard to fulfill and compute with,  on the distributions we can work with. Of course, finite-mean distributions don't have to have finite variance, but you only need slightly lighter tails in the distribution to fix that.
Another issue is we like to analyze the relation between two variables with quantities such as the covariance, which has a wonderful geometric interpretation I've discussed on math.se. How do you modify that concept to use something other than means? Say we keep using $\Bbb E$ as a wrapper, just to avoid another difficult question. If $m_X$ is the median of $X$, do you want to define the covariance as $\Bbb EXY-m_Xm_Y$, or as $\Bbb E(X-m_X)(Y-m_Y)=\Bbb EXY-m_X\mu_Y-\mu_Xm_Y+m_Xm_Y$? These aren't equivalent! In light of the above link, my guess is you'd prefer the second definition. But it's a really strange one, since it uses the means anyway. It'll get even worse if you replace $\Bbb E$ with a median operator or whatever you prefer, since again you won't be able to see it as an inner product any more.
Finally, means & variances just arise more naturally when you do statistical theory:

The CLT gives an asymptotic distribution for sample means; there's nothing as neat, with such minor assumptions, for the sample median. Similarly, Student's-$t$ does something nice for $(X-\bar{X})/S$.
The CGF is $1+i\mu_Xt-\frac12\sigma_X^2t^2+o(t^2)$, and you can write down something similar for the characteristic function and MGF. For discrete distributions, the PGF gives similar insights into these combined moments/cumulants.

Having said that, other measures of central tendencies can have some nice properties: $\Bbb E|X-a|^p$ is minimal for $p=2$ if $a=\mu$, but for $p=1$ if $a=m$.
Answer: I believe it is because standard deviation is the root of variance, variance is the second moment of a random variable, and the second moment is minimized when taken about the first moment (i.e. the mean) of the random variable.
As mentioned in the comments, there are dispersion metrics that are based on medians etc., but SD is necessarily based about the mean.
Wikipedia: Moment


Subset data.frames, merge subsets, and rbind for result

Question: I am attempting to find values in df2 that are within a percentage of the value in df1. These dfs are in long format and consist of the following columns / variables State (df1), ID(df2), MM, variable, and value.  I am matching MM and variable and including all values between the data.frames so that I can subset them later to select those within a percentage.
A solution for my problem can almost be found here, using merge and then subset to find the values. However, an additional bit of nuance does not allow me to use this solution as is.  df1 is ~900 rows and df2 is ~1,600,000 rows, if I try to merge all, r/my machine can't handle it.  However, subsetting each data.frame by MM and variable first and then merging, then subsetting, and finally rbinding all the intermediaries subsetted data.frames should produce my desired result.
Is there a way to subset data.frames then merge them, store result until through list of subsetted data.frames to merge and then rbind them?
I know dlply can make a list of subsetted data.frames, but I don't know if I should use to then create list back to data.frames to merge. Also, I don't know how I'd keep the subsetting and merging in order. There are up to 12 MM groups and always 4 variable groups, up to 36 subsets per df.
A for-loop or a function with a for-loop seems like it would work, but I don't know the right tools in r to make it so.
The example below performs the subset and merge for one (of up to 36) MM and variable groupings.
# for example, MM = 1 and variable = TMN
df1 <- structure(list(State = structure(c(1L, 1L, 3L, 3L, 2L, 2L, 1L,
    1L, 3L, 3L, 2L, 2L), .Label = c("AL", "NM", "PA"), class = "factor"),
    MM = c(1L, 1L, 2L, 3L, 5L, 6L, 1L, 1L, 2L, 3L, 5L, 6L), variable = structure(c(2L,
    4L, 2L, 4L, 2L, 4L, 3L, 1L, 3L, 1L, 3L, 1L), .Label = c("RH",
    "TMN", "TMP", "TMX"), class = "factor"), value = c(1.2, 2.3,
    3.4, 5.6, 7.8, 9.1, 1.3, 2.4, 3.5, 4.6, 5.7, 6.8)), .Names = c("State",
    "MM", "variable", "value"), class = "data.frame", row.names = c(NA,
    -12L))

df2 <- structure(list(ID = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L,
    3L, 3L, 4L, 4L, 4L), MM = c(1L, 1L, 1L, 1L, 2L, 6L, 3L, 2L, 5L, 6L, 6L, 5L, 3L, 1L, 7L
    ), variable = structure(c(2L, 4L, 1L, 3L, 2L, 4L, 1L, 3L, 2L,
    4L, 1L, 3L, 1L, 2L, 4L), .Label = c("RH", "TMN", "TMP", "TMX"), class = "factor"),
    value = c(1.2, 2.3, 2.4, 1.3, 3.4, 9.1, 4.7, 3.5, 7.8, 5.6,
    6.9, 5.7, 8.5, 1.2, 4.5)), .Names = c("ID", "MM", "variable", "value"),
    class = "data.frame", row.names = c(NA, -15L))

df1.tmn <- subset(df1, MM == 1 && variable == 'TMN')
df2.tmn <- subset(df2, MM == 1 & variable == 'TMN')
df1.df2.tmn <- merge(df1.tmn, df2.tmn, by = c("MM", "variable"))
# desired output example using one MM and one variable
df1.df2.tmn.sub <- subset(df1.df2.tmn, value.y < value.x*1.025 & value.y > (value.x-(value.x*.025)))

# dlply can make subsets from data.frames into a list, but
MM <- unique(as.list(df1$MM))
VAR <- unique(as.list(df1$variable))
dlply(df1, c("MM", "variable"))

Answer: From this part of your question:

Is there a way to subset data.frames then merge them, store result
  until through list of subsetted data.frames to merge and then rbind
  them?

I assume you want to keep intermediate results or intermediate computations/subsets. If that is indeed the case, you can store the intermediate results in a file (for example a .txt or .csv file) and then read the file back when necessary.
You can write a data.frame, say my_df directly into a file like this:
write.table(my_df,"filename.txt", sep="\t")

Here, the columns of the data.frame are separated by a tab, but check out the documentation on this I/O command for more detail.
Whenever you want to load all the information into a data.frame, you just use the read.table command:
newDf <- read.table("filename.txt")

Hope this can help you.


Fundamental Group of Wedge of Two Torus

Question:
This problem is from Kosniowski's book "A First Course in Algebraic Topology". I am going to follow the hint but it is not easy for me to find $C_A$ and $C_B$. Is it correct that $C_A$ and $C_B$ should be the torus minus interior of a disk? If so, I could not see how that space contractible to a point. Thank you.
Comment: Note that every manifold is locally Euclidean, i.e., each point of an  $n$-manifold has an open neighborhood homeomorphic to $\Bbb R^n$. So, $C_A$ will be a small open subset of $A$ containing the point $x_0$ and homeomorphic to $\Bbb R^2$.
Comment: @SumantaDas Ah great, thank you for your comment. Do you know some works that don't need manifold? I haven't learned manifold yet in my courses
Comment: Have you seen the construction of the torus as a quotient of $[0, 1] \times [0, 1]$ by identifying the vertical and horizontal boundaries? This should allow you to conclude the same fact.
Comment: @Rushy yes I have, thank you, I will try to convince my self
Answer: If you take the torus as $\mathbb{T}:=S^1\times S^{1}$ and pick points $y_{1},y_{2}\in S^{1}$ such that $x_{0}\notin \{y_{1}\}\times S^{1}$ and $x_{0}\notin S^{1}\times \{y_{2}\}$ then $X:=(S^{1}-\{y_{1}\})\times (S^{1}-\{y_{2}\})$ is an open neighborhood of $x_{0}$ by definition of the product topology and is contractible because $X$ is homeomorphic to $\mathbb{R}^{2}$.
Comment: thank you, I will try to convince myself

Fundamental Group of Wedge of Two Torus


What is the correct way to answer a general question?

Question: Is it considered rude to answer a question with a question?  For instance: Q. Did you eat those cookies? A. Why?
Would the correct response be "Yes I did (or no I did not), why do you ask?"
Answer: The context of the question is all important.
In your example, I suppose a direct yes or no answer would be most polite, unless the accused eater was the rightful owner of the cookies, and may possibly have more that they are willing to share.
Sometimes a question as an answer can be a polite commiseration.
e.g.
Q: Why is this train so slow!?
A: Why is the grass so green? Why is the sky so blue?
i.e. The answer here implies that the reason for the slowness of the train is unknown at this point, and worrying about it is not going to do any good.
Answer: Answering a question with a question needn't be considered rude, and is in fact used in linguistics and philosophy to better understand the subject matter at hand. By replying, "why do you ask", there can be a greater understanding between the two of you with an intent to better solve or dissolve the situation.