PHP curl 抓取页面时的 cookie 问题

Posted on 28th October 2009 by Nio in 工作忙碌, 程序人生 - Tags: ,

使用 PHP curl 抓取页面时,可以设置 cookie 保存的文件,示例代码:


<?php
$cookie_path 'cookie.txt';
$ch curl_init();
curl_setopt($chCURLOPT_COOKIEFILE$cookie_path);
curl_setopt($chCURLOPT_COOKIEJAR$cookie_path);
//....
?>

特别需要注意的是,在完成抓取之后,需要把 cookie 文件删除,否则下次抓取时会自动使用原有的 cookie 数据,从而导致一些预想不到的错误(我们今天就被这个问题折腾了很久 :( )。

WinCache – Preliminary tests look REALLY good

Posted on 7th September 2009 by Nio in Cache, 程序人生 - Tags: ,

WinCache – Preliminary tests look REALLY good

Those of you who follow me on twitter know that recently, I tweeted that I had installed Microsoft’s new PHP Opcode Cache, WinCache on a test machine and didn’t see much difference in performance. I then later tweeted that it was probably due to my inexperience in managing II7 and not necessarily a failing of WinCache. In between those two posts, I received 2 messages from people working with Microsoft, the most helpful being from Ruslan Yakushev. If you recognize that name it’s because he writes a lot of good stuff over at iis.net including the getting started guide for WinCache.

Ruslan picked up on the tweet and wrote me a very nice “How can I help” email. It started a conversation that eventually let me to the problem I was having, but I’ve only just now had a chance to finish my rudimentary testing. I can now say that yes, it was my configuration that I had wrong and once I took Ruslan’s advice, I am seeing a tremendous improvement.

Easyrest Rest Framework

Posted on 26th August 2009 by Nio in 程序人生 - Tags: ,

Easyrest Rest Framework 1.0 Released (Client and Server Library)

What is the Easyrest?
Easyrest is a REST framework that contains client and server implementations.It has a easy structural data transfer unlike XML-RPC.Easyrest use a lot of pear packages and it has got custom apikey functionality.I think using the pear libraries is not a disadvantage because of you don’t have to install required pear libraries, easyrest can work from its own custom pear directory without any pear installation.

What makes a good programmer?

Posted on 24th July 2009 by Nio in 程序人生 - Tags:

What makes a good programmer?

Some casual surfing led me to this article from a couple of years ago, titled "How to recognize a good programmer". It was a nice read, but as many in the comments pointed out, the criteria the author set forth most likely describe himself and are not really useful as rules-of-thumb on how to recognize a good programmer.

It got me thinking though, on what are the attributes I consider useful in fellow programmers. So what makes a good programmer?

以下五项,按照优先级,你会怎样排序呢?

  • Security(安全性)
  • Maintainability(可维护性)
  • Usability(可用性)
  • Performance(性能)
  • LOC (lines-of-code) count(代码量)

作者认为最重要的是 usability,因为你开发的东西最终价值取决于最终用户。我们开发的目的是为了解决问题,如果解决不了问题,则说明项目是失败的。

PHP Security: Fortifying Your Website- Power Tips, Tools & How to’s

Posted on 7th July 2009 by Nio in 程序人生 - Tags: ,

PHP Security: Fortifying Your Website- Power Tips, Tools & How to’s

PHP is the most popular web programming languages in use today due in large part to the fact that it’s a highly flexible syntax that can perform many functions while working flawlessly in conjunction with html – Plus it’s relatively easy to learn for beginners, yet it’s powerful enough for advanced users as well. It also works exceptionally well with open source tools, such as the Apache web server and MySQL database. In other words, its versatility is unsurpassed when compared to other scripting languages, making it the language of choice for many programmers.

文中还介绍了一些工具,用于检测 PHP 漏掉等,如 PhpSecInfoPHP Security ScannerSpike PHP Security Audit Tool