Posts

Showing posts from 2012

Install JDEE in emac

Install JDEE in emacs Table of Contents 1 JDEE Introduction 2 Some Troubles Met during Instillation 3 I have a word to say 1 JDEE Introduction I want to configure my java develop an environment of my emacs. And It seems that JDEE is a recommended option. Some one even uses JDEE as full features of IDE for java, that's sounds exciting right. So I decide to use JDEE. According to emacs wiki's advise, I use the latest source code from svn repository, But I met some trouble in the installation. The following section will figure out the solution. 2 Some Troubles Met during Instillation compile JDEE      # Download JDEE from svn first # use the source code in the main trunk svn co https://jdee.svn.sourceforge.net/svnroot/jdee jdee Then use ant to compile the source code, I met the error prompted by:   ## Could not load definitions from resource net/sf/antcontrib/antlib.xml That's because of lack of ant-contrib package, So I install this

OpenSSL ToolKit Usage

Image
OpenSSL Toolkit Usage OpenSSL is a great project, which provide a excellent implement of SSL and TLS protocol, and also a great toolkit which can do many of kinds of job related with cryptography field. There is a Great tutorial of openssl command toolkit: openssl introduction . This article has also some extension based above introduction. And this article  collect some the uses of openssl command, which I already tested in linux environment. Table of Contents 1 Use openssl as a encryption and decryption tool 1.1 symmetric cipher algorithms 1.2 asymmetric cipher algorithm (public key algorithm) 2 Create a signature of a file 3 verify certificate authority (CA) by command line 4 How to retrieve some web site's certificate by command line? 5 openssl's system path to store CA. 6 build your own CA step by step 7 X509 PKCS#12 PKCS#8 1 Use openssl as a encryption and decryption tool There are some kinds of classification methods of encryption alg

