Build and Release

A continuous learner for experience and life.

Using Git Command to Find Build Failure Very Quickly

When some changes broke your build during the mid night, how to find the culprit of the failure very quickly? Like this: build failure history

If you are using git as your version control system, then the short answer is ‘git bisect’.

As the above screenshot, you know the latest good version is 4.7.0.310, and the earliest bad version is 4.7.0.311, so some changes between the two version failed the build. Then how to use ‘git bisect’ to help us debug the issue very quickly?

Playing With Hadoop on Dockerbase

Apache Hadoop Logo Apache Hadoop is a map reduce computing environment, which provide a reliable, scalable and distributed computing environment to handle big data. This article introduce how to setup a Apache Hadoop Dockerbase image to play with the standalone operation of Hadoop on Docker.

Getting Familiar With HBase on Dockerbase

Apache HBase Logo Apache HBase is a distributed, scalable, big data store. With Apache HBase, you can randomly access your big data, which support realtime read/write. You can get more information about Apache HBase from the reference list [3]. This article introduces how to setup a standalone HBase database with Dockerbase supported.

Getting Started With Scala

enter image description here Have no any idea what to do today after dinner, although I have some homeworks need to submit soon, I still decided to try something new in a short time. I recalled I read an article yesterday on stackshare.io, it seems there is a company named instacarts tried Scala programming language to setup their development stack. I am very curious on the programming language, it seems someone said: “Speaking More Than One Language Could Sharpen Your Brain.”, how about Scala?

Programming for Andorid: Synchronize Actions With Handler

enter image description here

Sometimes, we need to synchronize the actions in a series but not in parallel. For example, we need to download an image then display it on Google Gallery. It seems we cannot display a partial image during downloading. OK, there is another story, probably, we will mention later, for displaying image with a coarse one then detailed the clear picture. Now let’s fix how to download an image then display it, without manual interference.

This program bases on the last one: Programming for Android: Download, Progressbar and FileProvider

Programming for Android: Download, Progressbar and FileProvider

enter image description here In this article, we try to download a file from Internet, show the progress of downloading, then share the file to gallery for displaying with FileProvider.

Keywords: Android, Programming, Download, Image, Progressbar, FileProvider

Prerequisites:

0. Create an Android project with name: FileProviderExample, you can also clone this project directly from github here: [3]

Steps:

1. Download

We intend to download an image file with foreground mode since we want to block the consequent actions until the download process is complete. If you try to download file(s) with background mode, please reference some other articles here

Design a Reuse and ‘De-use’ Modularized Software System

enter image description here

Design a reuse and ‘de-use’ modularized software system

Keywords: reuse, ‘de-use’, minimum equipped interface (MEI), strong cohesion, loose coupling, software engineering

Most of the task on software design are to analyze requirements, decompose functionalities and connect the parts of artifacts to fulfill customer requirements.

This time we focus on decomposition of functionalities. Why we need to decompose the requirements to each small module or package, one of the reasons is to reuse them, another reason, I think, is to ‘de-use’ them. When we do not need any of modules, we can separate them from system very easily, which also provide much convenience for testing. We can test each of the seperated modules, packages or interfaces isolated, without interference between each other.

The goal of the software design, include architectural design and detail design, is to decompose functionalities with the characteristics of strong cohesive, and loose coupled, which means we need a complete, but most minimal system function set. Interface is a very important element between two systems to access those functionalities, in addition to deployment environment. In fact, we can treat the environment as the interface between system and the system host. So we need a minimum equipped interface (MEI), which refers to Minimum Viable Product (MVP) definition.

To achieve the goal, besides an elegant design blueprint, functional prototyping, we also need supports from configuration management and testing. We should have many different configuration profiles to include or exclude the modules according to the reuse and ‘de-use’ specifications, which we planned in design. Testing should have different test scenarios to verify and/or validate the interfaces, which are exported by modules or packages according the configuration profiles.

Succeed to DCOM and CORBA, the popular technology so far for designing a strong cohesive and loose coupled interface on cloud is REST, which based on the simple HTTP protocol verbs (GET, PUT, POST, DELETE). REST API is an analogous to SQL for interaction between systems on cloud, the latter provides several common verbs to query and manipulate data with relational database, such as SELECT, INSERT, UPDATE, DELETE, etc.

In a conclusion, as the main task for design, we need to decompose functionalities in order to reuse and ‘de-use’ modules, which act as a container to host functions. The design goal is to make functionality as most as strong cohesive, and loose coupled. We can leverage configuration management and testing to achieve the design goal. REST interface provides a good practice for designing a strong cohesive, and loose coupled cloud system.

Written with StackEdit.

Setup Mongo Database Master Slave Replication

enter image description here

Prerequisites:

You need know the IP or hostname of the Mongo database which should be acted as a master, and you can ping the port 27017 from the mongo database which should be acted as a slave.

Here are some commands might be helpful:

  • To know the external IP of the server:
1
$ curl http://checkip.dyndns.org/
  • To ping the server which you want to connect, on the specific port ( for example: 27017 ):
1
$ telnet 1.2.3.4 27017

Practices:

Machine A (Master): Run Mongo Daemon as master:

1
$ mongod --master

Machine B (Slave): If mongod is running, which is the default behavior when installed, you should stop it before the following steps:

1
2
# Stop the mongodb which installed by default
$ sudo stop mongodb

Run Mongo Daemon as slave:

1
$ mongod --slave

Probably you need to specify the dbpath, in case you have any disk space limitation:

1
$ sudo mongod --slave --dbpath /data/mongodb/

Run mongo to open a mongo shell, then config for replication:

1
2
3
> use local
> db.sources.find()
> db.sources.insert( { host: <masterhostname> <,only: databasename> } );

Then you run show dbs in the mongo shell:

1
> show dbs

You will find the databasename which we typed behind the only key above displayed.

You may need to run the command multiple times to make sure the replication is going on. For example:

1
2
3
4
5
> show dbs
databasename    17.9453125GB
local   0.078125GB
> show dbs
databasename    19.9443359375GB

You can also run the following commands to show the information of the replication on master and slave side:

1
2
3
4
5
# Master side:
> rs.printReplicationInfo() # replace 'rs' to 'db' for the version prior to 2.6

# Slave side:
> rs.printSlaveReplicationInfo() # same thing as the above command, you need to replace 'rs' to 'db' if you run the mongodb which version prior to 2.6

Besides, you can run the following command to get a defail status of the server:

1
> db.serverStatus()

You might neet to run resync to recover replication:

1
2
> use admin
> db.runCommand( { resync: 1 } )

References:

  1. http://docs.mongodb.org/manual/core/master-slave/

Written with StackEdit.

Install Gollum

gollum snapshot

Gollum is a simple wiki system built on top of Git.

Gollum wikis are simply Git repositories that adhere to a specific format. Gollum pages may be written in a variety of formats and can be edited in a number of ways depending on your needs. You can edit your wiki locally:

  • With your favorite text editor or IDE (changes will be visible after committing).
  • With the built-in web interface.
  • With the Gollum Ruby API.

Here are steps to install gollum.

Install Nodejs Using NVM

enter image description here

An alternative to installing Node.js through apt is to use a specially designed tool called nvm, which stands for “Node.js version manager”.

Using nvm, you can install multiple, self-contained versions of Node.js which will allow you to control your environment easier. It will give you on-demand access to the newest versions of Node.js, but will also allow you to target previous releases that your app may depend on.