Posts

Using textmate-mode in Emacs

Image
Using TextMate-mode in Emacs As an emacs user, I was always being surprised by some fabulous modes. This time is TextMate-mode, which is a really useful minor mode for the plain text editor.  As a software developer, I always need to jump to some parts of the source code. Command, M-x textmate-goto-symbol, can really kick my ass.  Another thing which exciting me is the jump to a file by command M-x textmate-goto-file. Also, it only works when I am working in a git repository. It just gives me what I needed.  Are there any other functions in this mode which enlightening me? Well, Maybe it makes my tears running down again by other amazing tricks.

Using Gnu Global to navigating source code

Image
Using GNU Global to navigating source code I use etags as the default tagging system to navigating the C-like source code before. It works good, but sometimes it didn't perform as good as ctags which were used by vimer. Table of Contents 1 why not etags? 2 gtags's advantage 3 gtags's disadvantage 4 Install gtags 5 tagging source code systems of emacs 1 why not etags? Etags has a flaw compared with ctags, which is it didn't pop up the mini-buffer when searching a symbol. Which means I can not get options then decide where to jump when multi locations match the symbol. I have to jump one by one to find the right location in emacs with etags,which push me over the edge sometimes.  2 gtags's advantage Today I tried the gtags source tagging system which provided by Gnu Global project.  It can pop up the minibuffer when multiple targets match the symbol, which functions let me felt much more comfortable. 3 gtags's disadv...

An Algorithm for rotating a sequence

Image
An algorithm for rotating a sequence I attended a job interview today, the interviewer asks me a question about how to rotate a sequence with a good space efficiency. I believe I give him a terrible answer. And the interviewer gives me his answer, well, thanks him a lot. So how to rotate a sequence? There is a sequence blow?  +--+--+--+--+--+--+--+--+ | 1| 2| 3| 4| 5| 6| 7| 8| +--+--+--+--+--+--+--+--+ then rotate the sequence to left by 3? what we get is as following. +--+--+--+--+--+--+--+--+ | 4| 5| 6| 7| 8| 1| 2| 3| +--+--+--+--+--+--+--+--+ So  the following step to step tutorial is  a space efficiency way. reverse the first 3 sequence. reverse the last (8 - 3) = 5 sequence. reverse the whole sequence. Then, we get the result sequence which rotates to left by 3 items. I don't know whether it is the best way. I mean both the best space efficiency and time efficiency.  orignal sequence n =3 +--+--+--+--+--+--+--+--+...

How android sign your app

Image
android APK employed the same signature method just as java jar package did. there are two ways of sign your app. 1. Use tools in java package   a. make your own keystore keytool -genkey -v -keystore my-release-key.keystore -alias zpcat_key -keyalg RSA -keysize 2048 -validity 10000 b. sign your apk  jarsigner -verbose -keystore my-release-key.keystore MainMenuView_unsign.apk zpcat_key c. align your apk zipalign -v 4 MainMenuView_unsign.apk MainMenuView.apk 2. Use android's private tools a. make key/cert pair by android's private tools development/tools/make_key: android tool to make key/cert pair b. signing apk with key/cert pair: java -jar SignApk.jar platform.x509.pem platform.pk8 Application.apk Application_signed.apk 3 compare the two methods -- the java keystore file .VS. key/cert pair of android (pk8 key file and x509.pem cert file) they are the same stuff. you can import the key/cert pair into your java keystore file by: keytool-impo...

Install malabar-mode for java development

Install Malabar-mode for java development (Deprecated) Table of Contents 1 Why Malabar-mode? 2 What is Malabar-mode? 3 Install Malabar-mode 4 Configure Malabar-mode 1 Why Malabar-mode? There are Jdee for java development in emacs, so Why Malabar instead? Jdee is such a huge weapon, that it's so hard to hack into it. It is powerful but probably includes more useless features. What's more, Jdee maybe slow down your Emacs, but you can not fix it. But why not use Eclipse? Well, Emacs just make me cooler. 2 What is Malabar-mode? Malabar-mode is hosted on  GitHub . It provided a much more elegant way to edit java source code compared with Jdee. Just as its Github's page title – "A better Java mode for Emacs". 3 Install Malabar-mode This project stopped upgrade about two years age. So I met some troubles during the installation. Build the package with the following command. mvn package And I got following warning and erro...

Nginx's Memory Allocation

Nginx's Memory allocation Memory allocation performs a crucial role in a high-performance server's design, a poor efficiency memory management can become the bottleneck for high performance. Nginx, as a fast web server, implemented its own memory allocation. It's memory allocation source code located in ngx_palloc.c. It works in following ways. Nginx's memory allocation system has two kinds of chain, like the following figure. the above chain with equal data block size M, it works in this way: when Nginx want to allocate any memory equal or smaller than size M, it will be allocated from this chain, when neither of the nodes in this chain has enough space to satisfy this request. Then Nginx will build another chain node to finish this request. when Nginx want to allocate any memory larger than size M, it will allocate from the chain in the bottom side. this chain's node should be built dynamically, and can be destroyed. I write a copycat memory alloc...

Using ffmpeg to convert video file

Image
Using FFmpeg to convert video file Table of Contents 1 Some basic concept about digital video file 2 what is FFmpeg? 3 how FFmpeg works inside? 4 convert MOV file format into mp4 format 5 what's more 1 Some basic concept about digital video file There are many kinds of Video file format including MOV, mp4, Flv, AVI, which act as the containers in which video data is stored. And Video data is encoded by codecs. In other words, Video file format is just a container, and Video codecs are used to encode or compress the video data. The anatomy of video file including following parts: A container type: AVI, MOV, mp4, FLV… The video and audio signal: the data stored in the container. Codec: Codec refer to the software that is used to encode and decode the video signal The characteristics of a video signal: Frame size: the pixel dimension of the frame The Aspect ratio: the ratio of width to height Frame rate: the rate of frames per second Bitrate: th...