Month: September 2014

  • Showing choicefield in template Django

    For example, we have choicefield in models : 12345678class Employee(CommonInfo):     PROFILE_CHOICES = (        (1, _("Hello")),        (2, _("World")),     )     name = models.CharField(max_length=255, unique=True)     profile = models.IntegerField(choices=PROFILE_CHOICES , default=1) To showed value of profile in template, we can use 1object.get_{name-of-choicefield}_display So, example for […]

  • Always clear *.pyc in your Django system in Server

    Make sure to remove pyc before deployment in Django by : 1find . -name "*.pyc" -exec rm -rf {} \;

  • Install Maverick ISO OS X with USB Bootable

    1diskutil list 1sudo hdiutil convert -format UDRW -o ~/Desktop/Maverick.dmg ~/Desktop/Mavericks.iso 1234hdiutil convert -format UDRW -o ~/[path]/destinationISO.img ~/[path]/sourceISO.iso sudo diskutil umount /dev/disk3s2 sudo dd if=/[path]/destinationISO.img.dmg of=/dev/disk3 bs=1m sudo diskutil eject /dev/disk3

  • Django reset migration and avoid default value in makemigration

    It’s common when we need to add new key and migration said we need to defined default values for the field (eg: using datetime). Well, there another trick we can use. 1. Remove all tables in apps Yes, we create migration to remove all tables in apps. To do this, first go to APPS in […]

  • Solve Django makemigrations existing from initial

    When we already have migrations for our models and want to reset it in Django 1.7, it might be a bit tricky. All you need is to disable all apps in INSTALLED_APPS except your app which want to be reseted Example, app which will reseted call “credits”. In INSTALLED_APPS : 123456789101112131415# Application definition INSTALLED_APPS = […]

  • Django no module name

    When we got this errors : 123ImportError at /accounttraders No module named accounttrader Request Method: GET Just check urls.py and make sure to have correct apps name there. For intance, my app name is “accounttraders” but i wrote “accounttrader” in urls : 1234from django.conf.urls import patterns, url urlpatterns = patterns(”,     url(r’^$’, ‘accounttrader.views.index’, name="account"), […]

  • Install Recovery Heimdall clockwok into Samsung S3 G9300 in Ubuntu

    1. Download and install heimdall https://github.com/Benjamin-Dobell/Heimdall/downloads (Heimdall and Suite) 2. Install android adb 123sudo add-apt-repository ppa:phablet-team/tools && sudo apt-get update sudo apt-get install android-tools-adb android-tools-fastboot sudo dpkg –add-architecture i386 3. Download recovery 1wget -c http://download2.clockworkmod.com/recoveries/recovery-clockwork-6.0.4.6-i9300.img 4. Start Download Mode Plug Samsung S3 into your laptop and execute console 12adb reboot download sudo heimdall flash –recovery […]

  • Django Realtime with Redis and NodeJS

    I’ve found good articles for this : http://ipasic.com/article/django-redis-nodejs-real-time-applications/

  • Solve Windows 8 Disk 100%

    After using Windows 8 for nearly 9 months, i realized Disk 100% usage for very long time was unusual. Here is solution to solve this issue. 1. Press Windows + R and type “services.msc” 2. Disable BITS Right click on BITS and select “Properties”: Disable it by : Reboot and you can see that disk […]

  • Setup Ubuntu For Django Development

    Here is tutorial to setup Ubuntu for Django development. Fyi, i use Lubuntu instead of Ubuntu since it’s very lightweight and fast! I really recommend it for you if nice UI is not your problems. 1. Install dependecies 12sudo apt-get install vim git python2.7 python-dev python-software-properties python-pip sudo apt-get install libpq-dev python-dev postgresql postgresql-contrib libxml2 […]

  • Good Wording For Meeting

    I found this gem in linkedin https://www.linkedin.com/today/post/article/20140903114939-6526187-beware-these-tricks-for-making-you-look-bad-in-meetings Regional Vice President – Field Supervision at Royal Alliance Associates INC Let me try to add a little positivity to some of these examples. I personally know people who feel the way the author describes in the article but I honestly have to say that I would consider […]