Single or multiple process, what criteria decides it?

Question: In embedded systems using linux for an application; under which condition will you divide an application into two/three processes. My main doubt is; is it required to divide a single application component into multiple processes and then run multiple processes to achieve the required application functionality.
Answer: By experience I tend to isolate possibly problematic pieces of code. For example if you're depending on a sensor which ships with 3rd party libraries that you do not trust, making it a separate process will make your application more robust and fault-tolerant because you'll be (hopefully) able to restarts only parts of it.
Also for integration purposes it might be easier. Suppose your process A runs fine, then you can plug in the process B easily instead of adding new parts to process A. It might not seem like a big plus right now but it depends a lot on your project.
It does come with some overhead however, as dealing with synchronization and message passing can be more complicated and add to the design.
You don't have to do anything like that however.
Comment: My thoughts exactly (only better)
Answer: You don't tell much about the circumstances that led you to your question, so I can only guess what kind of answer you are interested in.
Linux offers multi-threading functionality since ages, so concurrent programming can be done without multiple processes.
There is rarely a functional reason to divide integral components of an application into processes.
My suggestion is to write a single-process application. Should the requirement arise, that is: a problem can only be solved by managing runtime resources in separate processes, you can still take on the heavy work of solving inter-process communication and resource sharing, without having to change much in your business logic.


Understanding the output of powertransform

Question: Working in a multiple linear regression setting I am attempting to fit a general model to a data set that consists of 7 predictor. To do so I have run the powertransform() function and received the output pictured. I am under the impression that the powertransform() function suggests transformation for the predictors. Under a single parameter transformation the general form falls into a box-cox transformation, does the form utilizing the suggested lambdas differ from that of the box-cox transformation when using the powertransform() function, further what can we concluded from the given output? I was under the impression, that if the values were close enough to certain values they could be rounded down or up.
Answer: My experience with the Box-Cox transformation, which I actually self-programmed into a spreadsheet, suggests first, use the indicated power (like 1.79), do not feel obligated to round.
The primary reason of suggesting rounding is to possibly explain the rationale of the transformation to others. Better is to focus on the best model fit and reverse transform the confidence intervals when done.
One can modify the transform to allow the addition of a constant to the data, which, at times, does assist in the model fitting exercise.
In addition to improving normality, it does appear in practice to also improve the homogeneity in the variance of the residues.
This online educational reference may be of assistance.
Comment: That was my major concern, the model before transforming was extremely normal, however upon applying the suggested transformation the model becomes not normal. Under this instance does it not seem that the powerTransform should not be applied?
Comment: Possibly correct, it depends on what also happen to the variance. More homogeneous variance can mean that the prediction error is probably more accurate. Loss of normality is more of a concern for the correct interpretation of significant levels.


What is a solid build order for use in ZvZ?

Question: I seem to be having more and more trouble in the Zerg vs Zerg matchup. I can't find a reliable, good, build order/ opening. What is an effective build order or build opening that I can use to safely progress in ZvZ?
Answer: 14 gas pool is my standard build for the matchup. The timings are actually pretty easy and if you miss something and notice quickly it still works out nicely, you can just get something else faster. It allows you to get a very quick speed up almost as soon as your pool finished and lets you safely take your natural expansion.

9 overlord
14 gas
13 pool
15 hatch
~16 Overlord

This counters an early pool pretty well if you just micro your drones around and delay. It gives you a timing window to hit against hatch first builds where you'll have speedlings for a while before he does, and you can exploit this to pick off drones, out of place queens, etc. If they start throwing down spine crawlers you can safely drone up and home and just scout to make sure he's not hiding any tech.
If he goes Banelings, go Roaches. You'll have to micro pretty intensely for a bit if you don't scout this ahead of time. If he goes Roaches, you can either defend on pure Speedling/Spines and tech to Mutalisks or go Roaches yourself. If you tech to Mutalisks you have to take 3-4 gas and do it quickly and preferably secretively or he'll have plenty of Queens/Spores/Infestors out in time to deal with it.
Example game: here. This is only against the very hard computer, but you get the idea. He goes for an early ling attack and kills a Queen, then I just contain him on one base until I have enough Zerglings to go for the kill. My teching to lair was a bit late.
It's by no means a professional build but it's a safe way to transition into a macro based ZvZ.
Comment: I typically use an opening very similar to this. However, the expansion comes alot later which I think is messing me up longer term. This may be the key! Thanks!


HP LaserJet - test page failed to print (after successfully printing it the first time)

Question: Trying to install drivers for HP LaserJet Pro M252dw. After initial setup, where everything went OK, and printing test page successfully, I'm unable to print test page again, or print from applications.
I think the issue started when I tried printing after installing driver and got popup to verify that my toner is genuine and refused to do so. I reinstalled the driver but I don't get the same verification prompt anymore. My toner is original HP toner that comes with the printer.
Then I tried HP Print and Scan Doctor, and it printed test page with no problems.
Then I figured out that the thing prints perfectly when I go to Devices and Printers / right click on HP Color LaserJet Pro M252 PCL 6 / Printer Properties / Advanced and choose Driver: HP Color LaserJet 2800 Series PS, which seems to be some sort of default Windows driver. Unfortunately, this driver doesn't recognize that printer can print in duplex, which doesn't work for me.
When I switch driver back to HP Color LaserJet Pro M252 PCL 6, one thing that I find curious is that under Printer Properties / General tab I see that paper available is Letter. The correct paper size should be A4, and it is under 2800 series driver which works.
I've tried changing paper size in all ways I could (in HP driver settings, on printer itself, through web interface) but it still says Letter in General tab. Could this be a culprit?
P.S. Printer is connected through USB.
EDIT: In the meantime, I uninstalled everything related to HP, including other HP network printer. Then I reinstalled driver from stratch - only driver, no other mumbo-jumbo like HP assistant and stuff. Now paper size is showing correct A4 size. The initial test page during driver installation printed fine. Printing from Devices and Printers or anywhere else in Windows still fails.
Answer: I contacted HP support and got an answer. The issue is with permissions on temp folder - it was not shared to "Everyone".

Open Devices and Printers and choose Security tab.
If Everyone is not on the list, click Add and enter the object name Everyone and click Check Names and then OK.
Check Allow for all permissions and click OK.

Do the same for Windows temp folder (C:\Users\User Name\AppData\Local\Temp and C:\Windows\Temp by default) through Windows Explorer (right-click the folder, open Properties and choose Security tab).


Where can the DNA splicers be obtained and how is it used?

Question: In Pokemon X/Y, where/how can you obtain the DNA splicers and how exactly do you use them?
Answer: The DNA Splicer can only be obtained after a few requirements are met.
•   You must have first beat the Elite Four and have gone to Kiloude City
•   You must have the Pokemon Bank app on your 3DS
•   You must have transferred over Kyurem, Reshiram and/or Zekrom from B/W(2) through the Pokemon Bank
Once you have completed these first steps, go to Kiloude City. Make sure you have Kyurem in your party. Go to the northwestern part of the city where there are 2 houses next to each other, go inside the one on the right. Inside there will be a "punk" looking girl. Talk to her and after a brief dialogue sequence, you will receive the DNA Splicer and will be placed in your key items bag.

To use the DNA Splicer:
•   Put Kyurem in your party
•   Put Reshiram or Zekrom in your party
Go to your key items menu and select the DNA Splicer, once you use it, it will ask you which Pokemon you want to fuse. First select Kyurem and then select the other legendary dragon in your party. Those 2 will start to show a little swirl icon and will be combined into one Pokemon. To get the Pokemon back to normal, you would simply just select the DNA Splicer from your menu again, and this time select only Kyurem. It will then un-fuse back to the original 2 dragons.
Comment: Very good answer, except for one thing. You don't _need_ to have pokemon bank if you have obtained the necessary pokemon through trading.
Answer: First, have Kyurem in your party and talk to the lady in one of the houses in Kiloude City, and she will give you DNA splicers. Afterwards click "use" on the splicers and click on Kyurem and then Reshiram/Zekrom.


Cannot get free apps from App Store after moving abroad

Question: I tried to load a free app, but as I have moved to Spain from the UK it wouldn't accept it. I had to change my Google password and I have tried to change my address from my iPhone but it won't let me.
Comment: Have you entered a valid cr dit card in your account and tried again? It might have nothing to do with countries and all to do with triggering a need for a correct and billable card for your account.
Answer: Often, if you can't download (even free) apps from the App Store, this is because your payment information is not valid (or no longer valid).
From the Settings app, go to the App Store settings, then tap on your Apple ID in blue at the top. After typing your Apple ID password, tap on Payment Information and make sure all the data is present, and correct.
Also - you had to change your Google password? I am confused by this ...
Comment: Usually you have to make sure your payment information is up to date after a credit card expires. However, if you restore from a backup you also have to check your payment details. I am not sure if moving country would also trigger it (I have lived overseas for longer than I have had an iPhone), but it's feasible. It's worth checking, anyway.
Answer: You mention changing your Google Password from your iPhone, so I'm not sure if you are really talking about your AppleID password (for the iPhone App Store) or your Google Play password.  My answer assumes you really mean the AppleID.
Apple has a separate App Store for each country.  Many apps are available at multiple App Stores, but some are limited to specific countries' App Stores.  To  use the App Store for a given country, you need to have a Payment Method for that country.  This can be a credit card, or an iTunes card specific to that country.  If you need to use an Apple Store in a country you aren't in, and don't have a credit card for, you can get a friend or relative to buy you an iTunes card and email you the code.  You may also be able to purchase an iTunes card for that country on eBay.  You CANNOT use an iTunes card from one country in the App Store for another country.
You can load apps from multiple AppleIDs (and thus, multiple countries) onto you iPhone at one time.  It's a bit of a pain, and best to keep one as your "main" AppleID and only use the other for apps that absolutely require it, or you'll end up being switched back and forth a lot and it gets messy.


