2008-10-25

mono+mysql 出现 EntryPointNotFoundException: CreateSemaphore

今天试着在 Mono 中使用 mySql 的连接驱动 "MySql.Data.dll" 时出现异常:

System.EntryPointNotFoundException: CreateSemaphore
at (wrapper managed-to-native) MySql.Data.Common.Semaphore:CreateSemaphore (MySql.Data.Common.SECURITY_ATTRIBUTES&,int,int,string)
at MySql.Data.Common.Semaphore..ctor (Int32 initialCount, Int32 maximumCount) [0x00000]
at (wrapper remoting-invoke-with-check) MySql.Data.Common.Semaphore:.ctor (int,int)
at MySql.Data.MySqlClient.MySqlPool..ctor (MySql.Data.MySqlClient.MySqlConnectionString settings) [0x00000]
at MySql.Data.MySqlClient.MySqlPoolManager.GetPool (MySql.Data.MySqlClient.MySqlConnectionString settings) [0x00000]
at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000]
google 后发现 似乎时需要在连接字符串中设置 "Pooling=false"
private const string CONNECTION_STRING = "server={0};database={1};uid={2};pwd={3};Pooling=false;";
这样就正常了。
原因还不清楚……

//EOF Read More...

2008-10-14

OpenOffice 3.0 在 KDE 下的一点小问题

3.0速度快了很多,感觉很爽!
但是有个小问题,就是:
“Tools”等几个菜单项选中的时候会挂掉(Arch 的 KDE4桌面环境)
解决方法:
export OOO_FORCE_DESKTOP=gnome
就好了,据说是因为3.0里面没有支持KDE的主题所致。
//EOF Read More...

2008-10-08

DIV+CSS 布局时要注意的

左右浮动分栏布局时要记得清除浮动,否则下面的东西会上来哦!
在一行的浮动,之后不需要浮动的时候,记得在中间加上一个清除浮动层:

<div style="clear:both;line-height:0;height:0;font-size:0;"></div>
或:
.clear {clear:both;line-height:0;height:0;font-size:0;}
...
<div class="clear"></div>

例:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>双栏</title>
<style type="text/css">

body {
    text-align: center;
}

#body {
    text-align: left;
    width: 95%;
    margin: 0pt auto;
    min-width: 640px; /* IE6 不支持 */
}

#header {
    background-color: #def;
}

#content {
    
}

.left {
    float: left;
    width: 20%;
}

.right {
    float: left;
    width: 80%;
}

#foot {
    font-size: .8em;
    color: #999;
    text-align: center;
}

#header, #content, #foot {
}

p, h1 {
    margin: 0pt;
    padding: 5pt;
}

*, body {
    font-family: "Verdana", Geneva, Sans-Serif;
    /*font-size: 10pt;*/
}

</style>
<script type="text/javascript">

</script>
    </head>
    <body>
<div id="body">
        <div id="header">
            <h1>Header</h1>
            <p>this is the header</p>
        </div>
        <div id="content">
            <div class="left">
                <p>Left</p>
                <p>Left</p>
                <p>Left</p>
                <p>Left</p>
                <p>Left</p>
                <p>Left</p>
                <p>Left</p>
                Left
            </div>
            <div class="right">
                <p>Right</p>
                <p>Right</p>
                <p>Right</p>
                Right<br />
                Right<br />
                Right<br />
            </div>
        </div>
        <!-- 去掉下面这行试试 -->
        <div style="clear:both;line-height:0;height:0;font-size:0;"></div>
        <div id="foot">
            Copyright &copy; 2008, h_Davy; Powered by: VIM;
        </div>
</div>
    </body>
</html>

//EOF Read More...

2008-10-05

一些字节的单位

如下是一些存储中用到的单位,及其换算:

