Tags » 技术笔记

A powerful parser for Java and Android: Jparsec

Today I want to talk about a powerful Java parser: Jparsec (http://jparsec.codehaus.org/). I recently used it for one of my projects and found it really helpful. 823 more words

Java

TSQL: Search keyword in XML Column

Sometimes you would need to search certain keyword inside a XML column using a like clause, here is a simple example:

SELECT XmlColumn, OtherColumns FROM TableWithXmlColumn
WHERE cast(XmlColumn as varchar(max)) LIKE '%keyword%'
… 10 more words
技术笔记

关于二分查找(Binary Search)及其变种形式的总结

二分查找是基本算法,但是据统计只有10%的程序员可以写出没有bug的代码。出错的原因主要集中在对边界值得选择和判定条件上,一不小心就可能导致超出边界或者死循环的情况。这里作如下总结:

标准版二分查找:
在有序(非降序)数组中查找一个target值,数组中元素没有重复,找到target则返回该元素对应的index,找不到则返回-1。

注意1:如果是start < end,那么当target等于num时,会找不到该值。 注意2:因为num > target, 所以如果有num == target, index一定小于mid,能不能写成end = mid呢?举例来说:num = {1, 2, 5, 7, 9}; 如果写成end = mid,当循环到start = 0, end = 0时(即num = 1, num = 1时),mid将永远等于0,此时end也将永远等于0,陷入死循环。也就是说寻找target = -2时,程序将死循环。 447 more words

Binary Search

在命令行快速切换目录

原文链接:http://blogread.cn/it/article/6648?f=wb
今天在微博上看到一个用命令行快速切换目录的文章,比之前自己的解决方案好了非常多,必须记录下来分享下。

每天在命令行下,一大部分的工作都是一遍又一遍的输入 cd ~/some/very/deep/often-used/directory这样来切换目录,现在利用一个简单的配置可以实现如下效果:

首先进入我的日常工作目录,标记一个书签mark sanguo

cd /Users/kimi/work/123guo/sanguo
mark sanguo
以后我再进入这个目录只需要g sanguo即可
g sanguo

通过输入gs指令来浏览所有的标签
gs
#app -> /Applications
#sanguo -> /Users/kimi/work/123guo/sanguo
#web -> /Library/WebServer/Documents… 113 more words

技术笔记

Microsoft SQL Server - Search specified column or table in all database at a DB Server

In a development environment normally there are multiple databases installed at one DB Server, and there is a system store procedure called: “sp_msforeachdb” can help us to search a specified column or table easily in these different databases(or other tasks need to be done in different DBs), and here are the sample script: 185 more words

技术笔记

GitHub Tips

  1. Config GitHub with Putty/Pageant
    1. Install Putty from here, run PuTTY.exe and create a new SSH session to “github.com’ and save it
    2. Run PUTTYGEN.EXE generate a pair of public/priviate key pair, copy the public key content to a text file(like ‘yourpublickey.txt’), save the private key to a text file(like ‘yourprivatekey.ppk’) at the same folder(like: c:\ssh)
  2. 144 more words
技术笔记

Very useful windows shortcuts which can run from command line or explorer

Run commands

Calc – Calculator
Cfgwiz32 – ISDN Configuration Wizard
Charmap – Character Map
Chkdisk – Repair damaged files
Cleanmgr – Cleans up hard drives… 385 more words

技术笔记