A modern or near-future civilization without nuclear technology?

Question: Would it be possible for a fully modern civilization (i.e. quite like our own, perhaps slightly more advanced, with near-future tech) to arise on an Earth-like planet devoid of uranium, plutonium, thorium, or any other elements that could lead to the discovery/development of nuclear power or nuclear weapons?
Comment: is fission or A/M-Annihilation  okay, or do you count this to "nuclear technology"?
Comment: It is much easier to have a non-nuclear civilization than a fossil fuel free one.
Answer: Yes
When you really look at it, it seems most technologies present today don't take advantage of nuclear power or radioactivity. Sure, smoke detectors will not exist as they do here. There will be a part of their energy sector equal to about 11% that requires some other solution than the one we have found. In any case, it seems very little in the way of civilization has to do with nuclear weapons, radioactivity, and radioactive isotopes.
In short, a societies' infrastructure, medical care, food supplies, and popular philosophies will generally not care if every nuclear isotope was removed from earth, and will get along just fine. Whatever they do use nuclear radiation for, however, can be replaced. If those areas of expertise are not what you measure civilization by, I'm not sure how else to do it.
One can argue that their version of Japan would still fight tooth and nail in their WWII because no show of conventional force would convince them to surrender. One could also then argue that there would be no MAD doctrine which came out of their Cold War. One could argue that the absence of nuclear weapons would have help thaw the Cold War; we could at least fight each other like modern humans and kill each other off until the non-involved nations were suddenly the powerhouses. So yes, radioactivity had a decaying hand in our history, but many of the major technologies and philosophies we have which separate us from humanity past hardly rely on nuclear anything.
In short, these other people would also be missing out in the other two fundamental forces of the Universe, and some things wouldn't make sense. I see no reason why they wouldn't have similar technology and be just as "civilized" as we are. ("Civilized" being whatever measure you take to them except things directly related to nuclear activity!)
But Will They Discover Radiation?
They simply need to figure out what is powering the sun. Some bizarre thing called "new-clee-air fuze-on"...
Really, though, there are plenty of isotopes of elements which are not heavy metals but are radioactive. (Such as the popular C-14!) Assuming none of these are present on this particular planet, that will make their version of the Curies happen somewhat later in their development. I predict they encounter radioactivity when they start sending things into space. At the very least, they'll figure it out when they see stars producing heavy elements from lighter ones.
Comment: `In short, a societies' infrastructure, medical care, [...] will generally not care if every nuclear isotope was removed from earth`, `How much of the knowledge gained from particle accelerators really filter down to the average person right now` Have you or any relative/friends of you have been cured from a cancer? Or just have any X-rays done?
Comment: They will still discover atoms and  electrons, they will still accelerate them and [shoot at other matter](https://en.wikipedia.org/wiki/Geiger%E2%80%93Marsden_experiment) without noticeable delay compared to our development, thus discovering atom nuclei and unleashing the development of particle physics. The difference will be mostly societal, without WWII and nuclear weapons, nuclear physics will get (much?) lower funding and therefore less possibilities to build large particle accelerators, which will significantly slow down the scientific development compared to 2nd half of 20th century.
Comment: @RadovanGarabík YES, but is the quality of particle accelerators really the true measurement of civilization? How much of the knowledge gained from particle accelerators really filter down to the average person **right now**? That's really the point of this answer; you can conceive of a very similar state of humanity to our current one without nuclear isotopes and the knowledge it brings.
Comment: My point was that discovering radioactivity is inevitable, and once there are particle accelerators, short lived radioisotopes could be produced and used much like in our world. Re knowledge: sufficiently miniaturized electronics (semiconductors) really needs quantum mechanical calculations, and to get sufficient information about QM element properties you need years and years of applied research.
Comment: @SJuan76 As I understand it, no cancer is ever cured, it simply goes into remission. Cancer is a jerk like that. X-rays don't come from nuclear sources, just electron beams, which nuclear isotopes could produce, but not needed to make such a beam. Once again, you can use non-nuclear treatments for cancer, such as chemotherapy. Yes, the contributions to from nuclear physics is real, and is important, but most people don't have cancer. Most technology we use isn't nuclear-isotoped based. If you feel my answer is dead wrong, answer yourself and let the votes speak.
Comment: Downvoting for the content about medical care.
Comment: @AndrewGrimm Think about it. Has a nuclear isotope recently prevented or treated an infection? No, that's what penicillin, antibiotics, and clean bandages do. Have we used radioactivity to sedate people? No, radiation is only an anasthetic when the person is dying from it. Radiation has very limited medical uses. Not that those uses are bad, but I'd rather lose radiation treatments for cancer than, say, antibiotics, germ theory, or the chemical background of medications.
Comment: @PipperChip losing nuclear would be bad for individuals, but not for civilization as a whole?
Comment: @AndrewGrimm what I'm saying is, *you don't need nuclear anything to get a civilization which has a very similar technology level to ours.* Yes, not knowing about nuclear stuff would be bad, but it's so bad as not knowing about germs or anything.
Comment: You could have X-rays and MRIs without nuclear technology, and radiation treatment for cancer (and in diagnostic imagery) is pretty state of the art and recently developed. In terms of scientific development another way to retard knowledge of nuclear stuff would be to have an eternal complete cloud cover like Venus as it was imagined before we knew it was a hell hole. If you have no astronomy observation until you have space travel, developments like general relativity and the discovery of nuclear fusion and even calendars and stellar navigation come much later.
Answer: Interestingly, I remember a short story, maybe written by Robert Sheckley (have to ask on the sci-fi sister site for identification, I think) where aliens actually stopped all sorts of radioactivity and nuclear reactions on earth. Unstable isotopes were rendered stable, no radiation, and so on and so forth.
Secondly, said aliens removed all knowledge about radioactivity and nuclear physics from earth, too, except from a select few.
While the overall changes in this world have been touched briefly, the biggest change was actually that one intended by said aliens, to deprive the humans of their weapons of mass destruction.
BUT...
While said world wouldn't have any nukes and the energy sector would be moving from fossil fuels directly to renewable energy sources - if they can commit themselves to the change - and applications of isotopes like medicine would be unthinkable, there is one bigger issue:
Vital parts of modern technology are based on quantum mechanics. Starting with simple LEDs, continuing with lasers up to any computer chip, many appliances vital to our living are developed on the knowledge of quantum states and quantum theory and its development was heavily influenced and spurred on by nuclear physics.
So, in essence, without any radioactive isotopes and nuclear reactions to study it would be very difficult to build the groundworks of modern or near-future civilization and maybe some handwaving is required for your people to pass over this lack of knowledge and develop their own version of quantum physics.


To locals without a tide chart, how surprising are tides?

Question: People have put a lot of work into predicting tides.  To a local, who knows the conditions of a certain area, are tide tables really necessary?  How surprising are the tides ever going to be to someone who's been sailing the same bay for decades?
Comment: I don't have a tide chart.  I'm never surprised by the tides.  When I go sailing, I might think "Hey, it's low tide".  But I'm not surprised.
Comment: Even non-locals who know about tides are not surprised. As Greg writes in his answer - they follow a predictable pattern. I usually spend two weeks at the beach every summer and basically after the first low/high tide on the first day, I'm calibrated and I know approximately when the next low/high point is and when the best time to go in the water is, etc. Usually the first afternoon I'm planning lunch time the next day around water time based on tides and weather.
Comment: @ToddWilcox Some places have a 5 ft tide and some have a 25 ft. and that can be surprising as a vacationer. But you do learn fast.
Comment: There are a few exceptions where tide-charts (or apps) are really essential. The North Sea is quite famous for [mudflat hiking](https://en.wikipedia.org/wiki/Mudflat_hiking). When you plan to walk from one island to the next, then you must not hit the rising water.
Answer: Tides are generally not surprising - they do not change much in amplitude from one day to the next, and the peaks happen slightly less than an hour later each day.
The amplitude of the tides mostly follows the phase of the moon. The highest tides happen on the full moon and the new moon, with slack tides in between.
Tide tables are useful for predicting what the tides will be months or even years in the future.
Comment: While this is true for most places, there are places with very non-obvious tide patterns dye to coast geometry, e.g. the cook strait and nearby waters in the Marlborough sounds.
Comment: @njzk2: Good point, they can be used to accurately predict flooding events if you know at what height flooding starts.
Comment: @whatsisname Locals would be well-aware of that.
Comment: @gerrit: they'd know that they can be unpredictable, but for most locals, thats about it. They wouldn't be able to tell you the times and behaviors off the top of their head. Even the ferry ship captains are sometimes caught off guard by the tidal flows. How would some random dude know better?
Comment: and also for having precise measurements of time and amplitude
Comment: @gerrit: then the answer to the question is "yes, all people who live near the coast are aware of the complexities of local tides and can predict them without reference to a tide table, even in the Cook Strait".
Answer: As someone that lives, works, and plays in a coastal area in Florida, I can say that I qualify as a local. The answer is nearly never. You would hardly ever be surprised by the tide. It becomes a lot like being surprised by the position of the sun. You may, on occasion notice it's later then you thought it was, but the "fact" that it's later isn't a big surprise. Tides are the same way. They don't shift around much day to day. So you may get taken off guard when you spend 8 hours doing a 2 hour task, but the fact that the tide has changed isn't really a surprise.
Now I say "nearly never" because there are three important times that I can think of where the need to be precise is so important that the water height at a given time can actually be surprising:

Storm (hurricane) conditions. Knowing when high tide is in combination with the storm's route can help you choose a better place to harbor your boat. Of course it's all guesswork, but if you have to harbor your boat in a storm, then being able to guess where can be important. The other side to this is that the answer is almost always Boat no go in storm, move boat out of storm path and with a week's worth or more of warning time, it's really not that hard to do.

Flood Conditions. After a storm, predicting flood conditions can be useful. Specially if you're in an area along an estuary. The difference in water height could be "a gap big enough to sandbag an area". Not specifically tied to boating but important nonetheless.

Areas that are impassable. There are a few areas that getting even a small boat in or out requires you do so at high tide. The small difference in draft can make the difference between bottoming out and a smooth trip. Usually if you use one of these places you know, (though I see a ton of people get stuck because they "follow the guy on front of them" without realizing his boat is sitting higher.) and it's not like the range is only a few moments. Usually it's a few hours on both sides of high tide.

So essentially, a tide table is mostly useless in local waters (for locals). Having a general idea about when high or low tide is - is useful, but you can almost always get that off the radio/TV/internet/whatever. If you're in local waters you're not likely to be surprised by the tide because it either doesn't matter, or it matters so much that your entire trip is planned around it. It's more likely you lose track of time, and thus get surprised (or stuck) because of that, than because you didn't know about the tides.
Comment: I does depend on your definition of "local" though.  Someone living just far enough inland to not see the sea all week would quite likely want to know before going to the beach at the weekend.  Then you either need a table or to work out the daily drift from last weekend properly - or get caught out. It's not just boaters - some beaches are much better/safer at certain states of tide, and birdwatching at the coast is often heavily tide-dependent (e.g. on a rising tide wading birds will be getting closer to where you might watch from)
Answer: As other have said, tides should not be surprising to locals, which makes sense as tide tables are not designed to be used by locals. They are intended for people a) to whom tides are important, that b) are not familiar with the local tides, and that c) intended to visit at some point in the future. Unless all three conditions apply, tide tables will be of little or no interest.


