<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar/8638045102788407707?origin\x3dhttp://micro1o.blogspot.com', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

(转贴)Ubuntu下优化交换分区 2008年12月30日 |

转贴自 OwnLinux.cn

[感谢 3k背景辐射 撰文]写在前面的话:我最近把我只有512M的老爷机加了一跟512M的的内存。但是我发现,当机器运行一段时间后越来越慢,一看系统监视器发现swap 里面居然驻留了200M的数据,我想:好你个乌斑兔儿,居然好好的物理内存你不吃,来吃swap!所以,自己就准备对它进行点点“教育”。

在ubuntu里面,swappiness的值的大小对如何使用swap分区是有着很大的联系的。swappiness=0的时候表示最大限度使用物理内存,然后才是swap空间,swappiness=100的时候表示积极的使用swap分区,并且把内存上的数据及时的搬运到swap空间里面。两个极端,对于ubuntu的默认设置,这个值等于60,建议修改为10。具体这样做:
1.查看你的系统里面的swappiness
$ cat /proc/sys/vm/swappiness

不出意外的话,你应该看到是 60
2.修改swappiness值为10
$ sudo sysctl vm.swappiness=10

但是这只是临时性的修改,在你重启系统后会恢复默认的60,所以,还要做一步:
$ gksudo gedit /etc/sysctl.conf

在这个文档的最后加上这样一行:
vm.swappiness=10

然后保存,重启。ok,你的设置就生效了。你会发现,现在乌斑兔儿跑得更快了!
当然,你可以用其他编辑器进行修改,如kate,vi,vim,nano……只需要把gedit替换成它们就ok了!因为考虑到大多数人都用的gnome桌面,就写的gedit。

ps:我找这个问题花了很多时间,在中国的网页上基本没发现答案,最后在help.ubuntu.com上终于发现了它,因此把它简要的翻译出来,供大家参考参考…
原文地址 https://help.ubuntu.com/community/SwapFaq

Performance tuning with ''swappiness''

The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and on to the swap disk. As disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.
  • swappiness can have a value of between 0 and 100
  • swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible
  • swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache
  • Ubuntu uses a default setting of swappiness=60

Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable.

How to check the swappiness value
cat /proc/sys/vm/swappiness


How to change the swappiness value

A temporary change (lost on reboot) with a swappiness value of 10 can be made with:
sudo sysctl vm.swappiness=10

To make a change permanent, edit the configuration file with your favorite editor:
gksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:
vm.swappiness=10

Save the file and reboot.

标签: ,

ubuntu 8.04/8.10 FLASH 中文显示 2008年12月25日 |

修改/etc/fonts/conf.d/49-sansserif.conf,下面文件内容中加粗部分,改为需要的中文字体。

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
  If the font still has no generic name, add sans-serif
 -->
    <match target="pattern">
        <test qual="all" name="family" compare="not_eq">
            <string>sans-serif</string>
        </test>
        <test qual="all" name="family" compare="not_eq">
            <string>serif</string>
        </test>
        <test qual="all" name="family" compare="not_eq">
            <string>monospace</string>
        </test>
        <edit name="family" mode="append_last">
            <string>WenQuanYi Zen Hei</string>
        </edit>
    </match>
</fontconfig>


该文件是对没有基本的字体名称(sans-serif/serif/monospace)的字体添加一个字体。由于FLASH没有指定显示的字体,因此此文件起作用。

标签: , ,

(转贴)ubuntu 8.10字体配置大略 |

Ironflower
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://ironflower.blogbus.com/logs/31662528.html


我写这篇东西源自长久以来按图索骥的配置字体,昨天登录时试着把locale改成中文,结果字体变成了最难看的那种。非常不爽,只好开始用font关键字来找配置。运气好,发现所有的字体配置信息都在手册FONTS-CONF(5)里。

在线版本在http://fontconfig.org/fontconfig-user.html,从风格来看fontconfig应该是freedesktp的一部分。本地的手册:

$ man fonts-config

手册是这么说的:

--------------------------------------

/etc/fonts/fonts.conf
/etc/fonts/fonts.dtd
/etc/fonts/conf.d
~/.fonts.conf


Fontconfig是一个设计用来提供系统范围内的字体设置,定制和应用程序访问的库。

它包含两个基本部分:
1、配置模块:从XML文件生成内部格式的配置
2、匹配模块:接受字体模式并返回最接近的字体

----------------------------------------

