nnd 还是无码。。 什么时候给生成几个邀请码??
Avatar

jason.zh

Vcard Download vCard   what is this?
Rss_icon

Recent Activity


Filter by:
All
  • SIM卡编号的含意 留备,原文:http://wuhongsheng.com/life/2011/01/sim-card/ SIM卡背面的20位数字所代表的含义如下:   前6位:898600中国移动;898601中国联通;898603联通133   第7位:业务接入号,对应于134、135、136、137、138、139中的4、5、6、7、8、9;   第8位:SIM卡的功能位:一般为0,现在的预付费SIM卡为1;   第9、10位:各省的编码;   第11、12位:年号;   第13位:供应商代码;   第14—19位:用户识别码;   第20位:校验位。    中国移动:   如8986 00 79 09 04 4 9311287   分段后的字符串意义分别如下:   8986代表国家中国   00代表运营商中国移动(好像02也是?)   79代表手机号码第三四位,如此卡为1379   09代表发卡省份编号,代码如下,为中国移动内部使用,只能精确到省   ————————–   01:北京 02:天津 03:河北 04:山西 05:内蒙古 06:辽宁 07:吉林 08:黑龙江   09:上海 l0:江苏 11:浙江 12:安徽 13:福建 14:江西 15:山东 16:河南   17:湖北 18:湖南 19:广东 20:广西 21:海南 22:四川 23:贵州 24:云南   25:西藏 26:陕西 27:甘肃 28:青海 29:宁夏 30:新疆 31:重庆   另:13800138000充值卡的密码开头两位、系列号6、7两位都是用的这个省份编号   04代表发(制)卡年份2004年 [...]
    3 months on
    迷失的蛋糕
  • MongoDB在PHP中的应用 近年来NoSQL DB兴起,其中的优秀设计也已不少,这里介绍的是MongoDB,具有众多优点的NoSQL DB。下面的PPT以MongoDB在CakePHP框架下的使用为例,介绍MongoDB在PHP中的应用。 Tips of CakePHP and MongoDB – Cakefest2011 ichikaway View more presentations from ichikaway
    3 months on
    迷失的蛋糕
  • PHP tidy模块安装 先装libtidy cvs -z3 -d:pserver:anonymous@tidy.cvs.sourceforge.net:/cvsroot/tidy co -P tidy cd tidy sh build/gnuauto/setup.sh ./configure make && sudo make install 然后PHP ./configure --prefix=/home/php --with-tidy --disable-all 但是在make时遇到了下面的错: /usr/include/tidy/platform.h:530: error: duplicate ‘unsigned’ 找了一下似乎如此解决: vi /usr/include/tidy/platform.h #然后把530行给注释掉,保存退出 重新make 通过 搞完之后发现,没发用上,还是罢了。tidy文档:http://tidy.sourceforge.net/docs/quickref.html
    5 months on
    迷失的蛋糕
  • svn relocate SVN server一直是用IP来访问,这本没什么问题,问题是昨晚换了IP。。。 一堆项目需要relocate,好吧,手动一次可以这样操作:svn switch –relocate svn://ip_address_old/project svn://ip_address_new/project 可能需要重新输入一次帐号密码,本来也很简单,可问题就在于独立项目太多,project有N个,机械重复累吧 索性写个脚本批量来干吧。 #!/bin/sh dirs=`ls -d */` for d in $dirs do cd $d if [ -e .svn ] then locate_cur=`svn info |grep URL |awk '{print $2}'` host_cur=`echo $locate_cur |awk -F"/" '{print $3}'` locate_nxt=`echo $locate_cur |sed -e "s/$host_cur/$1/"` read -p "relocate '$locate_cur' to '$locate_nxt'? [y/n]: " answer case "$answer" in [yY]) #echo "svn switch --relocate $locate_cur $locate_nxt" svn switch --relocate $locate_cur $locate_nxt && echo "done, next";; * ) echo "continue.." esac fi cd .. done [...]
    6 months on
    迷失的蛋糕
  • OS X下很棒的SVN客户端工具 SCPlgin, OS X下很棒的SVN客户端工具,使用方式跟tortoise svn很相像,很适合我现在的使用习惯。。最重要的是免费且开源 dmg安装完之后需要注意一点,下图中那个S小图标,是需要手动托上去的。 具体过程是,安装完毕后,在Finder中搜索SCToolbarButton 然后拖动搜索结果中的图标至工具栏上即可。 下载地址:http://scplugin.tigris.org/servlets/ProjectProcess?pageID=4adHJG 以下转自:http://scplugin.tigris.org/servlets/ProjectProcess?pageID=ihKl6V Below are some screen captures of the SCPlugin code. Click any image for a full-size version. The command contextual menu. File badges, showing version control state. Repository checkout The commit command window. The commit transcript sheet over the commit command window. The log window The status window The blame window
    9 months on
    迷失的蛋糕
  • Erlang常见的错误信息 Erlang常见的错误信息: badarg/bad argument 参数错误,参数格式或类型错误 badarith 错误算术的表达式,表达式中含有错误的参数,比如非数字的分子或分母、0做分母 {badmatch,V} 模式匹配错误,V指具体的发生匹配错误的数值 function_clause 函数子句错误,没有找到匹配的函数子句 exception error: undefined function 函数未定义错误 no case clause matching X case匹配错误,没有找到匹配的case pattern if_clause if子句错误,没有找到为ture的if子句 {try_clause,V} try匹配错误,执行try时,没有找到匹配的pattern {badfun,F} 函数错误 {badarity,F} 函数参数个数错误 timeout_value 超时参数错误,在receive after语法中,after对应的超时数据错误(应为不小于0的integer或infinity noproc Process 错误,Process不存在 {nocatch,V} throw未被catch system_limit 系统限制错误,某些性能或数据达到系统极限
    10 months on
    迷失的蛋糕
  • supervisor监控树的动态调整 先说一下,正常情况下supervisor监控树动态调整的需求应该是不多的,但是当我们遇到时应该怎么处理呢? 下面看看文档中提到的几个函数: 增加一个: start_child(SupRef, ChildSpec) -> Result 删除一个: 先停掉:terminate_child(SupRef, Id) -> Result 再删除:delete_child(SupRef, Id) -> Result 方法都很简单,主要看一下参数的含义吧, SupRef的取值可以是:Name | {Name,Node} | {global,Name} | pid() 通过监控树的注册名来调整是最方便的方式了,即 Name ChildSpec的取值是:child_spec() | [term()] 接下来再看child_spec() 的取值是: child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} Id = term() StartFunc = {M,F,A} M = F = atom() A = [term()] Restart = permanent | transient | temporary Shutdown = brutal_kill | int()>=0 | infinity Type = worker | supervisor Modules = [Module] | dynamic Module = atom() 其实就是创建监控树时,所需要使用的监控模式参数。举例: {server_logger, {server_logger,start_link, []}, permanent, 1000, worker, [server_logger]} 假设监控树名字为:sup_v1,我们可以通过以下代码实现动态向监控树添加节点: [...]
    ~1 year on
    迷失的蛋糕
  • 推荐一个与Erlang实时通讯的PHP模块 推荐一个PHP扩展模块的项目:mypeb (PHP-Erlang Bridge) 可实现PHP与指定Erlang节点间的通讯,利用此特性将Erlang作为高扩展性的内存缓存系统,在速度方面官方没有给数据我也没有实际测试,因此不敢妄下结论。但是觉得值得一试~ 另外一个应用场景就是用在Erlang系统的WEB管理平台,多的就不说了,你懂的~ 下面是官方给出的实例代码: <?php $link = peb_connect('sadly-desktop@sadly-desktop', 'secret'); if (!$link) { die('Could not connect: ' . peb_error()); } $msg = peb_vencode('[~p,~a]', array( array($link,'getinfo') ) ); //The sender must include a reply address. use ~p to format a link identifier to a valid Erlang pid. peb_send_byname('pong',$msg,$link); $message = peb_receive($link); $rs= peb_vdecode( $message) ; print_r($rs); $serverpid = $rs[0][0]; $message = peb_vencode('[~s]', array( array('how are you') ) ); peb_send_bypid($serverpid,$message,$link); //just demo for how to use peb_send_bypid [...]
    ~1 year on
    迷失的蛋糕
  • nginx中的文件检查”缺陷” 接上一篇 nginx启用sendfile之高级篇,还是同一个项目,按照前文的配置已经都很正常,只是发现有些目标文件明明是已经存在的,但为什么还是走到了后端处理呢? 查看了十几个URL之后发现了一个共性:文件或目录名包含 “+”。 比如 用户请求http://yourdomain/ab+c.ext,经过测试之后发现nginx实际读取的文件名是 ab%2bc.ext ,注意:这是在经过location匹配和rewrite处理的情况下,如果是直接访问一个静态文件 ab+c.ext 且文件存在,是没有问题的。经过我测试发现加号和空格会有这个问题,其他符号都是不会被encode的。 如此一来就很好解释“有些目标文件明明是已经存在的,但为什么还是走到了后端处理呢?”,nginx检查文件是否存在时使用的是 ab%2bc.ext,但文件系统上实际保存的文件是 ab+c.ext,因此会将请求rewrite到后端程序处理。 既然知道了问题,解决办法自然就有了。有两种解决办法: 1,不要使用包含加号和空格的文件、目录名; 2,如果必须使用,应该encode后在做为文件、目录名 注意,在 location 文档说明有这么一句话“It is important to know that nginx does the comparison against decoded URIs.”
    ~1 year on
    迷失的蛋糕
  • 关于erlang的md5计算函数 erlang模块中提供了一个md5函数,但是这个函数返回的并不是通常使用的32位字符。官方文档解释如下: erlang:md5(Data) -> Digest * Data = iodata() * Digest = binary() Computes an MD5 message digest from Data, where the length of the digest is 128 bits (16 bytes). Data is a binary or a list of small integers and binaries. See The MD5 Message Digest Algorithm (RFC 1321) for more information about MD5. 时间宝贵啊,暂时是不打算去看什么RFC 1321了,因此还是放狗吧。 得到以下解决办法: -module(md5). -compile(export_all). md5(S) -> Md5_bin = erlang:md5(S), Md5_list = binary_to_list(Md5_bin), lists:flatten(list_to_hex(Md5_list)). list_to_hex(L) -> lists:map(fun(X) -> int_to_hex(X) end, L). int_to_hex(N) when N < 256 -> [hex(N div 16), hex(N rem 16)]. hex(N) when N < 10 -> $0+N; hex(N) when N >= 10, N < 16 -> $a + (N-10). 保存、编译、执行 md5:md5(“123456″). 得到: e10adc3949ba59abbe56e057f20f883e 到此搞定了。 [...]
    ~1 year on
    迷失的蛋糕
  • proftp安装配置,虚拟账号便于管理 首先下载安装: wget ftp://mirror.wrpn.net/proftpd/distrib/source/proftpd-1.3.2.tar.bz2 tar jxf proftpd-1.3.2.tar.bz2 cd proftpd-1.3.2 ./configure --prefix=/home/proftpd --disable-ipv6 make && make install vi /etc/rc.local vi /home/proftpd/etc/proftpd.conf 修改端口, # Port 21 is the standard FTP port. Port 2121 # standalone 模式下耗费资源多一点,但配置简单 ServerType standalone #注释掉 编译时已经disable-ipv6,这里如果不注释掉,启动时会报错 #UseIPv6 off #修改执行账号 User nobody Group nobody #去掉下面这一行的注释 “#”,这一行是把ftp用户限定在自己的目录下,禁止切换到上层目录 DefaultRoot ~ 默认情况下proftpd是通过系统账号做认证的,或许你也跟我一样 不愿意用这种方式。那么有什么方式呢?查阅资料之后发现有另外两种方式。 一,采用mysql方式存储虚拟用户,如此一来用户容量巨大。比较适合公开ftp server,对于我的应用过于夸张了。这里也不做详细介绍了,有兴趣的可以去搜索一下,资料很多。下面说一下资料并不多的方法。 二,文件形式的虚拟用户存储方案。 首先在proftpd.conf中添加以下两行: AuthUserFile /home/proftpd/etc/ftp.passwd    # 指定认证文件的存储路径 [...]
    ~1 year on
    迷失的蛋糕
Next page