Category Archives: Website Development

快速批量修改豆瓣电影评分 using Javascript

截止 2016.05.06 依然有效

最近遇到一个问题,想要给早期自己在豆瓣上收藏的看过的电影评分,但问题是一个一个修改的话巨慢,于是写了一个小plugin脚本,只要在firebug的console里运行了就好(Chrome里应该也可以).

前提:登陆自己的豆瓣账户,进入自己的电影列表(需要是列表模式)。

movie_list_before

代码:(下面的code默认用到了 jQuery, 豆瓣支持此库)

Continue reading

fix STATIC_URL is empty in Django

When using static files in my Django application, the STATIC_URL is empty even I set it in the setting.py, after a few research, here is how I fixed it.

My static image files are located at movie/static/img (my application is movie)

1. in views.py

from django.template import RequestContext

if you use render_to_response, make sure you add context_instance=RequestContext(request) in it,

render_to_response('movie/index.html', {'movie_list': movie_list}, context_instance=RequestContext(request));

Continue reading

setup Django 1.4 on Godaddy linux economy host

In case you want to use Django framework in Godaddy’s Linux Economy Host, here is the steps:

1. Godaddy has virtualenv installed, so first, create a virtual environment venv: (I use $HOME/lib/ for all the installed stuff below)

cd ~/
mkdir lib
cd lib
virtualenv --no-site-packages venv

The python package folder is $HOME/lib/venv/lib/python2.7/site-packages

2. Install the latest Django through pip
pip install Django

Continue reading

setup Git on Godaddy linux economy host

There is no version control on Godaddy linux host, which makes the code deployment very painful. So here is how to setup Git on the Godaddy host.

In this tutorial, we set repository on the Godaddy host.

1. download the pre-build git binaries, Godaddy uses CentOS, and the binary is built under CentOS. (Thanks to here)
In your $HOME folder on Godaddy host

% mkdir lib
% cd lib
% mkdir git
% cd git
% wget http://www.lichun.cc/resources/centos5.2-git.tar.gz
% tar -xvzf centos5.2-git.tar.gz

Continue reading

Add multiple attachments in email using PHP

After googling several posts about how to add and send multiple email attachments using PHP, I found it was uneasy to accomplish it by using the methods from top 20 results on google, either they can show the attachments properly nor can be recognized correctly by gmail. Finally the following codes can correctly add multiple attachments in email.

1. If you want to use array, use the following codes in your html file:

<input type='file' name='uploadedFile[]’ />
Continue reading