我是懒人加上手册太长,知道这两点后所以决定猜测具体的配置过程。

/etc/fonts/fonts.conf是字体配置的总入口,如里面注释所说,没有特别原因不改为妙。来看看内容。

<dir>/usr/share/fonts</dir>
<dir>~/.fonts</dir>


这里很显然,是我们字体存放目录,而且会递归的扫描子目录。我们自己的可以放在~/.fonts里 ;-P

<cachedir>/var/cache/fontconfig</cachedir>


放缓存的目录。。。恩,什么的缓存呢?目录名为fontconfig,应该是这些XML配置文件的缓存吧,而且既然手册里说把XML转化为内部的配置,缓存文件应该用的就是内部格式。注意到/var/cache/fontconfig里的文件数目正好和/etc/fonts/conf.d里的文件数目相等,恩,猜测更有信心了:)

d@onepiece:~$ ls .fontconfig/
cabbd14511b9e8a55e92af97fb3a0461-x86.cache-2
d@onepiece:~$ ls /var/cache/fontconfig/cabbd14511b9e8a55e92af97fb3a0461-x86.cache-2


上面的说明了用户级别的配置缓存放在~/.fontconfig里,而系统级别的在这些系统字体配置文件被改动后,自动生成放在/var/cache /fontconfig中。如果在字体设置的界面中改变了什么东西的话,放在~/.fontconfig里。diff上面两个文件,完全相同。

不过此缓存和另一个命令:fc-cache -s -v(刷新字体缓存)做的事情不一样,见fc-cache手册。

<!--
  Accept deprecated 'mono' alias, replacing it with 'monospace'
-->

        <match target="pattern">
                <test qual="any" name="family">
                        <string>mono</string>
                </test>
                <edit name="family" mode="assign">
                        <string>monospace</string>
                </edit>
        </match>


这段有注释,说是把已被废弃使用的mono(字体别名)用monospace代替,恩,为了怕万一某些程序还是编码了老的别名进去,做个防护处理,把有可能的老别名统一替换为新别名。这是个很有代表性的匹配。

<!--
  Load local system customization file
-->
        <include ignore_missing="yes">conf.d</include>


这个对我们很重要,需要定制的内容都放在这个目录下。

<!--
  Rescan configuration every 30 seconds when FcFontSetList is called
 -->
                <rescan>
                        <int>30</int>
                </rescan>


每隔30自动刷新一遍,也就是说改动了某个配置文件会最多30秒后自动生效(我的conf.avail目录里有个多余的文件,把它删了,过了会儿屏幕闪了下,恩,说明重读配置了;-)

我们看那个/etc/fonts/conf.d目录,这个目录里都是指向/etc/fonts/conf.avail里文件的符号链接。这样可以灵活的决定包括哪个,排除哪儿,只要新建或者删除链接就行了。

读README总是个好习惯,告诉我们这是按照字母顺序一个个包括进去的,后包括的应该会覆盖前面的配置-至少对匹配来说,把一个匹配的模式想成一个哈希表的键?这点其实对实际配置意义不大。

 Files begining with:   Contain:
 
 00 through 09          Font directories
 10 through 19          system rendering defaults (AA, etc)
 20 through 29          font rendering options
 30 through 39          family substitution
 40 through 49          generic identification, map family->generic
 50 through 59          alternate config file loading
 60 through 69          generic aliases, map generic->family
 70 through 79          select font (adjust which fonts are available)
 80 through 89          match target="scan" (modify scanned patterns)
 90 through 99          font synthesis


我们挑典型来看。

00-09:定义字体目录的,在我的8.10系统上没有,前面都定义完了

10-19:系统渲染的默认配置

有五个文件:

10-antialias.conf
10-hinting.conf
10-hinting-medium.conf
10-no-sub-pixel.conf
11-lcd-filter-lcddefault.conf

这基本对应菜单的System->Preferences->Appearance-> "Fonts" 的"Rendering"配置,不过改动界面里的,我们改动了自己家目录里的缓存,而不是这些系统文件。这些文件的内容也很容易理解。

20-29:字体渲染选项,随便看一个:20-unhint-small-vera.conf

其实里面的注释很清楚,不过还是具体看配置是咋样的。。

        <match target="font">
                <test name="family">
                        <string>Bitstream Vera Sans</string>
                </test>
                <test name="pixelsize" compare="less">
                        <double>7.5</double>
                </test>
                <edit name="hinting">
                        <bool>false</bool>
                </edit>
        </match>