MapView leaves polylines on screen after removal

Question: I'm having some trouble with MKPolylines. Basically: I have a big thick purple (less detailed) polyline for a route overview, and a thin red (accurate) one for "focus" on a route. They, for the most part, are the same, but the red one follows corners more accurately, etc.
My problem is this: I start at the overview, then go into focus - replacing one of the purple polylines with a red one - and then go back to overview, which puts the purple one back, and then delete the route, which gets rid of the polyline altogether. When I follow this sequence of steps, part of the red polyline is left behind, until I zoom in or out, which refreshes the map tile. Note: once part of the purple polyline was left behind, but I haven't been able to reproduce that.
This seems like it must be a bug in MapKit, but I can't figure out a workaround for the time being. Has anyone else found this before? Any known workarounds?
Answer: Why not call
<code>[mapView setNeedsDisplay];
</code>
or
<code>[myPolyLineView setNeedsDisplay];
</code>
after removing it?


How to handle a question that was asked in good faith, deleted, and then vandalized while deleted?

Question: A user asked a question on a Stack Exchange site in good faith, but it was a very poor-quality question and ended up getting deleted by the community. Shortly after it was deleted, the asker edited it, replacing it with a rude/abusive screed, which then appeared in the "Undelete votes" list. What's the right way to handle this? It can't be "raise a rude/abusive flag on it", since you can't raise that flag on something that's already deleted, even if it wasn't deleted for that reason. My best guess would be "raise a custom mod flag on it", but that's what I did, and the result was "declined - flags should only be used to make moderators aware of content that requires their intervention".
Comment: @Catija Two things I wanted to happen: 1. Marking the revision as rude/abusive (although I suppose you could argue this is moot if you just roll it back). 2. Either warning or suspending the user who did it, as appropriate.
Comment: @DWRoelands The idea is that the asker can edit the question into better shape so that it can be undeleted, reopened, and answered.
Comment: What was your goal in flagging? What did you want the mod to do? I think you can still edit deleted posts yourself, yes?
Comment: @aparente001 Please do not edit spam. Likewise for rude/abusive/offensive content---unless your edit can salvage the post by simply removing the inappropriate content and leaving something reasonable, you should not edit. **If you're raising a red flag, you should not edit.**
Comment: @Catija Related question: do deleted posts still raise rollback war autoflags?
Comment: The first thing I do when I encounter something outrageous or egregious is prune it right down to the ground.  I delete all the offensive content -- the whole post in fact -- and put some dummy text in its place.  Then I make a custom flag and explain that it is spam and the question should be completely wiped out.  I don't know if that's officially what we're supposed to do, but it has worked fine so far.  I think moderators are glad when the community helps them detect such things quickly.
Comment: I'm curious about the use case for allowing edits to deleted questions.
Answer: I saw your custom flag. As I went to handle it, another moderator beat me to the punch. As you mentioned, that other moderator declined your flag, indicating that moderator intervention was not required. I did not understand that decline, and I thought that some action was required, so I went ahead and handled it as I normally would. There is, of course, no way that a flag's "declined" status can be retrospectively altered, so there was nothing I could do about that. I figured you would just get over it. :-)
In the future, I would certainly recommend a custom moderator flag for situations like this. Perhaps not for simple vandalism (it's ultimately a judgment call, but vandalism of deleted posts really doesn't hurt anything and may not even be worth moderator time to review), but certainly when someone decides to get rude/abusive. At a minimum, nonsense like that should be rolled back. In other circumstances, a moderator may even decide to reach out to the user with one of the canned messages reminding them of our Code of Conduct. (In this case, I did reach out to the user, and they responded favorably. It seems they were just frustrated.)
I have no idea if non-moderators can roll back edits on deleted posts. If so, I suppose you should have done that instead of raising a moderator flag. Either way, I suppose that is what the moderator who declined your flag assumed that you should have done. It is sometimes difficult to keep track of which flaggers have which privileges.
Comment: There is one thing I'm concerned about, though: if the author of the post rollback-wars on the deleted post, it may not trigger an automatic flag, so a manual flag may be necessary.
Comment: @sonic I don't know if it will trigger an auto-flag when the post is deleted or not. I would have no issues with a custom moderator flag in that case. I really think the decline in the case described in the question was incorrect. If you see something that you think is a problem, we do appreciate your bringing it to our attention, unless it is something that you can trivially fix yourself without requiring moderator assistance.
Comment: Yes, deleted posts can be edited by other non-moderators.
Answer: In The Tavern I suggested:

"Nice hack to edit and leave closed -- In Review Queue: click title, edit, back, and click leave closed; only related choice on menu was "reopen and edit" which wasn't what was needed.".

In this case replace the first occurrence of the word "edit" with "rollback".
Then simply roll it back and leave it deleted. That does the needed and retains your vote. It ought to have been rolled back before leaving it deleted when you return to the queue.


How to ping eth0 from eth1 on my linux machine?

Question: I have a linux machine with 2 ethernet ports(eth0 and eth1). eth0 is connected to a router which assigns it an IP address 192.168.1.2. eth1 is connected to a switch which doesn't have an IP. How do I ping eth0 from eth1?
Comment: could you explain why you want to ping one interface from another interface on the same machine?
Answer: You can use the <code>-I</code> parameter, eg.
<code># ping -I eth1 192.168.1.2
</code>
Comment: as the `#` suggests, one needs to be `root` to do that.
Answer: If your eth1 doesnt have an IP, it will not be able to work with IP traffic (and ping / ICMP is IP traffic). Did I misunderstood your problem ?
Edit : I am not sure that I understand your network. Could you send a schema ?
If I understood correctly, you ahve eth0 configured with DHCP and eth1 configured manually. Are you sure that the address you have on eth1 is correct ? If you configured it as 10.0.0.1, you need to have y router with an interface in the same subnet, and the router has to be configured to route trafic from your 192.168.1.0/24 to you 10.0.0.0/24 networks.
Comment: You understood my problem. I assigned an IP using:
"ifconfig eth1 10.0.0.1 netmask 255.255.255.0 up".
But still I can't ping.
Comment: You understood my network correctly. What happens if I configure eth1 as 192.168.1.254? What more should I do to make the ping work?


How to insert QChartView in form with Qt Designer?

Question: I want to add QChart to the form. But I can't find it in the Widget Box. So I created it in the code. How can I insert it in QWidget or QFrame or something else?
I want to set area of that widget in QtDesigner.
Answer: Option 1: Promoted
I suppose you mean inserting a QChartView, because QChartView inherits from QGraphicsView, this would be a good option, for this we do the following:

first add QT += charts in the .pro
place the QGraphicsView to the design.
Right click on the QGraphicsView and select Promote to...
When doing the above, a menu appears, in the menu it should be set in QChartView in Promoted Class Name, and QtCharts in Header file, then press the add button and finally press promote.

Screenshots of some steps:
[3.]

[4.1]

[4.2]

The same could be done using QWidget as a base instead of QGraphicsView.
Why is one or another widget chosen as a base?
It is chosen because Qt Designer through moc establishes certain properties by default, and if the widget does not have that method then it will not compile. as all widgets inherit from QWidget this would be the basis for any new widget to promote it in Qt Designer.
In the following link you will find an example.

Option 2: QtChart plugin
Another option would be to compile the QtChart plugin for QtDesigner, for it you must download the 5 files from the following link:

Then you execute the following:
qmake
make
sudo make install

