Ask Stack: Are fewer lines of code better?

2013年10月12日 评论已被关闭 679 views

This Q&A is part of a biweekly series of posts highlighting common questions encountered by technophiles and answered by users at Stack Exchange, a free, community-powered network of 80+ Q&A sites.

Mike Bryant asks:
Which of these programming styles is better?

<code>var result = methodOne(methodTwo(a, methodThree(b)), c, d); </code>


Read 20 remaining paragraphs | Comments


分类: OpenSource 标签:

Web Served, the finale: Congrats, you have a Web server! What’s next?

2013年10月10日 评论已被关闭 579 views
Aurich Lawson / Thinkstock

Welcome, dear readers, to the final piece in our long-running “Web Served” series. Starting last November, Ars has been helping to shed light on the fun world of DIY Web hosting—we started with setting up Nginx on Ubuntu, and we’ve progressed to advanced application hosting with PHP and even Node.js.

Along the way we’ve struggled with the command line and probably cursed at typos in config files. We’ve felt the incredible triumph of a simple “success” log file message and the crushing defeat of an error that appears to be happening for absolutely no reason. If you’ve stuck with us for the entire spread of articles, you’ve got a full-featured Web server capable of safely and quickly serving pages and running a wide range of awesome applications. Congratulations are in order—good job!

At this point you’ve got a functional Nginx Web server that’s configured with an eye toward speed and security. You’ve got it configured with SSL/TLS, (maybe) have some official certificates, and can serve data encrypted. You’ve got PHP set up along with the MySQL-compatible MariaDB, so you can handle serving most popular Web applications. Speaking of applications, you also probably have a WordPress blog, a Vanilla forum, and maybe even your own MediaWiki wiki.

Read 54 remaining paragraphs | Comments


分类: OpenSource 标签:

Google offers “leet” cash prizes for updates to Linux and other OS software

2013年10月9日 评论已被关闭 523 views

Google is offering rewards as high as $3,133.70 for software updates that improve the security of OpenSSL, OpenSSH, BIND, and several other open-source packages that are critical to the stability of the Internet.

The program announced Wednesday expands on Google’s current bug-bounty program, which pays from $500 to $3,133.70 to people who privately report bugs found in the company’s software and Web properties. Security researchers inside the company considered modifying the program to reward bug reports in open-source software, but eventually decided against that approach. The reason: bug bounty programs often invite a flood of reports of varying quality that can overwhelm the finite resources of open-source developers. What’s more, it’s frequently much harder to patch a vulnerability than merely to find it.

“So we decided to try something new: provide financial incentives for down-to-earth, proactive improvements that go beyond merely fixing a known security bug,” Michael Zalewski, a member of the Google security team, wrote in a blog post. “Whether you want to switch to a more secure allocator, to add privilege separation, to clean up a bunch of sketchy calls to strcat(), or even just enable ASLR—we want to help.”

Read 2 remaining paragraphs | Comments


分类: OpenSource 标签:

“Most powerful” Arduino ever has ARM Cortex-A8 chip, runs “full Linux”

2013年10月3日 评论已被关闭 976 views
The Arduino Tre.

The Arduino line of open source electronic prototyping platforms is getting some major upgrades. Earlier today, the first Intel-powered Arduino was announced, and it will be available by the end of November.

Arduino has also announced the Arduino Tre, based on the Texas Instruments Sitara AM335x ARM Cortex-A8 processor. Texas Instruments said that with the Tre’s 1GHz processor, it is the “most powerful Arduino to date” and the first that will be able to run “full Linux.” It will be available in spring 2014 from and other distributors, with pricing not yet announced.

“For the first time ever, Arduino users can use the full capabilities of Linux and gain access to a variety of new on-board connectivity options to develop a range of powerful, advanced applications while leveraging the simplicity of the Arduino software experience,” the Texas Instruments announcement said. “The Sitara-processor-powered Arduino Tre serves as a network hub that can connect to millions of classic Arduino nodes, enabling customers to be at the forefront of the Internet-of-Things era.”

Read 8 remaining paragraphs | Comments


分类: OpenSource 标签:

Code review 工具gerrit之体验

2013年9月17日 评论已被关闭 6,641 views


安装环境:Centos6.4 + gerrit-2.6.1 + LDAP + mysql-5.1.69

Install gerrit

Install/config mysql
CREATE USER ‘gerrit’@’localhost’ IDENTIFIED BY ‘pwd’;
ALTER DATABASE reviewdb charset=utf8;
GRANT ALL ON reviewdb.* TO ‘gerrit’@’localhost’;

sudo adduser gerrit
sudo su gerrit
java -jar gerrit.war init -d /home/gerrit/gerritapp


分类: git, linux 标签: , ,

nginx lua as http client

2013年9月17日 评论已被关闭 5,345 views


1. 编译openresty

tar xzvf ngx_openresty-
cd ngx_openresty-
./configure --with-luajit
make install

2.获取lua http client

git clone

3. nginx vhost配置

分类: linux, nginx 标签: ,

nagios plugins check_proc_runtime

2013年6月3日 评论已被关闭 1,603 views

A nagios plugin of check proc running time. which can check a specified process running time, If it has been running too long time..


usage on nrpe:

$ cat nrpc.conf
command[check_proc_rsync]=/usr/local/nagios/libexec/check_proc_runtime -k rsync -e inotify -c 360

分类: python 标签: , ,

nginx+lua module直接调用redis实现url跳转

2013年5月24日 评论已被关闭 3,522 views


git clone
git clone
git clone
git clone
git clone
git clone


分类: nginx 标签: , ,


2013年4月3日 评论已被关闭 1,456 views


# /usr/local/rrdtool/bin/rrdtool info /var/www/html/rra/71/2995.rrd
ds[traffic_in].min = 0.0000000000e+00
ds[traffic_in].max = 1.0000000000e+07
ds[traffic_out].min = 0.0000000000e+00
ds[traffic_out].max = 1.0000000000e+07


分类: linux 标签: ,


2013年1月26日 评论已被关闭 2,241 views


MacBook-Pro:~$ cat test.txt
MacBook-Pro:~$ sed -i ‘s/abcd/1234/g’ test.txt
sed: 1: “test.txt”: undefined label ‘est.txt’


分类: others 标签: ,