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

PHP 5.3.0 Released!

Posted on 2nd July 2009 by Nio in 程序人生 - Tags:

PHP 5.3.0 总算正式发布了。

比较受关注的特性有:namespaceslate static bindingclosures我曾经写过一篇相关的blog)、garbage collection

新的扩展包括:ext/pharext/intlext/fileinfo 等等。

PHP’s Forecast: Partly Cloudy

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

PHP’s Forecast: Partly Cloudy

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…

PHP 通过 Tor 代理实现多 IP 访问

Posted on 8th June 2009 by Nio in 程序人生 - Tags: , , ,

经常需要使用 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($ackCURLOPT_PROXY$tor);
    curl_setopt($ackCURLOPT_URL$url);
    curl_setopt($ackCURLOPT_HEADER0);
    curl_setopt($ackCURLOPT_USERAGENT$agent);
    curl_setopt($ackCURLOPT_RETURNTRANSFER1);
    curl_setopt($ackCURLOPT_FOLLOWLOCATION1);
    curl_setopt($ackCURLOPT_TIMEOUT$timeout);
    curl_setopt($ackCURLOPT_PROXYTYPECURLPROXY_SOCKS5);
    $result curl_exec($ack);
    curl_close($ack);
    return $result;
}
?>