易栈网-膘叔

发文热力图 2025-12-07 ~ 2026-12-06
少 多 近 365 天共 27 篇
浏览模式: 标准 | 列表 | 图文
markdown编辑器

markdown编辑器

妖怪在群进而推荐了mou这个APP,才发现,原来markdown文档可以这么写。
我原来都是用phpstorm的插件来处理的

之所以要用markdown,是因为首先,很多人都在用,很多开发人员觉得markdown其实只是写文本文件,可读性不强啊。
但是很多人为什么要用这个呢?

因为它简单。可读性好。且可以使用相关工具换成 TXT、RTF、HTML、PDF、Microsoft Doc等。

而且,今天在群里有人就说了,当你用它来写changelog或者readme的时候就可以很容易diff了,如果你是用doc,你怎么diff呢?

好吧,我走题了,不过markdown看起来真不错,而且也可以尝试以后将博客转为markdown格式(或许真有可能),又不占地方,也不占空间

先上图:03b4aff12346e1a2a6fdc65f2d00beb0

再上下载地址:http://mouapp.com/

这里有介绍:http://www.ituring.com.cn/article/details/504

Markdown 的目标是实现「易读易写」。

不过最需要强调的便是它的可读性。一份使用 Markdown 格式撰写的文档应该可以直接以纯文本发布,并且看起来不会像是由许多标签或是格式指令所构成。Markdown 语法受到一些既有 text-to-HTML 格式的影响,包括 Setext、atx、Textile、reStructuredText、Grutatext 和 EtText,然而最大灵感来源其实是纯文本的电子邮件格式。

因此 Markdown 的语法全由标点符号所组成,并经过严谨慎选,是为了让它们看起来就像所要表达的意思。像是在文字两旁加上星号,看起来就像*强调*。Markdown 的列表看起来,嗯,就是列表。假如你用过电子邮件,区块引言看起来就真的像是引用一段文字。

tidy参数引发的问题

tidy参数引发的问题

tidy库对于我们处理非标准HTML来说是一个好工具,当然,由于他需要在服务器上配置,所以相对就较少人用它,而是HtmlPurifier,毕竟它不需要在服务器上配置直接就可以配置着用了。
为什么我们会用这些工具呢?主要还是由于国内做页面啊,那是相当的不小心,不是这里标签不闭合,就是大小写混用,对于我们做页面分析的来说,就痛苦很多了。肿么办肿么办?
OK,htmlpurifier和tidy库就是帮我们解决这些问题的小工具。
这次要讲的是tidy库参数引发的问题,tidy的函数其实不多,平时我们一般只用tidy_repair_string或者tidy_repair_file就完了,可是就是因为这个REpair导致我的代码出了点问题
tidy_repair_string共需要三个参数,第一个参数string就不用提了,第二个参数是config,第三个参数是encoding。
NND,明明config数组中就可以指定encoding的,为什么还要用第三个参数??
我在处理的时候,在config中指定了input-encoding和output-encoding,分别是实际的编码,但在处理完后。发现有问题,好象页面中有几个字符被处理坏了。导致了UTF-8不认。
最后,只能tidy_repair_string($string,null,"UTF-8");
但这样,好象还是有问题,因为tidy支持的编码都是utf8之类的,参考:http://tidy.sourceforge.net/docs/quickref.html
LOOK:Example: raw, ascii, latin0, latin1, utf8, iso2022, mac, win1252, ibm858, utf16le, utf16be, utf16, big5, shiftjis
因此,写UTF-8有可能会出错(我没有仔细试)
上面的:tidy_repair_string($string,null,"UTF-8");其实还是错的,PHP报错说是找不到 指定的配置文件。所以NULL不能直接用啊,tidy_repair_string($string,array("wrap"=>0),"utf8")
直接解决问题。
(事实上,我一直在怀疑我的页面中是否有一些字符串tidy库处理的有问题,比如一些特殊字符,正如上面所写的,它支持的编码有问题,而我写的input-encoding为gb2312,所以就不正常了?转换有问题?)没有很多时间解决这个问题,主要是被他折腾了一天,所以记录一下。

删除BootCamp分区

删除BootCamp分区

机器上早就没有windows了,所以bootcamp分区对我来说也就没有了意义,主要是机器刚拿到手的时候,被IT分盘分的太厉害了。一半对一半啊。
所以找资料想删除这个bootcamp分区,或者将它的容量再减少一点。
找了一下资料,发现原来在工具的磁盘管理里就可以直接操作:
进入实用工具-》磁盘管理
点中左侧的硬盘(不是点中分区哦,是点中硬盘),在右侧的TAB中,选择分区,可以进行删除或者调整容量大小。

