公告板
预览模式: 普通 | 列表

解决了 RichTextBox中 —— 变 -- 的问题

RichTextBox中 —— 会解析为"\emdash"
默认的 ctrl+c ctrl+v复制粘贴后会编程英文的中划线。csdn发帖后未果,有人会出现,有人不出现。估计还是.net framework的问题


自己屏蔽掉系统的 ctrl+c ctrl+v 及重写 richtextbox的  Text属性

        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.C) //默认的 复制 “——” 时自动转成了--
            {
                this.CopyClick(null,null);//调用右键菜单上的复制

                base.OnKeyDown(e);
                e.Handled = true;
            }
        }



        public override string Text
        {
            get
            {
                return this.TextStr;
            }
            set
            {
                base.Text = value;
            }
        }
        private string TextStr = "";

Since the above wiki doucmentation is unclear to anyone not versed in Visual C++ incantations (if you're just a managed environment .NET developer like me you're basically screwed) I've fluffed it up a bit here. I took the following steps to compile tesseract with compressed/multipage TIFF support under a Windows 7 64 Bit system.

1. Download tesseract 2.04. Unpack it. In this example I've unpacked to C:\projects\tesseract-2.04. Windows 7 still doesn't understand .tar.gz out of the box. My recommendation is to get a copy of 7-Zip.

2. Download your required language files. I need german and english. I unpack these to the tessdata subdirectory of C:\projects\tesseract-2.04\tessdata.

3. Install libtiff. On my (64 bit) system the suggested install directory is C:\Program Files (x86)\GnuWin32?. Underneath this directory are a bunch of subdirectories containing files we'll need to compile tesseract with tiff support, namely include, bin and lib.

4. Add C:\Program Files (x86)\GnuWin32?\bin to your PATH environment variable so that the output tesseract.exe can find the libtiff dll. Restart.

5. Open the vc solution (tesseract.sln)

6. Change the solution configuration to "Release" mode. Note that if you later change back to Debug mode, you'll need to set up all the following again...

7. In the solution explorer right click the solution node (Solution 'tesseract') and click "Properties". Change to "Configuration Properties" and select "Release" configuration from the dropdown at the top of the window. Navigate to: Tools -> Options -> Projects and Solutions -> VC++ Directories Here we'll be adding the full paths for the subdirectories lib and include from the libtiff install so that VC can find the required header (.h) and static library (.lib) files. In this example they are: $(ProgramFiles?)\GnuWin32?\include $(ProgramFiles?)\GnuWin32?\lib as I'm using an environment variable. I could however just have written them as C:\Program Files (x86)\GnuWin32?\include.

Change the "Show Directories For" dropdown to "Include files". Add the following: $(ProgramFiles?)\GnuWin32?\include

Now change the "Show Directories For" dropdown to "Library files". Add the following: $(ProgramFiles?)\GnuWin32?\lib

8. Now open the project properties window for the tesseract project (not the solution). In the solution explorer right click the tesseract project and click properties. Navigate the horrendous list of options to Configuration Properties -> C/C++ -> Preprocessor and add HAVE_LIBTIFF to the list of Preprocessor Definitions. This causes a bunch of #includes to be enabled in the code.

9. You also want to add an "Additional dependancy". go to the "Additional dependancies" section for the project properties and add libtiff.lib.

10. Build the solution. Watch the error list. If you get a bunch of LNK2109 errors, that means the linker can't find something tesseract references. You're missing a reference to one of the paths from libtiff. If you get an error mentioning mt.exe, you've possibly encountered a bug in the sdk. Just try building again. see http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=106634 for more info.

If/when the solution builds successfully, you'll have a tesseract.exe file in the same directory as the tesseract solution file. drag you multipage compressed tiff here and try running tesseract. for example, if your tiff is called in.tif and you want to output text to out.txt, and the documents' language is german then your command line would look like:

tesseract.exe in.tif out -l deu The output file will have .txt appended to it by tesseract. If you're just translating english text then you can leave off the -l option, as tesseract assumes "eng" if you don't specify anything. If your tif file has the file extension .tiff, then tesseract will crap itself thusly:

C:\projects\tesseract-2.04>tesseract.exe in.tiff out -l deu Tesseract Open Source OCR Engine name_to_image_type:Error:Unrecognized image type:in.tiff IMAGE::read_header:Error:Can't read this image type:in.tiff tesseract.exe:Error:Read of file failed:in.tiff

Hopefully (fingers crossed, heh) you've now got an OCR'd out.txt file sitting in C:\projects\tesseract-2.04.

