Thursday, October 30, 2008

installing postgreSQL on leopard thru MacPorts

this is my first time installing postgreSQL on Mac OS X and i'm happy to say that it was successful.

i have to tweak some more things though, like allowing remote login (ssh) for the "postgres" account. i'll post the solution once i solve this problem.

i have installed postgreSQL before in redhat, MS$ and ubuntu by source (make, make install..) and by package but never tried installing it thru BSD "ports". there's always a first time so might as well post how i did it.

since leopard is built on Darwin, guys from MacPorts ported the BSD Ports to the latest OS X. this made life easier for me since i'm fairly new to OS X and it takes care of the dependencies.

MacBook Pro
Mac OS X, Version 10.5.5 (Darwin 9.5)
2.6GHz Intel Core 2 Duo

1] if you haven't installed MacPorts yet, install it first. you can find a pretty intensive guide at MacPorts Guide.

now don't get too excited and install postgreSQL right away. ensure first that you have the latest ports by doing:
sudo port -d selfupdate

2] search for the postgres ports by:
port search postgresql
search results:
postgresql7 databases/postgresql7 7.4.21 The most advanced open-source database available anywhere
postgresql80 databases/postgresql80 8.0.18 The most advanced open-source database available anywhere
postgresql80-doc databases/postgresql80-doc 8.0.18 Documentation for the postgresql database
postgresql80-server databases/postgresql80-server 8.0.18 run postgresql80 as server
postgresql81 databases/postgresql81 8.1.14 The most advanced open-source database available anywhere
postgresql81-doc databases/postgresql81-doc 8.1.14 Documentation for the postgresql database
postgresql81-server databases/postgresql81-server 8.1.14 run postgresql81 as server
postgresql82 databases/postgresql82 8.2.10 The most advanced open-source database available anywhere
postgresql82-doc databases/postgresql82-doc 8.2.10 Documentation for the postgresql database
postgresql82-server databases/postgresql82-server 8.2.10 run postgresql82 as server
postgresql83 databases/postgresql83 8.3.4 The most advanced open-source database available anywhere.
postgresql83-doc databases/postgresql83-doc 8.3.4 Documentation for the postgresql database
postgresql83-server databases/postgresql83-server 8.3.4 run postgresql83 as server

postgresql_autodoc databases/postgresql_autodoc 1.25 Automatic documentation generator for postgresql databases
caml-postgresql devel/caml-postgresql 1.8.2 OCaml-interface to the PostgreSQL-database
postgresql-jdbc java/postgresql-jdbc 8.0-311 PostgreSQL JDBC driver
py-postgresql-exception python/py-postgresql-exception 0.2 exceptions for the py-postgresql modules
py-postgresql-greentrunk python/py-postgresql-greentrunk 0.1 greentrunk interface to postgresql
py-postgresql-layout python/py-postgresql-layout 0.3 layout for the py-postgresql modules
py-postgresql-pqueue python/py-postgresql-pqueue 0.1 pure python implementation of the pq protocol
py-postgresql-proboscis python/py-postgresql-proboscis 0.1 postgresql database connector in pure python

3] install the latest version 8.3.4:
sudo port install postgresql83 postgresql83-server

or if with documentation:
sudo port install postgresql83 postgresql83-server postgresql83-doc

i can't say how long the installation will take, i left mine the end it will spew out this message:
# A startup item has been generated that will aid in
# starting postgresql83-server with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist
---> Installing postgresql83-server 8.3.4_0

To create a database instance, after install do
sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'

To tweak your DBMS, consider increasing kern.sysv.shmmax by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf
---> Activating postgresql83-server 8.3.4_0
---> Cleaning postgresql83-server

4] if you want postgres to start everytime you power on your mac then by all means:
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist

note: this is optional. you can start/stop postgres manually.

5] create directory for you database "defaultdb":
sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb

note: don't fret if you don't have the directories yet.. "-p" option of mkdir will create the directories in the specified path. you can also change the "defaultdb" to whichever name you like for your database.

6] change ownership of folder "defaultdb" to postgres
sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb

note: looking at the command above "chown postgres:postgres" means that the "postgres" user need not be created manually. it was already created while installing.

7] initialize "defaultdb" database:
sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'

8] there are two ways to install pgAdmin - by MacPorts or just download pgAdmin3 1.8.4 dmg image here

below are my own "tweaking" steps..

9] i can't create files at postgres home folder so:
sudo chown postgres:postgres /opt/local/var/db/postgresql83/
note: i said home folder since when i do a "sudo su - postgres" and "pwd" i find myself in "/opt/local/var/db/postgresql83/". "su -" will change directory to target postgres' home directory. RTM.

