结婚七周年纪念
时间过得真快,一眨眼就已经铜婚了,据说有七年之痒,哈哈。有了小孩之后,生活重心也转移了,去年的这个时候,我俩竟然都忘了,唉~~。所以今天要再转移回来,放在 Shxll 身上,好好庆祝庆祝 ![]()
时间过得真快,一眨眼就已经铜婚了,据说有七年之痒,哈哈。有了小孩之后,生活重心也转移了,去年的这个时候,我俩竟然都忘了,唉~~。所以今天要再转移回来,放在 Shxll 身上,好好庆祝庆祝 ![]()
PHP 5.3.0 总算正式发布了。
比较受关注的特性有:namespaces、late static binding、closures(我曾经写过一篇相关的blog)、garbage collection。
新的扩展包括:ext/phar、ext/intl 和 ext/fileinfo 等等。
There are three kinds of services that are commonly associated with the cloud: Software as a Service (SaaS), Platform as a Service (PaaS) and Infrastructure as a Service (IaaS). Software as a Service has gotten a lot of good press in the past few years, as Salesforce and the like have seen adoption from the smallest shops to the largest corporations. Beyond a few web service API’s, however, SaaS doesn’t offer much for application developers. Platform as a Service, on the other hand, provides full-service hosting environments that can automatically allocate resources as your applications need them. Google App Engine, for example, supports sandboxed Python and Java environments (PHP is the most requested feature, and hasn’t been ruled out by the GAE team). PaaS environments often extend a SaaS offering, as is the case with SugarCRM’s certified modules. But PaaS has some big shortcomings: your applications are far from portable and are limited to what the vendors specifically permit them to do. Infrastructure as a Service is less confining. Your applications can use these services to scale with the same hardware that backs the largest sites on the web. You can usually install the OS of your choice and run your applications in environments tailored to their needs. The tradeoff is that you have to provision additional resources manually to handle spikes in load, and you must design your applications differently if you’d like to use the services that improve the scalability of your app. As we’ll see later, changing your mindset to take advantage of these services isn’t necessarily a bad thing…
我的第一个父亲节礼物竟然是魔方,而且是很怪异的魔方。Shxll 刚买回来的时候,我一看都呆了,呵呵。如果光是形状上的变化,是没什么难度的,和普通的三阶魔方没什么区别,但所有面的颜色都一样,就有些难度了,因为只能靠抽象想像记忆哪一块在哪个位置上。今天早上,总算玩出来了,看来我的抽象想像能力还不错,嘻嘻

魔方完成后的模样。

魔方乱七八糟的样子,很像变形金刚。
经常需要使用 PHP 写脚本来模拟浏览器对一些页面进行访问,但客户端 IP 却是个问题,所以考虑通过走代理的方式。Tor 无疑是一个很好的选择。通过 curl 相关函数,很容易就可以实现通过 tor 进行访问。
<?php
function tor($url)
{
$ua = array('Mozilla','Opera','Microsoft Internet Explorer','ia_archiver');
$op = array('Windows','Windows XP','Linux','Windows NT','Windows 2000','OSX');
$agent = $ua[rand(0,3)].'/'.rand(1,8).'.'.rand(0,9).' ('.$op[rand(0,5)].' '.rand(1,7).'.'.rand(0,9).'; en-US;)';
// Tor 地址与端口
$tor = '127.0.0.1:9050';
// 连接超时设置
$timeout = 300;
$ack = curl_init();
curl_setopt($ack, CURLOPT_PROXY, $tor);
curl_setopt($ack, CURLOPT_URL, $url);
curl_setopt($ack, CURLOPT_HEADER, 0);
curl_setopt($ack, CURLOPT_USERAGENT, $agent);
curl_setopt($ack, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ack, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ack, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ack, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
$result = curl_exec($ack);
curl_close($ack);
return $result;
}
?>