A place to breathe

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");







Monday, January 4, 2016

How to install PHP packages with broken dependencies

Cent OS 6 is stable. Most of the people are familiar with it. So I decided to use the Cent OS 6 instead of Cent OS 7. I'm an middle-age ( i mean, mid 30s) software engineer. I don't want too much risk.

Assuming you've upgraded your repositories to Remi. For example, I want to install a PHP PostgreSQL.

sudo yum install php-pgsql 
 
If you get the following error:

Requires: php-common(x86-64) = 5.4.45-2.el6.remi
           Installed: php-common-5.5.30-1.el6.remi.x86_64 (@remi-php55)



You need to issue the following instead:

sudo yum --enablerepo=remi-php55 install php-pgsql 


Friday, January 1, 2016

Welcome to 2016

Hello 2016 !

Welcome to an exciting journey !  I can't wait to explore so many things this year.
2015 has been rough but rewarding. I thank God for everything wonderful in 2015.



About Me

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