2008-11-28 14:09:46
最近饱受北京(010)的广告电话骚扰,所有的号码如下,持续添加中。。。
010 59151515;010 59151616;010-86763606;010-81625825
MYSQL 5.1 event_scheduler
[ 2008-11-28 13:49:45 | 作者: LALFASHI ]
my.ini or my.cnf 中的
[mysqld]
添加 event_scheduler=ON
创建事件(CREATE EVENT)
先来看一下它的语法:
1) 首先来看一个简单的例子来演示每秒插入一条记录到数据表
[code][/code]...
阅读全文...
[mysqld]
添加 event_scheduler=ON
创建事件(CREATE EVENT)
先来看一下它的语法:
CREATE EVENT [IF NOT EXISTS] event_name
ON SCHEDULE schedule
[ON COMPLETION [NOT] PRESERVE]
[ENABLE | DISABLE]
[COMMENT 'comment']
DO sql_statement;
schedule:
AT TIMESTAMP [+ INTERVAL INTERVAL]
| EVERY INTERVAL [STARTS TIMESTAMP] [ENDS TIMESTAMP]
INTERVAL:
quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |
WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |
DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}
ON SCHEDULE schedule
[ON COMPLETION [NOT] PRESERVE]
[ENABLE | DISABLE]
[COMMENT 'comment']
DO sql_statement;
schedule:
AT TIMESTAMP [+ INTERVAL INTERVAL]
| EVERY INTERVAL [STARTS TIMESTAMP] [ENDS TIMESTAMP]
INTERVAL:
quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |
WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |
DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}
1) 首先来看一个简单的例子来演示每秒插入一条记录到数据表
[code][/code]...
阅读全文...
Export CSV directly from MySQL
[ 2008-11-28 11:20:05 | 作者: LALFASHI ]
How ofter were you asked by a client for a CSV (or excel) file with data from their app? I get asked that question quite often, so I wanted make the process as easy as possible. And guess what? You can create CSV files directly from MySQL with just one query!
Let’s say you want to export the id, name and email fields from your users table to a CSV file. Here is your code:
Well, if you know MySQL, you’ll know how to customize ...
阅读全文...
Let’s say you want to export the id, name and email fields from your users table to a CSV file. Here is your code:
SELECT id, name, email INTO OUTFILE '/tmp/result.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM users WHERE 1
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM users WHERE 1
Well, if you know MySQL, you’ll know how to customize ...
阅读全文...
MYSQL 5.1.29 查询 datatime < '2008-11-00' 导致崩溃
[ 2008-11-25 10:09:55 | 作者: LALFASHI ]
为了使用mySQL的表分区功能,系统升级数据库到 5.1.29 启用表分区;
可是有一条查询语句,总是导致数据库崩溃。
详见:http://bugs.mysql.com/bug.php?id=40972
081124 18:23:41 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.
----
information that should help you find ...
阅读全文...
可是有一条查询语句,总是导致数据库崩溃。
详见:http://bugs.mysql.com/bug.php?id=40972
081124 18:23:41 - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.
----
information that should help you find ...
阅读全文...
windows 下 memcached 配置和java client测试
[ 2008-11-18 20:14:29 | 作者: LALFASHI ]
明天继续
windows 下 Nginx + tomcat 负载均衡配置
[ 2008-11-18 20:05:08 | 作者: LALFASHI ]
Nginx 已经是目前公认的效率很高的代理服务,同时可以用来做负载均衡。
由于项目目前只有一台centOS的服务器,无法用来测试,所以打算找下Nginx windows下版本;
http://www.kevinworthington.com/nginx/win32/
以上为win32的版本
用户访问 sp.imichat.com 均衡到 10.10.10.181:8080; 10.10.10.181:8081; 10.10.10.181:8082; 这3台服务器
配置Nginx的nginx.conf
http {}增加如下内容
server {} 修改异侠信息:
阅读全文...
由于项目目前只有一台centOS的服务器,无法用来测试,所以打算找下Nginx windows下版本;
http://www.kevinworthington.com/nginx/win32/
以上为win32的版本
用户访问 sp.imichat.com 均衡到 10.10.10.181:8080; 10.10.10.181:8081; 10.10.10.181:8082; 这3台服务器
配置Nginx的nginx.conf
http {}增加如下内容
upstream sp.imichat.com {
server 10.10.10.181:8080;
server 10.10.10.181:8081;
server 10.10.10.181:8082;
}
server 10.10.10.181:8080;
server 10.10.10.181:8081;
server 10.10.10.181:8082;
}
server {} 修改异侠信息:
listen 80;
server_name sp.imichat.com;
#charset koi8-r;
#access_log logs/host_access_log main;
...server_name sp.imichat.com;
#charset koi8-r;
#access_log logs/host_access_log main;
阅读全文...
Using MySql 5.0 stored procedures with MySQLdb
[ 2008-09-06 17:24:41 | 作者: LALFASHI ]
When I wanted to try out MySQL 5.0 stored procedures I didn't find too much on the web. This was a few months ago and there may be some better tutorials out there now but I figured I would share some of my tricks.
Why use stored procedures in the first place? While stored procedures give a you a performance boost (I have not benchmarked so I can't say how much) the argument I usually use when making the case for using stored procedures is abstraction. One can make changes to a stored procedure and not have to touch the calling code just as long as you don't break the interface. There ...
阅读全文...
Why use stored procedures in the first place? While stored procedures give a you a performance boost (I have not benchmarked so I can't say how much) the argument I usually use when making the case for using stored procedures is abstraction. One can make changes to a stored procedure and not have to touch the calling code just as long as you don't break the interface. There ...
阅读全文...
Django肆意使用中文
[ 2008-07-31 11:40:06 | 作者: LALFASHI ]
刚开始遇到了些问题,后来发现,用manage.py生成的model.py默认是ascii的,需要做两道加工:
1 在文件首行加入
# -*- coding: utf-8 -*-
2
用UltraEdit的 文件/转换/ASCII 转 UTF8 功能将文件转换为UTF8存盘
这样就可以肆意使用中文了。
1 在文件首行加入
# -*- coding: utf-8 -*-
2
用UltraEdit的 文件/转换/ASCII 转 UTF8 功能将文件转换为UTF8存盘
这样就可以肆意使用中文了。
MySQLdb for Python使用指南/Python的数据库操作
[ 2008-07-24 21:33:43 | 作者: LALFASHI ]
网站就是要和数据库进行交互,否则什么都不用做了...今天我们来看一个叫MySQLdb的库,这个用来和MySQL数据库进行交互.
可以从这里获得这个库
http://sourceforge.net/projects/mysql-python
如果你不确定你的python环境里有没有这个库,那就打开python shell,输入 import MySQLdb,如果返回错误信息,那就表示你的机器上没有,赶紧去下载一个.我的机器是win xp,所以我下载了win环境下的exe那个,直接双击完成安装.
在介绍具体的操作前,先花点时间来说说一个程序怎么和数据库进行交互
1.和数据库建立连接
2.执行sql语句,接收返回值
3.关闭数据库连接
使用MySQLdb也要遵循上面的几步.让我们一步步的进行.
0.引入MySQLdb库
import MySQLdb
1.和数据库建立连接
conn=MySQLdb.connect(host="localhost",user="root",passwd="sa",db="mytable")
提供的connect方法用来和数据库建立连接,接收数个参数,返回连接对象.
比较常用的参数包括
host:数据库主机名.默认是用本地主机.
user:数据库登陆名.默认是当前用户.
passwd:数据库登陆的秘密.默认为空.
...
阅读全文...
可以从这里获得这个库
http://sourceforge.net/projects/mysql-python
如果你不确定你的python环境里有没有这个库,那就打开python shell,输入 import MySQLdb,如果返回错误信息,那就表示你的机器上没有,赶紧去下载一个.我的机器是win xp,所以我下载了win环境下的exe那个,直接双击完成安装.
在介绍具体的操作前,先花点时间来说说一个程序怎么和数据库进行交互
1.和数据库建立连接
2.执行sql语句,接收返回值
3.关闭数据库连接
使用MySQLdb也要遵循上面的几步.让我们一步步的进行.
0.引入MySQLdb库
import MySQLdb
1.和数据库建立连接
conn=MySQLdb.connect(host="localhost",user="root",passwd="sa",db="mytable")
提供的connect方法用来和数据库建立连接,接收数个参数,返回连接对象.
比较常用的参数包括
host:数据库主机名.默认是用本地主机.
user:数据库登陆名.默认是当前用户.
passwd:数据库登陆的秘密.默认为空.
...
阅读全文...







