how do I dispose of fluid from a lead acid battery?

Question: I am reconditioning a 12v lead acid battery, and a process I am trying requires me to remove aprox 2.5 to 3 oz of battery fluid from each cell. Before I do this, I'd like to know how to dispose of the removed fluid? Can I just neutralize it with baking soda?
Comment: Welcome to EE.SE, did you follow the forum rules and do some research (googling) before you posted?
Comment: @laptop2d Where are you coming up with the rule you mention?
http://electronics.stackexchange.com/tour
Comment: Note that both answers that you've gotten so far say to **add small amounts of the acid to a large amount of water**. That's extremely important. Don't ever add water to acid.
Comment: @horta fine, recommendations\rules, here they are: http://electronics.stackexchange.com/help/how-to-ask you ought to review them if you haven't. There are also recommendations to the right of the question box if you haven't see those either.
Comment: Yes, I did search for an answer. Everywhere I searched, I only found answers relating to disposing of the whole battery.
Answer: What you're removing is ~28% sulfuric acid. Dilute your 18 oz with a quart of water,  you can then neutralize it with baking soda with little difficulty. Wear rubber gloves and goggles and add acid to water in small amounts while monitoring the temperature. Have separate bucket of water nearby for yourself in case you get acid on your skin.
Comment: Baking soda and vinegar are my staples for cleaning batteries and neutralizing electrolyte.  Baking soda for lead-acid and vinegar for wet cell nickel-iron or nickel-cadmium, which use alkaline (base) electrolyte.
Comment: You can clean the surface of the battery with soda easily since you're dealing with small amount of acid. OP's amount/conc. would cause too much bubbling of the liquid being neutralized Search youtube for 'coca cola menthos' to get an idea of the phenomenon (you will be dealing with substance quite a bit stronger than a soft drink).
Answer: Are you not planning on putting the acid back in the cells after you recondition them?
Or are you planning on replacing it with new electrolyte?  Where are you getting the new replacement electrolyte?  Does the source not have a recycling system?
Can you take the electrolyte fluid to a place that sells (and recycles) auto vehicle batteries?  They are prepared to handle the material properly as they deal with it every day.
Answer: One way that is relatively safe (because of the small amount of acid you need to get rid of), is to dilute it very very much. I've done it it the past and the possible dangers are low. REMEMBER TO USE RUBBER GLOVES AND EYE PROTECTION.
Just add the acid gently to a very large amount of water (eg 5-10 liters of water). Then you can possibly dump it even in the sewer.
Note that I'm suggesting that only because you have a small amount of acid which is clearly not worth it to pay someone to dispose it "properly" for you.
Comment: I am replacing the electrolyte with a mixture of distilled water and  magnesium sulfate. This is an alternate method of desulfating a otherwise bad battery.


Highest score in a snooker frame

Question: What is the highest score ever achieved in one frame in a ranked event, not break i know it's 147, but for example the other player made some faults and the other player get points for it.
Answer: A player can score more than 147 by scoring foul points. The 'miss' rule means high foul point totals are not uncommon.
The highest individual frame score is 178-6 (Jimmy Robertson 2021) beating the previous 167-6 (Dale 1999). Yesterday Milkins beat Selby 164-0 (Welsh Open 2023) - this may be the record frame score to nil.
Links: https://www.snooker.org/plr/records.shtml   and.
https://cuetracker.net/head-to-head/nigel-bond/dominic-dale
Comment: This should be the accepted answer as the question is about a frame. Even is a break can be more than 147.
Answer: According to Wikipedia, citing this BBC article:

In October 2004, during qualifying for the UK Championship, Jamie Burnett became the only player to record a break of more than 147 in tournament play, when he scored 148 against Leo Fernandez. He took the brown as the free ball, then potted the brown again followed by the 15 reds with 12 blacks, two pinks and a blue, then the six colours.

The theoretical maximum is 155, but as of the writing of this answer, 148 is the highest ever achieved in a professional match.
Comment: This does not answer the question, they want the highest frame score.
Comment: @PaulPalmpje You're right, I somehow missed that when answering the first time. I'd delete it, but you can't delete accepted answers, unfortunately, and there's little chance of OP unaccepting it as they haven't been active in some time.

Highest score in a snooker frame


Which image for steganography?

Question: Which images are suitable for image steganography(Storing behind an image)?
In particular JPEG,BMP or TIFF?
As JPEG is lossy so is it possible to lose any data if it is hidden behind the image?(using LS*strong text* technique)
Answer: Technically any of these can be used, but you are more likely to see jpeg in use in the wild.  Because the steganography is a basically introducing imperfections in the image to hide a message, the imperfections will be less noticeable in an already lossy format, whereas if you had some off pixels in a bitmapped image, one is more likely to notice the discrepancy.
Your question about being lossy only applies if someone tries to resave the image.  For example if I opened your image with a secret message hidden in it in photoshop and then saved it back out as a jpeg, the image would likely change and destroy your message. This is not the case when sending a file via e-mail or the web (except in the case of some ISPs that implement jpeg compression to speed up browsing speeds for slower connections like dialup).
Answer: The easiest image type for Steganography using LSB technique is a BMP image. It is not a popular image type as it occupies a larger size than its counter parts(jpg).

Which image for steganography?


MS Project: How to deal with a reopened task

Question: There have a task which we assume be completed for a while, but just now we figured out that task is incomplete. How should I deal with that reopened task ? Should I set a baseline and then clean the task progress and set the new start/finish dates ?
Comment: This question reads as if it this is more about protecting the performance measurement baseline integrity.  In order to answer, the reason why a task / work package needs to be reopened is critical as this will dictate the appropriate technique to handle your PMB.  Edit your question to include the reason, please.
Answer: I assume you have tasks that follow the task in question that had a false finish.  I further assume those tasks have started and have progressed to some degree.  You have to reschedule the work since you are essentially going back in time and continuing the offending task to get it to completion.  So in your schedule, you would remove the finish date of this task and, based on your estimate to complete, you would add the hours, duration, and resources necessary to bring this task to finish.  If those other tasks have to be restarted, i.e., the work performed so far has no value, then reduce progress on those tasks to 0%.  Then march on with the work.
The question about rebaselining, however, is different.  Whether or not you can rebaseline depends on why the task was claimed not to be finished.  Did the workers on that task complete it based on the given requirements but the requirements changed?  If so, that's a rebaseline, which means you get time and money added.  If requirements were missed, then that would be a no rebaseline and you deal with your variances: late schedule, likely cost overrun.  If the subsequent tasks revealed an issue with the offending task, then that might be a negotiable item as to whether it could be rebaselined, i.e., no reasonable person could have known that the task failed to deliver what it was supposed to.


How do I switch a node's view mode for AJAX calls?

Question: I've programmatically created a new view mode called ajax.  Is there any way to force a node page to use that view mode if I'm making an AJAX call?  I know how to switch page and node templates when it's an AJAX call in template.php, but it's not quite the same thing.
Comment: As far as I know it's not standard Drupal feature. So, please, explain what do you want to do? What kind of AJAX call are you doing?
Comment: I'm loading my node page in certain parts of my site into a JQuery popup (i.e., via AJAX), and want a completely different layout when this happens - i.e. not just a different template, but a different view mode (so I can use different fields / field formatters). It might not be a standard feature, but it ought to be possible in my theme.
Comment: You can do this quckly on Drupal 8/9 like mentioned in my answer here : https://drupal.stackexchange.com/a/309563/61506
Answer: If you have a custom handler for your ajax request, I suggest you to manually render the node using node_view api function. It has a view_mode parameter which you should set to 'ajax'.
Answer: You can make use of Services module

A standardized solution of integrating external applications with
  Drupal. Service callbacks may be used with multiple interfaces like
  REST, XMLRPC, JSON, JSON-RPC, SOAP, AMF, etc. This allows a Drupal
  site to provide web services via multiple interfaces while using the
  same callback code.

Features(3.x):
Service API allow modules to create other services, including pluggable access control
Server API allow modules to create other servers, such as SOAP
Aliasing methods
Integration with core Drupal functionality like files, nodes, taxonomy, users, files and more.  ***you can try this option***
Response format API allows you to define response Formats for CONTENT-TYPE ie. application/json or application/xml. (also calls such as ENDPOINT/node/1.json work)
Comment: Hmm, no, that's not what I'm looking for. I've used Services before, and I don't believe this is a problem that will solve.


installation rights to all computers which is the part of domain

Question: We have domain environment and we have IT support team , I want to delegate installation rights to specific group (that particular group must have installation rights to all computers which is the part of domain).
Thanks in Advance
Vinay Kumar Vishwakarma
Answer: Domain Admins is added to the local administrators group on all machines joined to the domain. Add them to that.
Answer: If you don't want to add the IT support team to Domain Admins, create a new group for them and use Group Policy to add that group to the Administrators group on the local machines.
If the contents of the Administrators group on the clients can be tightly controlled, you can use the Restricted Groups policy item.  Otherwise, configure a startup script:
<code>net localgroup Administrators /add it-support-team
</code>
Comment: I think we need to create a security group "IT_SUPPORT" and add all IT support users to that group.

And add the below following lines in the script -

ifmember "IT_SUPPORT"

if not errorlevel 1 goto itsupport

net localgroup administrators %username% /add

:itsupport
Comment: The net localgroup command won't do any harm if the group is already a member of Administrators, so testing first is a waste of time IMO.  The %username% has nothing to do with it and definitely shouldn't be in the command.  Also, note that since you only need to issue a single command, you don't need an actual script.


Deciding Gas Pricing

Question: Anyone know how curve fi and metamask fetch the average gas price for the transaction and how they provide the slow and fast option? I just want to know which third party they use to get these info.
Answer: I think you can find the answer in following link
It seems like they use a binary search to calculate estimated gas based on the opcodes.
Comment: The link is about estimating the gas limit, not the gas price.
Comment: I was asking about gas price not limit, I know we can get it using web3 also but I guess web3 only give the average price so I just want to know how they give the fast and slow option

