Web
安装Sphinx-for-chinese
1 下载Sphinx-for-chinese
http://code.google.com/p/sphinx-for-chinese/downloads/list
sphinx-for-chinese-2.0.2-beta-r3019.tar.gz 源代码
xdict_1.1.tar.gz 词库
2 编译安装Sphinx-for-chinese
› Continue reading
全文索引Sphinx和sphinx的中文分词
网站需要做全文索引,所以研究了一下sphinx
1 Sphinx是什么
Sphinx是由俄罗斯人Andrew Aksyonoff开发的一个全文检索引擎。意图为其他应用提供高速、低空间占用、高结果 相关度的全文搜索功能。Sphinx可以非常容易的与SQL数据库和脚本语言集成。当前系统内置MySQL和PostgreSQL 数据库数据源的支持,也支持从标准输入读取特定格式 的XML数据。通过修改源代码,用户可以自行增加新的数据源(例如:其他类型的DBMS 的原生支持) › Continue reading
MacOs修改MySQL的默认编码设置
my.ini文件位置
$ cd /opt/local/etc/mysql5/ $ sudo cp /opt/local/share/mysql5/mysql/my-small.cnf my.cnf $ sudo vi my.cnf [mysqld] ... collation_server = utf8_general_ci character_set_server = utf8
搞定,MadOs各种版本的mysql的下载地址是
http://dev.mysql.com/downloads/mysql/
使用Django REST framework
最近在用django做个服务端应用,需要给外部设备开放rest服务,于是开始使用Django REST framework
Django REST framework的官方地址
http://django-rest-framework.org/
1安装
$ sudo easy_install djangorestframework
todo
在PHP中使用memcached
由于网站流量逐渐增大,而且有个新需求是需要实时更新文章的点击和回复。所以准备上memcached来做一个解决的办法。
在php中使用memcached
1 安装memcached
直接
njava:~ njava$ sudo apt-get install memcached
本地开发使用的是刚升级了的mac10.6.4,使用port安装
njava-MacPro:~ njava$ sudo port install memcached
当然也可以自己编译代码了,为了省事就这样用了
› Continue reading
初学python的Web框架Django-模板
修改django的url规则和模板的基本操作
We’ll just have to take a few steps to make the conversion. We will:
1. Convert the URLconf.
2. Rename a few templates.
3. Delete some of the old, unneeded views.
4. Fix up URL handling for the new views.
初学python的Web框架Django之二-后台管理
一 激活管理界面 Activate the admin site
1 Add “django.contrib.admin” to your INSTALLED_APPS setting.
2 Run python manage.py syncdb. Since you have added a new application to INSTALLED_APPS, the database tables need to be updated.
3 Edit your mysite/urls.py file and uncomment the lines that reference the admin – there are three lines in total to uncomment. This file is a URLconf; we’ll dig into URLconfs in the next tutorial. For now, all you need to know is that it maps URL roots to applications. In the end, you should have a urls.py file that looks like this:
› Continue reading
初学python的Web框架Django
1下载
bear@njava:~$wget http://www.djangoproject.com/download/1.2/tarball/ bear@njava:~$tar -xzvf Django-1.2.tar.gz bear@njava:~$cd Django-1.2/ bear@njava:~$sudo python setup.py install
2 新建django项目
bear@njava:~$ django-admin.py startproject njava bear@njava:~$cd njava bear@njava:~$ls total 20K drwxr-xr-x 2 bear bear 4.0K 2010-05-19 23:27 . drwxr-xr-x 4 bear bear 4.0K 2010-05-19 23:27 .. -rw-r--r-- 1 bear bear 0 2010-05-19 23:27 __init__.py -rw-r--r-- 1 bear bear 546 2010-05-19 23:27 manage.py -rw-r--r-- 1 bear bear 3.3K 2010-05-19 23:27 settings.py -rw-r--r-- 1 bear bear 534 2010-05-19 23:27 urls.py bear@njava:~$python manage.py runserver 0.0.0.0:8000