Home mail me! Syndicate this site using RSS

Archive for July, 2007


Howto change runtime variables without restart MySQL Server

比方说在一些实际生产环境中,想改个MYSQL的配置,但是又不想停止服务重起MYSQL,有什么办法呢?使用SET命令可以做到,请看下面几个例子:

1.设置key_buffer_size的大小为10M。

SET GLOBAL key_buffer_size = 10485760;

SET @@global.key_buffer_size = 10485760;

2.设置最大连接数为200

SET GLOBAL max_connections=200;

SET @@global.max_connections=200;

3.更改慢查询SQL日志时间

SET @@long_query_time=3;

要查看有哪些变量,可执行SHOW VARIABLES;获得。

无谓?无为?无味?无畏?五味!

用智能ABC输入5个wuwei,然后按数字键12345出来的一排字:无谓无为无味无畏五味.

很有意思的一排字,透着那么点伤感,这就是我这几年来的生活!

一切无所谓的态度,无所作为的事业,没有味道的爱情,无所畏惧的心,却又五味俱全的生活!

Xdebug 2.0.0 finally released

xdebug2
Derick Rethans 于2007年7月18日正式发布了Xdebug 2,官方网址:http://xdebug.org/

该工具用于排错确实很不错,支持堆栈跟踪、远程调试、代码分析等等,值得推荐,下面是他的原话:

It is finally here, Xdebug 2.0.0 has arrived! After about four years of work I finally found it ready to release. Have fun! After almost four years of work, Xdebug 2 is finally ready. With improved functionality and many new features it is ready to totally change the way you develop in PHP. Some of the new features and updates include improved stack traces, execution traces to files, code coverage analysis and much improved remote debugging support. Xdebug’s documentation has also been rewritten for more clarity.
As with most open source projects, it’s very hard to know who are actually the users of the project. As I would like to know my users better, I would invite everybody who finds Xdebug useful to send me a postcard with their location. (Address is here at the top of the page). I am looking forwards to find out who you are!

还有款调试器也非常不错,历史比较悠久,就是NuSphere公司(老牌的PHP IDE开发商)开发的DBG,也可以集成到一些IDE开发工具中(例如:NuSphere PhpED、PHP Eclipse等)。

MySQL 5.1新特性之事件调度器(Event Scheduler)

一、前言

自MySQL5.1.6起,增加了一个非常有特色的功能–事件调度器(Event Scheduler),可以用做定时执行某些特定任务(例如:删除记录、对数据进行汇总等等),来取代原先只能由操作系统的计划任务来执行的工作。更值得一提的是MySQL的事件调度器可以精确到每秒钟执行一个任务,而操作系统的计划任务(如:Linux下的CRON或Windows下的任务计划)只能精确到每分钟执行一次。对于一些对数据实时性要求比较高的应用(例如:股票、赔率、比分等)就非常适合。

事件调度器有时也可称为临时触发器(temporal triggers),因为事件调度器是基于特定时间周期触发来执行某些任务,而触发器(Triggers)是基于某个表所产生的事件触发的,区别也就在这里。

在使用这个功能之前必须确保event_scheduler已开启,可执行

SET GLOBAL event_scheduler = 1;

SET GLOBAL event_scheduler = ON;

来开启,也可以直接在启动命令加上“–event_scheduler=1”,例如:

mysqld ... --event_scheduler=1

Read more…

GROUP_CONCAT()妙用

GROUP_CONCAT()是MySQL数据库提供的一个函数,通常跟GROUP BY一起用,具体可参考MySQL官方文挡:http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat

先来看一下这个函数的语法:

GROUP_CONCAT([DISTINCT] expr [,expr ...]
             [ORDER BY {unsigned_integer | col_name | expr}
                 [ASC | DESC] [,col_name ...]]
             [SEPARATOR str_val])

下面就演示一下这个函数所带来的方便之处,首先建立一个学生选课表student_courses,并填充一些测试数据。
Read more…

[转载]想要做好老板先要懂得怎样留住员工

转载自:http://www.tblog.com.cn/index.php/archives/13.html
故事很简单,却值得人深思!

一天,一只兔子在山洞前写文章,
一只狼走了过来,问:“兔子啊,你在干什么?”
答曰:“写文章。”问:“什么题目?”答曰:“《浅谈兔子是怎样吃掉狼的》。”
狼哈哈大笑,表示不信,于是兔子把狼领进山洞。
过了一会,兔子独自走出山洞,继续写文章。
一只野猪走了过来,问:“兔子你在写什么?”答:“文 章。”问:“题目是什么?”
答:“《浅谈兔子是如何把野猪吃掉的》。”野猪不信,于是同样的事情发生。
最后,在山洞里,一只狮子在一堆白骨之间,满意的剔着牙读着兔子交给它的文章,
题目:《一只动物,能力大小关键要看你的老板是谁》。
Read more…

PHP4一路走好!

前几天炒的很热的gophp5.org,确实火了一批PHP开源项目,纷纷都宣布转到PHP5。
而昨天PHP官方网站也发布了一则消息,宣布到今年年底后将不再发布PHP4的版本,PHP5目前已足够稳定了,下面引用一下PHP官方的消息:

Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

For documentation on migration for PHP 4 to PHP 5, we would like to point you to our migration guide. There is additional information available in the PHP 5.0 to PHP 5.1 and PHP 5.1 to PHP 5.2 migration guides as well.

PHP COM应用之WPS篇

本文仅仅是一个简单的例子来演示PHP通过COM扩展来调用WPS二次开发接口.

<?php
$wps = new COM("WPS.application") or die("Can't start WPS");
try {
	$wps->Visible = true;
 
	// Create Document
	$doc = $wps->Documents->Add();
	$doc->Range->Text = "WPS v{$wps->Version} Example";
	$doc->Paragraphs[1]->Alignment = 1;
	$doc->Shapes->AddPicture("http://img.kingsoft.com/publish/kingsoft/images/gb/sy/logo.gif", 80, 50, 148, 60);
 
	$doc->SaveAs("c:/php.wps");
 
	// Close
	$wps->Quit();
} catch (com_exception $e) {
	echo $e;
}
?>

这段代码的执行结果是会在C盘下创建一个php.wps文件,文件内容如下图所示:
php_com_wps

使用PHP的GD库来实现截屏

PHP5.2.2以上版本的GD库实现了两个截屏函数imagegrabscreen和imagegrabwindow,分别用于截取整个屏幕和截取某个窗口(同ALT+PrintScreen)的屏幕。

调用方法也很简单,请看下面两个例子:
Read more…

推荐Wine软件安装管理包–Wine-Doors

Wine-Doors是一款基于Gnome桌面的Windows软件安装管理包,使用非常方便,只需在软件列表中选择要安装的软件,Wine-Doors就会帮你搞定一切,不再需要自己动手来配置。

最新版本为:Wine-Doors 0.1 (Vinegar Finger)
Read more…


Next Page »