Deciding Gas Pricing


Stack sizes and perceived ranges

Question: How do stack sizes affect mine and my opponents ranges? It definitely depends on the player but how do I decipher this and conclude their perceived range and also change my range based on my stack size? I'd expect them to get more aggressive as they have to compensate for their disadvantage but contrarily they could go tighter... I am not sure on how to tailor my play based on my opponents stack sizes and relate this to their position.
Comment: Your question is a bit broad. Can you add some more details or some examples in order to narrow the scope ?
Comment: It's like asking:"How big is this ocean?" Everyone knows it's big but no one can say exactly how big.
Answer: There are several components to your question, and I will do my best to address each of them.
How should my stack size affect my range?
That is a very complex matter, and I will assume you mean preflop hand range to simplify it. As a general rule, the larger your stack is relative to the big blind, the more speculative hands gain in value. By speculative hands, I mean hands that can make the nuts postlop, such as suited aces and connectors (T9 and such). As stacks get smaller relative to the big blind, preflop hands that already have value on their own, such as an Ace-X hand or a pocket pair, go up in value. Here is a very rough range of stack sizes and hands that have good value for each:
0-15bb Ax, all pocket pairs
15-40bb Broadways, strong pocket pairs
40-80bb Strong broadways, small pocket pairs (to make sets), strong pocket pairs
80bb+ Strong suited broadways, all pocket pairs (for sets or full houses), mid-high suited connectors, suited aces
How do I change my range based on my opponent's stack size?
Simple, the lowest stack is called the  effective stack You play the range that is appropriate for the lowest stack of you both. If he has 10bb and you have 200bb, you play a range appropriate for 10bb.
How do I deduce my opponent's range from their stack size?
Hand reading is as much an art as it is a science. Start by assuming a "baseline range" based on the average player where you are playing, and adjust that baseline through observation. You can even start assuming he plays the range written above! Then when you see him shoving 8bb with 96s, you adjust that mental model you have of his range. And adjust your own range to exploit his mistakes.

Stack sizes and perceived ranges


What is the difference between "Registry" and "Directory"

Question: We are building a software system that maintains a collection of participating entities, and I'm trying to determine if it is more appropriately termed a registry or a directory.
Comment: I'm voting to close this question as off-topic because it's about technical language, not general English.
Comment: @DJClayworth - but doesn't technical language come from general english?  I'm coming from a software development background and I can tell you that most concepts or terminologies come from general english definitions.
Comment: @djclayworth The OP asks about the meaning in general English, not technical, so I would say the question is fine.
Answer: From various dictionary definitions it is not easy to distinguish between the two. From current usage I would say it is as follows:

A registry is an official record keeping institution, such as the UK Land Registry. Ownership of all land in the UK is registered there. Unless you are in there, it might be hard/impossible to prove that you own a piece of land.
A directory is a collection, which does not need to be either official or comprehensive, such as the telephone directory. You can happily make and receive phone calls, whether you are in the directory or not.

If the participating entities enter the collection voluntarily, and can operate without doing so, I would suggest you use directory; a registry would require them to be part of it.
However, despite its name, use of the Windows Registry is not mandatory for applications.


Processing train and test data

Question: I have X numpy array as my features and y numpy array as my target. I split both of it into train and test data. From many QnA i have read they only say to preprocess both train and test separately. I assume i only do it to my feature (X) train and test data and not the target (y). Do we also preprocess the target?
Answer:
Do we also preprocess the target?

Sometimes. The most common example is scaling the target variable for regression, which is beneficial for some algorithms. Another example is when the distribution of the target variable is skewed and is processed into being normally distributed by log-transformation.
Comment: thank you for answering, since you said sometimes, is there any rule of thumb when to do it or not besides of your examples?
Comment: I would say that it comes with understanding the chosen algorithm. Linear regression works with the assumption that the errors are going to be normally distributed. Then preprocessing the target into being normally distributed makes sense. Gradient descent converges faster with values around 0-1, then scaling the target makes sense.
Answer: Not necessarily but depends on what your target(y) is and which algorithm/methodology you are trying to use.
It also depends on your data quality.
Few instances that come to my mind:

If your target value is categorical and multilabel in nature, it needs to be one hot encoded, also think about adding extra category to account for unknown classes
If your target is a continuous variable some transformations could work better depending on data distribution and quality- log transforms are common(if no negatives are present),
Normalization/MinMax scaling etc are employed when different features and targets are in very different scales.

https://machinelearningmastery.com/how-to-transform-target-variables-for-regression-with-scikit-learn/

Processing train and test data


Were there opium dens in Russia during the 19th century?

Question: The title says it all. I've tried searching information on opium use in Europe, but I can't find any source that says whether or not opium dens were ever prominent in Russia specifically.
Comment: Interesting, I knew about them in China and England but never thought about Russia.  I'd be curious as to the answer on this one.
Answer: There is solid evidence that Chinese Muslims who immigrated to Russia brought Opium there in the nineteenth century.  From Svetlana Rimsky- Korsakoff Dyer article for the Australian National University entitled "Karakunuz: An Early Settlement of the Chinese Muslims in Russia"

"The Dungans,the descendants of Chinese Muslims who migrated to Russia over a hundred years ago, are an ethnic minority of Central Asia.' They arrived in Russia in two distinct migrations. The first migration was the direct outcome of the Muslim rebellions in northwest China (1862-1878)." [Rimsky- Korsakoff Dyer, 1992, Karakunuz: An Early Settlement of the Chinese Muslims in Russia, p. 243]

and

"Whereas Tsibuzgin and Shmakov, for example, describe the hairstyle of Dungan girls, list the vegetables grown by the Dungans, and reveal that the Dungans smoke opium, sing well, and are avid cardplayers,..."[Rimsky- Korsakoff Dyer, 1992, Karakunuz: An Early Settlement of the Chinese Muslims in Russia, p. 247]

She then details the "Big Tokmak" in the Russian city of Karakunuz, which amongst other things serves as an opium den.  Although from her description it appears that it isn't like the English and French opium dens in which the focus was on opium.  Depending on your description of an 'opium den', the Big Tokmak may not even qualify as such despite the fact that opium smoking did take place there.

"Dungans do not like to stay in Karakunuz for too long without a break. They visit Big Tokmak fairly often. Nearly every morning a long string of Dungan carts heads for Tokmak, each cart drawn by two horses. The drivers, skillfully using a special whip, urge the horses on with such exclamations as "Uo-uo-uo!" "Yo!" or "Tyrch!" Dungans regard Tokmak as a kind of club: they drink tea there, eat noodles, smoke opium, play cards, set up quail fights, and chat loudly about the issues of the day."[Rimsky- Korsakoff Dyer, 1992, Karakunuz: An Early Settlement of the Chinese Muslims in Russia, p. 256]

The emphasized text indicates that opium was grown throughout the Zhetysu province (in which Karakunuz resides), incorporated into the Russian empire in the nineteenth century and now a part of Kazakhstan.

"Large areas of the Karakunuz fields are sown with opium poppies to cater to the habit of smoking opium brought by the Dungans from China. We have heard on several occasions that the price of opium in Karakunuz is cheaper than anywhere else in the Semirech'e area.
It is said that the nearer to China, the dearer the price of opium. Many Dungans asked us whether Russians have any sort of medicine to cure the habit of opium smoking. There is one remedy that Dungans regard as effective: this medicine is in the form of small black balls the size of a pea, and is very complicated in composition, consisting of the juices of various plants. Naturally, this remedy alone is not enough to win the battle against this fatal passion: one also needs to have strong willpower, and this is just what the opium smoker lacks. There is an interesting Dungan song about opium smokers that describes the severe consequences of this ruinous habit, and it is said that users of opium get very angry when it is sung in their presence. This song was published in the Semirech'e Regional Gazette in 1897. There is no doubt
that opium undermines the Dungans' health and shortens their lives."

Despite this, there is little evidence (that I can find) that opium gained the same prominence in Russia as it did in England, France, and America.  It is possible that opium became more popular in those countries due to the forced trade of opium in China as a means of maintaining control over the populace and deriving profits.  These merchants who were blessed by those European powers to trade opium in China then brought opium back to their home countries.
I don't know too much about Russia's involvement in the Chinese Opium trade, but what evidence I have come across suggests they largely kept out of it.  If this is true this would be supportive of that hypothesis.
Comment: Russia is such a large country (and bordering on both India and China) that there figured to have some opium in the "country." But apparently mainly near the borders, and not much in Russia "proper."
Comment: Quail fights?  I'd give a +1 just for that.
Comment: F**k yeah, Quail fights!  The quail no fail, bro!
Comment: This answers my question. I wasn't really expecting that there would've been a very similar culture with regards to opium in Russia, but I figured there must've been (at least some) people smoking opium there in the 19th century.
Comment: @Tom Au Russia never bordered India.


How does m2eclipse artifact search work?

Question: Can someone explain the search function in m2eclipse? I am not clear on where this info is coming from and how to troubleshoot this when it can't find the artifact. I have two Eclipse installations, both with m2eclipse plugin, one works (find some artifacts not others) and the second one doesn't return anything.
Answer: When using maven from multiple eclipse installations, one method to get consistent results is to install maven separately and point eclipse (under Preferences->Maven->Installations) to the external maven instance in place of the embedded installation.  An additional advantage to this approach is the ability to run maven from the command line independent of IDE to get a 'pure' view of the build process.  This can be valuable when troubleshooting.
Regardless, m2eclipse uses the standard maven practice of locating a dependency in the local repository (typically {home directory}/.m2/repository), then turns to any 'remote' repositories.  The local repository location can be found in eclipse under Preferences->Maven->User Settings.  If no other configuration has been done, the 'central' maven repository at http://repo.maven.apache.org/maven2/ is the next location searched.
Since you are getting different results from each of your eclipse installations, I would assume that they are looking at different repositories, although not certain how the settings would have gotten that way.  It would be interesting to know if the artifacts you are seeking are in the registered repository locations.
Note that this assumes you are accessing released artifacts.  If you are working with snapshots, the rules change a little and configuration (in settings.xml file) is significant.


