CakePHP 1.2 RC2 – Apache Crash on Vista

In my spare time (yeah, right), I've been busy developing a web application using CakePHP. I ran into a problem tonight that I wanted to share, in case anyone else happens to run into something similar.

After making some changes to my app, I went to test it out, only to get an Vista notification stating that httpd.exe had shut down unexpectedly. I checked my Event Viewer Application logs and found an Error with the following details:

Faulting application httpd.exe, version, time stamp 0x46deb625, 
faulting module ntdll.dll, version 6.0.6001.18000, time stamp 0x4791a7a6, 
exception code 0xc00000fd, fault offset 0x00065950, process id 0x998, 
application start time 0x01c8db31c2d05070.

After a bit of debugging and scratching my head, I remembered that I had deleted a "view helper" file that I had created, but forgot to remove the reference to it (var $helpers = array()) from my app_controller.php file...doh!

I am a bit surprised that CakePHP wasn't able to catch this problem since it seems to catch so many other "missing" situations. Perhaps there is a way that CakePHP can prevent the issue...

Update: this issue was already a reported bug and looks like it is due to an infinate recursion when trying to load a helper that does not exist.
Topics: , ,

CSS Naked Day 2008

I've signed up to participate in the third annual CSS Naked Day, which will be celebrated on April 9th! For the entire day, my site will be without style!

If this is the first time you've heard of CSS Naked Day, it was started by Dustin Diaz to promote Web Standards:

"This includes proper use of (x)html, semantic markup, a good hierarchy structure, and of course, a good 'ol play on words. It's time to show off your <body>"

Are you brave enough to strip naked for a day?

Note: Only my content delivered through WordPress will be "naked", the rest will be left "fully clothed".


Struts 2 ParametersInterceptor

Are your logs being filled up with errors like:

ERROR - ParametersInterceptor.setParameters(204) | ParametersInterceptor - [setParameters]: Unexpected Exception caught setting '_' on 'class Error setting expression '_' with value '[Ljava.lang.String;@1491ddc'

If so, it's because Struts 2 is parsing the query string/post data and trying to "set" a value for each parameter it finds.

I'm working on an Struts 2 application utilizing the jQuery JavaScript library for the UI and the Displaytag tag library for displaying tables.

With jQuery, I'm using the "no-cache" option (cache: false) on all Ajax calls, which adds "_=timestamp" to each request. Since I don't have a property called "_" in my Action class, I get an error (mentioned above) in my logs for each request.

Same with Displaytag, except the parameters causing errors are in the form of "d-#-X", where "#" is a unique id (usually 4 or 5 digits) and "X" is either p, s or o. They are used to determine the page (p) and/or the table sort order (o for asc/desc and s for which column).

The solution: configure Struts (struts.xml) to ignore these parameters:

   <interceptor-stack name="defaultStack">
      <interceptor-ref name="params">
            Excludes the jQuery no-cache _ parameter and
            the Displaytag d-#-X parameter(s)
         <param name="excludeParams">

If you have a different parameters that are causing problems, just put them in the excludeParams node, comma separating multiple parameters.

Topics: , ,

Symbolic links in Windows

Symbolic links can be very useful, but if you are a Windows user, you've had to use junction points because there hasn't been native support for symbolic links until recently.

Windows Vista and Windows Server 2008 now support symbolic links mklink command. See Junfeng Zhang's write up on the mklink command.

For those using Windows 2000 or XP, you'll still need to use junction points to achieve a similar effect. Microsoft has a KB article on creating junction points, but there are some drawbacks to manually trying to manually manage junction points.

Fortunately, there are tools available that ease the pain of using junction points and prevent you from having to know all of the command line options. One such tool is NTFS Link, which provides shell integration for junction points. You can simply right-click in a folder and select New > NTFS Junction Point. Then select the target folder to link to and a "new" folder, named "Link to target folder" will be created in the directory you are in.

So, if you are a Windows user, you now have a couple of different options for creating and using symbolic links!


SimpleModal Contact Form (SMCF) 1.1 Released

SMCF 1.1 includes the following changes:

  • Fixed image pre-loading to actually pre-load ;)
  • Added new effects on form open and close
  • Added a security feature
  • Added optional subject and cc sender form elements
  • Added common classes to form elements
  • Renamed all classes and ID's to prevent collisions
  • Added WordPress translation ability on text elements (__() and _e() functions)
  • Upgraded to SimpleModal v1.1.1 and jQuery 1.2.3
  • Moved SimpleModal and SMCF JavaScript file loading to the footer

For more information and the download, please visit the SMCF WordPress Plugin Page.


Finding files containing a certain value

Searching for files containing a certain string/text/value is something that I do quite often. There are a number of ways to perform a "find files containing 'foo'" search, but for me, nothing beats the simplicity and power of the command line!

In Windows:

findstr /s /n /i /p foo *

The above example of findstr will print out the relative file name/path and line number (/n) in a recursive (/s), case insensitive (/i) search for the string foo (foo) in all files (*), ignoring files with non-printable characters (/p).

For a literal string, you can use the /c option:

findstr /s /n /i /p /c:"foo bar" *

There are a number of other options, but those are the ones I use most often. To restrict your search to certain files, just change the * to the pattern you are looking for, like: *.txt or *.css, etc.

For Unix:

grep -rni foo *

The above example of grep will print out the relative file name/path, matching content and line number (-n) in a recursive (-r), case insensitive (-i) search for the string foo (foo) in all files (*).

To search for a literal string, just put the search pattern in quotes.

If you just want to see the relative file name/path and don't care about the line number/content, you can use:

grep -rli foo *

And since these are commands I use all the time, I usually set up "shortcuts", so that I don't have to type out long commands with lots of options.

In Windows, you can create a batch file, called grep.bat for example, with the following:

findstr /s /n /p /i /c:"%1" %2

Then from the command line, just type grep foo *. For this to work, grep.batch needs to be in a folder that is in your PATH environment variable.

In Unix, there are a number of ways to do this, but I tend to just create an alias. For example, from the command line:

alias search='grep -rni'

Then from the command line, just type search foo *. Of course, you can just about any word/letter in place of search, just as long as it's not a reserved/system keyword. Lastly, you can add the alias command to a startup file and it will be available to you every time you log in.


Why I hate Gmail

Ok, so I don't really hate Gmail, but I am pretty annoyed right now. Every time I try to send an email, I get an alert saying "An error occurred trying to send the message".

Despite my best-efforts to follow Gmails TOS, I believe that my account has been disabled...hopefully only temporarily. And here's why:

Read more »

Topics: ,

SimpleModal Contact Form (SMCF) 1.0 Released

SimpleModal Contact Form (SMCF) is an Ajax powered modal dialog contact form for WordPress.

The project and all of the information about it is hosted on

If you have any feedback regarding the plugin, please let me know.

Eric Martin