Syamsul's Blog

A place to breathe

Thursday, April 19, 2018

Surviving 2018

Hola

Welcome to 2018. Many things happening and I don't even have time to type !. Well, majority of the things are just learning. Many tech, and also non-tech.

One of the major decisions that  I have to make is to switch to Android from iPhone. This is a huge decision, but actually an easy one.

First of all, my beloved iPhone is still iPhone 4S. That's right my friend. The best phone ever. And the main issue is it keep dropping calls. Well after few years (about 5 years) using, I guess it's time.

Second, to purchase another iPhone is just too expensive. I was thinking of buying iPhone X but I figured that the price tag is just too much. So I decided to purchase a Samsung J+, which sadly, I misplaced it after a few days of purchase. Anyways, I'm still searching for it and hopefully will find it somewhere.

Another new cool discovery after Python is Phaser - a new game engine developed by Photon Storm. I mean, I manage to compile and got into my Phone with ease. The good news is it's running Javascript ! So I don't have to learn new things. Writing game in C++ is just too much. I mean, I'm not going to release a Quake here!

A sad new thing about gadgets is actually there's not much of a new thing. I remember when iPhone was released and we just can't wait for an SDK. Those days.. good times.

I'm toying of an idea of creating my own phone. But naaah.. too much effort for this. Too many phones that are good in the market anyway. Samsung,Oppo, Vivo, Xiaomi ... just choose.

But I think Javascript and Python has got some synergy there for many applications including app on the phones.. it's just that no one really package it in a nice way that they could work together seamlessly.

We'll see. Anyone got free time ? ;)




Wednesday, July 19, 2017

Using Angular Generator

Using Angular Generator is easy.

Since I like to work locally, I use "--save-dev" option. if you want to install it globally, replace "--save-dev" with "-g"

Here the steps.

1. npm install grunt-cli bower yo generator-karma generator-angular --save-dev
2. yo angular
3. npm install grunt-karma karma karma-phantomjs-launcher karma-jasmine karma-core jasmine-core phantomjs-prebuilt --save-dev

Now you should be able to run grunt:

> grunt
> grunt serve

It is now published on http://localhost:9000

Enjoy!

Monday, February 20, 2017

The all powerful Shebang

When you write scripts, often times, you'll see the following line at the top:

#!/usr/bin/python 

Now what is this?

This line allows you to run your script as the executable, without invoking the interpreter. For example, if I write a python script called blabla.py, I will need to run it this way:

%> python blabla.py 

change the permission and add the shebang line, will allow you to run it this way:

%> chmod +x blabla.py
%> ./blabla.py 

if you want to run it in the background, then call the no hangup:
%> nohup ./blabla.py 

It will run itself doing its thing. Time to go to sleep while waiting for it to finish.

Wednesday, February 15, 2017

Changing NPM default module folders

When you install NPM on Linux, it will install into the root location by default. Often times, it could cause trouble if you want to modify the node_modules. 

To know where the node_modules are going to be installed globally: 

%> npm config get prefix
/usr

Now, I don't want to play around with the '/usr' permission because it is a standard OS directory. Trying to modify some stuff for node and have to deal with the top root directories is just not worth it. 

Now, change the NPM prefix: 

%> npm config set prefix=$HOME/.node_modules_global

so test it now: 
%> npm config get prefix

You should see that it list :
/path/to/home/.node_modules_global 

Change the path inside your .bash_profile: 
%> export PATH="$HOME/.node_modules_global/bin:$PATH

OK, now update your environment: 
%> source .bash_profile

Try installing an NPM just to check whether the global works: 
%> npm install npm --global
%> npm --version 

You should see your version changes from previously because it is now getting the latest npm.



Thursday, February 9, 2017

Python - why you should give it a try

I have programs written in Perl. Whenever I revisited the code, I've forgotten what I've written, so I would stare at some of these variables for a few minutes before I remember. I have a line of code that
I use the spaceship operator : ' <=> ' . I love it. But whenever I come back to this, I was like. Oh man, what is this. ??

So somehow a colleague of mine have written some Python and got stuck on some issues. In order to help him, I have to learn Python.  So i decided to rewrite a portion of the my Perl code to Python. The result is... wow, efficiency. !

I was thinking. Why I wrote so fast on Python? Hmmm... Then I realize a few things:

1. There's no curly brackets { }. So I don't have to worry about missing brackets.
2. Semicolon ';' is optional. So being lazy, I just skip the semicolon
3. Strong community support. Packages are all in PIP . Getting a package is as simple as running
    pip install  package_name
4. Works well on both Windows and Linux.

So far I'm happy with Python. I probably use more and more of it.


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. 

About Me

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