Org-cycle with TAB from isearch without RET

Question: When I've  isearched for something in a headline in org-mode, and my cursor is sitting on the headline I want: how do I org-cycle that headline with TAB? Currently I have to first press RET then TAB. I would like to save the RET keystroke if possible. Looking for the Emacs Lisp for configuration.
Comment: `C-s` is modal: you get into a state where you can use a limited number of keys and stay within that mode (e.g. `C-s` to go the the next match, `C-r` to go backwards) - do `C-h f isearch-forward` and check the `isearch-mode-map` section to see what those keys are. While in that mode, however, any *other* keys get added to the search string: you need to *exit* that mode for keys to be normally interpreted and that's what `RET` does. IOW, there is no way to do what you want with `isearch`: it makes iterative, interactive searching easier but the modal nature of it requires a way to exit from it.
Comment: https://emacs.stackexchange.com/tags/elisp/info
Answer: If you want TAB to exit Isearch and do its regular (non-Isearch) thing, then just bind it in isearch-mode-map to isearch-exit (the same function RET is bound to):
(define-key isearch-mode-map (kbd "TAB") 'isearch-exit)

I don't recommend that, however, as you might want to search for a TAB character by hitting the TAB key...
Comment: Was not aware of isearch-mode-map and isearch-exit synergy. This is great. I have solved my problem with this. Thank you very much. Regarding your anti-recommendation, I'm not worried. Can bind C-M-TAB to insert TAB into search string if I ever encounter this issue. I've been using Emacs a while and have literally never searched for a TAB character.
Answer: Instead of isearch, you should be using org-occur.   See
(info "(org) Sparse Trees")

or
Sparse Trees (The Org Manual)

org-occur (C-c / r or C-c / /)
Prompts for a regexp (see Regular Expressions) and shows a sparse tree with all matches.

If the match is in a headline, the headline is made visible.

If the match is in the body of an entry, headline and body are made visible.

In order to provide minimal context, also the full hierarchy of headlines above the match is shown, as well as the headline following the match.
Each match is also highlighted; the highlights disappear when the buffer is changed by an editing command, or by pressing C-c C-c .
When called with a C-u prefix argument, previous highlights are kept, so several calls to this command can be stacked.
Comment: Sparse trees are great, but this answer does not address the specific question that I was asking.


Blender Internals to EEVEE?

Question: I have this model of starship enterprise all textured and set up. I wish to move over to EEVEE but heard that there is 0 compatibility between internal and eevee. Is that true? How can the model be changed into EEVEE engine?
Answer: Before 2.8 there was addons to convert Blender Internal materials into Cycles materials.
But in 2.8 none of those addons have been upgraded to the new addon API changes yet. You could wait until one is upgraded.
In the meantime, you can simply make yourself a separate installation of Blender 2.79 and use its integrated Material Utils addon to convert your Internal materials into Cycles.
Then append the Cycles material into your 2.8 scene. Cycles materials are mostly compatible with Eevee, so there shouldn't be much issues switching from Cycles to Eevee.
Comment: It just... doesn't come out right. Specular mapping is all broken.
Comment: Please show us how it is so we can figure this out.
Answer: There are no major issues when switching from Cycle render to EEVEE render. But there are a few things to keep in mind like:
- Light (reduce the light intensity when switching to EEVEE, including the light of the world)
- Materials do not change much except glass materials. You can turn on "Refraction" to increase the reflection.
Hope to help you
Comment: You or I may have misunderstood the question. He is talking about materials in *Blender Internal*, a render engine in Blender 2.79. This would not be cycles.
Comment: I think me misunderstood. I start to learn blender 2.80, the first time I heard Blender Internal XD
Comment: Leander is correct. RIP.
Comment: Guess the user meant  **the default** engine, which in 2.8x is Cycles.

Blender Internals to EEVEE?


Windows Server 2008 Network User Shares

Question: What would be the most efficient way to create a different shared folder for each user (not necessarily with desktop, my documents etc inside just a space that can be mapped to his computer), having a windows 2008 server with 30-40 windows 7 client machines on the same network? Would it be using active directory?
Notes: the users dont have accounts on the server machine yet
Thanks!
Comment: `Per user shares` as in home directories for the users?  Clarify your question.
Comment: different shared folder for each user (not necessarily with desktop, my documents etc inside just a space that can be mapped to his computer),
Answer: Based on your latest comment, there are multiple ways to do this and it doesn't require "desktop redirection".
Simple setup included...
You can:

Create a share called \\server\Users and set the share permissions to Everyone - Modify/RW and Domain Admins - Full Control.  Then in the NTFS permissions of "USERS" make sure Domain Admins has full control and normal Domain Users only have Special rights for This Folder Only of the following:

Then at that point you have the base share setup.
From here you can:

Much to the chagrin of MDMarra, you could use the Profile tab in the user account in AD and set a Home directory drive mapping to \\server\Users\%username% and hit apply/OK.  This will auto create a folder in that directory and give the user and that user only full control (besides domain admins).
1 above isn't really recommended due to issues.  See Doug's full walkthrough here, but you'll need to setup each user folder manually with permissions: http://blog.luxem.org/2010/07/how-to-setup-home-directories-on.html

You can use The Drive Maps extension in GPP now -  User Configuration > Preferences > Windows Settings > Drive Maps and map a drive to \\server\Users\%username% but you'd need to either have redirection already in place or you'll need to setup the user's folder and their rights to it ahead of time (whereas in step 1 it is done for you)

You can reference:
Doug's excellent article: http://blog.luxem.org/2010/07/how-to-setup-home-directories-on.html
http://technet.microsoft.com/en-us/library/cc731729.aspx
Answer: Active Directory is the best choice. Create User Groups, then Users, and you can do a clean share of your network resources (disks, printers, internet access...).

Windows Server 2008 Network User Shares


Is there a standard size for smart phone wallpaper?

Question: There are too many smart phones and sizes, I have to create a lock screen for a client but dont know what size I should be designing, is there a standard size that applies to all? instead of creating separate sizes for different phones. Since wallpaper can be adjusted, wouldn't one large size fit all?
Comment: Are you developing the application as well? Is this Android or iPhone or both? How far back does the app need to go regarding OS support?
Comment: Just wallpaper design, just wondering if the design is large enough, if it would that be good enough to cover all phones.
Answer:
Proportions my friend, not size.

The dominant proportion for screens at this time is 16:9... or 9:16 I should say in the case of phones because they are most used in a vertical position.

Ok. Let's use a "standard" size.

And you can make a high-resolution wallpaper and let the lower resolution phones deal with it. In this case a 1080x1920px size will be fine.
Forget about the declared resolution. That declared resolution is meant for developers to deal with element sizes in designing interfaces for mobile. You need to use native resolution.
And as a lot of phones want to display full HD video (1920x1080) use those same dimensions in a vertical format.

Some exceptions can be made, for example, a wallpaper that is meant to slide as parallax when you swap thru screens can need a different size proportion. But that is a special case.
Answer: Another answer is to design this in a vector app (Illustrator, Affinity Designer, Inkscape) so that it's resolution independent, and then set up correct batch export parameters for all the most common resolutions for .pngs, and also export out a clean svg.
Test to be sure your svg functions as expected, and if not, you can distribute the pngs.
Comment: The issue is the design includes raster imagery so that might not work, but thank you.
Answer: I have a few approaches:
1. Design for the Largest Phone
I prefer the iPhone 8 Plus screen which has the dimensions of 414 x 736 pixels. Keep in mind by designing for the largest screen size, you'll inevitably be conceding some of the edges of the design on devices where down-scaling isn't occurring at an exact ratio. Not a "deal breaker" in my opinion but worth noting to a client.
2. Design for a Median Screen Size
Screen widths (in portrait view) can range anywhere from 320px to 414px, and screen heights range from 568px to 812px. Averaging these out gets you roughly 367 x 690px. These aren't exact dimensions for any phone on the market, but they are close enough to the standard Android size (360 x 640px), the Galaxy S8 (360 x 740px), and the Pixel 2XL (360 x 720px) to justify designing to those screen sizes. I give the edge to the Galaxy S8 in this instance since Samsung currently has the edge in smartphone market share at the moment.
3. Design for Device Popularity
As mentioned in the previous section, Samsung is the preferential smartphone in the consumer market currently holding about 23% of the market share. What makes this a less reliable option for basis of design is iPhone holding just over 15% and the historical power struggle of Samsung vs. iPhone. In such a volatile market, it wouldn't be wise to base design solely on this data point alone.
4. Take Everything into Account
While you can easily rely on one of these methods, taking all available information into account before crafting a design is the best practice. Before you sketch anything, or open the computer, figure out as much as you can. Solving the problem (in this case, which screen size will best exhibit the design vs. which screen size will best represent a universal experience) first requires the designer to gather information. The more information, the easier the puzzle becomes and the easier it will be to talk to your client about your solution.

Source: Global market share held by leading smartphone vendors from    4th quarter 2009 to 1st quarter 2018
Comment: Thank you for the detailed answer zeethreepio, that helps a lot.


How to install deck railing top board slanted

Question: I'm building the railings for my new deck and plan to use a 2x6 as the top board. 4x4 posts, 2x4 rails. How can I make it a bit slanted to help shed rain water with minimal tools? (No table saw, no router...).
Comment: Define "minimal tools"? You've got to have _some_ sort of saw to cut pieces to length, right? I presume you want the slant outward to shed water off the deck, not on to the deck. Use a level to get the rail dead flat, then adjust it so the bubble is slightly higher on the inside of the deck.
Comment: The best bet is to not use a 2x6 as a railing. Use something narrower that won't hold as much water in the first place. My railings are roughly 2x4 that I purchased premilled with a bevel on each side and square holes premilled in the bottoms to accept the balusters. They'll hold a drink with no problem, but a plate would be a bit of a balancing act, I guess.
Answer: You'd just slope the 4x4 posts, set the top rails on them, and fit your 2x4 rails underneath. A slight wedge gap would be present, but that's not going to look terrible.
I'd reconsider for a few reasons, though:

You'll need a substantial slope to drain enough water to make a difference. We're talking about beads of water or, at worst, shallow puddling. Both require at least several degrees of slope to eliminate.
This isn't going to substantially extend the life of the rail. Even if it did, replacing just the top rails after 10-15 years might be worth not creating conditions whereby...
You'll eliminate the railing as a drink/dish platform. Don't underestimate the utility of that surface for you and your guests.

I'm in a moist climate and we routinely used 5/4x6 deck boards as top rails. Folks really liked being able to rest dishes and elbows on that wide surface. They didn't rot out any quicker than the hundreds of feet of decking below. A quick squeegee cleans them off after a rain.
Answer: I'm not sure it's worth the trouble if you don't have a saw to cut an angle off the posts. Odds are that the wood will dry out to whatever shape it wants to be anyway, either holding or shedding water accordingly. I find any water sitting on top of this board soon evaporates. Just make sure you keep up with the protection on the top board especially.
2x6 is so thick, I suspect you'll be long gone before it rots out and keeping it flat will make it more useful to put plates/drinks on etc. (assuming the drop isn't over someones head).
If you have a circular saw you can cut the slant from both sides following the image below. The offset equals the height of the slope you want (suggest 10mm which gives you about 5-6 degrees slope).
.
Comment: To your point, ensure that the growth rings (as seen from the end of the board) curve down when installing the railing. That will help ensure that any cupping causes the cup to go _down_, thus naturally shedding water. If allowed to cup _up_ it will, well, be cup-like and hold the water in.
Comment: A treated 2x6 rots out in 20-30 years in climates with regular rain. That said, it wouldn't be disastrous to have to change out just that rail board after a couple decades.
Comment: @FreeMan I had never heard of putting the growth down to prevent water from pooling but it makes a lot of sense. I learned something new today thanks.
Answer: I agree with some of the other answers and comments, but to answer the question as asked;  How to slant the railing, without having a power saw to cut the post tops at an angle -
Or the tools to cut slanted mounting blocks.
Consider using Composite Shims.  Just like regular shims but weather proof:
Example:
8 in. Composite Shim (Bundle of 12)
Experiment with the angle of the shims and cut to fit the top of the posts.
You could glue or tack nail them together before attaching the railing.
Comment: How do you propose using these? On the post? On the rail? Both? Some detail would be great.
Comment: I do have a skill/circular saw (just no table saw or router)
Comment: Table saws and routers are no use to you for cutting a slant on the top of posts. A mitre saw is easiest, but you could use a circular saw to cut slants. Line the posts up on a flat surface (offset by the height of the slant required) and cut all of them in one go. Flip them over and repeat on the other side. If the posts are already fitted, then it's a challenge...