Mysql查询优化

三个语句,做了三次测试,差别还是比较明显。


Select * From locoy1 Where ID>=(
Select Max(ID) From (
 Select ID From locoy1  Order By ID limit 90001
) As tmp
) limit 29;


查询花费 0.0938 秒,0.0529 秒, 0.1050 秒



*****************************************************************************

Select * From locoy1  Where ID>=(
Select Max(ID) From (
 Select ID From locoy1 Order By ID limit 90000,1
) As tmp
) limit 29;

查询花费 0.0304 秒, 0.0201 秒, 0.0882秒


*****************************************************************************


Select * From locoy1   Where 1 limit 90001,29;

查询花费 0.1350 秒, 0.0677 秒, 0.2183 秒

宝宝13个月的照片


 

快要过年回家了,把宝宝上个月拍的照片得多冲印一些带回老家去,顺带发上来给大家瞅瞅。
朋友说照的效果不错,关键是宝宝长得帅~~

centos 5.x系统大内存识别方法

新的服务器,内存给折腾了很久,8500E和10600R不能混用,换10600E后,共加上8G内存,但只识别3.2G,
网上查询后发现是要升级32位的内核补丁,方法如下:

# yum install kernel-PAE
# vi /boot/grub/grub.conf

如果看到如下代码 代表PAE内核已经安装好了
title CentOS (2.6.18-8.1.4.el5PAE)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-8.1.4.el5PAE ro root=LABEL=/
        initrd /initrd-2.6.18-8.1.4.el5PAE.img
修改设置为默认启动
default=0

# reboot


同时要进BIOS设置保存一下。free -m 显示8G.完成

vs2005打开vs2008开放的.net2.0项目常见问题

1.
  编辑.sln文件 替换vs2008为vs2005,Version 10.00 为 Version 9.00

2.常见请确认 <Import> 声明中的路径正确,且磁盘上存在该文件。 提示“未找到导入的项目“$:\Boo.Microsoft.Build.targets”。请确认   <Import>   声明中的路径正确,且磁盘上存在该文件。

解决办法:将项目文件(.csproj)用记事本打开,然后找到<Import >节点,作如下操作:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
替换为:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

这样问题就解决!

Linux 下 apache 实现可接受中文文件名的请求

1.下载mod_encoding并打补丁包:
# wget -c http://webdav.todo.gr.jp/download/mod_encoding-20021209.tar.gz
# wget -c http://webdav.todo.gr.jp/download/experimental/mod_encoding.c.apache2.20040616
解压mod_encoding-20021209.tar.gz
将新版本mod_encoding.c 覆盖到mod_encoding-20021209
# cp mod_encoding.c.apache2.20040616 mod_encoding-20021209/mod_encoding.c

这里必须要打一个apache 2.2的补丁。否则make也会出apxs rc=65536 之类的错误。
# wget http://www.aconus.com/~oyaji/faq/mod_encoding.c-apache2.2-20060520.patch
# cd mod_encoding-20021209
# patch -p0 < mod_encoding.c-apache2.2-20060520.patch


2.安装iconv-hook
# cd mod_encoding-20021209/lib
# ./configure --prefix=/usr
# make
# make install
# ldconfig

3 生成mod_encoding.so

./configure --with-apxs=/opt/apache2.2/bin/apxs --with-iconv-hook=/usr/include
make
gcc -shared -o mod_encoding.so mod_encoding.o -Wc,-Wall -Llib -liconv_hook

cp mod_encoding.so /opt/apache2.2/modules

4. 配置apache 2.2

#LoadModule headers_module modules/mod_headers.so
LoadModule encoding_module modules/mod_encoding.so
#<IfModule mod_headers.c>
#Header add MS-Author-Via "DAV"
#</IfModule>
<IfModule mod_encoding.c>
EncodingEngine on
NormalizeUsername on
SetServerEncoding GBK
DefaultClientEncoding UTF-8 GBK GB2312
AddClientEncoding "(Microsoft .* DAV $)" UTF-8 GBK GB2312
AddClientEncoding "Microsoft .* DAV" UTF-8 GBK GB2312
AddClientEncoding "Microsoft-WebDAV*" UTF-8 GBK GB2312
</IfModule>

·此地為某只的個人YY之地,言論僅代表自己的個人觀點,和現實、社會、政治完全沒關係,沒事請不要在此惹事生非。
·若要轉載本blog内容請註明轉載地址和作者名字,禁止無權轉載/盜鏈等無恥行爲。
·如有轉載侵權請聯系刪除。
·謝謝合作。^_^