用<test>来匹配了两个属性,都符合的话就把hinting关闭。。。

看来20-29是对特定字体的渲染设置的定制。要是有哪个字体不想使用默认的渲染设置(10-19里设置的),就在这里定制下。

30-39:字体家族替换

        <alias>
                <family>SimSun</family>
                <family>NSimSun</family>
                <family>SimSun-18030</family>
                <family>NSimSun-18030</family>
                <family>AR MingtiM GB</family>
                <accept><family>AR PL UMing CN</family></accept>
                <accept><family>AR PL ShanHeiSun Uni</family></accept>
        </alias>


上面的的片段里1。prefer,2。accept,3。default都行,这样如果match了Simsun别名,那么就会1放在match的别名里,2放在match的别名后,default放在最后。

40-49:字体的映射,好像44-wqy-zenhei.conf 放错了地方,这个应该放在20-29里。典型的是49-sansserif.conf。

        <match target="pattern">
                <test qual="all" name="family" compare="not_eq">
                        <string>sans-serif</string>
                </test>
                <test qual="all" name="family" compare="not_eq">
                        <string>serif</string>
                </test>
                <test qual="all" name="family" compare="not_eq">
                        <string>monospace</string>
                </test>
                <edit name="family" mode="append_last">
                        <string>sans-serif</string>
                </edit>
        </match>


50-59:装载别的配置文件,在网上指南里常看到的language-selector.conf, ~/.fonts.conf,local.conf等。

60-69:别名,定义所有的别名。

70-79:调整哪些字体可以被用

80-89:这个需要了解<match target="scan">的用处,回头看。

90-99:字体综合,针对字体的配置,改动特定字体的配置。

----------------------------------------

话说回来,要改成用黑体,不管是STHeiti,或者WenQuanYi Zen Hei,只要改动69-language-selector-zh-cn.conf。把STHeiti/WenQuanYi Zen Hei如法炮制的放在AR PL UMing CN的前面。

对单纯的配置来说,这大概就行了。

标签: ,

Excel金额大小写转换公式 2008年12月12日 |

=IF(ROUND(G8,2)<0,"无效数值",IF(ROUND(G8,2)=0,"零",IF(ROUND(G8,2)<1,"",TEXT(INT(ROUND(G8,2)),"[dbnum2]")&"元")&IF(INT(ROUND(G8,2)*10)-INT(ROUND(G8,2))*10=0,IF(INT(ROUND(G8,2))* (INT(ROUND(G8,2)*100)-INT(ROUND(G8,2)*10)*10)=0,"","零"),TEXT(INT(ROUND(G8,2)*10)-INT(ROUND(G8,2))*10,"[dbnum2]")&"角")&IF((INT(ROUND(G8,2)*100)-INT(ROUND(G8,2)*10)*10)=0,"整",TEXT((INT(ROUND(G8,2)*100)-INT(ROUND(G8,2)*10)*10),"[dbnum2]")&"分")))


注:“G8”是Excel表格中金额小写所在的单元格,各人使用时只需修改下小写所在单元格位置即可.
例1、56137.16 → 伍万陆仟壹佰叁拾柒元壹角陆分
例2、760090.40 → 柒拾陆万零玖拾元肆角整

----转自财务经理人Henry网友


shenboo@ExcelHOME

附一个我做的人民币大写公式吧,在我的机器上是没有问题的,可是有些机器上就不行。

SUBSTITUTE(IF(TRUNC(单元格)=0,IF(MID(单元格,LEN(TEXT(单元格,"0.00"))-1,1)="0","",TEXT(MID(单元格,LEN(TEXT(单元格,"0.00"))-1,1),"[DBNUM2]") & "角") & IF(RIGHT(TEXT(单元格,"0.00"),1)="0","",TEXT(RIGHT(TEXT(ROUND(单元格,2),"0.00"),1),"[DBNUM2]")&"分"), IF(TRUNC(单元格)=单元格,TEXT(TRUNC(单元格),"[DBNUM2]")&"元",TEXT(TRUNC(单元格)," [DBNUM2]")&"元" & IF(MID(单元格,LEN(TEXT(单元格,"0.00"))-1,1)="0","零",TEXT(MID(单元格,LEN(TEXT(单元格,"0.00"))-1,1),"[DBNUM2]") & "角") & IF(RIGHT(TEXT(单元格,"0.00"),1)="0","",TEXT(RIGHT(TEXT(ROUND(单元格,2),"0.00"),1),"[DBNUM2]")&"分"))),"-","负")


