I have a string: http:\/\/example\.com  I try to regex this to be: http://example.com  I've used preg_replace('/\(\)/', '', $string) but it is not working.  Could you help me, please?
I am tired of always trying to guess, if I should escape special characters like '()[]{}|' etc. when using many implementations of regexps.  It is different with, for example, Python, sed, grep, awk, Perl, rename, Apache, find and so on. Is there any rule set which tells when I should, and when I should not, escape special characters? Does it depend on the regexp type, like PCRE, POSIX or extended regexps?
"Subject, verb, direct object, object complement" versus "subject, verb, indirect object, direct object" Reading English Grammar (HarperCollins College Outline, published by HarperResource, an imprint of HarperCollinsPublishers) I found a chapter (Sentence Basics) that explains that in English there are different sentence patterns; in particular   Subject, verb, direct object, object complement Subject, verb, indirect object, direct object   The chapter reports the following example for the patterns:     Alice called Charles Professor Miller.   Alice gave Charles the rabbit.   What is the difference between the two kind of sentences? What is the difference between the object complement in the first case, and the indirect object in the second case?  PS: The question, which could appear silly, comes from the fact in my first language there is only the object complement. How do I profile memory usage in Python? I've recently become interested in algorithms and have begun exploring them by writing a naive implementation and then optimizing it in various ways.  I'm already familiar with the standard Python module for profiling runtime (for most things I've found the timeit magic function in IPython to be sufficient), but I'm also interested in memory usage so I can explore those tradeoffs as well (e.g. the cost of caching a table of previously computed values versus recomputing them as needed). Is there a module that will profile the memory usage of a given function for me? Does this polynomial evaluate to prime number whenever $x$ is a natural number? Do you ever center AND standardize variables in multiple regression? Do you ever center AND standardize variables in multiple regression? It seems as if standardization would automatically center variables...is this true? What characters/symbols are allowed within the CSS class selectors? I know that the following characters are invalid, but what characters are valid?  ~ ! @ $ % ^ &amp; * ( ) + = , . / ' ; : " ? &gt; &lt; [ ] \ { } | ` # I use Lasso logistic regression in order to identify a smaller subset of important variables. I start with N=51 (28/23) and 32 predictors.   So far it looks pretty promising, because I can identify four important predictors in my optimal model.   Now I would like to take those four predictors and examine them along with some control variables in a standard logistic regression.   My question is, does that analysis strategy make sense? Is there a better way to include controls or other variables that might be interesting?  For a better understanding:   Identify important variables via Lasso logistic regression Do further analysis including identified predictors and other control variables using standard logistic regression (using AIC to check model fit) Can the system leave a deletion reason when it deletes a question? they were question banned; it turned out it (in part) it was because of deleted questions.   was deleted by the Community user.  I'm aware it will delete old posts that have a negative score, but for a minute or two, I was really puzzled as to why it was unilaterally deleted without some notation left.  Can we have the Community user leave a notation in a post's history as to why the post was deleted?    Something like the following would suffice:     Post deleted automatically due to having negative votes and no activity for three months Standard definition of graph says that it is an ordered pair G=(N,L) where N is set of nodes and L is set of lines which connect the nodes.   From what I've read, the set L can be empty, but can set N be empty too?  I'm mainly asking this because for my exam, I found numerous problems that go like this: Graph X is given. How many subgraphs with property Y exist? Often the number depends on the definition of graph. I would like to have a paper's bibliography entries inside its .tex file instead of outside in a .bib file. Is this possible with biblatex?  My reason for asking this is that I want to find the most convenient way to produce documents that uses biblatex from just one file to make collaboration on papers easier and to be able to handle submissions of papers to journals. Is doing two PhDs a good path? Help! My master database is corrupt, I can't even bring the SQL instance online! What are my options to get my server back up?   I do have a backup of master, but the  asks me to start the instance in single-user mode, which I can't do!  (Note: I'm leaving this question unspecified as to SQL version, so as to be a more widely-applicable reference. There are some similar questions on DBA.SE, but none that involve the server unable to start.) Prove that a set of connectives is inadequate It is relatively easy to prove that a given set of connectives is adequate. It suffices to show that the standard connectives can be built from the given set. It is proven that the set $\{\lor, \land, \neg\}$ is adequate, and from that set it can be inferred (applying De Morgan laws and such) that $\{\lor, \neg\}$, $\{\land, \neg\}$ and $\{\to, \neg\}$ are also adequate.  Nevertheless, I'm stuck trying to understand how to prove that a given set of connectives is inadequate. I know I have to prove that a standard connective can't be build using only the connectives of the given set, but I can't figure out how to do it.  FYI, I'm trying to prove that $\{\lor, \land\}$ and $\{\leftrightarrow, \neg\}$ are inadequate sets of connectives.  Thanks in advance. I'm taking a look at  (now removed), which all seem to be pretty much the same.  Should any be downvoted/flagged, and if so, which ones? How does password salt help against a rainbow table attack? I'm having some trouble understanding the purpose of a salt to a password.  It's my understanding that the primary use is to hamper a rainbow table attack.  However, the methods I've seen to implement this don't seem to really make the problem harder.  I've seen many tutorials suggesting that the salt be used as the following:  $hash =  md5($salt.$password)   The reasoning being that the hash now maps not to the original password, but a combination of the password and the salt.  But say $salt=foo and $password=bar and $hash=3858f62230ac3c915f300c664312c63f.  Now somebody with a rainbow table could reverse the hash and come up with the input "foobar".  They could then try all combinations of passwords (f, fo, foo, ... oobar, obar, bar, ar, ar).  It might take a few more milliseconds to get the password, but not much else.  The other use I've seen is on my linux system.  In the /etc/shadow the hashed passwords are actually stored with the salt.  For example, a salt of "foo" and password of "bar" would hash to this: $1$foo$te5SBM.7C25fFDu6bIRbX1.  If a hacker somehow were able to get his hands on this file, I don't see what purpose the salt serves, since the reverse hash of te5SBM.7C25fFDu6bIRbX is known to contain "foo".  Thanks for any light anybody can shed on this.  EDIT:  Thanks for the help.  To summarize what I understand, the salt makes the hashed password more complex, thus making it much less likely to exist in a precomputed rainbow table.  What I misunderstood before was that I was assuming a rainbow table existed for ALL hashes. Structuring game narrative. Handling NPC, Quest, General Dialogue. Is Json/XML the right way to go? Or any other solutions? Hello guys I'm try to make some games that have more to it than just simple high score scrolling shooters etc.  I'm trying to design my own systm of handling narrative. I want to be able to place NPC's in the game world, with scripts attached to them. Some of the NPC's would just have n random greetings. Others will be mission givers and will offer you a quest of sorts. (The quest could be go speak to Bob in the pub, or it might be bring me the Holy Grail and Crown Jewels, or something in between).  I've wracked my brain for a long while over this but sadly keep slipping back to the only way I know how, which is to manually code all the strings that people can say and have a horrible web of if statements and other such insanity to give me a rudimental dialogue system. Its not good enough even with just a few characters, but if I had dozens/hundreds of characters it would be even worse.  I've read lots about it already but I'm still very confused when I start trying on my own project. I've read that Json/XML might be the way to go and that I can add custom markups in the Json text to call methods in my code, but I dont even know if this is right and if so how I can do it.  The back of my brain is screaming at me that there is a simpler way to do it, but I've sat here for a very long time without managing to think of ideas.  Here is a diagram I drew which pretty much shows the flow of how I want my NPC to behave. If anyone can see this and then tell me how they might do something like this that would be fantastic!! (note: if Json is the correct advise, please give me a exact example of how exactly to format the Json in order to check the bools I mention in my flowchart - thanks!):    note: The circles denote an output from the data as Text for the dialogue system. The bools will need to be checked against by the data file to see which output to give (hope that makes sense and is possible) How to determine which program is making a certain sound in windows 7? I'm experiencing an annoying "female robotic" sound effect saying "loading complete" at uncertain interval in windows 7.  I want to shut down that noise for good. To do that, I have to determine which program is making this sound. I tried to open the "sound mixer" window, only to find to program last made any sound, one is official GTalk client, one is system sound. I tried to close GTalk and the sound still existed.  I started experiencing this issue not long after I installed a "driver" program for Rapoo E9198 wireless keyboard. Why does a bezier curve twist when rotated? If I create a bezier curve and rotate it in edit mode it does not accordingly rotate the tilt of the handles which creates an undesirable twisting along the curve.  Here is an example using a bezier circle with a square used for a bevel object:   Here it is after being rotated 90° about the y-axis:   How do I prevent/fix this? How to reduce Eclipse's memory usage? Is Ghost Adventures real or fake? How to create svg symbols that have modifiable fill color, stroke color and stroke width? I want to create some svg symbols for Qgis using Inkscape, those symbols must have attributes as described in the question. For the last two days, I have been experimenting as instructed by  and mimicked some symbols came bundled with qgis that have desired attributes without any success.  Finally I experimented with the simplest form of symbol: I created an svg that contains only a circle in Inkscape and tried to modify it.  The original file () have this line:  &lt;path    sodipodi:type="arc"    style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.01988637;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"   I modified it into:  &lt;path    sodipodi:type="arc"    style="fill:param(fill) #ffffff;fill-opacity:1;stroke:param(outline) #000000;stroke-width:param(stroke-width) 1.01988637;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"   Saved as  and selected it as point symbol, but Qgis couldn't change all three parameters at the same time.  What did I do wrong or should do differently?  My system: Qgis 1.8.0 on Ubuntu 12.04 64 bit, Inkscape 0.48, Gedit 3.4.1 text editor.