3008/2010
simple svn merging lornajane
// Merging svn is really painful. This is useful resource while couple of others tht I tried on web are reverting the trunk changes after the branch is merged.
at 1:01 p.m.

2608/2010
howfuckedismydatabasecom
// I couldn't stop laughing for about an hour. damn funny and good one to share.
at noon

0908/2010
40 useful javascript libraries strong life
// Awesome js libraries at one place
at 12:36 p.m.

2707/2010
Priya checked in at Phoenix Worldgate 9 at 4:55 p.m.

2007/2010
show all available php variables getdefinedvars robshousenet
// good tip helpful for debugging in templates. worth saving.
at 11:31 a.m.

1107/2010
Priya checked in at near Amberwinds Ct & Summerwinds Dr at 9:37 a.m.

1007/2010
Priya checked in at near Donald Preston Dr & Robert Rhett Way at 1:48 p.m.

0107/2010
Just back from wapo labs HTML 5 talk. Few more sessions to come. Today enjoyed the history of HTML.
from web
at 10:09 a.m.
2706/2010
On the way to pittsburgh. It's fun to travel with my cute little cousin.
from Twitter for iPhone
at 4:02 a.m.
1506/2010
Priya checked in at District of Columbia at 2:10 p.m.

0806/2010
Priya checked in at Uncle Julio's Rio Grande Cafe at 5:33 p.m.

thanks to @amazon. I'm alive now...was really frustrated as none of the stores has 85w mac power adapter...including apple store...
from web
at 11:36 a.m.
2805/2010
Priya checked in at San Francisco International Airport at 6:46 a.m.

2305/2010
@8en Just found a flaw in your setup. Hire me as a security consultant. Although its fixed now.
from web
at 11:01 a.m.
1905/2010
PIL Image Handling
at 8:39 p.m. Be the first to comment.
Just playing around with Tornado Web Server and trying to make a twitter clone with realtime updates. I wanna share the ImageHandling snippet which requires Python Imaging Library module to resize images. BTW for PIL installation there are many valuable resources available on the web.
I will get the image from the form and the imghdr module is used to sniff the content type of the file. In this case, jpeg and png are the accepted file types. Here comes the interesting part, Instead of writing the image to the disk I am using StringIO module which reads the image from the memory. By this we are simulating a file object as expected by Image.open.
I want the image to be in three different sizes.
1. avatar_square the largest square of the uploaded image.
2. thumbnail size (48*48).
3. mininail size (24*24) to show the followers on the side as twitter.
class ImageHandler(BaseHandler): @tornado.web.authenticated def get(self): return self.render("image.html") @tornado.web.authenticated def post(self): user_id=self.current_user username = self.db.get("SELECT username from user WHERE id=%s", user_id) uploaded_image=self.request.files if imghdr.what('ignore', uploaded_image['avatar'][0]['body']) in ['jpeg','png']: avatar = Image.open(StringIO.StringIO(uploaded_image['avatar'][0]['body'])) width, height = avatar.size if width > height: delta = width - height left = int(delta/2) upper = 0 right = height + left lower = height else: delta = height - width left = int(delta)/2 upper = 0 right = width lower = width + upper avatar_square = avatar.crop((left, upper, right, lower)) avatar_mini = copy.copy(avatar_square) avatar_square.thumbnail((48,48)) avatar_mini.thumbnail((24,24)) return self.write("Successfully uploaded the image") else: return self.write("file format is not accepted")
gist is here
0705/2010
Learning cost of mysql replication on Amazon spot instances is 6cents.
from Tweetie
at 8:06 p.m.
0505/2010
40 really useful javascript tutorials
// JavaScript libraries helping to help make design and development easier now. This is a good reference to see the magic of js.
at 2:36 p.m.

0305/2010
regex bare minimum
// The best blog post for regex.
at 11:09 p.m.