上面两个主要使用的TEXT函数,这个函数里面重要的就是第二个参数format_text。

相关的文章:

标签: , ,

编译kvm时选择需要编译的音频驱动 2008年12月4日 |

  使用kvm作为虚拟机安装windows系统,速度感觉很快,但是音频老是有问题:在进入虚拟机使用声卡后,外面的ubuntu不能够播放音乐。使用参数-audio-help查询支持的音频输出有哪些,发现有alsa、oss、wav等。依次alsa、oss作为输出使用都是类似的问题,差点就放弃使用声卡。由于ubuntu 8.10使用PulseAudio作为系统的声音服务,能够支持多个应用程序播放音频,就想kvm是否支持PulseAudio输出呢?Google之后发现从kvm 71开始支持,参考官方wiki中的编译方法:
tar xzf kvm-release.tar.gz
cd kvm-release
./configure --prefix=/usr/local/kvm
make
sudo make install
sudo /sbin/modprobe kvm-intel
# or: sudo /sbin/modprobe kvm-amd

  编译安装之后,查询还是没有支持PulseAudio输出。于是,用./configure --help查询编译参数,里面没有提及声音驱动的设置。进一步查看configure的源代码,发现里面还设置了qemu目录下文件编译的参数,所以在qemu目录下面,执行./configure --help发现有了声音驱动的参数设置:
--audio-drv-list=LIST set audio drivers list:
Available drivers: oss alsa sdl esd pa fmod

  编译使用参数--audio-drv-list="alsa oss pa",其中pa表示PulseAudio。编译安装后,配置参数export QEMU_AUDIO_DRV=pa使用PulseAudio输出成功解决问题,但是好像稳定性有问题,在虚拟机下面播放音频关闭后,会莫名奇妙的跳出。

标签: , ,

FFSJ: The Fastest File Splitter and Joiner v3.3 号称最快的文件分割、合并工具 2008年12月1日 |


  现在文件越来越大的,尤其是音、视频文件,常常需要将文件分成多个比较小的文件通过网盘等进行分享。使用压缩软件,速度比较慢;最简单高效的方法就是将文 件分割。这个软件就是实现这个功能,号称比其他相同功能的软件HJ-Split, WinSplit, MasterSplitter快3到5倍。
  • 分割:可以指定分割的块数(即指定分割成几部分),也可以指定分割后每部分文件大小
  • 合并:支持在不同路径下的分割后文件合并成一个文件


FFSJ is...

Very fast: FFSJ can optimize disk-cache and memory usage, this makes FFSJ 3-5 times faster than HJ-Split, WinSplit, MasterSplitter in both splitting and joining tasks. Of course, it is much faster than any compression program.

Simple: FFSJ works well on all Windows platforms. FFSJ-Lite doesn't need any requirement of installations or complicated DLLs. FFSJ-Standard has only one simple installation package for integrating FFSJ into shell context menu.
FFSJ能在所有windows平台下使用,分为两个版本:FFSJ-Lite是单个文件,直接运行就可以使用;FFSJ-Standard是个安装包,除了包含FFSJ-Lite外,在资源管理器增加了右键菜单,方便使用。


Small: Both FFSJ-Lite and FFSJ-Standard editions are small enough to fit on a floppy disk.

Easy to use: FFSJ has a friendly user-interface, it can be used to split any file. FFSJ-standard can also create its shell context menus in order to perform splitting and joining tasks directly from Windows Explorer.

Easy to be integrated: Since v3.0, FFSJ published its command-line interface. End-users can split/join multiple files using a .BAT file. Developers can write their own interface (in any language) to perform splitting/joining tasks from their applications.
FFSJ支持命令行模式,可以使用在批处理文件中。

Secure: FFSJ uses an advanced encryption algorithm to make your data much more secure from unauthorized access. Since v2.9, MD5 checksum algorithm has also been integrated to verify data integrity.
支持加密。包含MD5校验功能,方便检查合并后文件是否正确、完整。


Compatible: FFSJ can join parts produced by HJ-Split.
兼容HJ-Split,可以合并HJ-Split分割的文件。

Free and Safe: FFSJ-Lite and FFSJ-Standard are free and clean, both editions do not contain any form of adwares, spywares, viruses, trojans and backdoors.
关键是软件免费,不包含任何广告、后门、病毒、木马等等 :)


官网下载:http://www.jaist.ac.jp/~hoangle/filesj/

标签: , , ,