You are currently browsing the FRP weblog archives for October, 2008.

Removing the 3 pixel gap in Hotmail email for Firefox

A while back I wrote a post about removing the 3 pixel gap in Hotmail. While that provided a solution for IE I've since discovered another fix that works in Firefox. It's the same problem as before; a 3 pixel gap is added beneath images, particular to images inside table cells. The problem seems to stem from the font size settings, obviously this shouldn't affect a table cell that does not contain text. Chalk it up to yet another That Shouldn't Make Any Difference But It Does™ This time the fix is to add style="line-height: 50%" to the TD tag. You should then end up with the following:

HTML:
  1. <td style="line-height: 50%">
  2.     <img src="image.gif" width="300" height="50" alt="" />
  3. </td>

Apple ‘upgrades’

Hmm, reading up on the big Apple hardware announcement on Tuesday I have to say I'm disappointed. I was really hoping for an OS X powered netbook. Instead what we have now is a so-called pro laptop with a shiny screen. Oh and if you want a small form factor laptop with firewire then you're SOL because the MacBook only has USB2 in the new models.

Reading the various comments on TUAW the fanboy response of "if you want firewire buy a pro" is quite spectacularly idiotic. If your laptop is your only computer then fine, go pro. I however, already have a desktop, I don't need another all singing all dancing workhorse, and 15 inch laptops are not very mobile. The MacBook is too expensive to be missing such a key port. I don't mind that my Eee PC only does USB, it cost less than £300, it's not designed to be used solo. A MacBook is, or was.

I'm seriously questioning my commitment to using Apple computers. I've already given up waiting for a netbook for this round of my laptop upgrade cycle with the purchase of the Eee. Currently I work on a white 20 inch iMac, what do I do if that breaks? Suck it up and buy a shiny screened iMac? Nope, I remember the nightmare of shiny CRTs too clearly. What about a Mac Pro? I design websites, I don't operate mission control, 8 cores is overkill for my needs. And an £1800 starting price? Forget it. So it looks like either I join the dark side and get used to Windows or I switch to Linux. I've been using Ubuntu on my Eee and I'm impressed with it. It even runs Photoshop. Then there's always VirtualBox to run anything that isn't covered on linux.

How to setup SEO friendly URLs for WordPress on Zeus

Up until a year ago I'd only ever used Apache to host websites. At Oxeye Daisy we host on Zeus webservers. After a lot of fruitless searching on the internet for guides on how to setup SEO friendly permalinks for WordPress hosted on Zeus I stumbled upon the relevant code. I've finally got around to tweaking and commenting it. I thought I'd post it here in case anyone else is having the same trouble.

First you need to go to your WordPress admin page and set up the permalink structure in Options > Permalinks. I've set mine to /%year%/%monthnum%/%day%/%postname%/ but you may want something different.

The notes in the script assume the requested URL to be http://www.domain.co.uk/blog/2007/10/31/an-example-post/?color=red I've added the GET queries so you can see how they are handled, they're not used in WordPress. This URL is then translated into http://www.domain.co.uk/blog/index.php/2007/10/31/an-example-post/?color=red. Notice the index.php in the middle? That's the key bit to making all this work.

Save the following code in a file called rewrite.script and upload it to your web space. Note that you will need to uncomment some parts of the script depending on whether your blog is in a sub directory or the top level of your site.

The code is currently set to work with a sub directory of blog. It has only been tested on Namesco servers and it's set to ignore their specific hosting folders like webmail, controlpanel and tech_support.

CODE:
  1. RULE_0_START:
  2. # Get the document root path and put value into the SCRATCH array.
  3. # This is the server path not the web URL.
  4. # e.g. /content/DesignerPlus/i/n/domain.co.uk/web/
  5. map path into SCRATCH:DOCROOT from /
  6.  
  7. # Get the URL without the domain.
  8. # e.g. /test&colour=red
  9. # e.g. /blog/2007/10/31/an-example-post/?color=red
  10. set SCRATCH:ORIG_URL = %{URL}
  11. set SCRATCH:REQUEST_URI = %{URL}
  12.  
  13. # See if there are any queries in our URL.
  14. match URL into $ with ^(.*)\?(.*)$
  15. # If there are...
  16. if matched then
  17.     # Set a var to path without the domain part.
  18.     # e.g. /blog/2007/10/31/an-example-post
  19.     set SCRATCH:REQUEST_URI = $1
  20.     # Set a var to the passed queries.
  21.     # e.g. colour=red
  22.     set SCRATCH:QUERY_STRING = $2
  23. endif
  24. RULE_0_END:
  25.  
  26. RULE_1_START:
  27. # This is setting a var to the server path and sub folders.
  28. # e.g. /content/DesignerPlus/i/n/domain.co.uk/web//blog/2007/10/31/an-example-post
  29. set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
  30. set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}
  31.  
  32. # Check to see if the file exists.
  33. look for file at %{SCRATCH:REQUEST_FILENAME}
  34. if not exists then
  35.     # The file wasn't found so is it a folder?
  36.     look for dir at %{SCRATCH:REQUEST_FILENAME}
  37.     if not exists then
  38.         # No folder either. So now check the URL for special hosting folders.
  39.         match SCRATCH:ORIG_URL into % with ^/webmail|^/tech_support|^/controlpanel
  40.         if matched then
  41.             # If a special folder was requested end the script.
  42.             goto END
  43.         else
  44.             # There were no files, folders or special folders so set the new URL.
  45.  
  46. # -- Sub directory -------------------------------------------------------------
  47.             # If the blog is in a sub directory...
  48.             # e.g. /blog/index.php/2007/10/31/an-example-post
  49.             match SCRATCH:REQUEST_URI into $ with ^/blog(.*)
  50.             if matched then
  51.                 set URL = /blog/index.php$1
  52.             endif
  53. # -- Sub directory ends --------------------------------------------------------
  54.  
  55. # or...
  56.  
  57. # -- Top level -----------------------------------------------------------------
  58.             # If the blog is in the top level of the site...
  59.             # e.g. /index.php/2007/10/31/an-example-post
  60. #            set URL = /index.php%{SCRATCH:REQUEST_URI}
  61. # -- Top level ends ------------------------------------------------------------
  62.            
  63.             # Go to the next rule.
  64.             goto RULE_2_START
  65.         endif
  66.     endif
  67. endif
  68. # If files or folders were found end the rewrite script.
  69. goto END
  70. RULE_1_END:
  71.  
  72. RULE_2_START:
  73. # Check for queries in the requested URL.
  74. match SCRATCH:ORIG_URL into % with \?(.*)$
  75. if matched then
  76.     # If queries were found add them to the new URL.
  77.     # e.g. /index.php/2007/10/31/an-example-post/&colour=red
  78.     set URL = %{URL}&%{SCRATCH:QUERY_STRING}
  79. endif
  80.  
  81. # -- Sub directory -------------------------------------------------------------
  82. # If you only want to rewrite the sub directory uncomment this bit.
  83. match SCRATCH:ORIG_URL into % with ^/blog
  84. if matched then
  85. # -- Sub directory ends --------------------------------------------------------
  86.    
  87.     # End the script.
  88.     goto END
  89.    
  90. # -- Sub directory -------------------------------------------------------------
  91. endif
  92. # -- Sub directory ends --------------------------------------------------------
  93. RULE_2_END: