Wednesday, April 25, 2012

Change Folder Name Using mod_rewrite

For anybody out there that may be needing to do a simple directory name replacement using mod_rewrite:
RewriteEngine On
RewriteRule ^(.+)\/abc\/(.+)$ $1\/xyz\/$2
So http://blah.com/abc/image.jpg becomes http://blah.com/xyz/image.jpg

Tuesday, April 10, 2012

Outlook Messages with Word Attachments

I hate getting emails at work with Word attachments. It just takes too long to open the attachment especially when the content could have been easily included in the message. Let's make a pact that any time we have a meeting agenda, job posting, etc. that has minimal formatting, we will copy and paste it into the message instead. Outlook is smart enough to know what to do with it (most of the time) and it will save everybody some time.

Friday, April 6, 2012

jQuery Newbie Mistake

I just made a jQuery newbie mistake but the worst part about it was that the code still worked in all browsers...except IE7. So I didn't even know that I had done it wrong until one of the developers discovered it.

Here is what I tried to do:

$("blah").each(function(index) {
this.id = newID;
this.name = newID;
});
Here is what I should have done:

$("blah").each(function(index) {
$(this).attr("id", newID);
$(this).attr("name", newID);
});
Once I changed my code to the latter, it starting working correctly in IE7.

Thursday, April 5, 2012

Using Color to Prevent Accidents

We are all familiar with the use of color for keeping our attention: stop lights, construction signs, warning labels, etc. To try to minimize the number of mistakes I make, I color code my terminal sessions.

On Windows I use PuTTY for creating a secure shell session into the servers that I need to access. One of the options it to set a background color for the session.


For production I set the background color to red and for development I set the background to green. The red color is a warning to myself: "You are on the production server. Don't screw things up!" Then for each server I log into, I save a session, and create a shortcut to it. In PuTTY the syntax is putty.exe -load "session_name". For example:

c:\putty.exe -load "dev"
c:\putty.exe -load "prod"

Color can't fix my stupid mistakes, but it has helped me to stay focused.

On the topic of color, I just read this article on Wired.com about how red keeps you focused and blue makes you more creative. Next step is to use Firefox Personas to color code my Firefox windows: red for coding and blue for designing.
 
Blogger Templates