Author Image

Michael Chen 的技術文件

程式設計、開放原始碼軟體、技術雜談

Cover image

Unix utilities seem arcane and ancient; however, some people still admire them, whereas mouses and touch screens are ubiquitous. By Unix Power Tools, Oreilly, Unix is rather a hacker’s toolbox than a platform to run application program. You can still access Unix interfaces with buttons, menus and windows, but the real power of Unix is beneath the command line. You do not need to be a programmer or geek to 繼續閱讀

Cover image

Sometimes we want to browse online document for the usages of Perl subroutines or modules. It is boringly repetitive to open the browser and key in the keywords. Is there any way to automate the process? With some tricks, you can open online documents by hotkeys. You may check this original Emacs script to utilize p3rl.org. p3rl.org is a web service providing shortened url for online Perl documents and Perl 繼續閱讀

Cover image

The Entrez Programming Utilities are a interface to Entrez query and database system at the National Center for Biotechnology Information (NCBI). With E-Utilities, we can write programs to query NCBI databases. Since the interface is a fixed URL syntax, we can query NCBI databases in any programming language. Here we demo a Perl script to query PubMed and filter the result with regular expression. The program is placed on Github. 繼續閱讀

Cover image

In my previous post, I introduced AI::Prolog, a Prolog engine written in Perl. AI::Prolog is easy to use; however, the speed may be not satisfying. Language::Prolog::Yaswi refers to Yet Another interface to SWI-Prolog; the performance of Language::Prolog::Yaswi is better than that of AI::Prolog. Before using Yaswi, You need a SWI-Prolog complier in your system. You can get it from SWI-Prolog website. First, you need to write a Prolog knowledge base. 繼續閱讀

Cover image

Perl programming can be done in imperative, objective and functional styles. However, Perl lacks direct support in logic programming. Prolog is a logic programming language, popular in the fields of natural language processing and artificial intelligence. AI::Prolog is where Perl and Prolog cross. AI::Prolog is a Prolog compiler written purely in Perl and, optionally, comes with aiprolog, a interactive Prolog interface. The module is easy to use if you know 繼續閱讀

Cover image

In Perl, you do not need to declare the type of a variable in advance. Sometimes, it is confusing because you do not know the type of the variable and you do not know what method to use. By using ref with a object, you can know the class (or type) of the object. Say we want to extract some data from some xml files. XML::LibXML is Perl binding for 繼續閱讀

Cover image

Since hash is a one-way relation, you cannot directly sort by hash values and get hash keys in Perl. However, by customized sort subroutine, you can also sort by hash values. This post shows the trick. You still need hash keys for later use, so we sort hash keys here. The catch is in the by_value subroutine. Here we pass $a and $b to the subroutine and compare them by 繼續閱讀

Cover image

According to the official page, rJava is a Low-level interface to Java VM very much like .C/.Call and friends. A strange error occurs while I try to load rJava insido RStudio. Reason: image not found According to the thread, starting RStudio and setting LD_LIBRARY_PATH variable from terminal can solve the problem. $ LD_LIBRARY_PATH=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/server: open -a RStudio You may make an alias for the command in ~/.bashrc. 繼續閱讀

Cover image

When we want to search from a page, we open the search page and type keywords in the search bar. It is annoying to repeat the process multiple times. Is there faster way to reduce the repeat? Firefox bookmarks comes with a convienent function called keyword search. You can try a built-in keyword search now by typing google keyword in the location bar. ! To use keyword search in Firefox, 繼續閱讀