At the end you can access QtCharts::QChartView in Qt Designer
Comment: Don't forget to call `chartView.setChart(chart)` in your code.
Comment: Great answer.  If using `CMakeList.txt` instead of `qmake` (.pro file), you need to add `Charts` as a Qt5 COMPONENT in the `find_package` (for example: `find_package(Qt5 COMPONENTS Widgets Charts REQUIRED`) and Qt5::Charts in your `target_link_libraries` (for example: `target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets Qt5::Charts`)
Comment: where to find .pro?
Comment: I'm on macos, I tried the option 2 (qt is installe via brew) and the plugin gets installed in `/usr/local/share/qt/plugins/designer/libqtchartsdesigner.dylib` I tried to copy the shared lib insto the .app : `cp /usr/local/share/qt/plugins/designer/libqtchartsdesigner.dylib /Applications/Qt\ Creator.app/Contents/PlugIns/designer/` but I cannot see in the designer part of the Creator. Any clues?
Answer: Let me add something here for the answer below (thanks for that!)
I had some additional steps for using
QTcreator 4.11.0

on
Ubuntu 20.04.3 LTS

First, you need to install not only package
qml-module-qtcharts

But also package
libqt5charts5-dev

Next, for "Option 1: Promoted" below you 1st have to use Button "Add" after entering
Promoted class name: QChartView

and
Header file: QtCharts

Then, you can select it from the "Promoted Classes"
Finally, QTCreator adds to your ui_mainwindow.h (e.g.)
#include <qchartview.h>

and uses
QChartView *graphicsView;

But it does not consider, that type QChartView is defined in "namespace QtCharts" in <qchartview.h>. Therefore, type QChartView is not found.
I fixed (hacked) this by adding a "Central.h" to #include for users as a 1st #include file, with content
#ifndef CENTRAL_H
#define CENTRAL_H

#include <QtCharts>
using namespace QtCharts;

#endif // CENTRAL_H


Is it possible to update an existing EC2 security group from CloudFormation?

Question: I have a manually created security group to access Redis, and I am creating a LAMP stack with AWS CloudFormation. I need to update the Amazon EC2 security group from Redis to allow access from this LAMP stack, but I want it to be updated through CloudFormation - is this possible?
Answer: Existing SecurityGroups can be updated using SecurityGroupIngress
For example:
<code>"SecurityGroupRedisIngress": {
    "Type": "AWS::EC2::SecurityGroupIngress",
    "Properties" : {
        "GroupId": "sg-123456789",
        "IpProtocol": "tcp",
        "FromPort": "6379",
        "ToPort": "6379",
        "CidrIp": "188.8.131.52/0"
    }
}
</code>
Answer: Yes you can update it. Make necessary changes to your cloud formation template and execute the below command with necessary template and parameter file or list of parameters.
Its always good practice to validate the template after making changes to your template using below command. Once the validation is good you can execute the update stack command.
aws cloudformation validate-template --template-body "file://mention_your_template_name (example.json)"
aws cloudformation update-stack --stack-name "Mention you stack name" --template-body "file://mention_your_template_name (example.json)" --parameters "file://mention_your_parameter_file or list_of_parameters (example_parameters.json)"
Once you have updated the template, open the aws cloudformation console and click on you stack and under it click on the resources console and watch out for the resources that you have updated.
you can modify any AWS resources in the template, but you need to be cautioned when you deal with the RDS or so...check for aws documentation as while updating the resources it will recreate those. Its recommended to take a snapshot for databases. But for security group its fine.


Updating Android Application

Question: a while ago I had a developer make an Android application for me. Now, there are some users reporting a bug. I've google'd a little and read something about a keystore. Is it possible for another developer rather than the original one to update this application?
Answer: Yes. Anyone can update this application of yours. The only and the most critical part of this, however, is, as you rightly mention, the keystore. You will need to sign the updated application with the same keystore as the earlier version. Google won't allow you to update the existing app in the Android Market if the keystore is not the same as the one used to sign the existing app.
So bottom line, if you have the original keystore, use it to sign the update regardless of who works on it.
Reference Link: http://developer.android.com/guide/publishing/app-signing.html

Updating Android Application


How often should clients look at the job site and talk to the contractor?

Question: During a major kitchen remodel that includes removing structural walls and pouring new foundation piers and extending the house, along with the typical re-plumbing and electrical work, how often should the client (me) be walking through the job site and talking to the general contractor? Should I ever be talking to the subcontractors, apart from being nice, or does everything go through the general contractor? What do contractors, and subcontractors, want from the client?
Answer: I'd be walking the site daily. This isn't a new building with major safety hazards. It's your home, and you should have free access outside work hours. Any hazards should be eliminated, marked, or secured by then.
I'd want to feel comfortable raising issues with the GC at his/her convenience. I'd recognize that my project is not their only one, and that they have limited attention split among several (or many) clients. Call or email and wait for a reply.
I would not address subcontractors directly other than sharing greetings in passing (while staying out of the way). That would be a violation of unwritten (or possibly written) protocol. You're paying your GC to do the negotiation and communication with the subs, and you'll cloud the water if you get in between. Also, as stated earlier, you shouldn't be on the job when they are.
My $.02, however biased it may be for having been both a GC and a sub as well as a customer at various times in life.
Other tips
Keep your crap out of the way. Few things frustrate a contractor more than having to work in confined spaces for no reason other than lack of consideration on the part of the customer.
Be courteous. The people working on your home will find it easy to not care about their level of quality if you give them reason. Conversely, treating them with respect is likely to earn extra care.
If you like, offer a cold drink or cookies or something now and then. This extends the being courteous thing to something approaching bribery, but really it just generates mutual good will. This is important when you're paying a pile of money for something you have to live with daily.
Comment: +1 I brought in breakfast sandwiches every day for my carpenters . They appreciated it, and all of them were onsite rather than one stopping for a breakfast run. I would avoid trying to instruct or guide a sub *unless* I saw something that seemed wrong (contrary to plans) and irrevocable, and then I *might* ask them to hold a bit until I could reach the GC (understanding I still paid for down time). Only invoked in emergencies.


How does Canonical report and transfer Software Center sales money to app developers?

Question: I would like to clarify some details of the derivation earned from the sale of application money. If I understood correctly, at the end of each quarter you will send us email to report the amount of earned us money. After that we will send you requisites on which you will send money by bank transfer. Am I right?
Answer: To clarify - Canonical will send a report within 30 days after the end of each quarter. Canonical will also send payment within 30 days after the end of each quarter (usually simultaneously - unless payment questions arise).
The TOS (click through agreement) states that Canonical will send a report, the developer will return a invoice, and Canonical will pay that invoice. This is the procedure, however Canonical has streamlined the process to what is stated above (send report, send payment immediately thereafter).
If a payment or report issue arises, you can reply to the report sender or contact me directly for resolution.
Answer: Citet from the Commercial Software FAQ:

Payment
How do I get paid for the sales of my application?
  Currently, we pay all publishers on a quarterly basis.
  Following publishing of your application we'll contact you for confirmation of
  your invoice details. We'll then pay you electronically, via bank
  transfer for PayPal, each quarter. In the future we'll introduce
  monthly automated payment.
How will I receive my money?
You'll receive an invoice and your payments on a quarterly basis.
  We pay the publisher either by electronic bank transfer or through
  PayPal. For Paypal payments we'll pay the registered address that's
  associated with your account in the Developer Portal.

So it seems to me that you will give the payment details directly following the publishing of the software. It does not seem like you give the details after each quarter report.
If you need more and official information, you might want to ask Canonical directly.


Is the use of checkboxes discouraged in mobile UI?