bit, Byte, KiloByte(KB,KiB), MegaByte(MB,MiB), GigaByte(GB,GiB), TeraByte(TB,TiB),
PetaByte(PB,PiB), ExaByte(EB,EiB), ZettaByte(ZB,ZiB), YottaByte(YB,YiB)

  • 1 bit
  • 8 bits = 1 Byte (on most systems)
  • 1024 bytes = 1 KiloByte (KBytes or KB or KiB)
  • 1024*1024 bytes = 1024 KB = 1 MegaByte (MBytes or MB or MiB)
  • 1024*1024*1024 bytes = 1024*1024 KB = 1024 MB = 1 GigaByte (GBytes or GB or GiB)
  • 1024*1024*1024*1024 bytes = 1024*1024*1024 KB = 1024*1024 MB = 1024 GB = 1 TeraByte (TBytes or TB or TiB)
  • 1024*1024*1024*1024*1024 bytes = 1024*1024*1024*1024 KB = 1024*1024*1024 MB = 1024*1024 GB = 1024 TB = 1 PetaByte (PBytes or PB or PiB)
  • 1024*1024*1024*1024*1024*1024 bytes = 1024*1024*1024*1024*1024 KB = 1024*1024*1024*1024 MB = 1024*1024*1024 GB = 1024*1024 TB = 1024 PB = 1 ExaByte (EBytes or EB or EiB)
  • 1024*1024*1024*1024*1024*1024*1024 bytes = 1024*1024*1024*1024*1024*1024 KB = 1024*1024*1024*1024*1024 MB = 1024*1024*1024*1024 GB = 1024*1024*1024 TB = 1024*1024 PB = 1024 EB = 1 ZettaByte (ZBytes or ZB or ZiB)
  • 1024*1024*1024*1024*1024*1024*1024*1024 bytes = 1024*1024*1024*1024*1024*1024*1024 KB = 1024*1024*1024*1024*1024*1024 MB = 1024*1024*1024*1024*1024 GB = 1024*1024*1024*1024 TB = 1024*1024*1024 PB = 1024*1024 EB = 1024 ZB = 1 YottaByte (YBytes or YB or YiB)

参考:http://en.wikipedia.org/wiki/Byte

//EOF Read More...

2008-10-02

使用 vim, ctags 来记带书签的笔记

个人比较偏好纯文本的记录,因为不管何种严苛的条件下只要能查看文本文档就能够读取。
(当然某些特殊的笔记还是需要依靠富文本才能完成的)

在某些时候希望这些纯文本的记录能够带上书签就更好了——特别是当这些记录日渐积累过多的时日——能够带上目录索引就更好了。

记得 vim 的help文档么?都是纯文本文件,但是它有带书签、索引的特性跳来跳去,并且还带少量高亮。

看来仅依靠 vim 自带的这个功能就可以做到了。

如何做呢?
只需在每个文本文档末尾加上:

 vim:ft=help

就能让 vim 在读取该文档后按照vim help来解析。

仅仅这样么?
还不够!
那么如何能够让 vim 在文本中支持书签功能呢?
随便打开一个vim的帮助文档看看就知道了。

通过两个"*"括起来的字符来锚定书签,
通过两个"|"括起来的字符来索引书签。
如:

索引 |the_first_bookmark|
书签 *the_first_bookmark*

在“索引”后面的"the_first_bookmark"上面Ctrl+]来跳转到
“书签”后面的"the_first_bookmark"所在位置,
然后按Ctrl+T(或Ctrl+O)可以跳回原来的“索引”后的"the_first_bookmark"所在位置。
还能支持不同文件之间的书签跳转,当然前提是书签不能够重名!!!

什么?不能跳,提示没有“tag”文件?
哦!忘记说了,还有条vim的命令:
:helptags .

表示构建当前目录下的*.txt文件的vim help tag索引。
能否构建成功关键是看你的系统里面是否有ctags程序(一般开发用Linux都会有的)
没有的话可以到 http://ctags.sf.net/ 去下载(有Windows版本)

要注意的是:
书签的命名规则,字符串中间不要有空格,不要有除"_"之外的符号。
还有就是当前目录下不要有重名的书签——就是说所有"*"中间的字符串们不要有重复的。


其他:
分隔行,支持如下三种高亮分隔行(内容分块显示,看起来更清晰):

---------------------------------------------------------------------------
===========================================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

感兴趣的话,还可以玩玩ASCII艺术。


总结如下:

  1. 文件结尾 vim解析标识:
     vim:ft=help

  2. "*"中间的字符串锚定命名书签

  3. "|"中间的字符串索引到指定命名的书签

  4. 构建tags索引:
    :helptags .



//EOF Read More...