Sunday, July 29, 2012

Ubuntu, PostgreSQL, pgAdmin

I've been interested to play with PostgreSQL for a while and it looks like now is the right time to have fun and go mad at it since my new work requires it.

My machine/initial setups is as follows:
  1. Ubuntu Server 12.04 64bit running on VirtualBox (love free stuff!)
  2. PostgreSQL 9.1 as part of Ubuntu Server installation
  3. pgAdmin installed in OSX
I've encountered a few hiccups when trying to connect the pgAdmin to the PostgreSQL server and here are the steps to avoid that in the future.

0. Configuration Files

The locations for the main configuration files specifically for Ubuntu Server is at:
/etc/postgresql/<version>/main 
For example, because at the time of this writing I installed the PostgreSQL 91, the configuration files are located at:
/etc/postgresql/9.1/main
The content of the configuration directory should contain the following files:
enathaniel@ubuntu:/etc/postgresql/9.1/main$ ls -la
total 52
drwxr-xr-x 2 postgres postgres  4096 Jul 29 00:34 .
drwxr-xr-x 3 postgres postgres  4096 Jul 28 23:50 ..
-rw-r--r-- 1 postgres postgres   316 Jul 28 23:50 environment
-rw-r--r-- 1 postgres postgres   143 Jul 28 23:50 pg_ctl.conf
-rw-r----- 1 postgres postgres  4693 Jul 29 00:28 pg_hba.conf
-rw-r----- 1 postgres postgres  1636 Jul 28 23:50 pg_ident.conf
-rw-r--r-- 1 postgres postgres 19250 Jul 29 00:24 postgresql.conf
-rw-r--r-- 1 postgres postgres   378 Jul 28 23:50 start.conf

1. Modify the PostgreSQL configuration file: postgresql.conf

Find the listen_address entry, uncomment if necessary, and modify its value to asterisk (*), which means to bind the PostgreSQL server service (daemon) to any IP Addresses of the server machine:
 listen_address = '*'
The default PostgreSQL installation does not bind itself to any particular IP Address of the server. One can also bind the PostgreSQL server service (daemon) to a specific set of IP Addresses if the server has more than one by using comma between values:
 listen_address = 'localhost, 192.168.0.114' # my server address is 192.168.0.114

2. Modify the PostgreSQL Client Authentication Configuration file: pg_hba.conf

Insert a line to pg_hba.conf file to grant client access to the database.
host    all             all             192.168.0.0/24          md5
In short, the above lines will do the following: grant client, via network connection TCP/IP with or without SSL (host), access to all (first) database for all (second) users from the IP addresses of 192.168.0.0 to 192.168.0.255 and use md5 password encryption.

3. Change password of the postgres user

Access PostgreSQL via command-line "psql" and update the password
enathaniel@ubuntu:/etc/postgresql/9.1/main$ sudo -u postgres psql postgres
psql (9.1.3)
Type "help" for help.

postgres=# \password postgres
Enter new password: 
Enter it again: 
postgres=# \q
The psql command must be run as postgres user (hence the sudo -u postgres) because that is the only user that has an account in the default installation of PostgreSQL.

4. Install adminpack extension

pgAdmin typically would give warning when it detects that the PostgreSQL instance does not have adminpack installed. To install the adminpack extension, the following psql command would do the trick
enathaniel@ubuntu:/etc/postgresql/9.1/main$ sudo -u postgres psql
psql (9.1.3)
Type "help" for help.

postgres=# create extension adminpack
postgres-# \q

5. Connect to PostgreSQL instance from pgAdmin
The following screenshot should give some idea how to connect to the PostgreSQL instance.


Voila, we're done!

PS: Yes, there's no food, fruits, or traveling story in this post. 

Monday, July 16, 2012

Summer Freedom Week Day 1

This week will be my last week before I go back to the grind, so we decided to have fun whenever we can. Here are our destinations on the first day of our "Summer Freedom Week!"

1. Granville Island
Granville Island entrance
We  have not been to Granville Island for a while. Our main target here was to have our lunch at "Go Fish".