10] change password of postgres account:
sudo passwd postgres
11] i know i'm lazy so i proceeded on creating a ".profile" at postgres' home directory:

a] switch to user postgres
su - postgres

b] create .profile file to add "/opt/local/lib/postgresql83/bin/" to $PATH and some alias
vi .profile
export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql83/bin/:$PATH
export MANPATH=/opt/local/share/man:$MANPATH

alias ll='ls -alhG'
alias lf='ls -alhFG'

12] run .profile by
. .profile
13] now i can issue postgres commands like psql, createdb, createuser without specifying the full path of the executables. make a test database:
createdb test
14] create language plpgsql in template1:
createlang -U postgres plpgsql template1
15] i always use the contrib dblink. contribs are usually at the "share" folder so after searching i was able to locate it at "macports/software" directories. to create "dblink" functions in "test" database.
psql test < /opt/local/var/macports/software/postgresql83/8.3.4_0/opt/local/share/postgresql83/contrib/dblink.sql
16] edit pg_hba.conf
vi defaultdb/pg_hba.conf
17] allow incoming connections from our LAN. CIDR-ADDRESS column will depend on your subnet. YMMV. in my case:
host all all md5
note: i chose "md5" authentication. if you don't know what you're doing just substitute this with "trust".

18] edit postgresql configuration file postgresql.conf:
vi defaultdb/postgresql.conf
19] update or uncomment the following lines:
listen_addresses = '*'
log_destination = 'syslog'
log_rotation_size = 10MB
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
log_hostname = on

20] updating pg_hba.conf and postgresql.conf requires restarting postgres. if you're in postgres' home directory issue:
pg_ctl stop -D defaultdb


pg_ctl start -D defaultdb
21] create a non superuser. this one i'm going to use for my web applications.
createuser -P -e pgapache
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
that's pretty much what i've done with my postgreSQL installation.. enjoy.

Saturday, September 27, 2008

HDR technique

Across the Line, originally uploaded by Stuck in Customs.

HDR composition by trey ratcliff - nice find.

currently reading his tutorial on HDR techniques using photoshop & photomatix.


wonder when will i be able to get my hands on a Nikon D3.. sigh.

Wednesday, April 09, 2008

Cebu Mountain Resorts

Royal Vista Resort / Imelda Aroma Mountain Paradise
121 Centro Ilaya
Maca-as, Catmon
Cebu, Philippines 6006
Tel No: (032) 430-9346 or 430-9441
For inquiries, email:

Mountain View Nature's Park
Sitio Gorohe, Busay, Cebu City
Tel. no. (032) 419-2300 / 419-2083 / 0921 834 7743
50 pesos entrance

Hidden Paradise Mountain Resort
Brgy. Libo, Ilaya, San Fernando, Cebu
(032) 415-9664 / 253-4452 / 414-5212 / 261-6434 / 0906 874 5035
updated contact number: (032) 411-2689

Island in the Sky
Gaas, Balamban, Cebu
Contact No: 09192318848

Roosevelt Mountain Resort (Private)
Babag, Busay, Cebu City
0917 622 1275 / (032) 346-6503

GL Highland Mountain Resort
Gaas, Balamban, Cebu
0928-502-1241 look for Col. and Mrs. Comilang
entrance fee is just 20 pesos

got this from a post.

posting it here for my future reference!

Monday, March 24, 2008

sugar beach rooms at sta. fe, bantayan

we went at sta. fe, bantayan, cebu and stayed at sugar beach. we rented a duplex non-ac room good for 8 persons for only 1500.00 pesos. excess of 8, they charge 40.00 pesos per head. pitching tent costs only 100.00 pesos. that's already a good deal. :)

room has:
+ 2 double beds with mattress, blankets and pillows
+ 1 single bed with mattress, blankets and pillows
+ a bamboo sofa with pull-out
+ own bathroom with showers and lavatories
+ mini kitchen
+ terrace with chairs
+ 2 fans
+ 24 hrs water supply

freebie: we used their cottages for no extra charge.

island shipping sta.fe - hagnaya vv trip schedules

island shipping corporation (RORO) trip schedules for sta. fe, bantayan, cebu to hagnaya, cebu vice versa. trips are 1.5 hours long.

hagnaya to sta. fe

sta. fe to hagnaya

note: they also have trips during night time or round the clock (24hrs) with 1.5hrs waiting interval during lenten season (peak) to accomodate the high number of passengers.

regular fare: 145.00 pesos
aircon fare (promo): 150.00 pesos
children (age 1 to 12): half-fare

contact numbers:
hagnaya, cebu: 032-4352078
sta.fe, bantayan: 032-4380080

there's also a small fast craft (forgot the name) but the fare is 150.00 also.

