看看想想记记

memcached 安装与应用

1.去官网下载:www.memcached.org

wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz

tar zxvf memcached-1.4.5.tar.gz

cd memcached-1.4.5

./configure

make

make install

2.配置:

/usr/local/bin/memcached -d -u nobody -m 512 -p 11211 127.0.0.1

会报错:

error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

这时需要:

使用LD_DEBUG=help ./memcached -v来确定 加载的类库路径,方法如下:

LD_DEBUG=libs ./memcached -v 2>&1 > /dev/null | less

参考:http://blogold.chinaunix.net/u2/70049/showart_1665279.html

看看少哪个

我这里是:

ln -s /usr/local/lib/libevent-1.4.so.2 /lib64/libevent-1.4.so.2

/usr/local/bin/memcached -d -u nobody -m 512 -p 11211 127.0.0.1

再去看看有没有启动端口!

netstat -anl |grep 11211

查看 telnet 127.0.0.1 11211

stats 看命中情况

KO!

查看memcache数据PHP代码:

 
 
function printDetails($status){ 
 
echo "<table border='1'>"; 
 
        echo "<tr><td>Memcache Server version:</td><td> ".$status ["version"]."</td></tr>"; 
        echo "<tr><td>Process id of this server process </td><td>".$status ["pid"]."</td></tr>"; 
        echo "<tr><td>Number of seconds this server has been running </td><td>".$status ["uptime"]."</td></tr>"; 
        echo "<tr><td>Accumulated user time for this process </td><td>".$status ["rusage_user"]." seconds</td></tr>"; 
        echo "<tr><td>Accumulated system time for this process </td><td>".$status ["rusage_system"]." seconds</td></tr>"; 
        echo "<tr><td>Total number of items stored by this server ever since it started </td><td>".$status ["total_items"]."</td></tr>"; 
        echo "<tr><td>Number of open connections </td><td>".$status ["curr_connections"]."</td></tr>"; 
        echo "<tr><td>Total number of connections opened since the server started running </td><td>".$status ["total_connections"]."</td></tr>"; 
        echo "<tr><td>Number of connection structures allocated by the server </td><td>".$status ["connection_structures"]."</td></tr>"; 
        echo "<tr><td>Cumulative number of retrieval requests </td><td>".$status ["cmd_get"]."</td></tr>"; 
        echo "<tr><td> Cumulative number of storage requests </td><td>".$status ["cmd_set"]."</td></tr>"; 
 
        $percCacheHit=((real)$status ["get_hits"]/ (real)$status ["cmd_get"] *100); 
        $percCacheHit=round($percCacheHit,3); 
        $percCacheMiss=100-$percCacheHit; 
 
        echo "<tr><td>Number of keys that have been requested and found present </td><td>".$status ["get_hits"]." ($percCacheHit%)</td></tr>"; 
        echo "<tr><td>Number of items that have been requested and not found </td><td>".$status ["get_misses"]."($percCacheMiss%)</td></tr>"; 
 
        $MBRead= (real)$status["bytes_read"]/(1024*1024); 
 
        echo "<tr><td>Total number of bytes read by this server from network </td><td>".$MBRead." Mega Bytes</td></tr>"; 
        $MBWrite=(real) $status["bytes_written"]/(1024*1024) ; 
        echo "<tr><td>Total number of bytes sent by this server to network </td><td>".$MBWrite." Mega Bytes</td></tr>"; 
        $MBSize=(real) $status["limit_maxbytes"]/(1024*1024) ; 
        echo "<tr><td>Number of bytes this server is allowed to use for storage.</td><td>".$MBSize." Mega Bytes</td></tr>"; 
        echo "<tr><td>Number of valid items removed from cache to free memory for new items.</td><td>".$status ["evictions"]."</td></tr>";
 
echo "</table>"; 
 
    }
 
 
 $memcache_obj = new Memcache; 
  $memcache_obj->addServer('memcache_host', 11211); 
   printDetails($memcache_obj->getStats());

来源:http://php.net/manual/en/memcache.getstats.php

2011-02-20Tech

没有评论
794 views

codeignitor 1.7.3 配置amfphp 实例

参考来源:

http://active.tutsplus.com/tutorials/workflow/using-amfphp-with-as3-and-codeignitor/

这里要看的步骤是:
从:Step 19: Installing CodeIgniter 开始配置就可以了:
上面可以慢点看

