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).
Posted in javascript by ajm | No Comments »
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.
Posted in cross browser, javascript by ajm | No Comments »
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.)
Posted in design by ajm | 1 Comment »
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?
Posted in development by ajm | 1 Comment »
October 14th, 2008
Dav Glass presents the YUI Bacon utility, complete with frying sound. (via Ajaxian.)
Tags: yui, bacon
Posted in yui by ajm | No Comments »
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:
- 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.
- 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.
- Save those settings, and start up your virtual machine.
- 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.
- 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.
- You’re done.
Tags: VirtualBox, sun, vm
Posted in development by ajm | 2 Comments »
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: ie8, cross-browser
Posted in cross browser by ajm | No Comments »
August 26th, 2008
This is definitely in the CakePHP docs, but my random Googling of different terms didn’t turn it up, so I’m adding it here with a few keywords just in case it helps anybody else.
The CakePHP equivalent of Ruby on Rails’ created_at is created. The equivalent to modified_at is modified. Columns with either of those names will be updated automatically when a record is created and/or modified.
I tried stuff like “magic update columns,” “CakePHP created_at,” and “CakePHP created_at autofill” before I finally found this blog post and this CakePHP doc.
Hopefully, including some extra search terms around this content will give someone else out there a hand.
Posted in development by ajm | No Comments »
August 12th, 2008
Just found a fantastic crash bug in the FireFox 2.0 line (I’m using 2.0.0.16 and it’s there). It seems to be fixed completely in FireFox 3.0 and up.
Basically, using Flash’s ExternalInterface to call a JavaScript function that removes the swf element from the DOM and also tries to set style properties on the element containing the swf is subject to timing issues (a race condition, really) that can cause a total browser crash. It seems to work this way: if the function called by external interface results in removing the swf before the calling function can execute all code inside it, the browser will bail out. (I’m not 100% sure if that’s the exact cause, but it seems to be supported by what testing I could do.)
How is this a problem? I was running a few animations that would call back a couple of times to closures inside them. If those closed functions wouldn’t have time to run before the swf was stripped out, things would explode. The solution: my final animation calls back and removes the swf; this seems to solve the problem entirely (as does removing the swf after a nice long callback that would ensure all the closure code completes). Perhaps this is a crazy bug that only shows up in this situation, with timing and closures? Like ExternalInterface needs all closures/JavaScript to execute before it can “safely” exit itself?
Very weird, but seems to be solved in later versions of Firefox. (By the way, I’m running Flash 9 and a swf that demands Flash 9, so it’s still a recent concern for newer versions of Flash.)
(Here’s a similar situation that got me in the right direction.
Tags: javascript, flash, external interface
Posted in dhtml, javascript by ajm | 1 Comment »