Posts

My Emacs Configuration

Image
My Emacs Configuration Table of Contents What is it? How to install my configure The most complicated part Code location 1 What is it? I have at least three desktop machines works right now, running Mac OS and Linux. I found that's a messy and dirty job to configure my emacs again and again after reinstalling the system. This project is a convenience collection my configurations of emacs and reinstalls them quickly into another machine. I had worked in a similar project formerly, not a so pleasure experience, I commit everything located in ~/.emacs.d into a git repository, after realize how silly it is, I abandon that project. This new project is an upgraded version, more light weight, just upload my own configuration without the third party modules. 2 How to install my configure steps 1 create your .emacs.d directory into your home directory cd ${ HOME } mkdir .emacs.d steps 2 clone the code into your ${HOME}/.emacs.d directory cd ${ ...

Learning Lua

Image
Learning Lua Table of Contents Background Tables metatable functions coroutine Lua as Object-oriented programming 1 Background Lua as an embedded language was popular in the game industry and also in any embedded scenario. I tried to wrote a Lua module for Nginx, which already has a ported Lua environment inside. And since this is my first time to get familiar with Lua, and to enjoy its simplicity. My learning materials were no special, but its official document . I wrote my notes down in order for future review. 2 Tables To understand table is to understand Lua, or in another word, Lua's syntax was nothing but just tables, no more. Tables in Lua is in similar with the dictionary in Python, in my view. a = {} a.x = 1 a[ 'x' ] = 1 2.1 metatable Lua's metatable is similar to magic methods in python. 3 functions Lua as a functional programming language, because the function is also the first-class variable. That...

ReactiveX Asynchronous Programming In Java

Image
ReactiveX Asynchronous Programming In Java There is a much detailed blog about ReactiveX of myself, checkout here . Table of Contents What is Asynchronous programming? Ways of Asynchronous programming in java Java Callback functions Java Future Benefit of RxJava 1 What is Asynchronous programming? The asynchronous issue exists, because of the blocking nature of every activity in reality. Every operation consume time, in theory, computers need to take at least one frequency to execute one instruct, it takes time between every oral conversation in the speed of voice at least. That's the blocking nature of this world, and the most valuable resource of all is the time. Some times the computer cannot wait for that longer for the blocking API, like in network communication, it waste of the computer resource so much. The another reason is the event-based scenario. In a network connected chatting app, program listens for every coming data continuously and output ...

Android Account Manager

Image
Android Account Manager Table of Contents the begging of an Internet mobile app Account Management Demos 1 the begging of an Internet mobile app The first component that an Internet startup needs to build is its user system. How to expand his users in an easily, convenient and user-friendly way, and how to develop its account system in a scalable method? The account system is the crucial and the most important part of a company, most of the content and service provider companies always develop its account systems followed the oAuth standard. There are third party authentication plugins, like stormpath and Auth0 targeted into those account management field, you can build your web app above that service. For an Android mobile developer, there are already a middle-ware in API level, AccountManager. Take a glance of Account preference in the Setting App, and experience how Gmail, Youtube, and G+ works with multi-shared google accounts and switch between them i...

Logical Volume Management

Image
Logical Volume Management Table of Contents What is LVM? Conceptions How to create PV create VG create LV 1 What is LVM? LVM stands for Logical Volume Management, which is one kind of virtual disk partition. In the traditional way, We need to separate a disk into multiple partitions, then format that partition with a filesystem. Once you write the partition table to the disk, rewrite this table will lose all your disk data. But, LVM gave more scalable and dynamic options, we can adjust and re-create partitions without reboot and re-mount process. 2 Conceptions VG:   Volume Groups PV:  Physical Volumes LV:   Logical Volumes Volume Groups is a collection of Logical volumes, and it is created on top of physical volumes, Physical Volumes are physical disk partitions with LVM header. Logical Volumes are the final partitions that we can format with our favorite filesystem. Topology of these concepts: one Volume Group can include more...

Javascript Callback Hell

Image
Javascript Callback Hell Table of Contents callback hell Promise bluebird 1 callback hell Javascript callback hell looks like an inherent problem in js language, because of its asynchronous nature, writing callback functions and nesting them together looks the only way to coding for a newbie.    It then gave programmers some mess code, if he persists to writing nesting callback code, and this mess codes are named as callback hell . fs.readFile( "file.json" , function ( err , val ) { if ( err ) { console.error( "unable to read file" ); } else { try { val = JSON.parse(val); console.log(val.success); } catch ( e ) { console.error( "invalid json in file" ); } } }); 2 Promise Promise is a new ES6(ECMAScript 2015) feature, is used for deferred and asynchronous computations. Promise is also a proposal , which represents the eventual ...

JBIG Android library published

Image
JBIG Android library published Table of Contents Design details Where it come from? Include the dependency into your gradle script Start to use it Please jump to jbig-android 's home page . 1 Design details jbig-android is just a JNI level wrapper of jbig-kit , so it inherited its License as GPL v3. If you are a newbie of JNI programming, you can refer my JNI tutorial . Basically, JNI part is the key of porting jbig-kit to android platform. Beside the core implementation of this project, the sample code pleased me the most. I tried to wrote it in an MVC way, which took me the most time, and it succeeds, Maybe I will use another post to describe this MVC paradigm and its apply in Android App. Of course, I learned this way and copy it from Chris Banes's sensational work philm . 2 Where it come from? About years ago, I met this problem, the format of hand write a signature in bank related system, like a POS. The customer sign in the screen(LED) ...