Resize your images on mac, command line
There is a built in command line tool called ‘sips’ Simply open up terminal and cd to the images directory and execute: sips -Z 670 *.JPG
There is a built in command line tool called ‘sips’ Simply open up terminal and cd to the images directory and execute: sips -Z 670 *.JPG
Currently django-cms-search doesn’t support haystack 2.0 yet, so here is my modified version to work on haystack 2.0 based on import datetime from haystack import indexes from cms.models.managers import PageManager from cms.models.pagemodel import Page from cms.models.pluginmodel import CMSPlugin class PageIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=False) pub_date = indexes.DateTimeField(model_attr=’publication_date’, null=True) login_required = indexes.BooleanField(model_attr=’login_required’) url = indexes.CharField(model_attr=’get_absolute_url’)… Read More »
This week we just been to Christchurch and took the TranzAlpine train ride. We are based in Auckland and would like to share our experience of the trip, hopefully this guide will make you better prepared if you are keen to do the same trip. How to get to Christchurch? Since we live in Auckland,… Read More »
I tried searching on the web and found no obvious code samples of how reuse the mongodb.connection object. This is what I have currently and hopefully the following snippet would help you out as well. If you do not think this is the right way, please leave a comment. var app = express(); var mongodb… Read More »
Don’t we all get confused by unicode encoding sometimes? Especially you wouldn’t expect this kind of error to happen in django admin. The problem is actually not in the admin section, the culprit is __unicode__ method in your model. when you have a unicode function like this: def __unicode__(self): return “{0}”.format(self.field_one) It is actually returning… Read More »
I have a custom user model as below: class User(AbstractUser): subscribe_newsletters = models.BooleanField(default=True) old_id = models.IntegerField(null=True, blank=True) old_source = models.CharField(max_length=25, null=True, blank=True) And using the builtin UserAdmin admin.site.register(User, UserAdmin) While editing the user record works fine, but when I add a user, I get the following error Exception Value: relation “auth_user” does not exist LINE… Read More »
Getting used to vim is like touch typing. At first you thought it’s impossible to remember all the keys, but if you force yourself keep using it, it just becomes your second nature. And I am glad that I did.
There is a requirement from one of my project to insert video ads before the actual video gets played. There are ways to do it, one is to use JWPlayer and OVA plugin, or the other way is to write your own javascript to control the playback. In the following demo, shows how you can… Read More »
I have quite a few goals (ok, things) I want to achieve before I die, couple of those are writing an iOS app and writing a game. I have had an attempt to write a 1945 style vertical scroll shooting game in python using pygames, and I cannot remember why I stopped and the source… Read More »