灰常方便,我是将它删除并且重建了一个50G左右的分区,用来存放我的一些重要文件(比如:软件、我的WEB代码 之类的。),这样以后我要备份也只备份这一个分区就OK了

转:微软升级iPhone应用OneNote,开始支持iPad

转:微软升级iPhone应用OneNote,开始支持iPad

Onenote是我在WIN下用的最多的一个程序之一,嗯,Office里面就这一个软件我最喜欢了。为了它,我买了个所谓的正版的Office。然而,在MAC下是无法使用的,这个,你懂的。
看到36氪上的这个新闻的时候,很是欣慰,原来微软哥没有忘记我们,没有抛弃我们,虽然这仅仅只是一个简单的版本,而且是基于skydrive的,但总算有了一个开头了。
先看新闻:
微软刚刚升级了iOS上的OneNote应用到1.3版本,新版将支持任何运行iOS 4.3或以上系统的设备,包括iPad和iPad 2。

除了开始支持新的设备,iPad版本的OneNote还充分利用了平板电脑的大屏幕优势,在使用地图、侧边栏菜单以及其他iPad专有功能时更加适合。

OneNote在2003年第一次随微软Office套件一起发布,今年1月份时候移植到了iPhone上,作为Office套件的一部分,它是唯一一个可以在iOS设备上使用的Office应用,OneNote使用微软的SkyDrive云服务自动跨设备同步笔记。

尽管OneNote应用本身免费,但是用户的笔记数被限制在500以内,超过500后则需要付费,iPhone和iPod Touch用户需要支付4.99美元,iPad用户需要支付14.99美元。如果你在SkyDrive上有超过500条笔记,你仍然可以在你的iOS设备上查看它们,不过微软说,你不能够编辑这些笔记或新建笔记。

不知道微软扩展OneNote支持iPad是意味着要将更多Office应用带到iOS设备上?我们拭目以待。
60965851401ad3e29085a60de12ef5b8
原文来自:http://www.36kr.com/p/68055.html
----------
静候mac版本,那样我就真的可以完全脱离windows了(除了玩游戏。NND,arclive没法玩,CS没法玩,真纠结)

开源分词程序

开源分词程序

