Category Archives: programming

CSS Clean

Finally got around to making a script to clean up my poor CSS files; enter CSS Clean.

So why would I need this? Because a lot of my CSS files are built over a long period of time… with thoughts and experiments randomly cut and pasted. After a while, the CSS gets hard to read because of the lack of organization.

So, instead of having something like this:

/* Before CSS Clean */
#selector {
    width: 150px;
        border: 1px solid #000;
   color: #070;
}

I can finally have something like this:

/* After CSS Clean */
#selector {
  border: 1px solid #000;
  color: #070;
  width: 150px;
}

All nice and alphabetized-like… and indented.

MySQL and Perl

Initially, I thought that getting MySQL to talk to Perl would be easy.  In theory, you should just be able to get the packages that do the talking… and everything would just work.  But, getting them to talk to each other under Mac OS 10.7 (Lion) has taken a while.

Here’s what I did to get it all up and running:

  1. Downloaded and installed MySQL.
  2. Downloaded and installed DBD-mysql.
  3. Added this line to my .bash_profile: export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
  4. Added this line to my httpd.conf: SetEnv DYLD_LIBRARY_PATH /usr/local/mysql/lib/
  5. Restarted Apache.
Why was this so hard? 🙂

Another Old Language

On the topic of old computer languages… I’ve recently been going back through books on the Perl programming language.  It was one of the first scripting languages I tried to learn back in high school… but I never felt like I really understood it.  Years later, I realize now that it really is a confusing programming language.  Even though it’s fairly simple to get up and going with Perl, it’s such a creative (or expressive,) language that programs can easily become confusing pieces of mangled artwork.  Perl.

I still like it, though.

Old Languages

Been thinking about getting another degree.  Not sure, though, even if I could.  But it’s given me reason to go back and study up on an old computer language called C++.  I started out using it back in early college days… but it was a hard language for me to understand.  Looking back at  it now, it makes a lot more sense.  In the past, I guess I was just over-thinking the whole idea that C++ itself seems to be a really simple, bare-bones language.

Still have a lot to learn, though.

Webgrind Install Notes

Webgrind is also pretty easy to install.  But, like the previous Xdebug post, some notes for future reference don’t hurt.

On Mac OS X 10.5, I had to change the $storageDir and $profilerDir to the following:

static $storageDir = '/var/tmp';
static $profilerDir = '/var/tmp';

because I did not have permission to write to the regular /tmp folder with my particular user.  This step probably isn’t necessary for most people.

Xdebug Install Notes

Xdebug is pretty easy to install… but listed below are notes for future reference.

First, installed Xdebug by using PECL:

pecl install xdebug

Here is what I ended up putting into my php.ini file:

zend_extension="/path/to/xdebug.so"
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1

And in the case of Mac OS X 10.5, at least, that “/path/to/xdebug.so” turns out to be something like:

/opt/local/lib/php/extensions/...

Then, just make sure to restart Apache or whatever you are using.

Zend Framework, Xdebug, and webgrind: New Friends

Found out about the debugging and profiling tool Xdebug, today.  It looks like a nice tool for checking out how a web application is performing.  Additionally, there is a pretty nice front-end for Xdebug calledwebgrind” that I’m starting to use.  Pretty nice combination so far.

I’ve also been working with the Zend Framework these days, and I’m realizing that the Zend Framework might be the only PHP framework (or one out of a precious few,) worth using at this point in time.  As a framework, it does have more overhead than plain PHP scripts… but so does any framework; at least to some extent.  So, while I still have the “opportunity” to work with PHP for the time being, I figure I might as well go with something like the Zend Framework.

Even with some initial (very informal and uneven,) memory footprint-based testing between a past CakePHP-based project and my new Zend Framework-based project, the memory footprint appears to be much smaller on the Zend Framework side of things.  CakePHP is still my “go to” framework when using PHP… but, if things continue going well with the Zend Framework work… things may change.