Unfortunately it wasn't meant to be since they have to go fishing on Monday. So instead of feeling sad and depressed, we took a few pictures since the weather was awesome.
Burrard Bridge at far
Granville Bridge across the other
Must be nice to have a waterfront view apartments, wondering how much a unit may cost your wallet.
Waterfront Apartments
Since we were hungry, we decided to leave Granville Island. Instead of going straight to the parking lot, we went through a few stores for a quick window shopping.
Kids Market
Freaky Eyes on top of Kids Market
Car stickers
We may have buy these stickers soon.

Sometimes Vancouverites amazed us, there are plenty of them enjoying their Monday as if money grows on their backyard. We can only guess what they do for a living.
Woofles & Meowz
Woofles & Meowz? The Z comes from the 90's? Kidding aside, too bad we don't have pets.
Weird Sign
Came across one shop that we have no idea what it sells because we couldn't find the entrance door nor we can see the inside. Who knows eh..?
Yes, I'm the Boss
Boss sleeps throughout the day, leaving us to enjoy to the fullest!

2. SalaThai

We went to SalaThai for our lunch because of the proximity and also ever since one of our favorite Thai restaurants near our home has closed due to a new apartment complex is about to be built there, we haven't had Thai.
A Bowl of Soup (No Name)
Wife ordered Beef Phanaeng Curry that comes with this unknown bowl of soup (a bit sour and slightly spicy).
Beef Phanaeng Curry
While I opted for my usual: Lard Na
Lard Na
The Lard Na was a bit unusual because typically Lard Na isn't that soupy. But it tastes good, so who am I to judge?
Calamari
The calamari was a late order because my stomach was not quite there yet and the Boss demanded his lunch as well: MILK PLEASE! Lucky we're prepared.

Overall the lunch was quite nice and the price was reasonable.
Roaming Dragon Food Truck
Came across one of those "hip" food truck. The last time I tried a food from a truck, it was okay but overpriced. Some of my friends have had similar experience. Speaking of food truck, have you ever watched the Eat St. TV show airing at the Food Network?


3. Vancouver Public Library
Vancouver Public Library
VPL was our last destination before heading for home. We had a few books of our interest that we wanted to borrow.

That's it for our Summer Freedom Week day one adventure. Day two is coming up tomorrow!


Friday, June 22, 2012

Coming Back From Hiatus

What's Happening
He has captivated us since day one
Ever since we had our first child, our lifestyle has changed drastically. Having said that, we're having TONS of fun spending our time with the little one. This blog may have to change its theme from food and travelling to baby and/or technology related as the latter topics are more relevant to our everyday life from now on. Unless if we travelled with the baby right? (^_^)

Where The Hell Is Matt 2012
Matt Harding from Where The Hell Is Matt posted his latest dancing video yesterday.
WARNING: Viewing his videos may trigger your emotion. 



As usual, it's him dancing. But this time he invited/included more people and choreographed (albeit not professionally) the moves. One of the scenes, which showed him dancing in Bali, reminded me of my time there. Bali is a wonderful place to be and I hope one day we will have another chance to visit Bali again.
Bali

Judging from the last scene, I have a feeling that this may be Matt Harding last video.

Indie Game: The Movie
Last week I bought my first indie movie, Indie Game: The Movie.