看到张宴的微博上有一条消息:
推荐一个工具:imewlconverter - 深蓝词库转换( http://t.cn/h4YOCi ) ,可以将搜狗拼音输入法细胞词库( http://t.cn/hWFEQ )*.scel 格式转换成文本格式。然后,可以将提取的一些专用词库,用于中文分词接口中去。

不错的工具,毕竟做分词的也好,做其他的也好,都可能会需要用到这个。所以我先备份了这条微博
官方地址是:http://code.google.com/p/imewlconverter/
张宴的微博:http://weibo.com/rewinx

OK,顺便再贴一下张宴的微型HTTP队列:http://blog.s135.com/httpsqs/
所谓的优点:
HTTPSQS 具有以下特征:

● 非常简单,基于 HTTP GET/POST 协议。PHP、Java、Perl、Shell、Python、Ruby等支持HTTP协议的编程语言均可调用。
● 非常快速,入队列、出队列速度超过10000次/秒。
● 高并发,支持上万的并发连接,C10K不成问题。
● 支持多队列。
● 单个队列支持的最大队列数量高达10亿条。
● 低内存消耗,海量数据存储,存储几十GB的数据只需不到100MB的物理内存缓冲区。
● 可以在不停止服务的情况下便捷地修改单个队列的最大队列数量。
● 可以实时查看队列状态(入队列位置、出队列位置、未读队列数量、最大队列数量)。
● 可以查看指定队列ID(队列点)的内容,包括未出、已出的队列内容。
● 查看队列内容时,支持多字符集编码。
● 源代码不超过800行,适合二次开发。
可以利用它来做很多事情,比如我曾经想做的短信队列发送,原来我都是利用MYSQL来做队列的,这样的效率不是特别高。而且额外写了很多程序。现在可以偷懒了。

一句可以围观的SQL

窝窝(Walkerlee)最近说他折腾了一个SQL,提升了他的工作效率。表示要到博客来投稿,今天我把这个SQL放出来了。
嗯。我总不能说,因为我确实会这个SQL就断了他投稿的心,否则他会砍我的。

前因:
数据库结构如下:

要求:一句SQL实现,分别统计type1,2,3,4 一共多少money (group by uid)

原先做法:分开查询 然后用php合并结果,如

select sum(money) form test where type = 1 group by uid
select sum(money) form test where type = 2 group by uid
select sum(money) form test where type = 3 group by uid
select sum(money) form test where type = 4 group by uid

现在要求一句SQL。
窝窝问我的时候,我说if(a,b,c)这个函数可以解决,于是他很愤怒。。。。
贴出了最终的SQL语句:

SELECT
uid,
SUM( IF(`type`=1, money, 0 ) ) AS `BuyByCash`,
SUM( IF (`type`=3, money, 0 ) ) AS `BuyByCard`,
SUM( IF( `type` IN (1,3), money, 0 ) ) AS `BuyByCashAndCard`,
SUM( IF(`type`=2, money, 0 ) ) AS `SellByCash`,
SUM( IF(`type`=4, money, 0 ) ) AS `SellByCard`,
SUM( IF( `type` IN (2,4), money, 0 ) ) AS `BuyByCashAndCard`,
SUM(money) AS `Amount`,
COUNT(*) AS `DataNums`
FROM `test`
group by `uid`

窝窝比较郁闷,因为以前处理起来很麻烦,而现在一句就解决了。


此事完结后,他又介绍了一个小技巧:
我有一个relation表,用来存储订单下面的游客

ALTER TABLE `travel_order_customer_relation`
ADD CONSTRAINT `travel_order_customer_relation_ibfk_1` FOREIGN KEY (`oid`) REFERENCES `travel_orders` (`id`) ON DELETE CASCADE;

然后我用了一个外键,这样order被删除时候,这个关系表里面的相关数据也就自动删除了
----
然后我也很郁闷的说,我的数据表不是INNODB的,所以这个功能我不能用。。。也很纠结

由一个笑话看需求理解

这,是一个笑话:

突然让我想起两年前的那个图,产品经理拿到一个要做秋千的需求,经过层层转达,最后做出一个十不象来,事实上就是人们所说的,每一次信息传递,都会丢失大约20%左右的信息,当信息传达次数过多的时候,需求和结果就已经很偏离方向了。
上海以前有一个节目《智力大冲浪》,其中有一个游戏就是COPY不走样,但事实上这真的不太可能。
在实际工作中,往往都是老板说要做一个什么东西,然后产品经理进行规划,事实上这时候已经可能偏了大约10%左右。然后产品经理规划好了,找开发主管讨论,这时候又偏了10%左右。开发主管找小弟把需求复述一遍,需求还剩70%,这时候根据开发人员的水平来划分:
1、特别好的开发人员能够保证60%的准确度+15%的自己理解(可能会有实际偏差也可能就正好把需求损失的补回来)
2、一般的开发人员,能够保证60%的完成度
3、稍差一点的开发人员,能够保证50%
4、差一点的,30%
5、如果连程序都写不完的,就不谈百分比了。。。。

细想想,难道不正是这样?

儿童咳嗽,不要总当感冒治

儿童咳嗽,不要总当感冒治

也是一个转贴啊,主要是我们家的小朋友也有点这种症状,如果有相同类似的小朋友们可以看看。当然我也不知道这是对还是错。。。

原文来自:http://geek.techweb.com.cn/viewthread.php?tid=231886
引起儿童慢性咳嗽的原因很多,过敏是重要原因之一。

过敏性咳嗽患儿的表现:

?长期咳嗽,久治不见好转;

?一般在夜间或清晨发作,白天通常不咳嗽或很少咳嗽;

?过敏性咳嗽一般不发烧,吐白色泡沫痰,多以咳嗽为主,不喘。

?咳三阵是它的最大特点,晚上睡觉前咳一阵,半夜醒来咳一阵,早上醒来咳一阵,有的儿童一连咳上3个月;

?过敏性咳嗽的孩子喜欢揉眼睛和鼻子,爱抓头皮,睡觉时爱出汗、不安分,喜欢蜷曲着睡。

治疗误区:

孩子出现过敏性咳嗽时,父母的第一反应往往还是“孩子又感冒了”,并把它当成感冒而一味使用抗生素和止咳药治疗,但实际上不对证的治疗是不可能获得良好效果的。咳嗽时间长了,患儿可以发展成典型的支气管哮喘。

正确治疗:

?在季节交替、气温骤变时,父母应尽量为孩子防寒保暖,避免着凉、感冒;

小快克的一分为二设计其实就是将一整袋药品分为两个相等的半份,这样便可以使年轻父母可以更好的掌握用药剂量。小快克的设计受到了广大年轻父母的欢迎,这无疑也是给那些不负责任的厂家好好的上了一课。

其实宝宝作为一家人中最受爱护的对象,从出生开始便会集万千宠爱于一身,很多的父母长辈都希望宝宝可以健康快乐的成长。如果宝宝受到病痛的伤害与侵扰,那将是全家人的烦心事,尤其是在选择用药剂量上,一直以来都困扰着很多的父母。

?避开过敏源,家里不要养宠物和养花,不要铺地毯,避免接触花粉、尘螨、油烟、油漆等,避免食用会引起过敏症状的食物,如海产品、冷饮等;

phpstorm 函数提示

其实我一直以为phpstorm的函数提示只能提示参数的,但最近我在把菜单一一看完的时候才发现,原来,它真的可以提示函数的详细信息。
说白了, 就是将phpdoc这一块的内容全部提示出来。具体怎么操作呢?
在macosx上,快捷键是F1或者ctrl+j
其他平台上未知,但没有关系,可以通过keymap来看一下定义的是什么快捷键,也可以看这个:

看那个QuickDocumentation,就知道了。
因为菜单里的提示只是默认的,所以如果有多种快捷键,还是看keymap的定义吧。比如我现在的定义是:

转:apache一个优化小技巧

转:apache一个优化小技巧

determine the MaxClient

決定 web server 效能一個最重要的因素就是記憶體的量,而藉由調整 MaxClient,可以避免 Apache 產生過多無用的 child process。這個數字到底要調到多少,老實說也沒有一個標準答案,網路上大家比較建議的算法都是用機器有的記憶體和每個 child process 的 size 去做粗估。但事實上,要估計 apache child process 的 size 也不是一件容易的事,如果你用 ps aux 這個指令去看,出來的 VSZ or RSS value,其實都會把 shared memory 重覆記算(詳細內容請參考: Understanding memory usage on Linux , Memory usage determination with the ps command ),所以後來我採用的作法是:先將 MaxClent 設成一個比較小的值 (e.g. 30),然後再定期去看 error log 是否有 run out of clients 的情形,如果有的話,就再幫 MaxClients 加個 5。

原文来自:http://brooky.cc/2011/06/30/practical-guide-on-setup-wordpress-on-amazon-ec2-free-tier/

disable “AllowOverride”

理論上,AllowOverride 會造成 Apache 在路徑的每一層去找找看是否有 .htaccess 這個 file。
例如說:如果 virtual host 的設定是:

DocumentRoot /www/htdocs AllowOverride all

那任何一個 /index.html 的 request, Apache 都會試著去找 /.htaccess, /www/.htaccess, and /www/htdocs/.htaccess.
所以除非必要,是可以將 AllowOverride 設成 None.

但如果你用了 wordpress Pretty Permalinks”這個功能,那就會需要 rewrite rule 的功能。在這種情況下,可以考慮將 AllowOverride 的設定直接寫在 config 檔裡。

----------
上文中的链接:Memory usage determination with the ps command

The ps command can also be used to monitor memory usage of individual processes.

The ps v PID command provides the most comprehensive report on memory-related statistics for an individual process, such as:

  • Page faults
  • Size of working segment that has been touched
  • Size of working segment and code segment in memory
  • Size of text segment
  • Size of resident set
  • Percentage of real memory used by this process
The following is an example:
# ps v 
PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND
36626 pts/3 A 0:00 0 316 408 32768 51 60 0.0 0.0 ps v

The most important columns on the resulting ps report are described as follows:

PGIN
Number of page-ins caused by page faults. Since all I/O is classified as page faults, this is basically a measure of I/O volume.
SIZE
Virtual size (in paging space) in kilobytes of the data section of the process (displayed as SZ by other flags). This number is equal to the number of working segment pages of the process that have been touched times 4. If some working segment pages are currently paged out, this number is larger than the amount of real memory being used. SIZE includes pages in the private segment and the shared-library data segment of the process.
RSS
Real-memory (resident set) size in kilobytes of the process. This number is equal to the sum of the number of working segment and code segment pages in memory times 4. Remember that code segment pages are shared among all of the currently running instances of the program. If 26 ksh processes are running, only one copy of any given page of the ksh executable program would be in memory, but the ps command would report that code segment size as part of the RSS of each instance of the ksh program.
TSIZ
Size of text (shared-program) image. This is the size of the text section of the executable file. Pages of the text section of the executable program are only brought into memory when they are touched, that is, branched to or loaded from. This number represents only an upper bound on the amount of text that could be loaded. The TSIZ value does not reflect actual memory usage. This TSIZ value can also be seen by executing the dump -ov command against an executable program (for example, dump -ov /usr/bin/ls).
TRS
Size of the resident set (real memory) of text. This is the number of code segment pages times 4. This number exaggerates memory use for programs of which multiple instances are running. The TRS value can be higher than the TSIZ value because other pages may be included in the code segment such as the XCOFF header and the loader section.
%MEM
Calculated as the sum of the number of working segment and code segment pages in memory times 4 (that is, the RSS value), divided by the size of the real memory in use, in the machine in KB, times 100, rounded to the nearest full percentage point. This value attempts to convey the percentage of real memory being used by the process. Unfortunately, like RSS, it tends the exaggerate the cost of a process that is sharing program text with other processes. Further, the rounding to the nearest percentage point causes all of the processes in the system that have RSS values under 0.005 times real memory size to have a %MEM of 0.0.
Note: The ps command does not indicate memory consumed by shared memory segments or memory-mapped segments. Because many applications use shared memory or memory-mapped segments, the svmon command is a better tool to view the memory usage of these segments.
-----------
第二篇:http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html

这篇文章来自blogspot,一般情况下打不开,所幸我用Read it later,直接用广本模式,让他帮我打开了。HOHO,有点长,慢慢看:

This entry is for those people who have ever wondered, "Why the hell is a simple KDE text editor taking up 25 megabytes of memory?" Many people are led to believe that many Linux applications, especially KDE or Gnome programs, are "bloated" based solely upon what tools like ps report. While this may or may not be true, depending on the program, it is not generally true -- many programs are much more memory efficient than they seem.

What ps reports
The ps tool can output various pieces of information about a process, such as its process id, current running state, and resource utilization. Two of the possible outputs are VSZ and RSS, which stand for "virtual set size" and "resident set size", which are commonly used by geeks around the world to see how much memory processes are taking up.

For example, here is the output of ps aux for KEdit on my computer:


USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
dbunker 3468 0.0 2.7 25400 14452 ? S 20:19 0:00 kdeinit: kedit

According to ps, KEdit has a virtual size of about 25 megabytes and a resident size of about 14 megabytes (both numbers above are reported in kilobytes). It seems that most people like to randomly choose to accept one number or the other as representing the real memory usage of a process. I'm not going to explain the difference between VSZ and RSS right now but, needless to say, this is the wrong approach; neither number is an accurate picture of what the memory cost of running KEdit is.

Why ps is "wrong"
Depending on how you look at it, ps is not reporting the real memory usage of processes. What it is really doing is showing how much real memory each process would take up if it were the only process running. Of course, a typical Linux machine has several dozen processes running at any given time, which means that the VSZ and RSS numbers reported by ps are almost definitely "wrong". In order to understand why, it is necessary to learn how Linux handles shared libraries in programs.

Most major programs on Linux use shared libraries to facilitate certain functionality. For example, a KDE text editing program will use several KDE shared libraries (to allow for interaction with other KDE components), several X libraries (to allow it to display images and copy and pasting), and several general system libraries (to allow it to perform basic operations). Many of these shared libraries, especially commonly used ones like libc, are used by many of the programs running on a Linux system. Due to this sharing, Linux is able to use a great trick: it will load a single copy of the shared libraries into memory and use that one copy for every program that references it.

For better or worse, many tools don't care very much about this very common trick; they simply report how much memory a process uses, regardless of whether that memory is shared with other processes as well. Two programs could therefore use a large shared library and yet have its size count towards both of their memory usage totals; the library is being double-counted, which can be very misleading if you don't know what is going on.

Unfortunately, a perfect representation of process memory usage isn't easy to obtain. Not only do you need to understand how the system really works, but you need to decide how you want to deal with some hard questions. Should a shared library that is only needed for one process be counted in that process's memory usage? If a shared library is used my multiple processes, should its memory usage be evenly distributed among the different processes, or just ignored? There isn't a hard and fast rule here; you might have different answers depending on the situation you're facing. It's easy to see why ps doesn't try harder to report "correct" memory usage totals, given the ambiguity.

Seeing a process's memory map
Enough talk; let's see what the situation is with that "huge" KEdit process. To see what KEdit's memory looks like, we'll use the pmap program (with the -d flag):


Address Kbytes Mode Offset Device Mapping
08048000 40 r-x-- 0000000000000000 0fe:00000 kdeinit
08052000 4 rw--- 0000000000009000 0fe:00000 kdeinit
08053000 1164 rw--- 0000000008053000 000:00000 [ anon ]
40000000 84 r-x-- 0000000000000000 0fe:00000 ld-2.3.5.so
40015000 8 rw--- 0000000000014000 0fe:00000 ld-2.3.5.so
40017000 4 rw--- 0000000040017000 000:00000 [ anon ]
40018000 4 r-x-- 0000000000000000 0fe:00000 kedit.so
40019000 4 rw--- 0000000000000000 0fe:00000 kedit.so
40027000 252 r-x-- 0000000000000000 0fe:00000 libkparts.so.2.1.0
40066000 20 rw--- 000000000003e000 0fe:00000 libkparts.so.2.1.0
4006b000 3108 r-x-- 0000000000000000 0fe:00000 libkio.so.4.2.0
40374000 116 rw--- 0000000000309000 0fe:00000 libkio.so.4.2.0
40391000 8 rw--- 0000000040391000 000:00000 [ anon ]
40393000 2644 r-x-- 0000000000000000 0fe:00000 libkdeui.so.4.2.0
40628000 164 rw--- 0000000000295000 0fe:00000 libkdeui.so.4.2.0
40651000 4 rw--- 0000000040651000 000:00000 [ anon ]
40652000 100 r-x-- 0000000000000000 0fe:00000 libkdesu.so.4.2.0
4066b000 4 rw--- 0000000000019000 0fe:00000 libkdesu.so.4.2.0
4066c000 68 r-x-- 0000000000000000 0fe:00000 libkwalletclient.so.1.0.0
4067d000 4 rw--- 0000000000011000 0fe:00000 libkwalletclient.so.1.0.0
4067e000 4 rw--- 000000004067e000 000:00000 [ anon ]
4067f000 2148 r-x-- 0000000000000000 0fe:00000 libkdecore.so.4.2.0
40898000 64 rw--- 0000000000219000 0fe:00000 libkdecore.so.4.2.0
408a8000 8 rw--- 00000000408a8000 000:00000 [ anon ]
... (trimmed) ...
mapped: 25404K writeable/private: 2432K shared: 0K

I cut out a lot of the output; the rest is similar to what is shown. Even without the complete output, we can see some very interesting things. One important thing to note about the output is that each shared library is listed twice; once for its code segment and once for its data segment. The code segments have a mode of "r-x--", while the data is set to "rw---". The Kbytes, Mode, and Mapping columns are the only ones we will care about, as the rest are unimportant to the discussion.

If you go through the output, you will find that the lines with the largest Kbytes number are usually the code segments of the included shared libraries (the ones that start with "lib" are the shared libraries). What is great about that is that they are the ones that can be shared between processes. If you factor out all of the parts that are shared between processes, you end up with the "writeable/private" total, which is shown at the bottom of the output. This is what can be considered the incremental cost of this process, factoring out the shared libraries. Therefore, the cost to run this instance of KEdit (assuming that all of the shared libraries were already loaded) is around 2 megabytes. That is quite a different story from the 14 or 25 megabytes that ps reported.

What does it all mean?
The moral of this story is that process memory usage on Linux is a complex matter; you can't just run ps and know what is going on. This is especially true when you deal with programs that create a lot of identical children processes, like Apache. ps might report that each Apache process uses 10 megabytes of memory, when the reality might be that the marginal cost of each Apache process is 1 megabyte of memory. This information becomes critial when tuning Apache's MaxClients setting, which determines how many simultaneous requests your server can handle (although see one of my past postings for another way of increasing Apache's performance).

It also shows that it pays to stick with one desktop's software as much as possible. If you run KDE for your desktop, but mostly use Gnome applications, then you are paying a large price for a lot of redundant (but different) shared libraries. By sticking to just KDE or just Gnome apps as much as possible, you reduce your overall memory usage due to the reduced marginal memory cost of running new KDE or Gnome applications, which allows Linux to use more memory for other interesting things (like the file cache, which speeds up file accesses immensely).