Posts

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.

Customize ubuntu login console by Cowsay, ascii art

Before this article, I wanna introduce cowsay again, cowsay is an ASCII art generator, which is alway the nerd's favorite toy. Cowsay & Fortune I already used cowsay in my email client, gnus. And at that moment, I found out cowsay's closet mate, fortune . And this time is the moment to make some fun to my ssh login terminal. How to decorate your ssh login console? Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-53-generic x86_64)  * Documentation:  https://help.ubuntu.com/  ____________________________ / Expect the worst, it's the least you \ \ can do.                                            /  --------------------------------------         \   ^__^          \  (oo)\_______             (__)\              )\/\ ...

Dig into Https client connection in Android

Dig into Https client connection in Android Table of Contents reference resources Java Keytool Certificate formats Use Https in Android Client Java SSLContext Two ways SSL verification TLSDemo 1 reference resources http://developer.android.com/training/articles/security-ssl.html http://ogrelab.ikratko.com/using-android-volley-with-self-signed-certificate/ http://stackoverflow.com/questions/2138940/import-pem-into-java-key-store http://stackoverflow.com/questions/3685548/java-keytool-easy-way-to-add-server-cert-from-url-port 2 Java Keytool Java keystore is like a database which store certificates and private keys and protect them by a password maybe. There are at least three format s of that, JKS, PKCS12, JCEKS, and many more. But in this tutorial, I only consider two formats of that JKS which is the Java's default format and BKS which is the Android's default format. How to import a certificate to the BKS style KeyStore? First step was to pr...

Merge branches in Git

Merge branches in Git Few days ago, my superior gave a task to make a presentation about the daily usage of git for R&D department, so I resumed the git pro book to prepare this presentation. And the following article is to recognize my former wrong and unclear opinion about branch merging in git, and a little suggestion about branch management. So how to merge two branches? There are two methods to merge two branches, merge and rebase. Merge method is to merge two branch and generate a new commitment, whose parents are the two HEAD of the older branch. This is called a cross in the branch network. While the rebase method is to re-play every commitment of a branch to another branch, and there are no cross between them after two branch's rebase. And the best way to check the branches is working in right way is to check if there are crosses in branches. So the recommended method of combine two branches is to always use rebase instead of the merge. Because If you always u...

How to configure Samba Server in Ubuntu?

How to configure Samba Server in Ubuntu? Table of Contents What is Samba? Target Prepare configure /etc/samba/smb.conf 1 What is Samba? Samba is a linux implementation of file share and transaction protocol for LAN, which mainly used in Windows OS. Samba is more convenient than FTP in my opinion, and it is useful in a small group who works in a same LAN, but its members are familiar with different OS, Bob works in Mac, David works in Ubuntu, while Mars likes Windows more. 2  Target This tutorial is a step to step document of how to build a Samba Server which met the following requirement: Share a Directory with both readable and writable authority for Guest. Share a Directory with both readable and writable authority for certain Users. Share a Directory with only readable authority for Guest. 3 Prepare addgroup smbgrp adduser abc smbgrp smbpasswd -a abc mkdir /xxx/path chown -R abc:smbgrp /xxx/path mkdir /xxx/public chown -R nobody:nogroup...

How to configure Android project's build types in Gradle?

Image
How to configure Android project's build types in Gradle? Table of Contents Generate Java Constants Generate Android resources A few days ago, our team needs to configure the Gradle's build scripts to auto build the project. Here is the requirement, to build three versions of app, release, development and test, from the command line. I found the ways from the following link, http://stackoverflow.com/questions/17197636/is-it-possible-to-declare-a-variable-in-gradle-usable-in-java Actually, we can generate the Java constants and Android resources from the Gradle's build script: 1 Generate Java Constants android { buildTypes { debug { buildConfigField "int" , "FOO" , "42" buildConfigField "String" , "FOO_STRING" , "\"foo\"" } release { buildConfigField "int" , "FOO" , "52" ...

My Android JNI Tutorial

Image
My Android JNI Tutorial Since I worked for my current employer, I found out my passion of writing was dropping down dramatically. My salary was raised and also got a promotion, but my ambition for the software looks have not evolved. So what is my favorite? coding and writing. I should keep that in my mind. I reviewed what I did in the last few months, there are one thing suit my desire of writing. I wrote a JNI module to process the jbig compressed image, both decoding and encoding, actually I initially allocated this job to one of my former colleague, but it looks so sucks, then I have to refactor his code after his resignation, basically rewrote the code. This is my first time to wrote JNI code with android-ndk, also my former jobs included a few JNI tasks, but it is in android system development not as an app developer. Here are my experience and summary of JNI coding. 1. How to design JNI code? Load the sharable library in static code in java part.   ...