IE7 with ClearType

I installed IE7 with ClearType.
ClearType is a technique to smooth out text and make it look softer to the eye.

It sounded like a good idea, then I relaized that it didnt just effect IE, but windows explorer, my computer, control panel, and basically all the other internal windows areas.

It wouldnt be so bad if it didnt make all the text on the screen look like it had a slight blur to it, It was annoying and hurt my head after a while.

I tracked down the way to turn it off in windows XP:

  1. Open IE7
  2. Open Tool Menu
  3. Click Internet Options
  4. Click Advanced Tabs
  5. Under Multimedia, clear the Use ClearType checkbox
  6. Click OK X 2

IE DOM : WTF!

I have been working on a help documentation system at work.
There are roughly 50,000 HTML files to deal with (yes 50 thousand).
The html files have a pretty decent structure, but they are by no means XHTML.

I dont have access to a web development language like php, cfm, for asp or this project to insert
the site navigation, page headers and footers, So I decided to go with some sweet web 2.0 un obtrusive javascript.

to make life easier for myself, I had the authors of the help system insert a single line into the head of each HTML file.
The line was a call to a javascript file. That javascript then used the DOM to insert all the appropriate CSS and other JS files I needed to make the pages look clean, and do what I needed them to do.

Things looked great in FireFox. Life was good until I loaded the site into Internet Explorer.
My beautiful project looked like a pile of crap, no styles, no javascript, just a stupid javascript error.

IE isnt known for its script debugging (another reason to no use IE). It took me literally hours to track down the problem.

I was doing this for all the css files (4 of them)

	var tmpElm = document.createElement("style");
	tmpElm.setAttribute("type", "text/css");
	tmpElm.appendChild(document.createTextNode("/some/directory/sweetness.css);"));
	document.getElementsByTagName('head')[0].appendChild(tmpElm);

Its clean, simple unobtrusive javascript.
create a style element, add the right attribute to it, add value to the style tag, then append it to the page head.
straight forward stuff.

Like I said, FireFix had no problem with it. After doing tons of test, i realized that IE didnt like me appending a style tag to the head!
Then I found this:

IE won't allow document.createElement('style')
If you try to add style declarations in the head of a document, IE borks at the name 'style' – "unexpected call to method or property access".

http://www.quirksmode.org/bugreports/archives/2006/01/IE_wont_allow_documentcreateElementstyle.html

IE gets confused between the head element <style> and the object property .style!

So I spend all that time debugging my code, which was perfectly fine, because IE is retarded and doesnt know the difference between <style> and .style!
WTF!

I removed all that sweet un obtrusive code and used this instead:

	document.write("<style type="text/css">@import url(/some/directory/sweetness.css");

I hate using document.write() these days, but it works in both IE and FF now.
My life sucks some times.

speed up firefox

Alot of people I know dont like firefox because its slow. after following my insteructions here, firefox will be anything but slow:

  1. Type "about:config" into the address bar and hit return. Scroll down and look for the following entries:

    network.http.pipelining

    network.http.proxy.pipelining

    network.http.pipelining.maxrequests

    Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.

  2. Alter the entries as follows:

    Set "network.http.pipelining" to "true"

    Set "network.http.proxy.pipelining" to "true"

    Set "network.http.pipelining.maxrequests" to some number like 30. This means it will make 30 requests at once.

  3. Lastly right-click anywhere and select New-> Integer. Name it "nglayout.initialpaint.delay" and set its value to "0". This value is the amount of time the browser waits before it acts on information it receives.

    If you're using a broadband connection you'll load pages MUCH faster now!"

Using PHP and Math To slow down spammers

If you read my blog, you might have noticed a LOT of spam in the comments of the posts. I was getting 100+ a day. Getting you blog on the front page of Digg.com will do that I guess. I got tired of all the spam, so I had the server email me a copy if the comment to my T-mobile MDA phone, If I saw the post was spam, I could kill it right away. This got old because I was getting an email every 5 – 10 minutes, way more then I cared to check.

I know that captcha systems help with keeping spam robots out, but at the same time I find them hard to use so I didnt want to put one up. Also, many spam bots look for captchas and can read them now! I thought there had to an easy way to handle the problem.

Step 1
Rename the file that your form posts to. This will break many of the bots and help cut the spam for a little while.

Step 2
Using some simple php, I decided to make users answer a very simple random math problem before their post could be saved. Here is some sample code on how I set it all up.

click the thumbnail images for a larger view of the code

form.php
form.gif

process.php
process.gif

I realize that there are most likely better ways to solve this problem, like having the random numbers be displayed in images that are dynamically generated, and I will do that If this menthod fails. For right now it seems to be working. I hope that it works for you.

DOWNLOAD THE SOURCE CODE

Coldfusion MX RSS Feeds

I am a web developer by trade. I write a lot of ColdFusion code for my job, I write a lot of PHP in my spare time. Being involved in both the CF and PHP communities, I have seen an overwhelming number of tutorials for things like generating RSS feeds using PHP, but not too many geared towards CF developers.

Here is some quick and dirty code that I wrote using CF MX to generate an RSS feed using some data that I had stored in a MS SQL database.

Download the source code here