Override keypress method in lwuit

Question: How to override keypressed method  form in lwuit?
if suppose user press numeric 1 from keypad how can I know that user has pressed 1?
In canvas we just need to handle keypressed method. but in lwuit how to handle this method.
and which listener I have to implements?
Answer: You can override the form's keyPressed/Releaseed methods (normally you should override release!). Every focusable component has these methods as well and will receive the keyPressed/Released calls when it has focus so you can override them in component as well.
The keycode you will receive for numeric/character keys is the actual character (e.g. for your case '1').
You can register global listeners for the form using key listener/game listener in the form (addKeyListener, addGameKeyListener).
Notice that LWUIT has a "game key" concept for navigation/action buttons since the values for these buttons often differ between platforms.
Answer: keypressed is method in interface so you always override that methos in class
see this example
if you dont khow exact key code then print key code in
<code>public void keyPressed(keyCode){
System.out.println(keyCode);
}
</code>
run your program, press "1" and see output
Comment: in which component you have registered listener? can i see code?

Override keypress method in lwuit


Infinity recursive simulation on a turing machine?

Question: Do you think, that it would be possible to run a infinite and recursive simulation of the universe on an turing machine?
Comment: This is an opinion based question that does not fit with the PSE format.
Comment: This post might help, but it requires some knowledge of computer science: [Falsifiability and Gandy's variant of the Church-Turing thesis](https://egtheory.wordpress.com/2014/09/01/falsifiability-and-gandys-variant-of-the-church-turing-thesis/).
Answer: The concept of the Turing machine is a mathematical concept representing exactly that which can be computed (is 'decidable'). Therefore, the answer to that question depends on your worldview.
In a strict scientific-deterministic worldview, the world could ultimately be modeled in a mathematical model, and iterations of that model would be well-defined. Therefore, by definition, a Turing machine could implement that model.
Other worldviews may not accommodate  for such possibilities. Hume comes to mind, claiming causation cannot be proven to exist.


Apt pinning returns error message about package headers

Question: I have a server running Debian Stretch that I need to install PHP 7.1 on, which isn't available in the default repositories of Stretch, but in Testing aka Buster. I tried to use apt pinning to add the Buster repositories with a lower priority, so packages from Buster only get installed when I specify them.
I added the following to the (otherwise untouched) /etc/apt/sources.list:
# buster to get php 7.1 for nextcloud
deb http://ftp.de.debian.org/debian/ testing main
deb-src http://ftp.de.debian.org/debian/ testing main

deb http://security.debian.org/debian-security testing/updates main
deb-src http://security.debian.org/debian-security testing/updates main

And I created a file called 01-buster in the (otherwise empty) /etc/apt/preferences.d directory, with the following content:
Package: *

Pin: release a=stable
Pin-Priority: 700

Package: *

Pin: release a=testing
Pin-Priority: 650

Now, when I run apt update, I get the following output:
Hit:1 http://security.debian.org/debian-security stretch/updates InRelease
Ign:2 http://ftp.de.debian.org/debian stretch InRelease
Hit:3 http://security.debian.org/debian-security testing/updates InRelease
Hit:4 http://ftp.de.debian.org/debian testing InRelease
Hit:5 http://ftp.de.debian.org/debian stretch-updates InRelease
Hit:6 http://ftp.de.debian.org/debian stretch Release
Reading package lists... Done
E: Invalid record in the preferences file /etc/apt/preferences.d/01-buster, no Package header

Other commands, such as apt search php or apt policy return the same error.
I am 95% sure I have done apt pinning in the past successfully with exactly the same settings. Does anyone have an idea what is going on here?
Answer: Try removing the blank line between Package: and Pin::
Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=testing
Pin-Priority: 650


Are all SATA cables compatible with SATA 3?

Question: I have a HP Compaq de5700 Small Form Factor desktop computer, and I am looking to upgrade it's hard drive.  When I open up the box, it clearly has available SATA connectors on the motherboard, but no indication as to which SATA version (1, 2, or 3).  The hard drive I am considering is a  SATA 3.  My concern is that if the motherboard also supports SATA 3 and I use an old SATA cable (v1 or v2), might there be problems?  This is a bare drive, so I don't expect that a cable will come with it, and I have not been able to find the manual for this machine.  Thanks.
Answer: Yes. There is no difference in the cables. They have not changed with SATA revisions.

When the Serial ATA International Organization (SATA-IO) began design of the
  SATA Revision 3.0 specification, the designers wanted to double the interface data rate
  while enhancing support for multimedia applications − without introducing major
  changes that could adversely affect cost, increase design complexity, or reduce the
  quality and performance of the SATA interface. Key to meeting this goal is maintaining
  backward compatibility with SATA 3Gb/s connectors and cabling.

Source (pdf): http://www.serialata.org/documents/SATA-6-Gbs-The-Path-from-3gbs-to-6gbs.pdf
Answer: We were discussing this on chat - I did a little digging and both maximum PC and puget systems did benchmarks on various cables.
Maximum PC had a more interesting variety of cables and found they worked identically, even when used beyond the specified distance. Puget system tried it with a typical set of cables and found there's little difference.
Empirically, if its a to spec, non damaged cable, it should work fine even with sata 3. Modern cables are probably made to higher tolerances and should work alright. I'd go with 'sata 3' cables if I had them but for most purposes, It looks like it dosen't matter.
Comment: +1 I miss hanging out in chat!!! Very interesting and I didn't realise...  I think I will still continue to use the SATA 3 cable "as it is there" in the box (and, it would look better if people look in their machines!), but nice to know it actually technically doesn't matter.
Answer: The compatibility is not a question, they look the same and work the same as you can read in the other replies. I think the main question is whether there are speed differences between the cables.
I found 2 tests:

sata 2 vs sata 3 cables: https://www.pugetsystems.com/labs/articles/SATA-3Gb-s-vs-6Gb-s-Cable-Performance-Revisited-183/
sata 1 vs sata 3 cables: https://www.youtube.com/watch?v=AjtIKOSVpto

Apparently the sata 1 cable can support at least 3.2Gbps and the sata 2 cable can support at least 4.0Gbps. Maybe by faster speeds there is a difference, but I somehow doubt that too, since you cannot change much in these cables. If you have a quality cable I don't think there is any difference regarding to speeds or anything else.


Can we switch into SysV in a distribution which uses systemd by default?

Question: /sbin/init points to systemd hence systemd is used. Can we safely change it into the old SysV?
Comment: Yes. If you want to downgrade to a deprecated init system, you can.
Answer: Not necessarily.
According to http://without-systemd.org/ Debian Jessie loses polkit.  It's not particularly practical to run a desktop without a privilege escalation mechanism e.g. for installing updates.  (As the name PolicyKit suggests, the idea is is to allow different policies - e.g. for different groups of users, or for different Linux distributions).
I'm not saying Debian was wrong to keep it in for another release, but the problem when you take advantage of the mix&match approach, is it's hard to know what is actually expected to work.
I'm not sure if this counts as explicitly deprecating it, but this sounds like "you better already know what you're doing".

[Caution]
Be advised that some packages may have degraded behavior or may be lacking features under a non-default init system.

Server systems are much less likely to see problems in this context.
Answer: Because systemd came later, it has a mechanism to run old SysV init scripts for forward compatibility.
Packages designed for a systemd-based system may only ship a systemd-based "service" script and not a legacy "init.d" script.
I don't think SysV has a way to read systemd service files. Therefore, some services might not start properly when using the old init system.


GIMP: Lock layers to be identical

Question: I have a file I'm setting up to essentially split a background image into three parts which I can apply transformations to independently; I'm doing this by setting up three layer groups, each of which has the same base image but applies a different clipping mask. I expect to want to use this on a number of separate background images which have the same general format, so it would be nice to make the fact that the three background images are the same a specified invariant rather than doing it by hand. Is this possible?
Comment: Welcome to GDSE. You can paste new images into GIMP and Anchor them to the active layer - this won't affect the layer masks. Further than than, what you are describing  as a "specified invariant" sounds like the use of Smart Objects in Photoshop. These aren't available in GIMP unfortunately. However Krita (which is free and Open Source) has something similar called [File Layers](https://docs.krita.org/en/reference_manual/layers_and_masks/file_layers.html). You might want to take a look.
Comment: Not new, just too jaded to use a persistent account on any SE site given the toxic community dynamics its structure fosters.
Answer: my dear friend, Stack Overflow user, although I do not understand your problem well, and I hope you will give me a more description of the problem, but I think that you mean or that you want to move each of the background parts separately. If you want to do this, you can open the background in three different times each time You select the part from the background and perform a Select and Mask, then you create one file for your design and put them all in it, my dear friend, and so you can modify them all separately, my friend, with ease and simplicity, my friend. Tell me, my dear friend, if this is your problem, my dear friend. It was not your problem, so please, a detailed explanation of the problem, my friend, so that I can help you more, my dear friend.
Thanks and goodbye

GIMP: Lock layers to be identical


Why selection sort is a stable sort algorithm?

Question: One of the specifications of sort algorithms is stability, which means items with the same value in different indices are not replaced after applying sort algorithm.
Why selection sort is unstable and can we make a sort algorithm stable by changing its swap condition?
Answer: Just run an example. I will use colors to distinguish multiple elements with the same value and a $\mid$ to separate the unsorted part from the sorted part.
With the input
$\mid\color{blue}{2},3,\color{red}{2},1$
the first step will swap $\color{blue}{2}$ with $1$.
$1,\mid3,\color{red}{2},\color{blue}{2}$
The order of the $2$s changed. It continues
$1,\color{red}{2},\mid3,\color{blue}{2}$
$1,\color{red}{2},\color{blue}{2},\mid3$
So, the $2$s ended in a different order as they started.
To avoid this you can insert the smallest element of the unsorted part at the beginning of the unsorted part, instead of swapping it.
So, the first step would be
$1,\mid\color{blue}{2},3,\color{red}{2}$
The next step leaves it as it is.
$1,\color{blue}{2},\mid3,\color{red}{2}$
It continues with
$1,\color{blue}{2},\color{red}{2},\mid3$
To prove that this happens in general, observe that if an element with multiplicity is about to be moved, it must be the first element (from left to right) of that value appearing in the unsorted part. So, when it gets moved to the beginning of the unsorted part it continues appearing before all the elements of the same value appearing in the unsorted part and after all the elements of the same value that could already be in the sorted part.


Configuring the Ports of an AVR Microcontroller for SPI Use

Question: I am trying to configure the an ATtiny84A for use with SPI, but I have some confusion with what Is being said in the datasheet for configuring the ports. The ATtiny84A has, what the datasheet calls, "alternate port functions", so each port can have multiple functions. In my case with SPI, the pin that serves the SPI Clock also serves the ports GPIO functionality, an ADC, the clock for I2C, among others (as seen on page 64 of the datasheet: Port A, Bit 4).
What I understand from what its saying in the datasheet, is that it somehow automatically configures the port when a functionality is set. So what happens if I try to configure multiple of these port functions at a time? For example, what if I configure the ADC on port A4 and SPI which has its clock source on port A4? I can't find a table which explicitly states how to configure the port which enables or disables other functionalities, so I imagine that some sort of function priority is taken?
Furthermore, where is the information on setting the direction register to allow the SPI clock through? This confuses me, because like I said, the datasheet seems to say that the port is configured automatically; however, for me to pipe the clock through port A4, I must write a 1 to the direction register (set it as an output) for the clock source to come out, but I cannot find any information in the datasheet to back up this behaviour.
Here is some sample code for getting a continuous clock to come out of the SPI clock port:
<code>USICR   |=  (1 << USIWM0);  // Set Bit 4 (USIWM0) of the USICR register
USICR   &=~ (1 << USIWM1);  // Clear Bit 5 (USIWM1) of the USICR register

USICR   &=~ (1 << USICS0);
USICR   |=  (1 << USICS1);
USICR   |=  (1 << USICLK);  //Sets USITC as the clock source for the 4 bit counter.

DDRA |= (1 << DDA4); // Configure PortA4 as an output?

while(1)
{
    USICR |= (1 << USITC); // Toggle the SPI clock output.
}
</code>
EDIT: I'll summarize the information which I am specifically confused about/don't know what to do with from the datsheet:
Table 10-2, page 60: I am unsure what the purpose of these overriding signals are when configuring alternate port functions.
Table 10-5, page 64: I see the USI clock in this table, but I don't know what the rest of the information that it contains is telling me. I see that USCK is in the DI row, but I don't know what that is telling me for the configuration of the port.
Comment: You may need to give the exact link to the data sheet you're referencing. There have been a number of revisions and there are a few different forms of each the data sheet. On the newest datasheet (from MicroChip.com)  I don't see the items you're referencing
Comment: @Nedd good point, it appears the data sheet I have is a different version. I'll update the question with the page numbers and tables numbers from the data sheet currently listed on microchips page for the ATtiny84.
Answer: I believe this is the answer you are looking for. It's at page 130.


Is it possible to upload Image to a website from Safari on iPhone?

Question: I'm trying to upload a photo from my iPhone to a website. However, the browse button to display the select file dialog is disabled. Normally this works fine on my HTC Mobile and all Android Mobiles. Should I be able to select image files to upload from Safari on iPhone?
Answer: This is not available prior to iOS 6. Since iOS 6, the select file button will open the typical select from library / take photo or video view.
Answer: I checked some website and it seem to only allow you to upload files that is stored inside the Photo Library (I am running iOS 6 for this). The thing with iOS is that there is no file system type behaviour that you normally find on a Windows and Android environment. Hence that explains why you can do it on your HTC but not on your iPhone.
If you need more information, this blog here explains how iOS 6 handles file upload.


Refraction of sound atomic level

Question: how the refraction of sound and the change in the angle of propagation can be explained at the atomic level, why the direction of propagation of molecules changes in different media?
Comment: Sound isn't an atomic level phenomenon.
Comment: To follow up on the previous comment, sound waves (by, essentially, definition) are *long-wavelength* waves, long-wavelength defined as "much larger than the interatomic spacing". That said, if you go from one medium to another, the molecules and their interatomic forces change, and so the "spring constant" of the "springs" connecting the molecules and the mass of the molecules change, and so the speed of sound (given schematically as $\sqrt{k/m}$, with modifications due to lots of springs and atoms) changes. A changing speed of waves causes refraction.
Comment: Also, the direction of sound propagation had nothing to do with "direction of propagation of molecules". There is no such thing in a sound wave.
Comment: I'm don't get this yet. I'm thinking i'm little confused . When a sound wave pass for example to air for water the angle of propagation changes . Why this happens . Maybe there will be a change in momentum . Like some parts are interfered destructively and other parts constructively . If there is happening how can explained with classic mechanics ? . When i refer momentum it's because i'm think in colision beteween molecules , and maybe some these colisions soffer interference, and for this the angle of propagation changes
Comment: Could you describe a sound wave when the medium comprises, let's say, 5 molecules? If you could do that, you would be one step closer to solving your problem. The hard part here is that sound is described as the "behaviour" of a bunch of molecules and not just 10 or 20. Good luck with describing the molecule movement for 5 molecules reaching a wave equation-like solution. It won't happen due to thermal/Brownian "noise", on the contrary, when you consider a large number of molecules this averages out. This is what others defined in their comments about sound **not** being an atomic phenomenon.
Comment: So with that in mind, you shouldn't treat sound down to the atomic level, because this is **not** what sound is.
Answer:
how the refraction of sound and the change in the angle of propagation can be explained at the atomic level, why the direction of propagation of molecules changes in different media?

Sound is a molecular phenomenon. Molecules of air move and collide and momentum is conserved.
When sound passes from air to water, the speed of the sound wave increases since sound travels faster in water. But if the wave front hits the surface of the water at an angle then the leading edge of the wave will hit the water first, and begins to travel faster than the trailing edge of the wave still propagating through the air. This speed difference causes the wavefront to change angle until the full wavefront is in the water and then the wavefront will move with same velocity and continue in a straight line until next interface. Different materials have different speeds for sound so the refraction angle will be material-dependent.

Refraction of sound atomic level


How to upload the site template in SharePoint 2013 sub site?

Question: I need to upload a site template in a subsite, and I need a clarification about whether site template covers the web parts also or not? I referred this link https://msdn.microsoft.com/en-us/library/office/jj938033.aspx but I need more clarification about the same?
Answer: I guess you have gone through the link and you know what the link is all about.
I am just trying to add some couple of points into it. If you save your site as template with including content then it will also contains all the lists and custom WebParts.
But if your site is publishing site or you have activated the publishing site feature then you need to deactivate this feature first and then try the same.
It will back up all your Lists and WebParts
Please refer this answer and comment  for more detail.
Comment: cool, that's fine how can we upload that site template into the subsite?@TrimantraSoftwareSolution
Comment: have you gone through https://support.office.com/en-us/article/Create-and-use-site-templates-60371B0F-00E0-4C49-A844-34759EBDD989 ??


Analyticity of a function

Question: Does this definition contain redundancy: "A function $f$ is said to be analytic at $x_0$ if its Taylor series about $x_0$ exists and converges to $f(x)$ for all $x$ in some interval containing $x_0$". Is anything missing in the following definition: "A function $f$ is said to be analytic at $x_0$ if it has derivatives of all orders at $x_0$".
Answer: You can think about the definition of an analytic function (at $x_0$) as consisting of three parts:

The derivatives of $f$ of all orders at $x_0$ exist. This is equivalent to saying "The Taylor series around $x_0$ exists" (because to define the taylor series around $x_0$, you need to know the derivatives of all orders at $x = x_0$).
The Taylor series converges. This means that the Taylor series has a positive radius of convergence. Even if the deriatives of all orders at $x = x_0$ exists, this doesn't mean that the Taylor series will have a positive radius of convergence (see Borel's lemma).
The Taylor series converges to $f$. Even if the Taylor series has a positive radius of convergence, it might converge to a function different than $f$ as it happens in the examples provided in the other answers.

Your attempt of simplification only captures the first part.
Comment: This reminds me of the standard elementary calculus definition of continuity at a point. The function has to be defined at the point, the limit of the function has to exist at the point, and these two values have to be equal.
Comment: It might depend on how you define "the Taylor series converges", not how you define the Taylor power series (as a formal series). Taylor's theorem helps us to relate the Taylor polynomials to the original function but it doesn't force the remainder to go to zero for the series to converge. The Taylor power series can converge without the remainder (as in, the difference between the Taylor polynomials and the function, not the tail of the Taylor series) going to zero. This is precisely what happens in the examples below.
Comment: This is probably splitting hairs, but I feel like saying "the Taylor series exists" is saying it is analytic, since in Taylor's theorem we need the remainder term to go to zero for the series to converge? I guess this all depends on how you define the "Taylor series".
Comment: The Taylor series converges to the zero function and the remainder which we expect to go to zero converges instead to the original function.
Comment: @charlestoncrabb, the Taylor series as a formal power series is a useful tool to handle all derivatives at once, even if does not converge or not to the function.
Answer: The function $\begin{cases}e^{-\frac{1}{x}}&x>0\\0 & x\leq0\end{cases}$ has derivatives of all order at $x_0=0$, but this function is not analytic. If it were analytic, then a power series would converge to identically zero, since $f$ is identically zero for $x\leq0$.
Answer: $x\mapsto f(x)=\exp(-1/x^2)$ extended to $f(0)=0$ has all its derivatives equal to 0 at 0 so it cannot be equal to its own Taylor series in any interval around 0.

Analyticity of a function


Why is a recurrence of $2N_{h-2}$ equal to $2^{h/2}$?

Question: I was watching video 7. Binary Trees, Part 2: AVL, where professor Erik Demaine stated that $$2N_{h-2} = 2^{h/2\text{ (or maybe with floor or something... maybe it's ceiling)}}$$ where $N$ stands for the number of nodes in a subtree of height $h-2$. Can someone explain me in more detail why this recursion can be solved like this?
Comment: Does this answer your question? [Don't understand one step for AVL tree height log n proof](https://cs.stackexchange.com/questions/27899/dont-understand-one-step-for-avl-tree-height-log-n-proof)
Answer: In the lecture it was shown that $N_h \geq 2N_{h-2}$. You can obtain the bound of $2^{h/2} $ for this recurrence by continued expansion of the r.h.s., also called unrolling the recurrence. E.g. :
$N_h \geq 2N_{h-2} = 2 * (2N_{h-4}) = 2*(2*(2N_{h-6})) = 2(2(2(...(2N_0)...)))$.
This expansion will continue until you reach $N_0$, which is 1, I think since the tree with height 0 has only the root. The number of times you can subtract 2 from $h$ is at most $\lceil h/2\rceil$, which is also the number of 2's in the expansion. Thus you have $N_h \geq 2^{\lceil h/2\rceil}$.
Answer: Let $N_h$ denote the minimum number of nodes in a height-balanced tree of height $h$.  Given a height-balanced tree of height $h$, without loss of generality assume the left child of the root has height $h-1$.  The right child must have height $h-1$ or $h-2$, and to get the smallest possible values (the worst-case), assume it has height $h-2$.  Then, the number of nodes in the given tree is at least $N_{h-1} + N_{h-2} + 1$, because there are at least $N_{h-1}$ nodes in the left subtree of the root, at least $N_{h-2}$ nodes (in the worst case) in the right subtree of the root, and the root itself contributes 1 to the count of number of nodes.
Thus, we get that $N_h \ge N_{h-1} + N_{h-2} + 1$.  One can pay attention to constants and show the terms $N_1, N_2, \ldots$ grow at least as fast as the Fibonacci sequence. The $h$th term of the Fibonacci sequence is at least $c \psi^h$ for some constant $c$ and the golden ratio $\psi$. Hence, the terms of the sequence grow exponentially fast.  This can be shown to imply  that $h$ is at most $1.44 \log n$, and so we get that $h=O(\log n)$ for a height-balanced tree with height $h$ and $n$ nodes.
But, in asymptotic analysis, you can be "sloppy" and ignore constants, and it suffices to use the fact that $N_{h-1}+1 > N_{h-2}$ to get that $N_h \ge N_{h-1}+N_{h-2}+1 > N_{h-2}+N_{h-2}$. Thus, we have $N_h > 2N_{h-2}$. This means the terms of the sequence $N_1, N_2,\ldots$ grow fast enough that they at least double every two terms: $N_3 > 2N_1$, $N_5 > 2N_3 > 4N_1$, and in general, $N_h > N_1 2^{h/2} = N_1 (\sqrt{2})^h$.  This implies that $h < 2 \log n$, and so $h = O(\log n)$.
In general, to show $h=O(\log n)$ for a height-balanced tree, it suffices to show that the number of nodes $n$ grows exponentially with $h$.  The crude analysis given above is good enough to obtain this result.


How to encourage my Alocasia xAmazonica to make new offsets?

Question: My Alocasia xAmazonica has gone through its second winter and is expected to break dormancy soon.
It has got many new leaves throughout latest growth season, but at the moment just three remained.
I also noticed its tuber has grown partially above the soil surface. Should I plant it deeper during the growth season? Will this encourage my Alocasia to offset? I am planning on dividing the tuber.
Answer: Production of offsets is a normal process which happens when the mother plant is growing vigorously and has proceeded beyond the juvenile stage and has progressed to flowering and a degree of maturity. So all you really have to do is keep it growing vigorously, giving it space to grow and flourish.
As with other plants that produce underground storage organs there is a risk that these corms, tubers and other thickened roots will displace soil and even though you appear to have lots of soil available there might be much less. Learn how to turn the plant out of its pot so that you can visually examine that the root ball is not too crowded. This will allow the whole plant to be more vigorous and produce the offsets you seek.


Here's The CA Animation Sequencing Sitch

Question: I asked a question (Animation Sometimes Doesn't Occur) a while ago about an animation not, apparently, happening sometimes. I got no helpful answers. So, after much research and playing around, I discovered that sometimes the animation that is supposed to happen second, sometimes happens first. The other one does happen, just not when it is expected to happen. The two animations are "flip" and "disappear." As an example, there are four tiles. When one tile is touched, it flips. When a second tile is touched it is supposed to flip. If the tiles match, both tiles are disappeared. If they are not matched, the tiles flip back. The flipback animation has always occurred correctly, so far as I have been able to tell. In other words - the first tile is flipped. The second tile is flipped. The tiles do not match. The two tiles flipback. As for when the tiles match, the first tile flips correctly. Sometimes the second tile flips correctly and then they both disappear (animation group of rotate and shrink). Sometimes the second tile does not flip correctly, but they both disappear before the second tile does its flip. This is not acceptable.
This is what I have tried so far - I have tried NSThread pausing. That didn't work because the whole thread was paused, which didn't let the animation that hadn't occurred occur. I looked into NSTimer - but the method that is being called has two parameters which means I have to do NSInvocation and I haven't figured that out yet - and not sure it would work. Right now, I have put in a flag that marks when flip animations are completed. If this method eventually works, I have to figure out how to account for flipping individual tiles over and back again without upping the completion count. Anyway - using this method, I need to figure out how to tell my second animation to wait until the first animation is completed before running.
What I would ideally like to be able to do is to tell the disappear animation to always wait until the second tile is completely flipped before committing.
What I can't figure out is a) why sometimes the animations happen in the correct order, sometimes they don't and b) when the animations are trying to not happen in the correct order, how to force them to occur in the correct order.
Not really sure what code would be helpful for you to see. Ask and I shall provide!
Here is the code that calls the animations:
<code>-(void)buttonPressed: (UIButton*)buttoni
{
    [self flipTiles:(UIButton *)buttoni];
    [self twoTilesFlipped];
}
</code>
Clearly, the flipTiles animation is called first. What I don't understand is why it sometimes isn't called until after the code that is called in twoTilesFlipped. I thought that programming was about logic and this just doesn't make logical sense to me. Oh, I just had a thought...I am going to put in a NSTimer delay in this code - maybe that will do the trick!
Answer: That seems to have done the trick. There are some tweaks that I obviously need to fix now, but at least it works everytime.
This is what I added:
<code>[NSTimer scheduledTimerWithTimeInterval:2.0
                                     target:self
                                   selector:@selector(twoTilesFlipped)
                                   userInfo:nil
                                    repeats:NO];
</code>
so the final code for the method was:
<code>-(void)buttonPressed: (UIButton*)buttoni
{
    [self flipTiles:(UIButton *)buttoni];
    [NSTimer scheduledTimerWithTimeInterval:2.0
                                     target:self
                                   selector:@selector(twoTilesFlipped)
                                   userInfo:nil
                                    repeats:NO];
}
</code>


In Elder Sign, if you need to draw from a deck and there are no cards left, do you lose the opportunity?

Question: There don't seem to be a large number of spell cards, and Dexter Drake can accumulate cards very fast.  If the spell deck (or any other deck for that matter) runs out, do players simply lose the privilege of gaining a card in cases that award them?
Answer: If there are no cards left, then you do not gain anything.  Ideally, you should be making use of these cards as often as possible to ensure that future gains do not get wasted due to not having cards available.
(Remember that all discarded cards go immediately to the bottom of their appropriate decks -- so you may want to spend spells freely in encounters that have spells at stake -- they'd then be at the bottom of the deck, and available as part of your reward.)
Exact quote from page 13 of the rules:

After all dice on a Spell card are removed, the player returns the
  card facedown to the bottom of its deck.
Comment: I believe this answer is incorrect.  OP, please reconsider.
Comment: Hmm.  It seems you are correct about the face-down part after all.  My apologies - we have been playing it like Eldritch Horror for years (since before Eldritch Horror came out).  Your answer is still partially wrong then, though - you still can't run out of cards in a deck.  The deck will cycle without shuffling in that case.
Comment: You can run out of cards, with an extremely dedicated crew, by having someone (like Dexter Drake) get overzealous about spell collection, and hoard to the point of not using his spells fast enough to get them back in the deck.  This is why my answer also suggests that you should use spells in this situation,
Comment: Oh, I get it.  I misunderstood the entire point of this question.
Comment: No worries.  :)  As I read the question, it's basically "If the players currently have every spell card sitting in front of them, what happens if they would get more?", with my answer being "They get nothing -- so consider freely spending spell cards on such encounters so you get them back immediately!"


Looking for an old Japanese UFO film

Question: I am looking for an old Japanese UFO film in which a little girl named KAYO comes to Earth in a UFO which looked like a golden egg. Then a family takes her to their home and she grows up with them. One day the aliens come to Earth and take her back to space and ...
Comment: Do you have any time-frame in mind? Is this live-action or animated? Also: and...?
Comment: @Shisa "... and they all lived happily ever after", I'm assuming
Answer: "Princess From The Moon" (1987)
Per Wikipedia:

One day wood cutter Taketori-no-Miyatsuko (Toshiro Mifune) discovers a
  baby girl while he's out in the forest visiting his daughter's grave.
  Not wanting to leave the infant to die and because of her resemblance
  to his dead daughter, he takes the child home with him- only to
  discover that the child grows at an extraordinarily fast rate.
  Incredibly beautiful, the now grown child Kaya (Yasuko Sawaguchi) attracts the attention of everyone around her, including the land's
  Emperor. Unwilling to accept their advances, Kaya gives the men a list
  of increasingly difficult tasks. By the film's end Kaya returns to
  outer-space by way of a space ship.
Comment: my good friends,
that was the very exact name of the movie. thank you very much for your help.

Looking for an old Japanese UFO film


Sharepoint Workflow - Due Date

Question: I wish to know if the task due date for the pre-built Approval Workflow, can have email reminders once the date is approaching. (Without using Sharepoint Designer) Lets say the DueDate for this approval is tml, can I ask sharepoint to send a reminder email to the task person to remind him to approve this task?
Answer: This doesn't exist OOB but you can use Information Policy settings to start a workflow based on a reminder date.
Laura has already done this for you: Workflow- Reminder Before Due Date – MOSS vs. WSS.
Post is in SP2007 but should be applicable for SP2013.
Comment: +1 For mentioning Laura a.k.a. godess of SharePoint

Sharepoint Workflow - Due Date


how to follow python polymorphism standards with math functions

Question: So I am reading up on python in Mark Lutz's wonderful LEARNING PYTHON book. Mark makes a big deal about how part of the python development philosophy is polymorphism and that functions and code should rely on polymorphism and not do much type checking. However, I do a lot of math type programming and so the idea of polymorphism does not really seem to apply--I don't want to try and run a regression on a string or something. So I was wondering if there is something I am missing here. What are the applications of polymorphism when I am writing functions for math--or is type checking philosophically okay in this case.
Answer: You are certainly allowed to do input checking. In some languages, you might check input arguments to make sure they are the appropriate type (i.e., they are of the right class). However, in Python, it is often preferred to check whether the input exposes the necessary capabilities. This is sometimes called Duck Typing, after the maxim that if something walks like a duck and quacks like a duck, it's probably a duck--or at least something that a duck processing function should be able to handle.
To give you a more concrete example, suppose you are writing a function that calculates the mean of a list of numbers. Instead of checking whether the parameter is, in fact, a list, check whether it is iterable (or even better, just try to iterate over it and throw an exception if not). This lets your function work for lists, tuples, sets, files, values from databases, and even as-of-yet-uninvented objects that store collections of numbers. On the other hand, you are certainly allowed, and even encouraged, to do domain-specific checking. If your code receives mathematically nonsensical values (e.g., negative probabilities), it probably should throw an exception or somehow signal an error.
Overall, The Python philosophy seems to be "check as much as you need to, but no more. If the caller does something strange, it's at least partly their problem (like regressing on a string). That said, these are guidelines, not hard and fast rules, so use common sense.
Comment: Ahh this is nice. I get what you are saying. So I want to make my function capable of dealing with useful numeric inputs that might be passed in different ways. So that makes sense. I come from using R quite a bit, and there is a lot of type checking in many of the packages--they want inputs passed in very specific ways, even if those inputs are sometimes a singleton matrix. So this seems to make a lot more sense. Thanks.
Answer: The point of polymorphism is that if you write a regression function for, say, Python's built-in numeric types, someone else can use it with NumPy or some other numeric library and not think about it. You don't even have to know about the existence of such libraries to be confident in writing your code correctly. Just use the natural language structures, and leave it to whoever makes the next big numeric library to ensure their numeric types can be operated on normally, their lists and sequences can be iterated over by for loops, etc.
Breaking polymorphism to defend against sloppy coding or to enforce a certain use of your library doesn't really gain you anything. But it might restrict future users of your code for no good reason.

I was wondering if there is something I am missing here

Not missing anything, but maybe overcomplicating things. You write a function that takes the arguments you want, and document it accordingly. That's it.

I don't want to try and run a regression on a string or something

Neither you nor anyone else should be passing a string into a regression function. Who would do that? Code should not be doing anything by accident — if it is, you're just programming by guesswork, which is doomed to failure in any language.

is type checking philosophically okay in this case.

The answer to this is almost always no.
The general philosophy of Python is that you assume the other people using your code are going to be sensible about it — because if they're not, there's really nothing that will help. No type system, no checks, no built-in language features can defend against someone mashing their face on the keyboard and calling your function with the result.
The overarching reason is this: Python is designed for writing concise, expressive, readable code with a minimum of boilerplate. If you manually add in all the boilerplate yourself, you're defeating the point. So just relax and use the language to express your ideas as neatly as possible :)
Comment: I think I get it. So there is a compromise between accepting valid numeric inputs that enter in different types of containers, versus trying to catch every possible type of error. That helps a lot. Thanks.
Comment: @krishnab - Yep. Just document the requirements for your code, and read the documentation of others, and you should be fine. Sometimes you'd consider raising a `ValueError` on certain kinds of invalid inputs, eg. trying to do a std dev on a list of one. But those are fairly rare cases, and aren't so much to do with type checking as input validation.


Place digits from 1 to 7 into each row and each column of the grid once. Numbers in the circles give the product of the four surrounding digits

Question:
What is the way to resolve the following puzzle?

Link to source. It's from a taiwanese math olympiad held in 2005.
Comment: Hi Grace, and welcome to Puzzling :) Where did you find this puzzle, please? If you can mention its source at the bottom of the post that will help us to credit the original puzzle creator and satisfy our plagiarism policy... Thanks!
Comment: Is the OP active?
Answer: Here's another answer for the sake of detailed solving path.

 First to notice is the columns 4-5 and rows 3-4, each of which fully contains three disjoint cages. Note that the product of each row or column is $$7! = 5040 = 2^4 \times 3^2 \times 5 \times 7$$ so two rows or two columns should multiply to its square. For columns 4-5, dividing it by $168 \times 120 \times 84$ gives $15$, which means R3C4-5 should contain a 3 and a 5. Likewise, R3-4C7 should contain a 3 and a 7. But since R3C4-5 is a naked pair, we can determine that R3C7 is 7 and R4C7 is 3.

 The second 7 in R3-4 should go in the 105 cage, but 120 is not a multiple of 7, so there is only one place it can go. And a similar logic applies to 3 in the same cage.

 The remaining three cells in the 60 cage have the product of 12, but without including the number 3. So it must be (1, 2, 6). There's only one place in R5 for 7, the 7 in R6 must go inside the 84 cage, and then the 7 in R7 is also decided.

 Another logic can be drawn from C1-2. Dividing $7!^2$ by 192 and 36 gives $1 \times 3 \times 5 \times 5 \times 7 \times 7$, which precisely defines the six numbers outside the two cages. Then all numbers inside 192 or 36 are even except for a single 1 and single 3, none of which can belong to 192. So both go in 36, and the other two numbers are 2 and 6. And similarly the product of six cells outside 168 and 24 on R1-2 is $2 \times 2 \times 3 \times 3 \times 5 \times 5 \times 7$. If the R1-2C1-2 contains (1,3,5,7), then the product of R1-2C3 is 60, which is impossible. So the corner must be (3,5,5,7). This gives a lot of progress with Sudoku logic.

 More progress, combined with the fact that additional 3 cannot go into 120.

 More progress at the top. Also, the 84 cage cannot contain any 2, so the only possible combination is (1, 3, 4, 7).

 The rest of the puzzle is solved easily.
Answer: The completed grid will look like this:

Answer: Here is what i got (Please forgive the editing I did it in MS Paint from my grandparents' laptop)

Method of solving

Started off with the top right column and calculated the possibilities for each of the circles   (Wavy curve method and Prime Factorisation) and got the values for each of the boxes


How would I create a regular expression to match all of Cardano's public wallet address formats?

Question: Can anyone help me in creating a regular expression to preg_match (php) all of Cardano's public wallet address formats?
Comment: What have you tried so far? Can you share your progress? And could you give some examples of the different address formats you try to match with your regex?
Comment: Well i know there are 2 address types. The Byron which start with Ae2 and DdzFF. The second address and more recent type starts with addr1. Not sure of the min and max length of these addresses. Can't find much about it.
Answer: A regex itself isn't capable of validating if an address is valid or not. You need to have a little more logic. Probably what you're looking for is something like from_bytes/from_bech32/from_base58 utilized in this library: https://github.com/Emurgo/cardano-serialization-lib/blob/master/rust/src/address.rs
If you really need it to just be a regex, shelley addresses are pretty easy to validate in bech32 format, it's addr1[a-z0-9]+ and byron addresses are base58 encoded [1-9A-HJ-NP-Za-km-z]+. But neither of these ensure the address is accepted by the blockchain, it just loosely restricts the character set accepted.
Comment: Is something like this available in golang?


Sci-fi book; nuclear bomb destroys the Panama Isthmus

Question: Book probably from between 1950 and 1980. A nuclear bomb destroys the Panama Isthmus. The Gulf Stream stops, disastrously changing the world's weather.
Comment: It's not the one you're looking for, but the Isthmus of Panama was destroyed (by a volcanic eruption) in ["Shifting Seas" by Stanley Weinbaum](https://archive.org/details/Amazing_Stories_v11n02_1937-04/page/n115/mode/2up?view=theater).
Comment: In John Barnes's _[Mother of Storms](https://en.wikipedia.org/wiki/Mother_of_Storms)_  (1994) there is widespread destruction after a nuclear detonation in the Arctic causes catastrophic weather and a lot of the action moves to Central America.
Comment: Do you read German? The Panama Isthmus was blown up in Hans Dominik's "Atlantis" (1925, so quite a bit before your time frame, but then Dominik's books were still popular long after WW2, and new editions were sometimes edited to make them appear more contemporary, and to remove some of the more over racism). Gulf stream is diverted, but the world saved by miraculous ancient technology. Not sure that the book has ever had a translation, though.
Comment: Thank you for your your answers. The book I was looking for is Schoonover's Central Passage.
Answer: Central Passage by Lawrence Schoonover, published in 1962.

Annoyingly I cannot find my copy to provide supporting quotes, but I managed to find a review in P. Schuyler Miller's article The Reference Library in the July 1962 edition of Analog:

As a matter of fact, the gimmick in "Central Passage" is a good one and relatively new in non-SF circles. The "20-Minute War" of "Central Passage" - which is touched off by a prestige-seeker in a Red satellite - destroys seven hundred miles of the Isthmus of Panama. The Gulf Stream begins to pour into the Pacific, instead of circling back to warm the coasts of North America and Europe, the clouds of dust and steam from the holocaust shut off the sun's radiation, and the world is in for another Ice Age.
In the early part of the book the author follows the fortunes of two families: the Youngs - American Navy, stationed in Panama but fortunately in Jamaica at the time of the touch-off, and the Bolducs - Gaspesian fishermen with a tradition that may go back before Columbus. The fortunes of Narcisse Bolduc, his wife, and their ten children as they make their way from the Gaspe down the ruined coastline of the United States to the stub-end of Guatemala, where an international task-force is trying to replace the isthmus, are especially interesting, if unsurprising to Old Holocaust Hands like the readers of Analog.
Meanwhile the author has been dutifully, if not very subtly - to us OHH - planting clues to the Big Shock that is the theme of the last third of his novel, "The Intruders". Little Bill Young Jr., born at the very moment of the Panama burst, is incredibly precocious. So, it appears, is Angelique Bolduc, born as the radiation from the bombed cities of Canada began to bathe the Gaspe. They have brown eyes, they see the ultraviolet spectrum - another of the author's points that is precisely the reverse of what he intends - they are telepathic and extraordinarily intelligent, they mature at a terrific rate. They are "Homo Supersapiens" and in the final chapters their parents see them hunted down and murdered in cold blood.
Comment: Thank you. Central Passage is the book. I can't believe I remember do little of it. I'll have to find a copy to re-read.
Answer: While I don't think that this is the book you remember, I have to mention the 1925 novel Atlantis (German Wikipedia) by the German classic SF writer Hans Dominik. It explores exactly the idea that large explosions (meant to widen the Panama Canal) destroy the Isthmus, leading to a rerouted Gulf Stream. This may well be the first time this idea was explored. I'm paraphrasing the German Wikipedia page here:
Through a mixture of intrigue, scheming and sabotage, the planned widening of the Panama Canal by gigantic explosions is performed in a dangerous fashion, braking up the Isthmus between the Americas. The gulf stream is rerouted and a panic ensues in Northern Europe. A mass exodus threatens a decline of the white race. The damage is reverted though by the heroic deeds of a German with telekinetic powers, who also raises Atlantis in the process.
I enjoyed reading Hans Dominik 50 years ago. When I was revisiting some of his work as an adult though, I found it rather unpalatable. While I'm all for making heroes of engineers, the second underlying theme that's driving the stories is his chauvinism. Some of that had been edited out in the editions I was reading back then; being confronted with it in newer editions spoiled the experience.
Comment: Dominik was way ahead of his time.  [Project Plowshare](https://en.wikipedia.org/wiki/Project_Plowshare) was a legitimate US program to explore using nuclear bombs for peaceful uses, and had sereval proposed uses - including widening the Panama canal.  OTOH Raising Atlantis? Hmmm.
Comment: Thank you. Dominik sounds quite interesting. The book I was looking for is Schoonover's Central Passage.
Comment: @PeterM He sure was.


SafeBrowsing domain vs. url distinction

Question: Does SafeBrowsing actually work with the URL paths or does it only look at the domains? If it is just the domains, does it also look at the subdomains or are the results for example.com and x.example.com going to be the same?
Answer: The details of Google's SafeBrowsing request can be found in their API documentation, which is freely available here.
On this page, the URL expected is described as "valid URL string following the RFC 1738", or more verbosely:
The url parameter indicates the URL to look up. This must be a valid and properly encoded URL. Non-ASCII characters must be in UTF-8. For example, if the URL contains an '&', it could be interpreted as the CGI parameter separator. Therefore, all reserved characters must use percent encoding, which is defined in RFC 3986 .
Therefore SafeBrowsing works with the full URL (which does not mean that, seeing too many suspicious URL matching the same domain, it may not internally flag the domain itself as suspicious, but this is Google's internal recipe and I doubt any official public information is available on the exact algorithms they use).
Comment: I checked the documentation, but wanted to know what actually happens. As far as my limited experience goes, there is a blanket blacklisting for the entire domain. So I wanted to know what the experts think

SafeBrowsing domain vs. url distinction


Turn off vibrate when charging wirelessly

Question: When I place my compatible iPhone on a wireless charger, it slowly falls off the charger over time as vibrations come in from messages. I appreciate the notification, but not if it will cause the phone to eventually fall off the charger. Are there any other options besides (1) manually turning vibrate mode to ring, which sometimes vibrates anyway, or (2) manually activating Do Not Disturb?
Comment: You might consider suggesting this to Apple as feature request here: https://www.apple.com/feedback/iphone.html
Answer: Build a stockade.
Cabinet maker's supply stores sell stick on bumpers that are used to keep wood hitting wood on cabinet drawers and doors.
The set below is from Lee Valley Tools.
Stick them on the edge of your charging device so that it can't crawl off, and then let it skate to it's heart's content.


What is the "Trio" in a march?

Question: During a band rehearsal the bandmaster may ask when playing a march: Let's start from the trio!
a) What is meant by this term?
b) where does it come from?
Answer: The trio in a march is a second contrasting section, often more lyrical in character and usually in the subdominant. Very often the first part consists of two sections or "strains", both repeated. The trio is the third strain.
Some marches end on the trio, some return to the first section. A classic example of a march that ends on the trio is Sousa's "The Stars and Stripes Forever". An example of a march returning to the first section is Johann Strauss Senior's "Radetzky March".
The term was originally used in baroque minuets. There the trio would often actually be played by three instruments:

Around Lully's time it became a common practice to score this middle section for a trio (such as two oboes and a bassoon, as is common in Lully). As a result, this middle section came to be called the minuet's trio, even when no trace of such an orchestration remains.
(Wikipedia)

A minuet was often included as the third movement in a classical symphony. The minuet later developed into the scherzo which usually also has a trio.
Answer: The "trio" which is common in marches (and polkas) is generally a final section in a contrasting key. In major keys, it's usually in the subdominant of the opening key (not always.)
It's called a trio for historical reasons. In many baroque (and maybe earlier) suites, some dances had a part traditionally played by three instruments. The polacca from Bach's Brandenberg is a good example. There's a nice trio for two oboes and a bassoon; later there's another trio for two horns and three bassoons (in unison).
These trios were generally in A-B-A form with the B being the contrasting trio. Modern marches and polkas make the B the final. The "Stars and Stripes Forever" mentioned above is good; also see "Rosamunde" (known in English as the "Beer Barrel Polka").
Comment: Is there anything here not covered in PiedPiper's answer?
Comment: @Aaron this answer notes that the trio practice was not limited to minuet but was more general, which makes it more natural that the practice would be used in marches.  There isn't a clear line of development from minuets to marches since they are in different meters.

What is the “Trio” in a march?


Sound does not work once my profile loads

Question: When I boot up my ubuntu 9.10 distro, the sound works just fine, but hen I sign into one of my profiles, the screen flickers for a second, and then the sound card no longer works. It appears that my profile is trying to reload my sound card and is confusing it. I have been unable to find out when it is loading the second instance though. Any help would be greatly appreciated.
Answer: There's a wonderful sound troubleshooting guide in the Ubuntu documentation that should better help you track down exactly what might be causing your trouble.
Personally, my issues with sound usually revolve around different processes trying to directly access my sound card at the same time. I used a utility called randomsound to gather entropy for my system, but this would hijack my sound card and prevent PulseAudio from using it. Once I removed the conflicting application, everything worked as expected.
Hope that helps!
Answer: That seems to be a common issue for 9.10 distro, as I experienced the same some time ago.
What I did was to install the new version (10.10), which you can already do. But meanwhile I was stuck in that problems for a while.
If you are using alsa (as I guess), you can try to restart alsa by dropping the next in a terminal:
sudo alsa force-reload

Which will kill your current alsa audio session and start a fresh one, this way you can continue working and you can do it as you need it.
I know this is not a final solution but it worked for me at least for more than a year until I opted to reinstall and upgrade.


Hello, how do I run my information over the tor network twice

Question: I was wondering how do I send my data through the tor circuit twice (6 relays instead of the normal 3) if that would add extra security so I can be fully untraceable?
Comment: Tor team says that 3 hops is enough for anonymity, for making more secure you should use IPs of countries that don't have laws for data retention on ISP/Data Centers.
Answer: You cannot route your traffic over the Tor network twice since relays will not allow new circuits originating from exit relays.
It's not recommended to use longer-length circuits. The standard circuit length of 3 has been chosen since having more than 3 doesn't provide a significant benefit for the extra load it puts on the Tor network. It could potentially make you more identifiable since your traffic may look significantly different from other users (for example your latency will be twice as long on average).
If you really wanted to use longer-length circuits, I can think of two options:

Increase DEFAULT_ROUTE_LEN in tor's source code. This option isn't really meant to be changed, so it's likely something will break.
Use tor's control port to build longer-length circuits. For example with stem, you could use controller.extend_circuit(). You will have to write your own script to do this.

so I can be fully untraceable?

You will never be fully untraceable, so I wouldn't worry about that.


What do chazal mean when they guarantee someone Olam Habah?

Question: What does it mean when the Gemara guarantees a person  Olam Habah for doing a certain deed (for example saying Ashrei three times a day)? How is it different from any other good deed that one does?
Comment: Great question. I also wonder whether the guarantee still applies if the person's other behavior is lacking. I would guess not, but where is the provision for that?
Comment: Is there two questions? What does mean a "guarantee" to Olam Haba? What is the special property of some deeds as saying Ashrei three times a day, which links them to Olam Haba. Both questions are excellent and I am interested to read an answerr.
Answer: I heard a tape of Rabbi Avigdor Miller once where he says whenever you hear such things there's always a catch (I think he said "fine print"). For example, regarding Ashrei he says it means you live what it says not just recite it.
As to why it is different perhaps because these things encompass most of the Torah.
Answer: Hazal say things by way of stressing the importance of deeds one might be lax about. That is a general principle, like the Torah itself promisses a great reward specifically for certain commandments by way of encouragement.


How to project a symmetric matrix onto the cone of positive semidefinite (PSD) matrices?

Question: How would you project a symmetric real matrix onto the cone of all positive semidefinite matrices?
Answer: If you merely want to find a projection $\pi$ such that $\pi(S)$ is positive semidefinite for some fixed real symmetric matrix $S$, you may first orthogonally diagonalise $S$ as $QDQ^\top$ and then define $\pi: M\mapsto Q\Sigma Q^\top M$, where $\Sigma$ is a 0-1 diagonal matrix whose $i$-th diagonal entry is $1$ if the $i$-th diagonal entry of $D$ is nonnegative, and $0$ otherwise.
Comment: @VictorDeplasse Your edit is problematic in two ways and I'm rolling it back. First, it should be a comment, not an edit. Second, your edit is wrong. On one hand, $\pi: M\mapsto Q\Sigma Q^top$, then $\pi$, as a **linear operator**, is a constant map, not a projection map. In fact, if you define $\pi$ this way, then $\pi^2\ne \pi$ in general. On the other hand, if you are talking about the **projected image** of $M$, then $\pi(M)$ should be $QD\Sigma Q^\top$, not $Q\Sigma Q^\top$. It is easy to see that $Q\Sigma Q^\top$ is a wrong choice, because $\pi(M)$ should be equal to $M$ if $M$ is PD.
Answer:
"A matrix M is positive semi-definite if and only if there is a
  positive semi-definite matrix B with B2 = M. This matrix B is
  unique,[6] is called the square root of M, and is denoted with B =
  M1/2 (the square root B is not to be confused with the matrix L in the
  Cholesky factorization M = LL*, which is also sometimes called the
  square root of M). If M > N > 0 then M1/2 > N1/2 > 0."
[6]  Horn & Johnson (1985), Theorem 7.2.6 with k = 2
Horn, Roger A.; Johnson, Charles R. (1990), Matrix Analysis, Cambridge
  University Press, ISBN 978-0-521-38632-6.

http://en.wikipedia.org/wiki/Positive-semidefinite_matrix
So, given symmetric $A,$ we have $A^2 = A A^T$ is symmetric positive semidefinite and has just one p.s.d. square root. So your projection is $$  A \mapsto \sqrt{A^2}   $$
Meanwhile, if $A$ is already p.s.d., already in the cone, then $A \mapsto A,$ which is what you want for something called a projection.
Comment: This doesn't seem to be quite correct.  Think in one variable -- the projection of $-1$ onto the semidefinite cone is $0$, not $|-1|=1.$  For symmetric $A$, however, the average $\frac{1}{2}(A+\sqrt{A^2})$ would work.


Determine a theoretically optimal screw shape wrt holding or withdrawal strength

Question: I was stating at a hex screw sort of in awe of the physics underlying this rather simple mechanical system. It got me thinking, how would one go about determining the optimal shape for a screw to maximize its holding strength for a given volume of material? What maths and engineering concepts are required to solve it and has this already been considered?
Comment: Stating? Or staring? Withdrawal has always been a problem...
Comment: that seemingly simple system has been under development for hundreds of years and yes, it's been optimized. Some mechanical engineering textbooks tell this story under the heading "threaded fasteners".
Answer: Screws come in various types depending on their application.  As @Nielsneilson said, they have indeed been optimized (approximately) over a long time, but the "fitness function" for optimization depends on multiple factors. You asked specifically about holding strength in a given material.  The brittleness and elasticity of the material, as well as the coefficient of friction between the material and the material of the screw, are both important.  If the concern is only that the screw may become "unscrewed" due to vibration or other such causes, the important factor is the friction.  If the concern is that the screw may get pulled out of the material, breaking the material in the process, it is a more difficult problem.
An extreme case is that of screws designed for anchoring in drywall (plasterboard). Because drywall crumbles easily, closely space threads in a screw will simply turn the drywall to powder so the screw has essentially nothing to hold it in place.  The solution is to shape drywall anchor screw threads a bit like an auger: a thin helical blade that slices a spiral path through the plaster, leaving intact most of the plaster that is within the cylindrical envelope of the screw.
Another extreme case is that of machine screws, designed to clamp two pieces of metal together solidly despite vibration.  In that case, the material (the metal pieces or a nut) is plenty strong and the important thing is to be able to exert maximal compression between the pieces.  For that purpose, it is advantageous to use narrow screw threads with a small helix angle https://www.afi.cc/blog/screw-thread-terminology.  Larger thread depth for a given helix angle results in weaker threads, but stronger grip.
Given a specific fitness function (i.e., what does "better" mean in a given context?", it is fairly straightforward to set up an optimization procedure that selects the best screw shape for a specific application.  For example, a genetic algorithm incorporating all the necessary factors and relationships can quickly find an optimal shape.  (Transparency note: this link is to something I wrote about 25 years ago.)


Can I do factor analysis with missing data?

Question: I have this dataset with 50 variables for which I assume a latent structure, so I want to run a confirmatory factor analysis.
My sample size is 370 but each of the participants was randomly assigned 36 out of the 50 variables. In average there are about 250 respondents for each variable, but it differs a little. Now I am not sure if I can run a factor analysis on my data or not? Should I do imputate the missing data?
I would be very grateful for any recommendations what to do. Thanks!
Answer: Provided that you are confident that the data meet the assumption of missing at random (MAR), you can either impute the data or use a full information maximum likelihood estimator (FIML). Most modern structural equation programs have a way of implementing FIML, some have ways for imputing or at least analyzing a series of imputed datasets.


Database field type for password storage?

Question: In the past I used varchar(255) for storing hashed passwords (no salt). Is this still enough? Or are longer fields required?
Comment: I am more concerned about storing passwords with no salt.
Comment: See this same question on Stack Overflow: http://stackoverflow.com/questions/247304/mysql-what-data-type-to-use-for-hashed-password-field-and-what-length
Comment: @Woot4Moo, that's a good point. Powtac, no matter how long a password is, a hash will bring it back down to a certain length. Make sure every user gets their own salt, and the salt changes each time the password is changed. Hashing passwords without salt was a major cause of the LinkedIn leak earlier today.
Comment: I was just asking for the DB field, there are enough other questions and answers about safe passwords...
Answer: The size of the field in the database should exactly match the size of the output of your key derivation function. So if the output is 60 characters long, use a varchar(60) (or maybe char(60) if that's smaller or faster in your database).
And please, don't just hash the password and call it a day. Do it right.
Answer: A longer database field or different type makes no difference to security, if that is your question.
You should choose a field length that is long enough just to contain the full bit length of the resulting hash. This is for minimum storage overhead and performance only. (See this as a guide https://stackoverflow.com/questions/247304/mysql-what-data-type-to-use-for-hashed-password-field-and-what-length)
A hash algorithm will return exactly the same amount of data (it's bit length) regardless of how much data is put in to it.
i.e. (password or password + salt or a 100 lines of text) hashed will return exactly the same amount of bits after hashing through the same algorithm.
To increase security you would need to change how you handled hashing, collection and storage of salt (if you do) as has already been mentioned.
Answer: Whatever input you use, hashing always produces a result with the same length.
Moreover, salting doesn't affect the length of the hash, because you should salt input before applying the hashing function: hash(password+salt).
There is no need to use DB fields longer than the length of the hashing output.
What's more, iterating the hashing function doesn't affect the length: length(hash(hash(input))) == length(hash(input))
Comment: Not that "hashing the hash" is recommended of course.  Many hash functions include an interaction count - not to "encrypt further" but to slow the process down making brute force approaches more difficult.


How to interpret air movement when we breath in terms of fundamental laws of nature?

Question: How to interpret the movement of air in nose in the two parts of breath : inspire and expire in terms of the 4 interactions of nature, gravitational, electromagnetic, weak, strong interactions ?
Comment: That's really just fluid dynamics. No need to go deeper than that
Comment: Sure but how to make connection to the only 4  fundamental interactions of nature ?
Comment: Gravity has an impact on what atmosphere you breathe. The rest is E&M through chemistry...
Comment: Lungs expands and compress. That pushes on air molecules. They push in other air molecules. Which push in other air molecules... Every time a push takes place, we can zoom in to the nano scale and see that a "push" between molecules or atoms is just electromagnetic repulsion
Comment: Electromagnetic interaction would explain pushing the molectules but not pulling molecules when we breathe. Pression is not a fundamental law of particle physics. I search how to reduce pression to fundamental interactions
Answer: You have to realize that different mathematical models are used in differing frameworks. The mathematics modeling is appropriate to the framework, and the forces and assumptions used in the models  differ. There is a hierarchy though:
Take thermodynamical models:the hierarchy is: thermodynamics with its laws, which emerges from classical statistical mechanics with its laws, which emerges from quantum statistical mechanics with its laws, which emerges from single particle quantum mechanics with its laws.
Laws, principles, postulates are different from level to level to enable to pick the correct mathematical solutions , except conservation laws of energy, momentum and angular momentum.
Fluid dynamics that describe the motion of air depend on the gravitational field that your nose exist, but do not affect the input output of breath, as pressure is a constant where you are. Electromagnetic theory is enough to explain the motion of muscles, although quantum theory is also necessary to explain temperature (black body) and energy supply. (biological and chemical reactions at the quantum level). In this sense the electromagnetic interaction plays the main role.
The weak interaction is not needed macroscopically. The strong interaction keeps the nuclei of atoms in air and your body but is not taking part in the fluid motion.
So even though weak and strong exist so that atoms in your body and the fluid air have the behavior you observe, it is not an effect that affects the motion of the fluid.
So the concept to keep in mind is the concept of "emergence"  when thinking of different levels of interactions.
Comment: Anna has the key : emergence in physics. I thought all could be reduced to the 4 fundamental interactions. Is it not the case ?
Comment: If we did not have these four interactions the world as we know it would not exist. Weak interactions limit the  numbers in the periodic tabe l(by introducing instabilities) , strong interactions keep the nuclei on the stability curve and give stable nuclei so that stable atoms can be formed with the electromagnetic forces, and gravity allows the atmosphere to exist. But  as I stated, the various levels of our world are emergent from the lower  ones, the lowest being the elementary particle, in a complicated mathematically way.
Comment: Sure and I try to understand how high level world works from low level world. This is the sense of my question with an example of pression that attract or repulse air by unknown force. Il people would use electromagnetism to push molecules then how to attract them. Molecules charges don t change. People are eluding my question
Comment: electricity and magnetism can be both attractive and repulsive at the macroscopic matter level. There are spill over fields in the atoms and molecules that generate positve and negative electric field  regions,, as well as magnetic fields.
Comment: Sure but this does not explain why air changes of direction during the breathe since the charge will not change of sign during breathing
Comment: The spill over electric fields of your muscles are used to make underpressure and overpressure to the fluid flow so that you can breath in and out. This is because the muscles are not rigid but have elastisicity ( which depends on the spill over electric field of the molecules that make them up.
Comment: Thank you very much Anna. A very last question. How inertia conservation could be explained from the 4 interactions law ?
Answer: The movement of air into is not because of any force exerted on it. The lungs in our body have a diaphragm which essentially controls the volume of the lungs. When we are about to breath in, the diaphragm contracts and the lungs become an region of low pressure as compared to the atmosphere. Hence the air moves from high pressure to low pressure.


What do I do If I used Salomet's grimoire?

Question: I used the grimoire by accident and now I presume I can't complete the quest. Do I have to return to the last checkpoint and lose ALL that I did in order to have it again?
Answer: You can find The Black Cat in Gran Soren. There, the shopkeeper offers you the chance to make forgeries of items, which will never inherit the magical properties of the original. They explicitly state:
<code>If Salomet's Grimoire is used, gifted to a pawn, or lost, a forgery becomes available.
</code>
For more information, check out The Black Cat entry on the wiki.
It's also good to note that with the exception of 2 (The Grimoire being 1) items, lost quest items will also appear in this location.


Getting file permissions across the network

Question: I have a situation where I need to confirm that I am able to get write access to a particular folder on the network.  So firstly I check is the user or one of the groups it is part of (domain groups) one of the identities in the access rules.  If that is not the case then I need to go through and check all the local groups on the remote machine, to see if my user or one of the user's groups is a member of the local groups on the machine.  For example on this particular machine I am a member of BUILTIN\Administrators, which means I do have write access to the given folder. However I am not clear how to get that local group from the remote machine to check if I have write access.
In the code below, when I try and use GroupPrincipal.FindByIdentity, it gives an exception "The binding handle is invalid."  I'm not clear what is invalid. If I just try and verify my username and password (a domain username), by using ctx.ValidateCredentials(UserName, Password), it gives exactly the same error.
If I give the machine name as just "pvr-pc", it says it cannot find the name on the network, but "\\pvr-pc" does get past that problem fine.
The same code correctly discovers that I one of the groups I am part of is a group in BUILTIN\Administrators on my local machine, so it's something about the network access that is the problem.
Does anyone have any ideas what I've done wrong?
The code looks like this:
<code>using (WindowsIdentity identity = GetUserIdentity())
{
    if (identity != null)
    {
        try
        {

            FileInfo fi = new FileInfo(@"\\pvr-pc\c\installers\");
            AuthorizationRuleCollection acl = fi.GetAccessControl().GetAccessRules
                (true, true, typeof (SecurityIdentifier));

            var rules = acl.Cast<FileSystemAccessRule>();

            List<string> sids = new List<string>();

            sids.Add(identity.User.Value);

            sids.AddRange(identity.Groups.Select(identityReference => identityReference.Value));

            // check for a direct user match
            var matches = from r in rules where sids.Contains(r.IdentityReference.Value) select r;
            foreach (FileSystemAccessRule accessRule in matches)
            {
                // apply rules
            }

            foreach (FileSystemAccessRule rule in rules)
            {

                // if it is built in, try and get the group
                var groupDetail = rule.IdentityReference.Translate(typeof (NTAccount));
                if (!groupDetail.Value.StartsWith("BUILTIN\\")) continue;
                PrincipalContext ctx = new PrincipalContext(ContextType.Machine, @"\\pvr-pc", null,
                                                            ContextOptions.Negotiate, UserName, Password);

                GroupPrincipal grp = GroupPrincipal.FindByIdentity(ctx, IdentityType.Sid,
                                                                    rule.IdentityReference.Value);
                if (grp != null)
                {
                    //// find out if we are a member of the group
                    var isInGroup = (from g in grp.GetMembers(true)
                                        where sids.Contains(g.Sid.ToString())
                                        select g).Any();
                    if (isInGroup)
                    {
                        // apply rules
                    }
                }
            }
        }
        catch (Exception ex)
        {

        }
</code>
Thanks,
Stefan
Answer: Would it not be easier to simply read or write to the folder and then catch the Exception; then inform the user s/he has no access.
Comment: Yes, it is certainly something that I would do if I can't do it this way.  At the point of running this code, I don't have anything specifically that I'm trying to read or write, so I'd have to read a random file or create a random file, which I would prefer not to do if I could.  FileInfo gives you an IsReadOnly property that may help, but haven't done any testing that yet to see if it is going to work in all situations.


Best way to keep values?

Question: I'd like to create app with 3 months exercise plan. There will be around 30 exercises to do every day but time is growing. What is best way to keep values of minutes in every exercises and which one exercises you should do today. Im using Firebase in this project but im not sure about optimalization because there will be much datas just from exercises. Every exercises has photo how to do this, time and description and I need to store the length of the exercise for each day so I do not know if this is a good solution.
Comment: If you are not going to do anything with the data generated by the user, you can better use SQLite to store data locally that can be access by that user only. If you are going to have some advanced features like sharing, competing with other users, you probably need a backend to serve data. In that case firebase is the best option. Also to note that firebase have inbuilt offline capabilities.
Answer: You could use a relational Database like MySQL, PostgreSQL, MariaDB to store the data server-side.
If you want to persist the data on the Android-side of things use SQLite https://developer.android.com/training/data-storage/sqlite
If you application doesn't require online connectivity all the time, a nice idea would be to be able to sync the server DB with the android DB for offline usage.

Best way to keep values?


How are digital maps generated?

Question: This is a more of a noob GIS question.  How are all the features on the maps we come use know and love (Google Maps, Bing Maps) generated from imagery?  Does somebody actually look at the imagery and draw feature layers on top using something like ArcGIS or is there algorithms for automatic extraction?
Comment: multiple sources, data suppliers (tomtom, navteq) streetview is a large source for google and some data extraction from aerial imagery and automatically with lidar)
Comment: I think it would be better to focus your question on a particular dataset because there are multiple ways that spatial data is captured.
Answer: Generally speaking, for vector geometry (e.g. roads, buildings, polygons, areas of interest) these features are created by outside contractors that specialize in geospatial data production. However, the tech companies like Google/Apple/Microsoft must also QA/QC the massive datasets for inaccuracies. A lot of this can be done programmatically by their engineers, but other features must be edited manually (e.g. to correct inaccurate features). As we saw with the rollout of Apple Maps, sometimes this process can be cumbersome.
The best mapping platforms use "ground-truthing" to improve their datasets beyond just what exists in vendor datasets, which may have incomplete or inaccurate features. Ground-truthing consists of sending on the ground teachnicians to map roadways and high-profile landmarks. A similar process exists for raster imagery as well.

How are digital maps generated?


How to set default browser used by NFC?

Question: I have a Samsung S4 mini, stock Jellybean ROM. I have several browsers installed, one of which is Firefox configured for browsing through a proxy. When I tap on an NFC tag, Android opens up Firefox - I want it to open up a different browser. How?
Comment: try clear Settings of Firefox so next time when you press the Tag it will ask you for the browser
Comment: Adjusting Itzik a little: *Settings → Apps*, scroll to Firefox, open its entry. Watch out for a box labeled "Reset defaults". Hit it. No other settings should be affected this way. Greetz – another Itzik :)
Answer: Normally, only apps that specifically support NFC will work, not just any browser. If you've tried resetting Firefox as a default app, as Izzy suggests, and you still don't get a choice of browser, it may be because your other browsers don't support NFC.
In this case, you can use my app bURLy to choose any browser. It's a free download from Google Play, and it supports NFC and lets you choose any app that understands the URL in the tag: whether it's a browser, the YouTube app, the Facebook app, or any other site's app, regardless of whether the app supports NFC.
You can choose the app each time if you like, you can set a single default app, or if you like, you can add rules for particular URLs, sites, or other conditions. For example, you might want one site to open in Firefox, another site in Chrome.

How to set default browser used by NFC?


Prove by induction on $\alpha < 2^{\aleph_0}$ that $|\mathcal G_\alpha| < 2^{\aleph_0}$ and $\mathcal G_\alpha$ is not an ultrafilter over $\omega$

Question: The following question is exercise 7.4 from Ernest Schimmerling's A Course on Set Theory which involves a construction from Tarski's theorem that extends filters to ultrafilters. I couldn't find much at all on the web for this so I thought this could be a good question. Here is the background of the construction: let $\mathcal F$ be the Frechet filter over $\omega$ and take $\left< \mathcal G_\alpha \colon \alpha < 2^{\aleph_0}\right>$ to be a sequence of filters extending $\mathcal F$ constructed as follows: enumerate $\mathcal P(\omega)$ as $\left<A_\alpha \colon \alpha < 2^{\aleph_0}\right>$. Set $\mathcal G_0 =\mathcal F$. At each successor stage $\beta = \alpha+1$ it must be the case that
$$ \forall B \in \mathcal G_\alpha (B \cap A_\alpha \neq \varnothing) \oplus \forall B \in \mathcal G_\alpha(B \cap X\setminus A_\alpha \neq \varnothing)$$
In the first case set $$\mathcal G_{\alpha+1} = \{C \in \mathcal P(\omega)\colon \exists B \in \mathcal G_\alpha (B \cap A_\alpha \subseteq C)\}$$ Do the analogous operation for case two. Then this ensures that $\mathcal G_{\alpha+1}$ is a filter and either contains $A_\alpha$ or its complement. In the limit stage(s) set $$\mathcal G_\beta = \bigcup_{\alpha < \beta} \mathcal G_\alpha$$ The exercise is: prove by induction on $\alpha < 2^{\aleph_0}$ that $|\mathcal G_\alpha| < 2^{\aleph_0}$ and $G_\alpha$ is not an ultrafilter over $\omega$. I get the base case very easily since the Frechet filter is countable and contains neither the even nor odd naturals. Howevever I'm stuck on the successor step as I can't seem to make any connections why $|\mathcal G_{\alpha+1}| < 2^{\aleph_0}$. Also, while $G_\alpha$ may not contain $B$ nor $X\setminus B$ for some subset $B$ it's still possible that $\mathcal G_{\alpha+1}$ could contain either set at the next stage, so I also don't see how to show that it's not an ultrafilter. Now, at the limit stage it makes sense why the filter is not of cardinality the continuum, since you're unioning fewer than continuum-many sets of which all have size less than the continuum. And there is also a set and its complement who are not contained in any previous sets. So, it seems there is something really minor that I'm missing on the inductive step. Thanks!
Comment: Re: limit steps, it's possible that the continuum *is* a smaller-than-continuum union of smaller-than-continuum sets - e.g. it's consistent with $\mathsf{ZFC}$ that $2^{\aleph_0}=\aleph_{\omega_1}$.
Comment: Thanks, Noah. So therefore my reasoning about why the filter obtained at the limit stage has cardinality less than $2^{\aleph_0}$ is wrong, because we could have $\aleph_{\omega_1} = \bigcup_{\gamma < \omega_1} \aleph_\gamma$?
Comment: This doesn't sound correct, assuming ZFC is consistent: According to Blass's chapter in "Handbook of set theory", i.e. chapter 9, "Combinatorial Cardinal Characteristics of the Continuum", page 448, between Definition 9.6 and Proposition 9.7:...
Comment: ...Kunen constructed a model where $2^{\aleph_0}=\aleph_{\aleph_1}$ but there is a non-principal ultrafilter $U$ on $\omega$ generated by $\aleph_1$ many sets (that is, there is a set $U'\subseteq U$ of cardinality $\aleph_1$ such that $U=\{A\subseteq\omega\bigm|\exists B\in U'\ [B\subseteq A]\}$) (Blass cites Kunen's "Set Theory: An Introduction to Independence Proofs", Chapter 8, Exercise A10 (this is the older book by Kunen))...
Comment: ...And also, Baumgartner-Laver "Iterated perfect set forcing" constructed a model of ZFC where $2^{\aleph_0}=\aleph_2$ with an ultrafilter on $\omega$ generated by a set $U'$ of size $\aleph_1$. So it could happen that we are working in one of those models, and your sequence $\left_{\alpha<2^{\aleph_0}}$ happens to enumerate the sets in $U'$ as the first $\omega_1$-many $A_\alpha$'s. Then $\mathcal{G}_{\omega_1}$ is already an ultrafilter, and hence has cardinality $2^{\aleph_0}$.
Comment: (Note this just says that the induction has to break down at some step, either successor or limit. One can show that an ultrafilter $U$ on $\omega$ can't be generated by a countable $U'$. So the first place the induction can break down is stage $\omega_1$, and that can be realized as mentioned above. But this doesn't tell us whether or not the induction can break down at a successor step. So in that sense, the remarks so far do not answer your original question.)
Comment: Actually, the property that $\mathcal{G}_\alpha$ has cardinality $<2^{\aleph_0}$ breaks down at the least $\alpha$ such that $\mathcal{G}_\alpha\neq\mathcal{G}_0$ (recall $\mathcal{G}_0$ is the Frechet filter), and note this $\alpha$ is a successor ordinal $\beta+1$: this is just the least $\beta$ such that $A_\beta$ is infinite and coinfinite, and hence $A_\beta\notin\mathcal{G}_0=\mathcal{G}_\beta$ and $\omega\backslash A_\beta\notin\mathcal{G}_0$...
Comment: ...Then $Y=A_\beta\in\mathcal{G}_{\beta+1}$, and there are $2^{\aleph_0}$ sets $X\subseteq\omega\backslash Y$, and for each such $X$, we have $X\cup Y\in\mathcal{G}_{\beta+1}$. (This doesn't tell us whether we can reach an ultrafilter at a successor stage, though.)
Comment: Actually $\mathcal{G}_\alpha$ can also become an ultrafilter first at a successor stage $\alpha$ (that is, consistently; it can't for example if CH holds).
Comment: As @FarmerS explained, the exercise is wrong. The first part should have only said that each of the filters $\mathcal G_\alpha$ is generated by $<2^{\aleph_0}$ sets (which is clear since only one new generator is added at any step). But I see no way to salvage the second part. Indeed, ultrafilter theory includes constructions of this general sort where the chief technical difficulty is to prevent getting an ultrafilter too soon (i.e., before $2^{\aleph_0}$ steps). Kunen developed a "method of independent sets" for this purpose (and others have extended it).
Answer: (The following answer is mostly repeated from my comments above, but I have added the observation that the least $\alpha$ such that $\mathcal{G}_\alpha$ is an ultrafilter can (consistently) be a successor ordinal. I'm working in ZFC.)
There seems to be a problem with the exercise...
First, there is an easy observation to see that the $\mathcal{G}_\alpha$'s, for $\alpha<2^{\aleph_0}$, are not all of cardinality $<2^{\aleph_0}$. Recall $\mathcal{G}_0$ is the Frechet filter, so $\mathcal{G}_0$ is countable.
Let $\beta$ be least such that $A_\beta$ is infinite, coinfinite (i.e. infinite and $\omega\backslash A_\beta$ is infinite). Note then that $\mathcal{G}_\beta=\mathcal{G}_0$, and $A_\beta\in\mathcal{G}_{\beta+1}$. Note that for every
$X\subseteq\omega\backslash A_\beta$, we have $A_\beta\subseteq A_\beta\cup X\in\mathcal{G}_{\beta+1}$. But there are $2^{\aleph_0}$-many such sets $X$,
hence $2^{\aleph_0}$-many such $A_\beta\cup X$, so $\mathcal{G}_{\beta+1}$ has cardinality $2^{\aleph_0}$.
So the exercise is incorrect. What if we weaken the exercise, and just demand
that $\mathcal{G}_\alpha$ fail to be an ultrafilter for $\alpha<2^{\aleph_0}$?
Then, consistently, it is still incorrect...

A base for an ultrafilter $U$ on $\omega$
is a set $B\subseteq U$ such that for every $X\in U$ there is $Y\in B$ with $Y\subseteq X$. Let $\mathfrak{u}$ be the least cardinal $\kappa$ such that for some nonprincipal ultrafilter $U$ on $\omega$, there is a base $B$ of $U$ of size $\kappa$. (This is well-defined, since there are non-principal ultrafilters on $\omega$.) Trivially then $\mathfrak{u}\leq 2^{\aleph_0}$. A direct combinatorial argument shows $\aleph_1\leq\mathfrak{u}$. So assuming CH, we have $\mathfrak{u}=2^{\aleph_0}=\aleph_1$, and the statement you wanted to prove  can be proved using this extra assumption.
But Kunen constructed a model satisfying $2^{\aleph_0}=\aleph_{\omega_1}$ and $\mathfrak{u}=\aleph_1$; see Kunen "Set theory: An introduction to independence proofs" Chapter 8, Exercise A10. In that exercise, one constructs a model with an ultrafilter on $\omega$ with a base of size strictly smaller than the continuum.
Also, Baumgartner and Laver showed that, assuming ZFC is consistent, so is ZFC + $2^{\aleph_0}=\aleph_2$ + $\mathfrak{u}=\aleph_1$. (See their paper "Iterated perfect set forcing".) (These points are mentioned in section 9 of Blass's chapter in the Handbook of set theory,  "Combinatorial cardinal characteristics of the continuum", p. 448. That section also contains much more related information.)
So it could be that $\mathfrak{u}<2^{\aleph_0}$. Assume this, and let $U$ be a non-principal ultrafilter with a base $B$ of cardinality $\mathfrak{u}$. Let $\left<A_\alpha\right>_{\alpha<\mathfrak{u}}$ enumerate $B$. Let $\left<A_\alpha\right>_{\mathfrak{u}\leq\alpha<2^{\aleph_0}}$ then be such that $\left<A_\alpha\right>_{\alpha<2^{\aleph_0}}$ enumerates $\mathcal{P}(\omega)$. Define the sequence of filters $\mathcal{G}_\alpha$ as you do in the question. Note that since $U$ is a filter, we get by induction that $\mathcal{G}_\alpha\subseteq U$ and $A_\alpha\in\mathcal{G}_{\alpha+1}$, for each $\alpha<\mathfrak{u}$. But then $B\subseteq\mathcal{G}_{\mathfrak{u}}$, and since $B$ is a base for $U$, therefore $\mathcal{G}_{\mathfrak{u}}=U$, which is an ultrafilter. But $\mathfrak{u}<2^{\aleph_0}$, contradicting the weaker version of the exercise.

Note that in the construction above, the $\mathcal{G}_\alpha$ are not ultrafilters
for $\alpha<\mathfrak{u}$, just by definition of $\mathfrak{u}$.
So $\mathfrak{u}$ is the least $\alpha$ such that $\mathcal{G}_\alpha$ is an ultrafilter there.
Finally, let me just observe that, again assuming that $\mathfrak{u}<2^{\aleph_0}$,
it can also be that $\mathcal{G}_\alpha$ is first an ultrafilter at some successor $\alpha$. For this, let $A\subseteq\omega$
be infinite, coinfinite, let $U_1$ be a nonprincipal ultrafilter on $A$,
having a base of cardinality $\mathfrak{u}$,
and let $U_2$ be a nonprincipal ultrafilter on $\omega\backslash A$,
also with such a base. (Note that if $U$ is any nonprincipal ultrafilter
on $\omega$ with a base of cardinality $\mathfrak{u}$, then we can easily
produce such ultrafilters on $A$ or on $\omega\backslash A$, by shifting
then according to a bijection $\pi:\omega\to A$ or $\pi:\omega\to\omega\backslash A$.)
Let $F$ be the filter on $\omega$ of sets of the form $C\cup D$ where $C\in U_1$ and $D\in U_2$ (note it is a filter). Then $F$ is not an ultrafilter on $\omega$, since $A\notin F$ and $\omega\backslash A\notin F$. But note that $U_1$ is a base for a unique ultrafilter on $\omega$ (as is $U_2$). Let  $B_1=\{A_{1\alpha}\}_{\alpha<\mathfrak{u}}$ be a base for $U_1$ and $B_2=\{A_{2\alpha}\}_{\alpha<\mathfrak{u}}$ be a base for $U_2$. Let $A_\alpha=A_{1\alpha}\cup A_{2\alpha}$. Let $A_{\mathfrak{u}}=A$. Then let $\left<A_\alpha\right>_{\mathfrak{u}<\alpha<2^{\aleph_0}}$ enumerate the rest of $\mathcal{P}(\omega)$. Suppose we use this sequence and define the $\mathcal{G}_\alpha$'s. Then it is straightforward to see that $\mathcal{G}_{\mathfrak{u}}=F$, which is not an ultrafilter, but since $A_\mathfrak{u}=A$, that $\mathcal{G}_{\mathfrak{u}+1}$ is the ultrafilter with base $U_1$. So $\mathfrak{u}+1$ is the least stage where we get an ultrafilter in this case.
Comment: Thank you for the wonderful explanation, and a whole lot more! I wouldn't have guessed that the exercise was wrong, but using your hints in the first paragraph I worked out the details why
Comment: No problem! ---


Breaking an oath(wallah) that i will not sin again by Allah's name, how do I cancel out this oath?

Question: One time I sinned and got really upset, so I swore an oath that i will never sin again(the ones I know), and i am already regretting this decision…
How can i cancel this oath I have made(Wallah) with Allah?
Comment: Assuming you succeed and nullify your oath, do you think that means it will become halal for you to sin?
Answer: People swear to force themselves to do or not to do something! But you want to break your promise  and break your oath! You must atone for this quit. This is a penalty for the bad promise man who breaks his oath.
The prescribed punishment for breaking an oath is the release of a slave or the feeding of ten poor people or the covering of ten poor people and, if incapacitated, the fasting for three consecutive days.

Breaking an oath(wallah) that i will not sin again by Allah’s name, how do I cancel out this oath?


Services - Rest Server Setup

Question: I have the Services 6.x-2.4 module installed on a Drupal 6 site.
I am attempting to use REST but I am having difficulties getting things working.
For instance, http://mysite.com/services/xmlrpc returns some kind of feedback that the server is working.
While http://mysite.com/services/rest returns nothing and I am not sure if the server is actually working.
Can anyone offer some direction, please?
Answer: Make sure you have an endpoint configured and enabled.  You'll have to additionally enable resources for the endpoint.

Services - Rest Server Setup


I play with P rested on the 6th string when doing high tempo pieces. Is this a bad habit?

Question: I've been trying to play classical pieces recently and I found it easier to play the very fast parts of a song (take fur elise's 2nd movement and the second part of the third movement) by resting P on the lower strings while my fingers IM pick. Does good players do this? I'm not very knowledgeable about classical guitar technique, unfortunately.
Answer: When playing in a classical style, your thumb has to go somewhere. If it's not actually in use, (not playing low notes at that time), there's nothing wrong with resting it on a string - and the low E is favourite. You've found that it helps your playing: your picking hand needs stability. I often find students struggle with this, as their picking hand is floating, not stable. True, it can be stabilised by freezing the forearm and partially the wrist, but why bother when there's a method that suits better.
Bassists use it  frequently, resting the thumb on the lowest string, sometimes moving it across to the next lowest when playing the top string. It also has another advantage. It mutes the string it's on. Thus cutting out extraneous noise from that string.
Comment: Please don't accept an answer so soon - it may discourage other answers. Also, my answer is based on my experiences - others may disagree and provide evidence to the contrary!
Comment: Thanks! I was worried it might become bad muscle memory
Comment: It will become bad muscle memory
Answer: I would not recommend placing your thumb on the bass string when playing fast runs on the upper strings.  This will only lead to handicap down the road.  The fact is that your thumb does not have to go somewhere when not in use.  I don't understand the rational behind that statement.  You thumb is always attached to your hand so it has a place to go.
You asked us whether or not the good players do this but you don't state who you think a good player is or any criterion for being good.  That makes it an opinion based question.  Some might say that by definition if a player has a handicap like anchoring the thumb on the strings then they are not a good player.  Based on my experience many Flamenco players will anchor the thumb but just as many float it, keeping the distance between the thumb and (i, m) the same.  Thus they shift the thumb back and forth when changing strings in a fast run.  Still other will keep the thumb close to the index finger and "rest" i on the thumb when executing a free stroke.
The best players I've ever seen do not rest the Thumb but float it.  At the end of the day what matters is whether this is something you need to rely on to play or something that you can choose to do.  If it is necessary then I would say you are developing poor technique, or no technique, and using the anchor as a handicap that in time will limit your dexterity.