mdpatrick

Sign-up for an E-mail Digest
 

Grab URLs from a String in PHP

In Uncategorized on February 1, 2012 at 5:55 pm

Found this little Regex pattern which is an improved version of Daring Fireball’s (found here). Throw whatever string of various mixed up URLs you can at it, and this will return an array of them.

$regexp = '/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:(?:[^\s()<>.]+[.]?)+|\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))/i';

preg_match_all($regexp, $message, $matches);

return $matches[0];

Traffic Pollution and Risk of Diabetes

In Uncategorized on December 20, 2011 at 3:38 pm

Of all the myriad variables that increase one’s risk for developing type 2 (adult onset) diabetes — smoking, being overweight, having a larger waistline — air pollution is not one we usually think of. But newer studies are suggesting environmental risk factors for diabetes: A new one finds that living in an area with more traffic pollution could increase one’s risk, particularly in people who are healthier to begin with. [...]

The link was “borderline significant,” according to the researchers. It was, however, stronger for people who were in better overall health, and for women. For example, in non-smokers who lived in high pollution areas, the risk for diabetes rose to 12 percent. A 10 percent increase in risk was found for physically active people. (via.)

Asus PCE-N13 Wireless Card Ubuntu Linux 11.04 Instructions

In Uncategorized on December 15, 2011 at 2:04 pm

I needed to buy a Wireless card for my desktop computer, and unfortunately… much to my dismay… despite there being *very* large lists out there on cards that more or less work with my version of linux (Ubuntu Natty Narwhal 11.04), there really wasn’t a list of *detailed reviews* as to indicate how well any given card works with linux.

Seems like an opportunity waiting to happen for someone that wants to put together a review site and curate what’s already kind of somewhat out there.

I went ahead and grabbed the asus CPE-N13. It was cheap, a brand name I recognized, and Wireless N (multiple antennas!).

Much to my dismay, the card did *not* work right out of the box. First, I had to blacklist some default but immature drivers that comes with ubuntu 11.04:

# Add these to /etc/modprobe.d/blacklist.conf

blacklist rt2800pci
blacklist rt2800usb
blacklist rt2x00lib
blacklist rt2x00pci
blacklist rt2x00usb

Pulled out the patch cable, rebooted for good measure… and voila we have wireless. :)

Hide me
Sign up below to join my eNewsletter
join our mailing list * indicates required Email Address *
Show me