Question: See Google Material Design (http://www.google.com/design/spec/patterns/selection.html) where it is mentioned that "Using checkboxes (or custom analogs) to initiate selection is an explicit anti-pattern for mobile".
Comment: Wow. That's not a great example of good proofreading. The recommendations are quite unclear. Judging from the context, they're talking about selecting items for manipulation. Long-press isn't *the global gesture to select data* in other contexts. After all, checkboxes are still present in [List controls](http://www.google.com/design/spec/components/list-controls.html#list-controls-types-of-list-controls).
Comment: And I've never used (and would never think about using) a two-finger tap to select an item...
Answer: Material design doesn't discourage the use of checkboxes for mobile.
The link posted in the question refers to a specific use of checkboxes as a way of selecting items (eg an entire row, or a group of controls, or some text). Checkboxes are not good for that kind of interaction because it confuses the function of the checkbox. There are several reasons why:

You would be "clicking on one place to select at another place" which masks ux intent.
In mobile/responsive design you cannot depend on the area being selected being rendered continuously (eg a row may get wrapped) so checkboxes for selection leads to confusion.
It conflates the function of the checkbox with other normative uses for the same control (Ie tradition check-the-box control)

All other "conventional" uses of checkboxes are perfectly fine for mobile, and in fact checkboxes can be a great control for some mobile interfaces because of how compact and broadly recognized they are.
As a practical matter, checkboxes are among the worst rendered native html control in most browsers so if you do use checkboxes a styled control may be more usable for many situations.
Answer: I can only guess, but I think the intention behind this guidance is that Google wants to eliminate the ubiqitious appearance of checkboxes as first column in every table, for (single or multiple) selection. I would agree with the statement that this is an explicit anti-pattern for mobile (while it appears often on desktop designs).
As stated, first think about whether multiple selection is required. If it is not, don't use checkboxes at all, but directly select and/or act on the item. If multiple selection is required, show checkboxes only after the user indicated he wants selection (like long press, dragging, etc.). I've even seen tables with an explicit "Show checkboxes" button in the header bar.
Note that the guidance explicitly allows checkboxes in other contexts than selection (i.e., "The use of checkboxes in contexts such as [...] is entirely appropriate." So the formulation of the question in this generality here is not supported by the Google guidance at all.
EDIT: I think the reason for not showing checkboxes initially is that they take up space and add visual clutter to the design. So if multiselection (what checkboxes are needed for) is a rare use case, the designer can keep the design leaner for the more frequent use cases. For example, I've seen apps that have a trashbin  in the top right corner initially. Only if you press that, checkboxes appear on all table rows (requiring labels to shrink).
Comment: Can you please elaborate on "If multiple selection is required, show checkboxes only after the user indicated he wants selection (like long press, dragging, etc.)"? Why are you recommending to not show checkboxes all the time and make the user do something to see checkboxes.
Comment: In gmail app, the big circle acts as a checkbox. I can tap on multiple circles and the option in the header change accordingly. Honestly, for months I'd no clue that it was a checkbox. I always tapped on the mail subject and it opened. I may be one of those many dumb users ;) but I still feel that showing checkboxes upfront is better from user's perspective.
Comment: @PratapGadgil I've added a hopefully clearer explanation. And I wouldn't call any software user dumb. You may be inexperienced, but the designer's task is exactly to make the software usable for inexperienced users as well. The hard part (for the designer) is then to make expertise valuable as well...
Comment: I agree that it's upon the designers to make the design work smoothly for novice users, preferably without any training / hand-holding. I also observe a difference of interaction regarding desktop and mobile sites and both make perfect sense respectively. I am running some quick tests to see whether there's a common approach to this interaction.


What does it mean to say that a process is using 75% of a CPU's resources?

Question: I thought that a core was responsible for processing a single thread. Hence, what does it mean when one says a process takes up 75% of resources? Is that memory? Computing power?
Answer: Question

What does it mean to say that a process is using 75% of a CPU's resources?
I thought that a core was responsible for processing a single thread. Hence, what does it mean when one says a process takes up 75% of resources? Is that memory? Computing power?

Analogy
Let's use an analogy: imagine a an ambidextrous celebrity sitting at a table, signing autographs.
Technical Specifications
Here are the specs for the system (the signing event as a whole):

The celebrity (CPU) is signing autographs (doing work).
There is a line (queue) of fans (processes) who come up and ask him to sign (do work) photos, autograph books, shirts, bodies, etc. (memory, files, etc.)
The celebrity has and can write with both of his hands (cores).
Some fans are VIPs (higher priority) and so get to cut ahead in line and stay at the table longer.
Some are normal fans who stand in line for themselves (single-threaded) while some are "power users" like managers, and other business people  (multi-threaded) who have several assistants (threads) standing in line with publicity materials so that they can get more done at a time (have him sign with both hands instead of just one).
The celebrity's manager (scheduler) stands next to the table and decides when the celebrity has spent enough time on a fan and must move on to the next one.

Permutations
Now let's examine the different kinds of scenarios that can occur.
CPU Usage and Temperature
High Usage
If the line is short, then he works at a low rate (low CPU usage %) and does not get to hot because he doesn't move at his top speed.
Low Usage
If the line gets long, he has to sign things faster, up to the maximum speed he is capable of, to keep up (high CPU usage) and gets hot from the extra work.
Threading
Single-threaded
If a normal fan comes up to the table, he uses one of his hands to sign the photo for the fan and the fan leaves. If the fan wants more autographs, then he tries to accommodate, but if the line is too long, he apologizes and the fan has to go to the back of the line and wait for another turn.
Multi-threaded
If a power user comes up to the table, it is the exact same situation as with the normal fan, but because he is using both of his hands to sign, he can get more done before having to send the business person to the back of the line.
Priority
Normal
If a normal fan arrives at the signing, they have to get in line and wait their turn.
High
If a VIP arrives at the signing, they are allowed to cut ahead of the normal fans and wait closer to the table among the other VIPs. They may also stay at the table longer when they get there.
Low
If a "low-ranking/priority person" (celeb's assistant? employee? roadie?) arrives at the signing, they have to get in line, but allow normal fans ahead of them when they arrive. They also have to get rushed away to the back of the line much faster so that higher-priority people can get their autographs.
Application
So then, what happens in your given scenario of a process using 75% of the CPU?
Well, imagine a marketing executive from the celebrity's studio arrives at the signing with two assistants to get a whole pile of photos autographed to be given away at a publicity event. The executive is multi-threaded and high-priority.
The line isn't too long, so the celebrity is taking his time and casually signing.
The executive sends the two assistants into the line where they cut ahead to the front of the line and arrive at the table quickly. They plop their stack of photos on the table and the celebrity promptly begins signing away with both hands.
He ramps up his signing speed to accommodate the large amount of important work that must be done, but because the line isn't too long, he only goes up to 75% of physical ability (his maximum speed).
The assistants remain at the table for quite a while because they are important, but eventually the manager tells them to get back in line so that some of the other fans who have been waiting for a while get a turn.
Comment: @Fran, yes, it is difficult to completely make microscopic electrical concepts easy to visualize and understand. It is like using traffic or plumbing analogies to explain electrical potential, current, and resistance. It works for the most part, but the analogy can only go so far. If you have a better way of analogizing CPU usage percentage, please let me know and I will happily change it.
Comment: I would take issue with the phrase "he only goes up to 75% of physical ability (his maximum speed)".  A core always executes code at its maximum speed (though with dynamic clock stepping, that maximum can change over time, but that's not what you or the OP are talking about).  So when a core is being utilized at 75% of its capacity, it means that on average over the last few seconds of time, the CPU literally had no work to do 25% of the time (and in fact it halts on modern systems).  But when it did have work to do (the other 75% of the time), it did it as fast as it possibly could.
Comment: +1 for creativity, this gives a nice visual to what is actually happening.
Comment: @Synetech I don't think I could improve on your excellent analogy.  My comment above was merely a minor nit.  You did a fine job of explaining it in a non-technical way.
Answer: It is correct that one core can only process one task, this task is your operating system. It occupies the whole CPU, all the cores, but does not really use all of its power. This unused time is distributed to the operating systems child processes.
Here something comes into play that is called scheduler, there are different approaches how the scheduler divides the processing power for the different running processes.
For a start consider 100% CPU to be sliced into several equally large time slices. Now the scheduler assigns every process one or more of those slices in which it gets processed.
How many slices each task gets is chosen by how much the task actually used of the last slice and how reactive it has to be. If you have more than one core each core gets its own set of timeslices to distribute to the different processes. This is called Round Robin Scheduling (One of the simplest schedulers).
In reality this is far more complex, because processes have to react to real time events like a keyboard press (hardware interrupts) or program faults (software interrupts). But basically that is how it works and how the percentage of the time is measured.
Answer: This relates to the amount of CPU-time that your process is taking.
Multi tasking is accomplished by context-switching at a such a fast rate that the user feels that multiple programs are running simultaneously.
Now, for context-switching there are several alogrithms that define how much of the processor time is allocated to a particular process.
Give too little time to a process, and the context-switching overhead increases greatly, causing a lowly responding machine. A large time-slice, means one application is using a lot of the CPU-time while the others will be lagging and unresponsive.
The % of resources used is the amount of CPU-time being used.


Why are there delays and input issues when using my wireless keyboard?

Question: I booted up my Raspberry Pi for the first time and I plugged in my USB dongle for my wireless keyboard and mouse. It booted up fine but when I type keys either don't appear on the screen or they appear to stick.
Any ideas how to fix this?
Answer:
This is caused by inadequate power. Use a good power supply and a good
  power cable. Some cheap cables that work with a cell phone, cannot
  fully power the R-Pi. Some USB devices require a lot of power: most
  will have a label showing the voltage and mA requirements. They should
  be 5v 100mA each max, any more than this they must be used with a
  powered USB hub. Try unplugging every USB device except the keyboard
  (you should also note that some keyboards have built in hubs and can
  try to draw 150mA (Pi can only handle 100mA per USB slot without a
  hub)). Also, use the latest software. Forum user MrEngman reported
  some keyboard repeats and wireless hangs until upgrading to the
  debian6-19-04-2012 kernel, which he reports stable with no problems
  even with a low TP1-TP2 voltage of 4.65 - 4.68 volts.

From http://elinux.org/R-Pi_Troubleshooting#R-Pi_does_not_respond_to_key_presses_.2F_Keyboard_randomly_repeats_key_presses

EDIT There's a note further down that page about the exact keyboard/mouse you're using:

Some wireless keyboards, for example the Microsoft Wireless Keyboard
  800 are reported to fail even though the current drawn by the
  wireless adaptor is within the R-Pi USB spec limit of 100 mA. This may
  be a software driver problem.
Comment: I'd like to confirm that the issue *wasn't* my power supply but my specific keyboard. I replaced it with a different keyboard and it works perfectly.
Comment: +1 Interesting. I've seen another question like this, but this conclusion was not drawn.
Comment: Thanks - I don't have a high quality supply handy to test but I will track one down and update when I do.
Comment: Bluetooth keyboards typically use encryption to communicate.  Could this additional overhead be causing the bottleneck?
Answer: The link @Simon provided in the other answer contains very useful information about this issue. What solved the problem for me is the paragraph just after the one Simon have quoted:

One suggested remedy to this, which has some positive feedback, is to adjust the USB bus speed. To do this, you need to edit the cmdline.txt file, and add "dwc_otg.speed=1" (without quotes) to the end of the file (found in the /boot directory).

You will not be able to do this on the Pi of course because the keyboard itself is crazy. You will have to insert the SD card in your computer and do the necessary edits. This WORKS for my Microsoft Wireless Keyboard 800.


How many right triangles are there with these conditions?

Question: How many right triangles are there with the following conditions:

the sides $a$, $b$, and $c$ have an integer length (Pythagorean triplets)

the amounts of area and perimeter are the same for each triangle.
Answer: I think there are

 Two such triangles, up to switching labels

Which are the following

 $(a,b,c) = (5,12,13)$
$(a,b,c) = (6,8,10)$

Proof

 The conditions are $$ a^2 + b^2 = c^2 \,\,\,\,,\,\,\,\, \frac{1}{2}ab = a+b+c $$ The second condition may be reformulated as $$c = \frac{1}{2}ab - a -b$$ which when substituted into the first equation yields $$a^2 + b^2 = a^2 + b^2 + \frac{1}{4}a^2b^2 - ab(a+b) + 2ab$$ $$\Rightarrow ab(ab+8) = 4ab(a+b)$$ Given that $a$ and $b$ must be positive we can divide across by $ab$ and rearrange to get $$ (a-4)(b-4) = 8$$ Since $a$ and $b$ are positive, it quickly follows that $a-4$ and $b-4$ must be positive and factors of $8$ (since, otherwise, one of them will be $\leq -4$).
 Up to switching $a$ and $b$, the only possibilities for $(a-4, b-4)$ are $(1,8)$ and $(2,4)$. This leaves $(a,b)$ as $(5,12)$ or $(6,8)$, both of which form Pythagorean triples.
Answer: Here's another approach which I mention not because it's necessarily better than hexomino's, but because the technique is useful to know.
Every integer right-angled triangle

 has sides $2kmn, k(m^2-n^2), k(m^2+n^2)$ for positive integers $k,m,n$. (And for any positive integers $k,m,n$ these three are the sides of an integer right-angled triangle.) Such a triangle has area $\frac12\cdot2kmn\cdot k(m^2-n^2)=k^2mn(m^2-n^2)$ and perimeter $2kmn+k(m^2+n^2)+k(m^2-n^2)=2km(m+n)$. These are equal iff $kn(m-n)=2$.

So

 one of $k,n,m-n$ is 2 and the other two are 1. Taking $k=2,n=1,m-n=1$ gives (8,6,10). Taking $k=1,n=2,m-n=1$ gives (12,5,13). And taking $k=1,n=1,m-n=2$ gives (6,8,10) which of course is just the first solution with its legs the other way around.
Comment: Ah! I'm so, so sorry.
Comment: Aaah I misread your first line and thought that somewhere further down the page there would be a post solving the problem by tiling the triangle with hexominos. After that moment all the beautiful algebraic solutions became mere disappointments.
Answer: I have a solution, as follows:

$$a^2+b^2=c^2\text{ and }\frac12ab=a+b+c$$Multiplying the second equation by $4$ and add it to the first equation yields$$\begin{split}(a+b)^2&=4(a+b+c)+c^2\\(a+b+c)(a+b-c)&=4(a+b+c)\end{split}$$As $a+b+c\ne0$, $a+b=c+4$, or $c=a+b-4$. We substitute this in the second equation above.\begin{split}\frac12ab&=2a+2b-4\\ab-4a-4b+8&=0\\(a-4)(b-4)&=8\end{split}So $(a-4,b-4)=(1,8),(2,4),(4,2),(8,1)$, or $(a,b)=(5,12),(6,8),(8,6),(12,5)$. We notice that these values of $a,b$ are pythagorean triples, so we have $(a,b,c)=(5,12,13),(12,5,13),(6,8,10),(8,6,10)$

Edit: Sorry that this is similar to @hexomino's solution.
2nd edit: How could I forget to spoilorise it?
Answer: Here is an economical solution:

 The area of any triangle is half its incircle radius times its circumference, hence the requirement wrt area and circumference can be simply rephrased as incircle radius $R = 2$. Let $a$ be the shortest side. It must (1) touch the right angle and (2) be larger than $2R=4$, (3) once its length is chosen, the triangle is fully determined because the middle side must form a right angle which fully determines the incircle's position which in turn determines the long sides position (it must touch $a$ at the far end and it must touch the incircle.) With these constraints we can enumerate: $a=5 \overset {(3)} \Rightarrow b=12,c=13$ $a=6 \overset {(3)} \Rightarrow b=8,c=10$ $a=7$ does not work ($b=7$ too short, $b=8$ too long) $a=8$ not shortest side. And that's all.


How to use values from one stored procedure into another?

Question: For eg
I have a SP which give a result when i, CALL A1();
i fetch the result and store in $a.
But when I call another SP CALL A2('$a'); It is not executing. Showing Array() when I run the program
Comment: Post your code on how defined both SPs and how called them and read using PHP.
Answer: When you compose the SQL command "CALL A2('$a');" in PHP, the parser first expands the $a variable within your double-quoted string literal.  However, as documented under Converting to string:

Arrays are always converted to the string "Array"

Therefore PHP interprets the string that is to be sent to MySQL as "CALL AS('Array');", which is obviously the root of your problem.  Note also that allowing PHP to expand variables into SQL commands in this fashion is dangerous: see @deceze's blog article The Great Escapism (Or: What You Need To Know To Work With Text Within Text) to understand this better; and then How can I prevent SQL injection in PHP? to understand how variables should (generally) be passed from PHP to SQL.
However, in this case, the fix is not so straightforward.  Since MySQL does not have an array datatype, even if you did properly serialise the array then it would only recognise the serial form (which will not be easy to use in your A2 procedure).
It should also be noted that stored procedures don't really "return" anything.  Whilst they can output zero or more resultsets, resultsets can't be used as an input to another stored procedure.  The normal workaround is to store the resultset (e.g. in a temporary table) and then later access that as required.
That said, it is very rare indeed that such an arrangement is necessary.  Usually people attempt such things because they're trying to use SQL as a procedural language, whereas it is a very powerful declarative language.  If you explain what it is that your procedures are collectively trying to do, I very much suspect that someone will be able to write a single SQL command to do the whole thing.


Difference between Pray for and pray over

Question: What is the difference between "Pray for" and "pray over"??i found this word in a novel named "the testaments" by Margaret Atwood where it was mentioned as such:" There were rumours about the Rachel and Leah Centre at school, but they were vague: none of us knew what went on inside it. Still, just being <code>***prayed over***</code> by a bunch of Aunts would be scary." When we use "over" after any word,what do we generally refer??And since I have a poor knowledge of phrasal verbs,can anyone recommend me any  book written on phrasal verbs to enhance my knowledge?
Comment: One can 'pray for' someone, privately, in their absence, making a prayerful request on their behalf. One can also 'pray with' someone, making prayerful requests which involve that person and which they may not feel able, in their distress, to voice for themselves. To 'pray over' someone is (I would suggest) what religious officials do (who are paid to do it). The person then becomes somewhat of a bystander in the process and the official takes over the proceedings, as part of their job. Some 'pray over' dead bodies but I cannot comment on that as I do not understand why it would be done.
Comment: https://forum.thefreedictionary.com/postst144226_pray-for--pray-over--pray-about.aspx  There's a good discussion on this in Free dictionary forums...
Comment: @NigelJ but when prayers are done upon dead bodies then it kinda sounds like praying for the dead body since you mentioned in the very 1st sentence that to refer "pray for"it requires their physical absence.And is it necessary for the person (being a by stander)to be present on the spot (where prayers are done on his/her behalf) in case of "pray over"?
Answer: In the Bible, the usage of "pray over" is unusual, occurring only once:

Is anyone among you sick? Let him call for the elders of the church, and let them pray over him, anointing him with oil in the name of the Lord. (James 5:14, NKJV)

The sense is where people pray to God on behalf of someone (who may be sick and might not be able to also pray).
This passage is the origin of the Roman Catholic sacrament of Extreme Unction:

So, unction refers to the act of anointing the sick, the oil used to anoint the sick AND the spiritual disposition and hoped for response to the anointing. The hope for the sacrament is to bring about the physical healing of the individual who receives it as a continuation of Christ's healing ministry.

Source
BibleGateway has 154 results for the topic of prayer. These include:

individual prayer
corporate prayer
prayers for healing
prayers on an individual's behalf
requests that God would protect the nation
prayers that God would uphold justice
prayers of thanks to God
prayers that God would help
prayers asking God to forgive

The difference between pray and pray over would be that the former is quite general and used often. The latter is used rarely, and when the one being prayed over is sick or incapacitated.
The character in the Atwood novel may have thought that being prayed over was scary because she did not want God to do what the Aunts were praying for. (I'm guessing that the Aunts were not praying for healing from sickness.)
Comment: I would say there are several reasons why this would be scary to her. The process is unfamiliar to her. The people praying over you are unfamiliar to her. And the outcome that they are praying for may not be what she wants. Finally, Margaret Atwood's characters are often pawns in an oppressive religious regime.
Comment: Cultural note: In American Pentecostal circles, being "prayed over" usually involves several church members gathering around an individual and praying simultaneously and loudly, sometimes in tongues, for an indeterminate amount of time. This is the type of activity that comes to my mind when I read the Margaret Atwood quote above. Scary, indeed, especially for a young person.
Comment: @RobJarvis you feel the "the voices/prayers being so loud"is the reason that someone will get scared??
Comment: @MahiraFarhanHaqRamisa that is certainly part of it, along with the person's lack of familiarity with the practice. These could combine to create a shock/apprehension/fear response.


Issue comparing datetime objects in django html template

Question: I am passing in class objects and a variable into my html template in Django
Using Classbased Views, I have
get_context_data(self, **kwargs):
   ...
   context['time'] = datetime.now()
   ...
   return context

I also pass in my objects using
model = Object and context_object_name = 'obj'
In my html template my comparison looks like this:
{% if obj.start_time > time %}

ITS WORKING

{% endif %}

Regardless of whether I use >, <, or ==, the h1 template is never displayed.
I have used {{obj.start_time}} and {{time}} to ensure that there really are values attached to these variables, and I see both of the times displayed on the page. The values themselves work, but for some reason the comparison isn't working.
Answer: The reason could be that time and start_time are not both timezone-aware or both timezone-naive. Display the times with the timezone information to check.


Sync to Outlook Removal

Question: I have read that in SharePoint tasks the sync to Outlook button is being removed this September, is there going to be a new syncing feature, or another way to achieve this function? Also if anyone knows of a tool or plug in that can aggregate Outlook and SharePoint please share!
Answer:
Open a tab in your web browser.
Log in to SharpSpring.
Click User Menu > Settings in SharpSpring's top toolbar.
Click User Email Settings, located under My Account in the left panel.
Select Outlook in the Provider drop-down menu.
Enter the Outlook email address that will be synced in the Username field.
Enter the password used to log in to the Outlook email address in the Password field.
Select Inbox in the Inbox drop-down menu.
Select Sent in the Outbox drop-down menu.
Click Connect.
Click Close.

Sync to Outlook Removal


Help Needed Regarding View Module

Question: Hi I am a newbie and want to Get Functionality from view module in the form of grid in which i want to show some fields and a main title after clicking on title user will be directed to full post. Can anyone help me how to get this functionality.
In other word i want to change the order of displaying data to end user created by the view module.
Answer: If you have already created a view which shows nodes you want to display, in the view settings select Format > Grid, and Show > Fields in the Format area; select the fields you want to display in the Fields area.
If you want other than default sorting options use modules such as the following ones:

the Weight module (It allows you to assign weight to nodes and then sort them by that weight.)
the Menu Node Views module (If you have added your nodes to some menus, then this module allows to sort nodes in the view by that order.)

Note
The Menu Node Views module starts producing duplicate results, if the content of the node is translated to other languages (translated using the Entity translation module).

Help Needed Regarding View Module


Email when Linux server disk is full?

Question: How can I set up an email notification on a Linux server for when a disk/volume exceeds a certain usage quota?
Answer: Option 1:Write a script that runs df, parses the output for the percent utilization & sends an email when it exceeds a given threshold, then run this script from cron.
(If you're feeling lazy you can find a bunch of pre-written scripts by asking The Knower of All Things for Unix Disk space check script.)

Option 2 (The better solution):
Deploy a monitoring system (Nagios, InterMapper, OpenNMS, etc. -- look around here for lots of suggestions & opinions), and configure it to send you a notification when your disks are filling up.  While you're at it configure alerts for other stuff you might be concerned about :-)
Comment: Option 2 is definitely the better solution.  We are mostly using Option 1 now, but if something fills /var too fast, you won't get any email, because it can't spool it.  You may also have issues if the volume the script runs out of space, or if it writes to /tmp and it runs out of space.  It is still a quick solution that works most of the time and is certainly a lot better than nothing.
Comment: Option 1 is great for the short term, but often results in a ton of kruft when you adapt this script to 5 functions on 10 servers. Option 2 is great for the long term, and is simpler to adapt to many server for many different checks.
Comment: Option 1 isn't really intended as a viable a solution (it was offered only for completeness in terms of a quick hack if you're in a "this server keeps filling up, we don't know why, and we need to monitor it YESTERDAY" situation) -- That said, lots of places use it :-)
Comment: To be more specific about Option 2, I'd recommend monit.  It's the easiest monitoring tool to configure for that purpose.  It can do more than that as well, and is simpler to set up IMO than something like Nagios, which is for more complicated scenarios.
Answer: One point for solution 2 too !
I recommend you the "Monit" software that is very light and easy to configure :
http://mmonit.com/monit/
Comment: easy to install too: http://mmonit.com/wiki/Monit/Installation
Answer: For people who do not have a monitoring system, this simple script can do the job :
#!/bin/bash
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
THRESHOLD=90

if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
    mail -s 'Disk Space Alert' email@example.com << EOF
Your root partition remaining free space is critically low. Used: $CURRENT%
EOF
fi

Then just add a cron job.
Answer: +1 for option 2 above.
You may think you only need to monitor disk space right now, but the reality is you almost certainly need monitoring for more than one or two servers. It will benefit you in ways that will amaze you long term.
I'd personally recommend Zenoss, it's F/LOSS, relatively easy to setup and get going, and they have great documentation.

Email when Linux server disk is full?


Rule for advancing the button when SB bust

Question: If the SB bust, is it the button which advance or the big blind ?
Answer: The button is dead for the next hand. Easiest way for you to see is for me to show you an example.
Table looks like this before player busts:

Player 1 is button
Player 2 is SB
Player 3 is BB
Player 4
Player 5

Table after Player 2 busts:

Player1
Dead button is moved to where player 2 sat(you can just leave it with
Player 1)
Player 3 is SB
Player 4 is BB
Player 5
Comment: You always have to have a BB. A SB can be dead but a big blind can never be dead. So if a player who was meant to be the BB the next hand, the BB will move to the player after that player. I.E. Player 4 is meant to be BB but busts, player 5 is now the BB for the next hand.
Comment: If the BB (player3) busts, player 4 will have to pay the BB or only the SB ? I have noticed than online poker room differt about this aspect of the game (for instance on pokerstars  player 4 will have to pay the SB, and player 5 the BB) but on Winamax, player 4 will have to pay the BB
Comment: Maybe edit this is "Dead button" and is commonly used
Answer: House rules vary.
Tournaments typically us the "dead button" rule, where the blinds advance but the button stays where it is (or moves in front of the empty seat, which is the same thing). If the big blind busts, the big blind and button move forward and there is no small blind for that hand.
But for live games many casinos use a "forward moving button" rule, where the button advances regardless, the player with the button posts a small blind (as he would otherwise have been required to), the player after the button posts a big blind, and the second player after the button also posts a big blind. On the hand after that, the two players that previously posted big blinds post a small, and the next player posts a big; the third hand goes back to normal (unless things happen during those first two hands, in which case the floorman may have to improvise).
Rarely, some games may use the "jellyroll" rule, where both the buttons and the blinds move, and two players are thereby excused of one of their blinds for a round. This is only done for games where the blinds are considered insignificant to the stakes but position is valuable, such as a 1-2 no-limit game.
Finally, in all cases when the game goes from three- or more handed to heads up, the big blind is awarded to whichever player posted it least recently, and the other player is given the small blind and the button.
Comment: I have always thought the term "Dead Button" was a silly term. I never place the button in an empty seat, it simply goes in front of the last player to receive cards. Lee laid things out perfectly, however it is much more simple to think about the rules of the blinds as not being directly linked to where the button is when you are trying to figure out who has what blind. That is more linked to who had the blind last and not particularly where the button is.


All folders and files in SD card and USB drive appearing as locked!

Question: I am facing a wired problem and that is whenever I insert any USB drive or SD card in my computer, all folder and files inside it appear as locked! And therefore I can't crate any new folder and delete any folder from sd card or usb drive! I don't know why it is happening and how to solve this. Anybody please help me.
Answer: Type in:
sudo su
enter your password.
Type in:
chown <your_user_name> <disk_name>
type:
exit
EDIT:
If your media is mounted read-only, it is probably needed to check group permissions:
First thing to do is to check the permissions on the hardware device mounting your card. You'll need to find the device name. To do this run the following command:
sudo fdisk -l

Your device will probably be something along the lines of /dev/sdb1, it can be the SD Reader /dev/mmcblk0p1.
Next you need to get the permissions on this device:
sudo ls -l /dev/mmcblk0p1
Replace "/dev/mmcblk0p1" with your device location.
You need to be a member of group disk to be able to write to the SD card. You can check which groups your a member of with
groups username
so then:
sudo usermod -G --append disk username
This adds the group disk to your user's groups, which should allow you to now read & write to the SD card.


hooking up a belkin USB switch

Question: I'm trying to help my parents hook up a Belkin 4-Port USB switch (model F1U200V) to a couple of USB printers, however, Google hasn't been able to find a manual. a picture can befound at http://www.amazon.com/Belkin-F1U200V-4-Port-USB-Switch/dp/B000EJUCVE Could someone point me in the right direction please? Thank you for your time and consideration.
Comment: If you need to connect more than one device (printer), you'll need a USB Hub, plug the hub into the single downstream port on the Switch and the printers into the hub. The four upstream ports go to 4 different computers ("host" in USB parlance).
Answer: Hook up the 'printer' port to the printer. Hook up the other four ports to up to four computers. Push the soft-touch switch until the light next to the port you want to print from lights up. Then install the printer drivers (if you haven't already) on the selected computer and print.
It sounds like you don't want a switch though. You have multiple printers. You need a USB hub, not a switch. USB switches connect multiple hosts to the same device. You want to hook multiple devices to the same host.

hooking up a belkin USB switch


How to properly invalidate the hibernate 2nd level cache from outside a hibernate transaction

Question: We're working on an application which is using Hibernate 2 (a legacy portion which was never updated).  Part of this application uses a JdbcTemplate to do a series of updates.  These updates occur outside the context of any hibernate transaction.  Since the updates affect objects that are already in the 2nd level cache, we are getting side effects with invalid data being displayed from cache.
We need to invalidate / clear the hibernate cache.  What is the right way to do this using Hibernate 2?  Remember we're updating objects outside of a hibernate transaction and after the updates are complete we want to invalidate the cache or refresh the cache so that it reflects up to date data.
We're having trouble finding information on this seeing as how it's Hibernate 2 vs the more current version 3.
Answer: You can use sessionFactory.getCache() (or entityManagerFactory.getCache() to access the 2nd level cache


Jalapeño Multipool Setup on OS X

Question: I have an ASIC Jalapeño Bitcoin Miner. It mines consistently at around 5000 GH/s. I have been mining using the BitMinter Miner and BitMinter Pool just because it is easy to setup and get running quickly and that's what I wanted to do upon receiving my Jalapeño. However, I now wish to maximize my mining profits. I have read lots about mining etc and I have seen a lot about multi mining. I found a pool called MultiPool and made an account. However, I am unsure how to get mining on the pool now. I have an iMac that I will be running the Jalapeño from. I want a simple, stable, and reliable mining program. But all my attempts to download CGMiner for Mac have failed. How can I get mining on Multipool with my Jalapeño?
Answer: You can use MacMiner
either use the fpga/asic or bfgminer window (which both use bfgminer) or the cgminer window depending on your driver setup. on 10.9 bfgminer should work without driver meddling and prior to 10.9 cgminer should work without installing drivers. You can run either from the command line or through MacMiner.
Answer: Bfgminer is better than Cgminer. This it the right resource to check for update of miners :
bitcointalk
And it gives you this two alternatives:

Homebrew (Mac OS X): brew tap nwoolls/cryptocoin && brew install bfgminer
Mac OS X: compile from source using Homebrew, or try MacMiner
Answer: Alas, Kolivas and Kanoi (cgminer maintainers) don't actively support OSX, although it compiles and runs fairly problem-free on OSX.
Just to be clear, all your attempts to download cgminer have failed? That is, you are unable to get a running, compiled binary on to your computer? Or have you tried running, e.g. http://spaceman.ca/cgminer/ and it has failed to launch? Try the program provided by the link, and tell us how it goes.
Comment: What I meant was that all versions I had downloaded that were meant to work on my machine failed to compile. I have not seen the page you linked to, however.
Answer: Try out Asteroid - it's a graphical UI built on top of cgminer for OSX.
Comment: @cbbcbail any luck with Asteroid?

Jalapeño Multipool Setup on OS X


Find not-accepted answer

Question: I had answers on a question that got unaccepted, but I can't find the parent question url from statistics shown on my profile page (not listed). How can I find them so?
Answer: You can see your removed answer if it had upvotes when you enable show removed posts in the reputation tab on your profile:

A moderator can see all your deleted posts, and in your case there was just one on this question.
The complete text of that answer is:

<code>global $wp_query;
$cat_id = $wp_query->get_queried_object()->term_id;
</code>
Update: More clear answer

It was not an accepted answer (the asker didn't show up on our site since 2011), and it had no upvotes.
This is the same as the the answer from Jan Fabry, there is no explanation and no visible update. So I have deleted it and added an explanation for you in a comment.
Note that bare code fragments are rarely good answers. If you think your answer just looks like another answer but is really something different, you have to explain that, so other readers can understand it.
Comment: with that option, again I can't see it. It's for questions not answers
Comment: Only posts _with upvotes_ are visible with that option.
Comment: why a post with *upvotes* should be removed?
Comment: That's a different question. Your post had no upvotes, and it was not accepted, that's why you cannot see it.
Comment: u say a removed post with upvotes! I confused here. an upvoted post has positive side, i think `a removed post with downvotes` should be correct?
Comment: @revo See my update, I hope it is more clear now.

Find not-accepted answer


Reduce feature levels

Question: I would like to know if someone knows of a way to group the number of levels of a feature that has 100's (even 1000's) of levels to a smaller number of levels - also, what number levels it should reduce to e.g. should it reduce from 200 levels to 10, 15 or 20?
Comment: This is not a well structured question. Are you trying to group levels of a factor, or discretize a continuous variable?
Comment: Okay the goal is to simplify the model, if possible, and without losing a lot of predictive power. Another reason is that certain packages in R cannot handle factors with let's say 3k levels. The purpose doesn't matter, it is a general question-whether it is a count model or a binary classification model, having 3k levels will be a problem. No order and no topology, I'm asking a general question-imagine it as geographic indicators (a bit more granular than postal code). Also, what would the difference/impact be if it was ordered-I would guess then it is simpler, since you can group neighbors?
Comment: Answers that are much more useful and penetrating will become available if you would disclose any of the information I asked for. You might learn about splines, spatial regression models, GAMs, geostatistics, or any other number of techniques that way.  A general question can receive only general answers, whose usefulness might be questionable or limited in any particular application.  That's one reason we ask people to post questions that focus on their problem, rather than posting general questions.
Comment: I'm sorry if the question was not clear, I would like to group the number levels of a factor, hence reduce a factor with 100 levels to let's say 10 levels that will explain as much (or almost as much) variance as the original 100 levels would explain.
Comment: Presumably, then, this "factor" is an explanatory variable in a regression.  But what does it represent? Is there some inherent order or topology to the levels of this factor? What is the purpose of the regression? Why do you want to group the factor?
Answer: It is hard to say how to group the levels based on the information you provided.

It can depend on how much data you have. Suppose you have $1000$ data points, then you may want to group into $10$ levels from $100$ levels. However, if you have $1,000,000$ data points, may be you want to group into $100$ levels. The underline idea is more levels would increase the "complexity" of the model. For large amount of data, you are less likely to have over fitting problem. So you can have more levels.
It can depend on how much information in original feature. Suppose, the original feature has many unique values. And most data would have few values. (80-20 rules, and most real world data like this). You may want to group all the infrequent levels into "Others".
It can depend on how this feature is related to the prediction target. Certain levels / values may have very strong correlation with the label, so you may group those levels specially.
It can depend on domain knowledge and real world requirement. All above are "data driven", where you look at data and decide how to group. On the other hand, in real world, we may have some constrains from the domain you are working on. For example you want do some differentiated advertising, but your marketing department only wants at most 5 groups instead of 20. Then you need to try your best under such constraint.
Comment: Thanks for the response! I agree with what you said, but this is my general logic (I might be wrong - I am still learning). With PCA you can reduce the number of features from 5000 to 10 and maintain a very similar accuracy between including all 5000 features or just taking the top 10 PCA features. This can be done regardless if you have 5000 rows of data or 50 000 rows. So I was wondering if you could do something like PCA on the feature level. I do not know what you can do though. I don't know if this make sense either - but in my head it does :)
Comment: I am still revising my answer. But got confused by your comment, are you trying to process levels in one feature or trying to reduce many features?
Comment: Reduce level in one feature (but possible do the same for other features with many levels as well)
Comment: that's what i thought. so if you reduce level in 1 feature, why PCA. And what's your suggestions on the 4 points I made? clear?
Comment: Indeed not PCA, I meant that you can reduce many features to a few using PCA. Can you reduces many levels to a few using something else (not PCA, but something else)
Comment: The listed 4 types are the ways I can think of.
Answer: I think what the OP is asking is whether or not you 'retain the same information' (or most of it) if you reduce the number of levels of a factor, and how to code such a thing. But let me back up.
Your statement: "With PCA you can reduce the number of features from 5000 to 10 and maintain a very similar accuracy between including all 5000 features or just taking the top 10 PCA features." is not necessarily correct.  This depends on the data itself and how correlated your features are.  If there are many highly correlated features, you may be able to retain much of the variance using a small set of principal components, but in other cases, this will not be true.
Now, whether or not you can restructure a factor, making it less granular, without losing any information is an empirical question. For instance, suppose you had 100 levels of a factor indicating 'degree of dislike for vanilla ice cream'.  This may very well be too granular, in which case you might find that cutting it down to 4 does just as good a job.  But again, it depends on the data.
If your question is how to accomplish such a task (I'll assume in R), there are several solutions. Here is one.  Further assuming that you have an ordered factor:
<code>#create a factor with 300 levels
dat = data.frame('Class' = 1:300)
dat$Class = factor(dat$Class)
#assuming an ordered factor, convert to numeric then use cut to reduce to 10 levels
dat$Class2 = cut(as.numeric(dat$Class),10,labels = FALSE)
</code>
Now, if your factor levels are not ordered (your post suggests it is not -- similar to a 'postal code'?), the above won't do what you want.  You'll need to come up with a scheme to recode these variables at a higher level.  I'm no expert in the postal sciences, but continuing with that example, I might consider using just the first 3 numbers.
Comment: Thanks for the answer, yes indeed I agree that this method would be applicable for ordered data - but this adds to my previous question (assuming for now that the data is ordered), how to determine the number of levels to reduce to?
Comment: Then regarding the postal code example, let's say you want to determine the like or dislike for vanilla ice cream based on region (postal code) then let's also say that the postal codes are completely random in it's structure (i.e Buffalo Grove, Chicago is AB-1,Beverly Hills, Los Angeles is JK-B-09) now if we have 10 000 records for each postal code then we have enough exposure. Working with this framework I would like to group the most similar postal codes and reduce let's say 3000 levels to 30 (or 40, 50, 60). Continued below...
Comment: The problem I can already think of with this is that if you include a second/third/fourth variable then the interaction of some of the levels of postal code might be significantly interact with other variables - and if you group the postal codes, some information might be lost in this process. So let's split this in 2 parts - 1 where there is only 1 variable (postal code) and then 2- multiple variables and handling this interaction. I really appreciate the help on this topic, for me it is really interesting and I am still learning a lot about Data Science and ML. :)
Comment: You must be from Chicago - no one knows Buffalo Grove otherwise.  It sounds like you might want K-means clustering, but the clusters (however many you choose) will be based on the similarity (or dissimilarity) of the other features, not the feature you wish to recode. Also, the appropriate number of clusters is somewhat arbitrary.  This may be a situation requiring extensive human intervention, if it cannot be solved algorithmically. If you really do have city names, you might parsing them with regex to get to a larger region, but without seeing your data I can't say.
Comment: :) I am actually not even from the states-I just know these suburbs.Just so that you know the question is really just in general what a person should do (or attempt).If I would apply kmeans, then I guess it would be just as good as removing postal code,and just use PCA on the region features?Getting a larger region might not be a good idea,since let's say for argument poor people like ice cream and rich people doesn't-then you really want region as granular as possible (even to street level maybe). But I agree it depends on what you are modelling (like large regions rain/no rain will be fine)
Comment: Look into the fused lasso, search this site!

Reduce feature levels