Tag Archives: SQLite

SQLite – Reduce db file size after removed the records

After i have removed some log entries in a SQLite DB, I found that the database file size stay the same. This is because SQLite will keep the used space and reuse them later.

We can use the VACUUM command to release the empty space.

sqlite3 <your_sqlite_db_file> "VACUUM;"

 

Done =)

Reference:

Advertisement

Django – Schedule django-admin command using django-chronograph

Previously we talked about setting up some custom command in a Django project.

 

I would like to run the custom command in a regular interval. I could use Linux cronjob but it’s hard to manage and check the run history. It would be great if i could setup and manage these scheduled commands on the Django web portal.

django-chronograph, written by wnielson, is a Python Package which allows us to schedule any django-admin command through the web interface. It works well with the UTC timezone but if you have set the TIME_ZONE in your Django project setting.py, there would be time discrepancy.

For more detail about the bug, you can refer to the Issue #36 – Job doesn’t follow the Django’s TIME_ZONE setting.
Continue reading Django – Schedule django-admin command using django-chronograph

Install Graphite under pyenv virtualenv on Ubuntu

It took me one and an half day to get the Graphite working…

1. Make sure you have pyenv and pyenv-virtualenv installed.

 

2. Install the following packages.

sudo apt-get install python-dev pkg-config libcairo2-dev memcached

 

3. Install Python 2.7 with enable-shared.

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 2.7.8

Continue reading Install Graphite under pyenv virtualenv on Ubuntu

Django – Setup Django REST framework

We have the Django welcome page working already.

 

I would like to create some REST services on that setup. We could make use of the Django REST framework.

Let’s keep working on our <project_root>/django_poc project to manage articles by REST. The example in this post are based on the Django REST framework quickstart tutorial. It’s good to go through all of them which could give you a more thorough idea on how the REST framework works.

1. Install the Django REST framework in your virtualenv.

pip install djangorestframework

Continue reading Django – Setup Django REST framework

Rails – Installation on Ubuntu Lucid

Last time we complete the Ruby 1.9.2 installation on Ubuntu Lucid.
Ruby – Installation on Ubuntu Lucid

Similar to the above post, run the following commands in your own account but not root account. Let’s proceed to the Rails 3.0 installation now.

1. Install Rails 3.0

  • gem install i18n tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler
  • gem install rails

Continue reading Rails – Installation on Ubuntu Lucid

MAMP – Introduction

MAMP is Apache, MySQL and PHP runs on Mac. For Mac users, it is very convenient to use the MAMP package such that they don’t need to install the those application one by one. Moreover, MAMP package also bundled with some other useful programs as well as libraries such as phpMyAdmin and the PHP GD library. For more information, you can refer to the MAMP website.

During the installation, you can include the MAMP control panel into you Mac Dashboard. This is quite helpful for you to start and stop the server. you can also pick either PHP4 or PHP5 by switching to the back panel by clicking the i button which is located under the Apache label on the front panel.

Continue reading MAMP – Introduction

iPhone – Start Developing Your First iPhone Application

Recently, I start learning the iPhone Application Development. If you want to be a iPhone Application Developer, you have to fulfill the following requirements.

  • A Mac computer
  • Register as iPhone Application Developer at developer.apple.com
  • Download the Xcode which is your development IDE

 
Continue reading iPhone – Start Developing Your First iPhone Application