Python performance tips
I came across this python performance tips article this afternoon and found it very interesting. Will definitely start using those tips in my next project.
I came across this python performance tips article this afternoon and found it very interesting. Will definitely start using those tips in my next project.
Just a quick python snippet I written today to reduce the image size during upload class PhotoField(forms.FileField, object): def __init__(self, *args, **kwargs): super(PhotoField, self).__init__(*args, **kwargs) self.help_text = “Images over 500kb will be resized to keep under 500kb limit, which may result in some loss of quality” def validate(self,image): if not str(image).split(‘.’)[-1].lower() in [“jpg”,”jpeg”,”png”,”gif”]: raise ValidationError(“File… Read More »
I was told to create some kind of logging mechanism to insert logs into database, and make sure it’s generic. So after some thought I decided to mimic the builtin RotatingFileHandler and write a DBHandler. The RotatingFileHandler allows you to specify which file to write to and rotate files, therefore my DBHandler should also allow… Read More »
Science is awesome, just imaging it, it’s landing on another freaking planet miles and miles away. Start watching the video after the jump
This is one of the few articles that I actually finish reading. http://www.vanityfair.com/business/2012/08/microsoft-lost-mojo-steve-ballmer
I liked the background music from the uncle drew video, and couldn’t find anymore information about it, so I created a ringtone version myself, hope you like it Download MP3 Version Here Download iPhone Version Here If you like it, leave a comment or click on the FB like button.
“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.” — Donald Knuth
Given light can travel forever in a vacuum, and given we use the light spectrum to determine the distance of other galaxies, however there are still particles in the outer space, and they might distort and absorb the photons, or even blocked by other planets, so some of the lights from further galaxy might not… Read More »