Syamsul's Blog

A place to breathe

Saturday, January 7, 2017

Welcome to 2017!

Hi there, welcome to 2017

Life is full of surprises. Let's make full of it.

I don't really know much what to expect on 2017. I guess my first top priority is to fix my ailing guitar and sharpen my guitar skills. It's been a while. My skills are as rusty as my guitar. I also need to buy a new guitar too.

How about programming? Perhaps the biggest deal is database. Somehow I think it comes to a point that I need to master it.

I probably get a brand new spectacles. Seems like the power is going up on the right side.

How about traveling? Not  really in my priority but i guess I need to do some trips sometime in the middle of the year. Destination ? Don't know yet.

Living in this moment is the best thing. Everything else is a bonus.

Wednesday, December 21, 2016

Installing Postgres on Red Hat

By default, Red Hat installs Postgres. But surprisingly, the Postgres cannot be started by default. I guess it's not Red Hat's issue, but it's Postgres install issue. 

Here's the fix for all you care: 

1. create the data folder: 
    sudo mkdir -p /var/lib/pgsql/data
2. change ownership of the folder to user postgres
    sudo chown postgres /var/lib/pgsql/data
3. logon to user postgres: 
    sudo -i -u postgres
4. create the db: 
    initdb -D '/var/lib/pgsql/data'
5. start the db! 
    sudo service postgresql start

You're welcome. 

Saturday, October 1, 2016

How to point your git branch to remote

Often times, you want to point your Git your HEAD to the remote branch other than master. So all you need to do is to do this:

%> git checkout -b my_local_branch remote/origin/my_remote_branch 

And you are now pointing to the local branch pointing to your remote branch !

(Of course, I assume you know what Git is).

Sunday, June 12, 2016

Cocos2D is no more ...

We build our games on Cocos2D-Iphone (back then, that's the thing). we invest in making library out of it, betting that the platform is going to be popular. 

But 2 things that came out that literally kills the project: 

1. SpriteKit
2. Swift 

Sprite Kit is Apple's solution to the game engine. So the Cocos2D-iphone is become more irrelevant. 
Second, when swift came out, Objective-C is not much of popular anymore. 

Cocos2D incarnation into Spritebuilder simply make thing worse. 

I am disappointed. 

Friday, April 8, 2016

How to run Postgres in your Unix

Running postgres on Linux using the following command:

sudo -u postgres psql 

Technically, you're running a "psql" client command using user "postgres" .

Monday, April 4, 2016

How to download Perl modules the easy way

I have had very bad moment with the default "CPAN" client. All these while I never got it to work.

Frustrated, I search around the web for alternatives.

Fortunately, i found a client called "cpan minus" (or cpanm) which really does what you expect: downloading perl modules.

Follow these steps:

1. Download the App::cpanm :
    curl -L https://cpanmin.us | perl - --sudo App::cpanminus 

2. Copy to your bin location. in my case, I like to put it at /opt of my Cent OS machine:
    /opt/cpanm/ 

Now, this is the trickier part. In the documentation, it doesn't really say how you can run it. Now, after inspecting the script in the "bin" folder, I realize that it's just a perl module. So, running perl module, you run:

perl /opt/cpanm/bin/cpanm --self-upgrade --sudo 

Say you want download package LWP.
Now you can download perl module with joy:

sudo perl /opt/cpanm/bin/cpanm LWP

Done!


Sunday, January 10, 2016

Unable to connect to PostgreSQL server

I recently installed PostgreSQL on my server and trying out their configurations. All these while, I just play with MySQL. For some reason, I decided to use PostgreSQL for my current project.

PostgreSQL come with a user called postgres . If you want to use it with PHP, you might end up using the following from its documentation:

$dbconn2 pg_connect("host=localhost port=5432 dbname=mary");


Bad news, it doesn't work on me.

pg_connect(): Unable to connect to PostgreSQL server: FATAL: Ident authentication failed for user

To fix the error, all you need to do is to omit the "host" and the port parameter so that you just use something like this:

$dbconn2 pg_connect("dbname=mary user=postgres password="yourpassword");







About Me

I'm currently a software engineer. My specific interest is games and networking. I'm running software company called Nusantara Software.