What does negative filling mean for Landau levels?

Question: I'm trying to read this paper, but I've never heard of Landau levels like $\nu=-1.$
What does it mean?
Answer: First, let me say that I find the discussion in Hierarchy of fillings for the FQHE in monolayer graphene particularly clear on this topic, and Goerbig's RMP is also a good resource. The paper you mention focuses on the $n=0$ Landau level in graphene, so I will as well.
The basic idea is that there is a difference in how we label filling ratios in conventional semiconductor 2DEGs and in materials with Dirac-like spectra, such as graphene. In the 2DEG case $\nu_{semi}$ is measured relative to the empty lowest Landau level ($n=0$). Hence $\nu_{semi}\ge 0$ as you're probably familiar with.
In graphene it is natural to instead measure filling ratios relative to the neutrality point (the Dirac node). Due to particle-hole symmetry the $n=0$ Landau level is half-filled at zero energy. Hence $\nu=0$ in the graphene case corresponds to a half-filled Landau level, rather than an empty one as would be implied by $\nu_{semi}=0$, and negative filling ratios become possible.
The final ingredient to note is that the Landau levels in graphene have a four-fold degeneracy due to spin and valley symmetries. Applying a magnetic field breaks this degeneracy and you get four sublevels. In the case of the $n=0$ Landau level, two of the sublevels end up below the Dirac point, and two above it. The $n=0$ Landau level is then said to be empty at $\nu=-2$ and completely filled at $\nu=2$, and the graphene filling ratio can be related to the one in a 2DEG counting by $\nu = \nu_{semi}-2$.


Google Analytics is not tracking all of our pages

Question: Our website is insynchq.com. In the All Pages report under Content -> Site Content we can only see data for some our pages, like /, /getstarted, and /download. Others, like /gmail, /about, and /mobile are not shown, even if we are sure that there have been visits to them. We use a template for our pages so the scripts that are loaded for / (for example) should also be loaded for /gmail, so it doesn't seem to be a problem with the installation of the tracking code. Can anyone help? Thanks.
Comment: Should does not equal does. Did you actually *check* that the scripts are being loaded on the pages? As you currently phrase things, you just seem to be assuming the template is working properly. Even if the code exists, there might be some other error or whatever that's interfering with proper execution, for example.
Comment: The chrome extension ghostery confirms that the javascript is being loaded. There are also no errors in the console. We also have other javascripts on the pages and we can confirm that they run as well.
Answer: We were finally able to resolve the problem. Turns out our programmer misplaced the _gaq.push(['_trackPageview']); in the untracked pages.
Answer: The 2 pages you give examples for working have a difference compared to those which don't work. In the code for the working pages (getstarted and download) there is no tracking for HitTail or Crazy Egg (and both HitTail and Crazy Egg are javascript tags to third party sites).
My guess is one of these javascript code blocks is confusing Google Analytics.
Comment: There is HitTail and Crazy Egg for / though, and it is being recorded in Google Analytics.
Answer: It's a bit difficult to say which one of the following might be the cause:

The scripts that you include before google analytics tracking code, might be the cause.
Google specifically ask users to: "Copy the following code, then paste it onto every page you want to track immediately before the closing  tag." - you add JS code after google-analytics tracking code, before the closing of
JS code supposed to be declared as


A word to describe a person who dismantles electronic products

Question: There are some Youtubers and Vloggers who make videos to show how they dismantle and/or modify electronic products like mobile phones, and maybe other kinds of stuff. Is there a word in English to describe such a person? Thanks.
Comment: Yes, they are hackers. Because you are not supposed to modify mobile phones unless they are simply repairing them.
Comment: Do they take the phones apart to show how they work, to repair them, to modify them, or to destroy them?
Comment: @alphabet Yes. I wonder if there is a more specific word to describe these people.
Comment: I'm asking which kind of people you are trying to describe.
Comment: @alphabet I thought "they" referred to the same group of persons no matter what they do after taking the phones apart, excluding those who destroy. Do they have different names if they do different things? Would you please teach me all the possible names?
Answer: The terms used to describe the kind of video tutorials you are referring to which demonstrate how an item is disassembled, either to carry out a specific repair or just to show how it is taken apart for the purpose of any repair, are 'teardown' or 'disassembly' videos.
I don't believe there's a specific word to describe the person who makes such videos. Chances are they don't just disassemble and reassemble things purposelessly. By trade, they may be an electronics technician or an engineer. If they are not qualified to be called that then they may just be an electronics hobbyist or enthusiast.
Answer: Appending -er to [noun] is a "productive suffix" in English. It can be used to create a new noun meaning person associated with [noun] in some way. As per this Youtuber...

what kind of teardowner would I be if I didn't take it apart first? Enjoy!

So just copy him. In context, I'm sure you'll be understood, just as I'm sure you understood my use of Youtuber.


Why there is forward chaining inference engine (reasoner) for description logics only and not for other logics?

Question: Reasoner is forward chaining inference engine (https://en.wikipedia.org/wiki/Semantic_reasoner) as opposite to Prolog backward chaining SAT solver (for queries). Why there is reasoner for description logics and not for other logics?
Answer: This question is a bit strange. I see it's based on the Wikipedia article, but that article is also a bit strange. I will try to clarify some concepts.

First, we have a language that can be used to make claims whose meaning are formally defined. Such a language may allow us to say, for example, that if $x$ is a Person, then $x$ is a Human, which can be done in first order logic as $\forall x (\neg\mathsf{Person}(x) \vee\mathsf{Human}(x))$, in a rule language like Datalog as $\mathsf{Person}(x) \rightarrow
\mathsf{Human}(x)$, in description logics as $\mathsf{Person} \sqsubseteq \mathsf{Human}$ and so forth.
Second, we have semantics, which formally defines the meaning of claims in the language. One way in which the semantics of a language can be defined is using model theory, which essentially maps terms in the language to sets, elements, and relations between sets; for example, we can map the term $\mathsf{Person}$ to a (hypothetical) set $P$ and $\mathsf{Human}$ to a (hypothetical) set $H$, and define the above claims as formally meaning $P \subseteq H$. This gives rise to the notion of models, where for example, $P := \{ \mathrm{Fred}, \mathrm{Jill} \}$ and $H := \{ \mathrm{Fred}, \mathrm{Jill}, \mathrm{Tom} \}$ is a model satisfying a given set of formal claims (since $P \subseteq H$), while $P := \{ \mathrm{Fred}, \mathrm{Tom} \}$ and $H := \{ \mathrm{Fred}, \mathrm{Jill} \}$ is not a model (since $P \not\subseteq Q$). In turn, models give rise to entailment between sets of formal claims, where for example, given $\{ \mathsf{Person}(\mathrm{Tom}), \mathsf{Person} \sqsubseteq \mathsf{Human} \}$ (in whatever language), we know this entails $\{ \mathsf{Human}(\mathrm{Tom}) \}$ as any model of the former set of claims must be a model of the latter set of claims.
Third, we have reasoning procedures to decide entailment. One way in which this is done is to use inference rules. For example, we may derive a rule such as $(\mathsf{C} \sqsubseteq \mathsf{D} \wedge \mathsf{C}(x)) \rightarrow
\mathsf{D}(x)$ to support reasoning with respect to the $\sqsubseteq$ operator in description logics. This rule may be applied for forward-chaining or backward-chaining. But there are many forms of reasoning procedures suitable for different types of languages; for example, for more expressive description logics, (a finite set of Horn) rules is not sufficient to guarantee complete reasoning, and so tableau-based methods are often used. Also one reasoning procedure can be useful for reasoning in different languages, where Datalog, for example, is natively based on rules.

Returning to the question:

Reasoner is forward chaining inference engine (https://en.wikipedia.org/wiki/Semantic_reasoner) as opposite to Prolog backward chaining SAT solver (for queries).

A "reasoner" can adopt multiple strategies, including, but not limited to, forward-chaining on rules. Engines that apply tableau-based methods, backward chaining, resolution, etc., are also "reasoners". (The article you base the question on never claims that reasoners are forward chaining rule engines, but mentions this as one strategy.)

Why there is reasoner for description logics and not for other logics?

There are reasoners for other logics. For example, Vampire is a reasoner for first-order logic, XSB is a reasoner for Prolog, or just check here for a list of different reasoners for different languages.
Comment: I understand that you imply that Vampire can do forward reasoning as well. So, I have found, that Vampire can do "demodulation (forward and backward" and "subsumption resolution (forward and backward)". I don't yet know what it means (I will read later about it), but it doesn't sound like full forward chaining. I.e. can I: 1) input into Vampire some set of premises, indicate natural deduction rule and get out the consequent ("bottom") set of sentences? 2) input input Vampire jugment (or two), indicate sequent calculues rule and get out the consequent ("bottom") judgment for one step?
Answer: Section 9.3.2 of the leading artificial intelligence textbook contains a sketch implementation of a forward chaining inference engine.


