Stands on the shoulder of Giants

My rambling and thoughts. Powered by Obtvse

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 :)

Upgrading to Mountain Lion

Mountain Lion is the latest version of OS X, also known as OS X 10.8. It was released at 25th July 2012, distributed only through Mac App Store, with USD $19.99. I spent 20 hours for downloading it, using my dedicated 1 Mbps Internet connection at home. It weight at 4.34 GB file, so it will need a lot of time downloading, considering the situation in Indonesia.

I decided to purchase it, because there are many ositive reviews given, since Apple releasing the Golden Master version to some developers. Apple stated that it brings 200+ new features for user, and it solves some annoyances in Lion. The other thing is, you can install Mountain Lion in other Mac, without any additional cost. My wife's MacBook Pro runs Snow Leopard, and it can easily upgrade to Mountain Lion.

After doing some reading, I decide it is better to upgrade than doing some clean install. Doing clean install surely bring speed to my Mac, but it will need a lot more time to do. I am planning to do it someday, so I save the installer to external hard drive.

If you are planning to upgrade to Mountain Lion, you better doing some research first. First of all, you need to check, whether your Mac is able to run Mountain Lion, you can refer to requirements from Apple. Second, backup your computer using Time Machine. Third step is to access RoaringApps site, where you can find a list of application that compatible with Mountain Lion. This step can help you to decide, since it can cost you a lot to buy new apps just because it is not compatible with Mountain Lion. And lastly, since Mountain Lion does not come with a DVD recovery, you need to create it before installing it, since Apple will delete it after installation process. You can use a DVD or a 8 GB USB flash disk as the media, using tutorial from Ars Technica.

The installation is smooth, it took me 30 minutes to finish the installation. I was suprised that it was running fine. No hassle at all. Hat tip to Apple, for creating such an easy process to upgrade your operating system.

Sparrow is gone

Today, Sparrow announced that they're joining Google GMail team, for developing next generation of GMail. Since they are going to be busy with Google, now further development for Sparrow.

It sucks I may say. F*ck.

Note: Love how Marco Arment wrote about it. And John Gruber's response is hillarious.

iOS and Jailbreak

Jailbreaking your iOS devices

I own two iOS devices at the moment. An original iPad and a iPhone 4S device. As a self-proclaimed geek, I jailbroke them. My iPhone runs iOS 5.1.1 and the iPad runs on 5.0.1 version.

I love jailbreaking my iOS devices. They give me tweaks that improve my device capabilities. For instance, I once purchased a tweak that give iPad capability to make a phone call. Jailbreak also make my iPhone more powerful and flexible, and easier to use.

These are my default tweaks installed, you can find the description in a lot of sites:

  1. SBSettings
  2. CyDelete
  3. FolderEnhancer
  4. iFile
  5. IntelliScreenX
  6. DisplayOut (for iPad)
  7. openSSH Server
  8. Springtomize+

Problems in jailbreaking process

Jailbreak process is a double-edged sword. In one side, you will get extra flexibility and power that Apple does not provide. As a power user, you might love this because you can control your device, more than Apple can. Something that Android users proud of than Apple users.

But there is a catch, since jailbreak tweaks sometimes messing around with iOS internal stuff. Stuff like iOS internal plist files and daemon's configuration. It can lead to a serious problem. Your device's performance can be very slow. Or most of the time, your battery suddenly drained faster.

I myself experienced these problems with my iOS devices. With my original iPad, its performance drops till it can not respond to my touch at all. These symptoms occurs when I perform 'Update All' operation in the App Store app. I have to wait for the update operation finished to gain the responsiveness.

I finaly began to investigate the culprit lately. I perform the 'Update All' operation, and so it began. The iPad get slower and slower until I can not interact with it at all. After examining for a little while, I noticed that one of the icon start blinking very fast. Finally I found the culprit! Now I can continue to find the solution.

After doing some research, I found that iOS gives a real-time priority for display related process, including icon drawing. As the icon tries to update all the time, the OS pratically ignores all the input and resulting to a non responsive system.

The fix is relatively simple, I just need to identify the package, and remove it. Since it does not response to my touch, I need to find other way to uninstall. This is the moment that openSSH package comes to rescue. Since an openssh server instance is running in my iPad, I can SSH to it by using terminal in my laptop. And the another important fact thing about Cydia package, they are actually a debian package.

What does it mean? It means, along with the Cydia app, I already have apt and dpkg command in my iPad. I can remove package as easy as managing my Debian server.

But it is still far from over. Unfortunately, I switch the openSSH process off. So, now I have a non-responsive iPad with no way to fix it. The final way is restoring it. This time, I choose not to jailbreak it. The good thing is, the problem now is gone. My iPad keeps its performance, no lag at all.

The other problem is with battery life. I find my iPhone battery is draining so fast, comparing to my brother's iPhone 4. I kow it is not an apple to apple comparison (pun intended), but the numbers showing that there is something wrong with my configuration.

Fortunately, this problem does not force me to restore my iPhone. I found an App, developed by UC Berkeley named Carat. It is a research application aiming to detect energy bugs in your smartphone. At the moment, you can install it in your iOS and Android devices.

Carat is very easy to use. All you need to do is launch the app, and let it monitors your device's energy consumption for few days. The application will give you a notification when it has finished, showing energy bugs application. You can read more on this matter in their website.

Carat's reports show that one of my tweaks consume most of my device's battery. The tweak is Springtomized+. I used it for changing my homescreen layout, my dock and task manager behaviour and the folder appearance. So, it is no wonder why Springtomized+ eats the most. I finally removed it along with some other apps that included in the list.


I have not done another examining about the battery life after Carat's result, but I feel that the battery life is increasing. I will write about it later.

The lesson here is you have to choose your jailbreak tweak carefully. And you mus read the description very carefully before installing it. Jailbreak still provides a lot more tweaking, but with greater power, comes greater responsibility. You must provide emergency plan for fixing the side effect.