Site Moved

This site has been moved to a new location - Bin-Blog. All new post will appear at the new location.

Bin-Blog

DamnInteresting.com

I found DamnInteresting.com today throught Digg. It a site that posts - well - interesting stuff. A must visit site - highly recommended by me.

I just found the site and have already spent hours reading various articles in the site. The articles are well written and the site is updated very often.

Filed Under...

Categories :
Technorati Tags:
Read More...

SedGUI progam is Complete

Remember the SedGUI script we talked about eariler? I have finished the program. I know that it is a bit late, but think of it as my christmas present for you.

This is a GUI version of the Sed(Stream EDitor) program in Unix. Sed is a very powerful and very useful program - that said, it is very user unfriendly. So this is a GUI version for the Sed progarm - you get the functionality of Sed but with a better interface.

The program is in Perl Tk - around 900 lines long. It is fairly flexible but kind of slow. Download SedGUI from my Bin-Co website and try it out. Remember it is a Beta release, so if you notice any problems with it, please let me know.

Filed Under...

Categories :
Technorati Tags:
Read More...

New Greasemonkey User Script - Multiple Engine Searcher

I have created some Greasemonkey User Scripts before, but this is the first one that could be used by others. All other were only fit for personal use. This script will add links to other search engines when searching for something on google. For example, when you search for anything on google, the result page will show the following line...
Try your search on Yahoo, Ask Jeeves, AllTheWeb, Teoma, MSN, Lycos, Technorati, Feedster, Bloglines, Altavista

I got the idea from a Firefox extension which did the same thing. I thought that making a extension for such a simple task is bit of an overkill - a simple user script will suffice for this purpose.

For installing these scripts, you must have Firefox browser and must install Greasemonkey extension for firefox. Then right click the below link and choose 'Install User Script' Option from the context menu.
Install Multiple Engine Searcher.

Filed Under...

Categories :
Technorati Tags:
Read More...

"Don't Make me Think" by Steve Kurg

I just finished reading the book "Don't Make Me Think" by Steve Kurg. It is a book on web acessablility and I would recommend it if you are in web designing. It is well written, witty and has very valid information on how do design so that the site may be easier to use.

There is one point I have to share here - people will not read something on the web if it is long - but if you manage to compress the same information into one small sentence, over 90% of you visitors will read it. Now, if I had followed my own advice, the last sentence will look like this...

Users love small sentences.

The next book I have to read is "Web Design Acessability" by Jacob Nielsen - much larger than "Don't Make me Think", but more detailed.

Filed Under...

Categories : Technorati Tags:
Read More...

Multiple Months for Calendar Navigation

I have added a new feature to the blog today - now you can use the calendar navigation to access posts from previous months. This is the second version of the Calendar Navigation for Blogger program in javascript.

Now the calender will have a link for the last three months. All the posts of the last three months will be shown in the calendar. All the links to the post has the 'title' attribute so if you hover on a link for a second you will see the title of the post - so you will not be blind in choosing which posts you want to read.

I still have no idea why I am working on the calendar navigation - Jakob Nielsen, the foremost web usability expert have condemned calendar navigation to be a very useless form of navigation. Anyway, since I have made it, why not make it better?

One last thing - the new version is still in beta - if you notice any errors, just let me know using the comment system. If you have any suggestions about how to improve it or any other opinion about this system, well, you know what to do.

Filed Under...

Categories :
Technorati Tags:
Read More...

Learning Sed - and Making SedGUI

I am trying to learn Sed(Stream EDitor). Sed is basically a small(but powerful) utility which you can use to filter files based on regular expressions. You can use it to

  • Find the lines that match the given regular expression.
  • Replace an expression with another.
  • Get the file contents from one point to another - the points can be a line number or even a regular expression.
  • And much more...

I am using the tutorial at http://www.grymoire.com/Unix/Sed.html. There is also a nice collection of tutorials at http://sed.sourceforge.net/grabbag/tutorials/.

Anyway since I know Regular Expression, I did not have any trouble learning the stuff. The trouble is using it. Don't get me wrong - Sed is a very powerful and very useful program - that sed(sorry, couldn't resist), it is very user unfriendly. If you know sed, you know that it has no GUI - it is a program that can only be run from command line. You define the regexps that must be matched, the file to be used and call the program. You can either see the results on screen or save it to another file. If you are saving it to another file - like with this command... sed 's/BEGIN/begin/' <old >new you have no clue whether any thing was changed. Another problem is that if there are multiple commands you wish to execute, the code quickly becomes un-handleable.

Despite all this issues, I could not abandon Sed - it is very useful for me. So I have decided to make my own little Sed like tool - SedGUI. Since this involves a lot of Regular Expressions, Perl is the obvious choice for the language. I will use Perl Tk to create a small GUI for the program. I have started the work on this program - I already have a working prototype. It is no where near release stable - so don't wait around for the download link. This is what I have done till now... It is nowhere near complete - I have just had one day of coding. I will let you know as soon as I release a beta version. Till then, use Sed.

Filed Under...

Categories : Technorati Tags:
Read More...

Exams Have Started

My IGNOU exams have started - the first one was on the December 1st - and it will end only at 27th of this month. Please forgive me if the frequency of my posts take a dip - I have to study for the exams.

The next exam is on 9th - Internet Programming. No, my knowledge as a web developer is almost useless here - the questions will be about Java - apparently they are still under the impression that Java Applets are still used. The next one is on the 10th and that is "Theory of Computation" - I am going to hate that. Must stop now - got to study.

Filed Under...

Categories :
Technorati Tags:
Read More...

My Custom JavaScript Functions

Dustin Diaz have recently written an article on Top 10 custom JavaScript functions of all time. So I thought that I would write about all the functions on my common.js file.