at hagnaya upon entering the waiting area you have to pay 5.00 pesos terminal fee while at sta. fe, bantayan you pay 5.00 pesos twice. first at the terminal then second at the waiting area.

Wednesday, February 13, 2008

fun ways sending greeting cards

tired of boring e-cards? try out this fun and creative greeting cards. take note v-day is 1 day away.

sample cards:
+ using smokes to spell your message from mapmsg

+ buildings or islands to spell your message from geoGreeting!

+ or etch your message from gMaps

enjoy sending free e-cards!! i did.

Saturday, February 09, 2008

cebu, boracay beach resorts

contact numbers and resorts to stay

bantayan island:

+ sugar beach
- non ac rooms starts at PhP 800.00
- you can pitch tents
- +639177846849, +639168536843, +639217755058

+ kota
- +63324196135

+ budyong
- +63324385700

+ ticketyboo

+ st. bernard
- ac rooms at PhP 1200.00

+ sta. fe beach club
- +63324380031

+ yoneek beach resort
- +63324389124, +639179993829

island hopping
+ olango and/or pandanon island
- +639197846849

boracay island
+ contact boracay getaway (travel & tours) look for grace, malou, jay
address: san vicente village, mandaue city, cebu
- +63323499316

+ d'mall station 2
- has several rooms for rent
- PhP 2500.00/room, good for 2 or more!

note: number are in international format (to help those calling from outside the philippines)

Monday, February 04, 2008

paper models project : subaru wrc 2006 photos

as's some pictures i've taken of my still unfinished subaru impreza paper model or cut-outs.

top view of front grill, hood, car cover and interior. btw, i used yellow A4 paper just in case your wondering why the "5" background is in yellow.

front right corner view. you can see the seat belts/harness..

bolted in..missing tires, back bumpers, windshield, wipers (yes it has this tiny wipers, i'll connect it later for the final touches), side mirrors and headlights assembly

i'm still having a hard time figuring out how to attach the headlight assembly.

i'll post more pics of my progress later. ciao.

Tuesday, January 22, 2008

paper models fold techniques

follow-up on paper models, paper crafts, paper cut-outs

i am such a noob. not that i'm complaining but i've spent more than 12 hours on the wrc 2006 front grill alone. that's because i don't know the difference between the two basic folds! not that it's my fault, can't read hiragana or kanji plus the pdf pattern has the japanese characters embedded on it, reason why i can't select-copy the words and have it translated. here's the legend:

after hours of googling i finally found the meaning of 谷折り which means "valley fold" by or "valley snapping" by babelfish (what the heck is snapping anyway??) finally i decided, googles' translation is better.

now i'm left with 山折り to translate.. if means "valley" and 折り means "fold" (just guessing) what's the antonym or reverse of "valley"? so i translated the words "hill" and "mountain". "hill" is and "mountain" is . am i genius or what?? haha!!

japanese to english:
谷折り - valley fold
山折り - mountain fold

searching again, i found out about the basic folds in Origami. cool. now i can fold those mind boggling/puzzling cut-outs again.

Friday, January 18, 2008

paper models/crafts/cut outs

i'd like to share my latest hobby -- paper crafts/paper models/paper cut-outs.

must haves (required):
+ scissors
+ paper or box cutters
+ glue - elmers glue is ok
+ printer
+ ruler
+ empty ballpen - used for making neat the empty ballpen thru a fold mark for easy folding (nice trick btw)
+ paper (light to heavy type) - if you like japanese cutouts (like me) better buy A4 standard size since most patterns are in A4. word of advice -- make sure when printing the patterns not to use the "fit to margins" settings or anything similar, use "none" instead to print the actual pattern size.

+ air brush - haven't done any project yet with paint since i always print in color
+ paint brush
+ glue gun
+ thin double sided tapes
+ paper clips - used for holding two edges together
+ markers
+ sticker paper - used for printing sticker cutouts i.e. car stickers/vinyls

here are some links i came across while "googling" to get me started. they are absolutely free so feel free to download and print.

for beginners:
+ i like subaru

5/10 difficulty (7/10 for beginners like me):
+ more impreza, f15 etc..

latest project of mine is the impreza 2006. see photo below:

others, with varying degree of difficulty:
+ yamaha TMAX - comes with english instructions, separate color and white versions.
+ check out this taiwanese 3D paper model site. they have a wide range of categories i.e. robots, weapons to furnitures.

enjoy! i'll post pics later - excited with my subaru impreza ;)

Saturday, January 05, 2008

Ryan vs Dorkman Part Deux!

Ryan vs Dorkman Part Deux!

enjoy, and may the Force be with you!


© New Blogger Templates | Webtalks