What is the Fabric of Spacetime?

Question: I always get the analogy of the pretend sun on a piece of cloth pulling everything down such as the image attached below:
But What I never really understood is what IS that piece of cloth. Like is it some sort of invisible force field or something? Sorry if I sound a little crazy, I only recently started reading a little bit of popular physics (fabric of the cosmos).
Comment: Possible duplicate of [Better explanation of the common general relativity illustration (stretched sheet of fabric)](https://physics.stackexchange.com/q/90592/)
Comment: Possible duplicate of [The Fabric of Space-time?](https://physics.stackexchange.com/q/309369/)
Comment: What would you consider to be the "fabric" of the natural numbers?  Or the unit circle?  Or the category of sets?
Comment: Related: http://physics.stackexchange.com/a/13839/2451 , https://physics.stackexchange.com/q/90592/2451 and links therein.
Comment: There is no 'fabric' of spacetime. It's a naive platitude used by popular science to 'explain' general relativity, to avoid going into the mathematical details. It is best to learn the math. See also this answer by @Solenodon Paradoxus - https://physics.stackexchange.com/a/142357/133418
Comment: The God(-damn) particle effect, as Lederman called it.
Answer: There isn't one. Probably the reason why this whole "fabric" thing was brought into existence was to attempt to make it possible for laypeople to visualize the fact that "spacetime geometry" is not something set in stone but something that is dynamical.
But while we identify gravity with spacetime geometry, the concept of a "spacetime geometry" is a mathematical concept pertaining to what is called Riemannian geometry.
In simplest terms, consider euclidean space. You can take up a cartesian coordinate system in euclidean space, the coordinates are called $x,y,z$. Because these coordinates are orthogonal and we have Pythagoras' theorem, if we have a displacement of coordinates $\Delta x,\Delta y, \Delta z$, then the square of the distance travelled during this displacement is $$ (\Delta s)^2=(\Delta x)^2+(\Delta y)^2+(\Delta z)^2. $$
Because finite displacements like this won't work in curvilinear coordinates, we can also take this formula with "infinitesimal" (infinitely small) displacements: $$ ds^2=dx^2+dy^2+dz^2. $$
Assume now that you introduce a curvilinear coordinate system $u^1,u^2,u^3$ (the superscripts are simply indices numbering the coordinates, NOT exponents this time). This means that you give your cartesian coordinates $x,y,z$ as a function of the new coordinates $u^1,u^2,u^3$: $$ x=x(u^1,u^2,u^3) \\ y=y(u^1,u^2,u^3) \\ z=z(u^1,u^2,u^3). $$ To ensure that this defines a well-defined coordinate system, we demand that these functions are sufficiently differentiable, that they are invertible (eg. that inverse functions $u^i=u^i(x,y,z)$ exist), and the inverse functions are also differentiable sufficiently.
What is the square of the displacement belonging to coordinate displacements $du^i$? Well, $$ dx=\sum_{i=1}^3\frac{\partial x}{\partial u^i}du^i,\ dy=\sum_{i=1}^3\frac{\partial y}{\partial u^i}du^i,\ dz=\sum_i\frac{\partial z}{\partial u^i}du^i, $$ so $$ ds^2=\sum_{i,j=1}^3\left(\frac{\partial x}{\partial u^i}\frac{\partial x}{\partial u^j}+\frac{\partial y}{\partial u^i}\frac{\partial y}{\partial u^j}+\frac{\partial z}{\partial u^i}\frac{\partial z}{\partial u^j}\right)du^i du^j=\sum_{i,j=1}^3g_{ij}(u)du^idu^j, $$ where I have named the quantity in the bracket as $g_{ij}(u)$.
As you can see, the square of the infinitesimal displacement corresponding to the infinitesimal displacement of the coordinates $du^1,du^2,du^3$ is a quadratic form of the variables $du^i$, which roughly means that it is a second-degree, homogenous polynomial of them.
Of course, we know that it is possible to bring the "line element" $ds^2=\sum_{i,j=1}^3g_{ij}(u)du^idu^j$ into euclidean form $ds^2=dx^2+dy^2+dz^2$ via a coordinate transformation, because that's how we started!
Buuuuuuut, we can ask the following question - we define an $n$-dimensional space by giving some system of coordinates in it, $u^1,...,u^n$. We also state that if we make a displacement of the coordinates $du^i$ ($i=1,...,n$), then the actual displacement in this $n$-dimensional space is given by $$ ds^2=\sum_{i,j=1}^ng_{ij}(u)du^idu^j, $$ so, then we can ask the question is it possible to find a coordinate transformation, which brings $ds^2$ into the form $ds^2=(dx^1)^2+...+(dx^n)^2$?
As it turns out, in general, it is not possible to do so. In that case, we need to conclude that the geometrical space defined by the coordinates $u^i$ and the line element $ds^2=\sum_{i,j}g_{ij}(u)du^idu^j$ has a geometry that quantitatively and qualitatively differs from the geometry of euclidean space.
While there are subtle differences (we need to specify some conditions on $g_{ij}$ such as nondegeneracy and positive definitness, and in relativity, instead of positive definitness we have a "Lorentzian signature"), this is essentially how we define curved spacetime. We let $g_{ij}$ be reasonably arbitrary.
What is then referred to as "the fabric of spacetime", is simply the geometrical structure given by $g_{ij}$, which, as you have now seen, is malleable and variable, by changing $g_{ij}$. But this is simply mathematics, that is shown by observations that produces an accurate description of gravity, nothing else. There is no literal "fabric".
Comment: @safesphere Your comment is incorrect. There is no such thing as "curvature of time" and "curvature of space". There is only the curvature tensor $R(X,Y)=\nabla_X\nabla_Y-\nabla_Y\nabla_X-\nabla_{[X,Y]}$.
Comment: @safesphere You didn't. In fact, any metric looks like $ds^2=-dt^2+h_{ij}d\xi^i d\xi^j$ to me. Gravity's still there though.
Comment: @PointedEars Because the standard form of the Schwarzschild metric is not in a Gaussian normal form. It could be put into that form though!
Comment: This answer is incorrect. While heavy objects do curve spacetime, gravity is caused by the curvature of time only. The curvature of space does not cause gravity. From Wiki: "*in space-time, the curvature of space has nothing to do with gravity (the 'curvature of time', one could say).*" https://en.wikipedia.org/wiki/Ellis_wormhole - Because time is one-dimensional, the curvature of time and therefore gravity can be accurately visualized with a "rubber sheet" analogy where the diagram represents the gravitational time dilation in the cross section of the system by a plane through the center.
Comment: I see. So there is no such hing as "energy" or "momentum"; there is only the energy-momentum tensor. There is no such thing as "the electric field" or "magnetic field"; there is only the electromagnetic field tensor. And of course there is no such thing as "space" or "time"; there is only spacetime (along with its curvature). Thanks for your insight.
Comment: @safesphere Oh please. Go ahead, define the curvature of "time" for me.
Comment: i already have in my original comment above.
Comment: The coefficient for the temporal coordinate in the Schwarzschild metric is _not_ $1$ (or $-1$), but $\pm \left(1 - \frac{r_s}{r}\right) \, c^2$. How do you account for that with your equation?
Answer: The "fabric" you are asking about is the speed of time. Everything moves in time, but if the speed of time is different, then the motion is no longer straight and trajectories become curved. Why do things fall down in Earth? Because time there moves slower. Tragectories are always curved to where time moves slower. So the depth of how much the "cloth" in your picture is pulled down is how much the speed of time is slowed down near the heavy objects.
Comment: Such nonsense, it is not even wrong.

What is the Fabric of Spacetime?


Virtual Testing | How would it be done

Question: How would testing be done on Zoom? Or would testing be pushed off until after COVID-19?
Answer: On April 30, 2020, the FCC issued a Public Notice, "WIRELESS TELECOMMUNICATIONS BUREAU CONFIRMS THAT AMATEUR RADIO SERVICE OPERATOR LICENSE EXAMINATIONS MAY BE HELD REMOTELY." According to the ARRL Letter for May 7, 2020,

The FCC opened the door to remotely administered examinations in a June 5, 2014, FCC Report and Order, noting that, since the VE system was established, "remote testing methods have been developed, including audio and video links, either hard-wired to a site or available through internet or satellite technologies, which would allow a VE team to observe an examinee from afar." The FCC ruled that allowing VEs and VECs the option of administering examinations remotely was warranted. The FCC declined to incorporate any specific requirements or conditions for remote testing into the rules, and made it clear that VECs and VEs were not required to offer remote testing.

You may be able to find an examiner who can remotely administer a test. Groups like HamStudy may also be able to help. Searching the internet for "remote ham radio examination" turns up a variety of responses, from "Yes, we can!" to "We're developing plans" to "Sorry, we're closed."
Comment: Do you have to be remotely tested by an examiner specifically in your state?
Answer: There is not a universal answer for this.  Each VE testing group is handling it differently.  Some groups are suspending operations.  You would need to search for a group doing virtual testing to determine how it works.  ARRL and FCC have only stated that nothing prevents virtual testing, and have not given specific guidance on how to do it.
Answer: Online testing has been done in the past and is currently being done, but there are issues and only a few VE teams are currently doing remote tests.
The first issue is to prevent cheating on the exam. Previously during remote exams, examiners would require another HAM to sit the person being tested to act as a proctor. Some examiners today are requiring several cameras so they can view the entire room the person is in. Other require you to have a movable camera and will periodically ask you to sweep the room.
In addition most will not let you have a cell phone in room, no notes, books, or documents of any type. Basically they want you in an empty room, just you and the PC. You can have only 1 PC with a single monitor and you must be using software with a remote desktop feature that allow them to control your PC.
Each team seems to to be using different software to fill out the forms and actually conduct the test.
It is very time consuming as each 3 person team can only monitor a single person testing.
I know many think online testing will the way of future, but I know most VE teams will not be able to do online testing. I hope many VE teams will be able to conduct in person testing sessions in the near future. The VE team I am part of is currently not able to conduct test sessions because our meeting place was a fire station and currently no one from outside the fire department is allowed in the station.  So far we have not been able to find an alternative location.

Virtual Testing | How would it be done


From a .side file to a GitLab CI/CD pipeline step?

Question: Is there a way to add a GitLab CI pipeline step that launches a Selenium test which is coded in a Selenium IDE file (.side) ?
Comment: Have you *tried* creating that step? What happened?
Comment: I'm not currently trying to do it, I don't even know how to add steps in a GitLab CI pipeline. But before I lose a lot of time trying to do it, I would like to make sure it is technically possible. If someone knows about a technical limitation that makes it impossible, I'd like to be aware soon enough.
Answer: The new Selenium-IDE has a command line runner for .side files, based on nodejs.
I havent tried it myself on Gitlab, but if you can run it from the command line you should be able to run it in any CI/CD platform.
I guess the setup is similar to this: https://docs.gitlab.com/ee/ci/examples/end_to_end_testing_webdriverio/
Where you change the script to: selenium-side-runner yourproject.side


How to import russian user records in salesforce?

Question: I am trying to load the csv files data through data loader to salesforce,When i try to load the Russian data i get <code>??????</code> in the place of text .How to resolve this issue??
Answer: Once you save the file in excel in CSV Format, Open it in notepad and save it with encoding as UTF-8, Open it again in excel to see if character are appearing correctly. If Yes then load the file .
Assuming that dataloader is used to load this data in, then ensure that utf8 is checked within the settings
Comment: I have checked following your steps ...but i still get ??? marks in place of Russian text...it may be tht my office tool is not supporting Russian language??
Comment: Dont open in excel then ...Just directly load the CSV without opening it in Excel.The problem that happens is excel may not support the Russian character
Comment: I need to edit the data ...I tried with open office where it accepts Russian language but once i reopen that document  it shows some special characters instead of original data. Salesforce also shows the same special character
Answer: It worked with open office it is not possible to do using MS office tool.Before loading the data check wheather the utf-8 is accepted by the data loader in Data loader setting.


What is the name for those UX paradigms: "multi-selection → action" vs "action toggle on/off → selection"?

Question: Supposing desktop application where multiple elements can be selected, and operations can be applied to them:

Text editor: several characters can be selected, and bold/italic/underline applied.
Drawing editor: Areas of different shapes can be selected, and drawing operations applied.
Vectorial drawing: Several elements can be selected, and operations (change properties, move, delete) applied.
3D editor: several triangles can be selected, they can then be moved, deleted, etc..

There seems to be 2 paradigms:

Select, then apply an operation to the current selection: you have as many tools as required to produce the complex selection. Then you apply the operation to all. Example:

Select a text in a text editor and then apply bold.
On a calculator, this would be the "Reverse Polish notation": "2", "4", "+"

Toggle the operation, and then apply it to as many elements as required: Example:

Toggle Chamfer on a CAD software and click one by one each edge.
On a drawing editor, toggle a brush, and then apply to the drawing (where the selection are those pixels below the cursor)

A third paradigm would be some kind of "infix" of a calculator, but I believe this is not common among desktop software.
What is the name (if any) for those two paradigms?
Answer: The first paradigm you're describing sounds to me like a 'batch action' or 'batch operation' - applying the same action or operation to multiple items at once.
The second paradigm you describe sounded more like 'applying a tool' - the tool conveys certain properties to the items it touches.
A lot of products/systems allow these two ideas to be in play at the same time - I could select a number of shapes (batch) and apply the paint bucket (tool) to fill them with the same colour


Is it possible to change the background color of all incoming emails in Gmail?

Question: I have been working with the theme options in Gmail. There is an option for changing the background color of the text/background inbox list of emails. I would like to change the original background color of the emails when they are viewed. I do not like the strong white color in the emails and would prefer a graytone to reduce the brightness.
Answer: I would use something like Stylish for this. (It's available for Firefox and for Chrome.) Then depending on your level of CSS skills you can use a theme that fits your needs, or create a new one that changes exactly what you want to change.


Chi-square approach to calculate if two words occur together by chance

Question: I have a large co-occurrence network where nodes refer to word terms. We create a relation between "Term 1" and "Term 2" if both terms co-occur in the same sentence. For each pair we also have co-occurrence frequency (i.e., number of sentences where pairs occur).
Now I want to calculate which pairs occur together more often than by chance. We can do that by applying Pearson's chi-square test for independence. I briefly outline the approach which is common in computational linguistics. For each pair of terms we create contingency table, as demonstrated in Table 1.

$U$ in Table 1 refers to word term $u$ and $V$ refers to word term $v$. $O_{11}$ is the joint frequency of the co-occurrence, the number of times the terms in a co-occurrence are seen together. The cell $O_{12}$ is the frequency in which "Term 1" occurs in the first position, but "Term 2" does not occur in the second position. Likewise, the $O_{21}$ is the frequency in which "Term 2" occurs in the second position of the co-occurrence but "Term 1" does not occur in the first position. The cell $O_{22}$ is the frequency in which neither "Term 1" nor "Term 2" occurs in their respective positions in the co-occurrence.
Next we calculate the corresponding expected frequencies $E_{ij}$ for each table cell, as demonstrated in Table 2.

Given the observed and expected frequencies for each pair, the $\chi^2$ statistic is calculated as
\[
\chi^2 = \sum_{i=1}^{2} \sum_{j=1}^{2} \frac{\left(O_{ij} - E_{ij}\right)^2}{E_{ij}}.
\]
To make long story short, if the $\chi^2$ is greater than the critical value, we can conclude that a particular pair occurs more often than by chance.
My question. The approach described above is suitable only when we consider the order of the terms in the sentence (e.g., pair »Term1 – Term2« is not equal to pair »Term2 – Term1« because in the first case »Term1« occurs in the first position while in the second case »Term1« occurs in the second position in the sentence. This situation is reflected by cells O12 and O21 in Table1). So, my question is, how to modify the presented approach if we don't want to consider the order (direction in terms of network anlysis) of the co-occurrence. Any pointers are greatly appreciated.
Answer: The described approach does not consider the order of the terms. The cell $O_{12}$ refers to the occurrence of $u$ without $v$, and $O_{21}$ viceversa.


Internet Sharing: I just need a WLAN

Question: I need to create a local WLAN using my MacBook Air's built-in network card (I need an IP network on this, with the MacBook being the router and WLAN clients being able to talk to it with its respective IP, etc.).
Basically, I need to turn my MacBook Air into a hotspot. I do not need any internet access on this network. All I need is a wireless LAN.
I've been looking into the Internet Sharing feature in System Preferences → Sharing. However, I've run into the following constraints:

"Internet Sharing" will not work if I do not have another interface to share "from". E.g. I need to have an ethernet cable plugged in (and working) or something similar for Internet Sharing to agree to create a hotspot. I don't need Internet on this network, I just need a LAN.
It's not doing DHCP. When I do get the hotspot to work (with another interface present, see point above), the LAN clients get self-assigned IPs such as 169.254.203.23, so it's just not handing any IPs out. I've tried messing with /etc/bootpd.plist, but it didn't help.
I can't figure out how to enable all this mess programatically. Not only do I need to create an Internet-less WLAN with only my Wi-Fi interface and do DHCP, but this also needs to be done programatically (AppleScript, shell script, anything works). I have no clue how to do this.

So, how do I create a WLAN that:

Runs (preferably) out-of-the-box on any MacBook.
Does not need another interface to work, just my Wi-Fi interface.
Can be turned on programatically.
Does basic DHCP (I can figure this out myself, I've found a node-based dhcpd server).

I am running macOS 10.14 Mojave.
Answer: This is not a programmatic but a manual solution.
Go to System Preferences → Network and check Show Wi-Fi status in menu bar.

Now click on the Wi-Fi icon shown in the menu bar and select Create Network....

Supply network name in the dialogue box shown (the default name assigned is the computer name set under System Preferences → Sharing).
Comment: This does not create an infrastructure network. It creates a very incompatible adhoc network, which basically only other Macs can connect to.

Internet Sharing: I just need a WLAN


Where do Badass Marauders spawn on Pandora?

Question: In Borderlands 2, I'm having a hard time tracking down which area Badass Marauders are local to on Pandora. I'm assuming they have the same spawn points as regular Marauders, but I'm still having a problem tracking them down.
Comment: Badass Marauders are a stronger breed of normal bandits. They do not spawn in some specific location, rather, all bandit-populated zones have a few. It would be hard to list all the exact spawn points, as they are many, and pointless, as there are only one or two guys in each. Example: the camp around Flynt's ship on Southern Shelf has one Badass Marauder right after Med Vendor.
Comment: Lots (including four at a time) of those guys appear in Bandit Slaughter quests, but they're not repeatable.
Comment: I should have made it less specific, as I know that general groups of enemies spawn together (psychos, bandits, marauders, bruiser, etc). I was just wondering which areas were specific to Bandit (and their Marauder subset) spawning.
Answer: The easiest way to farm them (3 to 4 guaranteed) is to head in Tundra express, at the north west of Tina cave you have a small camp with rat, kill them, find the valve that trigger the alarm. The alarm will spawn 3 wave of enemies and the last always spawn 3 to 4 Badass Marauder.
Watch this video for more details :
Comment: voted up for awesome answer, thanks for the video. I should try and start asking youtube before getting on this site sometimes.
Comment: Especially on games with a large community (like BL, Diablo etc.), you always have youtubers such as MorningAfterKill (who made this vdeo) that give you thos tips ^_-
Answer: If you're asking because of the loot challenge, the easiest place to find them is Blackburn Cove. After killing Knuckle Dragger, continue on to — and through — Liar's Berg. Take an immediate left when exiting the Liar's Berg gate, and fight through to Southern Shelf - Bay. That puts you right outside Blackburn Cove.
I say "easiest" not just because it's proximate to the Knuckle Dragger fight location. The bad guys in this location will all be much lower level than you are, unless you just started a new character, so you can breeze right through the low-level enemies on your way to the Badass Marauders. Even Midge-Mong will probably be a push-over.
There should be about four Badass Marauders in Blackburn Cove.
Two guaranteed are in the bar way up high, where the vending machines are. The bar door unlocks once you kill Midge-Mong, then the two marauders pop out from the room behind the bar just after you walk in.
The other(s) will be out in the marina after fighting past all the low-level bad guys.
Comment: The Loot Challenge was part of why I was asking the question, but getting the Badass Bingo challenge was also part of it, as Marauders are one of the lower level enemies on Pandora.
Comment: I completely forgot about mide-mong's area. That is a perfect place to farm early on in the game. Thanks for your answer. :)
Answer: Badass marauders is first found when your on your way to captian flynt but there is only one. If you want to find more go to the fridge in the slaughter house do the challenge there is a time where a lot of them spawns at the same time. But watch out they are not the only badasses.. There are also badass nomads, badass gloiaths and badass psychos..


Tags: "cue" or "cuelang"?

Question: CUE is "an open source language, with a rich set of APIs and tooling, for defining, generating, and validating all kinds of data" (to quote https://cuelang.org/). I asked a question about CUE a few weeks ago; yesterday I noticed that the tag cue that I had originally used has been replaced with cuelang. There are currently 4 questions with this tag. But since the name of the programming language is CUE, I think the tag should be cue as well? After all, we don't have golang, rustlang, phplang etc. etc., so why cuelang?
Comment: We generally add a disambiguating identifier for certain words; this is one of them. `cue` immediately sounds like a tag that's gonna be misused for anything involving the physical cue object, the abstract concept of a cue, as well as cue cards, etc. to avoid that, it's better if the cue language tag is called cuelang. There's also a couple examples of this in practice as well, including [tag:nim-lang], [tag:crystal-lang], and [tag:logo-lang]
Comment: @Zoe [tag:crystal-lang]? Geez, we might as well retag [tag:python] to python-lang to make sure people don't ask questions about snakes
Comment: @Nick You'd think that, but there's another programming-related tool called [crystal reports](https://stackoverflow.com/tags/crystal-reports/info) (possibly just crystal as well, there's something called crystal-space-3d which seems to be related, but I'm not an SME and I have no clue). So there's a conflict with something actually used in programming, justifying a disambiguation. In the case of cue, cue cards, concepts, and the object are all things that show up in apps (flash card apps, anyone?) and games (there's _lots_ of implementations of 8 ball pool).
Comment: [tag:golang] exists, as a synonym for [tag:go].
Comment: Am I supposed to say [cue] or [cuelang]? Can someone provide me with a cue?
Comment: @BenjaminW.: yeah, because "golang" is more search-engine friendly than "Go" (ironic if you think that it was invented at Google). Also "golang.org" was the original website - but "Go" is still the official name, and actually the Go team seems to dislike "golang" so much that they changed the website to "go.dev" recently (of course that probably wasn't the main reason for the change, but I think it contributed to the decision).
Comment: There's even an [FAQ](https://go.dev/doc/faq#go_or_golang) about it.
Comment: @rob74: They also stepped on [a chess-like game](https://en.wikipedia.org/wiki/Go_(game)) with a history of many thousands of years.
Answer: I did it in an attempt to disambiguate the cue tag before it's too late.
There were 39 questions with the tag,

4 of them were about cuelang,
7 of them were about cue-sheets,
and 12 of them were about cue-points.

I retagged those. The rest were about stuff that don't warrant new tags, so I removed the tag from them.
In short, it's cuelang because cue is ambiguous.
Comment: Shouldn't it be called `cue-lang` instead of [tag:cuelang]? To be coherent with the existing [tag:nim-lang], [tag:crystal-lang] or [tag:logo-lang] (c.f. Zoe comment on the question).
Comment: I also agree with changing it to `cue-lang`, since it's a language, and the name of the language itself isn't "Cuelang". I did a quick peek at [`*lang` tags](https://stackoverflow.com/questions/tagged/*lang), and it looks like the tags which don't have a hyphen generally are actually named *x*lang, which isn't the case here.
Comment: Ok, thanks for the clarification! Makes sense, "Cue" is more ambiguous (not to mention less well-known) than "Go", "Rust", "PHP" etc.. Maybe they should have taken an example from the band R.E.M. and called it C.U.E. - after all the name stands for "Configure Unify Execute"...
Comment: @rob74, the vast majority of acronyms don't have period separators. Laser, LED, modem, TWAIN, PHP, and probably millions more. So why would the makers of Cue even think about putting in periods? Just to disambiguate on SE? Not to mention that most people don't put the periods in REM when referencing the band, rather than the medical term with the same meaning.
Comment: @computercarguy: But then there is [D.A.D.](https://en.wikipedia.org/wiki/D.A.D._(band)) - [sample](https://www.youtube.com/watch?v=aPH0uqKoDFY&t=1h5m20s) (not to be taken too seriously).

Tags: "cue" or "cuelang"?


Maidsafecoin sent to Ledger Nano S

Question: I sent maidsafecoin to a segwit Bitcoin address generated by my Ledger Nano S.  My understanding is the coin is safe at the address and the Nano recorded the transaction as a very small amount of btc.  I have the bitcoin address.  Can I extract the private key from the Nano S that corresponds to the bitcoin address and so move the maidsafe coin?
Answer: The whole point of using a hardware wallet is that private keys can never leave the device, so no, there is no 'extract private key' function on the ledger.
The only way to gain access to individual keys is by using the recovery seed, but doing that is extremely unsafe.  The scheme used to derive child keys on a hardware wallet is incompatible with private key export as a single private key leaking could compromise the entire wallet.
Relevant BIP32 section

Note however that the following properties does not exist:

Given a parent extended public key (Kpar,cpar) and a child public key    (Ki), it is hard to find i.
Given a parent extended public key (Kpar,cpar) and a non-hardened child private key (ki), it is hard to    find kpar.

Maidsafecoin sent to Ledger Nano S


View history of anonymous users

Question: I have a Google Spreadsheet, which is accessible (only view) by anyone who has the link. I want to have an overview of every timestamp the document was opened by an not-logged-in (= anonymous) user. How can I do this?
Comment: @VidarS.Ramdal It's a duplicate because the answer is the same. While this question is specific to Google Sheets., AFAIK there aren't specific solutions. i.e. onEdit simple/installable triggers and onChange installable triggers which are specific for spreadsheets, can't be used to log spreadsheet views from anonymous users.
Comment: The onOpen trigger besides being available for spreadsheets it's also available for documents, presentations and forms (edit view)
Comment: @Rubén yeah I saw that thread and it's dated from 2011 and the solution there is with a third party that didn't seem to work for me
Comment: I believe that this is not _strictly_ a duplicate. This question is specific to Google Spreadsheet (and as such can use a Spreadsheet-specific solution), while the linked answer is generic to all Google Drive documents.
Comment: @Rubén I guess you're right, after how this question has evolved.
Answer: I was hoping to answer your question with a Google Apps script. There is an onOpen event, but it fires only on users that have edit access to the spreadsheet. Since your users only have view access, a script won't work like that.
If you're willing to give anonymous users edit access (which will let anyone in the world who knows the URL edit), you could log all visits to your spreadsheet to a separate Access Log spreadsheet.:

Create a new spreadsheet document, and create a sheet (tab) on it, let's call the sheet Access Log.
Note the ID of the created spreadsheet. You'll find the ID in the browser's location bar:

Open the spreadsheet you're going to make public
Go to Tools → Script editor
Paste the following script into the script editor window:

function onOpen() {
var sheet = SpreadsheetApp.openById("11evsXXXXXXXXXXXXXX8Xt3E6vI").getSheetByName("Access Log");
sheet.appendRow([new Date(), Session.getActiveUser().getEmail()]);
}
  ... replacing 11evsXXXXXXXXXXXXXX8Xt3E6vIis the ID you copied in step 2
Click the Run button, a dialog will open asking you to grant access to the script (you only have to do this once)
Close the script editor window

From now on, anyone visiting your sheet will cause a line to be appended to the Access Log sheet.
I have setup an example spreadsheet to demonstrate. It does not allow anonymous users to edit, so it will not log anything, but feel free to copy it and use it as a basis for your own sheet.
The script explained:
The onOpen function name tells Google Sheet to run this script whenever the sheet is opened by someone. ...openById(...).getSheetByName("Access Log") gives a reference to the sheet named Access Log in the separate spreadsheet document. Finally, sheet.appendRow([...]) appends a new row to the log sheet, with a timestamp and the current user's email address (which in case of an anonymous user will be empty).

An alternative solution is to use a URL shortener with analytics, such as bit.ly. It will allow you to make a short link that you will distribute to your users. When your users visit the link, they will be redirected to your spreadsheet.
By logging in to bit.ly, you will be able to see simple click stats.
Now, obviously, this will only work if your users only use the short link when visiting your spreadsheet. You won't be able to count anyone going directly to your spreadsheet by its long URL.
Comment: Or how about this: can the log be copied automatically to a different sheet in my drive folder, then wipe the log data on the original sheet that the anonymous user has access to?
Comment: See revised answer. The script now logs to a separate spreadsheet document.
Answer: unfortunately, that's not possible, because anonymous users are not included in the log.

enter your Drive - https://drive.google.com/drive/my-drive
find your file and check log pressing ⓘ button to see what is logged:

alternatives are - bitly statistics or custom script

View history of anonymous users


Transfer current Google Search Console property with data to new one

Question: I have a Google Search Console account right now and submitted this property through the "URL prefix" method. Now I am going to submit it again through the "Domain" method to include the subdomain data too, and I want to know how can I transfer the old property data to a new one? I don't want to lose the data...
Answer: You should be able to also add and verify the Domain Property too.
You should also keep the verified prefix url property for linking to Google Analytics, if you are wanting to do that.  If you do not delete the prefix url Property in GSC then you won't lose the data.
What do you mean by:

by I want to know how can I transfer the old account data to a new
  one? I don't want to loose the data...

Do you mean you want to access the old/current account data via a different Google account, or something else?
Answer: Google doesn't provide any mechanism to transfer data between search console properties. If you want to be able to see the data from your prefix property, you can just keep that old one around.  You'll be able to check the data in the old property and you'll be able to check the data in the new property. There is really no reason to delete the old prefix property.


Database choice when number of columns varies

Question: If i'm considering storing something like the list of all the movies a person likes on facebook, the number of columns per person isn't constant.
I've read some articles that are not in favor of NoSQL.
Is there a MySQL hack that would let me do something like this?
Answer: As I noted in the answer to this question:
insert into two tabels in mysql database at the same time
What your looking to do is create an table to store one -> many relationships.  Varying the number of columns isn't possible, what you do is associate multiple rows with the same user.
Answer: There is no hack needed, you just have to plan your schema in order for it to be relational.
For example, suppose you had a table called Users, and it had the following fields: id, name, email, password. Its graphical representation would be something like this:
id | name |    email    | password
------------------------------------
1  | John | email@example.com | <md5 hash>
2  | Mark | email@example.com | <md5 hash>
ETC...

Then, since you want to store the movies the user liked, you could have yet another table, called UsersMovies, containing fields id, user_id, movie_id:
id | user_id | movie_id
-----------------------
1  | 1       | 187
2  | 1       | 486231
3  | 2       | 9843
4  | 1       | 457
ETC...

This second table would contain the relationships between each user and one movie he likes. This would mean that, for user_id 1, you would know he likes movies with the ids, 187, 486231 and 457. This movie_id could hold the facebook's movie id, or whatsoever identifies this movie as such.
Adopting this model, fetching all of the movies for X user would be a simple as: SELECT * FROM UsersMovies WHERE user_id='X', X being the user's id in the user table, while fetching all users who like the movie X would be as simple as SELECT user_id FROM UsersMovies WHERE movie_id='X'
You can read more about this from this place.
Answer: You can do it with traditional relational databases (like MySQL).
Since it's a schema-ful database, you can't have different set of columns for each row. However, you can have one column (let's call it extra) which will be of type TEXT (or BLOB).
You can take all your variable columns, serialize them to JSON (or XML or Protobuf or MessagePack or whatever) and write to this special column.
This way you can write arbitrary data to a record and still use MySQL.
However, you just lost most of RDBMS functionality: indexing, querying and efficient updates of that data. It's now a key/value store with persistence!
At this point you might be better off with a true NoSQL solution. Amongst the better ones I can name MongoDB. It's a schema-less database (which means that every row (or document, in their terminology) can have its own unique set of fields).
You can build secondary indexes on those fields and efficiently query documents. See the site for more features and presentations and videos.
Gather as much information as you can and make an informed decision.


Replacing existing 9" dome fixtures with new 13" ones

Question: I purchased three 13" LED dome fixtures for my kitchen over the sink and the two bathrooms.  I removed the original fixture and the existing brackets screws are only 4" apart.  The new fixtures do not include brackets.  The old bracket would have to accommodate screws 6" apart which it does not.  Can anyone explain to me, how do I mount these?  Do they make longer brackets or do I have to change the boxes out?  Any help would be gladly appreciated!
Comment: Please post some photos of the old and new light fixtures and the brackets in question.
Answer: Holes 6" apart for a lamp fixture are not very common. You need larger or adjustable crossbar (also called a fixture bracket)

You can attach this type of bracket to standard boxes with holes at 4" or 3 1/2".
Depending on whether the crossbar you find is threaded at 6", you may need to install machine screws in the crossbar slots, locked into place with nuts, that then stick down through your fixture mounting holes.
<code>The links and images are for illustration only and are not an endorsement
</code>


What is better for coding - desktop or laptop?

Question: Use of desktops are decreasing day by day in daily life but for coding purpose are there any reasons for using desktop over laptop?
Comment: @Andreas Rejbrand  - Don't compare apples and oranges.
Comment: My ideal would be separate detachable parts. Keyboard, mouse, track pad for locations without a mouse surface. 2 large monitors, 1 small monitor. And a device to hold up a monitor in your lap. All of it light weight and fitting into a backpack. So you get the ergonomics of a desktop with the portability of a laptop.
Answer: Assuming you have an external monitor and keyboard to connect to your laptop the difference is small.
It is always better to work in a desktop like setting (bigger screen realestate, more ergonomic environment), but you can't take your work with you without a laptop. So if portability is important, get a laptop and a good external screen and keyboard to connect it to. Otherwise you might as well stay with a desktop.
Comment: The ergonomics is more important than you think. Using a laptop (without external screens/keyboards) all day is actually quite a strain on your neck and back, holding your head in a tipped forward position for hours and hours.
Comment: @user1525: That's one way to put it. I would rather say "best of both worlds"; portability and ergonomy. Don't remember when I've last time actually upgraded hardware on any computer. Could be in the 90s.
Comment: Plugging a monitor and keyboard into a laptop is basically taking the long way around to making a desktop without easily upgradeable hardware.
Comment: @Martin @Benjol mantaining two (or more) development environments up to date is a pain in the ass.
Comment: An external monitor helps, but I always feel cramped when I'm using a laptop. Extended programming sessions on laptops just discourage me.
Comment: Alternatively you could put all your work on USB drive and take that backwards and forwards between work and home.
Comment: @Martin, or use Dropbox
Answer: I once worked with a contractor whose entire lifestyle was enabled by her laptop.
Her worldly possessions could fit into a couple of bags -- and one of those possessions was a Mac laptop, which for her was a magic box that made money appear.  I literally -- literally -- was often unsure of which continent she was on any given day.  Most of the time she was some place in the Argentina hinterlands where she found a good internet connection, but she could have been in San Francisco, or DC, or Hong Kong, or....
I met her in person, once.  She was in town for a relative's wedding.  I asked where she was heading afterward.  She didn't know; either Argentina or San Francisco.  She had everything she owned with her, and she'd decide tomorrow.
She did good work, too.
For me, I much prefer developing on a desktop; I loves my multiple monitors, and the physical environment is more ergonomically sound.
But when I (or anybody else) say some version of "It all depends on what your needs are," it's true.  It all depends on what your needs are.
Comment: But is she on StackOverflow? :)
Comment: What an admirable lifestyle. Very interesting.
Comment: Sounds like Luke Gorrie. That dude gets around a lot, too.
Answer: The major plus point with a laptop is portability, and that's a huge plus, but a desktop has the following performance and productivity advantages:

Bigger screen. The average desktop screen is larger than the average laptop screen and you have the option of going all the way up to 30" or so. A laptop can do the same resolution, yes, but the pixels are tiny.
Multiple monitors. Yes, the same thing could be achieved using a laptop and a USB/PCMCIA video card, but then you'd be tied to a desk.. defeating the point of the laptops' portability as they'd need to be at the same height to avoid getting a crick in your neck.
Faster/Multiple CPUs. A desktop can have the very fastest of processors and more than one processor too. A top-of-the-line laptop has a fast processor, but it usually tops out at a Core i5 and never the fastest.
Better/Multiple Graphics cards. A desktop can have multiple high-end graphics cards, possibly linked together.
Lots of RAM. If you want fast response, you put in  as much RAM as you can afford. Not having to swap memory gives a massive performance boost, even if you were using Solid State Drives.
Choice of Keyboard. You can have a bigger keyboard with dedicated function buttons (Volume, Cut/Copy/Paste, etc) and even a split one for improved ergonomics.
Choice of Mouse. You could even have a vertical mouse, trackball or graphics tablet, since you're already sat at a desk. It's hard to use a mouse
Better Speakers. The speakers built into a laptop are very small and often cheap.
Wired networking. No need to worry about Google Street View reading your emails if you're not using Wifi. If you've another machine on the same network (e.g. NAS device), it's a lot quicker to use Wired networking.
Remote Access. It's easy to install secure remote access software such that you can get to your desktop PC from your Phone or some other PC. Many routers can be configured to wake up the PC from 'off' (not just sleep), especially if you have AMT.
Faster/Multiple Hard Drives. SSD is the fastest, yes, but also expensive for lots of storage. If you're doing serious video editing, you'd want multiple hard drives, which is difficult in a laptop. Yes, you could connect a big USB drive to a laptop, but that's a hassle and can't easily be done in the airplane/bus/train.
Better/More webcams. The webcam built into a laptop is often fairly poor compared to a decent HD USB webcam.
Expansion. All of the above hardware items can be upgraded at any time without replacing the entire machine.
Comment: I have all of this with my laptop... Exception is Expansion but I buy a new one every few years anyway so in a way that can count...
Comment: about #9, funny, but I hope you're still not checking email in a non-SSL'd way...
Answer: Very much depends on what you code, how you code and the tools you use/need.
My development projects...

Are graphics intensive (2D and 3D).
Are compute intensive.
Require multiple IDEs and usually
more than one instance each.
Include large volumes of reference
material...usually PDFs.
May target custom hardware.
May require CAD/CAM/CAE
tools.
May drive me to drink.

So, for me a desktop with several large monitors is more of a requirement than a choice.
I would also suggest that working from a loaded desktop with multiple 24" monitors is going to be the more productive choice regardless. Having your GUI designer, code editor and browser on separate monitors saves a lot of clicks and trips to the task bar remember: "Clicks take time and time is money"...is not just something your grandfather used to say...it adds up...plus...Coding, reading stackoverflow (aka: geekporn) and watching [some geek movie] all at the same time doesn't really suck.
Of course, at the end of the day desktop it is what works desktop best for you. desktop
Comment: "May drive me to drink." --> LOL :-)
Comment: "May drive me to drink.", desktops fair better when your drink spills too, or at least they are easier to fix.
Answer: I agree with EpsilonVector, the big issue is monitor space. A laptop can usually support a second monitor. But a desktop can support three or four monitors. The more, the better.
Comment: Not necessarily, there are USB based video cards
Answer: Desktop. I need my keys to be where they are. When microsoft came out with that stupid "lets turn those Insert/home/pageup/delete/end keys around 90 degrees" I raged like never before in my life. Keep my damn keys where they are, I don't want your garbage. I want my Model-M keyboard I've been using since the days when Comodore roamed the earth. My keyboard gets a lot of wear and I end up replacing normal ones really frequently because the contacts break up.
I need more than one real monitor. I don't want to look at some tiny freaking screen, and I don't want to lug around a 24 inch screen beast that devours the battery life.
I don't want any special over-ridden "make MS Word open" BS keys. I don't need to hit F-Whatever and have my screens flicker around. I want a numpad. Don't screw with my freaking keyboard!!!!
I don't use the mouse often, but I'd sure as hell use one over the trackpad or that TrackPoint garbage. When I'm typing I don't want the side of my hand to touch the trackpad and suddenly the text cursor is all over the screen.
Why would you EVER use a laptop for something other than screwing around in class at college?
Answer: I'd go for laptops with external monitors. It's perfect for situations where you get tired of coding on your desk and you want to go somewhere else to code. You can also take it with you around the office in case you want to show or discuss your code with your officemates personally while not having them go all the way to your far away desk.
Comment: While I agree with most, there are a multitude of simple tools, such as hg serve, to accomplish the latter point.
Comment: We only do this for code that we're not ready to push/commit yet so using hg serve is kind of an overkill.
Answer: Laptop with 1920X2000 pixel resolution and 4 virtual desktops.
Yes, laptops severely lack the ergonomics of a full keyboard but I'm addicted to the low tactile feedback needed to type. I can type faster on a laptop keyboard than a full keyboard any day.
Tossing it into a bag and going somewhere else to code is always useful too. Being a slave to your desktop can be depressing and makes me feel like breaking out sometimes.
As far as impact injuries go, I actually type on a laptop keyboard with my wrists at a 45 degree angle anyway. I'm not sure if that's normal for most but it just feels natural to me now.
The external desktop isn't really necessary unless you need to see a direct material reference while coding. Other than that, I don't see much use for it. Multiple virtual desktops do a much better job of isolating responsibilities.
I usually use 4:

one for a web browser
one for revision control stuff
one for the IDE
one for unit testing

I also make it easy to switch by assigning the super+left and super+right to cycle between the desktops. Only having what your working on on the screen at any given time makes it much easier to stay focused on the task at hand.
The extra monitors just serve to take up valuable desktop space that I'd rather use sketching notes down on paper. It's amazing how much easier ideas can flow on paper.
Comment: On that last point - if you don't have enough desk space for a mouse, full-sized keyboard, 2+ monitors *AND* a sheet of A3 paper then get an adult-sized desk, not a kid-sized one.
Comment: @Peter Regarding your last comment... Aside from the fact that it's an a**hole remark, sometimes you don't have the choice of how large your desk is. I have spent a lot of my development time working on the road where my workspaces have ranged between managers offices to a little space between the terminal consoles.
Comment: @Peter and... I mentioned isolating responsibilities as an added advantage. When you have less screen real estate in front of you, it's easier to drill down and focus on what you're doing. I used to work on a triple monitor setup but found it to be cumbersome after the 'cool' factor wore off. IE, more monitors don't make you more productive, more screen real estate (and the ability to run multiple apps in full screen) does. I'd get into fitts law and the theory behind UI design but this article http://particletree.com/features/visualizing-fittss-law/ describes it much better than I could.
Comment: You can get full low-profile keyboards. http://www.cherrycorp.com/english/keyboards/Desktop/G85-23100/index.htm Much better than everything being crammed together.
Comment: Oh and you're definitely missing the point with multiple monitors - it's *not* about isolating responsibilities, it's about faster task switching - I can flick my eyes across to the UI, make a decision, and then back to the IDE without having to stop writing code.
Comment: @Peter I think you missed my point. I write code on 4 desktops not 2. Having a 4 monitor multi-monitor setup would be pretty retarded. The only time I find 2 monitors to be useful is when I'm drawing graphics and electrical designs and need reference materials on the other screen at the same time.
Comment: (Eugh, I do wish SE made this sort of thing easier. Anyway, here we go...)
Comment: **Reply 1:**
Using multiple monitors does not mean not using multiple desktops. I've worked with 1m+1d,1m+*d,2m+1d,2m+*d on various setups.
I was using multiple desktops before I had two monitors, and I kept using them after having two monitors, but eventually gave up because the benefit to me was minimal.
~~~
**Reply 2:**
It's not an asshole remark. (I'm currently stuck with a kids desk too; it's annoying). Productivity depends on a proper environment. You might not have that choice if you're stuck in a crappy office or whatever, but that doesn't change that productivity requires space.
Comment: **Reply 3a:**
I have no problems drilling down or focusing when using two monitors, but when I really want to (e.g. if watching a film on primary), I just hit the off button (and/or disable in UltraMon). I haven't bothered with triple monitors (a third half-size screen might be handy sometimes, but generally two is fine), but I've being using dual monitors for ages - the "cool factor" wore off years ago.
As I mentioned, I stopped using multiple desktops because the benefit to me wasn't huge, but I *started* using multiple monitors at home too because it certainly is more productive.
Comment: **Reply 3b:**
The part of Fitts' Law that you're referring to - full screen edges having infinite depth - is valid, but not that significant for anyone with competent mouse control, and only broken for touching areas of multiple monitors (At home, I actually make use of it because my monitors are offset and only one corner overlaps - so I can get into the top right of both monitors quickly.)
Comment: Just to re-iterate: I'm not saying multiple desktops cannot be useful, I'm saying they don't stop multiple monitors from being useful in their own right.
Answer: Laptop are more expensive for the same prepossessing power.
So, the real question is: could you (or your employer) afford a laptop?
You could get rid of must of the disadvantages of the laptops by getting other material for it; extra(s) monitor(s), docking station, keyboards and mouses, external drives, extra power supply, wipers, air conditioning, air bag and so on. But that make the whole package price differences bigger.
Comment: @Ken It not a question of spending an extra 1000$ on the computer, it's a question of spending an extra $1000 for a laptop instead of spending an extra $1000 on a better desktop. Normally, you should get a "shopping budget" for the computer, the trick is to use it well.
Comment: If your employer can't afford or doesn't want to spend an extra $1000 to get you the computer you want/need, then in my opinion you need to find a new gig where they treat you right.
Answer: Show me an ergonomic laptop with 3 screens (or similar single screen resolution) and I'll go with a laptop, til then it's a desktop all the way.
Portability is not a problem when you are using remote desktops.
Answer: Desktop, hands down.
Throughout my time at university I used a low-spec laptop with Windows Vista for the majority of my development needs, and more often than not the pain of leaning forward, sitting uncomfortably on a bed and using it on a train isn't worth the convenience. Laptops are good if you're doing some quick document writing or surfing the Internet, but for anything serious it's really not worth it.
With a desktop computer, all these issues are taken away and left with how you sit, your mouse and keyboard layout, etc. Nowadays I'd never choose a laptop over a desktop, unless my company were to give me a laptop for free for remote work.
In the end, I typically opted to stay behind at university and get work done on a (slow) desktop, rather than work on my (slightly quicker) laptop.
Comment: Look at your laptop. Now look at me. Back to the laptop. Now back to me. I plug in a keyboard, mouse, and external monitor. Your laptop is now desktop!
Comment: True, but it's either at a far lower spec or it's far more expensive than a desktop. If you're going to use a laptop as a desktop you may as well buy a desktop.
Answer: Laptop! If you are having back problems, repetitive stress, carpal tunnel problems, or whatever, then you're doing it wrong. You are programming for too long at a time.  Sit on a couch, change positions frequently. Get up and down off the couch. Get a coffee. Go for a bike ride at lunch. I'm sorry but carpal tunnel and stuff comes from using a computer for too long in the same position. It means you're working too hard and not moving.
Laptop! If you're too poor to afford a laptop, or your job won't buy you one, then you should get a different job! Hello!  Programmers are supposed to make a lot of money!
Laptop! Why do people need so many monitors? I understand you have lots of programs to open, but do you really frequently need to see more than two at once?  You don't need 10 monitors. It honestly doesn't make you look like you're smarter. You look like a super-dork with all those screens.
Laptop!  For heavens sake do people really still uses mouses? That's adorable.
Comment: "It means you're working too hard and not moving" "Programmers are supposed to make a lot of money!" "why do people need so many monitors"... are you a kind of manager?
Comment: "You are programming for too long at a time."
Comment: Some jobs won't buy people laptops because they get left on trains and the compromise company confidential data security.
Answer: If you can't afford a high-end enough laptop, get a desktop. 3 or more monitors - desktop. Ideally, I would only program when sitting at one desk, but it doesn't always work that way.
I don't have an office at work, so sometimes I steal a conference room and use a laptop.
Some tasks are mundane and can be done watching TV. Others, require seclusion. Never know when you have to program on the train or some off-site location.
Answer: Laptop, if you know the key commands to switch windows you can "simulate" the experience of multiple monitors anyway.  In addition, you don't have the added overhead of moving your head/eyes to focus on some other point, you just look at the same physical space in front of you while switching what is in that space quickly.
I also used multiple monitors for a time and found that the process of managing those monitors and all the open windows/applications etc to be more difficult than doing it with just one screen.  That's just me though :)
Answer: Laptop, easily.
I do not like being stuck in the house all day. I actually try to stay out most of the time. I live in a city so I can go to a few diff coffee shops or wherever and code. If I am actually at the house, much easier to lay on the couch or something.
Just make sure you get one with high resolution. Preferably an apple macbook pro or dell studio with 1920x1200 res. Just use virtual desktops. I literally hate sitting at a desk all day, that was the main reason I quit my 9-5 job in the first place! Plus you can sell your desk/chair/speakers or whatever else you probably have and create more space.
Just go sit at your kitchen counter/table/couch/chair/coffee shops. I could never go back to working at a desk all day. It's also much easier for meeting clients somewhere and showing them things, or of course traveling. I live a lifestyle somewhat similar to the lady going to SF or Argentina.
Answer: As long as you connect 2 monitors minimum and an external keyboard then the laptop takes it for me.  The automatic battery backup has saved me several times. Of course you could connect your desktop to a ups and get a similar affect.
Comment: "Could"?  Do you mean that there are programmers out there who use desktops *without* a UPS?!?
Comment: :D I was referring to the shipping company http://www.ups.com/
Comment: Personally, I don't mess around with UPS for my desktops; I prefer FedEx or I just go down to Best Buy and pick one up myself. Cheaper.
Comment: @ChristianMann: I hope you're being ironic there
Answer: You can get enough screen real estate out of a laptop through the use of virtual desktop software and external monitors. The real reason to prefer a desktop machine is the (usually) higher physical memory limit (my desktop has 32GB RAM) and faster/more CPUs/cores.
Answer: I have a powerfull notebook, really good for software development and better: it's portable!


In Oracle America v. Google, what was the District Court jury's rationale behind its "fair use" finding?

Question: In the case of Oracle America v. Google, the District Court of Northern California ruled on whether or not Google's reimplementation of 37 Java APIs constituted fair use. My question is, how - in the said jury's opinion - is Google's action "fair use"?
Answer: Here are the jury instructions.
These describe how to evaluate witness testimony, burdens of proof, and the four-factor fair use test, among other things.
The jury had to answer yes or no to the following question:

Has Google shown by a preponderance of the evidence that its use in Android of the declaring lines of code and their structure, sequence, and organization from Java 2 Standard Edition 1.4 and Java 2 Standard Edition Version 5.0 constitutes a "fair use" under the Copyright Act?

They answered yes. Juries do not explain their reasoning (different jurors might even have different reasonings), but the assumption is that they followed the jury instructions to arrive at this conclusion.

To be clear, the issue wasn't reimplementation of 37 Java APIs, but a more limited taking, including "the declaring
code and the structure, sequence, and organization".
Comment: "*To be clear, the issue wasn't reimplementation of 37 Java APIs*" - Right, Oracle wasn't suing Google for writing ""different code that produces the same results"", as Oracle has 0% chance of winning that. They were suing over Google writing code that shares the same function signatures and function names. Which is dumb if the jury let them win over that (it'd legally throw a wrench in alot of existing software - including some of Oracle's own), but Oracle had a good chance of winning.
In another Oracle claim, Google copied actual code and documentation - that, Google will likely pay for.


Phone not showing as USB Connected

Question: Moto X4 running Android 8.1.0. Attempts to connect the phone to any of my Windows 10 PC fail. The phone begins to charge but under Settings, USB says Not Connected. The phone does not appear in Device Manager on the PC. A Moto E4 running Android 7.x works without issue, allowing me to see files on each internal and SD.
Comment: AFAIK The X4 has USB-C and the E4 uses Micro-USB, therefore you are using two different USB cables. Make sure you are using the original USB-C cable or if it is the one causing trouble try a different one.
Comment: @Robert I tried the original USB-C cable (Which did work once before with the same computer) as well as the same Micro-USB cable with a USB-C adapter. I have an additional USB-C cable on order as well.
Answer: There are reports that the update to 8.1 has disabled USB storage functionality but there is a fix on the way (time table unknown). The only work around right now is to disable your lock screen, reboot, then you can connect it. This worked for me but it will stop working again as soon as you re-enable your lock screen (which obviously everyone should).
Sorry, but long story short, the update broke it and you'll have to wait for a fix.
A Motorola agent confirmed the issue on the official Lenovo forum
Comment: The latest security patches released in June corrected this issue.

Phone not showing as USB Connected


template file for content header of a view

Question: I am using views 2. In views, it asks you for the title of the view and this title is displayed on the screen at
div id=content -> div id=content-inner -> div id=content-header -> h1 id=title
I would like to know if there is a template file which I can modify that can modify this title (ie: add some text to it). I think I can do this with javascript or with css using :after, but I would like to use a template if is available.
Answer: As far I understood you want to  modify title of your views page.
This title is the title of entire page.
You can modify this title using drupal_set_title('Your Title');
If you want to modify this title you can load current title first by drupal_get_title() and then set new title.


What is the most distant object from the Earth that a spacecraft has visited to date?

Question: What is the most distant object from the earth that a spacecraft visited has visited so far? What was the mission and when did it happen?
Answer: Depending on your definition of "object," Neptune is currently the farthest. It was visited by Voyager 2 in 1989. New Horizons will be visiting Pluto in 2015
If by object you mean cosmic structure though, then Voyager 1 is currently in the Heliosheath and is expected to reach the heliopause by 2015. These are regions that describe interactions between the sun's solar wind and the interstellar medium.
Comment: Just crossed it's orbit
Comment: Had Voyager 2 really visited Pluto? Or just crossed its orbit?
Answer: We landed on Titan in 2004.
That is definitely a milestone in being far away and landing on the surface of something big.
Source
It's a damn shame they didn't manage to get a better photograph of the surface.
Comment: Welcome to Astronomy and thanks for your input! I think this answer has potential value, but whilst this may provide access to relevant information [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
Comment: +1 for "landed" as a fair interpretation of "visited"...


How would one simulate the law of conservation of energy?

Question: I'm new to computer science, but I've studied physics for a while. I'm just curious, if one wanted to make a simulation of the law of conservation of energy, on a large scale, how would it be done? Most simulations take shortcuts for objects off screen, or may even skip them entirely during iterations. The objects may be frozen in place of screen, or grouped together if not interacting. Can these tricks be applied when simulating conservation of energy, without violating the law? Thanks.
Comment: I'm not sure what you mean by "a simulation of the law of conservation of energy". Energy is conserved in physical processes, and we can simulate those processes. But how would you simulate the law in the abstract? That seems like asking how one would simulate height, for example. If I tell you that I want to simulate height, the first thing you'll ask is "Height of _what_?"
Comment: @David Richervy I'm talking more so about a large simulation, like of a star system. Not all objects would be in view at once, some simulations freeze objects in place once out of view. Would these type of computer power saving tricks work in a simulation that needs energy to be conserved?
Answer: I'm having a lot of trouble understanding the question as posed, but I think it's worth making a few general comments about conservation laws and how they are used in physical simulation.
Conservation laws happen because of Noether's theorem. When you are investigating how some physical system evolves over time, it's usually the case that the exact moment when $t=0$ is an arbitrary choice; you could start it 10 seconds later and the system would evolve the same. This is known as time translation symmetry. Any physical system which is time translation invariant is a system where energy is conserved.
Let's take as an example the problem of simulating a gas, where viscosity can be ignored, in one dimension.
We denote $\rho(x,t)$ as the density of the gas at a time and place, $v(x,t)$ is the velocity, $E(x,t)$ is the energy, and $p(x,t)$ is the pressure.
Then the equations we are solving are the Euler equations:
$$\frac{\partial}{\partial t}  \rho + \frac{\partial}{\partial x}  \rho v = 0$$
$$\frac{\partial}{\partial t}  \rho v + \frac{\partial}{\partial x}  \left( \rho v^2 + p \right) = 0$$
$$\frac{\partial}{\partial t}  E + \frac{\partial}{\partial x}  v\left(E + p\right) = 0$$
The pressure is defined in terms of the other variables, called the "equation of state". If we assume an ideal gas, $E = \frac{p}{\gamma - 1} + \frac{1}{2} \rho v^2$ where $\gamma$ is the heat capacity ratio, which is different for different gases.
The Euler equations are, respectively, conservation of mass, conservation of momentum (note that $\rho v$ is momentum), and conservation of energy. The equations state that a local change of (say) energy in time is balanced exactly by a change in space. So those three conservation laws are, in a deep sense, exactly the system that you are trying to simulate.
So I think that it's misleading to think of conservation of energy as something to exploit in simulating some physical system. Conservation of energy is a central part of the system that you're trying to simulate.
One last thing: Physical simulation, especially of thermodynamic systems, suffers from a phenomenon known as "numerical dissipation" or "numerical dispersion". The fact that you are using discrete time steps to simulate a continuous system means that something has to give, and depending on the numerical methods that you are using, this sometimes translates as unwanted diffusion of some quantity that should be locally conserved. Like energy.


Server Error 500 when changing pager of Views to display all items

Question: I have a View with 1,000 potential items. When it is paged, it works perfectly, both with Ajax paging or normal paging. But when I try to switch off the display type, the server throws a Server Error 500. No log in the watchdog table of the database or any other registry. I guess that there must be some problem with memory or something, but I would expect a PHP memory allocation error or something. It is not practical to show the 1,000 items at a time for the first time, but if I would want to change to some Page scroll pager like jScroll, I am worried that this is not entirely possible in Drupal.
Answer: Answering your last statement displaying multiple nodes at once is totally possible in Drupal. (Bear in mind though the power of hosting and caching is something to consider.) Unfortunately, the 500 error isn't helping a lot; a good approach is checking the error logs for any indications there.
If you are suspecting a PHP memory allocation error, try increasing the memory_limit variable in php.ini to a higher value. This link might be helpful.
Displaying thousands of nodes at once needs caching, so your site can be nice and quick. First, enable the caching in the advanced section of your View UI. Also consider using modules like memcache and boost.
As I said, first check what this 500 error you are getting is, because maybe it has nothing to do with the amount of nodes you are displaying.
Comment: I have looked at the Apache logs and don't see the error. I am pretty confident it is a problem of memory or something, because if I use the pager and set a high limit, there is a moment where the problem happens, and even changing the order fields criterion on the View, so it seems to deal with the number of rows to be shown. In any case, it was just a curiosity, thank you very much. I think that the Taxonomy admin GUI had the same problem cause they had no pagination and with many items it crashed, and installed the module Taxonomy Manager. Now seems to work fine in new Drupal core versions.


How do you connect a hitachi CP-X400 projector to a Macbook

Question: I need help with connect a macbook to the hitachi cp-x400 projector. there are only a few ports on the macbook; 2 usb, one firewire/printer type usb (not sure if it is firewire or what it is exactly, but it definitely is the printer sized usb), ethernet, and thats about it. Please help. PC usually work when i plug it in. I have it a regular usb plugged into the macbook connecting to the printer type usb port on the projector and its not working.
Answer: maybe it's not firewire\usb, it mini displayport (http://en.wikipedia.org/wiki/Mini_DisplayPort), so you should find wire with such connector on one side & vga\composite on other - (for projector connection)
Answer: Yep that was exactly it. New Macs use mini displayports. after spending an hour and a half online trying to figure this fact out, and 2 hours going store to store before that asking if they have mac cable or accessories no one could tell me this simple fact. then another 2 hours driving around to go to Best Buy because they're the only place that has this besides Apple. $24.99 at best buy, although there was one for $29.99. I got the mini displayport to VGA, where the mini displayport to the DVI was only $19.99. If i got the mini displayport to VGA at apple it wouldve been $29.00... This is why i hate macs, they claim to make everything easier, but it just a hassle when you live in a PC world and Steve Jobs makes new cords or connector every 2 years so he can make on obsolete and sell new crap to a bunch of naive consumers, just so he knows mac people will have to by the crap he is selling if they still want to use their computers.
Comment: Actually now you just have ONE port that allows you to connect to VGA, DVI, HDMI or DisplayPort devices. That meany you can use Beamers (that usually have a VGA port), Displays (there are still a few using VGA, most use DVI and then again a few HDMI) or TV sets (mostly HDMI). In addition to that you are able to use the quite modern (but widely unkown/unused) DisplayPort which can be used to control quite big displays (4096x2560).


The proper name for a "story with photos"?

Question: What is the proper English word that means a publication (e.g. in a paper or online) consisting of a series of photographs along with short author's comments? Here is a live example of such publication. Can it be called a photo report (and if yes, then photo report or photoreport?), or there is another established term for it?
Comment: I am informed that when such photo-heavy articles appeared in _Playboy_ magazine back in the 1960s and 1970s, they were termed **pictorials**.
Comment: I'm not sure we've got a settled word for this.  Different publications will brand these stories differently - the Washington Post calls them "visual stories".
Answer: This is sometimes referred to as photojournalism or a photo-essay.
The links above are to Wikipedia, but here are definitions from Oxford English Dictionary:

Photo-essay: A series of thematically related photographs, usually supplemented or linked together by a narrative text or commentary; an essay, biography, etc., consisting of numerous photographs, with or without accompanying textual matter.

This definition is first cited in 1948.

The Atlantic Coast Exhibition by Eliot Elisofon, a Life Magazine photo essay, closes this week end.

1948   Portland (Maine) Press Herald 5 Nov. 15/5

Photojournalism: The use of photographs in journalism; journalism consisting primarily of photographs.

The first citation of this term is from 1938:

While Photo-Journalism is a comparatively new development in America, it has already taken quite an important position in Europe, where it developed during the past ten years.

1938   A. Eisenstaedt in W. D. Morgan & H. M. Lester Miniature Camera Wk. iv. 67/1
Comment: The former would be unusual.  You might say "Today I came across three pieces of great photojournalism."
Comment: Did I understand properly that _photojournalism_ is an occupation, and _photo-essay_ is a resulting product of this occupation?
Comment: @HydrochoerusHydrochaeris *photojournalism* can refer either to the act or the product.  You could say "There was some great photojournalism in that magazine."  You could also say "For a living I work in photojournalism."
Comment: Could I say "Today I came across three great photojournalisms", or only "…three great photo-essays"?
Answer: Your link points to what is colloquially called a "photoblog" or a "photolog". It is rooted in the concatenation of "photo" and "blog". However, it is not recognized as an official word by OED or Webster (yet).
Photoblog : Oxford Living Dictionaries

photoblog
  NOUN
A blog in which the postings are primarily in the form of photographs.
'I'm helping them set up a photoblog which will hopefully give
  everyone a chance to see some of those amazing pictures'

Wikipedia has an entry.
Comment: How would you call this kind of story, if its contents and composition were similar to my link, but published not on the Internet, but, say, in a paper magazine in 1970s?
Answer: photo story OED

n. a story with accompanying photographs; (in early use also
  occasionally) a story told in photographic form, a film.

As in:

1992    Working on her photography in the late '40s, she succeeded in
  getting a major photostory published in the London-based 'Picture
  Post'.

The proper name for a “story with photos”?


Tiling windows in GNOME 2

Question: How can I get tiling windows in GNOME?
Comment: please make your question a bit more specific...
Comment: I edited your tags.  This is not a linux-specific question, but an X Window System specific question.
Comment: @its : Isn't this a Gnome(and it's WM)-specific question, not an X-specific question? It's a fine question (but maybe flesh it out a bit), and I think it's fine to ask questions in a simple way, since that's how many people will ask this question in the future.
Comment: @Stefan : doi, yeah, that is more accurate. My brain tried to replace classification with classification where there was no need for either.
Comment: Alternative approaches, as discussed [here](https://unix.stackexchange.com/q/139730/), include the GNOME extensions *gTile*, *shelltile*, or *Put Window*.
Answer: It depends a bit what you mean by tiling: Permanently tiling or just temporary to get an overview and select a window? If you use compiz ("Desktop effects") the latter is possible by pressing Super+W (Super is normally the "Windows"-Key). For "permanent" tiling:
Tile windows with compiz:
Install the Compiz Settings manager (e.g. package compizconfig-settings-manager for Ubuntu) and the additional plugins (again for Ubuntu: compiz-fusion-plugins-extra). Then activate the Grid plugin -- then you can use Ctrl+Alt and a number on your keypad to move and resize the window so that it fits an imaginary grid. This allows very comfortable tiling.
Tile windows without compiz:
If you do not use compiz, there is a gnome applet that allows tiling: http://www.giuspen.com/x-tile/
Comment: X-tile works pretty fine if you are using just one monitor (if using two or more monitors, it gets tricky to configure it correctly)
Comment: I didn't know X-tile. Seem what I need now.
Comment: x-tile running on Ubuntu 18.10, running Gnome 3.30.2, with the default window manager of metacity, leaves large gaps in between the windows.  There does not seem to be an option to remove that gap, so that isn't really usable.
Answer: As has been mentioned, Gnome is not a Window Manager, but a Desktop Environment.  You can choose from many tiling window managers, such as StumpWM, wmii, or XMonad.
Here is how you use one to replace the default window manager.
From Mikael Jansson(with a little editing by me to make this more general).

If you, like me, use gnome-session 2.3 and earlier, you'll want to add this to your ~/.gnomerc:
export WINDOW_MANAGER=/path/to/your/favorite/window/manager

If on the other hand you run gnome-session 2.4 and later, you'll have to change a key in the registry:
gconftool-2 --set /desktop/gnome/session/required_components/windowmanager --type string "Window Manager Executable Name"

making sure the binary is in your path.
This will give you Gnome and default theme settings (such as fonts), but with your-favorite-window-manager instead of Metacity.
Answer: BlueTile is based on Xmonad but configured OOTB to work well with GNOME (to some degree, it's not as polished as Metacity or Compiz yet...).
Answer: GNOME is a desktop environment; it's not responsible for handling your windows. You need to change your window manager, which does handle that sort of thing. There are quite a few tiling window managers for X you can experiment with
Comment: I think what he meant is to get tiling with GNOME's default window manager, i.e. metacity or compiz…
Comment: @Marcel Oh, perhaps
Comment: or perhaps not ;) The question is really vague...
Answer: As other folks have said, you can use whatever tiling window manager tickles your fancy. Xmonad, however, is one of the few - AFAIK - which advertises GNOME integration and is widely used with it. Well, for some definition of "widely" I suppose.
Answer: The applet 'X Tile' can tile your windows from the Gnome panel on demand. It's in Fedora at least and works nicely.

Tiling windows in GNOME 2


PRAM with no bit operations and P vs NC

Question: I was reading up on something called the PRAM model without bit operations.
What exactly does it mean that this PRAM model cannot do bit operations?
I can't find a straightforward definition anywhere.
Surely the different processors will still be able to do all sorts of stuff with bits. The reason why I am asking is that the max-flow problem (which is in P cannot be solved in this model using a polynomial number of processors. So in fact it is a non-trivial implication of the conjecture
that $P \neq NC$. So it is further "evidence" of the $P \neq NC$ conjecture.
Comment: Hopefully your source has some citations. There are many variants of the RAM model (also called the pointer machine model). Perhaps the model that was meant is the real RAM model, in which access to numbers is limited to arithmetic operations and comparisons.
Comment: "which is in P cannot be solved in this model using a polynomial number of processors" -- that's conjecture, as you state in the next sentence.
Comment: Can you please tell us what you were reading that made you think that PRAM model cannot do bit operations (give us a full reference to the source, and a link if possible)?
Comment: I was referring to some papers by Ketan Mulmuley. If you want a brief overview you can read his paper in which he outlines a research program called geometric complexity theory. It is called "The GCT program towards the P vs. NP problem" and can be found on his homepage. There you can also find a paper in which he proves this special case of  $P \neq NC$.
Answer: Without further information, it's hard to tell exactly. However, to the best of my knowledge, bit operations may be intended as follows. Consider the problem of finding the maximum element in an array of $n$ real numbers. This problem can be solved by an EREW algorithm in $\Omega(\lg n)$; moreover, no CREW algorithm can do any better.
However, this problem can be solved in $O(1)$ time with $n^2$ processors using a common-CRCW algorithm (in this model, when several processors write to the same location, they all write the same value). The key point here is that a CRCW PRAM is capable of performing a boolean AND of $n$ variables in $O(1)$ time with $n$ processors (which allows overcoming the $\Omega(\lg n)$ lower bound). I think that bit operations may refer to this powerful AND capability of a common-CRCW.
Additional information regarding the FAST-MAX algorithm can be found in the first edition of CLRS Introduction to Algorithms, chapter 30 (ALGORITHMS FOR PARALLEL COMPUTERS).
Comment: The fact that the OP mentions maximum flow leads me to conjecture that by bit operations, they meant bit operations. In the context of maximum flow you can consider algorithms running on the real RAM, in which you are not allowed to peek at individual bits.
Answer: On page 1461 of "Lower Bounds in a Parallel Model without Bit Operations," Mulmuley says:

It is like the usual PRAM model, the main difference being that it does not provide instructions for any bit operations such as $\land$,$\lor$,or extract-bit.

The model is explicitly specified in section 2.1.
The reason I think this result ($\textsf{P}\neq\textsf{NC}$) in this model is interesting is---although this model does not allow bit-operations---it still allows the time to depend on bitlengths. Also, this model is powerful enough to compute the determinant (see paragraph "Arithmetic PRAM model." on page 1469)!

PRAM with no bit operations and P vs NC


Why can I ssh to my server but cannot sftp into it?

Question: I've got a VPS running Ubuntu 9.10 and I cannot sftp to the server with a regular account. I can ssh with a regular account and I can also ssh and sftp with root.
Is there an option that I need to turn on so that regular users can use sftp?
Thanks in advance,
J.
Comment: Post your `sshd_config` and the relevant entries from your logs.
Answer: It seems the problem was caused by wrong permissions set for /dev/null: crw-------. Now i only have to figure out why the permissions where set the way they were :)
Answer: maybe it's because of permissions on 'sftp-server' binary? what does debug run of sshd give you?
Answer: Another issue that I have noticed, is that if your login startup files generate any sort of output, scp and sftp fail.  Be sure you bracket things that output to the terminal in your startup scripting using a test on the variable $?prompt if it is non-zero you talking with a terminal.


Black screen when booting ArchLinux from USB stick on Chromebook R11

Question: I've recently got an Acer Chromebook R11 cyan and I would like to be able to boot ArchLinux from it. For now I would like to boot from an USB drive.
I made a pretty classic ArchLinux installation on it (syslinux as bootloader, DOS partition table, one ext4 partition for /boot and one btrfs partition with two subvolumes for / and /home).
I did set the Chromebook to developper mode, enabled legacy and usb boot and installed John Lewis RW_LEGACY.
Booting from the USB drive works well on other computers, however on the Chromebook, while syslinux runs fine (albeit very slowly) and is able to boot Arch, the classic "loading initramfs/probing edd" output is followed by a totally black screen.
I did try some kernel options (nomodeset, nofb, vga=normal, video=vesafb:off, i915.modeset=0), hoping that it might help getting an output on screen, with no result.
Answer: OK so I'm an assclown. I completely forgot to try the fallback initramfs image, which boots successfully (although it doesn't recognize my keyboard but this is another problem).


How to defend against a Roach-ling all-in with Forge FE

Question: Every time I go Forge FE against a Zerg player recently, my opponent goes for the 7-Roach push on one base, followed by streaming Zerglings and Roaches into my base repeatedly. For some reason, I can't seem to hold this off even if I manage to hold on to my nexus in the early game. What's the trick to holding off this kind of all-in play? Since I went for the Forge FE, I don't have enough time to get warp-gate technology, and by the time the attack hits, I'm usually on 3 gateways, trying to chronoboost out Warpgate and Stalkers.
Answer: As you already mentioned this is an all-in! This means if he fails killing you, he is done for. After you scout his all in stop probe production and build more cannons to buy time. You do not need Warp gate technology. Just add more Warp gates and create Stalkers.
Your goal is to stay alive then you win.
Like with every strategy you struggle against: Watch some pro replays that include your scenario. It is important to watch many of those to extract the key elements. Get a buddy that plays this strategy and try to beat it. First try to counter it blind, as if you knew it would come. Then try to react after you scout him. If you feel comfortable make your friend switch between multiple builds. Your friend should be at your level of play or better.
Sometimes it helps if you are in voice chat and he warns you like:

I start my roach warren.
Now it is done, 7 Roaches on the way.
etc.

Ask him what you could do better and repeat it all over again. This way you learn how to counter a certain strategy.
Comment: Building more cannons when the roach attack is already there isn't a solution. Besides this, cannons are extremely weak against roaches because they are armored units and have high health. Your "answer" doesn't give a solution really for of a "spam cannons, gateways, and stalkers and try to survive".
Comment: Also, if the roach push is there... it breaks down walls very fast. Another thing, adding gateways takes way to long and the push would already be successful. I can't see this working in a defense as a zerg player...
Comment: Sorry, but this is not my suggestion. I suggest that he scouts the all in before they knock on his door. If he sees the roach warren and / or no expansion then he should add more cannons, so they are up when the roaches arrive.
Comment: I really don't believe more cannons are the answer. Only because they don't have that great of a damage output against roaches and they can't be used in a counter attack.
Comment: Sometimes the problem is that this is very hard to scout. I can do a FFE, and see a hatch first. However, my opponent then proceeds not to drone up, and instead, basically uses his expo as a macro hatchery. From my scouting information, it looks like a standard build, not exactly an all-in. By the time the roaches and zerglings (or baneling zerglings) arrives, I have no idea that it is coming, because my probe has already been scared away by queens and a few lings. This is especially difficult to hold off on maps like Antiga Shipyard, where your minerals are half exposed
Comment: This will delay his timing attack, although it will be a bit stronger. Once your first Stalker pops out scout with it aggressively. Only Speedlings can kill it by that time and if he has like 6-8 of them he cripples his push. So even if it dies you have an advantage. If you see the Roaches set up more defenses and kite them until they reach your base. I am not saying this is easy, but your chances of survival should be around 50%.
Answer: On maps with ramps into your natural, sentries to FF your ramp will stop this attack dead. If you place a FF every 15s, the zerg cannot attack up your ramp. If you have two gates producing sentries, you should have enough to keep it perma-FF until you have 5 sentries, which can keep the FFs up indefinitely.
On other maps, some extra cannons and stalkers should help. Stalkers outrange roaches, so keep them behind your cannons to kill the roaches who attack your cannons. If they try to move forward and attack your stalkers, you can pull injured stalkers back slightly to let the shields regenerate. A well placed FF can cut the 7 roaches into a 4 and a 3, where your stalkers and cannon should clean up the 3 roaches with ease.
You should have sufficient notice this attack is happening, the hallmarks are an early pool (11), gas at 15, and no expo. Then only a single pair of lings created with no zergling speed being researched. (Although some zergs will start ling speed, then cancel to build the roaches so you can't use that as a guarantee.)