Why is IIS Worker Process eating memory on windows server 2008 (vs windows server 2003)

Question: My .Net 4 web app was running on windows server 2003 38 bit.
I've just upgraded to a new server with windows server 2008 64 bit.
I still got both servers running the same web app,
On windows server 2003 the app takes 55k RAM
And on windows server 2008 it takes 285K RAM
Same application, didn't change a thing and there are still no users at the new server.
What am I missing? Can the same application take a lot more memory on windows 2008?
Thanks
Rafael
Answer: You might say "Windows Server takes 5 times as much RAM.  OMG!!!!"
I prefer to say "Windows Server just uses 200K more initial space.  Who cares?"
The important thing is to see how the application scales under load.
I suspect the difference with several concurrent users will be relatively small.  I'm guessing that, ultimately, Server 2008 will scale better.
But the only way to be sure is to test it.
IMHO...
Comment: I care :) the same application with load (not heavy) didn't get to 200K on the old server. I really hope it scales better....
Answer: When the application starts up it reserves memory. If more memory is available it will reserve more.
Also 64bit applications use more space than 32bit application.


Unable to migrate data from Palm Desktop 4 to Blackberry Desktop Manager

Question: I am currently trying to migrate my data in Palm Desktop 4 (that's right, the one that came with the Pilot m500...) to a new Blackberry using the Desktop Manager's "Device Switch Wizard." Although it seems to be working at first, it completely stops (and becomes "Not Responding") after importing exactly 2971 records from the Calendar - which happens to be the first thing it pulls out. Closing the instance of Palm Desktop that the Wizard opens (both before and after it freezes) and waiting for over 15 minutes both do no good. I'm not sure whether or not it is a RAM issue, as there is a RAM meter on my Vista Sidebar and it stayed almost constant at 38% out of the almost 3GB of RAM I have.
Answer: In all probability, there is something wrong with the 2972nd record.
It may be corrupt. It might contain illegal characters. A critical field in it might be empty. Recurring events without an end date could cause problems.
If you can identify that record, delete it and try again.
If you can't identify that record, then I'd suggest turning on Advanced Logging in Desktop Manager and then run a synch. After it fails, check the log and at the bottom, you will find the last successful record. The subsequent one should be the problematic record.
Alternatively, Palm Desktop should have the ability to export records into something you can view in a spreadsheet. Export them and then find that record. Inspect it to confirm that you're using lower ASCII (no control characters), and also for the other things I mentioned in the second paragraph.
Regards,
Comment: Actually, whenever I deleted old records, the number that were processed pre-freeze increased. I don't recall the exact number anymore, as I currently no longer have access to that laptop. Anyway, most of the data was **incredibly** old, so there was nothing of value lost.
Comment: What that implies is that it wasn't a solid block of corrupt records. So if record 100 and 150 and 200 were corrupt, after deleting them you'd be able to get at least 200 imported. And of course, corrupt meaning that the BB software won't import it. It could be a record with an empty name field, or one with punctuation where it shouldn't be. I forget exactly but somewhen around when version 4 of the handheld code started getting released, RIM started requiring cleaner data when importing from other sources. It really made a difference in reducing synching problems.
Answer: (I know nothing about Blackberry, I use Palm Treo and Centro.)
However, this sounds like a generic issue with corruption with your Palm database.
If you even just suspect corruption, download the outstandingly helpful dbFixIt from Pimlico Software. dbFixIt runs on the Palm device, not on the Desktop itself.
I tried it and it finds and fixes lots of corruptions (often related to BLOBs in Datebook, at least in my personal experience).
FREE shareware program with unlimited free trial to run in detection mode;
only need to purchase for $12.95 to use it in repair mode. So it's a risk-free proposition.
And it's well worth it. Very widely recommended by armies of grateful Palm users.
I can personally vouch from painful experience for every single word of what Pimlico state: "Corrupt databases can cause all kinds of problems from crashing applications, hanging or crashing conduits, or causing unexpected errors ..."
By the way, Palm Desktop 4 is pretty ancient, you should also try Palm Desktop 6.2 (final, not the beta) for Vista which is ok.
Answer: I almost forgot about this. My mother ended up using a piece of shareware to accomplish this task. Upon inspection of the results, everything seemed fine.
I have no idea what the actual problem was, but it is now a moot point. Thank you all for your help anyway.


How can I center the window on each search result

Question: When searching for /a_string and getting several matches, I can cycle through them with n, but I'd like the editor window centered on each matching line so I don't have to move my eyes around all the time saccading for the match.
The same would be useful during search-replace with confirmation, where I want to cycle through each match and confirm or avoid replacement.
Is there any such option besides remapping n to nzz?
Comment: Remapping another key to `nzz` so that you still have `n` if you want to? Is there a reason why you don't want to remap to `nzz`?
Comment: Yes, I only realized that's what I wanted afterwards. Will edit.
Comment: `nnoremap n nzz` doesn't work during replacement, which mapping do I have to use for this?
Comment: From your question, it wasn't clear that you wanted to have this mapping while using a substitute command. I don't think that is possible: in the mapping modes listed in [`:h :map-modes`](http://vimhelp.appspot.com/map.txt.html#%3amap%2dmodes) I don't see something really related. I think (but I'd need to check the source code to be sure) that the keys `y`, `n`, `a` etc are hard code in the substitue command. You should edit your question to include this specific case.
Answer: I don't believe there is a builtin setting to do what you want only for search. If you :set scrolloff=999 (or other arbitrarily high number) you will get the effect you are looking for but it doesn't turn off. In other words, the cursor line will be midway between the top and bottom of the window  whether you're searching, editing, moving around in Normal mode, etc.
From :help scrolloff:

Minimal number of screen lines to keep above and below the cursor.
  This will make some context visible around where you are working.  If
  you set it to a very large value (999) the cursor line will always be
  in the middle of the window (except at the start or end of the file or
  when long lines wrap).

Try it out. Some people keep this on all the time. Maybe you'll like it, too. We might also be able to figure out a mapping/script that enables it just while searching, too, but if you don't want to mess around with a mapping with zz I imagine you don't want to mess around with a mapping for this either.
Update: This is totally superfluous given that zz should work fine but since I scripted it for kicks and someone might find something useful I give you...
Put something like this function and mapping in your vimrc file:
function! CenteredFindNext(forward)
    " save the current value for later restore
    let s:so_curr=&scrolloff
    set scrolloff=999
    try
        if a:forward
            silent normal! n
        else
            silent normal! N
        endif
    finally
        " restore no matter what
        let &scrolloff=s:so_curr
    endtry
endfunction

:nnoremap <silent>n :call CenteredFindNext(1)<CR>
:nnoremap <silent>N :call CenteredFindNext(0)<CR>


A nozzle and a diffusor are pointed upwards and have the same water pressure applied at their bottom. Why does the water come out at the same height?

Question: A water tank has two pipes installed on the outside near the bottom which point upwards towards the open top of the tank. One is a nozzle the other a diffusor. According to the hydrostatic pradox, they shoot the water out to the same height as the water level in the big tank. How come? Why doesn't the law of continuity apply in which the velocity increases at the exit of the nozzle due to the smaller cross section? I though the water out of the nozzle is faster and shoots up higher than the pipe with the wider diameter. I don't understand if and to what extent the hydrostatic paradox aligns with the law of continuity here. According to my textbook, the velocity out of the pipes is the same as the weight force of the water due to gravity.
Answer: Regardless of if a nozzle or a diffuser were to be attached, according to Torricelli's Equation, the velocity of the liquid particles which are just released from a hydrostatic position will be $v = \sqrt{2gh}$ where $h$ is the height difference between the height of the liquid particle and that of fluid in the tank.

Here in this pic, I have used energy conservation where $dm$ mass is the mass of the sheet of liquid at the surface of nozzle/diffuser and $x$ is the height above the surface which the liquid will rise.
Since $x = h$, the liquid present at the surface of the nozzle/diffuser will shoot out to the same height as the initial height of liquid in the tank.
Things to note are that here, viscosity, air drag and any other dissipative forces are being ignored and if performed in real life, the height gain would be way less than the initial height of liquid in the tank. But the height gained by the liquid should be almost the same in case of both the nozzle and the diffuser
You didn't really provide any information about your textbook so that I could refer to it for what you meant by "the velocity out of the pipes is the same as the weight force of the water due to gravity" but I hope my explanation helped sort out your doubt.
Comment: Torricelli!! Thank you!


Is there any way to handle disaster recovery for SharePoint Online?

Question: I want to know that whether there is any way to configure disaster recovery for SharePoint Online. Can we restore crashed files or store the SharePoint files in some server? If there is a way, please tell me how to configure it.
Answer: Disaster recovery is something that Microsoft takes care of. DR generally refers to the loss of a physical location.
It sounds like what you're asking about is backups. While Microsoft provides a full site backup for 14 days, if you want a cloud backup solution you'll want to look at 3rd parties, which there are many of so I won't make any specific recommendations. I would suggest searching for 'SharePoint Online cloud backup'.


Five years old and still pees and poops in house and gets into garbage

Question: I have two five-year-old Jack Russels, from the same litter. One is well behaved, but the other is very poorly behaved. He will pee and poop in the house while I am gone, so I have started crating him whenever I am not home. He also gets into the garbage, even when I am home. We have changed all our trashcans to ones with lids, but he still opens it and gets into it. He rarely listens to commands like sit and come unless there is a treat involved. Why is it he is so poorly behaved and the other is not? What can I do to help him? Or is it just behavioral?
Comment: Please provide more details.  i.e. Has the dog always had issues with housebreaking and the other behaviors you mentioned? Do you crate both dogs or just the 1? What types of training have you done with each dog and how often are you engaging in training currently?
Answer: I I had two JTR's for many years--sadly, passed on now. I had a book on JTR's that said they are the "most willful breed," and from my experience this is true. You have two male JRTs who are littermates? This could be the problem. Seems like the 'misbehaver' is jealous and is acting out. Male JRTs can be competitive with each other and perhaps the "bad" one is trying to get your attention --even negative attention. JRT's are like human toddlers in a number of ways.
Can you give a bit more detail? Has the one dog always behaved this way? Do you crate the "good" dog when you leave? Explain your behavior with each dog. Do you spend more time with one than the other? With more information, I may be able to help.


Balanced triodes. Gimmick, or worth the money?

Question: When purchasing tubes from some reputable dealers, I have noticed that you are given the option for balanced triodes--sometimes at a much higher price. How does a tube with balanced a triode effect the tone of the amplifier?
Answer: I can see why, in an esoteric, strictly technical, way it would help, because having the tubes pushing/pulling equally should create better sound. The question I have is, how far out of balance can the tubes be before the sound suffers?
When I started playing, way back when, we'd replace tubes by grabbing some from the electronics store shelf and stick them in. If the amp sounded good we were happy. It wasn't until boutique amps were starting to become popular that I remember hearing any mention of balanced tube sets. Maybe that came in from the high-end home-stereo world where they'd stress over things like that, but for regular playing it didn't seem to matter.
I figure, the guitarists who had the sound I wanted to imitate wouldn't have cared; Buddy Guy, B.B. King, Freddie King, early Clapton, Beck, Page, Hendrix... I can't imagine them freaking out because they couldn't get a set of balanced/matched tubes.
Or maybe that's what they meant about living the blues - not having balanced tubes?
Comment: The way I look at it is, some companies are lower-quality than others and their quality control is all over the map. Others are very high quality, with tight quality control. A matched set from the first is probably more important because there could be a pretty wide range of output for a non-matched pair. For a company that has tight quality control, the tubes should be putting out close to the same amount of power, matched or not. It's like everything else, we get what we pay for.
Comment: I noticed a pretty big difference between my balanced NOS Mullard 12AT7 and my unbalanced one. I guess it just depends on the tube.
Answer: Well, it's not just a gimmick, there is truth to the idea that balanced tubes will maximize an amplifiers capabilities, and if that is your concern then it might be worth your money. Balanced tubes will probably outlast a set of badly unmatched tubes because they share the work of amplifying evenly, as opposed to one tube doing most of the work in an poorly matched set.
That said, amps have been using unmatched sets since the development of electrical amplifier circuitry and audiences have enjoyed music played through those same amplifiers, so it comes down to each individual to decide for themselves if the investment is worth it. I'll just add this, I have 5 different guitar amps and they do all have matched output tubes, and they are not boutique style amps.
Comment: @skinny_peacock, matched output tubes are a totally different thing than balanced triodes. Balancing refers to a single tube with multiple triodes. Matched output involves multiple tubes.


How you feel in outer space vs. orbit?

Question: I understand that when someone is in low earth orbit, the "pull" of their inertia is equal to the pull of gravity. However, the force of gravity is still acting on them. However, if they are in outer space there the pull in any direction is miniscule, they should feel different that the way they feel in orbit, because you feel forces on your body and in outer space there is no net force while in orbit there is. Am I correct?
Comment: As far as physiology is concerned, the only reasonable experiment-backed answer is "We don't know", since no human has ever been farther than Moon's orbit.
Comment: However, the difference between micro-gravity and outer space zero-gravity seems to be much less significant than the difference between normal gravity and micro-gravity. Expect nausea, cramps, bloated face, muscular deconditioning, bone trouble. Awkward showers and WCs.
Comment: A 60kg person would just feel 2N of force at 100,000km away from the earth, and the moon is about 300,000km away
Answer: They should feel the same.  You only feel forces in orbit if there is something causing sensations, and nothing does in either case.  Even on earth, you don't feel the "force" of gravity; you feel the force of the floor pushing you up so that you don't start falling under gravity's influence.  In orbit, there is no floor, so you don't feel gravity.
You might imagine a force pushing on your spacesuit which then pushes against you.  But in orbit, the force on your spacesuit causes an acceleration of the spacesuit that's exactly the acceleration that your body experiences, so there will be no relative difference in the motion of your body and your spacesuit, so you won't feel anything.
Or you might imagine your left arm feeling a different force than your right, and so feeling pulled apart.  But the accelerations they experience in orbit will be the same, so their relative positions won't change, and you won't feel any difference.
(Technically, there might be minuscule differences referred to as tidal forces.  These should be measurable by extremely sensitive instruments, but not by humans orbiting anything humans are likely to orbit any time soon.)
Comment: No, that's the point.  You don't feel *net forces*, you feel *relative accelerations*.  If a pin just above my finger is accelerating toward my finger, but my finger is accelerating just as fast, I don't feel anything.  There's no relative acceleration, and no sensation.
Comment: I understand that you and your spacesuit have the same relative motion, maybe on earth you just got used to the force of gravity pulling on you since you were a baby, so when you go into microgravity (not orbit) you would feel a difference?
Comment: Sure, you would feel a difference between earth and microgravity.  Normally, your liver lies on top of your stomach a little, so your stomach is constantly pushing up on the liver.  In microgravity, the push would stop, so you'd feel funny.  Things like this are presumably what cause that funny sensation in your stomach on a roller coaster ride.  But the difference between orbit and deep space would not be noticeable.
Comment: well why? I understand that in orbit your organs have the same relative motion to the other parts of your body, but there is still a net force on them. If there is a net force on your stomach (for example someone punching you) you would feel it, so you feel net forces.
Comment: In the case of someone punching you, your stomach is accelerating relative to the rest of your organs.  What you feel, is the difference in acceleration of the front of your stomach relative to the back of your stomach, or relative to your liver, or whatever.  There is a net force, but it is causing a relative acceleration.
Answer: The sensation with respect to gravity will be almost identical, to be precise: undetectable by your body. While freely falling (in an earth orbit or towards some other body in deep space) only the gravitational tidal forces could be sensed and these vanish quickly (even faster than the square law) with distance from the planet or other body.
Can you feel the different pull of the earth on your feet versus your head? No.
In earth orbit, it's even less tidal force. In deep space even lesser. So for all intents and purposes, you wouldn't be able to tell the difference.
BTW, the Apollo astronauts, on their way to and from the moon, pass a point where the gravitation of earth and moon cancel. They jokingly said that they could feel a bump there to make fun of ignorant news reporters, but in fact that moment is unnoticeable, even though the vehicle changes from a decelerated motion to an accelerated one towards earth.
Answer: Remarkably, it is the case that as long as one is freely falling in a uniform gravitational field, one cannot "feel" the difference between an arbitrarily strong field and an arbitrarily weak one; one "feels" weightless in any case.
However, in reality, there are tidal forces (no uniform gravitational fields) which, for extended bodies, tend to stretch one in the radial direction and compress one in the others.

So, for example, if one were in orbit around a compact object such that the tidal forces were significant, one could certainly "feel" the difference between orbital free fall and outer space.
For low-Earth orbit, the tidal forces are there but not significant enough for one to "feel" them.
Comment: Why was this downvoted? As a layman, I'd like to know what the downvoter sees wrong with it.

How you feel in outer space vs. orbit?


Error Message when logging into WordPress on Xampp

Question: I have two Wordpress sites running on Xampp.  I am getting an error when logging into the second site I set up, it say's 'username is not registered on this site.  If you are unsure of your username, try your email address instead.'  I can only login to the first site I created.  How can I fix this?
Comment: Did you use exactly the same details when you created the admin account on both installs? It's one of like two screens during the install process. You could copy the db data from one install the other, but if it's a fresh local install with nothing important on, you could just reinstall the secondary and make sure to check the remember option this time when you setup the admin account.
Answer: Does the 'bad' site public-facing page display? If not, then you have database issues (doesn't exist, permissions, user account, etc). Check the wp-config.php file to make sure that the database name/user/password is correct.
If the public-facing page displays, then use phpMyAdmin (or similar) tool to look at the wp-users table in the database specified by the site's wp-config.file. Make sure the name/email is correct and the same as what you are trying to use.  There are many googles/bings/ducks on how to change the password directly in the database.
Also, look at the error.log file for the 'bad' site to see if there are hints there as to the issue.


A Dream in White, Black, Red, Blue, and Green

Question:

$\;\;\;\;\;\;\;\;\;\;\;\;\;\;$
Comment: The puzzle was supposed to be entirely wordless without the plaintext at the bottom, but PSE refused to accept a 0 character count.
Comment: like this? $$$$
Comment: The title compared to the pictures suggest a 5th image to exist :(
Answer: As noticed by @Ankoganit Image #1

spells "communed" after you take the mirror image of each component.

Image #2

There is 1 red circle in the middle, 2 next to it, 19 next to those...
This gives 1-2-19-20-18-1-3-20, which corresponds to "abstract".

Image #3 was also solved by @Ankoganit

and gives the word "rightist" by following the line on a qwerty keyboard with the shown letters I, O and Y giving the position on the keyboard.

In image #4

you follow the line showing with the roman numerals how many letters you go up or down in the alphabets, with the letter I (9) being at the shown position. This gives 19-8-15-21-20-9-14-7 or "shouting"

In case there is more to the puzzle, the following could be relevant

All of the solutions contain two groups of three consecutive letters

communed has cde and mno
abstract has abc and rst
rightist has ghi and rst
shouting has ghi and stu

If we remove these letters from the words (but each letter only once in each word) we are left with

communed
abstract
rightist
shouting

=mutation
Answer: Partial answer
Image #1:

 As the symbol at the bottom signifies, we need to flip the individual components horizontally. Doing so yields:

 ...which reads COMMUNED.

Image #3:

 Turning it upside down one could read the letters Y,I,O, and their positions match up with a QWERTY keyboard layout. Following the blue path, one can trace out the word RIGHTIST.


How can I limit the number of IMAP emails Outlook 2010 syncs?

Question: I'm helping a user with Outlook 2010. They have a large mailbox that they want to sync over IMAP, but we want to not sync the whole thing in order to keep Outlook performing well. A lot of email clients (especially those on smartphones) allow you to say "Only sync the past .... days" where you can choose a week, a month, two months, etc. Does Outlook allow for this, or is there any way that I can fake the functionality?
Answer: There is no way I know of to do that. You can only choose to download headers, or full e-mails (HIGHLY recommended in my opinion). I would also recommend that you teach users to not store too many items in one folder, since that seems to affect performance. In general, for IMAP, it is just slow with larger mailboxes.
Ultimately, if you want excellent performance with large mailboxes, and quick synchronization times, I can't recommend hosted Exchange enough. I have multiple clients using it, including a lawyer's office where they must keep everything, and it performs extremely well. Some of the users have as much as 12GB of mail, and it synchronizes header changes in seconds from a server 3000 miles away....only after that does it pull the bodies and attachments.
If you do choose to go this route, come back and I can offer some concrete advice on how to make the move, because I encountered numerous pitfalls the first time I went from IMAP to hosted Exchange, including who I would go with and why.
Comment: OK, thanks for the help. We actually use Google Apps for Business, so our users have access to Gmail, but this user just prefers Outlook. I'm going to go the "teach users to have small folders" route, because currently all of his mail is in one box- the inbox. I'll archive all of his mail and set Outlook to not sync Gmail's "All Mail" folder.
Comment: @John I was going to mention archiving too, but thought that was a bit obvious.
Answer: I dealt a bit differently with the same issue, where a user wants to use Outlook with Google Apps for Business. You can just go to Gmail settings and under "Forwarding and POP/IMAP" tab, change option "Limit IMAP folders to contain no more than this many messages" to 1000 (which is the lowest number). This will make Outlook download only 1000 latest emails. It works without a problem.
Comment: Does this limit the number of emails stored in the folder on Gmail's side, or only on Outlook's side? I remember seeing this option when I was investigating the issue for the first time, but I did not understand that it applied the limit to only Outlook and not Gmail as well.
Comment: Excellent! Is there any equal option in Microsoft accounts?
Answer: Since you're using Gmail, you might consider the Google Apps Sync for Microsoft Outlook.  It lets you set a hard mailbox size limit for Outlook.  For example, if you set the limit to 1 GB, the Sync tool will begin removing older messages when you hit the limit (the emails are still available in Gmail though!)
More on this:
https://support.google.com/a/bin/answer.py?hl=en&answer=184126
Download here:
www.google.com/apps/intl/en/business/outlook_sync.html
Answer: Here is a very good explanation I found on Microsoft Office help:
Click File > Account Settings > Account Settings

Select an Exchange account, and then click Change
Under Offline Settings, move the slider to the desired amount of time, such as All, 12 months, 6 months, 3 months, or 1 month.

For example, if you move the slider to 3 months, only mail from the past three months will be synchronized to your Offline Outlook Data (.ost) file from the Exchange server. Items older than 3 months reside only in your mailbox on the server. You can change this setting at any time.
Change how much mail to keep offline (answers your "Only sync the past .... days" question)
Download headers only

On the Tools menu, point to Send/Receive, point to Send/Receive
Settings, and then click Define Send/Receive Groups.
(Keyboard shortcut) To open the Send/Receive Groups dialog box, press
CTRL+ALT+S.
Select the Send/Receive group that you want to modify, and then
click Edit.
For any folder that you select to include in a send/receive, under
Folder Options, select Download headers only.
Repeat the previous step for each folder that is included in the
send/receive.

Download items and attachments smaller than a specified size

On the Tools menu, point to Send/Receive, point to Send/Receive
Settings, and then click Define Send/Receive Groups.

(Keyboard shortcut) To open the Send/Receive Groups dialog box, press
CTRL+ALT+S.

Select the Send/Receive group that you want to modify, and then
click Edit.

For any folder that you select to include in a send/receive, under
Folder Options, select Download complete item including attachments,
and then select Download only headers for items larger than n KB.

Enter the maximum size of items that you want to download. You can
specify a size from 1 KB to 9999 KB. If an item is larger than the
number that you enter, only the header for the item is downloaded.

Repeat the previous step for each folder that is included in a
send/receive.

Create a Microsoft Exchange account synchronization filter
This feature requires you to use a Microsoft Exchange Server 2000, Exchange Server 2003, or Exchange Server 2007 account. Most home and personal accounts do not use Microsoft Exchange. For more information about Microsoft Exchange accounts and how to determine which version of Exchange your account connects to, see the links in the See Also section.
Synchronization filters allow you to choose which items are downloaded or kept in your Offline Folder file (.ost). The .ost file is used when you work offline or use Cached Exchange Mode.

In the Navigation Pane, right-click the folder whose contents you
want to filter when downloading from Exchange, and then click
Properties.
Click the Synchronization tab, and then, under Filtered
synchronization, click Filter.
Do one of the following:

To filter by using additional criteria such as a category or
importance level, click the More Choices tab, and then select the
options that you want.
To filter by using additional or custom fields, click the Advanced
tab, and then select the options that you want.

The next time the folder is synchronized, any new or modified items in the .ost file are uploaded, all items matching the filter are downloaded, and items that do not match the filter are removed from the local copy.
Reduce mail download sizes (gives you much more options)
Comment: While these links may answer the question, it is better to include the essential parts of the answer here and provide the links for reference.  Link-only answers can become invalid if the linked pages change.  (And, yes, Microsoft web pages *do* often disappear.)
Comment: Sorry I think the offline settings slider is only in Outlook 2013 not 2010
Answer: You can specify a number of latest messages to sync in
Gmail > Settings > Forwarding and POP/IMAP > Limit IMAP folders to contain no more than this many messages > set desired number.


Is Whey Protein Bad For the Heart

Question: Since the heart contains muscles....does taking whey protein increase the muscle size of the heart thus increasing the weight of the heart...so is it bad for health?
Comment: Why would whey be different than any other protein?
Comment: Whey protein is just made from either milk or as a byproduct of cheese making. It's just dairy. Your heart will enlarge in response to exercise in general, regardless if you use whey or not.
Comment: So is exercise bad for the heart than coz it increases heart size?
Comment: Uh...no, not as a general rule. It's a natural adaptation. Why do you think a heart that weighs more is less healthy?
Answer: No, whey protein is not bad for the heart.
Two reasons for this:

Protein consumption alone, in the absence of significant (overload) exertion of a muscle, does not cause a muscle to grow. Additionally, in the absence of kidney disease, excessive protein consumption is not harmful.
An enlarged heart (cardiomegaly) may or may not indicate a problem depending on the cause. If your heart is enlarged due to participation in endurance exercise, that isn't a problem, but if your heart is enlarged because your arteries are clogged and it struggles 24 hours per day to pump blood through them, then that is a problem. And in the latter case, the enlarged heart is a sign of the underlying problem of arterial plaque, it is not actually a problem in itself.
Answer: The body gets in most western countries enough protein from diet alone, excess protein will just be burnt, no matter the source of it. If your intake is far to high it may have negative health effects, no matter if its from whey or wheat. Excercise may increase heart volume, which does not have to be bad as it in this case may lower your resting pulse. If your heart is enlarged due to drug abuse or fat build up due to a terrible diet or disease, it will have negative health effects.
Answer: The bottom line: take moderate amount of whey, don't take 10 scoops at a time as some do thinking to accelerate growth. Anything including air or water if taken in crazy amounts is not good. the mice studies they do in the labs is the equivalent like a person taking in cannisters of protein powder. They don't tell you that in their studies.

Is Whey Protein Bad For the Heart


getting black screen on iPad with an universal build

Question: I'm developing a game that should run on all the iOS platforms but I'm getting a black screen on iPad.
I'm not using xib files since I'm building the window programmatically.
<code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    CGRect rect = [[UIScreen mainScreen] applicationFrame];

    // fullscreen window
    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    glView = [[EAGLView alloc] initWithFrame:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)];
    [window addSubview:glView];

    [window makeKeyAndVisible];

    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];

    [glView startAnimation];

    return YES;
}
</code>
It does receives the touces and play the music as well as the sfx but it shows only a black screen on iPad.
I've been looking for a solution to this but all the responses were about xib files (which I don't have).
Does anybody has experienced the same?
What could be the reason for the black screen on iPad?
Thanks.
Edit: forgot to say that I'm using OpengGL ES 1 with VBOs.
Answer: Try replace this code line:
glView = [[EAGLView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
For more questions, you can check this link


Books about incremental data clustering

Question: Does anyone have a suggestion of any relatively recent and good book about data clustering?
More specifically, I'm looking for incremental clustering.
Comment: Chapter [7 Clustering](http://infolab.stanford.edu/~ullman/mmds/ch7.pdf) from the free book [Mining of Massive Datasets](http://infolab.stanford.edu/~ullman/mmds.html), and 7.6 Clustering for Streams and Parallelism might interest you.
Comment: Great one, chapter 7.6 seems interesting for me (even if it is somehow brief), I'll take a look at it ! (of course, I would prefered the whole book to be on this specific subject)
Answer: In a field that is this actively researched, a book will be quickly out of date. Just as with regular clustering: most books still discuss just hierarchical clustering, k-means and EM.
There is a book by C.C.Aggarwal, "Data streams: models and algorithms". Chapter 2 is on clustering.
It is better to check for recent publications in this field, in particular survey articles.
There is one survey from 2009: Alireza Rezaei Mahdiraji, "Clustering data stream: A survey of algorithms". But you will want look at newer methods than these, too.
Answer: Not a book, but a paper on this area.

Ailon, Nir, Ragesh Jaiswal & Claire Monteleoni. 2009. Streaming
  k-means approximation. In Advances in Neural Information Processing
  Systems.
Answer: I recommend you chapter 8 from "Cluster Analysis: Basic Concepts and Algorithms"
It provides a very definite overview on clustering, including Agglomerative Clustering, that we can count as incremental clustering.

Books about incremental data clustering


Enabling Sqlite3 for php on fedora

Question: I am trying to get php with sqlite working on my fedora server. In the phpinfo is see that ./configure was set with the option --without-sqlite3. From what I have read these means that I might have to recompile or reinstall php with with sqlite. I was wondering how I would go about installing or configuring php with sqlite.(possibly a yum command?) thanks
Answer: You do not need to recompile anything. In fedora you can get the sqlite php module by installing the php-pdo module. The following should do the trick.

yum install php-pdo

The reason your seeing php as having been built without sqlite is so fedora can split the php package and thus not force a big string of dependencies on people who don't want them. For instance you need sqlite and thus likely you do not need postgresql. If fedora was to build the main mod_php application with all --with's turned on you would end up installing postgresql without needing or wanting it. This helps people concerned with both security (only install exactly the software needed) and people concerned with package download bandwidth.
Comment: I can say from direct recent experience that the mediawiki application works correctly with an sqlite database with just the php-pdo package installed under rhel5.
Comment: I believe that on Fedora Core at least, you do still have to recompile - at least on my Fedora 13 server I did.  Php-pdo was installed and up to date, but if I wanted to use connect using the sqlite functions (http://us3.php.net/manual/en/ref.sqlite.php) instead of the functions that are included with pdo-sqlite (http://php.net/manual/en/ref.pdo-sqlite.php) I had to recompile - at the very least the connection was different.  I admit, though, it could have been a mistake on my part, but that was my experience.
Comment: This holds true Fedora 19. Entering `yum install php-pdo` @ the command line gives us access to SQLite3. Double check with `rpm -l php-pdo` if so required.
Answer: All over the Internet you can find questions and answers regarding sqlite support in PHP on Fedora Core, Red Hat, and CentOS distributions.  While many of them have differences in how to go about enabling support, all of them say the same thing about the cause:  packages for PHP on those distributions are compiled without support for SQLite.  To my knowledge there are no current RPM's for easily installing php-sqlite3.
I recommend you take a look at the comments found on PHP's SQLite Installation page that detail how to get it working as painlessly as possible.  The short version is to ensure that you have php-devel installed (if not then run yum install php-devel) and do the following:
Download the source for PHP from http://php.net/downloads.php and compile it with support for the SQLite module.
tar xfvj php-5.3.2.tar.bz2
cd php-5.3.2/ext/sqlite/
phpize
./configure
make
make install
/etc/init.d/httpd restart

Comment: In case anyone happens to come across this answer in the year 2013 or later, note that it is completely obsolete.
Comment: Also, the above procedure will turn an rpm-based system into one that has a mix of RPMs and randomly-installed software, leading to a management nightmare.

Enabling Sqlite3 for php on fedora


Scheduling reservations (not restaurant) with python

Question: I'm writing a python application that uses OpenStack to provide students access to a limited number of virtual machines.
Students can place reservations, either now or in the future.
I need to limit the number of virtual machines scheduled at any time to X while still allowing students to reserve vms if slots/reservations are available.
Reservation objects look like the below (sqlalchemy). I would know the start time and the length of the reservation requested, at which point I need to go through existing reservations and see if there are too many reservations in the time period requested. The *_job fields are the names of APScheduler jobs.
<code>class Reservation(Entity):
    student = ManyToOne('Student', required=True)
    class_id = ManyToOne('Class', required=True)
    image = ManyToOne('Image', required=True)
    # openstack image id filled in once the instance is started
    instance_id = Field(UnicodeText)

    # apscheduler jobs
    stop_instance_job = Field(UnicodeText)
    start_instance_job = Field(UnicodeText)
    warn_reservation_ending_job = Field(UnicodeText)
    check_instance_job = Field(UnicodeText)
</code>
Any pointers on where to look for examples of schedule algorithms or something like that? I'm not even clear what to search for...
Thanks.
Comment: This strikes me as an application for Dijkstra's Banker's Algorithm which is normally not discussed much in job scheduling as its preconditions (notably execution time) are hard to know in advance but which you have. The general class of problem is "Batch Scheduling"
Comment: +1 for well-phrased, short, but complete question.
Comment: Great. Thanks kindly for that. :)
Comment: Far from optimal solution in general case, but to get you started without any optimizations involved (especially when someone deletes the Reservations): **What to search for?** - Well, you need to search for all `Instance`s that do not have any reservations between the `StartTime` and `EndTime`.
Comment: Sorry, what I meant in terms of what to search for was what to google for scheduling. :)
Answer: You should look up Grid based Schedulers. Normally schedulers don't know the true execution time (or time of resource use) and complicated heuristics are used to guess how long a problem will take (see such heuristics on a grid scheduler at: PDF download Describing Scheduling on Grid basis). A simpler approach with a basic grid for representing workload over time will most likely meet your needs. Python doesn't have any awesome grid object libraries that I know of (I've implemented a few in C++ and Python before though and they're not too hard). You should look at the numpy package for the easier interpretation of multi-dimensional objects -- which can emulate or implement grids easily enough.
Msw mentioned Dijkstra's Banker's Algorithm which is a form of job scheduling -- however your problem cares about future state more than current state and you can accurately predict (know the true value of) task times. Thus a T(timesteps) by N (number of resources -- might be just 1) by M (max resource reservations) grid which you fill in as jobs are registered would suffice. Determining if a particular job can be scheduled in a particular timeslot is a O(task_length * M) checks on a subsection of the grid (start, stop)x(required_resources)x(1,M) for an empty slot.
Finding an adequate location for a particular job (picking the start time) is a more difficult task and would be achieved by a modified Dijkstra's algorithm, or from any standard scheduler (msw's comment is more helpful for this task than for a timeslot capability check). Note that a lot of the scheduler content online is specific to OS process scheduling which cares more about the type of operation (I/O or not) and penalties for taking longer than expected than about abstract resource use. So google searches for schedulers will oftentimes give you Linux scheduler implementations rather than techniques for arbitrary data. Try looking up Shortest job schedulers, which are oftentimes simpler and less reliant on OS tasks when explained.


Is PHP truly faster on the JVM?

Question: Lately I've been hearing a lot of people evangelizing that PHP with Resin is actually much faster than with mod_php, but I cannot find any benchmark anywhere.
Is it true or just vendor BS?
Answer: InfoQ has this video presentation from the 2008 JVM Language Summit on "P8, an implementation of PHP on the JVM. Topics covered include the reasons for bringing PHP to the JVM, an overview of PHP and P8 ..."
From what I've heard so far, performance was a topic of much discussion at the Summit, but I haven't had time to get through this presentation yet. However, I don't have any trouble believing that PHP source compiled into JVM bytecode and then run on a hot-spotting JVM would outperform a pure interpretation-based implementation.

Is PHP truly faster on the JVM?


"At" or "in" the office?

Question: When do you use at the office? And when do you use in the office? What's the difference between the phrases?
Answer: 'At the office' refers generally to the state of someone who works in an office of some kind being at work, e.g.

"Where's Bob?", said Jim.
  "At the office.", replied John

It can also refer to an object being at said place of work:

"Where's your briefcase?", said Jim.
  "I left it at the office.", said John.

'In the office' refers to someone or something physically being in a specific office, e.g.

"Where's Bob?", said Jim. "In his office.", said John.

This would usually be used when the office in question was in close proximity to the speakers, for example if Jim and John were in another office in the same building as Bob.

"Where's the telephone?", said Jim. "It's in the office", said John.

However, in and at are often interchangeable. Take the briefcase example. John could have said:

"I left it in my office."

To summarise, 'at' is a more general, vague term, whereas 'in' usually refers to a specific location.
Comment: In some cases "the office" means "the place where I work" which could mean a building or a suite in a building.

In other cases "the office" refers to a particular room.

The context of the answer depends on the context of the question.
Comment: +1. "In the office" usually means "physically inside the office" which doesn't make as much sense when you are using "the office" metaphorically.
Answer: I suspect "at" is more often used with buildings or non-specific locations

John is at home.
John is at work.
John is at the shops.
John is at the office (meaning his office building).

I think "in" is more often used with specific rooms.

John is in the kitchen.
John is in the meeting room.
John is in his office.

This theory falls apart somewhat when I consider

John is in France.
Comment: I am at desk in my office. Is that right?
Comment: `in France` because in this case France is considered a "boxed" space, i.e. a territory with fixed borders, like a room, only immensely bigger.
Answer: You're "in" the office if you mean to emphasise your physical location, inside a room where one works. You're "at" the office if you are at a place of work, but not emphasising a specific room.
So, "I need to have a printer in the office", but "I'm at the office, but I'll come home to see you soon."
Answer: A close call. In my opinion, 'at' is used when one is correcting an implied absence

I shall be at the office tomorrow

implies the existence of doubt that I would have been there. Either I had previously said I would be away, or something led you to believe so and I am contradicting that belief.

I shall be in the office tomorrow

confirms my presence, as was anticipated (probably by both of us).

"At" or "in" the office?


Space and time in Kant and space and time in physics

Question: From the Kantian perspective, what would be the relationship between our intuitions of space and time (which form the structure of subjective experience and are not things that exist outside of human cognition) and the mathematical models of space and time that are used in theories of physics? Is Kant going to deny that these mathematical models have mind-independent existence and instead say that they are intelligible only through being abstracted from our intuitions of space and time? Do these mathematical models of space and time pose a problem for Kant somehow?
Comment: Transcendental idealism, like idealism in general, is a metaphysical position, meaning that it is about things that are beyond physics. They don't--in general--imply anything about physics that is different from what realist positions imply. There are some differences at the extremes perhaps; for example, an idealist may be more willing to accept the possibility of psychic powers or miracles than a realist, but they don't require such things. It is extremely unlikely that science would ever be able to falsify a metaphysical theory because such theories just don't make observable claims.
Comment: Bear in mind that Kant considers compelling shared intuitions like 'autonomy' to be real and mind-independent, despite that they can only be experienced in a mind.  Space and time are quite as real as autonomy.  So things can be real and independent of individuals, even if they are not aspects of all beings, or of some world totally independent of us.
Comment: Relevant: https://philosophy.stackexchange.com/a/79471/17209 - don't confuse pure intuitions with concepts of space and time.
Comment: @hide_in_plane_sight What means autonomy to be real? Has space autonomy to be real?
Comment: @PhilpKlöcking Do you think pure intuition exists? If so then how does it look like? Intuition is always tainted with theory or memory. There is no such thing as pure intuition. Even animals dont have that. Maybe by meditation you can arrive at the point of pure intuition or pure perception. It would be a very disturbing experience.
Answer: Mathematical models of space and time doesn't pose a problem for Kant according to reference here:

In 1781, Immanuel Kant published the Critique of Pure Reason, one of the most influential works in the history of the philosophy of space and time. He describes time as an a priori notion that, together with other a priori notions such as space, allows us to comprehend sense experience. Kant holds that neither space nor time are substance, entities in themselves, or learned by experience; he holds, rather, that both are elements of a systematic framework we use to structure our experience. Spatial measurements are used to quantify how far apart objects are, and temporal measurements are used to quantitatively compare the interval between (or duration of) events. Although space and time are held to be transcendentally ideal in this sense, they are also empirically real—that is, not mere illusions.

So clearly Kant is a realist regarding space and time similar to Newton's absolutism of space (he defended Newton in his works), not an idealist such as Leibniz's space relationalism. This is consistent with Kant's famous synthetic a priori position regarding space and time, which are verifiable independent of anyone's experience under this POV. Currently most versions of mainstream physics spacetime notions belong to realistic POV.
Comment: FYI, he explicitly rejected Newtonian absolute space and argued for relative *conceptions* in his only work on philosophy of nature.
Comment: What the Wikipedia quote says is that space and time are empirically real, that is, true according to a liar.
Comment: @RodolfoAP feel similarly, sounds some innate contradiction (fallacy), that's why Kant's *synthetic a priori* metaphysics trying to bridge empiricism and rationalism has always been controversial...
Answer: Let's imagine everyone viewed the world, for the sake of argument, through hyperbolic geometry rather than Euclidean geometry. Then our mathematical and physical models of the world would have to begin with that fact because that is the ground of our observations, no matter if later we found that in some way Euclidean geometry was a better fit. It's in this way that our physical and mathematical models are mind dependent.
Answer: What you are trying to do with such question is to oppose physics to perception. That is, assuming that space and time would be, from a Kantian perspective, transcendentally ideal, which existence depends absolutely on the mind, but from a scientific/physical perspective, a reality independent of the mind. In such context, you are asking for the relationship between both.
To start, science seeks for empirical truths, not final truths. When we make science, we know that the product (scientific knowledge) will be dependent on our perception, that what we come to learn is not a final truth. In such sense, any scientific approach (or any formal approach from physics) of space and time is assumed to be dependent on the mind. Finally, the physical perspective of time and space has the same basis as the Kantian perspective. So, they are (necessarily) logically coherent:
The scientific and the Kantian views of space and time are essentially the same.
In order to find the relationships between the scientific and intuitive perspectives of space and time, I will use an analogy, comparing the literary and emotional perspectives of a feeling. Both can be equivalent in the sense that they would just be two different forms of an intuition.
So, what are the relationships between the scientific and the Kantian perspectives of space and time? They are the same as the relationships between a feeling and an artistic work expressing such feeling (e.g. the relationships between joy and a poem evoking joy). The description of time and space in physics would be just a formal way to express perceptions of space and time. The only difference is that formal physical descriptions use mathematics to describe experience, and subjective intuitions of space and time are just the product of our subjective experience. But mathematics provides an additional advantage: math is not only a language to communicate concepts, like english, but also a tool that allows analyzing such concepts. So, math provides intuitions of new forms (relativity is essentially a different expression of our intuitions of space and time), like poems can provide feelings of a literary form, which would be essentially different expressions of the same intuition.
So, relativity would be essentially a set of formal conclusions raising from intuitions and empirical concepts, that are the product of a mathematical analysis. Relativity would not be possible without mathematics.
Perhaps you are probably still curious about the effect of the formal, scientific knowledge, over our intuitions. For example, questioning what does the relativistic spacetime curvature implies over my intuition of space and time? In the analogy, how does a poem of joy impact on my intuition of joy?
The answer would be: in nothing. Following the example, there would not be any qualitative change on the effect that a poem of joy evokes on my feelings of joy. In order to know any possible effect, noumenal knowledge would be necessary, so to compare it with phenomenal knowledge, to observe the relationships. Following the example, if joy would be the equivalent of a white light from a noumenal perspective, we could say that the relationship that poems have with feelings is that poems of X specific class have the capability of evoking white light on a phenomenal perspective.
Comment: @DescheleSchilder Mainly, because science does not enter into metaphysical considerations. Philosophy does. Example: "_Induction is the glory of science but the scandal of philosophy_". C. D. Broad. (induction is necessary for finding empirical truths, while in philosophy, induction is considered as not necessarily true: https://plato.stanford.edu/entries/induction-problem/). This is not the only conflict between empirical facts and final truths. See Kant's antinomies, for  empirical/rational contradictions regarding space, time.
Comment: Why does svience seek for empirical truth only?
Comment: @DescheleSchilder I mean science is already aware that our perception is limited so everything that we can follow from that, has that same problem. Like take a ruler and measure and object slightly bigger than the ruler and write down the results. Or pass that ruler to 100 people and ask them to measure that object and you'll not see 1 answer but several answers that ideally revolve around one value. So that value would be our assumption and the spread is our uncertainty and it's physically impossible to get rid of that uncertainty entirely.
Answer: Kant's notion of space is a transcendental one. Which means that space has an autonomous existence but it transcends our perception of space, or time, for that matter, as irreversible perceived changes of objects in perceived space. We will never, according to Kant, be able to know the transcendent reality an Sich. Which is a kind of Platonic notion, because Plato thinks the same about mathematical objects, existing in an extramundane mathematical heaven. We can perceive math, like spacetime, while not knowing how the math objects themselves look like.
In his left glove thought experiment, Kant argued that space is not relational as Leibniz stated. The relationships between the parts of a left-handed and right-handed glove are the same and still they are different gloves. So space is not relational. Which doesn't mean that space can be perceived without looking at objects that stand in a relation to other objects. Space and objects in it have a mutual dependence though. Space without objects is a, well, empty notion.
So Kant believed (wrongly, in my opinion) that space refers to something autonomous, independent of creatures, but it isn't space (or time) as we see it. As the porridge in which objects are submerged as dried raisins.
He would have regarded the modern notion of spacetime as a perception referring to an autonomous thing, substance, essence, entity, or whatever you wanna call it. But the perception isn't the real thing, which we will never be able to contemplate as we're bound to perception. Which of course can be questioned. We might perceive a transcendent reality.
Comment: This is a severe misunderstanding of Kant. In his *Phoronomy* (Ak. 4:480f) he clearly argues that a) the space we deal with in natural sciences is material, relative space that comes to us through the senses, ie. as a relation between observer and object, b) we cannot know, hence not talk about whether space exists as an *as such* (an sich), and c) absolute space is, if anything, an idea of reason which has only *logical* bearing (as idea of an outermost spatial frame of all empirical movement) but no physical/real being whatsoever. Please do not use early writings and sell them as critical.
Comment: I am sorry that this may have come across a bit harsh. The main itch I got about how you wrote it here is that it is everything **but** clear that there is some "Raum an sich" (space as such). While Kant does argue that there has to be some material/empirical space, this import arguably is a mere function of our form of intuition instead of anything independently affecting us. This is even an [important feature when distinguishing Kant from Berkeley](http://strangebeautiful.com/other-texts/harper-kant-space-emp-real-geom.pdf). If you got any source for your reading, I'm happy to hear about it.
Comment: @PhilipKlöcking Aha!
Comment: @PhilipKlöcking No problem. But, for example, what's the difference between a "severe" misunderstanding and a misunderstanding? You misunderstand or not. I notice this use of adjectives a lot here. "Serious", "grave", "unforgivable", "blatant", "severe", etc.  Anyhow, the spacetime an Sich can't be known, or at least isn't the perceived spacetime. He might have considered it relational, but not as Leibniz did. That's why he introduced the left-hand glove idea. If no further objects are involved to be in relation with, a left-hand glove is no different from a right hand glove, since all...
Comment: ...relations between the parts are the same. Still the both are different, so space has a non-relational character, and it can exist even when no objects are present. I doubt this myself because space is an aid for objects to interact and you can't have an empty space, as QFT acknowledges. I'm not sure what Kant truly thought. Spacetime is autonomous. Okay. But is it the stuff we see?
Comment: Look at CPR A375-77, B 359-60. Space and time are *only in us*. Space is by no means noumenal/autonomous but indeed merely the form of our intuition. What Kant rejects by using the glove example in the *Prolegomena* is Leibniz's *inner* relationalism of objects (where two monads with the same internal relations are identical) exactly because we see objects with identical inner relations as different in space in their *outer* relations (mind: everything as appearances, ie. our representations, not things-in-themselves). Kant is not a Platonist.
Comment: @PhilipKlöcking But if you have two different gloves you can connect with a larger whole and say the whole has different inner relations and thus the gloves are different but not outside the whole. So Kant sees space as monad dependent, but autonomous? Does he think there is space an Sich, or can the "an Sich" only exist for objects in space?
Comment: I wouldn't use monadic language as he clearly rejects the whole concept of reality or substance outside of the synthesis of intuition and concept altogether. And yes, an 'an sich' only makes sense as an idea of reason because the object of perception *may* be different from how we perceive it. And space is not an object of perception, it is their frame.


Brannock Device US Size to Nike/Adidas Football Boot US Size

Question: If I measured as a US size 7 on the Brannock Device, which US size should I pick in an Adidas boot or a Nike boot?
Comment: it was a little unclear what you were asking. I think I've captured your question better through editing, but please re-edit it if I've misinterpreted what you were asking.
Answer: Looking at the Brannock Device sizing chart here, it appears that no further information is given other than the shoe size.
Unfortunately, feet are all very different and the problem with a specific number is that it assumes certain proportions between foot width and length, as well as arch type and other differences.
Furthermore, not only is there variation between manufacturers, different manufacturers' individual products also vary widely.
I am roughly a US size 14. Adidas Copa Mundials in US size 14 fit me perfectly. However, Nike's range of US size 14 indoor football shoes I find are a little short and feel very tight on my heels and toes, even though they fit the width of my foot perfectly.
You will need to try a range of products by a variety of manufacturers to find a boot that fits you well. The best advice I can offer is to stick with the same boot once you have found one that fits you comfortably and works well for your playing style. A lot of time and money (in purchasing shoes that end up not working out) can be wasted if you switch to a new product every time your boots wear out.


Will termites come in with mulch

Question: I am hearing that termites come through mulch, is that true? What do you guys use as an alternative? I see some people use Pine straw mulch, will that help ?
Answer: I was concerned about this too. Not so much termites being in the mulch, but attracting them towards my house by surrounding it with delicious decaying wood that is often wet from watering.
I used rubber mulch that is made from recycled tires, which won't attract insects and looks reasonably close to regular mulch. Plus Recycling!
The main downside is that it gets SUPER hot in the summer. Enough to burn your hand while working in the garden bed in Texas summers.
Answer: It is possible for any wood destroying pest to make it through the debarker, and then the hammer hog that smashes the bark into "hog fuel" or "mulch".
I work in a mill and have used many truck loads with no problems probably because the pests are normally deeper in the wood than the bark layer but it is possible.
Comment: Regardless of whether the pest is in the mulch - they can find and attack the mulch afterwards. Depends on your local area's pests.

Will termites come in with mulch


iOS: Can openURL ever be nil?

Question: For -[UIApplicationDelegate application:openURL:sourceApplication:annotation:], can the URL ever be nil? I'm asking because I saw someone put in a check if (url) // ..., but isn't that unnecessary? I.e., doesn't this method always get called with a non-nil NSURL argument for openURL?
Answer: Assuming an external invocation (ie from another app trying to open yours), then I would assume it is non-nil, however perhaps (unlikely I know) you call it internally in which case it might be?
Assumptions however are dangerous!
It would therefore seem prudent to sanity check the value before doing something that might cause a crash should the value be nil.
Seems OK to check if you ask me.
Answer: According to Apple Documentation, the url parameter is:

A object representing a URL (Universal
  Resource Locator). See Apple URL
  Scheme Reference for Apple-registered
  schemes for URLs.

You have to register your application to accept specific URLs.
This article shows how it is done.
This would lead me to believe that this method would not be called unless it adhered to a URL Schema specified by the application.
If it is being called internally, than you would know whether you would need to check for nil or not.  As for an outside application calling it, I can't see how that would happen.

iOS: Can openURL ever be nil?


If Muammar Gaddafi was a benevolent dictator then why was the military intervention by NATO in Libya conducted?

Question: What was NATO's stated problem with the late Muammar Gaddafi's leadership as the leader of Libya? What possibly would have led NATO signatories to be all over his rule and yet the citizens were happy (most of them); like everything was okay as far as the living standards of the people, the free education, and the rich oil resource. Wasn't he a benevolent dictator if dictatorship was anything to go by?
Comment: For once, neither the NATO nor the USA did not start the overthrow of Gadaffi. It started as an internal revolt by the citizens that "loved him so much" (IIRC because of the brutal repression of a mutiny in a prison). Some countries in the NATO had one or two "pending issues" with Gadafi and used the situation in their favour, but they did only help the people that already had rebelled against Gadaffi. Since it is a pretty recent event, probably you can check the newspapers of these days yourself over the net.
Comment: Mugabe is just one step behind, he is certainly a pariah. Nobody is considering military action but there are countless dictators that have an easier relationship with the west than Mugabe. In that case, it's not the only reason but distance is certainly a factor. That said, as I have already noted, you are definitely right that there is a lot of arbitrariness in this and that there are many other very bad dictators out there. But that's a completely different thing than implying that there was nothing wrong with Gaddafi or that he was "benevolent".
Comment: Gaddafi was benevolent in the same way as God is supposed to be as long as you stick to his religion. If you don't, then all hell will break loose (take e.g. Sodom and Gomorrah).
Comment: I was wondering why Him and yet The Zimbabwean counterpart is a filthy dictator and the country is miserable what is the motivation behind NATO intervening Gadafis Rule and he is not the worst so to speak
Comment: Maybe this question should ask how the West profited from the overthrowing of Gaddafi or how democracy in Libya and standards of living fared. These are all answerable question. As it is this questions asks multiple questions "Was Gaddafi a benevolent dictator" can be answered quite independent from "Why was the military intervention conducted".
Comment: @mykey As far I know there is no oil and gas in Zimbabwe, so the country is not a big interest.
Answer: There were no real problems with Gaddafi. It was just a declared US policy change to stop supporting dictators like him.
Secretary Condoleezza Rice
Cairo, Egypt
June 20, 2005

For 60 years,
  my country, the United States, pursued stability at the expense of
  democracy in this region here in the Middle East -- and we achieved
  neither. Now, we are taking a different course. We are supporting the
  democratic aspirations of all people.

http://2001-2009.state.gov/secretary/rm/2005/48328.htm
Comment: That's what she said, but is that the true motivation?
Comment: @gerrit This is an anwer to the question. If you want to know about motivation please ask another question :-)
Comment: So NATO spent approximately $1 billion to "support democracy"? Maybe...... they are lying...
Answer: Your question starts from a couple of false assumptions.
With big oil revenues and a small population Libyans could have been richer than the Norwegians, but that never happened. Furthermore the Western nations to oust Gaddafi exploited the internal dissent. This means that a lot of people were not happy with his regime, therefore calling him a benevolent dictator is a strong assertion.
Another incorrect  assertion is calling it a NATO intervention. It was a military intervention led by UK, France and the USA, plus the Gulf states that provided weapons and support for the militias. Most of the NATO countries did not participate.
As for the stated goals, at the time there were mixed declarations and goals. The British media recalled many times the stories of the Lockerbie bombing and the shooting at the Libyan embassy in London. BTW I cannot find any reference on the internet now, but I well remember that soon after Gaddafi's death James Cameron was interviewed by the BBC and he declared "Finally Libya has been democratised".
The Americans feigned little interest and made the usual claims about democracy, but on the other hand they sheltered General Haftar for a long time and sent him back to Libya as soon as Gaddafi was ousted. This shows that they always kept an eye on Libya and kept themselves always ready to intervene.
Answer: The same question can be asked about what was wrong with Mubarak. Definitely Mubarak conducted pro-Western policy not only in the latest years.
Currently the West supports radical islamists in the Arab world, such as Al-Qaeda affiliated Al-Nusra front in Syria and Muslim Brotherhood. People like Gaddaffi, Mubarak, Assad are the obstacles for the islamists so the West wants them to be desposed.
With Gaddaffi additional issues were his image (the clothing, the gold-knitted uniform etc which supports the image of a "mad" dictator) and his (alleged) past deeds.
A Gaddaffi's mistake was that he thought that he could win Western favor by his loyal policy. Particularly, in the later years

