Month: May 2013

  • Solve Django Grappelli Delete or Action dropdown menu doesn’t works

    Apparently, Django-grappelli action menu drop-down doesn’t works with default Django 1.4. I tried select item and go to drop-down menu to delete that, but nothing happened. This is errors from Firebug: 12 $("tr input.action-select").actions(); TypeError: $(…).actions is not a function And the problem apparently located in STATIC_FILEFINDER which FILESYSTEM finder above AppDirectoriesFinder. This is the solution: […]

  • Nokia Lumia 920 or Windows Phone black screen and dead

    If your windows phone or Nokia Lumia suddenly blank screen or DEAD, don’t throw away! press Volume Down + Power for 10 seconds. It will revived! Trust me, Nokia phone isn’t easy to die 🙂

  • Run standalone python scripts in Django 1.5

    Since setup_environ is deprecated in Django 1.5, we can use os.environ to load environment and run standalone python script. At this example: 1234567myproject     |     |     —- myapp            |            |             ——– standalone_scripts_is_here.py And here […]

  • Lock 3G 4G network in Nokia Lumia Windows Phone

    I use Nokia Lumia 920 at this example. To lock Nokia lumia network on 3G / 4G only, we can do quick setup by: 1. Go to dial-pad Type : ##3282 and call For older version, please type : ##3282#. Click settings on right-bottom From this settings, we can set network running on 2G only, […]

  • Browsing with minibrowser and proxy settings using PyQt4

    When it comes need to have browser that we will using with specific task and run behind proxy, we can rely on PyQT4. Here is the the code that taken from : http://code.activestate.com/recipes/576921-using-proxy-connection-for-qwebview/ 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273## {{{ http://code.activestate.com/recipes/576921/ (r4) import os import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * from PyQt4.QtNetwork […]

  • Install Spynner on Virtualenv

    Installing Spynner which using Qt4 and autopy module as it 3rd party is can’t run smooth under virtualenvironment. Thigs to do here : 1. Install Qt4 and make it works with Virtualenv Follow this links Install pyqt4 on virtualenvironment 2. Install autopy under Virtualenv We may facing several errors while installing autopy under Virtualenv. Xtest.h […]

  • Add PyQt4 on virtualenv Python

    If we want to make PyQt4 accessible from virtualenv, we can put this scripts into “~/.virtualenvs/postmkvirtualenv”: 123456789101112131415#!/bin/bash # This hook is run after a new virtualenv is activated. LIBS=( PyQt4 sip.so ) PYTHON_VERSION=python$(python -c "import sys; print (str(sys.version_info[0])+’.’+str(sys.version_info[1]))") VAR=( $(which -a $PYTHON_VERSION) ) GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())" LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD") LIB_SYSTEM_PATH=$(${VAR[-1]} -c "$GET_PYTHON_LIB_CMD") […]

  • Install Python 2.7 Debian 6.0. Squeeze

    Here are guide to install Python 2.7 into Debian 6.0 Squeeze 1. Add new repo into “/etc/apt/sources.list” 1deb http://ftp.uk.debian.org/debian/ testing main contrib non-free 2. Update and Upgrade 1apt-get update && apt-get upgrade -y 3. Install python 2.7 and set as default 123apt-get install libc6-dev apt-get install python2.7 update-alternatives –install /usr/bin/python python /usr/bin/python2.7 10

  • Django log format app name and function and saved into file

    This is quick configuration for Django logger to log with application name followed with function, and store them into log files. 1. Edit logger settings settings.py 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import os CURRENT = os.path.dirname( __file__ ) LOGGING = {     ‘version’: 1,     ‘disable_existing_loggers’: False,     ‘filters’: {         ‘require_debug_false’: {   […]

  • Get object in Django Admin Form

    Easy way to access object in Django admin form template is using {{ original }}

  • Create custom view and page on Django admin

    We can customize Django Admin with custom views and pages. Here are the steps to do: 1. Configure Admin URL Edit urls.py and append new admin views before “admin.site.urls” : 123    …     url(r’^admin/item/$’, ‘products.views.admin_products’),     url(r’^admin/’, include(admin.site.urls)), 2. Create Django admin custom views Create new admin function view: 123456789101112131415161718@login_required def admin_products(request): […]

  • Setup git server with Amazon EC2

    We can setup git server on amazon ec2 intances using gitolite. Here is step to do: 1. Configure SSH config Create new file “~/.ssh/config” which contains your amazon EC2 hostname, user and PEM key location. 1234Host amazon Hostname 23.21.1xx.xxx User root IdentityFile /home/yodi/my-ec2-micro.pem With this configuration, we can login into EC2 instance with : “ssh […]

  • Make auto populated slug field in Django admin

    Django admin have great feature called “prepopulated”. Here is an example to create auto populated slug in Django admin without using any additional Jquery scripts. 1234567891011from django.contrib import admin from photos.forms import PhotoAdminForm from photos.models import Photo class PhotoAdmin(admin.ModelAdmin):     list_display = (‘title’, ‘admin_image’)     prepopulated_fields = {‘slug’:(‘title’,)}     form = PhotoAdminForm […]