但因为提供的源代码是1.7.1 上面很多代码都过期了,会出现很多错误,所以我们要改成1.7.3 来配置。

基本上成功可以,但一些文件格式可能要直接复制他的比较好,因为utf-8编码的问题,可能amf格式不正确

测试地址:

http://j.etwong.com/amftest/amfphp/browser/

选择CI
输入:main(控制器)和args [99,100]
就可以看到输出了
也可以用amfexplorer 看到结果输出

下载已经配置好的:

http://j.etwong.com/amftest/php.rar

2011-02-17Tech

没有评论
396 views

loadrunner 新手指导

Loadrunner确实是个大家伙,但是不错的大家伙。

2011-02-08Tech

没有评论
393 views

flash/actionscript 基础汇总(2011/2/8更新)

1.常见:

[code]
import flash.display.Sprite;
import flash.display.SimpleButton;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.filters.BlurFilter;
import flash.text.TextFormat;
import flash.display.Loader;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import fl.transitions.Tween;
import fl.transitions.Tween;
import fl.transitions.easing.*;
[/code]
其中flash包和fl包有什么区别呢?
答:
flash 包是 Flash CS 和 Flex 共用的包,是 ActionScript 3 的基础包。
fl 包是 Flash CS 组件相关的包。Flash CS 专有包。
mx 包是 Flex 组件相关的包。Flex 专有包。

flash包是FlashPlayer的核心
fl包和mx包都是扩展自flash包
fl用于flash
mx用于flex

2011-01-23杂杂杂

没有评论
524 views

flash web game ,开发很有意义的文章

【完】我的FLASH情结2010——浅谈FLASH WEB GAME与创业 – Flash 专栏 – 经典论坛

http://bbs.blueidea.com/thread-2969949-1-6.html

2011-01-20杂杂杂

没有评论
421 views

公司跳槽法则

新的游戏开发完了,也上线了,也有开放充值了。

结果是没赚钱,一个月收入十万,百万泡影了。

公司开人,走人了。

程序员们开始没心思工作了。公司你这是折腾啥?我也要做好产品!烂作品,不如跳槽!这帮人乱指挥。

我花了一个晚上想出一个说服自己跳槽还是留下的理由:

1。留下是为了做个好产品

这个大错特错。记住你是程序员。作为技术是为产品服务的,做好服务是才是你的职责!好的产品要好的决策,好的策划,好的执行,好的市场缺一不可。关注产品不是你的错,而且要好的更多的产品,才能做出好东西,记住技术才是从的根本。

2。我来公司是学习的。
每一个阶段你有总结吗?有你想学的东西了吗?多做一些总结,才是提高的关键。
公司里有学习的对象吗?如果没有值得学习的赶紧走吧!

3 。我是来学习运维经验的。

碰到问题你会及时处理吗?客户的问题有及时反馈吗?学会和其他部门打交道的技巧了吗?学会一线的流程,有整理吗?整理才是你的经验。学会突发情况处理问题了吗?

想清上面问题再跳

2010-08-23Tech

没有评论
386 views
2010-04-20杂杂杂

没有评论
2,600 views

GAE(google app engine)搭建twitter API注意事项

搭建的教程:

月光的博客:>>

1.可能年代问题很多抢建的都有无法成功的例子
就现在来讲有两个情况:

1.Python ,现在python被墙了,所以下载都成问题
但是目前来看,python版本也成问题,最新版本的不见得能成功!

F:\Google\google_appengine>appcfg.py update gae
Traceback (most recent call last):
File “F:\Google\google_appengine\appcfg.py”, line 68, in
run_file(__file__, globals())
File “F:\Google\google_appengine\appcfg.py”, line 64, in run_file
execfile(script_path, globals_)
NameError: global name ‘execfile’ is not defined

记得把python换成2.5 2.6的就好
下载就可以搜 python 2.6 下载

2. APP不成功
执行:yourid.appspots.com/api/ 放在浏览器里会报
internal server error

这时要用这个办法了(转自):

出现“internal server error”错误,这个看别个说是代码里面有问题,你可以尝试删除code.py里面的下面一段代码:
import socket
import re
ua = web.ctx.environ.get(“HTTP_USER_AGENT”, ‘None’)
if ua.find(‘jibjib’) >= 0:
socket.setdefaulttimeout(60)
elif ua.find(‘zh-CN’) >= 0:
#raise Exception(‘unknown error’)
socket.setdefaulttimeout(2)
else:
socket.setdefaulttimeout(2)

