CakePHP - Helper filenames must be lower case?

March 7th, 2009

Bit of an odd one. It seems that in between the beta version of CakePHP 1.2 that I’ve been using and the full release, Helpers now must have lower-case filenames or they go missing.

You’ll wind up with a null object error otherwise.

I wonder if I did something wrong?

YUI Cookie utility and single-page cookies

February 9th, 2009

I’m doing a bit of work with cookies, so I figured that I’d give YUI’s Cookie utility a try. Got it up and running on a proof of concept with no problem and it worked pretty well. However, once I moved off the proof of concept, it seemed like my cookies were only living for one page.

A quick inspection with Firecookie revealed that the Cookie utility was creating a huge number of cookies with the same name and binding them to a single page by default. (At least in 2.5.2). If you’re on that branch (I can’t upgrade a production instance, for example), make sure you add a path to the cookie you’re creating if you’d like the cookie to be readable and writable by more than the page you’re on. That would look something like this:

        YAHOO.util.Cookie.set('someName','someValue, {
            expires : new Date('January 1, 2010'),
            path : "/"
        });

That will make your cookie readable beyond a single page and might save you a headache.

Handy little for … in test

January 20th, 2009

Quick and easy:

 if(fileType in {'jpg':'','gif':'','bmp':''}){ ... }

Create the Object you’re testing against on the fly. Seems that Object creation trumps in in the order of operations (at least in Firefox 3.0).

IE and Disappearing Google Maps API Routes

January 15th, 2009

I ran into this one earlier today. Essentially, you use the Google Maps API’s GDirections object to load some directions into your map. Occasionally, without warning or any pattern I can see, the little blue-ish route polyline will begin disappearing in IE 6 and IE 7. There seems to be no rhyme or reason to it, although I suspect that it has to do with DOM modifications after the map redraws.

Speculation aside, here’s a fix that I dug out of the Google Maps API Group. Make sure your document is using a valid DOCTYPE (duh) and then add the following XML namespacing to your HTML tag:


<html xmlns=”http://www.w3.org/1999/xhtml” xmlns:v=”urn:schemas-
microsoft-com:vml”>
</html>

I didn’t have access to that part of the document as I’m working in a CMS, but found that this JavaScript version worked:

var el = document.getElementsByTagName('head')[0];
el.setAttribute('xmlns','http://www.w3.org/1999/xhtml');
el.setAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');

That should fix the problem. However, it may pop-up again if you clear the map results and any overlays you have, and plot points on that same map again. Really odd. Does Google clobber that namespace at some point, after centering or drawing a map? I haven’t been able to test to find out. My only thought would be to set those attributes after every redraw or map load, but that could be a bit of overkill.

Still, if you can promise only a single load of a set of directions, the above should save you. Here’s the Google Groups thread for posterity.

This is why my Photoshop CS2 kept lagging…

November 20th, 2008

Bless you, sir. I can now open 1kb JPEGs in under 1 minute. (The short of it: if you have a slew of remote network printers mapped, Adobe Photoshop seems to want to query them all every time you open a file. Blow them all away and it will be good as new.)

Throwing out a CakePHP question…

October 26th, 2008

Maybe this will come up in a Technorati or Google search, so I’m throwing it out.

I had a CakePHP controller called “galleries”. Trying to access /galleries on my server appended an extra “/” onto the URL and redirected me to a 403 forbidden page.

Various Google searches suggested a few things in htaccess that didn’t work and seemed more geared toward site-wide problems but this is a single controller. No other controllers seem to exhibit this behavior and sticking any random controller name in the URL sends me to a missing controller page.

Why does this one, single controller fail?

Take this, jQuery!

October 14th, 2008

Dav Glass presents the YUI Bacon utility, complete with frying sound. (via Ajaxian.)

Tags: ,

iPhone Design Stencil Collection

October 8th, 2008

Thomas Joos has collected everything you’ll need to design an iPhone app. Great, comprehensive resource.

Sun VirtualBox File/Directory Sharing Between Mac OS X and Windows XP

September 15th, 2008

I ran into this problem last night, and had a hard time Googling a solution, so here’s a brief summary of what I did just in case anyone else runs into it.

I was trying to set up VirtualBox on Mac OS X to share a directory between OS X and my Windows XP virtual machine. Under VirtualBox 2.0.2, here’s how you do that:

  1. Open VirtualBox. Make sure the virtual machine you’d like to share with is stopped. This should give you access to “shared folders” setting under the info panel.
  2. Open up that shared folders setting, and choose the directory you’d like to share and give it a name. Remember that name, because that winds up being used as part of a network share location by Windows XP.
  3. Save those settings, and start up your virtual machine.
  4. Here’s the part that took me an hour to figure out: you need to install the VirtualBox “guest additions” on your virtual machine to actually allow you to connect to the share. That’s located under the “Devices” menu item. You’ll be prompted to install guest additions and a bunch of drivers on your Windows XP VM; go ahead and accept all the prompts that pop up on the screen and reboot the VM if necessary.
  5. When your VM reboots, head over to the My Computer section and choose “Map Network Drive.” You’ll be mapping a drive with the following format: \\vboxsvr\[your_share_name_from_step_2]. The \\vboxsvr hostname is the standard default set by VirtualBox, so that’s what it should be on your install, too, unless there’s a way to change it.. While you’re here, check off the “Reconnect at logon” box so you’ll never need to do this step again.
  6. You’re done.

Tags: , ,

IEBlog : Microsoft CSS Vendor Extensions

September 9th, 2008

As you may know, all browsers have a set of CSS features that are either considered a vendor extension (e.g. -ms-interpolation-mode), are partial implementations of properties that are fully defined in the CSS specifications, or are implementation of properties that exist in the CSS specifications, but aren’t completely defined. According to the CSS 2.1 Specification, any of the properties that fall under the categories listed previously must have a vendor specific prefix, such as ‘-ms-’ for Microsoft, ‘-moz-’ for Mozilla, ‘-o-’ for Opera, and so on.

IEBlog : Microsoft CSS Vendor Extensions

Nice to see IE jump on the vendor extension prefix bandwagon. Although it does break backwards compatibility to an extent (annoying), it will allow browsers to play better together.

Also, nice to see that they’re doing the “implement draft CSS specs” as prefixed, too.

Tags: ,

I'm Reading…
Search This Site

AddThis Feed Button

Need great hosting?

Categories