Stands on the shoulder of Giants

My rambling and thoughts. Powered by Obtvse

UTF-8 Support in MySQL

If you want to save Unicode character into MySQL, make sure that the encoding is utf8mb4.

MySQL Documentation stated that:

The character set named utf8 uses a maximum of three bytes per character and contains only BMP characters. As of MySQL 5.5.3, the utf8mb4 character set uses a maximum of four bytes per character supports supplemental characters:

  • For a BMP character, utf8 and utf8mb4 have identical storage characteristics: same code values, same encoding, same length.

  • For a supplementary character, utf8 cannot store the character at all, while utf8mb4 requires four bytes to store it. Since utf8 cannot store the character at all, you do not have any supplementary characters in utf8 columns and you need not worry about converting characters or losing data when upgrading utf8 data from older versions of MySQL.

`whatis` command

whatis command will give brief summary for your command-line application. e.g.

$ whatis cat
git-cat-file(1)          - Provide content or type and size information
for repository objects
cat(1)                   - concatenate and print files

Upgrade all Python Packages (pip)

pip does not provide easy command to upgrade all packages, so we need to take a round way to perform it. Thanks to this article.

You can add alias to this command, i.e pipup in your preference shell.

pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs pip install -U

How to develop app related with Spatial and Postgresql in Mac OS X Mountain Lion.

At the moment, we are developing a new location-based app focusing in travel. After doing some reading, I found that PostgreSQL is a very capable RDBMS for doing spatial related query. PostgreSQL also a very stable and scalable database, and the best of open source database engine out there.

Since I am using Mac OS X for development, I met some difficulties for setting up my development environment to use PostgreSQL. Heres is a list what I've done to install

  1. Get PostgreSQL database app for mac from this site. This is the easiest method for running PostgreSQL Database server in Mac OS X. Just download the app, unpack it, copy to your Applications folder (System or User, whichever you choose), and just double click it to run it.
  2. The most known PostgreSQL client is PGAdmin. The problem is, PGAdmin is ugly. It has 90s User Interface, and so not pretty in Mac OS X. Fortunately, the creator of Postgres app also create a brand new app, named Induction app. It is a polygot database client, which means that you can connect to multiple database and do some query stuff just from one client. Say goodbye to PGAdmin, PHPMyAdmin, or Adminer for MySQL. What makes this app more awesome, we can connect to NoSQL databases, such as Redis and MongoDB. Currently it is in Alpha, but I really recommend it.
  3. This issue is Mountain Lion specific, but sometimes you will get Failure message when you initiate spatial support on PostgreSQL. This problem caused by Mountain Lion is missing a specific library, named libjpeg. I recommend you to use Homebrew to install.
  4. Add psql from Postgres app into your PATH, by editing your .bashrc if you are using bash or .zshenv if you are using zsh.
  5. Launch Terminal or iTerm2, type psql -h localhost. You will get the psql prompt for and your database is ready to be use. Create your database first, using command CREATE DATABASE <database_name>; and then use it by issuing USE DATABASE <database_name>;. PostGIS is a extension for PostgreSQL, you must install it before you can use it. Install it by typing CREATE EXTENSION postgis;.
  6. You are ready to use PostGIS.

New Utilities

Recently, I became a avid listener for Mac Power User Podcast. This show talks about ways becoming more productive by using your Mac. As a new user, I am very interested in learning those techniques, to be a power user.

I have learnt about TextExpander, where you can save time typing, by creating some snippets which will be used in other applications. I purchased the TextExpander Touch, when there is a sale, cost $ 4.99. I am learning about it , and already I can get some benefits from it.

The other tools I learned is 1Password, which I heard about from the podcast, talking abouth how easy 1Password makes you manage your password and other sensitive information. Since there is a sale for 1Password for Mac and iOS, I decided to purchase them. And boy, I am thankful for doing that.

1Password can store data in your Dropbox, which I used, to share data across your devices. I stored my bank account informations, my online logins and passwords, my credit cards details and lastly all my purchased software. All these information used to scatter all ovee the place and hard to find. But now, I can save them in one safe place, accessed from everywhere.

The most sucessful story I ha with 1Password is when Twitter hacked and their 250,000 users had their data stolen. Twitter suggest to change the password, before your account being hijacked. I decided to use 1Password capability to generate strong-yet-readable password, changing the password and storing it back into the app. Now My Twitter acount is protected. Using this app will make your digital life safer and easier to manage.

Mac OS Tips

Mac OS X maintenance tips.

Today I Learned

How Apple kept Safari a secret.

Best part is

Back around 1990, some forward-thinking IT person secured for Apple an entire Class A network of IP addresses. That’s right, Apple has 16,777,216 static IP addresses. And because all of these addresses belong together — in what’s now called a “/8 block” — every one of them starts with the same number. In Apple’s case, the number is 17.

It is awesome

iTunes Store

iTunes Store is finally arrive in Indonesia! This is something I have been waiting for a long time. Now you can purchase Musics, Movies and Books. Finally, I can buy digital Music legally, and in a good quality too.

You can buy a track for average IDR 7k for international song and IDR 5k for Indonesian songs. I need to be very careful, since I need to manage my credit card not only for buying apps, but also in books, movies and musics. Let's just hope I am doing some clever shopping.

I just want to say, good move for Apple. And I am waiting for others (yes, I am talking to you, Amazon) to expand your business in Indonesia. There is big market for digital content in Indonesia, and actually not all of us like to pirate stuffs. So please, provide legal way to accessing your digital contents.

iPhone 5 review

All you need to read about iPhone 5.

Java: Guava library by Google

Just watched this video. Really enhanced my knowledge about Java's Collections. The talk consists of 2 parts. Here they are.

Enjoy :)