A concern, a message….
A friend of mine recently whipped up a message of concern regarding saving the earth. I thought it was done pretty well so am posting it here…
A friend of mine recently whipped up a message of concern regarding saving the earth. I thought it was done pretty well so am posting it here…
Internet Explorer apparently has a bug in it that prevents you from using getElementsByName on document elements that have been created using document.createElement. This is a known issue with Internet Explorer and for some reason no one seems to have done anything to fix it (or is this the way it is meant to function?). The following (although perfectly legal code) does not seem to work on IE, although it works just fine on Firefox (and possibly other browsers although I haven’t tested):
<html>
<head>
<script type="text/javascript">
function addTextBox()
{
var div = document.getElementById(’addToDiv’);
var tb = document.createElement(’input’);
tb.type = ‘text’;
tb.name = ‘textbox’;
tb.value = ‘data’;
div.appendChild(tb);
}
function countBox()
{
alert(’Number of textboxes: ‘ + document.getElementsByName(’textbox’).length);
}
</script>
</head>
<body>
<input type="button" value="Add Input Box" onclick="addTextBox();" />
<input type="button" value="Count TextBoxes" onclick="countBox();" />
<div id="addToDiv">
</div>
</body>
</html>
A work around to this problem is using innerHTML as opposed to createElement in order to add a new element. This code seems to fix the problem and works fine on all browsers (I imagine):
<html>
<head>
<script type="text/javascript">
function addTextBox()
{
var div = document.getElementById(’addToDiv’);
var tb ="<span><input type=’text’ name=’textbox’ value=’data’ /></span>";
div.innerHTML = div.innerHTML + tb;
}
function countBox()
{
alert(’Number of textboxes: ‘ + document.getElementsByName(’textbox’).length);
}
</script>
</head>
<body>
<input type="button" value="Add Input Box" onclick="addTextBox();" />
<input type="button" value="Count TextBoxes" onclick="countBox();" />
<div id="addToDiv">
</div>
</body>
</html>
This is more of a generic setting than a setting for Gmail, however, since I started using IMAP only after Gmail offered it I’ve realized it only now. If you use the Archive+Label combo in Gmail to replicate the feeling of folders then you might have noticed after you’ve set up IMAP in Thunderbird that all the mails that come to your inbox show up with a nice count (n) in brackets. On the other hand, none of the mails which get automatically archived and assigned to labels get displayed.
Its only when you click on a particular label does it tell you if any new mail has arrived. This gets annoying when you have quite a few labels. So as an update to my previous post, I found this setting and thought I would mention it here if anyone else wanted to know.
In order to get the unread message counts on all your labels go to “Tools->Options->Advanced->Config Editor” and type in “imap” into the filter box.
The first setting you see is “mail.check_all_imap_folders_for_new” and it is set to false. Double click it to set it to true. Restart Thunderbird and do a “Get Mail->Get All New Messages”. Now if there are any unread mails in any of the labels, it will display them as well (since it has now checked all the IMAP folders you are subscribed to.

I’ve been trying to get my hands on a good ruby editor for a while and somehow every time I take a look at the one’s that exist, I am not at all impressed. These are a few of the editors that I have taken a look at and my impressions of them. As a beginner to Ruby, my only requirements initially are that I have syntax highlighting, code completion and it should just work without me having to do a whole lot. I am yet to test it them out with Rails (although I’m assuming that if they work good with ruby, they will work good with Rails)
1. SciTE - This comes installed by default if you are a windows user using the Ruby ‘One click installer’ available here. Of the 3 editors I looked at, this has the fewest features. One thing that is good about this though is that it is extremely quick to load. Unfortunately it lacks code completion which is a major requirement of mine. The reason why I believe code completion is useful while learning a language is you can actually look through all the methods for the various built-in objects rather than having to go back to the documentation each time. Consider this your bare bones editor with syntax highlighting. I wasn’t very happy with the indentation support as well, for example, it indents it when you start a function, but typing in ‘end’ does not reset the indentation. Its a small annoyance but an annoyance no less.
2. Aptana - I thought that this would be the most promising editor now that they have taken up the RadRails project as well and are integrating it into their existing system. Aptana is based off of Eclipse and provides a well rounded development environment. As of this writing however, Aptana’s code completion for ruby is broken (and has been for quite a while). All the other features seem to work well, syntax highlighting, debug support, etc. but it throws a Null Pointer Exception when you try to do a ctrl-space for code completion.
3. Netbeans - Of all the editors, I found this the simplest to install and start using right out of the box (with the exception of changing one setting, that is if you want to use the native ruby compiler). Other than that I had no hiccups in getting up to speed with the Netbeans editor and I would recommend it to anyone starting out with Ruby. Netbeans themselves have a nice site to show you how to get going with it.

A more in dept review of some editors is available here, and it very nicely outlines the advantages of Netbeans
I recently made a post on how to configure Windows Live Mail Beta (client) for Gmail’s new IMAP offering. I wasn’t very comfortable with the application and wanted to give Thunderbird a try (again). Although Foxmail has been my primary e-mail client, it does not support IMAP.
The first step is to follow the instructions at the Gmail Help Center for setting up Thunderbird as you IMAP client. Once that is done you still have to configure your folders to map accordingly Gmail.
When you follow the steps at the Gmail Help Center, you end up with a folder list like the following:

The [Gmail] folder has sub folders containing the your actual primary set of folders of your Gmail account (Inbox, Starred, Sent Mail, Drafts, All Mail, Spam & Trash). All your labels are shown as folders outside of this. There is an easy method to map your primary folders correctly to Gmail’s, but doing so will deprive you of access to your labels (which show up as folders in Thunderbird).
So the cleanest way to map the folders is to do the following:
1. In Thunderbird select Tools->Account Settings and select the account that you are using for Gmail IMAP.
2. Select Copies & Folders under that.
3. Sent Mail: Choose ‘Other’ for the “When sending messages, automatically: ” and from the drop down select “AccountName”->[Gmail]->Sent Mail
4. Drafts: For drafts as well, choose “Other” and from the drop down select “AccountName”->[Gmail]->Drafts
5. Spam: Select “Junk Settings”, check the “Move junk messages to”, select “Other” and from the drop down select “AccountName”->[Gmail]->Spam

This fixes most of your folders. The only remaining one is “Trash” and fixing this folder is a bit cumbersome, but it is worth it. By default Deleting a message does not send it to your Gmails “Trash” folder, instead it sends it to Thunderbirds Trash folder. The way IMAP is set up is that Thunderbirds Trash folder is mapped to [IMAP]/Trash on Gmail. So here are your options
1. Let it remain as is and you will have an extra label called [IMAP]/Trash in Gmail, under which all your deleted mails will reside.
2. If you want your deleted mails to be removed from your inbox, but still exist (in your ‘All Mails’ section) then map your trash to ‘[Gmail]/All Mails’
3. If you want your deleted mails to be removed from your inbox, and actually be trashed then map your trash to ‘[Gmail]/Trash’
(1) requires no further action on your part, but (2) & (3) are essentially the same thing, only differing in folder names.
So here’s how you go about fixing your trash folder:
1. Close Thunderbird
2. Go to C:\Documents and Settings\<windows_username>\Application Data\Thunderbird\Profiles\<profile_name>, where <windows_username> is your windows logon and <profile_name> is the current Thunderbird profile you are using.
3. Open prefs.js in your favorite text editor and search for a line that says user_pref(”mail.server.server#.directory-rel”, “[ProfD]ImapMail/imap.gmail.com”);
Here server# refers to your server number. Basically we have to find out which server number is being used for our Gmail IMAP
4. Just below that line, add an additional line that says user_pref(”mail.server.server#.trash_folder_name”, “[Gmail]/Trash”);
5. Startup Thunderbird again and your Trash folder below the Inbox should no longer be there. Instead it will use [Gmail]/Trash. If it does show up, then restart Thunderbird a couple of times until the Trash folder below the Inbox goes away. I have no clue why this happens, but this is a quirk I’ve noticed.
Now anything you delete would go to the actual Trash. If you wanted it archived instead of trashing it, specify [Gmail]/All Mail as the trash_folder_name.
Thunderbird should now be configured to properly work with Gmail’s IMAP.
Ever wanted to take screenshots of a web page in its entirety? Ever wanted to crop out a portion of it, highlight a portion of it, blur out specific details? There are times when I’d wished I have a tool to do that and now it exists. I’ve been using Screengrab! up until now, but after seeing Fireshot I don’t think I’ll be going back. Here’s a screenshot of it in action

It has a lot of features for grabbing the whole page, a part of it, annotating it, blurring it out, etc. Definitely worth being in your palette of Firefox Add-ons.
Download the Fireshot Addon.
Gmail has finally started giving users IMAP access and I think that its going to be very useful for a lot of users. Up until now I have been using Gmails POP service in conjunction with Foxmail. I loved Foxmail for the fact that you could create multiple accounts and have each of them password protected. This allows many users for a computer but at the same time keeps your data private (you could use different users on the system, but I also have multiple mail accounts, some of which I want password protected). I have not been able to find another application yet that provides the same password protection feature of Foxmail.
Unfortunately Foxmail does not support IMAP as of now, so I have decided to switch to either Thunderbird or Windows Live Mail Beta (henceforth referred to as WLMB). I managed to get WLMB up and running satisfactorily with Gmail IMAP. Here’s how I went about it.
Download WLMB here and install it.
Once done we can begin setting up our account for using IMAP.
Head to your Gmail account and on the Settings->Forwarding and POP/IMAP page (if you don’t see it, its probably because Google is still rolling it out to users, it will show up in a few days).

Once that’s done, fire up WMLB and Add an account.
Enter your e-mail address, password and select ‘Manually configure settings for email account’.
Put in the following settings (don’t forget to specify the login ID):

Once done, WLMB will download your folders and display the list:

The problem is that the folders on your drive do not get automatically mapped to the right folders within Gmail, but rather get mapped to the subfolders within the Gmail folder.
To fix this right click on your account and choose properties->IMAP and specify the following settings:

Once done, your final list of folders should look like this:

Some points to note however are :
Well there you have it. Gmail IMAP all set up and ready to go in your Windows Live Mail Beta.
When I started using Wordpress for blogging, I realized that my tags would soon build up if there was no way of viewing the tags I’d already used while specifying tags for a post. A little hunting around brought me to a plugin - Simple Tags, which I got from here. Very useful, must add plugin is what I would say.
Update: This plugin is much more useful… I just looked at the options for it.
If you have ever come across this error in SQL
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
then all SQL is trying to tell you is that you cannot use your ORDER BY clause within a subquery.
So if you have something like this, it sure as hell won’t work:
SELECT x, y, z
UNION
SELECT * FROM(
SELECT DISTINCT x, y, z
FROM (
SELECT x, y, z
FROM a
WHERE
UNION
SELECT x, y, z
FROM b
WHERE
)
ORDER BY z
)
Work arounds? A little hunting around showed that you could “use” a ORDER BY in a subquery if you used the TOP X PERCENT in your SELECT statement which would go something like this:
SELECT x, y, z
UNION
SELECT * FROM(
SELECT TOP 100 PERCENT x, y, z
FROM (
SELECT x, y, z
FROM a
WHERE
UNION
SELECT x, y, z
FROM b
WHERE
)
ORDER BY z
)
Why I stressed on “use” there is because although you can use it, it doesn’t make life any easier. Basically it allows the usage of ORDER BY, but it never does ORDER BY anything. You get back an unordered result set.
The workaround I used was adding an extra column that had blank data for the row I wanted sorted on the top and the actual data I wanted sorted by for the rest of the rows; then sorted it based on this extra column. Crude, but it works.
I thought this would be an easy thing to do, but it doesn’t seem so.
I’ve been thinking about purchasing a MacBook as my next laptop, but a few things concern me. Even though I’ve read a whole lot about the interoperability with Windows, its the other things that I’m more worried about. The fact that the touchpad does not support taps in order to click is on the topmost of the list. Also that there is only one button on the touchpad… This basically means that there is absolutely no way that you can use the Mac with only one hand if you had to. Well all things apart, the functionality that it provides looks pretty amazing and convincing.
My other deciding factor is the pricing. The MacBook is fine, but it seems like a steep price for a 13″ screen. Also it will almost be like downgrading from my current 14″ screen.
My other question… Do I really need a new laptop?