The movie is about the people behind a few popular indie games(Super Meat Boy, Braid, Fezand their thought-process building the game. I really enjoy the movie because growing up, I've always wanted to make my own game. That interest drives me to major in Computer Science. Sadly, I have not made one game up until today despite taking a Computer Graphics course at university (^_^). Perhaps it is something to revisit later on in my life. 

Monday, May 28, 2012

Facebook Interview and IPO

In 2007, I submitted my resume to Facebook for fun. I didn't think I would get an interview but since I got nothing to lose, I thought why not?

To my surprise, I got a reply and an invitation for an interview.


I went through two interviews: one with HR and the other with a technical person (Software Engineer, who else right?). The HR interview was just an opening; they wanted to get a feel of me as a person.

The technical interview was awful: I got paired with probably one of their smartest engineers. I recalled one of the "big" questions was how would I improve memcached (a distributed memory object caching system) performance.

I knew what memcached is back then but since I have never used it, I wouldn't know much technicality of the underlying system. NOTE: the answer was to switch memcached implementation from using TCP to UDP, which, apparently was an on-going internal effort at Facebook to have a faster memcached system in the planet.

Let's just say that I was not Facebook material :). I don't feel bad to admit that considering that Facebook have plenty smart people.

Fast forward to the end of 2011, they knocked on my door one more time.



I politely declined the invitation because I was involved in a long-term project and I enjoyed (and still do) what I do.

Last week, Facebook IPO-ed with starting price of $38 and peaked at $45.

Hmmm......

To put things into perspective:

http://www.insidefacebook.com/2012/02/06/facebooks-99-taxes-restricted-stock-units-rsus/

Such is life. Oh well. As long as you're happy even if you don't win the lottery right? (^_^)

Tuesday, April 17, 2012

Nitobe Memorial Garden, Cherry Blossom, and Las Margaritas

We went to UBC last Saturday for some errands.

UBC Logo
The weather was a little bit gloomy when we arrived but improved vastly as the day went by.

Nitobe Memorial Garden

Nitobe Garden just opened a few minutes after we arrived and since we had not been there for a long time, we decided to venture in.

Nitobe Memorial Garden entrance
The entrance fee is $6 for adult, all-day and free for UBC students. Sadly, we are no longer scrappy poor students with the "golden" student card roaming free using the university facilities as we pleased.

Nitobe Garden wall
Nitobe is a great place to walk-around especially between classes when you've got nothing else to do and the library is over capacity.


The first exhibit right off the bat from the entrance gate is a Japanese-style house.


There seems to be a strong relationship between UBC and the westcoast Japanese-Canadians.


Alas, we couldn't explore the house any further.


Maybe there's nothing inside?


This small waterfall lead to a big fish pond nearby.


There were stepping stones to go across the shallow stream.


The stream passes under a small bridge ahead, near the bigger Japanese stone pagoda.


The weather continue to improve, creating a stunning view.

Center of Garden.
The big fish pond occupies the center of the garden where a small hut with a wooden bridge lies nearby.

Koi Fish
We saw a big, fat Koi fish. Probably as big as my calf.

Back in the days...
The trip to Nitobe brought back the memory of our days being UBC students. For whatever reason, I feel strongly toward UBC than wife. I love coming back here and occasionally "abuse" my alumni status to borrow awesome books.

Cherry Blossoms

We came to UBC at the right time, we saw plenty of cherry blossoms.

Awesome Weather
Cherry Blossoms
More Cherry Blossoms
... and more
That is the best cherry blossoms covered sidewalk I've ever seen so far this year.


Suddenly, we had to leave UBC since our tummies were grumbling and the little one seemed a little bit antsy, signalling mommy to eat lunch ASAP.

Complicated Parking Payment machine
On our way out, we had to face a very complex parking payment machine. Luckily, we were out in a matter of seconds, not minutes.

Las Margaritas

Last week we had Mexican for lunch. This week, due to the proximity and the urgency, we opted for another Mexican at our regular Mexican restaurant: Las Margaritas.

Interior
Las Margaritas has been our go-to Mexican restaurant for a few years due to its location somewhere around Kitsilano, 4th Avenue, and somewhere in our route between UBC and home.

Pictures
The interior design of Las Margaritas is quite entertaining.

Tortilla Chips and Salsa
Wife likes the chips and the salsa. They do make a good salsa.

Virgin Margarita
Virgin Margarita, Strawberry mixed with Lime is my all-time favorite. I always and must order this. I secretly wish I knew their recipe to make my own at home. Time to devise a plan to get it from their kitchen.

Deluxe Quesadilla
My order this time around is the Deluxe Quesadilla with grilled Chicken breast. It came with delicious black beans and salad.

Beef Burrito
Wife decided to had her revenge since she didn't get what she wanted last week. Beef Burrito with sauce all over seems to be a great choice after a long walk at UBC in a nice sunny day.

As always, Las Margaritas delivered and we're pleased. Once the bill had been paid, we went home and spent the rest of the day to rest.