addEvent()

The competition for addEvent was just over - so I was not able to include this function in any of the projects I do - but all my future projects will have this.

getElementsByClassName()

A very important function for me. If multiple elements in a html document must be processed, I always use this. I have spoken about my getElementsByClassName() function earlier, but I will include the code here...

//Get all the elements of the given classname of the given tag.
function getElementsByClassName(classname,tag) {
 if(!tag) tag = "*";
 var anchs =  document.getElementsByTagName(tag);
 var total_anchs = anchs.length;
 var regexp = new RegExp("(^|\\s)"+classname+"(\\s|$)");
 var class_items = new Array()
 
 for(var i=0;i<total_anchs;i++) { //Go thru all the links seaching for the class name
  var this_item = anchs[i];
  if(regexp.test(this_item.className)) {
   class_items.push(this_item);
  }
 }
 return class_items;
}

Update : The regular expression have been chaged from var regexp = new RegExp("\\b"+classname+"\\b"); to var regexp = new RegExp("(^|\\s)"+classname+"(\\s|$)");. Thanks to Dustin Diaz for pointing it out(see comments for more information.)

Function $()

My dollar function is very simple. Just call it like this $("id"); and it will return the element with that id. The code is.

function $(id) {
 return document.getElementById(id);
}

Dump Function - for debugging.

The dump function will output an array - with a better formatting so that humans could understat what is in the array.

function dump(arr,level) {
 var dumped_text = "";
 if(!level) level = 0;
 
 //The padding given at the beginning of the line.
 var level_padding = "";
 for(var j=0;j<level+1;j++) level_padding += "    ";
 
 if(typeof(arr) == 'object') { //Array/Hashes/Objects
  for(var item in arr) {
   var value = arr[item];
   
   if(typeof(value) == 'object') { //If it is an array,
    dumped_text += level_padding + "'" + item + "' ...\n";
    dumped_text += dump(value,level+1);
   } else {
    dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
   }
  }
 } else { //Stings/Chars/Numbers etc.
  dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
 }
 return dumped_text;
}

This is how the function is called. In this example we will use a complex associative and list combination array as the argument.

//Calling the function...
var arra = new Array("Hloo",'s',23,23.1,"Hello World");
var assoc = {
 "val"  : "New",
 "number" : 14,
 "theting" : arra
};
alert(dump(assoc));

The result will be shown in the following format.

    'val' => "New"
  'number' => "14"
  'theting' ...
      '0' => "Hloo"
      '1' => "s"
      '2' => "23"
      '3' => "23.1"
      '4' => "Hello World"

Filed Under...

Categories : Technorati Tags:
Read More...

Firefox 1.5 - How to repair broken Extensions

The latest version of Firefox - Firefox 1.5 is released for the public. I have just tried it - but had to revert to the older version(1.0.7) because it broke many of my most necessary extensions. The broken extensions are...

The extensions that stayed intact were...
  • Sage
  • Web Developer

Some of the extensions like TabMix, PrefBar and Greasemonkey were too critical for my browsing that I could not sacrifice them - even for the latest version of Firefox. But I really liked the new version - so I made a last ditch effort to try whether I could repair the extensions - so that it may work with the latest version. As I have recently tried my hand at creating Firefox extensions, I set about the task with great hopes. I am providing a small note of what I have done so that you can try this out - if you too, like me, want to keep the latest version of Firefox - but is unwilling to sacrifice many of you beloved extensions for that.

First I installed Firefox 1.5 and removed all the extensions that did not work. Then I downloaded the latest versions of all the extensions I needed - you can download the extension by going to their websites and choosing 'Save Link As...' option from the right click menu of the Install link for that extension. For example lets say I want to repair the extension PrefBar - I go to their website and download the 'prefbar.xpi' file. Next I renamed the file to 'PrefBar.zip' - I changed the extension to zip. You can do this by running the dos command 'ren "PrefBar.xpi" "prefbar.zip"'. Now extract the contents of this file using any compression programs - like winzip. Now find the file 'install.rdf' and open it in a editor like notepad. Then find the Firefox section for the <em:targetApplication> tag. If only one is given that will be for Firefox. See the below example...

<!-- Firefox -->
 <em:targetApplication>
   <Description>
   <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
   <em:minVersion>1.0</em:minVersion>
   <em:maxVersion>1.1</em:maxVersion>
   </Description>
 </em:targetApplication>

NOTE: I just created the above example - the code of the extension you are are working on may not be the same as given - except for the contents of the id tag - <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> - that will be the same.

Now you have to change the value of the <em:maxVersion>1.1</em:maxVersion> to <em:maxVersion>1.5+</em:maxVersion>. This will make Firefox think that the extension is compactable with the latest version of Firefox.

Finally, save the file and add this file to the previous ZIP file. Then rename it back to <Extension_name>.xpi from <Extension_name>.zip. There - you are done. You have hacked the extension. Now all you have to do is fire up a Firefox window and drag the xpi files from their location to the Firefox window. This will ask the Firefox to install these extension. Just install them as you install any other extension. With some luck, your hacked extensions will be working in no time.

Before you try this out at home, I have to warn you that my attempts at this hacked have failed. I managed to install the extension - but they did not work properly like they did earlier. Greasemonkey was functional - but some of my most used scripts failed to work with the new version. PrefBar appeared, but it did not prevent Flash files from loading. So I was forced to revert the the earlier version.

Anyway, why don't you try it out - you have nothing to lose. If you do, let me know the results of your experiment - just leave some comments. Hope it works out for you. If it does not, wait for the extension writers to update their extensions.

Filed Under...

Categories : Technorati Tags:
Read More...

Subscribe to : Posts