Update: This post is outdated, I created a Firefox Addon collection
I use only 4 firefox Addons. (I am guessing this may come down to 3 with FF3.1's Tabbing features). These four make the slickest and most productive FF for me.
Tuesday, February 24, 2009
Fantastic Four Firefox Addons
|
Friday, February 20, 2009
Powered By
|
As it goes, We ought to give thanks to people who power us. This page will be updated, like the version page, to show all the tools, and people this site is Powered By!
Ubuntu
GIMP
Firebug
Blogger
Google [AppEngine, Ajax and other Apis]
AddtoAny
Project Fondue
jQuery
Monday, February 16, 2009
Don't Print
|
Dont print that email/document. Its not a request. Its a real, honest, warning. Dont do it. You must be really out of this world, or of the last millenium, or simply a silicon dimwit to use that printer instead of using it electronically.
In the first place, you are consuming (carelessly) yet another enviromentally expensive resource. No, not the paper. The Tree (do you know how long it takes for a tree to be ready for paper manufacturing? and all those chemicals used to make it?). On the other hand, it is much easier to search an electronic catalog than manually looking up a drawer full of business requirements in hard copy. Instead of printing those comminucation emails, jira tickets, corporate bills, use case documents (and the list goes on..) - scan them / store digitally. Many of these start off as electronic documents. Use those. You can make it worth even more by using Google Desktop search or similar tools. Much worse is printing books/study material for *reference*. Are you kidding? For *reference*?? BUY that book (Bookmakers are many times envorimentally friendlier, than printing in a brand new A4 papers from staples), if you cant read it off the monitor . Again, searching is so much easier, quicker and productive, if you are looking up the digital version.
You really have to print? REALLY! Chances are you DON'T - REALLY. Look for alternatives. Make that *looking* a habit. Tell others. Stop them from using the printer. Shoot them if you need to (Ok, that - I am kidding..). If you are a manager, encourage people to go green. Use no (or minimal) paper. It saves you a ton of money. Better yet makes you a pleasant tree hugger.
If you STILL have to print (you have to read this all over again :D)-
- Use both sides of the paper.
- Use that paper used on only one side.
- Make use of print preview and reduce errors.
- Reduce font size, spacing, extra line breaks - feel victorious even if you save one page!
- When you are done put that in a *recycle* bin.
I hope this makes you a better user of paper. If you find this a little harsher than you thought, keep that rolling everytime you go near a printer :P
Read more about this revolution
image:infomancie
Saturday, February 14, 2009
Happy Valentines Day!
|
This one is my all time favorite!
Happy Valentines Day!
Friday, February 13, 2009
Use meld as git diff gui viewer
|
Meld is a popular diff viewer in linux (gnome). It is extremely light weight. UI is very similar to WinDiff. Although it is not comprehensively robust yet, It is still a great help for people like me, handicapped to read huge diffs in command line.
Git is awesome when it comes to managing version control, esp in command line. However, while committing, you would want to check what changes are going in. git gives git-diff for this purpose. Spitting out a (unified) diff format text for showing changes. But reading this could be cumbersome at times. To visually inspect git diff, you can use the latest version of meld. The version that comes with debian or ubuntu 1.1.5 lacks git support. You need to build the latest meld (I got 1.2.1) from source. Here is how you can do it.
- resolve dependencies:
sudo apt-get install pyorbit pygtk gnome-python intltool
- Get the source from here (opens new window).
- Extract the archive.
- In the exploded directory, run make.
- It makes an executable meld
- Run meld path/to/git-project
- That's it, if there are any modified files, it will display the changes.

As an earlier alternative, if you have KDE or prefer to use kompare, You can pipe this to kompare to visually see the changes.
git diff . | kompare -o - I have tried using egit for eclipse. It sure is good for many features (commit, track, reource history, pull et al) but misses the "compare with base version" feature as in svn. Meld fills in that gap.
Thursday, February 12, 2009
Site now running on django 1.0
|
hence the bump in minor version - 3.1
While researching on grails and the patterns around it, I looked at django, rails, and lift. All these are quite amazing frameworks that get you started on an application like in 5 mins or less (That includes database layer, view pages, and controllers). Yeah it cannot do everything you want but its there to get you to kick off.
And then I realized, how much effort I am putting in maintaining my site on hand coded - wsgi.webapp based - Python app. So I started working to move this to django based multi app site. If you dont know, I host this site on Google App Engine. It does come with a patched, short featured, django of its own. However, I preferred to use app-engine-patch and deploy with a supplied django 1.0. You get most benefits of django with this port. A very big tip of hat to Waldemar Kornewald and his team for this patch. (Guess what, They also have a similar concept of stitching mutiple js/css files - media generator)
I can see how rapidly I can develop applications and deploy using django. I simply moved jscss.py to django views.py. My first sub-app is a dynamically manageable urls. All the following urls are served by my new django app.
http://sarathonline.com/java
http://sarathonline.com/green
Next, grails?
Tuesday, February 10, 2009
Faster webpages fewer Images with CSS Sprites
|
In a previous post, I have made a point how to improve performance by reduce HTTP connections by stitching together content of css and js fragments. At that time I also mentioned a way to do it further is to reduce the number of images on a page. Because images are also loaded on HTTP connections. Again the same Cache-Control headers on the client can be used to reduce much of this traffic. But to reduce the Number of HTTP connections, You can employ a technique called CSS Sprites.
I have to confess, I don't know about this technique until I was researching on GWT's ImageBundle interface. Had I known this trick, my SarathOnline2.0 site would not have been lame - text only!
Simply the technique is to stitch all images together into one big image. This big image is called a Sprite. The images used on my site are sprite-d as shown on the left. How do we display them seperately? Using css backgrounds. To achieve this We will send a blank 1px gif. Then insert an img tag with src=blank.gif, and height and width set to the image that was orginally intended to be there (kick this, go Firebug > Inspect Element :) ). Then, using css background: url(path/to/sprite.png) no-repeat top left; background-position: 0 -5px; You can clip the background to show the exact image. As shown below.
This technique is so well discussed in detail all over the web. But you dont have to get intimidated about doing this whole stiching, and calculating the co-ordinates et al. This online css sprite genereator is simply awesome. Supply it with a zip file containing all the small gifs or pngs, and it will spit out a sprite and a piece of code for your css. If you are like me, have that css in a separate file and keep that deploy that image on to your site. And boom, you got your site running faster. If you need to add one more icon, dont worry, add it to your list images, zip them, generate this sprite again. Just keep the names of the images same. The class names generated will be the same, so you dont have to worry about modifying existing pages.
Awsome? Ain't it?
Wednesday, February 04, 2009
Javascript: Convert Strings to Binary (and representing in a nerdy way!)
|
I follow those GoogleDevelopers Videos. Sometime back, in one of the presentations on GoogleIO, there was this interesting string of dots at the bottom of each page of the presentation. They looked like random big and small dots. A similar bunch of dots were also on the T-shirt of a presenter was wearing in another presentation. While it seemed something in the pattern, I could not find what it was. Finally, another presenter cleared the matter that those dots are just binary representation of "GOOGLEIO" (So much for advertizing Google IO, Impressive!).
So I wanna do it. Takes me back to days of those DSP classes at school. Nerdy me had to churn some old brain cells. I remember those first programming language classes in Pascal and C when you were asked to do fibonacci series and converting a binary string to ascii codes. That *experience* came handy here: Check it out!
For those who came to copy the javascript code to convert string to binary, Here it is:
function toBin(str){
var st,i,j,d;
var arr = [];
var len = str.length;
for (i = 1; i<=len; i++){
//reverse so its like a stack
d = str.charCodeAt(len-i);
for (j = 0; j < 8; j++) {
st = d%2 == '0' ? "class='zero'" : ""
arr.push(d%2);
d = Math.floor(d/2);
}
}
//reverse all bits again.
return arr.reverse().join("");
}
Tuesday, February 03, 2009
Decorator for Memcache Get/Set in python
|
I have suggested some time back that you could modularize and stitch together fragments of js and css to spit out in one HTTP connection. That makes the page load faster. I also indicated that there ways to tune them by adding cache-control headers.
On the server-side however, you could have a memcache layer on the stitching operation. This saves a lot of Resources (CPU) on your server. I will demonstrate this using a python script I use currently on my site to generate the combined js and css fragments.
So My stitching method is like this
@memize(region="jscss")
def joinAndPut(files, ext):
res = files.split("/")
o = StringIO.StringIO()
for f in res:
writeFileTo(o, ext + "/" + f + "." + ext) #writes file out
ret = o.getvalue()
o.close()
return ret;The method joinAndPut is *decorated* by memize. What this means is, all calls to joinAndPut are now wrapped (at runtime) with the logic in memize. All you want do is use the someregion+files+ext as your key in memcache. I extended an example in App Engine CookBook.
def memize(region="", time=3600):
"""Decorator to memoize functions using memcache.
The calling function must give a memizekey named parameter
"""
def decorator(fxn):
def wrapper(*args, **kwargs):
if (not "memizekey" in kwargs):
raise Exception("memize-d function does not send key")
key = region + kwargs["memizekey"]
del kwargs["memizekey"]
data = memcache.get(key)
if data is None or not settings.DEBUG:
data = fxn(*args, **kwargs)
memcache.set(key, data, time)
logging.info("Cached");
else: logging.info("Cache hit");
return data
return wrapper
return decoratorThis version of memize takes a region instead of key. The intention is a key is generally given at runtime, and is controlled by application logic, so it goes into the *actual* call (ex given below). But the region is (generally a prefix) decided at coding time to avoid runtime collisions. You could also update memcache by force at runtime. A sample call would be something like
class MainPage(webapp.RequestHandler):
def get(self, files, ext):
if ext == "css":
self.response.headers['Content-Type'] = 'text/css'
elif ext == "js":
self.response.headers['Content-Type'] = 'text/javascript'
forceUp = self.request.get("force");
if 'true' == forceUp:
forceUp = True
else:
forceUp = False
self.response.headers["Cache-Control"] = "public, max-age=432000"
con = joinAndPut(files, ext , memizekey=files + "." + ext, memizeforce=forceUp)
self.response.out.write(con);
For people coming from java background, this is similar to an around Advice in Aspect Oriented Programming. If I get time, may be I'll post another sample in AOP :)
Sunday, February 01, 2009
Define Freedom - Blogging and Media
|
Before I start, I want to make a few points clear. I have no contempt for either Mrs. Dutt or Mr. Kunte. Neither do I have any allegation or support for either. What I am writing, is my personal view and believe in strongest sense what and how one need to be thinking.
Everything ever is a fight in India. Truth, Freedom, Life itself. What we see here is just another classic case. In short: Barkha Dutt's coverage on 26/11 aired on NDTV while millions watched out of curiosity (for information and to quench anxiety). One Mr.Kunte in his limited reach tried to push his thoughts around. Mrs. Dutt brings in a lawsuit, and Mr Kunte. 3 months later posts a "not-for-comment" withdrawl post with specific points that have been objected. Mrs. Dutt has her own explaination too.
Thats what it is. It is neither reporting nor blogging. Its just some series of words in English formed to sentences and put to some meaning. How you want to read it is your choice. If you are Barkha or her admirers, you can read the not-for-comment is big bold. Or - If you want to, You will side with Mr. Kunte and consider the above paragraph the biggest understatement.
People will believe what they want to believe. Why do people watch CNN or NDTV (for the record, I don't endorse either, I go with NPR , C-SPAN)? Why do they have to believe you? Why do they have to read your post? You being good at words or in front of the camera, will not make the whole world comply with your argument. they are allowed to differ. Coming from different schools of thought, Mohandas Gandhi and Bhagat Singh - two names every Indian would take pride in taking. How come? What is freedom? What is a free country? What did we earn in the last 60 years of sovereignty? Do the politicians have the right to say what our women should and should not do? Does the media (print/TV/blogosphere) have the right to say what is correct and what is wrong? You cannot tell your post is (in its) right by using strong words. You cannot curb Terrorism by telling terrorists a 1000 times that they are wrong. For them, You are wrong! Simply, People will believe what they want to believe.
Freedom is, Barkha Dutt being able to report what she wants to, Chyetanya Kunte is given the same thing. A viewer of NDTV and cKunte.com given his own freedom of saying to either. The point is Legality and Morality don't always have two shades of black and white. There is a lot of grey area. EVERYONE is hell bent on making you believe its only Black OR White and asking you to choose their choice. What is the solution? Did human mind, especially in India, mature(v) enough to read it out? Education eludes to be an answer. Religion claims to be another. Media broadcasts its one. Parents and Culture profess they are. But what all of them do not realize is, You can keep me jailed, but you cannot jail my mind.Thats one freedom, you just cannot hold out from me!
I am no fool on Nov 27, nor un-emotional about Nov 26, and lastly not carried away on Jan 29. I just have my own views. You are entitled to have your own. So do you have the right to express yourself. You can be in a position to provide information or force a regulation, but What you cannot do is force me to think that you are right, and that makes the last sentence of the opening paragraph in this post a paradox.
Subscribe
Labels
- advanced (5)
- android (1)
- bugs (6)
- code (27)
- continued (10)
- css (6)
- design (10)
- developer (75)
- dilbert (2)
- Dobbs Journal (3)
- eclipse (11)
- FeelGood (31)
- finance (1)
- flash (4)
- fun (23)
- git (1)
- Google (12)
- Green (9)
- gwt (2)
- home (102)
- iBatis (2)
- image (10)
- india (11)
- iphone (3)
- java (16)
- javascript (10)
- jee (34)
- linux (22)
- memcache (1)
- movie (1)
- offtopic (45)
- OpenSource (9)
- osgi (6)
- Politics (4)
- python (2)
- scalability (6)
- security (5)
- soupdates (11)
- spring (9)
- technology (60)
- Telugu (2)
- thanks (2)
- Threads (2)
- tips (64)
- Tools I Use (38)
- travel (3)
- tutorials (22)
- ubuntu (14)
- vegetarian (1)
- video (13)
- webtech (16)
- weekend (39)
Blog Archive
-
▼
2009
(55)
-
▼
February
(10)
- Fantastic Four Firefox Addons
- Powered By
- Don't Print
- Happy Valentines Day!
- Use meld as git diff gui viewer
- Site now running on django 1.0
- Faster webpages fewer Images with CSS Sprites
- Javascript: Convert Strings to Binary (and represe...
- Decorator for Memcache Get/Set in python
- Define Freedom - Blogging and Media
-
▼
February
(10)

