Monthly Archive for August, 2010

Page 2 of 3

音乐需要social吗

音乐是用来听得,没错,从黑胶唱片到数码光碟,从电台DJ到Youtube,时代在发展,音乐得传播也在改变,唯一不变得是聆听。用Walkman得时候在聆听,交换音乐的方式是朋友和同学之间交换卡带和音乐,面对面得方式让我们可以更直接,更生动的对喜爱得音乐进行交流。用Ipod得时代我们依然在聆听,但是我们用网路交换,再也没有面对面的热情和欣喜。所以,我们加入社区得元素吧,让更多的人来填补感情空缺。于是last.fm来了。然后呢,电台VJ得位置被Youtube取代。聆听少了,social多了。

Share

极速 Twisted Web 60秒(5): 错误句柄

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.internet import reactor
from twisted.web.error import NoResource

from calendar import calendar

class YearPage(Resource):
    def __init__(self, year):
        Resource.__init__(self)
        self.year = year

    def render_GET(self, request):
        return "<html><body><pre>%s</pre></body></html>" % (calendar(self.year),)

class Calendar(Resource):
    def getChild(self, name, request):
        try:
            year = int(name)
        except ValueError:
            return NoResource()
        else:
            return YearPage(year)

root = Calendar()
factory = Site(root)
reactor.listenTCP(8880, factory)
reactor.run()
Share

ubuntu下MySQL服务器更改目录后问题

1
2
3
4
5
6
100811 18:42:06  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

修改下面文件中得权限列表可解决问题。

