Modifying strings in a list efficiently

Question: I have a list of strings $\{s_1,s_2,\ldots,s_n\}$. I would like to to produce the following list of strings:
$$
\{s_1<>1,\ 1<>s_2<>1,\ldots,\ 1<>s_n\}
$$
In other words, I want to append the character $1$ to the end of the first string, to either end of all internal strings, and to the beginning of the final string. What is an efficient way to achieve this?
Comment: If efficiency paramount, check my answer, and note that the `Riffle` based solution will break if strings contain spaces, unless you use a dummy character - which cannot exist in any string - possibly slowing further...
Answer: Here's a way with v10.1:
strings = {"a", "b", "c", "d", "e"};

StringSplit@StringRiffle[strings, "1 1"]

{"a1", "1b1", "1c1", "1d1", "1e"}

And if you're not on 10.1 (and as suggested by @ciao), you can achieve the same thing with:
StringSplit@StringJoin@Riffle[strings, "1 1"]

And just for the heck of it with MapIndexed:
MapIndexed[If[First@#2 == 1, "", "1"] <> #1 <>
 If[First@#2 == Length@strings, "", "1"] &, strings]

Comment: +1 - and a similar construct (I won't post since it's the same in essence) for pre 10.x of `StringSplit@StringJoin[Riffle[s, "1 1"]]` is considerably faster than mapping solutions....
Answer: Flatten[
 {#[[1]] <> "1", StringInsert[#[[2 ;; -2]], "1", {1, -1}],
  "1" <> #[[-1]]}] &@strings

About 2X to over 10X as fast (depending on string lengths) as Riffle et al. that I noted in comment, and unlike that this will return correct results if strings contain spaces. About 4X as fast as mapping (all tested on MMA 9).
Comment: That's the way go to IMO.
Comment: Nice. Can't believe it's that much faster though. Crazy. (+1)
Answer: Pedestrianly,
x = {"a", "b", "c", "d"};

Flatten[{StringJoin[#, "1"] &@First[x],
  StringJoin["1", #, "1"] & /@ x[[2 ;; -2]],
  StringJoin["1", #] &@Last[x]}]

{"a1", "1b1", "1c1", "1d"}
Comment: Hehe, learned a new adverb just now
Comment: Like 'prosaic'.  (Prose, but not poetry.)

Modifying strings in a list efficiently


What are good techniques for retrieving a list of keywords for the top news stories of the day

Question: I am working on an application where I would like to retrieve a list of the day's top news stories from some source (such as the BBC) and parse these for keywords that I can use against my own tag data.  There are obviously lots of webservices and APIs out there - but what would you suggest as good routes to take.
One thing I was considering is periodically downloading the RSS feed of BBC News and parsing the content using the Yahoo term extractor.  This seems like a good solution to me, but the term extractor is for non-commercial use only and my application is commercial.
YQL looks promising but I'm not sure how easy it will be to condense the data down to keywords.
All suggestions welcome, both for the news source and the keyword/tag extraction, and for both commercial and non-commercial uses.
Update:
Building on the suggestion of an answer, here's the YQL for grabbing the keywords from the top UK news stores on the BBC:
select content
from search.termextract
where context in (
    select title
    from rss
    where url='http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml'
)

which returns something like:
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="46" yahoo:created="2009-11-13T11:49:05Z" yahoo:lang="en-US" yahoo:updated="2009-11-13T11:49:05Z" yahoo:uri="http://query.yahooapis.com/v1/yql?q=select+content+from+search.termextract+where+context+in+%28select+title+from+rss+where+url%3D%27http%3A%2F%2Fnewsrss.bbc.co.uk%2Frss%2Fnewsonline_uk_edition%2Ffront_page%2Frss.xml%27+%29">
    <results>
        <Result xmlns="urn:yahoo:cate">new york</Result>
        <Result xmlns="urn:yahoo:cate">bolt gun</Result>
        <Result xmlns="urn:yahoo:cate">stalker</Result>
        <Result xmlns="urn:yahoo:cate">russia</Result>
        <Result xmlns="urn:yahoo:cate">moon</Result>
        <Result xmlns="urn:yahoo:cate">hijack</Result>
        <Result xmlns="urn:yahoo:cate">yacht</Result>
        <Result xmlns="urn:yahoo:cate">balloon</Result>
        <Result xmlns="urn:yahoo:cate">parents</Result>
        <Result xmlns="urn:yahoo:cate">bruce forsyth</Result>
        <Result xmlns="urn:yahoo:cate">flu</Result>

Ultimately though, I don't think I can use this within a commercial app though due to the restrictions on the term extraction service.
Answer: You say YQL looks promising, so I'm sure you've investigated this already.  You can use two YQL services together.  search.termextract will give you the keywords from the query made with search.news
select * from search.termextract where context in (select abstract from search.news where query="election")
You'd have to fiddle around to make the where part of the query specific to latest news.
From here: "The Term Extraction service is limited to 5,000 queries per IP address per day and to noncommercial use. See information on rate limiting."


What do you call something that looks like clockwork?

Question:
I don't know any adjective or word that has that particular meaning. What's the closest expression or word if there's no adjective for it?
Comment: Gear train? Or "clockwork", a perfectly good adjective, as well as noun.
Answer: Which aspect of it do you want to capture?
The actual shape and structure? There's no one word that does the job better than the phrase "resembling clockwork", postfixed to the noun.

Inside was a complex set of gears resembling clockwork.

Its other qualities I would describe as mechanical, intricate, ingenious, interlocking/fitting, elaborate, finely engineered, toothed, or (depending on what you're describing) gearlike.
Answer: Just "Clockwork"! This isn't a common thing to say, but:

Clockwork refers to the inner workings of either mechanical machines called clocks and watches (where it is also called the movement) or other mechanisms that work similarly, using a series of gears driven by a spring or weight.

Alternatively you could use "gears" or a "gearbox".


Is writing content for casinos and gambling considered haram or halal?

Question: I am a content writer. I write content for different niches like health, fashion, entertainment, and more. But if someone orders me to write content/articles for casino and gambling niche and I write them. is it haram or halal?
Answer: Bismillah
In Surah Al-Maidah Verse 2:
ۘ وَتَعَاوَنُوا۟ عَلَى ٱلْبِرِّ وَٱلتَّقْوَىٰ ۖ وَلَا تَعَاوَنُوا۟ عَلَى ٱلْإِثْمِ وَٱلْعُدْوَٰنِ ۚ وَٱتَّقُوا۟ ٱللَّهَ ۖ إِنَّ ٱللَّهَ شَدِيدُ ٱلْعِقَابِ ٢
Cooperate with one another in goodness and righteousness, and do not cooperate in sin and transgression. And be mindful of Allah. Surely Allah is severe in punishment.
If you can avoid it, better not to do it.
While the halal is still available.
Answer: The direct answer would be that it is forbidden.
However you need to consider your specific situation. Is it a major part of your work. You should start looking of alternatives. If it is a minor part, you might just finish it and move on.
Sometimes there are lateral solutions. I know a muslim friend who is a service engineer for some industrial equipments. He was assigned to service equipment in an alcohol factory. (The equipment was not specifically designed for alcohol factory). He asked his boss informally. His boss assigned him to different site and sent someone else in his place.


Are there any ship design rules for star wars ships?

Question: I THINK I have seen them in the past once, but not sure any longer if I'm not confusing it with the D20 version. Were there any ship design rules published for the star wars D6?
Answer: D20
If you want a straightforward construction guide try to find the original  Starships of the Galaxy (modification is swiped under the rug).  If your prefer that the players modify a ship to their liking instead of designing it from scratch, get the Saga edition.
You can use either book to do the other (ie use the D20 book to distill modifications out of it or use the Saga version to get a construction guide), but that can be more hassle than it's worth.
D6
No details here with regards to constructing a ship, but there's plenty to do with modification (with good or bad results). Any of the core rulebook editions contains a section about starships, but if you want to have the full package then you need:

Stock Ships: to have basic information for various ships. The biggest bonus here is that you get deck plans!
Galaxy Guide 6: Tramp Freighters and Pirates & Privateers: for various ship modification options.
If you want to have a description of the Millenium Falcon, get Han Solo and the Corporate Sector Sourcebook.

With that, you wont have everything (ship descriptions are very spread out in D6), but you'll have a very stable basis. You can also get the Death Star Technical Companion if that's what you fancy. .
Answer: for D6
Try this one:
credits:
"Star Wars Starship Pricing and alterations created by Krapou 2006, based on original Starship Generation created by Grimace 2002, both systems based loosely on the format originally listed in WOTC's Starships of the Galaxy"
So it seems to be a D6 conversion of the D20 / Saga reference cited by Ahriman.
Krapou is from the Rancor Pit. Krapou's work was subsenquently cited by Fallon Kell (another guy at The Rancor Pit) who issued the SCS (Fallon Kell's Starship Construction System)


LQR problem with interaction term between state and control

Question: Consider the usual linear process $x_{t+1} =Ax_t+Bu_t+Cw_{t+1}$ where $w_t$ is an independent and identically distributed $N(0,I)$ process. The objective is
$$
V=E\sum_{t=0}^\infty \beta^t(x_t'Qx_t + u_t'Ru_t + x_t' S u_t)
$$
The problem is identical to a stochastic LQR, but with the additional state-control interaction term $x_t' S u_t$.
Is there a way to reduce this problem to the usual LQR formulation? Alternatively, is there a reference treating this general case?
Answer: Remark: you want to put a 2 your $x_t^\top S u_t$ term to save some headaches later, and throughout my hints I assume there is 2 on the cross term.  I will also neglect the discounting factor $\beta$.
This is known as LQR with a cross term (or cross coupled LQR).  There are a few ways to approach solving the problem: working out the solution through Hamilton-Jacobi-Bellman, forming the Hamiltonian, or "guessing" at the solution.  For the sake of simplicity, I will go with the last one.
Start by defining
$$
u_1=u_t+R^{-1} S^\top x_t,
$$
then define your dynamics and cost in terms of $u_1$.  This will yield a new $A$ matrix: $$\bar{A}=A-BR^{-1}S^\top,$$
and a new $Q$ matrix:
$$\bar{Q}=Q-SR^{-1}S^\top.$$
This provides us with a new condition that needs to be satisfied: $(A-BR^{-1}S^\top,Q-SR^{-1}S^\top)$ is detectable.
Now with $\bar{A}$, $\bar{Q}$, and the resulting modified cost for $u_1$, we get back to a known LQR without cross terms and
$$
u_t=-\underbrace{R^{-1}(S^\top+B^\top P)}_{K}x_t.
$$
As for a reference, I have to imagine it is hidden away in one of Bertsakas' books or Kumar and Varaiya.


Casimir operators for Poincare algebra

Question: I have seen at various places the comment that the operator $P_\mu P^\mu$ is a Casimir operator of Lorentz algebra and thus it satisfies a on-shell condition like $P_\mu P^\mu=m^2$. Given the Poincare algebra \begin{aligned}
i\left[M^{\mu \nu}, M^{\rho \sigma}\right] &=g^{\mu \sigma} M^{\nu \rho}+g^{\nu \rho} M^{\mu \sigma}-g^{\mu \rho} M^{\nu \sigma}-g^{\nu \sigma} M^{\mu \rho} \\
i\left[P^{\mu}, M^{\rho \sigma}\right] &=g^{\mu \rho} P^{\sigma}-g^{\mu \sigma} P^{\rho} \\
\left[P^{\mu}, P^{\nu}\right] &=0.
\end{aligned}
How does one derive its Casimir operators, especially the one $P_\mu P^\mu$? Can someone show the crucial steps? Also Does the method works for any other similar algebra? Moreover, if an operator, say, $A$ commutes with the generators $M^{\mu\nu}$, i.e., $[A,M^{\mu\nu}]=0$, can it be said that $A$ is a Casimir operator?
Answer: Casimir operators commute with all generators. That's what you need to check. $P^\mu P_\mu$ does commute with $M$ and $P$. A fast way to say it is that

$[P^2,P_\mu] \propto [P_\nu,P_\mu] =0$
$P^2$ is a scalar and therefore it's annihilated by the rotation generators

But if you don't believe 2. you can just check
$$
\begin{aligned}
i[M_{\mu\nu},P^2] &= 2\,(g_{\rho\mu}P_\nu-g_{\rho\nu}P_\mu)P^\rho\\
&=2 P_\mu P_\nu - 2 P_\nu P_\mu \\&= 0\,.
\end{aligned}
$$
For other Casimirs such as
$$
W^\mu W_\mu\,,\qquad W_\mu := \tfrac12 \varepsilon_{\mu\nu\rho\lambda} M^{\nu\rho}P^\lambda\,,
$$
you can do the same. This is just a bit harder. The argument 2. still works because it's a scalar. Then by explicit computation
$$
[P_\mu,W_\nu] = 0\,,
$$
so also its square commutes with $P$.
Answer: As far as I know, there are no ways of deriving Casimirs. In the case of the Poincare algebra one guesses and checks that $P_{\mu}P^{\mu}$ and $W_{\mu}W^{\mu}$ are Casimirs, based on physical principles.
There are some ways of deriving the quadratic Casimir of a (simple) Lie algebra. If you calculate its Cartan metric then the quadratic Casimir is $g_{\mu \nu}x^{\mu}x^{\nu}$.
You might check the answers to this question: Explicit Quadratic Casimir for $sp(2N)$

Casimir operators for Poincare algebra


How can I empty the trash from the Terminal?

Question: How can I empty the trash from the Terminal?
Answer: Another solution would be to create AppleScript containing the folowing code
tell application "Finder"
    empty the trash
end tell

save it as emptytrash for example and execute it via open emptytrash.app
or even better (as suggested by Chris) - execute:
osascript -e 'tell app "Finder" to empty'

Since trash is a Finder thing, this should be more compatible in the long run.
Comment: Directly from the command line: `osascript -e 'tell app "Finder" to empty'` (though you may want to put in a shell script to avoid having to get the syntax exactly right each time).
Answer: Trash is actually a hidden folder in the user's folder named .Trash
If you delete it's contents, you empty the trash. You can use
rm -rf ~/.Trash/*

Just be careful with it so you don't delete something else ;)
Comment: But this will not delete .Trash on mounted media/network volumes.
Comment: @mspasov, in many cases that is a feature, not a bug.  In any case it also answers, "How can I empty just my local trash without unmounting my external volumes?"  ;)
Answer: A review of various command line tools, for managing the Trash from command line:
http://hasseg.org/blog/post/406/trash-files-from-the-os-x-command-line/
Answer: If you have Homebrew installed, you can easily install trash by typing:
brew install trash

Then, to empty the trash, you only have to type the following from the command line:
trash -e

It's a pretty little piece of software.
$ trash
usage: trash [-ulesv] <file> [<file> ...]

  Move files/folders to the trash.

  Options to use with <file>:

  -a  Use system API for trashing files instead of asking
      Finder to do it. (Faster, but the 'put back' feature
      in the Finder trash will not work if files are trashed
      using this method.) Finder is still used for trashing
      files you have no access rights for.
  -v  Be verbose (show files as they are trashed, or if
      used with the -l option, show additional information
      about the trash contents)

  Stand-alone options (to use without <file>):

  -u  Check for updates (and optionally auto-update self)
  -l  List items currently in the trash (add the -v option
      to see additional information)
  -e  Empty the trash (asks for confirmation)
  -s  Securely empty the trash (asks for confirmation)

  Options supported by `rm` are silently accepted.

Version 0.8.5
Copyright (c) 2010 Ali Rantakari, http://hasseg.org/trash

Answer: A pure command line version:
find "${HOME}/.Trash/" -print | \
    tail +2 | \
    tr '\12' '\0' | \
    xargs -0 echo rm -rf

Find all files in ~/.Trash.
Disregard the .Trash directory itself, by starting at line 2.
Convert line-separated files back to null (\0) separated.
Pass to xargs to safely delete the files.

You may get errors about files not existing. This doesn't consider the fact directories will potentially delete files inside first before then attempting to delete the files inside.
Answer: You can simply use the command
rm -rf "${HOME}/.Trash/*"

We remove (rm) recursively (-r) and force (-f) all files inside the  "/Trash" directory.
I prefer using "$HOME" rather than "~" because that can give issues in a script, if you want to do something like:
#!/bin/bash
#
# Tidy your machine

# General file paths

file_paths=("${HOME}/Desktop/*" "${HOME}/Downloads/*" "${HOME}/Pictures/Screen*")

# Remove file paths

for file_path in ${file_paths[@]}; do
    rm -rf ${file_path}
done


Is follow-ups the right word?

Question: I'm creating a web page (intranet) where administrators can add customers to scheduled "follow-ups" by phone (we'll call them in the future and ask how it goes). So I used google translate and the web to find a good word for my menu tab. When using Google Translate I got "follow-ups" as a suggestion. This don't seem appropiate enough to me, so is there synonyms or better word for my purpose? Or is it the right word?
Comment: We use *follow-ups* on our intranet and it works just fine. (In your case, the more specific *callback* will work, but our follow-ups can be by email, fax, or in person.) Anyway, the thing is you always write for an *audience*, and in your case, the audience is your own colleagues. So in point of fact, you can use *whichever word you agree upon*. Absolutely any word you like. Could be *Jabberwocky*, as long as it's understood. In fact you'd be well advised, rather than asking here, to ask your colleagues first. It might well be they already are using *Jabberwocky* (or *follow-ups*).
Answer: Perhaps callbacks

a return call

Also often found as call-back.
Answer: Follow-ups sounds okay, but if you don't like it then how about follow-up calls?

Is follow-ups the right word?


Bandwith for streaming multiple channels

Question: what is the preferred bandwith for streaming multiple channels? How does the antenna affects the frequency when your hosting in the computer?
Comment: Hi Sataniel, 1. multiple channels of what? 2. streaming – over what medium? within the context of radio, we usually talk about *transmissions*, the word *streaming* usually arises in packeted computer networks, so I'm a bit confused about what your actual medium is? 3. frequency of what? 4. "hosting in the computer": really not sure what that is, please explain!
Answer: Great question sataniel. In essence the total bandwidth depends on the bandwidth of each channel. For example with FM radio the band is divided into 100 channels and each has 200kHz. Of course the antenna can receive them all, otherwise people would have to change out the antenna on their car for example but even if you wanted to stream 1,000 channels you can buy a special antenna that can handle them all. The real limiting factor is the transmitter/receiver, more specifically what it can do and what filtering is in place. The computer doesn't produce the frequency, only it probably produces the audio and it controls the transmitter/receiver. Another thing to keep in mind is the more channels that you stream at the same time the more the transmitting power is spread out so it will affect your range. Let me know if you have any more questions and we'll get them answered immediately :)


Zipping all files in a folder but excluding all subfolders

Question: I would like to zip all files in a given folder but none of the directories: any idea on how to do it?
e.g. directory X contains files F1 and F2 and directories D1 and D2.
How can I zip directory X to only have F1 and F2 and not D1 and D2.
Comment: Please use proper syntax
Answer: With GNU find or compatible, assuming there are no filenames containing newlines:
find X -maxdepth 1 -type f | zip -nw -@ X.zip

The -@ option takes a list of files from stdin, one file per line. -nw (or --no-wild) turns off wildcard expansion by zip, to avoid problems with filenames containing *, ? or [ characters.
Comment: smart ! there is no easier way ?? A flag, a wildcard, etc ?
Comment: Maybe with `zsh`? I don't know a faster way, let's wait for other answers.
Comment: @user3360735 it's already extremely compact and optimised
Answer: One way to approach it would be to use zip's exclusion option:
zip /path/to/zip/file.zip /path/to/given/folder/* -x /path/to/given/folder/*/

This tells zip to archive everything in /path/to/given/folder but also to exclude everything in that folder that is a directory. Here it's the shell doing the work, via wildcards, to expand the wildcard that ends in slash to the list of directories in that folder. If you had dotfiles in that directory, you'd have to expand them separately -- and also exclude any "dot directories".
Answer: With zsh,
zip -nw X.zip X X/*(ND.)

Would store X and the regular files (with the . glob qualifier including hidden ones with D) in it into the X.zip compressed archive in lexical order.
Instead of . which selects regular files only, you could use ^/ which selects files of any type except directories, including symlink, fifo, devices, sockets. But of those, the zip format (which is not much of a Unix format) can only store symlinks and fifos (named pipes), and you'd need to pass the --symlinks and --fifo option to zip. You could also use .,@,p to select only regular, symlinks and named pipes:
zip --symlinks --fifo -nw X.zip X/*(ND.,@,p)

Answer: In case we want to escape a specific subfolder at time to zip, we need to scape the * with a backslash (\), so that it is treated as a literal character by the shell (rather than being expanded into a list of files), in this way:
zip /path/to/zip/file.zip /path/to/given/folder/* -x /path/to/given/folder/subfolder/\*

Hope this help!
Comment: If the `*` is not escaped or quoted somehow, it will be expanded by the shell. However, this would still work correctly since the `-x` option takes one _or several_ patterns.  The trailing `/` is needed to only match directories.
Comment: Yes, you're right...
Sorry, I tried and posted my answer for the case of escaping a specific subfolder, I missed that the question mentioned 'all subfolders'.
Editing my comment, in case this still helpful for someone.


Help designing a Bluetooth controlled square wave generator

Question: I am an EE student, and I am working on my first quasi-freelance project.
I am designing a PCB, and part of the design requirements is a square wave generator whose frequency is controlled by a Bluetooth receiver. I need a range of 20-1000 Hz. I know electronic circuit theory, but I have never worked with Bluetooth protocol before, and I don't know where to start.
Answer: Start with a commercial Bluetooth module that encapsulates the stack, read and understand all the application notes and datasheet. It will act more-or-less as a wireless serial port.
Implement the serial-port-controlled square wave generator with whatever technology is appropriate for the performance requirements- microcontroller with on-board peripherals, aux DDS or whatever.
If you are planning to sell this, read up on the license and other fees to use BT.
Answer: There are some Bluetooth modules which have widespread support by online communities. Eg. For HC-05 module you will find many readily working online projects/codes which will make your development easier. Other modules are mentioned Here .
If you want to go into depth and understand working of Bluetooth protocol on multiple layers, you can refer to its core specification on its official website.
You can also refer to the first chapter of this book for brief understanding of protocol.


Can a mobile game developer ban an account for excessive purchases that were cancelled/refunded by the payment provider?

Question: Can a mobile game developer ban an account for purchases that were cancelled/refunded by amazon appstore? It seems that amazon allowed $50k worth of in app purchases to be delivered without actually getting payment for by allowing the purchase to go through and putting them in a "pending" order status.

Though your order has already been delivered, we couldn't charge your
  account for your order (#D01-0381849-xxxxxxx), due to a problem with
  the payment method you provided. We may attempt to reprocess payment
  for your order in a few days using the payment method you provided.
  Please go to the following page to make sure that the payment
  information for your account is correct, and so that we have a valid
  payment method for your future orders:
https://www.amazon.com/gp/digital/your-account/order-summary.html?orderID=D01-0381849-xxxxxxx
A charge can be declined for a variety of reasons. If you used a
  credit or debit card for your order, please contact the bank that
  issued your card for more information on why the charge was declined.
If we don't receive payment from you within the next 30 day(s), your
  order will be cancelled.
If you have any questions, go to:
  https://www.amazon.com/gp/help/customer/contact-us/
Note: This e-mail was sent from a notification-only address that
  cannot accept incoming e-mail. Please do not reply to this message.
Thank you for shopping at Amazon.com.

A month later the game developer banned the account because amazon refunded all the purchases. Although they werent actually ever paid for so how a refund could be made is beyond me...
Theres a few issues actually...
The game developer is now demanding repayment for the orders amazon cancelled.. but is demanding more than the amount that was actually refunded when amazon cancelled the pending purchases... can they do that?.. the game developer only recieves 70% of each sale made through amazon appstore since amazon keeps 30% of every purchase made.  So if the game developer only lost 70% of every order that was cancelled/reversed by amazon... shouldnt 70% be the amount to be repaid?
Another issue is that these orders apparently were "cancelled/reversed" by amazon 1 minute after the purchase was made... but yet both amazon and the game developer allowed purchases to keep being made for about a month... letting the bill rack up to $50k. Why wait a whole month for someone to make $50k worth of in app purchases when orders were cancelled 1 minute after being made? And then wait a whole month before doing anything about it (banning the account and demanding repayment in order to lift the ban)
both amazon and the game developer should not have allowed purchase after purchase without doing anything about it til after the total outstanding balance accrued to $50k...
Any thoughts, opinions, help, direction on the matter would be greatly appreciated.
Answer: Can any service provider ban a customer if there are repeated payment issues? Yes. Game developers are no exception.


How to store gas on little pulsejet plane?

Question: I am thinking about building small plane with a pulsejet but the engine would need to be roughly 2 cm in diameter. Is it even possible to fit something to store gas on that sized plane? At least for like 10 seconds of running.
Comment: Hi! It would be great if you could perhaps narrow down the question a little... have you been able to work out roughly how much total gas you will need for the necessary thrust? It's very difficult to engineer a solution without a rough estimate of the requirements. Scaling the engine might be your first task.
Comment: "Gas" may mean petrol or eg "propane". Either are possible and petrol is easy. A used "sparklet" CO2 cylinder from a soda syphon os softdrink CO2 dispenser would probably work for Propane. You'd have to check with a engineer re safety, and the chances of this being an approved or certifiable use are "very small" [tm]. If gas = petrol then model aircraft fuel systems are a logical place to start.
Comment: The small butane soldering torches do exactly that. Whether they meet your weight goals is another matter... https://www.machinemart.co.uk/shop/product/details/cbt5k-butane-gas-torch-kit
Answer: buy a propane lighter refiller cartridge, these are about 1" in diameter and 5" long. make the cartridge part of the fuselage.


What am I meant to do with Elder Scroll (Dragon) after completing Dawnguard?

Question: After completing the Dawnguard storyline in favor of the vampire hunters, I was able to give the 2 scrolls (sun and blood) to Dexion, however the dragon scroll remains in my inventory. Is there some special use for it? i've checked with Urag gro-Shub and he will not take it. Note that this is after I've completed the main questline.
Comment: Is it still a quest item? If it is, at least you won't have to worry about its weight.
Comment: You probably bought it back from Urag.There is a glitch where if you buy it back, he will not re-take it back like he should be doing. Just wait for a patch to fix the issue is your only option now. Or if you are on PC, trying to remove it via console command might work but could also screw up your save at the same time.
Comment: @RavenDreamer yes, it is still a quest item. I guess Beth forgot to re-enable the option to sell it to Urag, maybe somebody who hasn't sold it before using it for Dawnguard can confirm.
Comment: Any interesting side note - if you tried to read the Sun or Dragon scrolls during the mission they open, glow then your screen goes black and nothing more is shown from them.
Answer: There is a bug in the game where if you buy back the Elder Scroll (Dragon) from Urag gro-Shub after earlier selling it to him, you won't be able to sell it to him again after completing the final Dawnguard DLC main quest, Kindred Judgment.
The bug is fixed by the Unofficial Skyrim Patch. Download links: Original / Legendary Edition - PC / Special Edition - PC / PS4 / Xbox One.
Related patch note:

UDGP v1.2.3 - (2013-06-29)
After completing Kindred Judgment, it is not possible to sell the Dragon Elder Scroll back to Urag. This has been corrected. (Bug #12490)
Comment: It is important to note that this will only work on pc
Comment: @3ventic I agree. Answer edited.
Answer: The Dragon Elder Scroll is used as part of the main quest.  Paarthunax will tell you to go retrieve it if you haven't done the dawnguard quest that makes you get it.  I imagine it won't let you sell it so that you will have it on hand when you get to that point in the main quest.
(Note: By "the main quest" I mean fighting Alduin)
Comment: I've already completed it before starting Dawnguard.
Answer: Get arrested and escape then grab everything but the scrolls.
Comment: Have you tried this? Quest items normally don't get removed from your inventory when you're put in jail.
Answer: If you chose the Dawnguard side of the quest.Dexion Evicus will take all three elder scrolls off your hands for 6000 gold and take them to the imperial city, i'm not sure what to do if you chose the vampires side though.
Comment: Pretty sure he only takes the 2 scrolls introduced by Dawnguard.
Comment: [I very much doubt that](http://www.uesp.net/wiki/Skyrim:Moth_Priest).
Comment: He took all three when I did it


How do I trace a custom allocator using xperf's heap profiling tools?

Question: xperf (part of Windows Performance Analysis Toolkit) is very helpful in tracking memory usage with its heap analysis.  However, my app uses a custom allocator -- it grabs chunks via VirtualAlloc directly and manages its own heap.  I'd like to generate HeapAlloc/HeapFree/etc. events myself from my own allocation functions, so that I can use the tools as is, without having to define a bunch of custom ETW events.  Is it possible to do this?
Answer: Try using leakdiag


p4 perl - how to add a file into p4 repository?

Question: I was reading this p4 perl official page:
http://www.perforce.com/perforce/doc.current/manuals/p4script/02_perl.html
But I can not find a library to add a file. I would guess something like:
runadd(), runAdd(), or RunAdd(). But exactly which one is correct? How many arguments does it take?
And lastly, why does not the p4 perl offcial page have it listed?
Could someone post a sample code that can add a file to p4 repository?
Many thanks!
Answer: Looks to me like it's:
<code>$p4->Run('add', $filename);
</code>


C# implementation of Bron-Kerbosch algorithm

Question: I am attempting to write a C# implementation of the Bron-Kerbosch algorithm in graph theory, which is used to find cliques of maximal size in graphs.
Ideally, this algorithm would produce a list of graphs, where each of those graphs would represent a maximal clique from the initial input graph. My code is not producing the expected result, and I would appreciate some guidance to writing better code that achieves this implementation.
The graph class used in this instance is a custom class based on an adjacency-list representation of a graph.
public class BronKerbosch
{
    public List<Graph<Person>> Run(Graph<Person> R, Graph<Person> P, Graph<Person> X, List<Graph<Person>> maximalCliques)
    {
        // if P and X are both empty, and the size of R is greater than 1 (implies clique):
        if (!P.Nodes.Any() && !X.Nodes.Any() && R.Nodes.Count() > 1)
            // report R as a maximal clique
            maximalCliques.Add(R);

        else
        {
            // Copy P's nodes for traversal
            List<GraphNode<Person>> nodesCopy = P.Nodes.ToList();

            // For each node v in P:
            foreach (GraphNode<Person> v in nodesCopy)
            {

                // Make graph with just v
                Graph<Person> vGraph = new Graph<Person>(new NodeList<Person>());
                vGraph.AddNode(v);

                // Make graph with just v's neighbors
                Graph<Person> neighborGraph = new Graph<Person>(v.Neighbors);

                // Move v to X
                P.Remove(v.Value);

                // BronKerbosch(R U {v}, P INTERSECT N(v), X INTERSECT N(v)))
                maximalCliques = Run(R.Union(vGraph), P.Intersect(neighborGraph), X.Intersect(neighborGraph), maximalCliques);

                X = X.Union(vGraph);
            }
        }
        return maximalCliques;
    }
}

Any help provided would be greatly appreciated - let me know if I can provide any additional information.
--
UPDATE 1 One context of the inputs and outputs is a graph of three people - Person A, Person B, and Person C. Code is provided below to provide more accurate detail:
graphR = new Graph<Person>(new NodeList<Person>());
graphP = new Graph<Person>(new NodeList<Person>());
graphX = new Graph<Person>(new NodeList<Person>());

Person personA = new Person() {FirstName = "Person A"};
Person personB = new Person() {FirstName = "Person B"};
Person personC = new Person() {FirstName = "Person C"};

Anode = new GraphNode<Person>(personA);
Bnode = new GraphNode<Person>(personB);
Cnode = new GraphNode<Person>(personC);

graphP.AddNode(Anode);
graphP.AddNode(Bnode);
graphP.AddNode(Cnode);

graphP.AddUndirectedEdge(Anode, Bnode);
graphP.AddUndirectedEdge(Cnode, Anode);

expectedClique1 = new Graph<Person>(new NodeList<Person>());
expectedClique1.AddNode(Anode);
expectedClique1.AddNode(Bnode);
expectedClique1.AddUndirectedEdge(Anode, Bnode);

expectedClique2 = new Graph<Person>(new NodeList<Person>());
expectedClique2.AddNode(Cnode);
expectedClique2.AddNode(Anode);
expectedClique2.AddUndirectedEdge(Cnode, Anode);

maximalCliques = new List<Graph<Person>>();

bronKerbosch = new BronKerbosch();

bronKerbosch.Run(graphR, graphP, graphX, maximalCliques);

In this situation, I would want the output to be the two graphs expectedClique1 and expectedClique2 - however, the actual output is four graphs with only personA. Hope this helps!
--
UPDATE 2 It appears that I have found a solution to the problem, though I am hesitant to close the case until I do some more testing to confirm that my solution is correct. Will update when I am able to confirm that my solution is adequate.
Comment: Please provide current and expected outputs along with any work you have done to pinpoint the cause of the error.
Comment: Done. "Update 1" should cover my data set and output. Let me know if any other information can be of use!
Answer: To expand on ananthonline's comment well contained data structures such as these are perfect candidates for unit testing.  Fire up your favourite testing framework and set out your expected outputs including all your boundary conditions.
Start simple, get it green and then expand.  Formalising your expected will help you think through the algorithm and might switch on a lightbulb for you.
Comment: Thanks for the input. I've been at it with a framework called Machine.Specifications from NuGet, and that was how I was able to identify the errors at first - there were problems with my union and intersection methods in the Graph class. I think my biggest problem at this stage is that I'm uncomfortable with exactly how the algorithm is operating. This is brave new territory for me, who has little experience with algorithms - much less those that are NP-complete.


Any out source outlier (anomaly) detection package for Weka?

Question: There is KDD'98 cup data waiting for me to run some anomaly detection algorithms but Weka does not include any of them, natively. Is there any 3rd part package that can be integrated to weka?
Answer: Weka has a Libsvm package which includes the one-class Support Vector Machine (SVM) classifier which is quite widely used for outlier detection problems.
To begin with, here is a nice lecture on one-class SVM -- http://www.youtube.com/watch?v=rNGtj2iEw6g.
And below are the two widely read references on one-class SVM:
-- Schölkopf, B., J. C. Platt, et al. (2001). "Estimating the Support of a High-Dimensional Distribution." Neural Computation 13(7): 1443-1471.
-- Tax, D. J. and R. W. Duin (2004). "Support Vector Data Description." Machine Learning 54(1): 45-66.
Hope this helps.


I want to combine my www and non www and keep the link jucie from both

Question: My website shows up for some keywords in the www and some in the non www. Seaquake shows more links to the non www version. It is a PR2 either way. I would like to combine the link juice of the two versions into the non www version. Does anyone know the best way to combine the two and keep the link juice of both. It is as simple as a 301 redirect and if so does the 301 need to be handled in any specific way.
Answer: Yep, you choose the one you want (without www.) and you
301 redirect the other to the one you choose. (Using an htaccess directive to always remove the www. part for instance).
Answer: The best way to do this is to use the rel canonical tag in your website.  Check out this from the google webmaster tools:
http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html
Answer: The preferred domain is the one that you would liked used to index your site's pages. Links may point to your site using both the www and non-www versions of the URL.
For Instance:
http://www.example.com and http://example.com
The preferred domain is the version that you want used for your site in the search results.
Visit Google Web Master Tools for information on Canonical domain and what to prefer.


how to obtain the IP addresses of nodes for mining pools?

Question: I have set up a node for mining, and in order to maintain network stability and quickly receive the latest tasks, I would like to connect to nodes of some large mining pools. Does anyone know how to obtain the IP addresses of nodes for these large mining pools?
Answer: There isn't a way to obtain these IP addresses (that I know of) other than to contact the mining pool or to follow the sign up process for that mining pool. You don't need to know the IP addresses of multiple mining pools as your mining pool will take care of broadcasting any mined block that your hardware finds and probably has its own infrastructure for receiving mined blocks from other mining pools. If you are concerned with stability of the network of full nodes then just connect to multiple other full nodes (perhaps randomly), they don't need to be mining pools' full nodes.
If I misunderstood the question and you don't want to use a mining pool and solo mine instead then good luck in 2024. It is very rare for a solo miner to find a block (see this Coin Telegraph article).
Comment: I noticed there is an evaluation of all nodes on https://bitnodes.io. If I were to set up a mining pool, can its nodes be referred to using bitnodes for connection? Do you know about the connection strategy?
Comment: @youcaizhao: Bitnodes just indexes the IP addresses of reachable full nodes on the network, it doesn't present any information on mining pools. Obviously if you find an IP address of an mining pool you can look it up on Bitnodes and share the Bitnodes URL for it.


Which is the best multitrack recording software?

Question: What is the best multi-track recording software for Ubuntu? I know Ardour is one of them but I heard it is a bit complicated to use.
Answer: You can check out the following applications:

Jokosher
Audacity
Traverso

Here is the what their summaries says on the USC.
Jokosher:

Jokosher is a simple and powerful multi-track studio. Jokosher
  provides a complete application for recording, editing, mixing and
  exporting audio, and has been specifically designed with usability in
  mind. The developers behind Jokosher have re-thought audio production
  at every level, and created something devilishly simple to use.
Jokosher offers a strong feature set:

Easy to use interface, designed from the ground up. Jokosher uses    concepts and language familiar to musicians, and is a breeze to use.
Simple editing with splitting, trimming and moving tools.
Multi-track volume mixing with VU sliders.
Import audio (Ogg Vorbis, MP3, FLAC, WAV and anything else supported    by GStreamer) into your projects.
A range of instruments can be added to a project, and instruments can    be renamed.
Instruments can also be muted and soloed easily.
Export to MP3, Ogg Vorbis, FLAC, WAV and anything else GStreamer    supports.

Audacity:

Audacity is a multi-track audio editor for Linux/Unix, MacOS and
  Windows.  It is designed for easy recording, playing and editing of
  digital audio.  Audacity features digital effects and spectrum
  analysis tools.  Editing is very fast and provides unlimited
  undo/redo.
Supported file formats include Ogg Vorbis, MP2, MP3, WAV, AIFF, and
  AU.

Traverso:

This is a free, cross platform multitrack audio recording and editing
  suite, with an innovative and easy to master user interface. It is
  suited for both the professional and home user, who needs a robust and
  solid DAW.

Also you could search for more applications from the Ubuntu Software Center.
Comment: Bad links that redirect to a bad package repository.
Answer: I'm a new user to audio editing and recording, recording my own guitar song. Tried a few apps so far, here's my opinions about them each.

Audacity seems confusing for a newbie me. Besides, it sticks out like
a sore thumb in GTK apps. Hard to config too.
I love the simplicity of Jokersher, but it does not work. Too bad,
the UI is so straightforward.

Eventually, Ocenaudio does the job for me. Integrates fine into Unity, even the Global Menu works.
Answer: I use Ubuntu Studio, which comes pre-compiled with Ardour, Audacity and a ton of other useful software for media production. I personally like Rosegarden and Ardour over Audacity, but use all 3 for different things. Here is some reading material :)

http://en.wikipedia.org/wiki/Ardour_%28software%29
http://www.rosegardenmusic.com/
https://en.wikipedia.org/wiki/Audacity_%28audio_editor%29
http://en.wikipedia.org/wiki/Linux_audio_software

all should be available through software center/synaptic/repos.
Some info on a full multimedia distro like Ubuntu Studio...

http://ubuntustudio.org/
http://en.wikipedia.org/wiki/Ubuntu_Studio


Select Distinct/Unique Rows from a Huge Table in SQL Server Without Timeout Errors

Question: I have a table in SQL Server with around 400,000 rows. Unfortunately, this table has many duplicate rows, as there isn't a primary key. I'm using SELECT DISTINCT to get all unique rows, but as there's so many of them, I keep getting timeout errors. What's the best way to approach this problem?
Comment: belongs on stackoverflow?
Comment: You wont get a proper answer unless you post your table definition (script it out in SSMS with right-click script table as... CREATE), any indexes defined against the table and your query.  Best guess if that you should create a clustered index on the column your distinct is on.
Comment: @Nick I'll do that, but, fyi, my distinct is on all the columns, not just one.
Answer: Good question. Improove timeout - raise the value. Or throw in more power. Technically 400.000 rows is not a lot, so it would go very fast for a decent server. Otherwise - if you have IO problems because your "server" has only one (pair of) hard discs.... then your IO Will kill you.
Basically, DISTINCT triggers a temporary result creation in the tempdb - so it is tempdb heavy.
But at the end, I would increase timeout, especially if this is a one time operation only.
Btw., to put that into perspective - where is the HUGH table you talk about? 400.000 is trivial in size.
Comment: How do I raise the timeout value? Thanks for your answer!

About the 400,000 = huge thing, it feels huge for me, but it's subjective.
Comment: Actually it is not subjective - pretty much standard anything below one million is trivial (not even small). 1.000.000 records where small 10 yars ago (Foxpro) ;) TImeout - check command, connection object. CHeck connection string parameters.
Comment: For the timeout thing, I'm running the query directly from SQL Server Management Server. Is there a way to set it there?
Answer: The best solution for speeding this up is to add an index on the field that you need to select against.  Using a select statement where the database engine has to filter results without an index essentially requires the server to walk through every row in the table.
Comment: Most likely a bigger issue with the hardware. Unless the table is unusualle wide - 400.000 rows are comically low a size. That is unless this is a one disc system that overloads the IO. I have distincted 130 million record tables without problems in a minute or so - 400.000 is nothing for even a small but properly set up server.
Comment: DISTINCT is a form of aggregate... an index will help if it's not SELECT * and you can limit it to keys. Otherwise an index won't help if it has to over all columns = table scan anyway
Comment: Will not help. A distinct NOT On only the key will trigger a table scan anyway, index or not.
Comment: True, I should clarify that to be effective, the index would have to be on all fields which are the target of the DISTINCT.  Re-reading the question though I'm curious what the structure of this table looks like and the exact query that's being run against it.  The timeout could be a symptom of a bigger issue with the overall design of the database.


Element is working for the local but not for the jenkins in selenium

Question: There is tool tip scenario it is working fine in my local but getting unable to locate element in jenkins. I have given wait and also using isDisplayed() method to get the element .I have to verify tool tip functionality is there any other way to verify?
Comment: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comment: Please show us the code you are using
Answer: I think it's not about Jenkins and local. Maybe in Jenkins, it's taking a long time to display the element. One thing you can do is, running your script on the machine where Jenkins is located, I mean as you running locally but the machine will be where Jenkins is located. Let me know, what you get.


How can an International Court of Justice order to stop the war in Gaza be enforced?

Question: In the expected upcoming case, where South Africa accuses Israel of committing genocide against Palestinians in Gaza, if South Africa wins and the court rules to stop the war, how can such an order be enforced?
Comment: I wonder whether such a court decision would make a (unilateral or multilateral) armed intervention legal. That may actually be a separate question, possibly on Law SE.
Comment: I asked about that [here](https://law.stackexchange.com/q/98625/3312).
Answer: It cannot. If it determines that a genocide is taking place, it can order it to stop.  But even then it cannot order, or interfere, in a state action such as a war.
It can resolve legal disputes between nations and issue advisory opinions between states which submit to its jurisdiction.
But stopping wars(as opposed to war crimes) is simply outside of its jurisdiction.
Answer: Such an order cannot be enforced as the global polity has no enforcement powers. The UN does have peace-keeping forces but these are usually deployed as part of a peace process brokered by states. It's inappropriate here.
However, it will have an important advisory effect on international bodies as well  as states. This can be seen by the fact that only the US has come out publically to denounce the suit. The rest of the international community will wait to see what the court's final judgement is.
Comment: And peacekeeping operations usually require the approval of the Security Council, where the US would veto any move against Israel.
Answer: Most of the world's states are parties to the Convention on the Prevention and Punishment of the Crime of Genocide. States are obliged not only to not commit genocide, but also to prevent and punish genocide. According to the International Court of Justice (ICJ) this obligation has extraterrestial scope. That is, if Israel is guilty of genocide, most states must interfere and must bring Israeli war criminals to justice. The latter could, for example, be implemented as an international criminal tribunal similar to the one who adjudicated cases concerning the Rwandan and Bosnian genocides. For stopping the ongoing genocide - if Israel is found guilty - the world could put sanctions on Israel, attack it militarily (the UN Security Council could authorize the use of force against Israel like it did against Iraq in 1990 by adopting resolution 678), or arm the Palestinian resistance. Stopping a genocide is a clear casus belli.
Here is an interview with international law professor Francis Boyle about the ICJ case. He says the same things I wrote about but fills in many details I missed. Clearly, the US would exercise its veto power to block any enforcement attempt through the Security Council (SC), which precludes the authorized use of force. However, Israel could be suspended from United Nations activities by the General Assembly (GA) if it invokes the 1950 United for Peace resolution. Both South Africa and Yugoslavia have previously been suspended that way. The GA can also establish a war crimes tribunal without the SC's involvement.
Comment: States are obliged in the same way people are obliged to pay taxes on their income. International law contains no formalized penal code but other states can still subject a violating state to various sanctions. The Yazidi genocide has been cited as a pretext for the use of force against ISIS.
Comment: I like the mentioning of the convention, but I wonder what "states are obliged" really means? Can they also, for example, decide to do nothing at all, if they wanted to and still remain signatories to the convention? Also, in the past how often did something similar happen, for example attacking a convicted country and using that as casus belli. Further I wonder if casus belli are still a big thing. It seems a bit as if countries simply attack whenever they want to (see Russia in Ukraine for example).
Comment: The UN security council can do nothing because the US will veto any action.
Answer: As far as I understood:

it can't be directly enforced
it could be major reason for UN SC sanctions aka "really working" kind. IF USA at least abstain from voting on this issue


increase precision without hurting recall

Question: I have a classification problem with class imbalance and after the oversampling, I get high recall ,accuracy and roc (around 0.85) while my precision and f1 is fairly low(0.50). I have used every kind of smote and undersammpling but I never get to achieve some balance between precision and recall.I have done some params tuning but when I try to increase my precision, my recall drops of course. Do you have any suggestions as to how i can increase my precision whilst not hurting the recall too much?
Answer: An important consideration is that your models are not giving categories. They are giving values on a continuum that are binned according to a threshold to give discrete categories (above the threshold is one category, below the threshold is the other). Moving this threshold around is what yields ROC curves.
A similar idea to ROC curves can be applied to precision and recall instead of specificity and recall. For a given model output, as you change the threshold, the predicted categories change. With these changing predicted categories come changing precision and recall. These precision and recall values can be plotted to give the precision-recall curve.
Thus, every model you have created gives not just one precision-recall pair but a bunch of them. It might be that a threshold other than the software default would give you the desired combination of precision and recall, and you might benefit from looking at these precision-recall curves.


Grails Atmosphere Implementation

Question: I am trying to implement auto update feature in my application using atmosphere plugin. I am also planning to use the same plugin to create a chat application. I have searched all over for proper documentation but I could not find any. Can you please direct me to a proper tutorial explaining the use of this plugin. Thanks in advance.
Answer: Here's the Atmosphere github project, with links to the documentation, tutorials, FAQ, and javadocs.
Here's the project for the Grails plugin, with what looks to be an extensive "Getting Started" right there in the readme.

Grails Atmosphere Implementation


Can we construct a function that is continuous at each rational point and discontinuous at uncountably many irrational points?

Question: Some functions on $\mathbb{R}$ are continuous at every irrational and discontinuous at every rational, but there aren't any functions that are continuous at every rational and discontinuous at every irrational. Additionally, it is easy to come up with a function that is continuous at every rational and discontinuous at countably many irrationals. Now, I am wondering if there are any functions from $\mathbb{R}$ to $\mathbb{R}$ that are continuous at every rational point, but discontinuous at uncountably many irrational points. If so, could you give me some examples?
Comment: Yes, you can. Let $K$ be a compact of positive measure which is a subset of $\mathbb{R}\backslash \mathbb{Q}$. Then consider the indicator function $f$ of $\mathbb{R}\backslash K$. As $K$ has empty interior, $f$ is discontinuous precisely at the points of $K$, which are all irrational and uncountably many.
Comment: no you can't since the rationals are not a $G_\delta$ set or rather it's not the intersection of countably many open sets.
Comment: @aldodecristo The question doesn't require the set of points of continuity to be *exactly* $\mathbb{Q}$, just to *contain* $\mathbb{Q}$ and miss uncountably many irrationals.
Answer: I'm turning my comment into an answer. We know that, as $\mathbb{Q}$ has measure zero, there is an open subset $U \subset \mathbb{R}$ with arbitrary small measure containing $\mathbb{Q}$. We just assume that the Lebesgue measure of $U$ is finite.
Let $f$ be the indicator of $U$. Clearly, $f$ is continuous at any point in $U$. Since $U$ is dense, $f$ cannot be continuous at any point outside $U$, so the set of discontinuities of $f$ is $\mathbb{R} \backslash U$ m, which contains only irrationals and has infinite Lebesgue measure (and in particular is uncountable).


What to use instead of org.jboss.resteasy.client.ClientRequest?

Question: I just found that org.jboss.resteasy.client.ClientRequest is deprecated, invalidating everything I could find on Google about how to use the RESTEasy client. The Javadoc gives no indication as to what to use instead. Google is likewise silent.
I have reverted to 2.3.5 for now, but would be interested in the answer anyways, as well as how one was supposed to find out the answer without asking someone else who knew - is there a resource with that information where I could have looked ?
Comment: #easyPeezey.  I'll add to your comments..that.... the examples seldom contain the import statements (<<this drives me nuts), and groupids and artifactids would also be very appreciated.
Answer: The 3.0 beta documentation here describes these deprecations like so:

Resteasy manual client API, interceptors, StringConverters,
  StringParamterConverters, and Async HTTP APIs have all been deprecated
  and will be removed possibly in a later release. There is now a JAX-RS
  2.0 equivalent for each of these things.

This would imply that the preferred method will be to use the JAX-RS Client API described in this post
Comment: There is also some useful information [buried in the Javadocs for `Invocation.Builder`](http://docs.jboss.org/resteasy/docs/3.0.4.Final/javadocs/javax/ws/rs/client/Invocation.Builder.html) which doesn't refer to a non-existent `ClientFactory` class, but it would be great if the RestEasy authors added some pointers from the deprecated classes.
Answer: If we assume there is a JSON API at http://example.org/pizza/{id}.json, (where 'id' is a pizza ID) which returns results such as
{
  "name": "Hawaiian",
  "toppings": ["tomato", "ham", "cheese", "pineapple"]
}

Building on the Invocation.Builder Javadocs, we can do something like this,
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
import org.glassfish.jersey.jackson.JacksonFeature;

public class PizzaClient {
    private Client client;

    public PizzaClient() {
         client = ClientBuilder.newClient();
         // enable POJO mapping using Jackson - see
         // https://jersey.java.net/documentation/latest/user-guide.html#json.jackson
         client.register(JacksonFeature.class);
    }

    /** POJO which maps to JSON results using Jackson */
    public static class Pizza {
        private String name;
        private String[] toppings;

        public String getName() { return name; }
        public String[] getToppings() { return toppings ; }
    }

    public Pizza getPizzaById(String id) {
        String uri = String.format("http://example.org/pizza/%s.json", id)
        Invocation.Builder bldr = client.target(uri).request("application/json");
        return bldr.get(Pizza.class);
    }

    public static void main(String[] args) {
       PizzaClient pc = new PizzaClient();
       Pizza pizza = pc.getPizzaById("1");
       System.out.println(pizza.getName() + ":");
       for (String topping : pizza.getToppings()) {
            System.out.println("\t" + topping);
       }
    }
}

(this is also assisted by this post although that uses the deprecated API).
Note also that you may need to register a special handler if you want to use Jackson to read POJOs (or, I think, using JAXB) as documented here
Update
You actually only need the following Maven dependencies:
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.3.1</version>
    </dependency>

(In which case you're not using RestEasy at all -- the javax.ws.rs JAXRS implementation comes from Jersey)
OR you can stick with JBoss:
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson2-provider</artifactId>
        <version>3.0.4.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>3.0.4.Final</version>
    </dependency>

In which case you can just remove the JacksonFeature line in the above code, and the code uses the more liberal Apache licence.
Answer: The RESTEasy documentation says we should close the client connection; that would be client.close() in your example.  But every example I can find does not do this.  Will the client connection get closed automatically during garbage collection?


Ubuntu 12.04.02 filesystem

Question: I am about to install Ubuntu 12.04.02 desktop on my home PC. Can somebody please tell me what is the default file system for Ubuntu 12.04.02, is it ext3 or ext4?
Answer: Ubuntu 12.04 will default to Ext4.  See image below (Taken during installation, and choosing something else at install type screen).
Comment: I thought it was ext4 but wanted to check. Many thanks for your swift response.
Answer: Default file system is ext3.
For more information regarding ext3 and ext4 refer here
Answer: Ext3
Ext3 stands for third extended file system.
It was introduced in 2001. Developed by Stephen Tweedie.
Starting from Linux Kernel 2.4.15 ext3 was available.
The main benefit of ext3 is that it allows journaling.
Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling.
Maximum individual file size can be from 16 GB to 2 TB
Overall ext3 file system size can be from 2 TB to 32 TB
There are three types of journaling available in ext3 file system.
    Journal – Metadata and content are saved in the journal.
    Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing the content to disk. This is the default.
    Writeback – Only metadata is saved in the journal. Metadata might be journaled either before or after the content is written to the disk.
You can convert a ext2 file system to ext3 file system directly (without backup/restore).

Ext4
Ext4 stands for fourth extended file system.
It was introduced in 2008.
Starting from Linux Kernel 2.6.19 ext4 was available.
Supports huge individual file size and overall file system size.
Maximum individual file size can be from 16 GB to 16 TB
Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)
You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).
Several other new features are introduced in ext4: multiblock allocation, delayed allocation, journal checksum. fast fsck, etc. All you need to know is that these new features have improved the performance and reliability of the filesystem when compared to ext3.
In ext4, you also have the option of turning the journaling feature "off".

Ubuntu 12.04.02 filesystem


In Knives Out, how did Marta get away with a certain lie without vomiting?

Question: In Knives Out, Marta vomits whenever she tells a lie. It's an interesting quirk that makes it difficult for her to execute Harlan's plan while evading B. Blanc's suspicions. When she is in the study with Harlan, she claims that she cannot play Go because she had too much champagne. It seems the movie goes out of its way to show us that this was a lie: we see in a flashback that she had refused the champagne. This suggests that her vomiting quirk is fake, she does it whenever she wants. But this causes a contradiction: why would she vomit in the soda cup when no one was even there to see it?
Comment: The vomit trigger is established in the film to have significantly predated Harlan's death — Ransom new about it from a game of "mafia" that the family had played at a previous gathering (and used his knowledge of it in putting pressure on Marta).
Comment: Just a guess, the vomit trigger may have started at the trauma of Harlan death, because we didn't see her vomit before, another guess is that it happens only when answering a question
Answer: Because Marta's lie-induced vomiting is likely a guilt-based physical reaction to emotional stimuli. She doesn't get sick because she's lying, she gets sick because she's a good person, and lying makes her feel so guilty she vomits. Telling Harlan she's too drunk to play Go wasn't intended to fool or deceive him, it was a weak excuse that she knew he wasn't going to fall for to get out of sitting down for a game she wasn't in the mood to play. There was nothing to feel guilty about, because she wasn't trying to hide anything. Just making idle protests to get out of playing the game, which was never going to work, and which she knew wasn't going to work.
Answer: Marta vomits when she directly lies. She gets only nauseous when she conceals the truth. While remaining in the lie, she gets sicker and sicker. At the end of the movie, she was able to hold off vomiting for an extended period of time. But, while facing the person to whom she was lying, she could not hold off vomiting indefinitely.
Answer: The simplest answer is that it likely isn't a lie at all.  First, in the screenplay, it seems there was originally an intention of showing this explicitly.  Marta first declines a glass of champagne but then after the awful conversation with the family about immigration where she's put on the spot, the screenplay had this:

Marta takes the opportunity to slip into the hallway, alone. She
breathes hard. Takes a champagne flute from the tray. Drinks it in one
gulp.

Now, I know many times the final cut of a film leaves out a detail from the screenplay for a reason, so we can't assume necessarily that Marta was still intended to drink a glass.
Nonetheless, the dialogue suggests that Harlan may have actually witnessed this "one glass" of champagne:

Marta: I had a glass of champagne.  Harlan, listen to me.  We are...
It's late.  I had...
Harlan: You've only had one glass.
Marta: Exactly.  A glass of champagne.

The way Harlan says this, he states it matter-of-factly (not in the tone of a question), seemingly confirming that he knows it was only one glass. Such as, perhaps, a glass that she insisted she drink as part of a birthday toast perhaps or something.
If she were actually trying to convince Harlan she was too drunk to play, explicitly saying it was only one glass isn't going to help her case.  So, I don't think there was any intent at deception there.
Given the tight editing of the film in general, it seems unlikely that the apparent on-screen contradiction was a total oversight.  A few things could be going on:

This was a possible red herring, initially casting a bit of doubt on Marta's account.  But since we never get later confirmation of her ability to lie without vomiting in the film, this turns out to be a red herring.
Perhaps for some other reason they decided to eliminate the scene of her drinking the champagne off to the side (perhaps to eliminate the implication that she was being irresponsible when she had to give medication later), but the shoot was already completed and it would be too difficult to stage another scene with all the actors showing her toasting or something instead and basically being goaded into it.
Perhaps it really is a continuity error, though I think that's unlikely as I said above.

I know that this one detail has spawned many internet conspiracy theories about Marta.  But the question is to what end would she even lie here?  If she really wanted to get out of the game of Go, she could have said she had a few glasses.  (Though again, that might look bad in terms of making her look unprofessional and possibly negligent for drinking before giving medication.)
So why even bother to show this supposed "lie"?  Why have Harlan be the one to seemingly confirm it was only one glass (as if perhaps he knew and had witnessed it, and knew she took her job seriously enough not to drink more)?
And if she was supposed to be able to suppress her need to vomit after lying, why not show any other scenes of it in the film?
It's a puzzle, but given the screenplay and dialogue, I just assume that she did have only one glass (because she's a responsible nurse, which is what the other declining scene is there to show), and we for some reason didn't see that one glass on-screen.


How would you measure the diameter/radius of a non-circular bacterial zone of inhibition?

Question: Typically when we're testing the antimicrobial effects of some substance on bacteria growing on an agar plate, we get the area or diameter/radius of the zone of inhibition. But what do we do in cases where the zone of inhibition is not uniformly circular around the antimicrobial agent? How would diameter and radius measurements be of use in these cases and/or how would one adapt these measurements to more accurately reflect the area of the zone of inhibition?
Comment: I think a picture or two would be worth a thousand words here
Answer: We actually did something like this in one of my periods in biology class, all you need to do is take your measurement in millimeters. This measures the radius of the zone of inhibition. Multiply that by two in order to get the diameter.
If it's not uniformly circular, try getting the diameter of the circle you do know, and find the diameter/length/width of the unusual part. Just like in maths when you calculate total volume of a combination of shapes.
By unusual part, I mean the part that makes the circle around the microbial agent non-uniform.
Answer: If your inhibition zones are not uniformly circular (or at least close too it) you may want to revisit your methods and ask why this might be the case.
Are you applying your inoculum in a consistent and standardized manner? Is the inoculum too light or too heavy in any place? Are your disks too close together, or too close to the edge of the plate? Could your disk have moved after application (possibly due to excess moisture or condensation on plates)? Is the uneven zone close enough to another disk for the two agents to interact, either synergistically or antagonistically?  (see image)

Have you looked to see if any special cases apply, like Fosfomycin, in the EUCAST breakpoints table.
If all of those potential causes are ruled out, I'd say you should measure to the nearest (inner most) circular or semi-circular edge of the zone. Since diffusion tests are often used for antibiotic susceptibility testing of clinical isolates, users (and clinicians) are often more interested in the qualitative classification (susceptible, resistant, or intermediate) than the quantitative result. For example, in cases where a double zone in present, the EUCAST method recommends measuring to the inner-most zone, unless otherwise specified, to avoid falsely categorizing a resistant isolate as susceptible.
If it's irregular because it's overlapping with the edge of the plate, with another inhibition zone, or if synergism/antagonism(aka induction) are suspected, you could just measure to the circular part and ignore the overlap/interaction zone, but retesting with more space around the disk would be preferred.
References:

EUCAST clinical breakpoints table, version 12.0
Antibiotics in laboratory medicine, 6th edition. (image credit)
Development of the EUCAST disk diffusion antimicrobial susceptibility testing method and its implementation in routine microbiology laboratories


Replacing a Light Fixture with 2 Sets of Wires

Question: I bought a new light fixture for my porch light.  The directions for installation describe only using 1 set of wires, however this light has 2 set of wires.  I don't imagine it should be difficult, but I assume it can be done very wrong.  How do I install this fixture?
Comment: `directions for installation describe only using 1 set of wires` ... are you sure?
Comment: @jsotola Yes, I suspect they are fairly generic instructions, because I bought 2 lights to choose from, and the other light only had 1 set.
Answer: The light appears to have two sockets for bulbs, each with their own set of wires. The black wires are hot and the white are neutral. The single bare wire is the ground.
The two black wires should be joined together, along with the hot wire in the fixture box that comes from the wall switch. They should be stripped about 1/2 inch, twisted and covered with a wire nut.
The two white wires should be joined, along with the white neutral from the fixture box. Similarly stripped, twisted, covered.
The single ground wire is attached to the bare or green wire in the fixture box.
There is sometimes confusion about which wires in the box are which. If there was an old fixture, you should be able to connect the new wires to the same wires as before. If not, you will have to confirm which wire is the switched hot and which is the neutral. Color is usually the guide, but occasionally the color rules have not been followed.
Comment: I thought that should be correct, but I didn't want to do it without confirmation.  Thanks!
Comment: Soecifically, the rules require that if a neutral is present, it must be white.  However there are also white wires which are not neutral.
Answer: The purpose of the two sets of wires are twofold: Either

to allow you to control the bulbs separately, but from the same circuit (each black to a different switch, whites together).

or

to allow you to feed each bulb from a different circuit, so if a circuit breaker trips, you are not plunged into pitch black.  I'm very fond of this trick.  But it requires separation of the neutrals, which is what they are providing here.  (each neutral must return to its own circuit).
the different circuits could even be mains, and low voltage solar/battery.


InvalidOperationException while saving an image to the media library

Question: I'm trying to save an image to the media library, but I'm getting an "InvalidOperationException" when the SavePicture function is being called. I have an image file saved in the isolatedstorage that i want to save to the Pictures Hub. Here's the code snippet -
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
    {
        using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(fname, FileMode.Open, FileAccess.Read)) //fname is the filename of the image that is to be saved in the library
        {
            MediaLibrary mediaLibrary = new MediaLibrary();
            Picture pic = mediaLibrary.SavePicture("SavedLogo.jpg", fileStream); //Exception thrown here!
            fileStream.Close();
        }
    }

From what i've gathered, this exception has something to do with Zune blocking out the Images library when it is running. I have it stopped and don't have a phone connected to the PC either.
When i test this app on a physical device, the app just crashes, although i can see a blank image saved in the "Saved Pictures".
I'm downloading the image from a url using a webclient and it seems correct. The webclient is passed the image's url (openReadAsync). Here's the openReadCompleted event :
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            var resInfo = new StreamResourceInfo(e.Result, null);
            var reader = new StreamReader(resInfo.Stream);

            byte[] contents;
            using (BinaryReader bReader = new BinaryReader(reader.BaseStream))
            {
                contents = bReader.ReadBytes((int)reader.BaseStream.Length);
            }
            IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
            IsolatedStorageFileStream stream = isf.CreateFile("example.jpg");
            stream.Write(contents, 0, contents.Length);
            stream.Close();
         }

I think it is saving the file correctly (in the isolatedsotrage, that is) because it is displaying it successfully when i try and open it later.
Answer: Are you sure that the image saved correctly? MSDN has a great resources for saving pictures to the MediaLibrary
http://msdn.microsoft.com/en-us/library/ff769549(v=vs.92)
Comment: I haven't used the exact method on there. I've added what I've done to save the image.


How am I able to let my 2 PC over internet see one another as if they are on the same network segment?

Question: How am I able to let my 2 PC over internet see one another as if they are on the same network segment?
Comment: Off to Superuser.com - this is not a business environment question.
Answer: With a VPN.
You have tons of options to choose from.
Answer: With a VPN. Usually in advanced routers you can setup one, this means both routers in both ends must support it.
If both ends have a computer you might leave them switched on, use it as a server and setup Openvpn there. the router then will just NAT the openvpn port to the server and from the server you will have your LAN plugged to your SWITCH who will connect your pc.
An application called teamviewer might help you too, there's a vpn option but I've never used
Answer: 1) On 1st PC setup OpenVPN(or any other VNP server) server.
2) On the router connected to the 1st computer, setup port forward or DMZ
3) On 2nd PC setup connection to 1st PC


Are my wires in this junction box too short?

Question:
This my first attempt at a junction box .  I am kind of worried the wires are too short.  They are all in the push connectors. Is this safe?
Comment: Those wires are so short that you are actually at risk of a wire or junction break -- especially if that space is subject to freezing temperatures.
Comment: looks way too short ..... you should be able to pull the ends of the wires out of the box and work on them comfortably
Comment: You should probably say what country you're in. Different countries have different definitions of 'safe'.
Comment: Going to guess that the second picture is your re-do?  Much, much better.
Comment: I'll add, since I haven't seen it below, that in the places I've done home wiring (Ontario and Nova Scotia, Canada), the excess _external_ insulation is a problem. Shouldn't be more than a cm or so from the cable clamp (I don't have my simplified code with me to get the exact amount.
Comment: In the UK, I would add some green/yellow earth wire insulating sleeve on the exposed bare copper.  Not sure if this additional safety measure is used in the US.
Comment: @uɐɪ In a metal box that would be undesirable. The point of bare ground is to provide maximum exposure to this extra path. In fact, you're required to attach a ground wire to the box.
Comment: Yes second picture is my redo
Comment: The box (if metal) has to be earthed in the UK too. We brits sleeve the earth wire for identification and to stop it accidentally touching terminals on accessories.
Answer: The work is solid with a few exceptions.
Yes, that's too short.  You should be leaving 9-12 inches.  The legal minimum is 6" past the clamp, or able to reach 3" beyond the finished wall surface.  It can seem cluttery, but cluttery is good.
Are you using a book on electrical?  The book would tell you this. People learning electrical work best when they have a general overview of all aspects - a primer if you will. Google can't substitute because Google only answers questions, and without a well rounded set of concepts, it's hard to know all the questions  you should be asking.
You will need to replace all three legs, and you will be better off doing it now, rather than waiting until the drywall is up, you are doing any kind of maintenance, and you are forced to improvise.  Remove the old cables carefully and you can reuse them - maybe even for each other.
These push connectors are particularly problematic with short wires, because it is annoying/difficult to wrest the wires out of the push connectors, so people usually just snip them.   You'll want even more length for that.
Some people get snipper-happy and go out of their way to cut wires as short as they can.  Perhaps they think there are brownie points for that... Code does mention "neat and workmanlike", but functionality and maintainability come  before neatness. Another trouble spot is the panel - it's in vogue to go snip-snip*, but for maintainability, you should give every circuit enough length so both hot and neutral can reach every breaker position in the box.

You need to ground the box also.  Most boxes have a threaded 10-32 hole in the back for a ground screw. Some are on dimples so they work flush against a surface, look for that feature in boxes.  They sell special green #10-32 ground screws.  But any will do.  Do not use a deck screw or sheetmetal screw unless it is cut -32 thread or finer.
Rather than spend a big budget on connectors, I would recommend using wire nuts instead.  Not least because you can take apart wire nuts and reassemble them.  But even more, because wire nuts produce reliable connections, and push connectors - like any backstab - are notorious for series arcing and failure.  At least you are in a metal box, which will contain all but the worst series arcing.

I also see where you have knocked out two additional knockouts.  You need to fill those with knockout plugs. Those are trivial cost, about a buck for five.  Alternately, if you are expecting more cables to come in, you are painted into a corner with those push connectors.
Assuming you'll have 5 cables, it's time to start talking about box fill.  If the box is getting too crowded, you can get either box extensions or "mud rings" which provide some additional cubic inches.  On the Web there are "official" tables and calcs for box fill, but if  you are leaving yourself 9-12" of wire, you'll know when boxes are getting crowded.  The takeaway is that extensions (and larger boxes) are available.
My signature box when I have >5 cables converging is the 4-11/16 square x 2-1/8 (120 x 55mm) which I buy at electrical supply houses, where they are much cheaper.

* check out this disaster of a box.  Looks purdy, but now add a generator interlock and a whole house surge suppressor: those need to go on top, so every breaker must move down 2 spaces.  That expensive subpanel cable definitely will not reach, ouch!  And then, when they add GFCI or AFCI to some breakers, none of the neutrals can reach.  But he leaves lots of slack for the short service line (why?) Also, the panel is completely full, so it was a poor choice.
Comment: Harper referenced "additional cubic inches", but to further explain, there are calculations in the electric code that tell you how many wires, connections, and receptacles can be used in a certain sized box.  So, if you ever say, "man this seems like too many wires for this box!", you can use the calculations to determine what size box code requires.
Comment: Re "disaster of a box": Of course you can add a surge suppressor or two, just run the subpanel cable straight down and with a nice sharp turn right into the breaker and it'll reach (maybe after some tugging first). Or grab a couple of _serious_ wire nuts and splice a short extension in. Sure, it'll be the mother of all code violations and an instant fire hazard as well, but who cares about that when you can post a great-looking photo? :)
Answer: I'm no electrician, but at first glance I would say two things:

Ground the box itself. That ensures that there's no chance the box itself can become energized, because if a hot wire ever touched the box, it would trip the breaker. Unlikely situation, but I always do that when I'm working with metal boxes just to have some peace of mind. You should be able to do this with a common ground screw.
Plug those open holes unless there are more wires going in there. You can buy little knockout plugs for less than $.50 at most home improvement stores. Open holes into a live electrical box are never a good idea.

In the future, I'd leave a little bit more extra wire in there, but it should function just fine assuming you've used the correct gauge wire for your current rating.
Comment: It's worth noting all of these, including the wire length, are required by code. Metal boxes must be grounded, unused knockouts must be covered, and the wire must be able to extend at least 3 inches from the opening (6 inches of extension if all dimensions of the box are at least 8 inches; 6 inches is a general rule is typical).
Comment: @DanW actually push connectors are safer than screw terminals, because people often over or undertighten them, the copper can wander and screws can work themselves loose over time if there is vibration. Push-connectors like wago always have the correct pressure, and they can take much more current than the wires are rated at. See Big Clive talk about them here: https://www.youtube.com/watch?v=zWc_awaQFPg
Comment: @danw as big Clive is a professional electrician and electronic guru, who lives on Isle of Man, but also works in mainland UK, I believe him to judge wago as safe, legal and good. Seen the video? I also trust German chain Bauhaus not to sell dodgy stuff.
Comment: Also, use screw terminals, they're a lot safer and more reliable.
Comment: @K4KFH If I use a plastic box with a metal top cover, should I ground the top cover somehow?
Comment: Well they always have the correct pressure if they are made right. If they are made wrong then they always have the wrong pressure. Beware of cheap knockoffs.
Comment: @Lenne I'm not sure if push-connectors and wire nuts are actually illegal in the U.K., but I've never seen one for mains wiring in any setting - residential or industrial. I've only ever seen screw terminals. Not sure where you are? But using whatever is standard and 'safe' where you are is good.
Comment: @Lenne yeah, Big Clive is good; only skimmed the video so far. But those connectors he's got look a lot better made - a quick google suggests that the quality of push connectors is variable, and some have lots of arcing problems. Whereas terminal block is very reliable.
Comment: @DanW they are legal, but they are relatively new, and a little more expensive.   Existing stock, familiarity and price do a lot.
Comment: @Baldrickk good to know  I'll look out for them.
Answer: In addition to everything else everyone's said, if you don't have any spare length in the wires, it limits your ability to make changes to your wiring later.
You would struggle for example to bring in a 4th wire, and you've no spare length to correctly wire the earth wires to the metal box.
You may also need a little slack if you later adjust another fitting, or split a wire to make another spur off the ring.
Comment: Concur - OP or some other future person is gonna be grumpy if they need just a little slack somewhere in a wire.
Comment: Yeah, I've done that to myself, had to re-run the wire because I'd not left a couple of inches slack.
Answer: Looks ok I think it will work just needs a little  sprucing  up .
Providing your cable runs are long enough  you may want to insert additional cable into the metal box, if you do. Strip  back the  cable sheathing  within the  metal box at least 6inches then  connect them to the push in connectors ,also  ground the box itself either by adding an additional bare wire to your connector if it is a 4slot type connector if not then loop an existing ground wire  clockwise to the ground /bonding screw  sometimes they are green .
Also reverse all of your clamps have the screw portion of the clamps on the outside   of the metal box  and then use  knock out plates to cover the two spaces on the left side of the box.
Comment: Thanks for the tips.  I added more slack along with wire nuts.  I added a ground screw and wrapped the main line ground around it before splicing.  I got the wrong size knock plugs so I will put those in tomorrow.


Define an inner product between p-blades so that 0= completely orthogonal and 1=completely overlapping for their subspaces

Question: $\DeclareMathOperator\span{span}$Denote two $p$-blades $\nu=v_1\wedge \dots \wedge v_p$ and $\omega=w_1\wedge \dots \wedge w_p$ $\in \bigwedge^p X$, where $X$ is an inner product space. How to define the inner product of $p$-blades $\langle \nu, \omega\rangle$ from the inner product of $X$ so that
$$(1)\qquad \frac{\langle \nu, \omega\rangle}{\|\nu\|\|\omega\|}=1 \iff \span(v_1,\dots, v_p)=\span(w_1,\dots, w_p);$$
$$(2)\qquad\langle \nu, \omega\rangle=0 \iff \span(v_1,\dots, v_p)\perp \span(w_1,\dots, w_p).$$
I know one may define $\langle \nu, \omega\rangle=\det(\langle v_i,w_j\rangle)$, but this defintion doesn't satisfy (2). See the arXiv paper Grassmann angle formulas and identities by Mandolesi.
Answer: It is not possible. Let (i,j,k) be the canonical basis of $\mathrm{R}^3$, $\nu=i\wedge j$ and $\omega_t = (\cos (t) i + \sin(t) k)\wedge j$. For $t=0$ your condition (1) requires $\langle\nu,\omega_0\rangle=1$, and as $\omega_\pi = -\omega_0$ we have $\langle\nu,\omega_\pi\rangle=-1$. By continuity $\langle\nu,\omega_t\rangle=0$ for some $0<t<\pi$, but $\omega_t$ is never completely orthogonal to $\nu$.


How can I remove the stem on my leaking IKEA faucet?

Question: I have an IKEA LOVIKEN AA-291347-1 faucet. It leaks between the 2 handles at the connection.
I removed the screw behind, but I cannot remove the top center part.
Do you have any idea how I can open it to change the seal inside?

Comment: How old is the faucet?  Is it still under warranty?
Comment: after removing the screw it should just lift out, maybe you need to wiggle it a bit or turn it to a certain angle.
Comment: Did you ever get this resolved? If so, please give a check-mark to the answer that helped you the most, or write up your own answer explaining what you did to get it fixed and give yourself a check mark. That will help others with this kind of problem know that this has a resolution and is a good place to look for their answer
Answer: While you have removed the locating screw, there are usually 3 rubber (well nitrile or somesuch) sealing rings which are a tight fit.
So, you might have to twist and pull very hard to get them to release.
At least, that was the case when I took a similar tap apart.
Of course, lots of care needed to get it back together without damaging the new seals...
Answer: I believe that part is factory assembled, not removable. You may want to check with the manufacturer, if there's a local 800 number. Maybe they'll give you a brand new one.


How can I remove the top panel in Unity?

Question: I want to keep the Unity launcher only and remove the panel. Is there a way to do that?
Answer: Not a complete answer, but you'll need to disable Global Menu first :
sudo -s
echo "export UBUNTU_MENUPROXY=" > /etc/X11/Xsession.d/81ubuntumenuproxy

Then restart your computer.  If you want the Global Menus restored, simply remove that file (sudo rm /etc/X11/Xsession.d/81ubuntumenuproxy).
After that, if you can delete the top panel somehow, at least you'll keep most of your functionality.  You'll need some kind of replacement for some of the indicators, like network-manager and the session menu.
Answer: Install cairo Dock and During login Change the environment to "cd" by clicking on the Ubuntu symbol at top of use name entry during login...By this you'll eliminate top panel but will miss the dash and unity scopes.
Answer: By panel, you mean the global menu on the top of the screen?
If that's the case, I don't think it's possible because it's used for application's menu. If you would get rid of it, your apps wouldn't have menus.
Comment: It can ofcourse be disabled. See here: http://www.liberiangeek.net/2012/04/disable-the-global-menu-in-ubuntu-12-04-precise-pangolin/
Comment: the question is about removing the top panel altogether. and not just changing the menu bar position. the main aim is to gather more screen space. so, for the OP it doesn't really help much. and as the answer here says, inn Ubuntu it is not yet possible, very very sadly.
Answer: Use gnome to run the unity launcher (with it you can completely remove panels, since unity uses nautilus anyway it is essentially the same), and then run unity-2d-shell to get back just the unity launcher, you can then add it to start-up programs, by running gnome-session-properties
With this you can even run the unity launcher in xubuntu! And it solves the window maximizing bug where the close icons disappear or move to the other side.