I need to check if a form field is a valid URL (it can be done through HTML5, but not every browser has it yet), and I can't find a good URL checker function. It's strange, because with email-checking, there are lots of already-done functions.  I've seen (I just discovered it) the filter_var() function, but as I read, there are some issues with urls. I can find some regular expressions, but they don't seem very exhaustive.  Do you know any good url checker function?
I've been looking for a simple regex for URLs, does anybody have one handy that works well?  I didn't find one with the zend framework validation classes and have seen several implementations.
I've read before that, by the Principle of Explosion, if a theory is inconsistent, then absolutely any statement can be proven within it.  Obviously, there are statements which are independent of ZFC (Continuum Hypothesis, etc). It seems to me that this proves that ZFC is incomplete. Why does it not then follow that ZFC is consistent? It seems to me that we could say "Assume ZFC is inconsistent. Then the the Continuum Hypothesis is provable in ZFC. But the Continuum Hypothesis is neither provable nor disprovable in ZFC. Therefore ZFC is consistent."  What am I missing here? In my past experiences, I have almost never typeset my manuscripts according to the formats required by the journals to which I would like to submit. I leave my manuscripts as produced by the LaTeX article documentclass.  Recently I am wondering: Would such a behavior generally give handling editors a negative first impression? I unlocked the 'Files' button/icon from my unity launcher and now it disappearead and I cannot restore it or get it back I unlocked the 'Files' button for the Ubuntu file manager from the unity launcher and I cannot get it back.   When I run the file manager from the dash, the icon does not appear on the launcher like it does for all other applications while they are running. I wanted to have an empty launcher when no applications are running, and just have the icons of those I am actively using there.  Any idea why I don't see it in the launcher when its running or how to lock it back? Automatically define macros in LyX documents I'm using LyX all the time and over the last 2 years I've accumulated some very handy macros for my lecture notes. As it is today, every time I start a new document, I copy and paste the macros from one of my other documents. Is it possible, somehow, to automatically load macros for all files?  (I asked this on SO a while back and got no answers. I hope in this new home I'll get a response). Why use gradient descent for linear regression, when a closed-form math solution is available? I am taking the Machine Learning courses online and learnt about Gradient Descent for calculating the optimal values in the hypothesis.  h(x) = B0 + B1X   why we need to use Gradient Descent if we can easily find the values with the below formula? This looks straight forward and easy too. but GD needs multiple iterations to get the value.  B1 = Correlation * (Std. Dev. of y/ Std. Dev. of x)  B0 = Mean(Y) – B1 * Mean(X)   NOTE: Taken as in   I did checked on the below questions and for me it was not clear to understand.      The above answers compares GD vs. using derivatives. Does iOS 7 cellular tethering limit the number of WiFi clients? I'm looking on Apple's site and can't find any published limits on how many clients can connect to one iPhone / iPad with cellular tethering enabled in the US.  Setting aside the obvious limit where 1,000 devices would overwhelm the data connection in practice if they all want data at the same time, is there a hardware or software limit of perhaps 5 or 10 devices that can connect to one device over WiFi? Possible Duplicate:     Which one of these is correct?  It is I who am at fault. It is me who is at fault.  The word &quot;is&quot; is a conjugation of &quot;be&quot; which is a linking verb. I also want to know the same for 2nd person.  It is you who are at fault. It is you who is at fault. Algorithm for minimization of sum of squares in regression packages Printing pointers in C I was trying to understand something with pointers, so I wrote this code:  #include &lt;stdio.h&gt;  int main(void) {     char s[] = "asd";     char **p = &amp;s;      printf("The value of s is: %p\n", s);     printf("The direction of s is: %p\n", &amp;s);      printf("The value of p is: %p\n", p);     printf("The direction of p is: %p\n", &amp;p);      printf("The direction of s[0] is: %p\n", &amp;s[0]);     printf("The direction of s[1] is: %p\n", &amp;s[1]);     printf("The direction of s[2] is: %p\n", &amp;s[2]);      return 0; }   When compiling it with gcc I get these warnings:  $ gcc main.c -o main-bin -ansi -pedantic -Wall -lm main.c: In function ‘main’: main.c:6: warning: initialization from incompatible pointer type main.c:9: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char (*)[4]’ main.c:11: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char **’ main.c:12: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char ***’   (The flags for gcc are because I must be C89)  Why incompatible types of pointer? Isn't the name of an array a pointer to it's first element? So if s is a pointer to 'a', &amp;s must be a char **, no? And why do I get the other warnings? Do I have to cast the pointers with (void *) in order to print them?   And when running I get something like this:  $ ./main-bin The value of s is: 0xbfb7c860 The direction of s is: 0xbfb7c860 The value of p is: 0xbfb7c860 The direction of p is: 0xbfb7c85c The direction of s[0] is: 0xbfb7c860 The direction of s[1] is: 0xbfb7c861 The direction of s[2] is: 0xbfb7c862   How can the value of s and it's direction (and of course the value of p) be the same? How to connect to remote X-Server (logged in via ssh) When I'm logged on to another host (e.g via ssh), how do I connect to the XServer of that machine (same user is logged in and is running a desktop (gnome))?  You may ask way I wish to do that: There are commands that don't open an X-Window, e.g. xinput, xhost, etc.. and there are situations where you want to run them from remote. I noticed that I got some initial traffic problems at the point where the initial highway is connected to my city. At the beginning I simply elongated both roads that came from that highway, but this doesn't seem to scale.  What I wanted to do now is to create a single six-lane highway from these two four-lane roads. I'd be open to continue to use two roads in parallel here, but I didn't manage to add any way of crossing between the lanes when I tried that idea.  So, how do I merge two one-way roads into a single two-way road? Or, if my idea is really bad, what is a good way to connect the initial highway access to my fledgling city?  Here's a screenshot of the roads I want to connect, if my description wasn't entirely clear: I have an element that already has a class: &lt;div class=&quot;someclass&quot;&gt;     &lt;img ... id=&quot;image1&quot; name=&quot;image1&quot; /&gt; &lt;/div&gt;  Now, I want to create a JavaScript function that will add a class to the div (not replace, but add). How can I do that? I have installed an Ubuntu server on a VMWare workstation with a space of 20GB storage as seen below;    After the installation I've attached another 40GB worth storage to the existing Ubuntu server installation (seen below);    Now I want to add this 40GB to my / (root) directory or to /var/ directory but my df -h result shows;  root@Userver:~# df -h Filesystem      Size  Used Avail Use% Mounted on /dev/sda1        18G  900M   16G   6% / udev            990M  4.0K  990M   1% /dev tmpfs           400M  308K  399M   1% /run none            5.0M     0  5.0M   0% /run/lock none            999M     0  999M   0% /run/shm none            100M     0  100M   0% /run/user root@Userver:~#   What should I do now? Further, I have only ssh access to the server. Number of combinations of dice having different number of faces that add to $10$ A function $\textbf{face}_{\mathrm{sum}}$ that takes a vector  $f$ that represents the number of faces of each die, and a positive integer  $s$ , and returns the probability that the sum of the top faces observed is  $s$ .  For example, if $f=[3,4,5]$  and  $s≤2$  or $s≥13$ , $\textbf{face}_{\mathrm{sum}}$ returns $0$, and if  $s=3$  or  $s=12$ , it returns  $\frac13*\frac14*\frac15=\frac1{60}$  $\textbf{face}_{\mathrm{sum}}([2,4,4,6], 10)$  I tried to solve this but I can't find the formula to calculate the number of combination of die faces that add to $10$, as the number of faces are different for each die.  Since max no of possible combination is $6*4*4*2=192$, all I need to find is the number of combination of die faces that add to $10$.  Thanks in advance. Getting tabular statistics from table using QGIS? Allow users to leave an anonymous comment when voting I don't know if people don't explain why they up or down vote because they don't care or because they don't want the person to know they voted on an answer (or question)... But, it might be nice to be able to leave a comment anonymously as to why it was voted.  It could give us more insight as to people's thoughts on posts.    Really, I think this would come into play a lot more dealing with down votes more than up votes, but I could see it being beneficial in both situations.   See also Does it make any difference to SEO ratings what-so-ever if your url has a trailing slash:  http://www.example.com/some/slug/paths/   as opposed to one that does not:  http://www.example.com/some/slug/paths In almost all proofs I've seen of the Lorentz transformations one starts on the assumption that the required transformations are linear. I'm wondering if there is a way to prove the linearity:  Prove that any spacetime transformation $\left(y^0,y^1,y^2,y^3\right)\leftrightarrow \left(x^0,x^1,x^2,x^3\right)$ that preserves intervals, that is, such that  $$\left(dy^0\right)^2-\left(dy^1\right)^2-\left(dy^2\right)^2-\left(dy^3\right)^2=\left(dx^0\right)^2-\left(dx^1\right)^2-\left(dx^2\right)^2-\left(dx^3\right)^2$$  is linear (assuming that the origins of both coordinates coincide). That is, show that $\frac{\partial y^i}{\partial x^j}=L_j^i$ is constant throughout spacetime (that is, show that $\frac{\partial L_j^i}{\partial x^k}=0$).  Thus far all I've been able to prove is that $g_{ij}L_p^iL_q^j=g_{pq}$ (where $g_{ij}$ is the metric tensor of special relativity) and that $\frac{\partial L_j^i}{\partial x^k}=\frac{\partial L_k^i}{\partial x^j}$. Any further ideas? How do you reindex an array in PHP but with indexes starting from 1? I have the following array, which I would like to reindex so the keys are reversed (ideally starting at 1):  Current array (edit: the array actually looks like this):  Array (  [2] =&gt; Object     (         [title] =&gt; Section         [linked] =&gt; 1     )  [1] =&gt; Object     (         [title] =&gt; Sub-Section         [linked] =&gt; 1     )  [0] =&gt; Object     (         [title] =&gt; Sub-Sub-Section         [linked] =&gt;      )  )   How it should be:  Array (  [1] =&gt; Object     (         [title] =&gt; Section         [linked] =&gt; 1     )  [2] =&gt; Object     (         [title] =&gt; Sub-Section         [linked] =&gt; 1     )  [3] =&gt; Object     (         [title] =&gt; Sub-Sub-Section         [linked] =&gt;      )  ) FM Transmitter oscillation problem I've been trying to get this simple FM transmitter to work over the past few days and I could use some help in a few areas.      First iteration was on a breadboard with all parts included.  The exception being I didn't have a 0.1uH coil handy but I had another coil rated at 0.7uH (using my LCR meter).  I also didn't have a C4 value of 4.7pF but I had a 10pF value.  I figured I could just tune it later.  I hooked a scope up to it and got no oscillation.  I tried connecting the probe to the gate and the collector separately and together.  Still no oscillation.  Second iteration.  I removed the audio component of the circuit.  Essentially everything to the left of C2.  I had gotten that working no problem anyway so I figured I would concentrate on the oscillator.  This time I tried different values for the inductor ranging from 20uH to 1mH and different fixed values for the variable cap (10pf, 20pf, 30pf).  These were all ceramic caps. No love.  Third iteration. I tested the transistor to make sure that wasn't the issue.  Seems fine.  PN2222A variety. (Also tried 2N3904 and BC547). I then modeled this up on a piece of perf board.  I even found a SMD inductor of 0.1uH so now I thought I would be good.  Tested all the pieces on the meter before installation. Still nothing. I'm not seeing anything on the spectrum analyzer either.  Questions:   Do you think my benchtop power supply is causing a problem?  All the various versions of this type of FM transmitter circuit on YouTube and the Internet all seem to use a battery.  Any chance the 60Hz main power is messing with things?  I've put .1uF and higher caps on the power rails. I have a 200Mhz SIGLENT SDS1202X-E scope.  I've built and tested other oscillators up to a few MHz before with no issues.  Any thoughts on that being the issue?  I would expect to see something on the scope right? Any chance the probe is dampening the oscillations?     I know there are a lot better FM transmitter circuits out there I was just experimenting with this (and others like it) and couldn't get any to work.