Skip to main content

Posts

Showing posts from December, 2011

Just another object-oriented approach to jQuery plugins

It has been almost a year since I have been working primarily in JavaScript. During this time I have written three jQuery plugins and loads of other scripts.This is the story of how my approach to writing jQuery plugins has evolved.

I was working on my first plugin, which was supposed to be a large (in LOC) and went through the authoring mentioned on the jQuery site. In the beginning- it was great, a few exposed methods, well organized code, private functions, everything looked pretty. Soon the code reached some 1000 lines and it started becoming messy for me. To clarify, I am basically a java developer. I accept that the coding practices will obviously differ in every language, but for me, object oriented approach to code seems much more understandable and tidier than 'functions everywhere' thing!

I began searching for object oriented approaches people take in writing jQuery plugins. There are many, but mostly at the cost of some other flexibility. Some approaches allow only…

Habit-Firebug Saver: SmartLogger

How many of the web developers do not depend on Firebug or the chrome's console... Just wondering..

BTW, its plain fun to work with firebug, makes life a lot easier.. Its a different matter all together that the other browser that you have to develop for does not have a powerful enough tool. (Name deliberately avoided to avoid the eminent flame-war!) Yes the current versions have a quite powerful debug and development tools but (hopefully) few developers working on products still have to consider some 10 year old versions (namely 6, 6.5 and 7). Ah, the pain.. Anyways, we are not discussing that..

What we are talking about is the issues that we face when testing our changes to a thousand lines JavaScript code on multiple browsers, especially after we are accustomed to the ease of firebug. :)

I spent much of my time commenting my console.log() statements before I could dare to open the page in IE. Well, fear not, the days have passed! The pain drove me to write a logger object that…

How to add a nice code block to blogger

While there are awesome syntax highlighting and styling libraries  with nicely written tutorials for using them with blogger, a simple 'code' tag can suffice at times...

For such times:

.myCodeHighlighter {
    border-left: 4px solid #FF9933;
    display: block;
    font-family: Courier,"Courier New",monospace;
    margin: 15px;
    overflow: auto;
    padding: 15px;
    text-align: left;
    white-space: nowrap;
}

And use as:

<code class="myCodeHighlighter">
//the code codes here..
</code>

A preview of how it will make your code tags look like? You are looking right at it! :)

Creating a Local Version Control System

Now this is a post that is going to be updated time and again.. The very post that made me abandon my previous blog to move on to a Google site..
Requirement: Need to setup a local repository.. a version control system.. Given that I use VSS (I know, please dont make faces..!) at my work place, I am used to the 'ease'.. However it may be, it sure is simple to use...! I need the repository to be platform independent, as I dual boot into Windows 7 and Ubuntu, secondly need it to be local.. Now thats the background, next is a journal...
Which one to use? Tried: CVS: on Ubuntu 11.4 and on windows 7.. dint find it so impressive.. TortoiseCVS: Dont know why but the options in the context menu never appeared...! :S Mercurial: confused about its use.. yet to be tried.. Trying out git.. many friends suggest this.. seems interesting.. simple to learn, they say.. lets see!
Git setup Alright, what helped me understand it whole was two great articles, one form tiredblogger and another from a

mGSD With CheckboxPlugin

To give an introduction, TiddlyWiki is a wiki in a single html page, a must have tool for every developer, what you use it for is subjective. And mGSD is a TiddlyWiki variant to aid in GTD.

    I believe, CheckboxPlugin is a must have in a tiddly wiki that can even remotely be used to track things! In spite of warnings that it 'damages your mGSD' I haven't been able to damage mine nor the data in it for a while now.. Thought should share it with you..
    But I must remind that it can 'potentially' damage the file or the data in it if proper precaution is not taken. So please backup your wikis if you plan to proceed on the steps I mention here. Do proceed only when you are sure of what you are doing and that you have a copy of the file safe somewhere.
    I did damage a few of the mGSDs when I first tried out using CheckboxPlugin, the auto-backups saved me. What I have found out is that the file is damaged or the data is corrupted only when the CheckboxPlugin-…

Eclipse: Same Workspace in windows and linux

I believe almost all dual booters wish for something like this.. The eclipse workspace should be independent of the operating system they are logged in..! well.. I have found a way to do it..Issue:
    The problem with using the same workspace is that 'it doesn't work!' :D well.. the configuration of a workspace is stored in .metadata folder inside the working directory.. it has all the paths.. Most importantly, the path to JRE/JDK..! If a workspace from Windows is opened in Linux/ubuntu the java projects wont compile cause of the build path issues.. If you set it right in ubuntu, it wont work in windows..

Solution:
Well..One of the solutions that works or at least worked for me is:
    Having 2 ws with all projects pointing to an external folder..!

There may be other solutions, but this is how it is done:
    Say you have a workspace under windows, now you need it to work under ubuntu..
Well.. leave alone the original workspace.. Create a new one and 'import' the pr…

Explanation of the name...

Hello!
It's not that this is my first attempt at blogging but my previous attempts never went past a couple of posts... This precisely is the 3rd!
This time, I was serious to make it a habit to blog. The idea is, when you want to blog, it has to be about something new, something you tried 'new', in effect, you keeping doing something new. One of my attempts to keep up experimenting.

This time wanted to make it different, a name that has a real meaning, for both the worlds: the one I belong to and the one I came from...
So, was thinking about a name for the blog...

The beginning of the expression...
The beginning: As all my computer literate readers will understand, The Slash (/) stands for the root! The Beginning in this context.

The Expression:
The word 'prot' here stands for proteins.Thinking further, what are proteins? Now the life sciences students will may begin with 'Proteins are biochemical compounds blah blah blah' (read that on Wikipedia), but at …