Posts

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

Python yield paradigm

Image
Python yield paradigm Table of Contents generator or iterator generator pipe coroutine concurrency The yield keyword in python language is its landmark and invention, it is not just a language syntactic and feature, it lets python programming rocks in the functional programming way. Here in this article, I try to collect all the yield magic here to surprise the python newbie. 1 generator & iterator "yield" is the keyword that to make a generator in python, so what the generator is? Before that, I just try to explain what the Iterator is first? An iterator is an easier and more common concept in objective oriented languages, take java, for example, basically, every container can be converted to an iterator. List < String> namesList = new ArrayList < String> (); // add 3 names namesList.add( "moses" ); namesList.add( "jacobs" ); namesList.add( "davide" ); // iterate via Iterator Iterator < Str...

RAID learning

Image
RAID learning Table of Contents RAID's benefit RAID's types type 0 type 1 type 10 type 2, 3, 4 type 5 type 6 RAID's limitation 1 RAID's benefit So, what the RAID is? RAID is short for Redundant Array of Independent Disks. In the storage industry, the speed, redundancy, and cost are the three factors that the market cares about. I/O speed: hard drive's I/O performance is limited by the physical law, if we continue to use magnetic storage materials. redundancy: the fault of a subset disks in an array can't damage the whole data stored in them. cost: the density of data per dollar. RAID is a common solution to face that. 2 RAID's types 2.1 type 0 parallel multi disks together, with the highest disk write/read IO performance, but none data security. split the data into n pieces, n equals to the array size of the disks. And both the write and read are parallel to improve the speed, but one disk's damage c...

DIY my dreaming machine

DIY my dreaming machine Table of Contents My Requirements Composition of a PC Where to begin Budget 1 My Requirements Now I works in a PC desktop only on my office time, and it is a Mac machine, and after my office time, I primarily do entertainment and learning on my MacBook air (mba). To be honestly, I like my mba, but not my IMac, Mac system is stable, UI friendly and upgrade my efficiently a lot only with a high-ranking hardware, its so bad IO efficiency make her only perform good with a SSD driver inside. And also it's horrible scalability and its closed nature like Windows make her less funny in a nerds's eye. So what's my dreaming machine is? I think the answer is on the DIY field. It has to running a Linux system, for software hacking and audio composition. My favorite configuration is intel haswell CPU with more the 8G memory with a nice display, and also with vt-d compatible. 2 Composition of a PC The CPU, Motherboard, Mem...

How to install and switch between multi JDK?

How to install and switch between multi JDK? Table of Contents How to install and switch between multi JDK? Linux Mac OS X Common incompatible errors between different version 1 How to install and switch between multi JDK? I suppose that you are installed both java 7 and 8 into your system. So how to switch between them. 1.1 Linux # !/bin/ bash # java1.7.sh # source java1.7.sh to switch jdk 1.7 export JAVA_HOME = "/opt/tools/jdk1.7.0_60" export CLASSPATH =.:${ JAVA_HOME }/lib:${ CLASSPATH } export JDK_HOME = "/opt/tools/jdk1.7.0_60" export PATH = "/opt/tools/jdk1.7.0_60/bin" :${ PATH } # !/bin/ bash # source java1.8.sh to switch to JDK 1.8 export JAVA_HOME = "/opt/tools/jdk1.8.0_05" export CLASSPATH =.:${ JAVA_HOME }/lib:${ CLASSPATH } export JDK_HOME = "/opt/tools/jdk1.8.0_05" export PATH = "/opt/tools/jdk1.8.0_05/bin" :${ PATH } 1.2 Mac OS X # ~/.bash_profile ...

Android UnitTest

Android UnitTest Table of Contents kinds of Unit Tests in Android Android Instrument Test Junit Test the Demo Unit Test was always the most import part of a project, especially for Object-oriented programming like Java codes, and also was the necessary part of Test-Driven Development technology. But how to process test-driven technology in Android app developement, we all know that android app is based on Java code, and the thought of TDD was in the blood of Java. There are must be some ways to do TDD in Android, and this article will guide you to the Unit test in Android Development. 1 kinds of Unit Tests in Android There are two levels of Unit Test in Android, Android Instrument Test, which running in the Android Devices; and Junit Test, which running without any Android environment. The key difference between two of them are the dependency on the android.jar, in other word, the Android API. We develop android app by import the dependency of android.jar, whi...

Android ViewPager to implement guide page

https://github.com/suzp1984/welcome This demo started up, because one of my former colleague tried our app, and blamed the guide UI, which is a little stuck. I know the viewpager is a convenient and simple substitute for our bad implementation. So I started it. Make your app guide UI smooth and response quickly, use ViewPager.