Tuesday, April 4, 2017

Better SQL (0)

Better SQL


This is the first blog for the new series – Better SQL. In this series, I’m going to record my progress from a basic SQL programmer to an advanced SQL programmer. Hope it will help readers too.

What is a basic/advanced SQL programmer?

I define basic SQL programmer as the one who can use basic SQL commands correctly, e.g., SELECT, UPDATE, DELETE, etc. Basically, who can use SQL as a basic data query tool for relational database.

Advanced SQL programmer is the guy who not just run simple SQL queries but also some advanced or more efficient SQL queries; who not just use database but may start to manage database and understand SQL query performance better. After this journey, we will see what is an advance SQL programmer will be.

Style of this series

This series will be like a learning note for me, so it could be really short, e.g., some tips of SQL, or may be longer, some tutorials or thoughts for a bigger topic.

Hope you will like it and let’s learn SQL!

Thursday, July 23, 2015

A easy way to view binary file in hex in linux

If you use vim, that is pretty easy, you can

vim your_binary_file

click "Esc", and then type ":%!xxd"; type ":%!xxd -r" to return to normal mode.

Thursday, July 16, 2015

How to convert column labels to numbers in Excel?

Microsoft Excel:
Go to:
Preferences -> General
Uncheck R1C1 Reference Style
And then click OK.

LibreOffice Calc:
Go to:
Tools -> Options -> LibeOffice Calc -> Forumula
And then change the Formula syntax dropdown to: Excel R1C1

Thursday, June 18, 2015

How to auto mount disk at startup in Linux/Ubuntu

Step0: format your disk to ext4

sudo mkfs.ext4 /dev/yourdisk

Step1: find the disk UUID

sudo blkid /dev/yourdisk

Step2: register the disk in fstab by using any editor, e.g., vim.

sudo vim /etc/fstab

then add one line into the file

#device                    mountpoint            fstype    options    dump   fsck
yourdiskUUID      /mount_directory        ext4      defaults     0         1

Then reboot it will auto mount.

Thursday, June 11, 2015

Two steps to survive and be productive in open office

The open office is used by many companies, especially IT companies like Google and Facebook. Now even our CS department apply an open office layout for PhD students. Staying at such an open office for one year, I realized it is not a good idea to do so. It is easier to focus and keep productive while programming in an open office, but it is much harder to think and derive math formulas. Many reports also shows the open office is destroying the workplace: e.g., washingtonpost, thenewyorker.

So how to survive and keep productive at an open office, I tried following steps and work pretty well for me:

Step one: buy a comfortable noise-cancelling headset
The headset needs to be comfortable! Because you need to wear it for hours. And it needs to cover all your ears to isolate the outside noise. Noise-cancelling is not necessary but a good feature to cancel noise like AC or other machines (it cannot cancel voice). The Bose headset is a good choice.

Step two: create good white noise
I found out that playing some good white noise actually help you focus and meanwhile decreasing the influence from other people's talks around you. I'm using Coffitivity. The noise it generates is just right.

Hope it helps!

Tuesday, January 21, 2014

When Java Runtime.exec doesn't work

When Java Runtime.exec doesn't work, the first thing to check is was the current path the working path. To make sure your runtime execute on the right path, use "cd yourpath" before running your command.

Thursday, January 16, 2014

How to push a string in to a command's stdin in Linux

It's a small trick but sometimes quite useful, e.g., you want to run a shell script without any interaction after you execute it.

You can push a string into your command like this:

$ command parameters <<< word