1
/etc/apparmor.d/usr.sbin.mysqld
1
2
/web/data/mysql/ r,
/web/data/mysql/** rwk,
Share

通过与Java的比较,迅速掌握Groovy

Groovy和Java的相同点有:
0+, 3+, 4+, 6+, 8+, 10+, 12+, 13, 14, 15, 18+, 19+, 20+, 21, 22, 23, 28+, 29+, 30+, 31+, 32+
+表示Groovy不但涵盖了Java的语法,而且还有增强部分

Groovy和Java的不 同 点有:
1, 2, 5, 7, 9, 11, 16, 17, 24, 25, 26, 27,33 Continue reading ‘通过与Java的比较,迅速掌握Groovy’

Share

Groovy轻松入门—搭建Groovy开发环境

Groovy既然是Java帝国的王储,当然少不了Java的支持。

先安装JDK(推荐版本为1.5及1.5以上,当然1.4也可以)

然后设置Java的环境变量:

  1. 设置环境变量java_home(设置环境变量XXX_home的一个好处是只要修改XXX_home的值,与之相关的%XXX_home%\bin等的值都相应改变,这样就能做到‘一处修改,处处修改’)右击‘我的电脑’-> ‘属性’ ->‘高级’-> ‘环境变量’-> 点击‘新建’(用户变量与系统变量均可,挑一便是)-> 输入‘变量名’为java_home -> 输入‘变量值’为JDK的所在目录(默认安装位置为C:\Program Files\Java\jdk1.6.0,我装的是JDK6.0)-> 点击‘确定’-> 环境变量java_home设置成功
  2. 设置环境变量path环境变量java_home设置好之后,我们开始设置环境变量path前面的步骤与‘设置环境变量java_home’相同,到点击‘新建’按钮时,选择新建用户变量(因为系统变量path已经存在,如果追加在长串已存在的path值后面,比较凌乱) -> 输入‘变量名’为path -> 输入‘变量值’为“%java_home%\bin;” 不包括双引号“”
  3. 设置环境变量classpath环境变量path设置好之后,我们开始设置环境变量classpath前面的步骤与‘设置环境变量java_home’相同,到点击‘新建’按钮时,选择新建系统变量(我的个人习惯,你也可以选择新建用户变量)-> 输入‘变量名’为classpath -> 输入‘变量值’为“.;%java_home%\lib;”不包括双引号“”,注意不要漏了最前面的小圆点.如果你已经安装了JDK,并设置好了Java环境变量,请跳过上述过程,直接安装GDK(只需3步)(如果您下载的是Groovy安装版Download Windows-Installer: Binary Release http://groovy.codehaus.org/Download,请将安装过程中出现的选项都打上勾,以下4,5,6步骤可以跳过)
  4. 下载GDK (http://dist.codehaus.org/groovy/distributions/groovy-1.0.zip)并将下载的groovy-1.0.zip文件解压到指定位置(我的位置是D:\D\MY_DEV\groovy),
  5. 设置环境变量GROOVY_HOME步骤与“设置环境变量java_home”类似,到 输入‘变量名’时,输入‘GROOVY_HOME’-> 输入‘变量值’为你解压指定位置(我的变量值为D:\D\MY_DEV\groovy),需要注意一点,解压目录如D:\D\MY_DEV\groovy中不可有空格,比如D:\D\MY    DEV\groovy
  6. GROOVY_HOME目录下的bin追加到环境变量path中步骤与“设置环境变量path”类似,找到你设置的path,然后将“%GROOVY_HOME%\bin”追加到path值(按上述过程,你现在的path为“%java_home%\bin;”) 之后,你的path值为“%java_home%\bin;%GROOVY_HOME%\bin” ,注意用英文分号;分开,不要有空白字符如空格,Tab等

Continue reading ‘Groovy轻松入门—搭建Groovy开发环境’

Share

Java帝国的王储—Groovy !

让我们来回顾一下主流语言的发展历程:机器语言(由01组成)  汇编语言 → … → C语言 → C++ → Java → ?

不知道大家有没有发现在语言发展过程中,存在这么一个规律:能成为未来主流语言的,必与当前主流语言属同一‘语系’,换句话说,由王子继承王位。

在C语言之前,似乎还处于‘春秋战国’,各种编程语言混战,于20世纪70年代,C语言成为‘秦始皇’,各种软件甚至操作系统也改用C语言编写。但可惜C语言是面向过程的,程序代码一多,逻辑流程就容易混乱,再加上全局变量和可运算指针的添乱,使程序员调试程序万般辛苦。 Continue reading ‘Java帝国的王储—Groovy !’

Share

How to Repair a Crashed MySQL Table

Today, I had a server crash when the /var partition filled up while reindexing. I attempted to clear out extra log files and such but df was still showing greater than 100% utilization. Checking /var/db/mysql showed I had one table that was taking up too much space. du -d 1 -h is a very useful command when tracking down the largest folder usage on partition.

Jul 21 07:39:06 plab2catsg01 kernel: pid 36500 (mysqld), uid 88 inumber 329992 o
n /var: filesystem full
Jul 21 07:39:22 plab2catsg01 kernel: pid 36500 (mysqld), uid 88 inumber 353413 o
n /var: filesystem full
Jul 21 07:39:23 plab2catsg01 kernel: pid 36500 (mysqld), uid 88 inumber 353288 o
n /var: filesystem full

I attempted to stop MySQL by executing /usr/local/etc/rc.d/mysql-server stop and unfortunately, it kept looping while trying to stop the process. I was eventually forced to reboot the server.

On reboot, I thought all was well but then I found the Eventum application I use wasn't showing support emails. I checked the MySQL log files:

plab2catsg01# tail -f plab2catsg01.ten-net.net.err
...
090721  9:15:54 [ERROR] /usr/local/libexec/mysqld: Table './eventum/eventum_mail
_queue' is marked as crashed and last (automatic?) repair failed
090721  9:15:54 [ERROR] /usr/local/libexec/mysqld: Table './eventum/eventum_mail
_queue' is marked as crashed and last (automatic?) repair failed
090721  9:15:55 [ERROR] /usr/local/libexec/mysqld: Table './eventum/eventum_mail
_queue' is marked as crashed and last (automatic?) repair failed
090721  9:15:55 [ERROR] /usr/local/libexec/mysqld: Table './eventum/eventum_mail
_queue' is marked as crashed and last (automatic?) repair failed
...

Continue reading 'How to Repair a Crashed MySQL Table'

Share

Use MySQL Regexp Sample

1
DELETE FROM `google_data` WHERE site_id=4 AND url REGEXP '\.php\\?matchid=[0-9]+$'
Share

森林“板房”

Continue reading ‘森林“板房”’

Share

苹果

以前总觉得苹果的 macbook pro 非常好,觉得matetext是那么Cool。以致于自己都想买一台,可是当自己做为Linux的9年用户得时候,觉得macbook并不是那么神通广大。然而Iphone,也不是那么炫。不是还有Android吗?放弃封闭的,投奔开放吧。

Share