Saturday, April 18, 2009

Portable Ubuntu - Take Linux With You

I have to admit that I first thought that portable Ubuntu was going to be a install on a flash drive. It actually runs UNDER windows. The real credit though goes to Cooperative Linux. This allows a linux distro (almost any) to run while windows is running. Now I took the easy route and ran Ubuntu which is a decent distro for most desktop users.

It ran sluggish at first. I was really kind of disappointed and thought that it was because it was running from the flash drive. It really was just not getting enough CPU. I was able to improve the experience considerably on my laptop by setting the colinux and associated exe's to a high priority. This allowed them to get a bit more task scheduling from windows. This was enough to kill the little bit of sluggishness and get me rocking with all that linux has to offer.

On a side note this isnt my first experience with linux or ubuntu. I've run it under VM's and dedicated boxes for some time. It is just very nice to be able to start it up, shut it down and run it while I'm running windows apps. I'm going to go download aptana for linux and try it out under there. Would be nice to be able to take my favorite IDE everywhere regardless of the PC I'm on.

Thursday, April 09, 2009

Quote Curling Function

I recently had to add some curly quotes to text on the page. The following function allows you to add Microsoft Word Style Curly Quotes in replacement of standard quotes. Uses some basic regex to accomplish this quickly and easily.

echo curlQuotes('"This" is a "test", a great "test" I think. Don\'t you?');

// Curl Quote Function
function curlQuotes($curlme) {
// Adds fancy Microsoft Word Style Quotes to standard text.
$curlme = preg_replace('/(.+)"(.+)"(.+)/Ss',"$1“$2”$3",$curlme);
$curlme = preg_replace('/(.+)"(.+)"/Ss',"$1“$2”",$curlme);
$curlme = preg_replace('/"(.+)"(.+)/Ss',"“$1”$2",$curlme);
$curlme = str_replace("'",'’',$curlme);
return $curlme;

Output is:

“This” is a “test”, a great “test” I think. Don’t you?