Posts

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) ...

How to publish and distribute your Android AAR package?

Image
How to publish and distribute your Android AAR package? Table of Contents JCenter vs Maven Central Add build script dependencies Configure the library module Sign up an account in bintray Sample 1 JCenter vs Maven Central I don't know since when Android Gradle's default repository started to use jcenter instead of the older maven central as the default archive repository. According to some talks, Jcenter can leverage the JFrog's technology, which is a superset of Maven central, so it improved and promoted the efficiency of Android project compilation. In a word, Jcenter is better than Maven Central. 2 Add build script dependencies dependencies { classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' // NOTE: Do not place your application dependencies here; the...

Install Software RAID in Linux System

Image
Install Software RAID in Linux System Table of Contents Benefit Prepare install and configure mdadm finished 1 Benefit RAID can provide stable, speed and security for your data access, but not at the same time. We need different performance at a different scenario, and the above three traits that I mentioned, are trade-off factors in real apply, some time we sacrifice one to achieve another. In my desktop work station, what I really need is the speed all the time. That's the RAID-0. Here is my disks, one SSD as the system disk for ubuntu, and two additional 1T disks to be an RAID-0 array. 2 Prepare Plug two disks into the motherboard first, then erase the disk's format use fdisk tool and build one partition for each one with the same size. In my case, I got two devices, /dev/sdb, /dev/sdc. sudo fdisk /dev/sdb # d .... delete all partition in the hard driver # n create one partition for the whole disk # t choice fd (linux raid disk) ...