Service unavailable error while building using Maven

Question: I am a newbie to Maven.
First time I run the mvn clean install command and it gave me the below error:

[ERROR]     Non-resolvable parent POM: Could not transfer artifact
  com.sybase365.mobiliser:mobiliser-parent:pom:4.6.0-RC02 from/to repo
  (http://orinoco.sybase.com/nexus/content/groups/public-devel): Failed
  to transfer file:
  http://orinoco.sybase.com/nexus/content/groups/public-devel/com/sybase365/mobiliser/mobiliser-parent/4.6.0-RC02/mobiliser-parent-4.6.0-RC02.pom.
  Return code is: 503, ReasonPhrase:Service Temporarily Unavailable. and
  'parent.relativePath' points at wrong local POM @ line 3, column 11 ->

How do I resolve this error?
Comment: I have the same problem and believe it to be related to a proxy
Answer: Your remote repository is inaccessible.  See explanation for error 503 in here.
Comment: Could you update the link? It doesn't refer to a page about 503
Answer: I think i found the reason it gives 503. In my case this was a proxy issues inspite of excluding hosts that belong to a certain domain.
Remove the proxy from manage jenkins -> manage plugin -> advanced  and try again
Answer: Could be, also I find this error happens all the time when the repo is available and downloading the file manually from the nexus GUI works.  For some reason maven looks in the wrong repository location.  If it happens for one jar and its pom you can down load the file by hand.
If maven ever hits a temporary HTTP problem it stores a lastUpdated file that you need to delete or it will not try to download the file again for a while.
sudo updatedb && locate lastUpdated | xargs rm
Or scrabble around in explorer in /Users/username/.m2/repository to find the files if you use windoze
Another thing that can mess with repo access is the proxy that maven uses. Check the contents of ~/.m2/settings.xml or create this file and setup what ever HTTP proxies or lack there of that you need to access the repos you have configured in poms.


Mesh getting ripped apart when remeshing

Question: I am new to Blender so please bear with me.  I have imported a model from Maya into blender as an fbx file. In sculpting mode when I try to remesh it Blender either stops responding or the mesh does something very odd where it looks like the mesh has been torn apart.  I attached an image to show what I mean.  Does anybody know what is happening here and how to fix this?  Thanks in advance.
Answer: Remesh doesn't work when you have "thin" mesh. Your model gotta have thickness more, than one face. Solutions:

Use multires modifier, not remeshing a surface
Add thickness to model by "solidify" modifier and applying that
Close all holes in your model and try to remesh ones more.

(here is a simple representation of why it appears. left cube has "hole" and just don't remesh properly)


Changing threshold in logistic regression

Question: Suppose that you have a logistic model and the predicted probabilities of a $1$ all are in $[0.2,0.3]$. So the predictions would be "0" based on a threshold of $0.5$. What would be a good threshold to choose?
Comment: Logistic regression predicts probabilities. If these are sufficient to solve your problem, you dont need a treshold. So what are you using the regression for?
Comment: You will find much information here:  https://stats.stackexchange.com/questions/127042/why-isnt-logistic-regression-called-logistic-classification/127044#127044
Comment: Why would you need a treshold?
Comment: So that I can get better predictions. Right now my model predicts all 0's.
Answer: If your logistic model has predicted probabilities that are always in $[0.2, 0.3]$ for class $1$ and you have sufficient inclusion of class $2$ data you have possibly trained it with appropriate data or used appropriate features. The logistic regression model is probabilistic; ie, it spits back probabilities. If you decide that the model saying class $1$ has probability of $0.25$ and class $2$ has probability $0.75$ I feel as though you've eliminated a lot of the strong points and highlights of a probabilistic model as now your inference on features is wonk and difficult to properly interpret (using standard tests, which is really the best argument in favor of probabilistic models over other strategies and their bread-and-butter use-case). You can hack together other models that will probably fit better if you don't want a probabilistic strategy (ie, RF, NNs, etc).
Answer: Plot the ROC curve predicting class based on the output p value, then decide visually or using an optimal threshold algorithm considering your sensitivity/specificity tolerance
Comment: @Eric that's just not correct. When you plot out your ROC you become privy to the family of decision criteria that can be made based on the data available. Depending on the context and objectives, it is warranted to choose a decision criterion favoring any combination of sensitivity or specificity. Could this prevent some statistical tests? ...Maybe?  But it doesn't matter. The purpose is to understand the trade-off and decide appropriately. I do not think this deserves a downvote.
Comment: A logistic regression model does not have a threshold parameter. Nowhere in a logistic regression model is there tuning for thresholds. Can you work around it, build in a threshold, and perhaps get awesome results? Sure. But it is no longer a logistic regression model with the normal interpretability. You can't look at odds, you can't look at odds ratios, etc in the parametric form. Finally, at the end when it comes time to interpret the model you have lost the interpretability of a coefficient, what a significant coefficient is defined as/means, etc.
Comment: choosing a threshold that isn't 0.5 completely voids the purpose of a probabilistic LR model; doing this you completely break the chain of assumptions that allow you to do things like the "standard" statistical tests, model GOF tests, etc. They are not valid when you select a threshold that is not in line with the model as a threshold is not a free parameter for logistic regression.


Freezer warmed to -6C. Safe to eat the food?

Question: My freezer recently warmed to -6 degrees Centigrade during a long power outage from its usual -18C. It's now on its super freeze cycle and cooling back down again. Is the food inside still safe to eat? -6 is obviously less than zero, the freezing point of water, but I've heard that food in a freezer can go bad even below 0. Is this true?
Comment: -6C is still freezing, you should be good.
Comment: how long was it at that temperature?
Comment: @KateGregory: Not for very long. It's kept inside our utility room which is at about +15C therefore it would have kept on warming had the power not come back on then [i.e. -6C was not close to ambient temperature outside of the freezer]. I would therefore hazard a guess at under half an hour at that temperature. Thanks for the edit and help by the way :)
Comment: "*I've heard that food in a freezer can go bad even below 0*" Yes, bacteria are still multiplying, just slower. At -18, it's deemed safe indefinitely (source: EU and USA government websites) with a tolerance of 3°C (source: EU legislation). Above that, it will spoil, just much much slower than at room temperature. According to the [star rating](https://www.smeg-service.co.uk/support/knowledgebase/article/2711/x) system, -6°C keeps "three or four days" and -12°C "fifteen to twenty days". Why -18°C is said to be three months is beyond me though, so these probably err on the side of caution.
Comment: Note that these are cumulative times. If your food spent 3 days at -6°C (where 4 days at -6°C is considered safe), then storing it at -12 will only be good for another ¼ of those "fifteen to twenty days" i.e. up to 5 more days (if those values are to be taken literally, which I doubt; it's about the concept). As an example, let's say 20 bacteria is the allowance and at -6°C they double every day (2× per day) whereas at -12 they multiply by 1.25× per day, then you can count out at which point 1 bacterium turns into 20.
Answer: In your question, does "go bad" mean food quality or food safety?
As for safety, you were nowhere near the "danger zone" either temperature-wise or time-wise.
Initially safe, properly stored, frozen food that warms to -6C (or 22 F) for 30 minutes will not render it unsafe to eat.
In terms of food quality, freezers (most of which these days are self-defrosting), go through temperature cycles regularly.  The problem with this is not food safety, but the accumulation of ice crystals in foods, which degrades quality.  Freezer burn is the extreme example.  Of course, attention to packaging (vacuum sealing, for example) helps.
Comment: I was talking very much about food safety. In this house we live by "Will it kill me?" rather than best-before dates :) I'm glad to know that it should still be good. Thank you all very much.
Comment: "*freezers (most of which these days are self-defrosting), go through temperature cycles regularly*" Just to note: if **items in your freezer ever reach -10°C** or higher under normal conditions (not when you just filled the freezer with lots of new stuff or opened the door for a long time, for example), this is definitely **not a normal defrost cycle.** It should not heat up the air by more than 1-2°C, if that, due to the air circulation fan turning off while the evaporator coils are being heated. (Source: mechanic that came over and confirmed our freezer is broken within warranty.)


Disable Keyboard Shortcut key Super + num on lubuntu 19.04

Question: I've just switched to using Lubuntu 19.04 and I am having problems getting keyboard shortcuts working how I like. I have assigned Super+n to switch desktops. However the new setting doesn't take effect. There is some other behaviour overriding my settings which causes Super+n to cycle between application groups. I can't find the settings to change this anywhere.
Answer: Don't use the Super key as the sole modifier key. Use Alt+Super or Ctrl+Super. So, in your case, use something like Ctrl+Super+1, Ctrl+Super+2, etc to switch desktops.
The reason seems to be that in Lubuntu 19.04, the Super key is used by LXQt differently than in previous Lubuntu versions.

... but in 19.04+, you'll run into conflicts with lxqt-globalkeys using
  the key to open the menu, so either disable that, reconfigure that, or
  use something other than the Windows key here.

Source: https://discourse.lubuntu.me/t/how-to-snap-windows/247/4

If you're interested in window snapping, see Lubuntu 19.10: How to tile windows? The window tiling section is missing in lxqt-rc.xml.
Comment: Thanks for the info, but I'm not sure if this is exactly the same issue. I switched to cinnamon desktop and removed lxqt, but the problem persists. For now I am using Super+Fn instead, but I would still like to figure out what is hogging Super+n and how I can control that.


How do you know when the first compound is completely distilled and how do you know when the next compound starts

Question: Did a distillation between two solvents. Would the answer have to do with temperature?
Comment: You could improve this question *a lot* by asking it properly, that might actually get you even *better* answers.
Answer: There is no such point when the first solvent is completely distilled and then the next one starts. From the very beginning, both solvents boil together, though the vapor initially is relatively enriched with the lower-boiling one. The cutoff point is set somewhat arbitrarily. And yes, the answer surely has something to do with temperature, because temperature is the only parameter we can control.
Like NotNicolaou said, if the boiling points of your solvents are reasonably far away, you may separate the mixture almost completely by collecting the fraction that distills near the boiling point of the low-boiling one. Otherwise, you might not be able to get pure compounds, unless you use an industrial rectification column.
Answer: The answer would depend upon how different the boiling points of the two solvents were.
If the boiling points were completely different, say one component boiling at 40 °C and the other at 250 °C, then heating the mixture to 40 °C would remove all of the component boiling at that temperature, leaving the 250 °C boiling component behind. This the principle of a rotary evaporator, with the high boiling component often being the product of a chemical reaction.
If the boiling points are similar, say 70 °C and 80 °C, then it can be harder to get complete separation. Often in these cases, three 'fractions' are obtained: clean 70 °C material, clean 80 °C material, and a small amount of a mixture which distills off between the two. In this case, a fractionating column (such as a vigreux column) can be used, to get better separation. The boiling point of the distillate can always be measured, as an internal thermometer is often used and as such its possible to see whether the boiling point of the distillate is cleanly 70 °C, cleanly 80 °C or some in-between number (indicating a mixture is being distilled).
Its also worth noting that many solvents form azeotropes with water, and in these cases (such as benzene and water) it is not possible to cleanly distill the two components apart despite the different boiling points, since the mixture has a defined boiling point which is neither that of benzene nor that of water.


Is my realative clause "for which" used correctly in this sentence?

Question: I wanted to say that the material that was used to store documents were made of animals' bones and skins in Shang Dynasty. This is my sentence: "Bamboo strips books were invented as a replacement for the materials that stored documents for which they were made by animals' bones and skins". Thank you very much, guys,
Answer: Let's start with how I'd write the sentence (which is but one of many ways):

Bamboo-strip books were invented to replace materials that traditionally stored information: animal bones and skin.

Working with your original sentence, you could say:

Bamboo-strip books were invented as a replacement for the materials that stored documents, which were animal bone and skin.

You're not setting off a clause as much as you are using a pronoun.  "Which" being a pronoun referring to "materials."
"For which" is inappropriate here because it is used to set off a clause.  Using an example from the above linked reference, "it was a crisis for which he was totally unprepared."  The clause "he was totally unprepared," can stand alone.  Your oringinal sentence could have had the clause, "they were made [using] animal bones and skin," but to keep this clause (which may have used "for which...") would require a very complicated sentence.
Comment: Thank you so much, sir. I really appreciate your explanation. But what I meant in this sentence was the traditional materials were made from animal bone and skin, not the documents. So, how do I use which in that situation? Thank you.
Comment: Either of the examples I gave solve your problem.  "Which" is a pronoun for "materials," not "documents."  We know this because we're talking about the materials.  Bamboo strips replaced materials which were bone and skin.  "That stored documents" is an adjective phrase describing "materials."


What determines how long you meditate for?

Question: I just unlocked Meditation in Glitch, and I'm having trouble understanding how it works. It seems that I've been able to meditate from 1 second to around 10 seconds. Is the time random? Or is there something I'm missing?
Comment: Good question. I try to find a quiet place with no one around, but that doesn't seem to help.
Answer: Your meditation duration appears to be random, but it increases based on your Meditation skill. How many people there are nearby doesn't appear to affect it.
Comment: and rainbows mean you did it for max duration!
Answer: The amount of time you will keep the mediation going is random except that you can't hit your keyboard or try to do anything with your Glitch while meditating. You can look through your bags and organize things though, just don't try to chop, make anything, or harvest anything while meditating or you will lose it. Gaining meditation skills will increase your ability to meditate (minute plus even), and allow you to focus meditating on increasing mood or energy, as well as 'levitating', which lets you jump higher and better for a little while. Imagined Levitation is the only kind of mediation that you actually should be trying to move your Glitch for.
Comment: How can I shoot you an e-mail if you don't provide any?
Comment: ? I am not sure what you are referring to...
Comment: @Kateky: You have no email nor a website but I would send you an e-mail anyway.
Comment: I'm not sure what is wrong with my profile, my work email and twitter (website) should be there. You can get in touch with me at email@example.com
Comment: No, no e-mail no website. Can you see my website in my profile? I believe the e-mail is hidden. BTW. I've a photo on my website, too. I hope you like it like your own photo!?


What is a word for bringing together fragmented pieces of a whole?

Question: Is there an English word for the act of or the output of bringing together distinct but connected pieces to make a whole? I am working on a theory of anonymized digital connectivity where a complete picture of who we are can be built from the behavioral clues we provide across the digital ecosystem and I need a word to help illustrate the higher-level concept and to help focus the way I explain my work. "Mosaic" is the closest I've been able to get.
Comment: I think we'd need a very precise example context sentence ***and*** full explanation of the sought meaning. But words like ***integrate*** and ***consolidate*** come to mind.
Comment: Are you after a noun or a verb?
Comment: Bringing together **fragmented** pieces of a whole is **re**assembling (or similar). The whole has bee fragmented. Bringing together distinct but connected pieces to create ("make") a whole is assembling (or similar). Your question is unclear because its title doesn't match its first sentence.
Answer: Compilation works for both process and result:

compilation [noun]

the action or process of producing something, especially a list or book, by assembling information collected from other sources.

great care has been taken in the compilation of this guidebook

a thing, especially a book, record, or broadcast programme, that is put together by assembling previously separate items.

[Oxford Languages; courtesy of Google]
The verbal form piece together is common in everyday English, prabably neither too formal nor informal. Merriam-Webster regards it as a multi-word verb:

piece together [phrasal verb]:
(1) to make (something) by bringing together various parts or pieces

She pieced the quilt together from scraps of old cloth.

(2) to bring together (various parts or pieces) to form one complete
thing

The police had to piece together reports from several witnesses to get an accurate account of what happened.
Answer: Defragment.

to reorganize separated fragments of related data on (a computer disk) into a contiguous arrangement -M-W

Usually used for data "on a computer disk" as in the above definition, but can be extended with some freedom to your multi-faced pieces of data.
Answer: Therer exists a family of words that applies generally enough to this idea.

(SOED) conflate v.t.
2  Put together; compose; bring about
(3 Combine, blend (two things, esp. two variant texts, etc.) into one)

(SOED) conflate a.
Put together from various elements. Now spec. formed by fusion of two textual readings.

(SOED) conflation n.
The action or process of CONFLATE v.; the result of conflating, esp. a composite textual reading.
Comment: Note that "conflate" also has the definition of _failing_ to keep things separate, as in "You are conflating apples and oranges."
Comment: @isanae I see in Merriam-Webster that it is even used nowadays to mean "to confuse" (b: **confuse** Given its name, St. Thomas in Houston has on occasion been conflated with St. Thomas in Minnesota …. ).  I do not find this meaning in British dictionaries. In fact it originated in the US quite recently (2003), but there,  it has not been widely accepted yet (https://archives.cjr.org/language_corner/language_corner_020915.php).
Comment: I'm not a native speaker, so my English is a mishmash of different dialects. Before reading your post, that definition was the only one I was aware of. Not sure how that happened.
Answer: Coalesce is a concise and somewhat poetic word for this. It is used frequently to describe smaller bits joining up with each other to produce a larger whole, often spontaneously, though that's not required.
Answer: There are actually a vast number of words, phases, and metaphors for this, with different connotations. It would probably foolish to try to list them all.
All quoted definitions from Merriam-Webster. In each section I've listed terms in decreasing order of applicability, based purely on my opinion. I've also skipped words that appeared in other answers at the time of writing.
Specific to your situation
Reidentification refers specifically to determining the identity of a person from diverse pieces of individually non-identifying information. The verb is "reidentify," defined as "to identify (someone or something) again," but it has been given this more specific technical meaning in the privacy literature.
De-anonymization is a synonym of reidentification that does not have the other possible meanings of "reidentification." I didn't find it in Merriam-Webster, but it is used commonly in the field of privacy. See, for example, [1] [2].
Doxing or doxxing is still extremely informal internet slang, but becoming more widely used. Merriam-Webster defines "dox" as "to publicly identify or publish private information about (someone) especially as a form of punishment or revenge." However, it has also been used to refer to the process of determining a person's identity from putatively anonymous information, rather than on the disclosure. For example, Google has 9000 hits for the phrase "I don't want to dox myself," meaning "I don't want to disclose information that would make it possible to determine my identity." Use with caution due to the strong negative connotations.
General terms
Reassemble means "to assemble (something) again : to bring or put together the parts of (something) again."
Reconstruct has several related meanings:

1 a: to build or assemble (something) again

2 a : to re-create or reimagine (something from the past) especially by using information acquired through research

2 b : to create an accurate reenactment or understanding of (a past occurrence or event, such as an accident) by applying scientific principles and techniques to physical evidence

Synthesis means "the composition or combination of parts or elements so as to form a whole" and can be used for information.
Detective work or sleuthing means gathering clues from different sources to determine the truth, but emphasizes the search for clues rather than their assembly.
Metaphors
Jigsaw puzzle is probably the most common, and most on-point, metaphor for this.
Collage, mosaic, and patchwork are all art forms that involve making a unified whole out of small parts. However, in these art forms, you are generally making a new thing, rather than trying to rebuild an old one.
A scrapbooker is "a hobbyist who creates scrapbooks of photographs, clippings, journal entries, etc., typically as a way to preserve personal experiences and memories." While scrapbook is a good metaphor for the collection of personal information you're describing, the word scrapbooking focuses very strongly on the collection and preservation of things rather than on deduction of someone's identity from them.
[1] Su et al., "De-anonymizing Web Browsing Data with Social Networks," https://www.cs.princeton.edu/~arvindn/publications/browsing-history-deanonymization.pdf
[2] Narayanan and Shmatikov, "Robust De-anonymization of Large Sparse Datasets," https://www.cs.utexas.edu/~shmat/shmat_oak08netflix.pdf
Answer: Reassemble. I realize this word has already been submitted, but I strongly feel as if it succinctly conveys the intended meaning.


Why do my 'small' images appear poor quality and of low resolution when they aren't

Question: I am trying to figure out the optimal size for the 'small' images (the one that will appear on a category page) but no matter what size or resolution I make them, they appear as low resolution - I have tried them from as high as 2000 x 2000 px - down to 250 x 250 px and they are always saved as optimized for web through Photoshop
Comment: To add to Fabian Schmenglers answer, depending on your theme you may also have a css height & width on the img tag, which may distort the image.
Answer: All images in the frontend are automatically resized based on theme settings. The sizes are defined in etc/view.xml of the theme and are different for various areas, like the category grid.
For example: luma/etc/view.xml
<image id="category_page_grid-1" type="small_image">
    <width>240</width>
    <height>300</height>
</image>


Allow voting for new members on their own questions

Question: Users with less than 15 reputation make up about 40% of users on SO.  Users with less than 15 rep cannot vote at all, even on their own questions and thus can only reward a single answerer   - by accepting an answer - even on their own questions.  I propose that all users be able to vote on their own questions.  We've already seen one case where a user explicitly avoided questions by users with low reputation.  This would help solve this problem by allowing even new users to acknowledge helpful answers by awarding reputation to all that are helpful.
Comment: tvanfosson: "We've already seen one case where a user explicitly avoided questions by users with reputation = 1." link?
Comment: @Mehrdad -- added link
Answer: If a person asks a question with 3 upvotes they will be able to vote on the answers to their questions. If a person asks a question that does not receive upvotes, I'm not sure how important it is for them to be able to upvote. Additionally, it might make it easier to setup shell accounts to gain rep.
Comment: Yes, my concern would be shell accounts. Although it's already exploitable because of the down vote bug. I register an account, ask a question (account has 1 rep). I use my main to down vote, then up vote (1 + 2 + 10 = 13 rep). I use the shell to accept the answer (+2 = 15 rep), I up vote my main account. In a few seconds I gained +25 rep on my main, and now have a shell that can up vote as it wishes.
Comment: +1 Agreed and Agreed. The limit is there for a reason. It also means 40% of users has most likely only asked one question and never returned again.
Comment: However, due to the general lack of question voting as discussed at http://meta.stackexchange.com/questions/9508/stackoverflow-why-arent-people-rating-questions very few new questions get upvoted.
Comment: @Joel, that question was recently migrated here to meta, but it was originally asked over a year ago. I believe since then the situation has improved some. And regardless, two upvotes is not that many to get on a question or questions and does make it harder (if only slightly) to setup and use shell accounts for the purposes of voting fraud.


Is there a way to import a script from Celtx into Final Draft?

Question: Is there a way to import a script from Celtx into Final Draft? Going to switch and it seems as though my script is "locked" into Celtx's format. I'm hoping this is possible and that there isn't a huge typing project in my future. Thanks.
Answer: Final Draft will open a text file exported from Celtx and give you the option of converting it to standard formatting for a screenplay.
Quite detailed instructions are given in the Final Draft support forum
Comment: Thanks so much! This will make my transition to Final Draft easier. Appreciate it.


Fusion inside a planet with high concentration of radioactive elements?

Question: If an Earth-sized or larger planet had sufficiently large amounts of radium, thorium or uranium, couldn't the resulting fission trigger periodic fusion of hydrogen? I'm thinking of fission happening at great depths and high pressure, with some hydrogen-containing material nearby to the radioactive elements.
Comment: Why would fission events trigger fusion of hydrogen?
Comment: @Richard Paterson Is your question is something like would the energy created by nuclear fission of Ra etc would cause fusion of hydrogen(by enabling H atoms to get past the coloumb potential barrier)?
Comment: @JonCuster possibly connected to A-bomb as initiators of H-bombs but I don't get the question.
Comment: @Mockingbird Yes, that's what I was thinking. Perhaps in a rocky planet with more heavy radioactive elements, that sank toward the core and became concentrated.
Comment: @Jon Custer As ZeroThe Hero alluded to, the H-bombs designed by Teller and Ulam in the United States used fission bombs in some way to compress and heat up the fusion elements.
Answer: First of all, there will certainly occur (very) few fusion reactions, as you always have some particles in the tail of a Maxwellian that have the correct energy.
Speaking, however, of a burning plasma, like our sun, that is not going to happen. To achieve a burning plasma (self-sustained in that sense that all energy required to achieve fusion is delivered by the fusion reaction itself), you need to basically fulfill the Lawson criterion: you need enough particles (density) with enough energy (temperature) and that for a sufficient time (confinement time).
The sun is doing that mostly with a very high density (due to the gravity). On earth, the most promising fusion approach seems to be to achieve high temperatures instead (magnetic confinement fusion).
As you asked about fusion in a planet's core, let's use the sun's analogy: a huge mass is required for the gravitational pressure needed to have a burning (in the sense of self-sustained fusion) core. What is the heaviest planet in the solar system? That is Jupiter. Still, the mass and the resulting gravitational pressure is too low. As is turns out, though, if Jupiter would be heavier by approximately 1 order of magnitude, see here, its core would "ignite" (and it would be called a brown dwarf).
So, if you asked about the occasional fusion reaction (where a fission reaction might be helpful for some initial heating), that might happen; the transition into a burning plasma will certainly not happen.


What would happened if two transactions have the same hash?

Question: What would happened if two transactions have the same hash?
Would it make the Unspent Transaction Outputs(UTXO) in the old transaction not spendable?
I think it would make the outputs in the new transaction spendable and the outputs in the old transaction not spendable.
Comment: As [eponymous's comment](https://bitcoin.stackexchange.com/questions/74537/why-there-is-no-block-index-or-block-height-included-in-the-block-header):"All blocks after 2012 contain the height in the block's coinbase transaction". It is difficult to create a new coinbase transaction with duplicate hashes because the height is included in the coinbase transaction.
Comment: Also read:[Can the outputs of transactions with duplicate hashes be spent?](https://bitcoin.stackexchange.com/questions/11999/can-the-outputs-of-transactions-with-duplicate-hashes-be-spent) and [Two blocks, two transactions, same hash](https://bitcoin.stackexchange.com/questions/3030/two-blocks-two-transactions-same-hash)
Answer: Per BIP 30, transactions are not allowed to have the same TXID as another transaction which has unspent outputs.
This means that there can be transactions that have the same TXID, but only after the first transaction's outputs are already spent. So in this case, the duplicate TXID does not matter.
For transactions that do have duplicated TXIDs (there are a few of them), only the most recent of those transactions can have its outputs spent. The earlier transactions with the same TXID cannot be spent from and their Bitcoin are lost forever.
Comment: `getrawtransaction` will return the same thing because the duplicate txid transactions are literally the same transaction (everything about them is the same except for the block that they are a part of). it will only return data for the most recent of the duplicates.
Comment: No, the new transaction will be rejected entirely for having a duplicate txid. There are just special cases for the few duplicate txid transactions that occurred before BIP 30's introduction.
Comment: I was about to answer the question, but I was not sure about some details. Does that means that if the old transaction has unspent outputs, all will be evicted from the UTXO set, and the new ones will be included?
Comment: Moreover, will that `getrawtransaction` will return more than one result?
Comment: Note that disckjet's examples predate BIP30's activation. In the current consensus rules, such a duplicate txid wouldn't be permitted anymore. Also note that it isn't a case of an actual collision; just the same transaction issued twice.


12.04 - Screen glitches / freezes after "Lock Screen"

Question: Ubuntu 12.04, 3.5.0-36-generic kernel through LTS Hardware Enablement stack. HD4600 GPU on top of an Intel Core i7-4770.
When I use the "Lock Screen" feature of the desktop, sometimes I will go back to the machine hours later and will see one of the following two glitches:

the screen is mostly black with a bunch of glitchy graphics on it. I can still move the mouse, can't click on anything though, and nothing happens.
the system looks unlocked (and if I remember correctly, the monitor is on). Whatever was on the screen before the lock is now fully visible, although you can't click on anything. This has showed my email inbox contents to the rest of the office more than once.

The OS hasn't actually frozen at this point. I usually open a TTY with (CTRL+ALT+F1) and run:
sudo stop lightdm
sudo start lightdm

and am able to resume work, even though all of the processes open before (like Firefox, skype etc) seem to be gone.
First of all, is this an known issue and can I fix it?
Secondly, is there a log somewhere I could look at to see what the specific issue is? /var/log/lightdm didn't reveal much, but I might have been looking in the wrong place.
Any suggestions would be super welcome.
Workaround I stumbled upon: If someone else is running into this issue, there's no reason to reboot the machine when it happens. I think switching to a virtual tty with ALT+CTRL+F1 and then back to ALT+CTRL+F7 seems to fix the problem. Even better, you can avoid it altogether by locking the screen in X and then switching to tty1 when you want to leave the machine alone for some time. Switch back to X when you're back. Hasn't glitched out on me yet, probably because it forces some kind of "full refresh" every time you do it.
Answer: Edit: I wrote a script that works around it by detecting the screen state and automatically switching virtual terminals (same as a manual Ctrl+Alt+F-key sequence) at the right time. Try it out and let me know if it works. I don't use lightdm but maybe we can figure out a way to patch it in. You can get it on GitHub and follow the instructions to use it:
https://github.com/appleYaks/switcher

Old method: only works on laptop lid close.
If you're on a laptop, you can make the machine switch ttys automatically when you close and open the lid. This is how I fixed it. I'm not running Ubuntu, so YMMV:
Edit the file /etc/acpi/lid.sh and put the commands chvt 1 and chvt 7 in the right places.
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
    . /usr/share/acpi-support/screenblank

    # this is the line we add to switch to tty1
    # when the laptop lid closes
    chvt 1

    if [ x$LID_SLEEP = xtrue ]; then
        pm-suspend
    fi
else
    # this is the other part of the pair,
    # that switches back to tty7 when the lid opens again
    chvt 7

Those two lines with chvt are the only changes to the file. I haven't yet found a way to fix it when the screen shuts off when idle, but I'm happy with this for now.
Answer: Strange that you have issue with graphics normally it works out of the box without any issues. Install Intel Graphical Driver Installer and see if it helps
https://01.org/linuxgraphics/downloads/2013/intelr-linux-graphics-installer-version-1.0.1
Comment: Is 12.04 an option? It sounds like you'd need 13.04 for that driver to work.
Comment: My bad forgot that you were using 12.04


CA DMV: What happens once my temporary license expires?

Question: I have a valid Indian Driving License. I went to the DMV and gave the written and they gave me a 60 day temporary license and asked me to give the behind the wheel driving test before it expires. Unfortunately, I could not clear the test and now my license is about to expire. What happens now? Do I again have to give the written test or can I extend my temporary license?
Comment: Are you a resident in California?  It'll make a difference.
Comment: He must be a resident, otherwise he wouldn't have been given a temporary license
Answer: As someone that had first-hand experience of this (ie, I did exactly the same thing!) I can tell you that it's fairly simple.
Once your temporary license expired you are "unlicensed" - you will have been in the state long enough that technically your home-country license is no longer valid in California, and your California license is expired.
Thankfully there's a simple solution - just go into the DMV, let them know what happened, and they will give you a new temporary license for another 60 days.  No further written test required.
I'm sure if you do this too many times they will eventually take issue with it, but I had no problems doing it once.
When you come to do the driving test you'll likely find it very easy.  They seem to go easy on people who have had their license in a foreign country - I didn't even have to do a reverse park as a part of mine despite that being a mandatory part.
Comment: "I could not clear the test" - I imagine he means he couldn't pass it...
Comment: What is the required document to bring? Also is there a reference link to the official documentation?
Answer: If you're visiting or a resident, it'll differ.
From the DMV page, if you're a visitor:

If you are a visitor in California over 18 and have a valid driver
  license from your home state or country, you may drive in this state
  without getting a California driver license as long as your home state
  license remains valid.

If you're becoming a resident, however:

If you become a California resident, you must get a California driver
  license within 10 days.

If you have a license from another country, you will be required to take a driving test, for which you have three chances to pass.  If you fail three times, you do not meet their criteria to receive a drivers' license 'transfer' from another country, and as such will not be issued a license.
At this point, you'll have to speak to the DMV about what happens next.  Likely it'll consist of getting some driving lessons and reapplying, but you may find you're not allowed to legally drive until you've completed these steps.


Difference between Vernier constant and least count

Question: What is the difference between the Vernier constant and least count of a Vernier caliper?
Comment: There is no difference.
Comment: Can you please explain the reason?
Answer: Vernier Constant: it is the ratio of smallest division of main scale to the number of divisions of vernier scale.
Least Count: the smallest possible measure that any instrument can do accurately is known as least count.
Answer: Vernier constant is the difference between the smallest division of main scale and that of vernier scale. When we multiply the vernier constant with the count of one division of main scale we get least count of the vernier caliper.
Answer: The quantity represents the difference between the size of the smallest division on the main scale and the size of one Vernier divisions.This
quantity $(S-V)$ is called the Vernier Constant.
Answer: I think vernier constant is only the least count of vernier callipers while least count can be of any instrument
Comment: This is more a comment level statement


How can I quit my job before my 6 month probation and before my 2 years service and jump ship without getting the dubai ban?

Question: If I jump ship for a higher salary before my 6 month probation or better yet; before my 2 years of service at my current employer; I have heard I will be banned for 6 months to work. Apparently you can pay or do something to address this?
Comment: @littleadv A ban from Dubai?
Comment: Is this in the UK? What is "dubai ban"?
Comment: Instead of editing my answer, please add your information as a new answer. You can then accept your answer.
Answer: I cannot find much information about immigration to the UAE. The official webpage with the relevant information might be http://dnrd.ae/en/Rules_Reg/Pages/Rules.aspx?AudianceId=3, but it looks sketchy for an official government webpage. This random webapge has a lot of information about the visa ban. I think the relevant section for you is

It is possible to avoid a ban/ lift a ban by paying a fee, in case you are transferring from one sponsor to another. This is different from cancelling your residence visa or work permit. It is not clear if a NOC (No Objection Certificate) from employer is necessary for processing this. However, for exact details of ban lifting fee (which may vary depending on certain occupations), it is better to check with the labour department helpline of the emirate you are working in.
Comment: I have heard that certain salaries and people with higher certifications such as UK attested degree holders may skip the ban. The ban seems to be for all the Indian, Pakistan and Filipino workers; like construction trades.
Comment: @TheBlackBenzKid it sounds like there are lots of "unofficial rules" and the only thing helpful in my answer is really "check with the labour department helpline of the emirate you are working in"
Comment: That is Dubai for you man! I love this place!
Comment: A ban which restricts new migrants to one employer, a government-enforced fine enforcing the ban, I can only imagine what that system does to the social and economic position of the migrants. Pity on them.
Comment: @FreekWiekmeijer In the UK [changing employers on a Tier 2](https://www.gov.uk/tier-2-general/extend-your-visa) requires paying a £650 fee so I I don't think the behaviour is particularly rare.


my airlock is not bubbling after 4 days on the secondary fermenter in a carboy.

Question: Im brewing a belgian wit and have not seen any action after putting it in the secondary fermented in the airlock. The hydrometor showed after the first fermentation a 1.12. Should I leave it alone or take another reading?
Answer: I would leave it alone. It sounds like you may have reached final gravity for the style. I very rarely see activity on my secondary vessels, and it is a good idea to not rack to secondary until fermentation is complete. Secondary is not as important for fermentation, instead it is time for the beer to have more time to clear out and flavors to meld together into a delicious brew. I recommend letting it sit a week, and take gravity readings the last 2-3 days of that. If there is no change you are good to keg/bottle.
Comment: Good simple answer.  I agree the beer was probably done after primary and you don't expect to see much activity in secondary.  The idea of a secondary FERMENT, is a misleading misnomer for the novice brewer.
Answer: Secondary "fermentation" is a misnomer.  It's more for clarifying and conditioning beer.  AAMOF, most experts these days recommend skipping secondary altogether unless you have a specific reason for it...a high OG beer that needs conditioning, adding fruit or dry hops to a beer.  In general you're better off just leaving the beer in primary for 3-4 weeks.
Answer: Relax, don't worry, have a homebrew.


matching image in plane/mask to video footage

Question: I recently watched Ian Hubert's lightsaber tutorial.  About midway through, he discusses using a plane with an emission material and a clean plate image (as the color) to animate the lightsaber ignition.
I played around with a couple of different videos I had, and in each case, the plane was clearly visible in the render and did not blend well with the underlying video footage.
I ended up finding another tutorial that shows how to make a phone appear to levitate through the use of a mask and clean plate image.  I tried this approach as well, but again the mask was clearly distinct from the rest of the video.
I know some steps can be taken to try and minimize the issue--having footage where the lighting/brightness doesn't vary; limiting the number of frames where the clean plate is shown; using compositor nodes to make the mask less sharp; etc. But it still seems like I'm missing something.
As a last resort, I tried an experiment.  Instead of using video footage I had shot, I used screen recording software to capture a video of a simple setup in MS Paint.  I created a large blue rectangle with a small, thin yellow rectangle inside it.  I used a still image of just the blue rectangle as my clean plate.  However, after trying both tutorial methods, I was again left with a noticeably visible plane/mask.
Here is a frame render of the experiment using the mask method (I animated the mask moving to cover up the yellow rectangle, but the mask was distinct throughout).
Does anyone know what I might be doing wrong?  Can anyone replicate the tutorials more or less cleanly?  I'm stumped.
Thanks in advance.
Answer: Try changing the color management :

Blender uses Filmic by default but this will change how your footage color are rendered so you should use Standard for projects involving video footage :

The difference between the two is subtle but when you put them on top of each other, it's quite noticeable :
Filmic

Standard


weakest topology so that space of riemannian metrics is open in space of symmetric tensors

Question: Let $M$ be a smooth n-dim manifold.  Then on any local chart we can write a symmetric tensor as a symmetric $n \times n$ matrix with the entries being smooth functions on $\mathbb R^n$.  The space of Riemannian metrics is the space of matrices that are invertible. What is the weakest endowment of a topological vector space structure on $\Gamma(M,T_{2,0}M)$ that is weaker than te $C^\infty(M,T_{2,0}M)$ topology, that makes the space of Riemannian metrics open in the space of symmetric tensors(given the subspace topology)?
Comment: You probably want to specify a bit more on the topology, for example that it turns $T^*M$ into a topological vector space. Otherwise I would also not see how a topology on $T^*M$ induces one on the tensor of $T*M$ with itself. The weakest topology on the symmetric tensors that makes the Riemannian metrics open is the topology with 4 open sets: The symmetric tensors, the empty set, the Riemannian metrics and its complement.
Comment: Thanks.  I edited the question.
Answer: A good candidate for such a topology is the natural analog of the topology of the product topology i.e. the topology of point-wise convergence. This means that for each $x\in M$, you take the evaluation map $\Gamma(M,T_{2,0}M)\to S^2T^*_xM$ (where the target is just the fiber over $x$ of $T_{2,0}M$). Then take the initial topology with respect to these maps. Hence a basis for the open subsets in $\Gamma(M,T_{2,0}M)$ would be of the form $\{s\in\Gamma(M,T_{2,0}M):s(x_i)\in U_i \forall i=1,\dots,k\}$ where $x_i\in M$ are points and for each $i$, $U_i$ is an open subset in $S^2T^*_{x_i}M$. I think it is rather easy to see that this defines a topological vector space structure and that Riemannian metrics form an open subset. I am not sure whether it indeed is the weakest such topology.


Slang words which came into English from other languages?

Question: Are there such modern slang words in British or American versions of the English language which came from other foreign languages?
Answer: Lots:  Slang tends to be very local to particular groups, so where languages interact you get slang.
Any summary will miss out more words than it includes, however you get Spanish phrases, like "Hasta la vista" in American English.
On the other hand you have borrowing from Hindi such as "pukka" (meaning "just right") in Southern English slang. There are quite a few slang terms from Romani (the language of the Roma "gypsies") like "cushty" and "wonga".


If power lines are properly insulated, why do we see sparks/arcs in videos these days?

Question: I saw a video where power lines touched due to high speed air and created huge arcs. In another video, a person throws a wire in air, it touches a wire and he gets shocked. Also it is said that birds are not electrocuted because they do not short +ve and -ve wires. Why shouldn't the answer be power lines are insulated by rubber?
Comment: Powerlines in the air are not insulated. If hung properly they shouldn't be able to touch. In really heavy rain and wind you might be able to see some arcs and sparks between the wires, but that is not supposed to happen.
Comment: Power lines are meant to be up for decades.   No coating material (invented decades ago) could stand up to weathering for nearly that long.  So the logical conclusion would be to design the grid such that wires don't need insulation.   And of course  $$$ which really drives most decisions
Comment: You'd need twice as many poles. Expensive. Everything is money.
Comment: @Jeroen3 you mean wires are not insulated?
Comment: to stay exact the air is the insulator. Without it the electrons could jump between the wires. Vacuum tubes are based on that phenomena.
Comment: @PeterKarlsen Post it as an answer?
Comment: @KyleB I got everyone's point. Actually I till date believed all wires are insulated properly as the wires entering our homes are insulated. Now I got to know that most wires are not insulated.
Comment: @BhavyaGupta insulation has weight.
Answer: Powerlines in the air are not insulated.
If hung properly they shouldn't be able to touch.
In really heavy rain and wind you might be able to see some arcs and sparks between the wires, but that is not supposed to happen.
Answer: High voltage (>1KV) overhead lines are nearly always bare wire. Instead insulation is achieved through spacing of the wires and mounting them on insulated supports. This works fine most of the time, but sometimes either support structures break or high winds cause problems by either blowing wires into each other or blowing other stuff onto the wires.
Insulating a HV line is more complicated than just slapping a bit of plastic or rubber on, at high voltages controlling field strengths becomes very important. Insulated HV wires used underground often have multiple layers including a layer of earthed metal and then inside that a "semi-conductive layer" to control field strength. However having earthed metal close to a HV conductor means more capacitive losses.
Low voltage (<1KV) overhead lines were also historically often bare wire. At least in the UK this has fallen out of favor in recent years with new installations tending to use insulated conductors. There is still a lot of legacy bare wire LV overhead around though (and yes this does include service drops to peoples houses).
Comment: Are low-voltage overhead lines insulated *because* they're low-voltage? That sounds backwards: you'd think that lower voltage would mean less need for insulation.
Comment: Low voltage lines are usually more closely spaced, closer to the ground, closer to foliage and closer to peoples houses. As I understand it there are also less technical difficulties in insulating them.
Comment: low voltagew means less than 1000V it does not mean safe to touch.  Once while building a metal atructure I found a low voltage wire with my back, I was most glad for the insulation.


spin–orbit resonance, between moon and the earth

Question: if this happens in the future what will be the consecuences of this?.
Consecuences for the life or the climate conditions.
Comment: There already is a spin-orbit resonance between the Earth and the Moon. We only see one side of the Moon as a result.
Comment: What do you think would happen?
Comment: Doing some research is encouraged before asking questions here.   As pointed out above, the Moon is already in spin-orbit resonance with the Earth.   Many moons are around their planets and Mercury is around the sun.    Any close orbit usually ends up this way.    Are you asking what would happen if the Earth was in spin-orbit resonance with the Moon?   That probably won't happen.  It will take longer than the sun will live, but what theoretically might happen isn't hard to look up.
Comment: Maybe Im  not be sufficient clear. Im reffer in when the earth and moon have the same spin orbit-face, the same face the moon, and the same face earth to the moon.
Answer: It's not going to happen, but if it did, what it would mean is that the Earth would rotate very slowly, at the same rate the Moon orbits the Earth, currently 27.3 days, but for practical purposes, 29.5 days relative to the sun.   Presumably even longer, because as the Earth slows, the Moon moves further away, so figure 30-something days for 1 synodic orbit.   I'll say 30 days, but it would probably be a bit longer.
That means that a complete day/night cycle would be 720 hours.  Days might be scorching hot and nights would get very cold and as a result, you'd probably see stronger winds, but the Coriolis effect would be measurably decreased, so prevailing winds might be less, or perhaps similar to Venus, where the upper atmosphere rotates in one direction very fast.
You might see fewer hurricanes.  Snow would probably all melt during the day, so there would be less chance of permanent snow buildup outside of very cold regions that get very little solar energy during winter.  Plants would also need to adapt to 360 hours of sunlight and 360 hours of night.
There would be no more tides and it's possible that the Moon's orbit and the slowing of the Earth's relatively rapid rotation assists the magnetic field so we might lose the Magnetic field too - which would be pretty harmful to life in the long run.
The Moon would also stay in essentially the same place in the sky all the time.  That's a product of tidal locking.
That's the gist of it anyway, but feel free to comment if I skipped anything.
Comment: Your statement "a 24 hour day would be 720 hours" made me think for a few seconds (much longer than I'm used to). It might be clearer to say "a full day/night cycle would be 720 hours", or even use the word "nycthemeron" for "full day/night cycle".
Comment: @Jim421616 Edits made.  I think that's a little clearer.   Thanks.


How to document and test interfaces required of formal parameters in Python 2?

Question: To ask my very specific question I find I need quite a long introduction to motivate and explain it -- I promise there's a proper question at the end!
While reading part of a large Python codebase, sometimes one comes across code where the interface required of an argument is not obvious from "nearby" code in the same module or package.  As an example:
def make_factory(schema):
    entity = schema.get_entity()
    ...

There might be many "schemas" and "factories" that the code deals with, and "def get_entity()" might be quite common too (or perhaps the function doesn't call any methods on schema, but just passes it to another function).  So a quick grep isn't always helpful to find out more about what "schema" is (and the same goes for the return type).  Though "duck typing" is a nice feature of Python, sometimes the uncertainty in a reader's mind about the interface of arguments passed in as the "schema" gets in the way of quickly understanding the code (and the same goes for uncertainty about typical concrete classes that implement the interface).  Looking at the automated tests can help, but explicit documentation can be better because it's quicker to read.  Any such documentation is best when it can itself be tested so that it doesn't get out of date.
Doctests are one possible approach to solving this problem, but that's not what this question is about.
Python 3 has a "parameter annotations" feature (part of the function annotations feature, defined in PEP 3107).  The uses to which that feature might be put aren't defined by the language, but it can be used for this purpose.  That might look like this:
def make_factory(schema: "xml_schema"):
    ...

Here, "xml_schema" identifies a Python interface that the argument passed to this function should support.  Elsewhere there would be code that defines that interface in terms of attributes, methods & their argument signatures, etc. and code that allows introspection to verify whether particular objects provide an interface (perhaps implemented using something like zope.interface / zope.schema).  Note that this doesn't necessarily mean that the interface gets checked every time an argument is passed, nor that static analysis is done.  Rather, the motivation of defining the interface is to provide ways to write automated tests that verify that this documentation isn't out of date (they might be fairly generic tests so that you don't have to write a new test for each function that uses the parameters, or you might turn on run-time interface checking but only when you run your unit tests).  You can go further and annotate the interface of the return value, which I won't illustrate.
So, the question:
I want to do exactly that, but using Python 2 instead of Python 3.  Python 2 doesn't have the function annotations feature.  What's the "closest thing" in Python 2?  Clearly there is more than one way to do it, but I suspect there is one (relatively) obvious way to do it.
For extra points: name a library that implements the one obvious way.
Answer: Take a look at plac that uses annotations to define a command-line interface for a script. On Python 2.x it uses plac.annotations() decorator.
Answer: The closest thing is, I believe, an annotation library called PyAnno.
From the project webpage:
"The Pyanno annotations have two functions:

Provide a structured way to document Python code
Perform limited run-time checking "
Comment: That project provides ways to check types, not to document interfaces.  Also, it uses decorators that wrap the decorated function.  I'm not a priori opposed to use of decorators here, but if they're used for this purpose they should probably just mutate the decorated function object and then return it, rather than wrapping the decorated function in a new function -- otherwise, it's very intrusive for something that's just documentation and that may be used all over the codebase.


QFile.atEnd() returns TRUE too early

Question: I'm trying to read in a CSV file. My code is below. The problem I am having is that the first line of the file is read in, as expected, but once the while loop condition is reached again File.atEnd returns true. I've tried this with several files, some very large, and it still only reads the first line of the CSV file. I've stepped through with the debugger and cannot find a reason why this is so.
Running Win7 Pro (64-bit)
Qt v5.0.1 (32-bit)
QDesigner v2.6.2.
UPDATE: If I have a CSV file with a lot of columns than it seems to work out.
QFile File(strFileName);
File.open(QIODevice::ReadOnly | QIODevice::Text);

QTextStream FileStream(&File);

while( !File.atEnd() )
{
    QString strLine = FileStream.readLine();
    //Do some code here
}

File.close();

Example CSV file:
1,10,20
2,20,30
3,30,40

Answer: Try to change
while( !File.atEnd() )

to
while( !FileStream.atEnd() )

QFile.atEnd() returns TRUE too early


Utility to load .sys driver on Windows

Question: Is there any tool that I can use to load .sys driver. I just made hallo world driver from this tutorial
http://www.rohitab.com/discuss/topic/24166-windows-driver-development-tutorial/
but I don't know how to load it.
Cant find anything on google.
Comment: sc.exe, built into all recent versions of Windows.
Comment: CreateService() with the SERVICE_KERNEL_DRIVER option.
Comment: Yes, I found lot of code examples, but I need some kind of tool.
Comment: Hi, I built a howto on that topic: http://jtsoft.at/load-windows-driver/
Answer: You have two choices - You have sc.exe as Harry said in his comment, or you have the OSR Loader, which is what I personally use.
Keep in mind that, on Windows Vista/7 x64 you will need to use BCDEdit to enable TESTSIGNING (bcdedit -set TESTSIGNING on) in order to install your unsigned driver for development.
The program itself is pretty self explanatory.
Comment: x64 Windows prevents loading of unsigned drivers. The only way around it is disabling Patch Guard.
Comment: I am on Windows 7 x64 and I enabled `Test Signing`. But when I try to load my driver with OSR Loader I get an error message:  `this driver has been blocked from loading`
Any help?

Utility to load .sys driver on Windows


Entity Framework 5 Complex Types

Question: I'm all new to EF5 and I'm looking at Complex Types.
I can see why you would use Enum types with your EF Model, but I've also seen examples of where you can create you own complex type whereby your grouping multiple properties in a table under one complex type.
An example would be a table that contained properties such as:-

FirstName
LastName

You can define a complex type called Name, and these two properties can then be referenced like this:-

Name.FirstName
Name.LastName

My question is why would you do this and where do you get the benefits?
As I say, I'm new to EF5, so I'm just trying to get a better understanding of it.
Comment: duplicate : http://stackoverflow.com/questions/2659392/entity-framework-complex-type-vs-creating-new-entity
Comment: Its not quite a duplicate. The other question is asking about complex types vs. associations. This question is asking about complex types vs. separate properties. The answers will be different.
Answer: It's possibly not obvious with just a first name and last name, but consider something more complex like an address. You may need to pass addresses around the system and it is far easier to do if it is in a self-contained object.
You can also re-use complext types. So a good example of that is where you have a customer who has a delivery address and a billing address.
For example:
Comment: Thanks for your time with explaining this, brillant!

Entity Framework 5 Complex Types


jqPlot Resize Chart after AJAX call

Question: I am using a jqPlot to display a horizontal bar chart with the data in the yAxis being a dynamic number of points.  The data is being loaded using the AjaxDataRenderer.  Since the number of points on yAxis is dynamic, I need to change the height of jqPlot container div so the bars are the same size no matter what.  I need to change the height based on the data that comes back from the ajax call.
I have tested this by adding a click handler on a button to resize the chart contaniner div.  This works fine.  My question is how can I change the height after the ajax call returns but before the chart the rendered?
Answer: I had this kind of problem few weeks ago.
Check this related post, Boro exlpains how you can set a fix height and width of your graph.

jqPlot Resize Chart after AJAX call


Ruby XMLRPC pass keypair

Question: I have to interact with an XML-RPC server that uses key authentication.  Before accepting the request, the server verifies the key pair (ssl private key and ssl cert).  I understand this is terrible, but it's what I have to work with.
My question is this: is there an easy way to pass the key and certificate in this request?  I am using the xmlrpc/Client in Ruby, but the documentation does not seem to indicate this can be done.  My current code is as follows:
Error:

/usr/lib/ruby/1.8/net/http.rb:586:in connect': sslv3 alert handshake failure >(OpenSSL::SSL::SSLError)
         from /usr/lib/ruby/1.8/net/http.rb:586:inconnect'
         from /usr/lib/ruby/1.8/net/http.rb:553:in do_start'
         from /usr/lib/ruby/1.8/net/http.rb:542:instart'
         from /usr/lib/ruby/1.8/net/http.rb:1035:in request'
         from /usr/lib/ruby/1.8/net/http.rb:992:inpost2'
         from /usr/lib/ruby/1.8/xmlrpc/client.rb:535:in do_rpc'
         from /usr/lib/ruby/1.8/xmlrpc/client.rb:420:incall2'
         from /usr/lib/ruby/1.8/xmlrpc/client.rb:410:in `call'

Class File:
class RpcRequest

  require "xmlrpc/client"

  # Automatically create the connection
  def initialize(connection_params)
    @connection = XMLRPC::Client.new(connection_params['host'], connection_params['path'], connection_params['port'], connection_params['proxy_host'], connection_params['proxy_port'], connection_params['user'], connection_params['password'], connection_params['use_ssl'], connection_params['timeout'])
  end

  # Make the xml rpc call
    def make_call(method, request_params)
      @response = @connection.call(method, request_params)
    end

end

Driver file:
require 'RpcRequest.rb'
require 'config.rb'
require 'openssl'

# Define parameters for the connection
connect_params = Hash.new
connect_params['host'] = $host
connect_params['path'] = $path
connect_params['port'] = $port
connect_params['proxy_host'] = $proxy_host
connect_params['proxy_port'] = $proxy_port
connect_params['user'] = $user
connect_params['password'] = $password
connect_params['use_ssl'] = $use_ssl
connect_params['timeout'] = $timeout

# Define parameters for the request
request_params = Hash.new
request_params['fname'] = 'Robert'
request_params['lname'] = 'Jones'

request = RpcRequest.new(connect_params)

puts request.inspect

request.make_call('test.hello', request_params)

Answer: You can interact with the .http property of the client instance.

Ruby XMLRPC pass keypair


iphone app NSNumber memory leak

Question: I'm having a memory leak and I have no clue where it comes from and how to fix it.
At some point i calculate the distance between 2 locations.
double calc = [self getDistance:location to:otherLocation];
NSNumber *distance = [NSNumber numberWithDouble:calc];

in instruments i get as leaked object NSCFNumber and it identifies
NSNumber *distance = [NSNumber numberWithDouble:calc];

as the line causing this.
I'm at a loss. Please help.
thanks in advance,
Michiel
Comment: Try running the static analyzer (Xcode > Build > Build and Analyze) to see if that gives you more information than Instruments.
Answer: There's nothing wrong with what you're doing there.  The NSNumber has a +0 retain count (autoreleased), so you're probably retaining that NSNumber somewhere else and forgetting to release it.
Answer: Leaks shows you where an object that is leaking is CREATED.
If you think about it, there's really nothing else Leaks can show you - it's leaking because the object should have been released at some point, and Leaks can't show you code that does not exist!
Answer: I don't believe that you have problem on the NSNumber line.
I have run the following code and I've got no problems
code>double calc = 10.1234567;
    NSNumber *distance = [NSNumber numberWithDouble:calc];

    NSLog(@"calc: %f | %f", calc, [distance doubleValue]);
I believe that your problem is in your method "getDistance: to:"
Do like I have done. put a static value, instead of the method and check if it is ok.
Cheers,
VFN

iphone app NSNumber memory leak


Is there a method to determine a prime number containing the first n digits?

Question: For example, the number $10243$ is prime and contains the digits '0,' '1,' '2,' '3,' and '4.'  Similarly, the number $20143$ is prime.  Is there a method to determine whether a prime number exists that contains the first, say, $8$ digits?  Or whether a number exists that contains an arbitrary number of digits in order starting from an arbitrary number (say, $3, 4, 5, 6, 7$)?
Comment: Do you want the prime to contain only those digits, each exactly once, or something more relaxed?
Answer: Let $d_1,d_2,\dots,d_k$ be an arbitrary sequence of $k$ digits, with $d_k$ odd and not equal to $5$. Let $a=10^k$ and let $b$ be the number with decimal expansion $d_1\dots d_k$. By Dirichlet's Theorem, there are infinitely many primes in the arithmetic progression of numbers of the form $an+b$, so there are infinitely many primes whose decimal expansion ends in $d_1\dots d_k$.
Added: We now look at the "opposite" problem. Let $d_1,d_2,\dots,d_k$ be any sequence of digits, with $d_1\ne 0$. Then there are infinitely many primes whose decimal expansion starts with the digits $d_1,d_2,\dots,d_k$, in that order. The proof is in principle simple, but takes a while to write out. It uses the Prime Number Theorem.
Answer: Based on your examples, its not clear if the prime number is allowed to contain digits other than those specified, or if each of the digits specified can be used more than once. Assuming the answer to both of those is "no":
The number $10235647$ is prime, and contains each of the digits $0$ through $7$ exactly once.
For any number with the digits $3,4,5,6,7$ arranged in some order, the sum of its digits will be $3+4+5+6+7 = 15$, and so, that number will be divisible by $3$, and thus, will not be prime.
Comment: You claim that 3+4+5+6+7=15, which is false.  3+4+5+6+7=23, which is not divisible by 3.


Can a device that connected to malicious network once be compromised even after disconnection from malicious WiFi?

Question: I need to take my personal laptop to the workplace so I will be using their internet that only employees usually use. However, if the network I connected to was malicious, is my data only compromised if I am still connected to the malicious network or would it still be compromised even after I have disconnected and use my own personal WiFi?
Comment: You are swapping terms, which makes this difficult to answer. Can a malicious network compromise a *device*? Yes, if the device has a vulnerability. If the compromise allowed a persistent connection to the device, then it wouldn't matter if you changed networks because you are still "infected". But you switch from device to "data". What, then, is your concern?
Comment: Tangentially related: Connecting your personal laptop to the company network is likely prohibited by your employer. Contact your employer's IT department to be sure.
Comment: Which terms am I swapping exactly?
Comment: I said: you switched from "device" to "data"
Comment: Short answer: Of course, yes
Answer: Your question does not mention what you mean by "malicious network".
I can give you a few examples.

I try to create my own network and then allow people to connect to it. So now everyone connected to the internet via me is using me as a middle guy for traffic. That is the reason why they say you shouldn't use open network places.
In the second case, if someone wants persistent access to your system, they will allow you to connect to their network and then push you to install something. Now that malicious software will give them access to your system or steal stuff from your systems.

I could offer a lot more but this should get you started.
Answer: If you were connected to a malicious network (aka, a network owned by a malicious actor) then if a payload or persistence point was loaded onto your system then yes, you could still be vulnerable.
The hardware MAC address for example, will not change when you connect to different networks and received a different dynamic IP, but a payload beacon on your device could always be sending out information if your device was compromised.


How to use MicrosoftMvcValidation with jQuery.Ajax in ASP.net MVC2?

Question:
using asp.net mvc2, Data Annotations,
  MicrosoftAjax.js,MicrosoftMvcValidation.js,
  jquery for ajax

I have contact form and i am using Data Annotations for the ContactFormModel.
I add this line <% Html.EnableClientValidation(); %> to top of the form.
When i click the submit button client validation works perfectly. Now i have changed my mind and want to post the form with jQuery.Ajax.
This time i want to accomplish this.

Click submit button.
MicrosoftMVCValidation does the client validation and renders the errors on the clientside.
If Model is valid i meant if the validation passed i want my jQuery ajax to get involved.

But when i clicked the submit button both ajax post and mvc client validation works.
How can i get the things in right order.
1.Mvc Client validation
2. Then jQuery.Ajax Post.
Answer:             var myForm = $("#MainForm");
            var formContext = myForm[0]['__MVC_FormValidation'];
            var errors;
            if (formContext) {
                // validate the form
                errors = formContext.validate("submit");
            }
            if (!formContext || errors.length == 0) {
                // no errors so submit to server
                ...
            }