2010-03-07Tech

3条评论
634 views

mysql事务备份

1.http://wasabi.javaeye.com/blog/180162

1. $LinkID =mysql_connect('localhost:3307','root',*******);
mysql_select_db('web_his',$LinkID);
mysql_query("set names utf8");

/* 创建事务 */
mysql_query('START TRANSACTION') or exit(mysql_error());
$ssql1="insert into pf_item values('22','我们','30')"; //执行sql 1
if(!mysql_query($ssql1)){
echo $ssql1.mysql_errno().":".mysql_error()."
“;
mysql_query(‘ROLLBACK’) or exit(mysql_error());//判断当执行失败时回滚

exit;
}
$ssql1=”insert into pf_item values(’21′,’hell’,’10′)”; //执行sql 2
if(!mysql_query($ssql1)){
echo $ssql1.mysql_errno().”:”.mysql_error().”
“;
mysql_query(‘ROLLBACK’) or exit(mysql_error());//判断当执行失败时回滚

exit;
}

mysql_query(‘COMMIT’) or exit(mysql_error());//执行事务

mysql_close($LinkID);
?>


2.

mysql_query(“BEGIN”);//开始一个事务
mysql_query(“SET AUTOCOMMIT=0″); //设置事务不自动commit
$insert=”INSERT INTO userinfo VALUES (‘aa12′,’aa’,’1′,’aaa’)”;
mysql_query($insert);
mysql_query(“COMMIT”);//非autocommit模式,必须手动执行COMMIT使操作生效
//mysql_query(“SET AUTOCOMMIT=0″);
$insert=”INSERT INTO userinfo VALUES (‘aa20′,’aa’,’1′,’aaa’)”;
$insert=”INSERT INTO userinfo VALUES (‘aa8′,’aa’,’1′)”;
//mysql_query(“COMMIT”);
if(mysql_num_rows==0)
mysql_query(“ROLLBACK”);//非autocommit模式,执行ROLLBACK使事务操作无效
else echo “ok”;
//mysql_query(“CLOSE”);
mysql_query(“SET AUTOCOMMIT=1″);//恢复autocommit模式
$insert=”INSERT INTO userinfo VALUES (‘aa15′,’aa’,’1′,’aaa’)”;
mysql_query($insert);//不需要手动执行COMMIT就可以使事务操作生效

执行BEGIN之后,其作用同set autocommit=0,而且之后设置set autocommit=0或1时无效。所以,为使操作清楚,一般不使用BEGIN。

3.mysql事务与行锁

http://www.611530.com/PC/wangzhan/200910/2220.html

4.

http://hi.baidu.com/cuihu0706/blog/item/1dd6ccb1621c355709230278.html

$handler=mysql_connect("localhost","root","");
mysql_select_db("task");
mysql_query("SET AUTOCOMMIT=0");//设置为不自动提交,因为MYSQL默认立即执行
mysql_query("BEGIN");//开始事务定义
if(!mysql_query("insert into trans (id) values('2')"))
{
mysql_query("ROOLBACK");//判断当执行失败时回滚
}
if(!mysql_query("insert into trans (id) values('4')"))
{
mysql_query("ROOLBACK");//判断执行失败回滚
}
mysql_query("COMMIT");//执行事务
mysql_close($handler);
?>

5.各种锁的类型:

http://www.d5s.cn/archives/93

6.CI中的事务:

http://xinbituya.blogbus.com/logs/21820416.html

http://codeigniter.org.cn/user_guide/database/transactions.html

myssql fulltext 全文索引

参考:http://haka.sharera.com/blog/BlogTopic/1001.htm

mysql当把字段设成fulltext时,就可以使用了,
但有几个问题要注意:
1.对于四个字符以下的字符可以搜不出来:
SELECT * FROM articles
-> WHERE MATCH (title,body) AGAINST (‘spa’);

这是因为mysql设置
需要修改配置:
ft_min_word_len 为2或者你想要的字符长度
默认是4

2.对于出现机率太高的可能搜不出来,不太清楚原因:
SELECT * FROM oneword_content where match( name) against (‘space’)

试试:
SELECT * FROM oneword_content where match( name) against (‘space’ IN BOOLEAN MODE)

返回顶部

Switch to our mobile site