Author Archives: James Lin

Firefox 7, fixed memory leak.

Everyone knows firefox has a notorious memory leak issue, and it drove me crazy as a web developer. Yes, I know Chrome exists, but it doesn’t have vimperator plugin! So, Mozilla has released firefox version 7. This particular release claims it drastically improved memory handling for certain use cases. Good news, and I went for… Read More »

Python Webcam Capture Code Snippet

Here is a small piece of code how to query your webcam and save the frame as an image. import sys import Image, ImageDraw, datetime import opencv #this is important for capturing/displaying images from opencv import highgui camera = highgui.cvCreateCameraCapture(0) def get_image(): for i in range(10): im = highgui.cvQueryFrame(camera) # Add the line below if… Read More »

Python decorator – caching your django functions

Prerequisites: – Python Memcahed Library – Memcached server Settings.py CACHES = { ‘default’ : { ‘BACKEND’: ‘django.core.cache.backends.memcached.MemcachedCache’, ‘LOCATION’: [‘127.0.0.1:11211’], ‘KEY_PREFIX’: ‘YOUR_PREFIX’, } } Caching Code from django.core.cache import cache #get the cache key for storage def cache_get_key(*args, **kwargs): import hashlib serialise = [] for arg in args: serialise.append(str(arg)) for key,arg in kwargs.items(): serialise.append(str(key)) serialise.append(str(arg)) key… Read More »

Css starter pack

Thanks for Keran McKenzie’s courtesy for sharing his latest useful find. http://twitter.github.com/bootstrap/ Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.

Category: CSS

My Vim Key Maps

Finally I have decided to move over to vim, if you would like to do the same, please spend 10 minutes of your life to read about this blog and this blog After reading those 2 blogs, by now you should have a basic understanding of Vim and have NERDTree installed. This is my key… Read More »