Development

看了看开心网

| Development

访问听下包发现:

两个(组)前端:fronta和frontb,跑 Linux + Squid。图片(img)、动态页面采用同一组cache,后端使用apache 2.2.6,php 5.2.4。所有图片、静态js均假定用户不刷(i.e. 设置一个较长的过期时间)来减轻负载。

阅读全文…( 本文约 397 字,阅读大致需要 1 分钟 )

网页自作主张改用户浏览时的窗口尺寸是不负责任的行为!

因为要查一款主板的规格,访问了湾区一家市值132.72B(今日收盘)的网站。

搜索,点进去,哗的一声,窗口变了形状和尺寸。

最大化。

规格说明是一组文件,点下载,哗的一声,窗口再次变成了刚才的尺寸形状。

阅读全文…( 本文约 206 字,阅读大致需要 1 分钟 )

挑战:算法挑战 36进制 条码序列号 生成器

| Development | #algorithm | #challenge

好久没做编码方面的东西了,今天在 火星 上看到一个挑战,一时兴起就做了一下。原题请看 这里

既然是挑战,我目前的算法对于每个数来说都是常数时间,欢迎大家继续拍砖,我的代码2天后公布(我用的是C语言,大家自便)。

阅读全文…( 本文约 222 字,阅读大致需要 1 分钟 )

Python的浮点数 __str__ 方法的小问题

今天 康神 发现一个浮点数的问题,一个 class 里面有两个浮点(double) 成员 x、y,然后用 return (self.x, self.y).__str__() 返回时,发现输出是 (39.210279999999997, 116.34528) 而不是希望的 (116.345280, 39.210280)。

查了一下,改成 return “(%f, %f)” % (self.x, self.y) 解决。C里面printf的 %f 默认显示小数点后面6位,但是 __str__ 似乎自己对于浮点数精度有些想法?没看 Python 具体的实现。

参与评论

HD-COPY作者成为 FreeBSD committer

今天才知道在 FreeBSD 邮件列表里面的那个 Oliver Fromme 就是 HD-COPY 的那个家伙,预计他将会 takeover FreeBSD 的 loader 部分。HD-COPY是DOS时代我非常喜欢的工具之一。

参与评论

关于网站流量的一些想法

| Development | #成本 | #流量

有人说,中国大陆网站的流量有 80% 是不带来价值的垃圾流量,我个人的感觉是,也许没有多到这么离谱,但是,我认为至少在一半以上。你会看到很多人如此地关注 Alexa 排名,会想出各种各样的方法来骗取 eCPM,但是很少有人关注一些其他的东西—-和投资一样,有战略眼光的投资者,恐怕都被饿死了吧。

阅读全文…( 本文约 692 字,阅读大致需要 2 分钟 )

YSlow

| Development | #performance | #website

An elegant tool for analysis of your website regarding its appearance slowness. Why is it slow?

What you need are:

参与评论

patched top(1) and kernel to support multiple CPU

| Development | #FreeBSD | #multiprocessor | #top

前几天有人问 FreeBSD 的 top(1) 如何能够显示不同 CPU 的占用情况。这是 patch 过之后的输出:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
last pid:  1773;  load averages:  0.43,  0.19,  0.16                                                                                        up 0+00:34:35  16:17:04
97 processes:  1 running, 96 sleeping
CPU 0: 20.8% user,  0.0% nice,  0.0% system,  0.0% interrupt, 79.2% idle
CPU 1:  3.1% user,  0.0% nice,  0.0% system,  0.0% interrupt, 96.9% idle
Mem: 517M Active, 21M Inact, 577M Wired, 11M Cache, 48K Buf, 810M Free
Swap: 2048M Total, 2048M Free

 PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND  
 1236 delphij 1 104 0 232M 143M select 1 4:37 37.06% Xorg  
 1768 delphij 1 8 0 164M 52704K nanslp 1 0:07 36.28% kicker  
 1771 delphij 1 8 0 6212K 1664K wait 0 0:00 3.17% sh  
 1772 delphij 1 45 0 8020K 1656K select 1 0:00 2.39% ksysguardd  
 1756 delphij 1 20 0 10648K 3596K pause 1 0:00 1.17% csh  
 1754 delphij 1 4 0 11764K 1588K sbwait 1 0:00 0.78% gnome-pty-helper  
 1751 delphij 2 -8 0 136M 25756K piperd 0 0:00 0.68% gnome-terminal  

FreeBSD 8 中已经包含了这个功能。

参与评论

Micropolis ported to FreeBSD

| Development | #FreeBSD | #micropolis | #port | #Simcity

Today I have ported (a rather hacky patch) Micropolis (a GPL’ed version of SimCity) to FreeBSD.

(20080114) Note: the patch is based on the git version of micropolis-activity, as available from git://dev.laptop.org/projects/micropolis-activity .


参与评论

BSD ar(1) announced

Kai Wang has announced today the BSD ar(1) is available for wider testing. This is amazing work, the creation and list speed are 5-20 times faster than GNU ar(1), and extraction speed is also slightly better than GNU ar(1).

It is also important to note that this version is completely BSD-licensed (yes, that means that you are free from the lair’s license), and is a piece of the vital parts of the FreeBSD DTrace work.

参与评论