Network programming in elisp

  Network API in elisp Table of Contents 1 Introduction 2 A example 3 Http server implemented by elisp 1 Introduction Emacs is not just an editor, Yes, that's true. Emacs lisp can do network connection programming by its network API. But there is something difference with other kinds of programming language. First, elisp do not support multi-thread, pretty cool, huh!! Yeh, Multi-threads programming is a horrible venture for you, right! Second, There is no socket similarly conception in elisp, and elisp provide network programming ability as processes. Elisp can open a network connection by function – open-network-stream .  It can make network connection server listen a special port by function - make-network-process . Both of those function return a process object. Then you can communicate with the process by process's API. 2 A example I write a snippet code to figure out How to use it. ( require ' cl ) ( defvar my-network-client-b

A magic trick to make cool email signature

Image
A magic trick to make cool email signature Table of Contents 1 where's the idea come from? 2 how to use it? 1 where's the idea come from? I hang out in the #emacs IRC channel in freenode one day, and some guy show some funny trick that can always make some fun: fortune | cowsay Every time I execute this command, the output always let me LOL. _______________________________________ / Atherton: "You set this up, whore! \ | After I bought and paid for you. I | | should have uglied you up so no one | | else would want you." | | | | Mal: "See how I'm not punching him? I | | think I've grown." | | | \ --Episode #4, "Shindig" / --------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | ||

Literate programming in org-mode

Image
Table of Contents 1 Literate programming 2 org-babel 1 Literate programming Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. — Donald Knuth (author of the art of computer programming) This is a revolutionary opinion in software history, Knuth even has his own literate programming language named the web(not the same thing with internet web). He used cweb tools to write most of his source code which can be found on his webpage. Literate programming is actually a software development method, which combines documenting and programming process into one job. In that way, the document and source code are tangled. The source code developed by programmers is also the document for that. There are some examples of this programming style. Some technique books like C Interfaces and Implementations was write in this way, the source code of the examples in this

some tips for how to write a emacs lisp package -- elisp's loading mechanisms

1. elisp's loading mechanisms In order to learn how to write an elisp package, you must be familiar with some ways of how to load your package to emacs. That means developers need to master following functions. Some of them puzzled me at  the past. Functions: load-file, load, require, autoload Following hyperlinks webpage removes my confusion, and give a good explanation of elisp's loading  mechanisms. http://ergoemacs.org/emacs/elisp_library_system.html?1352689199 Function Name Purpose Tech Detail Comment load-file Load a file. Load one specific file. Use this if you have one very SPECIFIC file at one particular file path. load Load a file. Load a file by searching thru var “load-path”. Also, tries to load a compiled version (.elc) if exists. Use this if the path for the file is not known in advance, and you are using a file name without full paths, such as “undo” or “undo.el”, and you want to load the compiled version if it exists (undo.elc). require Load a packa

auto-complete mode in emacs

Emacs as an IDE works well with all kinds of the environment (C lisp elisp slime java python). But his auto-complete plugins sucks. I use hippie-expand before I met auto-complete. Auto-complete was the best auto-complete package in the present moment. This package is so simple that can be a tutorial on how to write a minor-mode package. And the users also easy to configure or modify it according to their needs. after a search in google, I add a package to use auto-complete in slime environment to develop a common lisp. Also, add a package to Let it search ac-source from etags files. I upload modified package into google drive: https://docs.google.com/open?id=0B5yiz3j-W7mca3VtYUpWTTl1VDg Install tutorial: 1. copy *.el to a directory like (~/.emacs.d/auto-complete/) 2. copy dict directory to a directiory like (~/.emacs.d/auto-complete/dict) change symbol ac-dictionary-directories according dict directory (add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-com

use org-mode to schedule your job

http://www.mastermindcn.com/2012/02/org_mode_quite_a_life/ emacs is not just an editor or IDE, It is a desktop Environment. org-mode in emacs is an amazing tool to practice GTD which help you to organize your time. here is a template I used. My Whole Template * org-mode configuration #+STARTUP: OVERVIEW #+PROPERTY: CLOCK_INTO_DRAWER t #+TAGS: { LEARNING(l) LISP C FUCK-GFW EMACS TEX EMULATOR PYTHON BLOG } #+STARTUP: hidestars [[http://www.mastermindcn.com/2012/02/org_mode_quite_a_life/][where this file come from]] * Inbox [100%] ** DONE Interface C: momory interface CLOSED: [2012-11-09 Fri 11:30] SCHEDULED: * Tasks [16%] ** TODO [#B] learning org-mode :LEARNING: SCHEDULED: :LOGBOOK: CLOCK: [2012-11-09 Fri 09:39]--[2012-11-09 Fri 10:24] =>; 0:45 CLOCK: [2012-11-09 Fri 08:18]--[2012-11-09 Fri 08:52] =>; 0:34 :END: ** TODO [#A] Common lisp [50%] :LISP: *** TODO shoutcast p

SSH X11 forwarding

I wrote some ssh port forwarding in a previous post . But there is some difference in X11 port forwarding.  First, Let's introduce some knowledge about X. X system is the standard basic display system in the Unix-like world,  it has an C/S framework -- server and client and they communicate with each other by TCP/IP network. SSH provide X11 forwarding function, which can be used when X server and client do not run in the same host. The following link is a good tutorial in ssh X11 forwarding. http://www.vanemery.com/Linux/XoverSSH/X-over-SSH2.html We can use SSH to do X11 port forwarding (ports 6000-6063). ssh -X -C user@remothost -X: enable X11 forwarding -x: disable X11 forwarding -C: Compress the traffic, useful in the lower network. then, we can run the graphical application in remote host, but displayed in local host. That mean the graphical application running in remote host use the X server in localhost to display itself.

How to use quicklisp to manager common lisp packages

http://xach.livejournal.com/278047.html http://common-lisp.net/project/asdf/asdf.html quicklisp is an amazing tool in common lisp tool. It just like "easy-install" in python field, and "cpan" in Perl world. * How to install or load package by quicklisp We can install or load some package into lisp's core image by quicklisp's help, (ql:quickload "package name") this will load the package, if this package didn't installed, it will search in the quicklisp's repository in the net, and install it. But, If I want to load a package that is developed by myself. May I use ql:quickload to manage my personal project? Yes, you can. ql:quickload use the ASDF2 package to do this. First, We need to config ASDF, it can scan a particular directory tree for my own project. To do that, I create a config file named ~/.config/common-lisp/source-registry.conf.d/projects.conf   that has following stuff: (:tree (:home "src/lisp/"))

tabbar-mode slow down emacs

I find my emacs slow down after a long time operate in it.  Emacs process takes 50% of cpu resource. After search this problem in google, I found following stuff: http://ergoemacs.org/emacs/emacs_font_slowdown.html tabber-mode seems have bugs. So,  M-x tabbar-mode to disable tabber-mode, then everything become normal again.  Maybe I should disable tabber forever.

xelatex -- 中文latex的另一解决方案

最近研究Latex, 发现一般linux发行版中集成的TexLive套件有点水,似乎阉割了一些管理宏包的功能,这怎么可以呢?而且TexLive的目录树也被分割到了很多地方。看来还是自己安装的好用,其实TexLive安装也非常简单,如果用推荐的方案,把整个宏包系统全部安装的话,基本会少很多折腾的地方。 我把整个TexLive重新安装一遍后,发现了xelatex这个在2007年左右开发的好东西,它对中文的latex支持提供了另一种方案,这次可以直接使用系统自带的字体了。(fc-list 可以查看系统里的字体) 更令我意外的是,这次可以直接使用ctex宏包了,看来ctex中文宏包也是使用的telatex的办法。不过在使用ctex宏包前要安装Microsoft的几个TrueType字体。 1. 为linux安装系统字体的方法: copy windows 下的sim{fang|hei|kai|sun}.ttf到/usr/share/fonts/win/下面,运行 fc-cache -fsv 2. 可能要修改Texlive 目录树中的 texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def 原因是上面安装的simkai.ttf字体的名字不是SIMKAI,而是KaiTi_GB2312。 使用fc-list可以查到。 把文件中的第一行改成下面的便可: \setCJKmainfont[BoldFont={SimHei},ItalicFont={KaiTi_GB2312}]   {SimSun} 其实就是将SIMKAI.TTF改为KaiTi_GB2312。

SSH Port forwarding

http://staff.washington.edu/corey/fw/ssh-port-forwarding.html I used ssh to fuck notorious GFW(made by china government), some of it's options related to port forwarding: -L : Local port forward -R : Remote port forward -D : Dynamic port forward -g  : Let another host in the same LAN to use this tunnel. what is port forwarding? First, we should have an ssh connection -- named tunnel. >$ ssh RemoteHost this cmd build a tunnel from LocalHost to RemoteHost. >$ ssh -L localPort:TargetHost:TargetPort RemoteHost this cmd build a tunnel ofcouse. And it also Forwarding any traffic from LocalHost:LocalPort through the tunnel to the RemoteHost, then the RemoteHost forwarding the traffic to the TargetHost:TargetPort. In conclusion, First we have to buid a tunnel, second, ssh collect the traffic from one side of the tunnel and send to another side of tunnel, then In another side, the traffic can be send to the target host. There are two ways of port forwarding in ssh.

a vim plugin -- load license template

http://www.vim.org/scripts/script.php?script_id=4064 When I coding by vim, I always want to insert the license declares in the head of source files. So I creat the plugin to do this job. Of cource you can make your own templates, just following the example rules. now I only given  gpl and apache license templates.