Wednesday, February 26, 2014

Linux - set -vx

Set command in Linux is used to set or unset values of shell options and positional parameters.

It has many useful options, and specifically, set -vx is very useful to debug a Linux script.

-v  Print shell input lines as they are read.
-x  Print commands and their arguments as they are executed.

To use this, simply put set -vx before an interested script line. Usually, I will put it at the top of my script to print out everything.

For example, you can use set -vx as follow script call test.sh

#!/bin/bash
set -vx
export foo=$1
echo $foo 

Executing the test.sh with

./test.sh hello

The output will be

export foo=$1
+ export foo=hello
+ foo=hello
echo $foo
+ echo hello
hello

Those line with + sign are evaluated value during execution

Reference: http://linuxcommand.org/lc3_man_pages/seth.html

Sunday, February 2, 2014

Whatsapp for Android - Video color become bluish when sharing the video

When you make a video, you could save it and shared it with Whatsapp. The video appears to be normal in Gallery, however, when you shared it with Whatsapp, the video become "bluish" and the recipients receive "bluish" video as well. It only happens when sharing video via Whatsapp. Local pictures, local video and sharing pictures via Whatsapp appear to be normal.

An example of "bluish" video is as follow (This is snapshot from a video where the camera is pointing to a brown flooring)


There are a few solutions you could try

Resetting Camera Setting

You can try to fix the coloring problem by resetting the device camera setting. Different phone manufacturers have different ways to reset the camera setting. For Samsung phone, you can reset your camera setting as follow

1. Launch your camera
2. Locate a setting icon similar to the following




3. Locate a Reset option and click on it.

The reason to apply this fix is to reset the White Balance setting to default. White balance is a global adjustment of the intensities of white in a photo. A wrong setting in White Balance may create a blue tint effect. For example, if your White Balance setting in the camera is Incandescent and you are not under light bulb setting in your home, your image may appear bluish. You can try it out by take a photo with Incandescent White Balance setting under a bight sunlight environment.

You may argue that only Whatsapp video has the problem. However, it is possible that Whatsapp had cached the wrong camera setting and resetting the camera setting will removed all cache and restore to factory default camera setting.

Reinstalling Whatsapp

An alternative is to re-install Whatsapp. Since the problem persist and happen only in Whatsapp, reinstalling Whatsapp may fix the problem as it will remove all settings to the application. Before doing this, please backup your chat history.

Facebook - Control privacy setting of liked page

By default, Facebook displayed your liked page to public. It is the user responsibility to adjust the privacy setting. And in my opinion, F...