How to apply the primer over paint on a small chipped area

Question: Someone has chipped the paint from corner of my wall. Do I need to apply a primer (I see the wall behind the paint)?
If so, I will inevitably put it over the previous paint a little. You know? I won't be able to only put the primer in the small chip in the wall, it will spill over inevitably a little. Is that okay? How does this work generally?
Answer: So it sort of depends on how bad the chipping is.  (posting a picture will allow for a bit more detail in answers)
In general for chipped paint I would recommend the following process. (and yes getting the prime on existing paint is no big deal)

Clean and sand the edges.  Basically, make sure that nothing else is loose.  Take a scraper and chip off any paint that does not adhere to the wall behind it.
Fill the holes with non-shrink spackle.  Use a scraper, apply it, let it dry then sand it smooth with the surrounding wall.
Prime.  You can get away with a spray primer (I generally use the spray Kilz to seal the parts that were patched.
Paint.  So you can brush it on and just apply a spot fix...but the texture of the paint will be different from the walls around it...ideally you should paint the whole wall, but that said you can roll a section of it, and feather out from the main area that needs paint.
Comment: Not a problem.  A few days of moisture shouldn't be problem.  Just make sure it is dry when you are applying your spackle, primer and paint.  Ideally you will want it to stay dry the whole time but that's not reality.  If you can avoid the spackle absorbing any moisture that would be good.
Comment: Thanks greatly.
I'll post a picture today. But I can say that the chip is small however it's on the eye level!! :(
I have a quick question that nags me: this is in the bathroom. If I do the repairs in a few days, will the moisture from the water vapor from the shower, will that cause damage to the wall because the paint has been chipped off a little?
I'll have time in 2-3 days to do the repair.
Thanks again for your kind help.
Comment: Hi James.
I can't find a non-shrink spackle. Is it okay to use a regular one? Or I should definitely try to find a non-shrink one?


(Bash) How do I display a command output in a whiptail textbox?

Question: The whiptail command has a --textbox option

A text box lets you display the contents of a text file in a dialog box

I would like to use the output of a command in its place (yup, that's the same question posted here), but the difference is that when I run the command in the response (not the same) whiptail --textbox /dev/stdin 30 60 <<< "$(echo Hello)" I get an empty textbox as you can see here.
Which other ways could you handle the output of a command as a file?
Thank you!
Comment: @j_b: Ubuntu 20.04 still uses bash v5.0; this particular symptom appears with bash v5.1, for reasons analysed [here](https://stackoverflow.com/a/23091156/1566221). (I only just figured all this out.)
Comment: It works for me, just like it did in that question. Could you perhaps reveal which version of whiptail you're using (should be available from `whiptail --version`) and on what operating system and shell?
Comment: I don't think this will solve your problem, but `<<< "$(echo Hello)"` is convoluted.  Why not just `<<<"Hello"`?.  If you want to pass the output of a command (eg `echo`) to whiptail, use a `|` eg `echo Hello | whiptail ... `.  I use `/dev/stdin` this way regularly so I'm not sure why your example doesn't work
Comment: Yeah that's weird, with `whiptail --textbox /dev/stdin 30 60 <<<"Hello"` I got [an empty textbox](https://i.imgur.com/R6IpM1P.png) and `echo Hello | whiptail --textbox /dev/stdin 30 60` [the same result](https://i.imgur.com/wQIfX8o.png)
Comment: if any one of those variations doesn't work, it makes sense that other equivalents wouldn't work too.  does it work with a regular file?
Comment: What O/S are you using?  I cannot reproduce on ubuntu 20.04.   All of the following produce at text box with "foo bar" in it:  `$ whiptail --textbox /dev/stdin 25 50 <<<"$(echo foo bar)"` or `$ whiptail --textbox /dev/stdin 25 50 <<<"foo bar"` or  `whiptail --textbox foo.txt 25 50` or `whiptail --textbox /dev/stdin 25 50 <foo.txt`
Comment: @DanielFarrell Yes it works with regular files. E.g. "File" file that simply says "Hello, I'm a file!" [as you can see here](https://i.imgur.com/DDIe46V.png)
Answer: It turns out that cmd | whiptail --textbox /dev/stdin 30 60 doesn't work for you because you're using Bash v5.1, not because of any changes in whiptail.
You can still use this alternative workaround:
whiptail --scrolltext --msgbox "$(cmd)" 30 60

provided the output of cmd is not too big to include in the command line (around 128kb).
I rewrote the original question which you cited, taking into account the change in Bash v5.1 and a more accurate analysis of the original problem, so I'm not going to repeat all of that here.
Comment: Weird, I'm using bash... But thank you! Your command [worked like a charm](https://i.imgur.com/L6WvV5I.png). I used `whiptail --msgbox "$(echo $MESSAGE | tr '[a-z]' '[A-Z]')" $(stty size)` as an example
Comment: @IwakuraLain: I'm glad you got it working, but I'm still curious. Which version of `whiptail` have you got? And what OS do you use? (Eg. Ubuntu Linux 20.04, macOS 12.0, ...)
Comment: I'm also curious which version `whiptail` and where came from
Comment: ```whiptail (newt): 0.52.21``` and I'm using Fedora 36
Comment: I made a post on [Reddit](https://www.reddit.com/r/linuxquestions/comments/xe7ngc/how_do_i_display_a_command_output_in_a_whiptail/iogt8en/) about the same thing and someone also had a similar situation because of the version but in Debian
Comment: Maybe it's a bug or bad luck
Comment: @IwakuraLain: I guess it could be described as bad luck :-( I tracked it down to a version change, but not in whiptail; it's a version change in bash. I'm writing it all up now.


How to add user level environment variables to be used by GUI application?

Question: What is the recommended way to add user level environment variables to be used by a GUI application in Ubuntu? I know there are ~/.bashrc, ~/.cshrc, ~/.profile etc for console apps.

How can I add new paths to existing PATH (/bin:/usr/bin/:/usr/X11R6/bin/usr/local/bin)?
How to add settings (new key value pairs)? This is meant to be used by a bunch of applications.
Answer: At EnvironmentVariables, ~/.pam_environment and ~/.profile are mentioned as suitable files in Ubuntu. Personally I prefer ~/.profile since it's a script file.


How do I add two more lights to one cirucuit. The power is supplied to the first light?

Question: I have and old house and the light is supplied with power which then is connected to one switch. I want to add two more lights and have them run off the same switch. I connected as though the power was supplied to the switch at first but was the wrong assumption. Can I do this with just two conductor cables everywhere or do I need 3 conductors between the lights?
Answer: You need a neutral and switched hot for each light. To get a neutral you really have 3 options:

You can run a 14/2 wire from the existing light to the new light(s)
You can run a new power supply into the switch, disconnecting the existing supply at the light (cap the wires). You can then run 14/2 from the switch to the new light(s).
You can replace the existing wire between the light and switch with 14/3, so you can get neutral at the switch, then run 14/2 from the switch to the new light(s)

As an alternative, you could look into some of the smart switches on the market. Depending on what you use, there are several ways to do this, but essentially you can put your new lights on a new switch, then link the two switches together to form a virtual 3-way circuit and the end result is that either switch can control all the lights (there are many, many different ways to configure this as well, definable by programming the switches).
Comment: The 1st option is the easiest, connect the other lights in parallel to the current one. The existing light's neutral to each new light's neutral binding post. The light's other wire (switched hot) to each new light's other binding post. All 2 conductors. All other options needless complications IMO. But offering options is good.
Comment: @bcworkz Yeah but this is one of those difficult things to say without actually being there. The easiest approach really depends on accessibility from unfinished space (vs amount of damage you're willing to and capable of fixing), types of construction (drywall vs plaster vs brick), ability to route wires (eg, engineered beams or ductwork in the way, exterior insulated walls), proximity to another power source, etc.


How is this plan for repairing load bearing rotting posts with epoxy (pics included)

Question: My carport has five 4x4 posts with two of them are showing serious signs of rot. I have attached a photo of the worst and 2nd worst looking one, and what the other ones look like. At first I thought the only way to repair the posts was to replace them. However some epoxy's have incredible bonding stength, load bearing strength and water resistance properties. My plan to repair them with epoxy as follows:

On each side of the post, cut the blacktop a couple inches away from the post, and expose the full length of the post.
Remove as much rotting material from the posts as possible with a small chisel
Liberally Spray a wood preservative solution of copper napthenate (green preservative) to halt the rot's progression
Prebuild forms that will be put around the posts once the resin mixture is ready, and spray them with silicone spray so they will come away from the resin a little easier.
Mix West Systems 105 Resin with West Systems 206 Slow Hardener, and thicken the mixture with West Systems 403 Microfibers. Note, I may not necessarily use West Systems products, but something similar such as from conserve: http://conservepoxy.com/category/Rot-Repair-Epoxies.htm .
Let the Resin cure for a day or so and remove the columns.
Prime and Paint the posts, including the repaired area.
Repair blacktop and raise the blacktop enough such that rain water will slope away from the posts.
I got this idea from a blog here: http://www.westsystem.com/ss/saving-the-deck/

What do you think, is my plan sound?
Comment: If footings are questionable, the answer I have below will allow new footings to be dug as well
Answer: The plan will make the 4x4s look good. However, you did say they are LOAD BEARING, an epoxy is great for holding things together or protecting things, but terrible at withstanding stress from a load. The posts function is to transfer the weight above it to the ground, so filling in the rotted parts of the wood with epoxy is just hiding the problem. Most epoxy adhesives rely on the stress being directed against thier cohesion to the material. When the stress is in a direction that is contrary to that the epoxy fails. If you wanted to glue two pieces together to double the load bearing capacity it would work great for that, but it can't take the load and replace the structural member yet. Maybe in the near future they will come up with something that can. Sorry to tell you this, but you are going to have to replace the 4x4 posts, or you run the risk of them tipping, or collapsing so that the structure comes down. It aslo would be a good time to bring them up to code. The good news is you can treat them so they are rot resistant for far longer now, and it is far cheaper than having the carport fall on your transportation.
Comment: Post replacement really isn't hard. Even if the epoxy is structural (something I've not heard of, but I'll read the info), I suspect you'd spend as much time on epoxy as post replacement.
Comment: Nice Explanation. I'd just like to echo the fact that it could actually be cheaper to carefully to just replace the posts. Ideally, the footings, etc are sound. Assuming that, and counting using some good bracing, you could take your time and replace one bad post at a time, even a weekend, until it's all fixed.
Comment: @User95050 - +1 for the time equate. I would also like to point out that the epoxy materials are going to be expensive. I scoped out one of the half gallon sized containers at the conservepoxy web site and saw a price of like $80. Some of those worst posts could take that much of the epoxy for just one post!!  At home depot .com a 10' pressure treated 4x4 is $11.37! The choice is pretty obvious.
Comment: I wonder why here then they say their epoxy can be used for structural repairs: http://conservepoxy.com/wood-rot-and-epoxy-faqs.php?Screen=wood-rot-and-epoxy-faqs#five
Comment: @MichaelKaras:  Replacing a post should take less than 30 minutes each.  Blacktop removal and repair, chiseling, pretreating, molding, mixing and spreading epoxy is likely to take several hours per post and provide a suspicious or doubtful result, at least compared to replacement which is pretty much a sure thing.  If the OP's time is worth anything plus the certainty of a lasting repair make this also a pretty clear choice.
Comment: I am pretty sure replacing the posts will take me a lot more time then 30 minutes (I'm old and a weekend DIYer). For one I am not sure if the footings are proper so I may need to dig/pour concrete 1st. Of course if i don't have the proper footings... it is more of a reason to replace them.
Comment: @offthegold -- I sincerely doubt that anyone can shop/ support/ replace (with appropriate fastening)/ clean up in 30 minutes. However, it's quite reasonable for a homeowner to budget a few hours for the job.
Answer: I have cut posts off and poured concrete under them to get them above grade. The pics below show a 12" diameter post, but an 8X8" square poured under the cut off post could work with proper anchoring.

I thought I had a picture of the finished post, but I could not find one, but you might get the picture.
Yours may only need to be 12" tall.
Comment: Looks interesting. How did you anchor the post in the cement? How much of the post did you cut?
Comment: On the upper picture you will see a plate with a threaded rod that is actually holding the bottom of the post off the footing. I left that intact to anchor the new concrete to the existing footing. I power washed the footing cleaned the rust off with a wire wheel on a strong drill and painted the pin with rusty metal primer. I cut of about 16" to get to sound wood. You may not need to cut that much off yours to get to sound wood, and shorter the new concrete base is the better. 12" is ideal. If you need a footing, it would need to be configured differently too.
Comment: You could drill holes in the concrete footing if you have one and set them with expansive concrete, Clean the holes thoroughly!!!! With in an 8" square form the pins need to be 2" from the form unless you use epoxy coated rebar, then you could get closer. Use a minimum of 2, 4 would not hurt. You could use epoxy too, in this case to set the pins.... Also use a post bottom clip to cast in the concrete. Set it on the post first, bolt it, or nail it, then pour the concrete.


Functors - Are they used to make Operator Overloading more easy?

Question: The below piece of code is very common to implement Min-Heap :
struct comparator
{
    bool operator() ( int i, int j)
    { return j < i; }
};

priority_queue<int, std::vector<int>, comparator> minHeap;

How Functors work?
What purpose they solve in C++?
I could see Functors are more often used to Overload comparison.
Are they just used to make Operator Overloading easy?
When to create Functors?
How to create our own functor?
Comment: @πάντα ῥεῖ I think are more appropriate place to point them would be http://stackoverflow.com/questions/356950/c-functors-and-their-uses
Comment: @NathanOliver Yes probably the better dupe. Reopened.
Answer: The comparator struct is an example of something usually called a 'functor' in C++. A functor is a 'callable object' - that is a regular object that implements operator(), the function call operator. When used like this in an STL container, you are passing the type of the functor rather than an instance of it as a template argument. The container will create instances as necessary in order to actually call operator() on them.
If you are familiar with lambdas in C++, they are really just syntactic sugar for functors. A lambda definition creates an anonymous type which you can think of as a compiler-generated functor type with an operator() corresponding to the lambda function.
Functors (or lambdas) are the standard way in C++ to pass functions to types or other functions. This is useful in many situations, the example allows you to customize the sorting criteria for the priority_queue. The STL uses functors all over the place in containers and the algorithms library as a way to parameterize types and functions on a user supplied function.
Answer: comparator is functor type used internally to sort container.
cppreference
By default STL uses builtin comparator std::less that is doing i < j. In your example custom comparator is used to sort container in reversed order. Your example can be rewritten as:
priority_queue<int, std::vector<int>, std::greater> minHeap;


advice on choosing different binary xml tools

Question: My requirement is to compress xml file into a binary format, transmit it and decompress it (lightening fast) before i start parsing it.
There are quite a few binary xml protocols and tools available. I found EXI (efficient xml interchange) better as compared to others. Tried its open source version Exificient and found it good.
I heard about google protocol buffers and facebook's thrift, can any one tell me if these two can do the job i am looking for?
OR just let me know if there is anything better then EXI i should look for.
Also, There is a good XML parser VTD-XML (haven't tried myself, just googled about it and read some articles) that accomplishes better parsing performances as compared to DOM,SAX and Stax.
I want best of both worlds, best compression + best parsing performance, any suggestions?
One more thing regarding EXI, how can EXI claim to be fast at parsing a decoded XML file? Because it is being parsed by DOM, SAX or STax? I would have believed this to be true if there was another binary parser for reading the decoded version. Correct me if i am wrong.
ALSO, is there any good C++ open source implementation for EXI format? A version in java is available by EXIficient, but i am not able to spot a C++ open source implementation?
There is one by agile delta but that's commercial.
Answer: You mention protocol buffers (protobuf); this is a binary format, but has no direct relationship to XML. In partiular, no member-names (element names / attribute names / namespaces) are encoded - it is just the data (with numeric markers for identifiers).
As such, you cannot reconstruct arbitrary XML from a protobuf stream unless you already know how to map "field 3" etc.
However! If you have an object-model that works with both XML and protobuf, the transform is trivial; deserialize with either - serialize with either. How well this works depends on the implementation; for example, it is trivial with protobuf-net and is actually how I do the codegen (load the binary; write as XML; run the XML through an xslt layer to emit code).
If you actually just want to transfer object data (and XML is just a proposed implementation detail), then I thoroughly recommend protobuf; platform independent, a wide range of implementations, version-tolerant, very small output, and very fast processing at both read and write.
Comment: Great, that answers my questions about proto buffs and i believe thrift would be no different. Thanks alot for your answer.
Comment: Now i am looking for someone to clear my confusing regarding EXI - efficient xml interchange.
Answer: Nadeem,
These are very good questions. You might be new to the domain, but the same questions are frequently asked by XML veterans. I'll try to address each of them.

I heard about google protocol buffers and facebook's thrift, can any one tell me if these two can do the job i am looking for?

As mentioned by Marc, Protocol Buffers and Thrift are binary data formats, but they are not XML formats designed to transport XML data. E.g., they have no support for XML concepts like namespaces, attributes, etc., so mapping between XML and these binary formats would require a fair bit of work on your part.

OR just let me know if there is anything better then EXI i should look for.

EXI is likely your best bet. The W3C completed a pretty thorough analysis of XML format implementations and found the EXI implementation (Efficient XML) consistently achieved the best compactness and was one of the fastest. They also found it consistently achieved better compactness than GZIP compression and even packed binary formats like ASN.1 PER (see W3C EXI Evaluation). None of the other XML formats were able to do that. In the tests I've seen comparing EXI with Protocol Buffers, EXI was at least 2-4 times smaller.

I want best of both worlds, best compression + best parsing performance, any suggestions??

If it is an option, you might want to consider the commercial products. The W3C EXI tests mentioned above used Efficient XML, which is much faster than EXIficient (sometimes >10 times faster parsing and >20 times faster serializing). Your mileage may vary, so you should test it yourself if it is an option.

One more thing regarding EXI, how can EXI claim to be fast at parsing a decoded XML file?

The reason EXI can be smaller and faster to parse than XML is because EXI can be streamed directly to/from memory via the standard XML APIs without ever producing the data in an intermediate XML format. So, instead of serializing your data as XML via a standard API, compressing the XML, sending the compressed XML, decompressing the XML on the other end, then parsing it through one of the XML APIs, ... you can serialize your data directly as EXI via a standard XML API, send the EXI, then parse the EXI directly through one of the XML APIs on the other side. This is a fundamental difference between compression and EXI. EXI is not compression per-se -- it is a more efficient XML format that can be streamed directly to/from your application.
Hope this helps!
Comment: BTW: The [Efficient XML FAQ](http://www.agiledelta.com/efx-faq.pdf) might also be helpful to you.
Comment: John, Thanks a lot for your detailed response. Really appreciate it.
Comment: John, After all my work related to binary xml, (EXI being major part of it), i want to publish my work in some famous journals. Since i haven't invented anything new, can you please point me to most specific research journals related to XML where i can send my article for publication. Your response would be highly appreciated.
Answer: Compression is unified with the grammar system in EXI format. The decoder API generally give you a sequence of events such as SAX events when you let decoders process EXI streams, however, decoders are not internally converting EXI back into XML text to feed into another parser. Instead, the decoder does all the convoluted decompression/scanning process to yield an API event sequence such as SAX. Because EXI and XML are compatible at the event level, it is fairly straightforward to write out XML text given an event sequence.
Comment: just to confirm my understanding, you are saying that there is another decoding parser by the EXI API's that just parse the decoded version just like SAX events?
Comment: There is no another decoding parser involved. EXI decoder does all the convoluted process (integrated decompression and reverse-tokenization) within itself, of which the output are the events such as SAX.


What is wrong with this induction proof? I am confused on how this is wrong other than the base case being wrong.

Question: P(n): $n=2n$ for all integers $n >= 0$
Base Case: n = 0

Verify Base Case:
P(0): 0 = 2(0) which is true

Induction Step:
Assume that P(n) is true. Then multiply both sides of the quantity by $(n+1)/n$ which gives us $n+1=2(n+1)$ = $P(n+1)$

I am not sure what exactly makes this proof wrong despite me knowing it is false.
Comment: to get from P($0$) to P($1$) you would multiply by $1/0$, but division by $0$ is not allowed
Comment: With problems like this, it's always good to write out the first inductive step completely.  Try to use this argument to show $P(1)$, i.e. try to show that $1=2$.
Answer: What makes the proof wrong is that, when $n=0$, you cannot multiply by $(n+1)/n$,
because that would involve dividing by $0$, so it is not allowed.
For a different kind of induction fallacy, see this Wikipedia article.
Answer: You have divided by $n$ in your induction step where you have multiplied by $(n+1)/n$
Note that you may not divide by $n=0$ but your initial step was involving $n=0$
Thus your argument fails at $$P(0)\implies P(1)$$
Answer: When applying the inductive step for the first time with $n=0$, you are instructed to multiply by $\frac{n+1}{n}=\frac{1}{0}$. Clearly, this is not a well defined number and, hence, not a well-defined step.


Standard Community Responses to Poor Questions and Answers

Question: With this feature, I have begun trying to write some standard responses to certain types of questions. I tend to write these as I see the need for a new one (when responding to a specific question, I'll try to write a "form" answer).
I thought others may also appreciate sharing and/or participating in creating some of these standard responses, and I'd love to see how others go about answering. I was thinking we could do one answer per response type ("add initial research", "opinion based question", etc), and see where it goes from there!
Answer: I tend to use something like the following, especially with newcomers' questions, when a question is unclear possibly due to lack of information on what they are researching

Hi [@Username] and welcome to CogSciSE. What research have you done to come up with ..... ? What references can you provide to give a background to what you are asking about?
Answer: Personal advice sought
Similar to the standard comment given by MedicalSciences.SE I comment with

Welcome to Psychology.SE! I am sorry, but for a number of reasons outlined in this meta post we can not, and will not, give advice or potential diagnoses for any specific individual. If you or anyone else has a question regarding personal mental health, advice from a doctor should be sought. For further information on how this site is supposed to work, what is on-topic or not, you can take the tour, visit the How to Ask page and Psychology & Neuroscience Meta.

there are shortcodes you can use to help so the markdown used when posting the comment is:
Welcome to Psychology.SE! I am sorry, but [for a number of reasons outlined in this meta post](https://psychology.meta.stackexchange.com/questions/502/why-was-my-self-help-question-closed-as-off-topic) we can not, and will not, give advice or potential diagnoses for any specific individual. If you or anyone else has a question regarding personal mental health, advice from a doctor should be sought. For further information on how this site is supposed to work, what is on-topic or not, you can take the [tour], visit the [ask] page and [meta].
Answer: No Initial Research
This one will probably also be edgy as we are about to get the new close reason, but I still think a form comment may be useful.

Hello and welcome to Cognitive Sciences! Will you please provide the results of your initial research? Thank you!

Hopefully is welcoming while stating the expectation that initial research is done, and asking for it. This may be nicely supplemented by a link to the new close reason's help documentation which, in my mind, will detail our expectation on ``initial research''.
Answer: Relating to Pseudoscience

Welcome to Cognitive Sciences! This question appears to be off-topic as questions relating to pseudoscience are off-topic on Cognitive Sciences.

With lack of a better definition, I think that the link to the "list of pseudosciences" on Wikipedia is important (to let users know what will or won't be classified as pseudoscience).
I know we (as a community) haven't formally decided one way or the other on the appropriateness of pseudoscience questions, but I propose using this reason (or a reason that lists what you classify as pseudoscience) when choosing to vote to closed a question as pseudoscience (if you choose to do so).
Answer: Subjective

I'm voting this question closed as seems likely to generate opinion-based answers. Please see our help center for more details about opinion based questions and what questions are appropriate here at Cognitive Sciences, and feel free to edit as needed.
Comment: @StevenJeuris Hmm I wouldn't disagree if the close reasons automatically generated a comment, but in the couple of days that it can take a question to be closed a user (specifically a new user) may appreciate the feedback and the point in the right direction.
Comment: @mfloren I see. So you advocate posting the comment prior to the questions being put on hold (while close reasons are still coming in)?
Comment: Personally, I dislike it when someone says *we frown upon* when I actually like the question. Further, [too] many questions here are quite subjective. I think you need to keep in mind that pob close-votes are generally used the other way around, namely for questions that are **likely to generate opinion-based answers**. Lastly, pob close-votes already generate an automated answer which is actually pretty good.
Comment: @AliceD Really? Perhaps it is because I post an additional comment, but I haven't seen the auto-generated answer... To test, I just voted to close my question here for this reason...
Comment: @AliceD Updated: hopefully better (though if we have auto-ones for this, there is no need). Perhaps I could ask: are we supposed to have auto-generated responses for all closings?
Comment: When the comment ends up being the same as 'on hold' reasons, I see no point in leaving a comment. This is what the specific close reasons are for in the first please. A comment should either elaborate, or make it more specific to the site.
Comment: @StevenJeuris Yes sir! I think that even a form answer can give newer users a push in the right direction on improving their posts (and let them know that someone is trying to help them). For me, the ideal would be that the question is edited immediately (and never gets closed at all).


Gps notification iphone sdk

Question: Is there any api in iPhone sdk for getting the major change in location (ie for more than 500m). I need to notify the user even though the application run's in background.
Answer: I'm not 100% on the running in the background part, but iOS 4.0 introduced some major change in location monitoring to CLLocationManager, specifically 'startMonitoringSignificantLocationChanges'. Is that what you're after?
Answer: Your question is answered in detail in this document: Location Awareness Programming Guide

Gps notification iphone sdk


Cannot call function from click event

Question: I have a car parts classified section, I want to display only 10 ads per page and pagination links at bottom. Every example of PHP pagination I see puts the php code into the same page where the data is displayed....I do not want to do this. I want everything to go through jquery and AJAX and use the XMLHttpRequest to push the data on page.
In my PHP script I put together the pagination links and each anchor has an attribute of "href='#'"  and'linkValue' who's value is dynamically set to it's corresponding page number. The PHP generates this HTML:

For instance when clicking on link with 'linkValue=2' that value is passed to a jquery function and concatenated to the end of the query string:
'getParts.php?pageNum=2'.

The PHP script gets the value of pageNum from the query string and uses it to determine which page is returned, in this example it would return records 11-20. The parts classified page is initially loaded by a function call to 'showParts()' in the head:
$(document).ready(showParts() );

which in turn calls the PHP script 'getParts.php'.
The problem is this:
I cannot seem to call the 'showParts()' function from the click event from the pagination links. I can call a simple alert quite easily, I can even call a function which has the alert in it,but when trying to call the showParts function I just get the '#' at the end of the url addy and go to top of the page.
The jquery function:
$(document).ready(function(){
    $(".paginateLink").click(function(){
        showParts();
    });
});

At this point I'm not even trying to put the query string together, just want to get it so the function fires in the first place, even if it just sends back the same results.
EDIT:
Not sure what I'm doing wrong here, this seems like it should work. For instance the following code works:
$(document).ready(function(){
    $(".paginateLink").click(function(){
        alert($(this).attr('linkValue'));
    });
});

So I CAN call a function and pass the necessary variable, I just can't call the showParts function, at least not a second time. Again the function is called when the page loads initially to populate the page with car parts.
function showParts(str) {
    if (str=="") {
        document.getElementById("partsDisplay").innerHTML="";
        return;
    }
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else {  // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200) {
            document.getElementById("partsDisplay").innerHTML=xmlhttp.responseText;
            $(document).foundation('accordion', 'reflow');
            $(document).foundation();
        }
    }
    xmlhttp.open("GET","PHP/getParts2.php",true);
    xmlhttp.send();
}

Comment: maybe more help if you include the showParts function too
Answer: It looks like you change the pagination elements in dom, so click event is removed. So, you better use:
$(document).ready(function(){
    $("body").on("click", ".paginateLink", function(){
        showParts();
    });
});

This means, no matter if you remove the pagination, than insert it again, whenever you click the body and target is a navigation link it will trigger the event. If you use older jQuery, than live is equivalent method.
Another error spotted, you use:
if (str=="") {
   document.getElementById("partsDisplay").innerHTML="";
   return;
}

which is wrong, because later on you call the function without argument. It should be:
if (typeof str === "undefined" || !str) {
   document.getElementById("partsDisplay").innerHTML="";
   return;
}

But, since you use jQuery, wouldn't all be easier with:
$(document).ready(function(){
    $("body").on("click", ".paginateLink", function(e){
        e.preventDefault();
        $('#partsDisplay').load('PHP/getParts2.php?pageNum=' + $(this).attr('linkvalue'), function() {
            $(document).foundation('accordion', 'reflow');
        });
    });
});

Comment: That's a delegated event right? Didn't work. Again if I just replace the function call with an alert, it works and the alert pops up, works same my way and this way. Seems to be related to the code in showParts but what I don't know.
Comment: How do you know the function is not called at all?
Comment: Because the page would reload....wouldn't it? It just goes to the top of the page because of the href='#'(u can see it in the url).I thought of that too, and removed the if(str=="") code just to see what would happen and nothing happened. Also tried the code you suggested....still nothing.
Comment: you cannot say it would reload, start the function with `console.log('Function called');`, than test it
Comment: Sigh....it appears I was refreshing a cached page. Chrome caching issue. I'm getting something now. Sorry. Thanx Sko.

Cannot call function from click event


Can I overload REST url resource having different arguments?

Question: Using the same url of the resource, is it possible to call different methods underneath depending the arguments?
@POST
@Path("/resource/add")
@Consumes(MediaType.APPLICATION_JSON)
public Response add(Class1 arg1);

@POST
@Path("/resource/add")
@Consumes(MediaType.APPLICATION_JSON)
public Response add(Class2 arg2);

Comment: The '/add/' is redundant as the POST verb implies creating a new instance of the class.
Comment: No. Why don't you try it and see the result?
Comment: No, but you could do `@Path("/resource/add/class1")` and `@Path("/resource/add/class2")`
Comment: what about this https://stackoverflow.com/questions/30380498/overload-controller-method-in-java-spring
Answer: To answer the question
No, it is not possible because the container has no information on how to route the request.
What you could possibly do
As pointed out by @Jim Garrison in the comments, you could work around this by differentiating the path. However, I find this somewhat counter-intuitive. As far as I understand, it's not a different resource at all. You just want to use a different representation.
If you really want to introduce such logic, maybe you should introduce your own, custom media types for specific formats and use them instead of the generic application/json
The clients of your API would have to be conscious of this design decision, though. If you're unsure whether the introduction of custom media types is a good idea, take a look at the answers to these questions, which may make it a bit clearer:

How to create a custom media type (application/vnd) for a RESTful web service?
Is using custom json content-types a good idea

If you don't want to have the representations different, then I don't really understand the point of having those two classes. Perhaps this division should not reach your RESTful API and you should be using these representations internally. In this case, you might want to implement an adapter, a decorator or maybe a factory to be able to switch between the two implementations. It's difficult to recommend a specific pattern without knowing how these classes are supposed to be used and what they represent.
Answer: No it is not possible. From your example i could see that you are trying to add. If it is two different class i am guessing that its two different things.
For eg : Contacts, Items like that.
Generally in these cases we would have two api's.
One is for adding Contacts (Class1) and another one for adding Items(Class2). So that it would be clearly understanding for the Client Side.


How can I get column descriptions/comments for a table in SQL Server

Question: In my laravel app, I'd like to get the comments for all the columns of a given SQL Server table.
This is what I've tried so far:
$query    = "SELECT sys.objects.name AS TableName, sys.columns.name AS ColumnName,
                   ep.name AS PropertyName, ep.value AS Description
            FROM sys.objects
            INNER JOIN sys.columns ON sys.objects.object_id = sys.columns.object_id
            CROSS APPLY fn_listextendedproperty(default,
                              'SCHEMA', schema_name(schema_id),
                              'TABLE', sys.objects.name, 'COLUMN', sys.columns.name) ep
            ORDER BY sys.objects.name, sys.columns.column_id";

$columnDetails =  DB::connection($user->getConnectionName())->select(DB::raw($query)

This is what my table looks like in DBeaver:

But, I get this result from my code which gives a "Description" of null:

Have I done something wrong in the query or in the table setup thats causing this to be null?

Additional Info
I added the original comment via the DBeaver UI, thinking that might not do what I think it does, I went back and added another column and comment via SQL with:
EXEC laravel.sys.sp_addextendedproperty 'MS_Description', 'Some test description', 'schema', 'guest', 'table', 'users', 'column', 'test' GO

Which unfortunately results in the same issue:
Answer: Try changing the query like this:
$query    = "select so.name as TableName, sc.name as ColumnName,
                ep.name as PropertyName, ep.value as Description
            from sys.objects so
            join sys.columns sc on so.object_id = sc.object_id
            join sys.extended_properties ep
                on sc.object_id = ep.major_id and sc.column_id = ep.minor_id
            order by so.name, sc.column_id";

$columnDetails =  DB::connection($user->getConnectionName())->select(DB::raw($query)

Comment: Unfortunately, that produces the same result (ie MS_Description is still null). Perhaps I've set the `MS_Description` incorrectly? I assume that adding a "Description in DBeaver's UI is setting the `MS_Description` extended property for the column, but maybe its not?
Comment: Maybe you're using an user without metadata permission in your query.


Using Vector2 and Vector2 as generic constraints?

Question: I am trying to create a somewhat generic xna physics module like this:
   class PhysicsModule<T> : where T : Vector2, Vector3
   {
        private List<PhysicsForce<T>> _globalForces;

        public PhysicsModule()
        {
            _globalForces = new List<PhysicsForce<T>>();
        }

         ///
        /// Updates the resultant which will be sent to be applied on all entities.
        ///
        /// <param name="gameTime">...</param>
        public override void UpdateResultant(GameTime gameTime)
        {
            _resultant = T.Zero;
            foreach (PhysicsForce<T> force in _globalForces)
            {
                T vector = T.Multiply(force.Direction, force.Magnitude);
                T modifiedByTime = T.Multiply(vector, (float)gameTime.ElapsedGameTime.TotalSeconds);

                _resultant = T.Add(_resultant, modifiedByTime);

            }

        }
    }

    class PhysicsForce<T> where T : Vector2, Vector3
    {
        public T Direction;
        public float Magnitude;
    }

I know this code won't work, it only serves as a sample to make clear what I want to do.
Is this possible or will I be better of having an abstract base like this
class PhysicsModule2D : PhysicsModule

class PhysicsForce2D : PhysicsForce

Answer:
You need to always fulfill all generic constraints
.net generics only allow you to call methods from the generic constraint, i.e. unlink C++ templates they don't work by name. One consequence of this is that you can't use static methods or operators on T.
There is a workaround using dynamic typing(either using the dynamic keyword in C# 4 or generating delegates on the fly as MiscUtil does). This reduces performance significantly though.
There is an ugly hack that allows high performance, it's a bit complicated though.
You can write the code with some placeholders and then use a code generator to generate the other versions
You can simply implement 2D and 3D separately manually. Probably the best choice even if it violates DRY.

For 4) you first create a generic interface that contains all methods on VectorX you want to use. Like this:
interface VectorMath
{
  T Add(T v1,T v2);
}

Then you implement it using structs. And then you pass that struct as a second generic parameter to your class.
Comment: Thx for the great explanation! Will try 4) but like you say I will probably end up with separate implementations.


Where is the best place in a checkout flow to ask users to save the payment method?

Question: In a checkout process, I need to show an option for the user to save their payment method info, to pay faster next time. Only registered users can save this info, so if a user wants to save they either have to sign in or create an account. The checkout form is a single form, no steps.
Two options come to mind:

After the user enters payment info, before sending to payment. This will trigger a modal window to sign in or register.
After payment is processed, on the success screen.

There are pros and cons to either of these, but i'm curious to hear what you think.
Answer: I'll take as an example the Steam platform (where you can buy games).
When you take something (like the last game you want) and proceed to checkout, steam ask you your payment info. At the bottom of it, there's a little box checked by default with the text "Keep my payment info for next time".
In psychology, we call it "Default" (from MINDSPACE model for behavioral change). People tends to accept the default option.
So, to answer directly, do as steam does : During the payment info, let them uncheck this little box (or something similar, as you wish, as long as your users understand) if they don't want. So that you'll have more people with default payment infos than if you did the other way around, making it easier for your users to pay (and so, winning you more money in the end).
Of course, you have to let them change it as much as they want (I mean, in the process, if they enter something different than their previous payment info, ask them if they want to change their default payment infos or if it's another payment info that they could register => It depends on your business).
Comment: i tend to agree, but i can't have the checkbox checked because i have a condition - i can save payment info only for registered users. so if user is NOT logged in, i'll have to show the checkbox as disabled until they register (if at all).
Comment: Is it possible to ask them to log in after the payout? Like "Oh you paid this, with those info, want to create a new account to keep those infos?"
Comment: @Martin, don't show the checkbox for people who are not registered. Or add a link like "To save the payment method, please log in or create an account". It would otherwise be confusing, not knowing why the checkbox is disabled.
Comment: @Rhevan i think that's a good direction, only concern is that maybe after the payout i lose the user's attention and they might just close the confirmation screen. but i guess this is something to A/B test...
Comment: @Martin Yes, A/B testing is the best way to see if your user attention is lost after this step. But maybe check how Amazon does it for new accounts?
Comment: @Rhevan Amazon doesn't allow checkout as guest. eBay does, but i couldn't find online how an updated confirmation page looks like. I believe they don't give this option.
Answer: I prefer to put that at the end of the payment process.

For a new user, or for a user that has not saved the payment template, they know that the payment info that they input is correct and the payment success, then they can decide to save that payment info for later use next time or not.
For the old user who did save the payment info, if they would like to change any payment info, they can change and get feedback about their payment process (is it successful or not,....) before choosing to save or not save that change for next payment.


In what ways can I generate EU in feed the beast?

Question: Feed the beast has many different packs and settings, so for the sake of consistency we shall use the most common combination of core mods, Industrial Craft 2, GregTech, Buildcraft, Forestry, Minefactory Reloaded, and Thermal Expansion. With everything available to you from these mods, what machines generate EU?
Note: I'm not asking for all the different strategies available, rather I'm looking for a small list of the specific machines that generate power.
Answer: EU is implemented by Industrialcraft and is generated by so called "generators".

Generator
Geothermal Generator
Thermal Generator
Semifluid Generator
Diesel Generator
Plasma Generator
Water Mill
Wind Mill
Solar Panel
Nuclear Reactor
Fusion Reactor
Lightning Rod
Dragon Egg Energy Siphon
Magic Energy Converter
Steam Turbine
Gas Turbine

While there is a simple way to generate MJ from EU by just building a electrical engine and hooking it up to EU by some cables there is no simple solution to convert MJ to EU.
There are ways around this, like a magma crucible (using MJ) can be used to output lava from cobblestone. This lave can be used for your geothermal generators to generate EU.  Cobblestone costs 24000 MJ to concert to a bucket of lava in a magma geothermal generator this yields 20.000 EU, not bad. However if you use netherrack in your magma crucible to convert to lava this only costs 12.000 MJ, this is afaik the most efficient conversion there is.
With this setup you can basically generate/convert to EU with every possible way you generate MJ.
Comment: In the statement after the list, I think you meant to end with "MJ to EU"?
Comment: I'm going to leave this answer un-accepted for a short while (few days or so) as we continue to complete the list, but be assured your gonna get the checkmark. Thanks for all your help! :)


main.c:(.text+0x30): undefined reference to `reciprocal'

Question: I was trying the first program of Advance Linux Programming. Some other guys also felt this problem but reading those thread are not helping me. I tried also those methods but my problem is still there. Please help me.
Here is main.c
#include <stdio.h>
#include "reciprocal.hpp"

int main(int argc, char const *argv[])
{
    int i;
    i = atoi(argv[1]);
    printf("The reciprocal of %d is %g\n", i, reciprocal(i));
    return 0;
}

Listing reciprocal.cpp
#include <cassert>
#include "reciprocal.hpp"

using namespace std;

    double reciprocal(int i) {
        //I should not be Zero
        assert(i != 0);
         return 1.0/i;
    }

Listing reciprocal.hpp
#ifdef _cplusplus
extern "C" {
#endif

  extern double reciprocal (int i);

#ifdef _cplusplus
}
#endif

Listing Makefile:
reciprocal: main.o reciprocal.o
    g++ $(CFLAGS) -o reciprocal main.o reciprocal.o

main.o: main.c reciprocal.hpp
    gcc $(CFLAGS) -c main.c -I ../include

reciprocal.o: reciprocal.cpp reciprocal.hpp
    g++ $(CFLAGS) -c reciprocal.cpp -I ../include

clean:
    rm -f *.o reciprocal

The error is:
rajat$ make
gcc  -c main.c -I ../include
g++  -c reciprocal.cpp -I ../include
g++  -o reciprocal main.o reciprocal.o
main.o: In function `main':
main.c:(.text+0x30): undefined reference to `reciprocal'
collect2: error: ld returned 1 exit status
make: *** [reciprocal] Error 1

Comment: `_cplusplus` is not correct. http://coliru.stacked-crooked.com/a/35fd78f99bdb6fee
Comment: why not main.cpp? edit: Also I am not sure if function should be marked as extern, I think only variables can be preceded by that keyword
Comment: `#ifdef __cplusplus`
Comment: I also marked the function as extern "C", as explained in other thread, but the problem did not resolved.
Answer: You should have __cplusplus (the proper macro definition) not _cplusplus in your macro.

How to debug: find the undefined reciprocal in main.o:
nm main.o | grep reciprocal
                 U reciprocal

And look for it in your reciprocal.o:

With __cplusplus:
$ nm reciprocal.o | grep reciprocal
0000000000000000 T reciprocal
0000000000000020 r _ZZ10reciprocalE19__PRETTY_FUNCTION__

Without (with _cplusplus as your wrote it):
$ nm reciprocal.o | grep reciprocal
0000000000000000 T _Z10reciprocali
0000000000000020 r _ZZ10reciprocaliE19__PRETTY_FUNCTION__


How do you determine how much electricity is used by a device?

Question: How does one go about determining how much electricity is used for a particular device?  Where can I find the wattage ratings, and how do I calculate the cost based on my current electricity rates found on my monthly bill?
Specifically, I have a computer that I am debating how to leave it on a regular basis.  I wonder how much it costs in each of the following scenarios:

Leave my computer in standby mode.
Leave my computer in hibernate mode.
Turn off my computer but the cord remains plugged.
Comment: edited the question to make it broader and on topic - i think the process of finding the power consumption and calculating them are certainly home improvement
Comment: More appropriate for http://superuser.com/. It has nothing to do with home improvement.
Comment: See this question. http://diy.stackexchange.com/questions/1713/how-best-can-i-discover-what-is-up-with-my-electrical-bill
Comment: sorry, off topic my friend. better suited for the computer related stacks.
Answer: Sounds like you could use one of these...
http://www.amazon.com/P3-International-P4460-Electricity-Monitor/dp/B000RGF29Q/ref=sr_1_2?s=hi&ie=UTF8&qid=1294406639&sr=1-2
Then you could take this power saving feaver beyond the computer.
Comment: Yep... Kill A Watt meter is the most-used device for this purpose.
Comment: Yep, was about to post the same thing. Take different measurements for each scenario and plot it on a graph to see the difference over time.
Comment: I have used the Kill A Watt for several applications and it works well for rough estimates.
Comment: I used this to measure how much juice my fridge uses.
Answer: This will vary depending on the computer in question and your local energy cost.
Here is a table listing power consumption of a range of PCs.
So, for example, let's take the worst case shown on the table.  The IBM ThinkCentre M52 running Folding@Home with the monitor on pulled down an average of around 175 watts.
175 watts * 24 hours * 31 days = 130.2 kWh
Assuming a local energy cost of $0.15 / kWh would mean that it costs $19.53 per month to run a relatively inefficient computer at 80% CPU usage with the monitor on for 24 hours a day all month.
On the other hand, if the computer is drawing 1 watt while in the "off" state...
1 watt * 24 hours * 31 days = .7 kWh
At $0.15 / kWh, it will cost you approximately $0.11 / month to have your computer off (but still plugged in to the wall).
Of course, you will likely not find your specific setup in a table of power values (and even if you did, you cannot be sure that it will match your specific setup).  If you want to find out the real numbers for your setup, you can purchase a power usage meter (e.g. Kill-a-watt).  That info, along with your cost per kWh, will give you what you are looking for.
If you are looking for just a generalized answer, then my speculation would be:

Leave my computer in standby mode. - Moderate
Leave my computer in hibernate mode. - Very little
Turn off my computer but the cord remains unplugged. - Very little
Answer: I've got a clamp-on Hall Effect Ammeter that I use with an A/C line splitter to do that.  If you've got any electrician (or even computer nerd) friends, odds are good that they have one you could borrow.  Or, you could pick up one of those "kill-a-watt" type devices at a local store.


minecraft launcher 1.3.7 problem

Question: <code>[16:33:33 WARN]: Couldn't download https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.1-nightly-20131120/lwjgl_util-2.9.1-nightly-20131120.jar for job 'Version & Libraries'
java.net.SocketTimeoutException: connect timed out
    at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) ~[?:1.7.0_40]
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.7.0_40]
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.7.0_40]
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.7.0_40]
    at java.net.PlainSocketImpl.connect(Unknown Source) ~[?:1.7.0_40]
    at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.7.0_40]
    at java.net.Socket.connect(Unknown Source) ~[?:1.7.0_40]
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source) ~[?:1.7.0_40]
    at sun.net.NetworkClient.doConnect(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.protocol.https.HttpsClient.New(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:1.7.0_40]
    at java.net.HttpURLConnection.getResponseCode(Unknown Source) ~[?:1.7.0_40]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source) ~[?:1.7.0_40]
    at net.minecraft.launcher.updater.download.ChecksummedDownloadable.download(ChecksummedDownloadable.java:49) ~[launcher.jar:?]
    at net.minecraft.launcher.updater.download.DownloadJob.popAndDownload(DownloadJob.java:108) [launcher.jar:?]
    at net.minecraft.launcher.updater.download.DownloadJob.access$000(DownloadJob.java:12) [launcher.jar:?]
    at net.minecraft.launcher.updater.download.DownloadJob$1.run(DownloadJob.java:89) [launcher.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_40]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_40]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.7.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.7.0_40]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_40]
[16:33:33 ERROR]: Gave up trying to download https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.1-nightly-20131120/lwjgl_util-2.9.1-nightly-20131120.jar for job 'Version & Libraries'
[16:33:33 ERROR]: Job 'Version & Libraries' finished with 26 failure(s)! (took 0:00:50.083)
</code>
What can I do to fix this?
Comment: Are you getting this error when starting the Bukkit server or when you're starting the client?
Comment: when i start the Clinet
Comment: when i press " Play " Button it start loading and eventually nothing happen and  the game not start and the error come - if you press Development Console -
Comment: Wait, what version are you running?  Minecraft shouldn't be trying to download stuff minecraft.net, it should be trying to get it from an Amazon S3 instance.  That's probably why the socket is timing out.
Comment: @MBraedley isn't it the other way around? I thought Mojang ditched amazon's servers.
Comment: @aman207 you might be right.  I haven't stayed fully up to date with that stuff.
Answer: Restart your computer, close firewalls and then start Minecraft. That worked for me.

minecraft launcher 1.3.7 problem


Inserting time into database

Question: The below piece of code isn't working the way it is supposed to
$t = date('Y-d-m H:i:s',time());
$query = "INSERT INTO time VALUES('$t')";
if(mysql_query($query))
echo "Date and Time are added";

I have created a table named time with only one column now and DATETIME as datatype. Even though the PHP script executes successfully in the browser by printing "Date and Time are added".
The database isn't updating the way it is supposed to be. Rather than the current time, it gets initialized to default value.
Do suggest the way to rectify the problem.
Answer: You can use NOW()
$query = "INSERT INTO `time` (`now`) VALUES (NOW())";

Comment: Renamed the table as test and the query works good. Thank you. And when you say the 'Whole code' apart from code for connecting to database there is none to post.

can you do suggest the errors in the above code(ie using a variable)
Comment: Thank you for your time. Now the code works good. Naming the table as time might have been the problem.
Answer: Change the value of $t from
$t = date('Y-d-m H:i:s',time());

to
$t = date('Y-m-d H:i:s');

Even better method would be to write your insert query like this:
   $query = "INSERT INTO `time` VALUES ('".date('Y-m-d H:i:s')."')";

Answer: Try with this format
$t = date('Y-m-d H:i:s');
$query = "INSERT INTO time (now) VALUES('$t')";
if(mysql_query($query))
echo "Date and Time are added";

OR
$query = "INSERT INTO time (now) VALUES(NOW())";

Comment: Even After editing to YY-mm-dd it works the same way.
Comment: The piece of code with now() works good, yet the one with variable doesn't.
Comment: Have renamed the table and now the code works. Thank you for your help.
Answer: <?php

/* YOU NEED TO ESTABLISH FIRST A CONNECTION */

$con=mysqli_connect("Host","Username","Password","Database"); /* REPLACE THE NECESSARY HOST, USERNAME, PASSWORD, AND DATABASE */

if(mysqli_connect_errno()){

echo "Error".mysqli_connect_error();
}

$t = date('Y-d-m H:i:s');
$query = mysqli_query($con,"INSERT INTO time (now) VALUES ('$t')");
echo "Date and Time are added";

?>

Comment: please click the tick as the solution for you.
Comment: Thank you for your reply. I didn't post the connection code for security purpose. And after renaming the table the code works good.
Comment: @Darthstroke did my answer solved your problem? If it does, just tick that check on the side of my answer to mark my answer accepted. :)

Inserting time into database


core data with multiple NSOperation

Question: Can I have a single Private Managed Object context that is being accessed by Multiple NSOperation ?
I have 2 two options :

Have a managed object context per NSOperation.
i.e if there are 100 NSoperation 100 context will be created.
Have a single context and multiple NSOperation.

i.e Single Context and 100 NSOperations accessing it.
Which can be a better option.
Comment: What is the maxConcurrentOperationCount of your NSOperationQueue? Can your NSOperations be performed simultaneously? What is the amount of work that is done by single NSOperation (in amount of objects to be saved or in seconds to do its work)?
Comment: 1. maxConcurrentOperationCount is kept default currently.
2. What is the amount of work that is done by single NSOperation :- A single object is fetched from core data compared with server object which ever objects wins then based on it a that object and file is uploaded or downloaded and written to disk.
Comment: As you described, you don't save a bunch of new data into CoreData in the single operation. So you can have single context and fetch any object from it. To avoid problems with concurrency you can use performAndWait function.
Comment: ok, thanks sander so you are suggesting I can go with 2 option.  Many people suggest going with option 1 including Marcus Zarra, That never share context between 2 thread and child context are cheap. Use them once, then throw them away. I felt that this is over-head since am working with single object at a time. Am still not able to decide a better solution. can anyone shade some light just in case I misunderstood
Comment: Ok, I'll post my answer below so that you can look at it closer.
Answer: The correction solution is option 1.  Create a queue with a concurrency count of 1 and do all your writing with the queue.  This will avoid any write conflict which can lead to losing information.  If you need to access information for the main thread you should use a global main thread context (in NSPersistentContainer it is call viewContext).
If this is going to slow then you should investigate the work that you are doing.  Generally each operation should be pretty quick, so if you are finding that they are not you might be doing something wrong (a common issue is doing a fetch for each imported object - instead of one large fetch).  Another solution is to split up large tasks into several smaller task (importing large amount of data).  You can also set different priority - giving higher priority to actions that the user initiated.
You shouldn't  be afraid of creating contexts.  They are not that expensive.
Answer: According to what you said in the comments, that you didn't actually write lots of data in the single operation and just did a fetch for an object, I suggest using single MOC.
Usual reason to have multiple MOC is to read/update/save lots of data independently of Main context and of any other contexts. In such flow you would be able to save that objects concurrently from different contexts.
But it's not your case, If I understood correctly.
For the single fetch there would be enough just one Private context, however I believe there wouldn't be lots overhead in creating many contexts. But why to do extra work?
1.So, you create private MOC
let privateContext = NSManagedObjectContext(concurrencyType:.privateQueueConcurrencyType)

2.Create each operation and pass MOC
let operation = MyOperation(context: privateContext)

3.In the operation perform sync call to private MOC with function.
In such way you should avoid any concurrent problem with single MOC
func performAndWait(_ block: @escaping () -> Swift.Void)

for example
let myObject: Object?
privateContext.performAndWait {
     myObject = privateContext.fetch(...)
}
// do what you need with myObject

core data with multiple NSOperation


Proof : prime $p$ has the form $4n+1$ or $4n+3$

Question: I am looking at the theorem:
Let prime $p>2$.
$-1$ is a quadratic residue $\mod p$ if and only if $p \equiv 1 \pmod {4}$
$-1$ is a non quadratic residue $\mod p$ if and only if $p \equiv 3 \pmod {4}$
If $p=4n+1 : \left ( \frac{-1}{p} \right )=(-1)^{\frac{p-1}{2}}=(-1)^{2n}=1$
If $p=4n+3 : \left ( \frac{-1}{p} \right )=(-1)^{\frac{p-1}{2}}=(-1)^{2n+1}=-1$
But...,when $-1$ is a quadratic residue,how can I show that $p=4n+1$,and when $-1$ is a non-quadratic residue, how can I show that $p=4n+3$ ?
Comment: ok. That's better.
Comment: Firstly, you may want to try to prove by showing that it cannot be 2 or 4 $(mod4)$. Secondly, what do you want us to do with the arrow?
Comment: I mean that at the one case,when $-1$ is a quadratic residue,how can I show that $p=4n+1$,and when $-1$ is a non-quadratic residue, how can I show that $p=4n+3$ ?
Comment: but you asked about the arrow.
Answer: $-1$ is a quadratic residue iff there exists $x$ such that
$$
x^2\equiv -1\mod p\iff x^4\equiv 1\mod p
$$
iff order of $x$ in modulo $p$ is $4$. On the other hands, using FLT we have $x^{p-1}\equiv 1\mod p$ which implies $4|p-1$. So, $-1$ is a quadratic residue iff $4|p-1\iff p\equiv1\mod4.$
Answer: By the formula you gave, $1$ is a quadratic residue if and only if $(-1)^{(p-1)/2}=1$. This is equivalent to the fact that $(p-1)/2$ is an even integer, i.e.,
$(p-1)/2=2n$. Hence $p=4n+1$. Similarly, $1$ is a quadratic non-residue if and only if $(-1)^{(p-1)/2}=-1$, i.e., iff $(p-1)/2=2n+1$, i.e., iff $p=4n+3$.
Comment: @evinda: you are welcome, Evinda.
Comment: Nice,Dietrich.. I understand... Thank you very much!!!


General question about information a scheduler 'dashboard' should have

Question: Sorry for another non programming question, but I'm using Quartz.NET, a scheduler for .NET  applications, for a Windows Service which allows users to schedule transferrig of files that match a regular expression from various sources - for example the user may schedule a job to occur every day at 6pm that transfers the files from a network path to a FTP server.
The adding jobs and management is done using an ASP.NET project, and I'm creating a Dashboard to display useful info to the user. I have the following information on the dashboard so far:
Total number of jobs
Windows Service status
Time since scheduler active
I know it's a very general question, but what other snippets of info can I add to the dashboard, as it's very sparse at the moment.
Answer: I've worked as a product manager on a few schedulers.  Here are some common requirements for these types of things, but I urge you to talk to some target users to find out if they are applicable to your application.
The use cases:
1. Trying to identify if the jobs are running okay.
2. If jobs are not running okay, give the user clues as to the cause. Give user tools to debug and fix.
General requirements:
1. Table with info on last N jobs:
- Time started, time completed.  Status of completion (success / failure). Length of time. Any errors.  User who scheduled job. Any dependencies this job has on other jobs or other events. Specific machine the job ran on (if in a cluster).
Might be nice to include links in this dashlet that would allow you to cancel a job that might be hung.
Priority of the job (if you have priorities).

Compare all jobs: %succeed, %failure.  Avg time to complete job.
Compare jobs by the scheduling user:  avg time, %success, %failure.

This is by no means a comprehensive list or something.  Just my trying to give you a few ideas, based on what I can remember off the top of my head.
-


Should I assign dwellers to the storage room?

Question: I've played Fallout Shelter for a while now and normally use dwellers with appropriate SPECIAL stats for each room (Strength in the reactor, Perception in the water supply, etc).
However, I have a question regarding Endurance. The only room which uses this is the storage room. It doesn't produce anything; it has no cooldown; it just does nothing...
Even if I just build and upgrade the warehouse, my stock capacity is increased. Is there any good reason for me to waste my dwellers by assigning them to storage rooms?
Comment: Regarding Endurance, that stat is also used by dwellers in the Nuka Cola Plants.
Comment: Well the roaches and the fire will disappear on it's own in those rooms. They will move to other rooms. But it won't hurt my stuff inside those warehouses.
Comment: Only reason is protection from fire/radroaches. Maybe, haven't tried, it will make them happier using their higher Endurance than other lower stats somewhere else.
Comment: Possible duplicate of [What is the point of dwellers working in the warehouse?](http://gaming.stackexchange.com/questions/242145/what-is-the-point-of-dwellers-working-in-the-warehouse)
Comment: Roaches can still invade rooms with people assigned to them. It's happened to me quite a few times, and like 2-3 today alone. One of the tips says that you can assign people to the storage room if you want to stash them somewhere temporarily, but you don't need them there for anything useful.
Comment: Ah I haven't the nuka cola plants currently. Thanks for this advice!
Comment: In addition to the obvious use of Nuka Cola bottlers, endurance is a relatively universal ability. While it won't improve your dwellers' job performance, it will help keep them alive, and thus is a very important skill for your explorers and for dwellers working near the vault entrance (and fighting lots of raiders/deathclaws).
Comment: @TheUnicornMaster What? This question comes way earlier and is better written imo. If anything, the other should be a duplicate of this.
Comment: Sorry, didn't see when it was posted
Answer: While the storage rooms do not produce anything, putting E type dwellers in them will raise their happiness, improving your average happiness rating and earning you more caps from your daily reviews. It will also count towards "Place # dwellers in the right room" objective.
Comment: Yes, their correct room is determined by their highest SPECIAL, so training them will change it.
Comment: Well currently I train them in S,P or A for the basic rooms and place them in there. This makes them happy too. So in fact, due to your answer, I just can ignore them and put them to the training and afterwards in the correct room too. Right? :-)
Comment: Yes I think this is the best answer. Currently I just have one dweller placed in them and the rest is training. I'm pretty sure I will get the last dweller also back in the training rooms. ;-)
Answer: There are no reasons for placing dwellers in the warehouse that are related to actual warehousing, however there are other reasons:

Dwellers with high endurance become happy from being stationed in the warehouse.
This is useful for doing something about all those 50% happiness dwellers on coffee brake; you can park them in the warehouse instead where they grow happy
It is also needed for high Endurance dwellers when you get the task to put X dwellers in the right room
Dwellers don't gain experience from being in the warehouse.
If you are training your dwellers to full endurance before you let them level, this is quite useful. It gives you more accessible place than the door queue to put your dwellers on "hold".
(Dwellers gain HP each time they level, and the amount of HP gained depends on the Endurance they have at the moment they level. Once they have levelled there is no going back, so you might want your dwellers to stay at level 1 until you have trained them to full endurance.)
Dwellers in a warehouse contain incidents in that warehouse.
For this reason alone it is worthwhile to have at least one dweller in every warehouse. The single dweller will contain the strength of the incident while you move other dwellers there to fully solve the incident.
The alternative is to place your warehouses deep down at the bottom of your vault and stagger them, so that incidents can't spread.
Also note in relation to point (2) that dwellers in a warehouse do gain a bit of experience from preventing incidents, but it is usually so rare for a particular warehouse to have an incident that it is negligible.
Comment: I posted this answer here: http://gaming.stackexchange.com/questions/242145/what-is-the-point-of-dwellers-working-in-the-warehouse before realising that that question was a duplicate of this one. Perhaps someone with sufficient karma could mark the duplicate?
Comment: I can flag it for you. But why do you think it's a duplicate?
Comment: The way I read it, the question here is: "Is there any good reason for me to waste my dwellers by assigning them to storage rooms?", the linked question is: "What's the point of having dwellers working in the warehouse?" But it's you with the karma to mark it, so you be the judge :-)
Answer: To all of that it has another purpose: more dwellers with a higher endurance in warehouse = more junk items from scrapping. I used to have the room empty and mostly I got nothing from scrapping weapons or clothes, now when it is full of high endurance people I got items from scrapping every time, so it seems like a big difference. If you are scrapping at all of course.
Answer: If you put a dweller in the storage room with higher endurance stats than the rest, nothing will happen. Their happiness won't increase more than any other room, so just train their strength or agility.
Answer: The warehouses are for those who needs protection. When there are roaches and fire, the people in your warehouse are safe from danger. It will make them happy.
Comment: Living quarters can have roaches and fire just like any other room.
Comment: This means if I have pregnant wives, they'll run to the warehouse?
Fire and roaches appear in the warehouse too, what about that?
Comment: The living quarters provide protection from incidents, not the warehouses.


Where can I find a Meteor Strike skill book?

Question: I'm trying to get the Meteor Strike skill. So far I haven't looted one, and none of the spell vendors seem to sell it.
I've heard people claim that the vendors in Silverglen sell it once the characters reach level 16, but that doesn't seem to be true.
I'm currently in the Phantom Forest region, completing the Hunt in Hunter's Edge quest. My characters are around level 17. I'm playing the Enhanced Edition on PS4
Answer: Are you sure your characters are level 16?
All magic/skill book vendors should be selling it upon being level 16.
You should be able to find the books at Silverglen inn (a bunch of vendors sitting together), the pyro elemental in your Homestead or Arhu (2nd floor of legion HQ)
You need Pyrokinetic level 4 to use it. It will cost +2 AP for each level below that. It is also recommended to have 12 intelligence, each level below will reduce the status effect chance by 10%.
Note: In this game, the skill book itself is called "Meteor Strike" but the skill is Meteor Shower.
Comment: I just checked; all of my characters are level 17, one of them has Pyrokinetic level 5. Neither Arhu nor the vendors in Silverglen (Hassar is the one who sells pyro books) have the book, however, the fire elemental in the homestead does. I don't know if this is somehow irregular, but I'll mark this as the correct answer, since it led me to the right place.
Comment: I'll double-check again later today with all my characters and the various vendors. Please note that the first link you provided refers to Divinity Original Sin 2.
Comment: You're right, I updated the link and level information. The locations should still remain the same - your best bet is just going to the fire elemental in homestead
Comment: The other two might just be chance, it's been a bit since I played this one. I do remember the Homestead elementals always having almost all of their respective skill books all the time.


What is the relation between the gradient and the Jacobian matrix here?

Question: For $f:\mathbb{R}^n \rightarrow \mathbb{R}$ and $g:\mathbb{R}^n \rightarrow \mathbb{R}^m$
$$
f(x) = \frac 1 2 \left\Vert g(x)\right\Vert^2_2
$$
How to show that
$$
\nabla f(x) = J_g(x)^T g(x)
$$?
Answer: \begin{align*}
f(x)=\dfrac{1}{2}[(g_{1}(x))^{2}+\cdots+(g_{m}(x))^{2}],
\end{align*}
so
\begin{align*}
\dfrac{\partial f}{\partial x_{i}}(x)&=\dfrac{1}{2}\cdot2\left[g_{1}(x)\dfrac{\partial g_{1}}{\partial x_{i}}(x)+\cdots+g_{m}(x)\dfrac{\partial g_{m}}{\partial x_{i}}(x)\right]\\
&=g_{1}(x)\dfrac{\partial g_{1}}{\partial x_{i}}(x)+\cdots+g_{m}(x)\dfrac{\partial g_{m}}{\partial x_{i}}(x),
\end{align*}
the rest is just writing down the big matrix.
Comment: Ah, thanks a bunch! Writing out the sum from the norm definition definitely helped, I also did that just now. However, I can't edit your answer because I need to edit a certain amount of characters, but you're missing the index 1 at $$ g_1(x) \frac{\partial g_1}{\partial x_i}(x) $$.
Answer: It is an application of chain rule. Let $\varphi: y \mapsto (\sum_{1}^{m}y_{i}^{2})/2$; then
$$
f: x \mapsto g(x) =: y \mapsto \varphi(y), \mathbb{R}^{n} \to \mathbb{R}.
$$
So,
given that the conclusion of your interest takes that form, we have
$$
\nabla f(x) = (\nabla \varphi(y)' Dg(x))^{\top} = ((y_{1}, \dots, y_{m})Dg(x))^{\top} = Dg(x)^{\top}g(x).
$$
Answer: Write
$$
f(x) = \frac12\left\Vert g(x)\right\Vert^2_2 = \frac12\langle g(x),g(x)\rangle.
$$
and apply Frechet derivative for bilinear map.


Tooltip NVD3 AreaStackChart

Question: How do I add sufix 'USD' depending on key type 'Spent', on tooltip as well as on yAxis?
And also I want the view should show only Impressions by default, but on click of other legend, suppose I click on Clicks or Installs or Spent, only the selected legend data should be visible on the graph.
Data:
<code>[{"key":"Impressions","values":[[1405535400000,15132],[1405539000000,15216],[1405542600000,14385],[1405546200000,11291],[1405549800000,10798],[1405553400000,10460],[1405557000000,12787],[1405560600000,15948],[1405564200000,18891],[1405567800000,15536],[1405571400000,14793],[1405575000000,16771],[1405578600000,16441],[1405582200000,18943],[1405585800000,15560]]},{"key":"Clicks","values":[[1405535400000,137],[1405539000000,6],[1405542600000,13],[1405546200000,49],[1405549800000,33],[1405553400000,97],[1405557000000,50],[1405560600000,17],[1405564200000,181],[1405567800000,35],[1405571400000,107],[1405575000000,17],[1405578600000,7],[1405582200000,143],[1405585800000,96]]},{"key":"Installs","values":[[1405535400000,0],[1405539000000,0],[1405542600000,1],[1405546200000,3],[1405549800000,0],[1405553400000,7],[1405557000000,2],[1405560600000,0],[1405564200000,11],[1405567800000,2],[1405571400000,3],[1405575000000,1],[1405578600000,0],[1405582200000,9],[1405585800000,3]]},{"key":"Spent","values":[[1405535400000,0.01],[1405539000000,0.46],[1405542600000,0.22],[1405546200000,0.93],[1405549800000,0.17],[1405553400000,0.22],[1405557000000,0.8],[1405560600000,0.63],[1405564200000,0.34],[1405567800000,0.8],[1405571400000,0.07],[1405575000000,0.17],[1405578600000,0.43],[1405582200000,0.97],[1405585800000,0.19]]}]
</code>
Code:
<code>function kMFormatter(num) {
if (num > 999) {
    if (num > 99999) {
        return d3.format(',.2f')(num / 100000) + ' M'
    }
    return d3.format(',.2f')(num / 1000) + ' K'
}
return num
}

function defaultChartConfig(container, data, useGuideline) {
    if (useGuideline === undefined) useGuideline = true;

if (typeof d3 !== 'undefined') {
    var colors = d3.scale.category20();
    keyColor = function (d, i) {
        return colors(d.key)
    };

    var chart;
    nv.addGraph(function () {
        chart = nv.models.stackedAreaChart()
            .useInteractiveGuideline(true)
            .x(function (d) {
                return d[0]
            })
            .y(function (d,key) {
                return d[1]
            })
            .color(keyColor)
            .transitionDuration(300)
            .showControls(false);

        chart.xAxis
            .tickFormat(function (d) {
                return d3.time.format('%X')(new Date(d))
            });

        chart.yAxis
            .tickFormat(function (d) {
                return kMFormatter(d);
            });

        d3.select('#' + container + ' svg')
            .datum(data)
            .transition().duration(1000)
            .call(chart)
            .each('start', function () {
                setTimeout(function () {
                    d3.selectAll('#d3_chart2 *').each(function () {
                        if (this.__transition__)
                            this.__transition__.duration = 1;
                    })
                }, 0)
            })

        nv.utils.windowResize(chart.update);

        return chart;
    });

   }
}
</code>
Comment: To change the tooltip have a look at [this answer](http://stackoverflow.com/questions/16860138/how-to-display-the-percentage-on-a-nvd3-pie-chart?rq=1)
Comment: I could able to manipulate the core nvd3 library and got the tooltip functionality done. But I am not yet able to do the second functionality.
Comment: Could you put your code in a [Fiddle](http://jsfiddle.net/), so someone could have a look.
Comment: link to code http://jsfiddle.net/69AtH
Comment: The default behavior of NVD3 legends, when double clicking one,
is to set all other series to false, and make the double clicked series enabled. So only the selected legend data will be visible on the graph on dblclick event.
Answer: As I've mentioned in my comment above, the default behavior of NVD3 legends, when double clicking one, is to set all other series to false, and make the double clicked series enabled. So you'll need to override the legend's onclick event handler in order to make the second functionality work:
<code>        d3.selectAll('.nv-series').on('click', function(d,i) {
           dispatch.legendDblclick(d,i);
           data.forEach(function(series) {
               series.disabled = true;
            });
           d.disabled = false;
           dispatch.stateChange({
              disabled: data.map(function(d) { return !!d.disabled })
           });
           chart.update();
        })
</code>
Complete example is here

Tooltip NVD3 AreaStackChart


Remotely access mysql db on vm from windows as host

Question: I have ubuntu on vmware. I've installed mysql-server on it. And now I'd like to connect to this db directly from the Host(windows) machine. Ubuntu is connected to the router via bridge. I can ping it and have remote access to system. But I want to connect to the database only. How do I do this?
Comment: Please tell us about your setup. Does the VM have internet access? How have you set up its network card? What is its IP? How exactly do you want to access the DB? Using what tools? Imagine you know nothing about what you're doing, would you understand this question?
Comment: Yes, it has. I set it up as a brige. VM machine has his ip adress. I'd like to get acceess to db via commmand promt
Comment: OK, please [edit] your question and include this information. Preferably also add a screenshot of the VM's network settings. Tell us if the IP is in the same subnet as the host, tell us if you can ping the guest from the host, what commands you tried and how they fell.
Comment: possible duplicate of [MySQL server not accessible from remote machine](http://askubuntu.com/questions/159053/mysql-server-not-accessible-from-remote-machine)
Answer: You should allow remote access to mysql from command line inside your virtual machine (assuming you don't have any gui tools to connect to mysql like phpmyadmin and mysql-workbench)

as root, open your /etc/mysql/my.cnf with your favorite editor
look for the [mysqld] section, and in there for the bind-address keyword. This usually is set to 127.0.0.1 -- change that to match your "normal" IP-address
save the file, and reload the service (e.g. using service mysql restart)

Remember you must enable your remote users to access their database(s) from remote, by setting the appropriate GRANTs -- e.g.
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';

Note the @'%', which means "from any host".
Comment: @nikgul please mark it as answer
Comment: Possibly related to [this question](https://stackoverflow.com/questions/16954395/how-to-connect-to-a-mysql-server-running-on-a-virtual-machine), which says to set the `bind-address` to `0.0.0.0`


What are the criteria for re-combining?

Question: After you launch half your mass, it seems that you can't immediately re-combine your separate masses into one bigger cell.
Is this based on some amount of time, or some other criteria? Exactly what do I have to do before I can re-combine back into one big mass?
Comment: I've noticed that larger cells seem to take longer to recombine. I may try different movement patterns with cells of the same size to see if it affects how long recombining takes.
Comment: Yes, well, clearly you should move in such a manner that the larger cell is ahead of the smaller cell so the smaller cell will overtake the larger cell and  merge.
Answer: The time to recombine is based on the size of the offshoots. When the cell is split, every individual cell has a timer storing how long until they are able to recombine. There may be a component that if you have cells much smaller than your largest cell the timers for the small cells are reduced.
Edit:
So having looked through the source code at the link @BitCoder provided, I had it partially correct. The server has a base recombine time, currently 30 seconds. When a new cell is created (either via the player splitting, or running into a virus), the server sets the recombine time to be:

30 sec + (.02 * mass))

In summary: the recombine time of each cell is thirty seconds plus one additional second for every 50 mass the cell has when it is created.
Comment: How long is the timer? What's the formula?
Comment: I don't think the source code is public, so this information is just from a number of hours of playing the game. Only hard number I know about the game is that a mass of 130 is the size that activates the virus balls.
Comment: An interesting idea might be to go into settings (the gear icon before you start the game, or in the 'escape' dialog during the game (which will likely get you killed)) and turn on the 'show mass' checkbox, and then split and time it.  With a graph of the data we could probably figure out the algorithm.  One question might be whether splitting into four 100-mass balls has the same recombine time as splitting into two 100-mass balls.
Comment: @Dead I believe that the server source code can be found here: https://github.com/forairan/Ogar. And size 125 activates green viruses. 200 for red viruses.

What are the criteria for re-combining?


iOS, Android, Blackberry etc, which of the mobile OS is the most hacker-friendly?

Question: I'm a developer and I have the desire to do everything technically possible with my mobile device, such as programmatically placing calls, programmatically deciding whether what to do with an incoming call (hang up, divert to voicemail, play an automated message etc), programmatically sending text messages, accepting push notifications from my own servers, allowing me to read data from the GPS device, periodically taking pictures, running my own programs without making them to the app store, etc...
Which of the existing mobile device platforms has the most liberal and feature-complete API that may allow some of the above? Good documentation would be a plus :=)
Answer: If you feel hackish in anyway and your only purpose is to taylor YOUR phone the way you want without feeling the need to make your hack-thingie available into an appstore...then the answer is easy :
Android.
The documentation is poor, badly written, the apis are full of little annoying bugs and all that BUT : Whatever you don't find in the official API's you can hack by forking your own Android.
For example none of the mobile frameworks allow developers to send audio to a caller during a call. I personally cannot see the reason but you just can't. Fork your Android, add the missing bits and off you go.
Comment: Most Android phones are closed and you can only upgrade using a signed binary, but the Google Nexus (the first one) is open in any way. No problem with compiling your own Kernel and uploading it to the device.
Comment: actually, rooting any android device allows you to put your own ROM (self built android) onto it. That's why most people do it.
Comment: Android is open and as far as i understood the TOS rooting an Android phone or tablet is legal and should not void your warranty...at least in the US. see : http://www.google.com/support/forum/p/Google%20Mobile/thread?tid=19e05c1159ef7f77&hl=en .  You can also root any tablet provided you find the right toos : see galaxytab : http://www.addictivetips.com/hardware/how-to-root-samsung-galaxy-tab-with-superoneclick-rooting-app/
Comment: Can I load my own version of Android on an Android phone/tablet? If that depends on the particular model, do most devices out there allow that? Are the compiler tools generally available?
Comment: @JustSid: Thanks. What about tablets?
Comment: Thanks everyone. It's unfortunate that the question has to be closed.


Why doesn't the "watch" command work on an alias?

Question: So I've made my customized alias command and tried to use it with alias, but my alias was not recognized while concatenated with the watch command.
So I tried to make a thread of it and fortunately, this one helped me out.
But what is the reason for this?
I've created an alias in my .bashrc which works perfectly fine.
alias gpu='sensors nouveau-pci-0100'
alias cpu='sensors coretemp-isa-0000'

and when I concatenate watch and gpu like this:
watch GPU

I get this below every 2 seconds:
sh: 1: gpu: not found

And I solved it regarding the mentioned thread above like this:
alias = watchh='watch '
watchh gpu

But why does this happen? Why can' It use my surely defined alias command?
My guess is it is something about the user because I've gone root once and I couldn't use my alias but I surely need an expert to answer this.
Answer: It's nothing to do with users.
Aliases are only expanded in the interactive shell for which they are defined - so an interactive bash shell if you defined them via ~/.bashrc, or an interactive zsh shell if you define them in ~/.zshrc for example.
The watch command invokes commands via a non-interactive /bin/sh shell.
By aliasing watch itself, as alias watchh='watch ' (with a trailing space) and then using watchh gpu, you force the current interactive shell to expand gpu before it's passed to watch.
Note that in zsh, aliases may be defined as global which allows them to be expanded anywhere in a command - avoiding the need to alias watch with a trailing space.
Comment: You can name the alias `watch` without the extra `h`. I also do this for `sudo` in my .bashrc.
Answer: The watch command does not locate aliases, only commands in your search path. As an alternative, define gpu and cpu as shell scripts instead of aliases and place them in your search path. Then your watch gpu and watch cpu commands will work fine.
For example, if $HOME/bin is a directory in your search path, create a file $HOME/bin/gpu containing the line:
sensors nouveau-pci-0100

Make the file executable:
$ chmod +x $HOME/bin/gpu

and you're ready to go!
$ watch gpu

Then do the same for cpu.
Comment: @YoloWex is something stopping you from making one?
Comment: That seems legitimate dude but there is no ```/bin``` inside my home directory. if you meant ```~/bin```  by ```$HOME/bin```
Comment: @YoloWex: Yes, `~` expands to `$HOME`, your home directory.  The default .profile scripts on most systems will add that directory to your `$PATH` if it exists.
Comment: @hobbs I tried making one and followed the instructions and it WORKED. Thanks
Comment: I'd suggest `~/.local/bin` instead, for consistency with the [XDG base directory specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html), but it doesn't _really_ matter.


How to contact a user to let them know their suggested edits are partially wrong

Question: I've seen a lot of suggested edits in the queue over the last week (all from the same person) that have removed the term 'Drupal 7' from the post body and instead added it the 7 tag. And we all know how wrong that is! ;)
In nearly all cases the rest of the edit is perfectly valid, so I can't really reject it. This leaves only the option to improve the edit; remove the tag, and insert the text back into the post.
However, that's getting a bit tedious. Since there's no mechanism for me to get feedback to the editor to tell him what he's doing is wrong, this is just going to keep happening over and over.
What do we do in these situations? What is the right method to get in touch with the user to politely ask them to stop doing this?
Comment: Against my better judgement I've just rejected 3 of these otherwise fine edits with a custom rejection message asking the user to stop...but I'd still like to know what the proper thing to do in this situation is
Answer: There are two ways to give a feedback to who suggested an edit:

you reject the edit using a custom reason
you accept the edit as it is, and then you write a comment for that post @-referring the user who suggested the edit

In the first case, the message will be read from the user if the user looks at the page showing the suggestions he made, and clicks on the "suggested edit" link shown in that page.

It is probable a new user will not read that page, and check the feedback received for the suggested edits.
In the second case, the @-reference works for the users who edit a post. Keep in mind that the username is not auto-completed as when you reply to a comment given from a user for the same post, and you should use at least three characters from the username (excluding spaces and other characters).
Suggested edits are considered invalid also when a part of them is invalid, such as when the user keeps adding views to questions just because an answer is suggesting to use the Views module. In that case, you have two possibilities:

you reject the edits, until the user is not anymore allowed to suggest edits for seven days
you improve the suggested edit by removing the unwanted tag, or the part that keeps added to the posts

In the first case, the user could notice the suggested edits are not anymore possible, and ask a question on this very site; at that point, the user will get an explanation of why the suggested edits have been rejected, and learn what edits should be done.
If you see you keep improving edits from the same user to remove the same part added to the posts (e.g. a tag, a link, a phrase), and you tried to advice the user about what should be edited, then you could consider rejecting the suggested edits. If the user is not checking if the edits are welcome, you would keep improving edits until the user doesn't understand in which way the posts should be edited.
Comment: You da man! Seriously, thanks for always going into so much detail with these things; I'm very grateful and I'm sure others are too :)
Comment: Oh, and a large lol @ the giant S. I'm just off to report a few pluralization bugs myself...;)


Can we tag a location in No man's sky?

Question: Yeah, tagging a location so we won't get confused while flying within atmosphere of any planet. Unlike other open world games; NMS has no map (obviously, It's a procedural generated world). Still we find places like Monolith, Colonial outpost,  Transmission, Shelter. Once, we find multiple places, can we tag them? for better understanding? It's always confusing to remember while flying which place is visited and which is not. I often visit same place by mistake. haha. Thanks.
Answer: Not in the traditional sense, like in MGSV, but Polygon says

Using your Analysis Visor, you can scan buildings and structures. Doing this will put a white dot above them on your screen and make them show up as a waypoint both on your minimap and on your HUD.
This tagging process isn't permanently visible. Your tag seems to have a range of about six or seven minutes worth of walking distance, so it's a good temporary solution to help you with a limited task, but don't rely on it for a cross-continental journey. Once you're back in range, the tagged building will show up again, though.

I'm afraid this is the closest thing.
Comment: It bugs out, I've placed 1 point on a tradepost went to scout something. Then on flying back the waypoint was pointing to a whole different location, somewhere I haven't been too yet.
Comment: That "tagging" definitely is terrible. When you scan, you accidentally tag anything you see in the scanner. Even stuff miles away gets tagged, stuff I have not visited before. Also, the markers get lost when you save/load a game.
Comment: Its pretty bad. Agreed. Kind of another oversight in the game. Probably due to time pressures from Sony Is my guess
Comment: I think I read somewhere that a revamp of the current mapping system is in the works, so there may be still be hope.
Answer: Icons represent the waypoints that you have discovered. They float around your HUD. They seems to be the same but they are not. For exaxmple, you discovered a normal waypoint only for saving, and a waypoint that is for saving and trading. The icons are the same, but if you are standing faraway or driving your starship, the one with the word 'Terminal' under the time taken to reach destination is the waypoint with trade market, whereas the icon that only has the time is just a normal waypoint where you can only save the game. Just notice the words under the time. 'Depot' is where you get a lot of resource supply, but currently in my planet, I can only find a lot platinum in those depots. 'Drop Pot' is where you have...the drop pot for upgrading your exosuit; However most of the time, if you have used that drop pot, the icons will still show up. Google more about this to understand all the tag.

Can we tag a location in No man's sky?