His regime conducted torture and imprisonment on various terrorists handled to him by the West. The West used him to do things which were illegal in western countries.
He financially supported the pro-Western "orange revolution" in Ukraine (2004).
He financially supported some right-wing western politicians, like Sarkozy in France in hope they would become more friendly to him.
He tried to improve relations with Israel (with no success).

His son and likely successor Seif(executed recently by the new regime) had even more pro-Western attitude.
Comment: This sounds more like an incoherent rant full of Russian propaganda than an actual explanation…
Comment: -1: this answer is full of unreferenced claims and bare-word accusations. All claims should be either backed with credible references and reworded, or completely removed.
Comment: What do you mean when you say the west wants them desposed? @Anixx
Comment: the US torcheres in Guantanamo Bay, today still...think about it
Comment: "His son and likely successor Seif(executed recently by the new regime)" Here in the Western world there is no news about such execution. According to what we know he is still alive. Where did you get that information from?
Comment: When Gaddafi carried out those pro-Western actions he was already bound to the West. Do not confuse the shows he made for the media in the past with the real business. He never stopped providing his oil to Western country and he did business with Western companies all the time. In the fund holding his assets that was seized by the American authorities there are a lot of shares in Western companies that he bought during the time starting from the 80's.
Answer: You are asking the incorrect question.
NATO's objective is not to bring about justice in every corner of the world. NATO is a US-led coalition whose objective is to safeguard Western (i.e., US & its allies) interests.
Gaddafi was removed mainly because he had an anti-USA stance. He was a nuisance for the USA.
Among other things -

the USA/UK accused him of the Lockerbie bombing
he proposed the ditch of USD in favor of a pan-African currency (probably, Gold-backed)
He had a nuclear program (which he ditched and that was the point of start of his demise)
France wanted full control over Libyan oil fields (which they couldn't because of Turkish intervention later on)
Comment: @user366312 "If NATO was not there in the first place, there wouldn't have been any civil war." Lybian civil war started a full month before NATO intervention. See https://en.wikipedia.org/wiki/Timeline_of_the_2011_Libyan_Civil_War_before_military_intervention for details.
Comment: As I already explained calling it "NATO's objective" is not correct.
Comment: Lockerbie bombing was mainly a British concern.
Comment: @user366312: Useful as Wikipedia can be, it's not a primary source. But even it notes the reluctance of the USA, stating that it looked to the Gulf states. Wikipedia furthermore states that it was Italy who insisted on NATO's role, and that Germany (another bit NATO member) opposed the no-fly zone. And that is probably the biggest problem with this answer: NATO enforced a no-fly zone. That does not remove dictators. Civil war does, however.