Thursday, April 13, 2017

Do you remember?

Do you remember how it was?
What fun we had, what games we played.

Do you remember who we were?
Young and carefree, riding into the future.

Do you remember all of this?
Any of this?

Maybe one day we can look back again,
And be happy for who we were, for who we now are.

Do you remember?

Monday, August 22, 2016

Installing ftw.tika in Plone

I love being able to search in all the documents uploaded into plone. I keep on forgetting that this was an add-on and not natively provided. The latest add-on I tried to enable that feature was ftw.tika.

To install it, first download the tika.cfg file from their github page at Once that has been downloaded, modify your buildout.cfg with:


extends =

eggs =

zcml =

parts =

zcml-additional += ${tika:zcml}
eggs += ftw.tika

zcml-additional += ${tika:zcml}
eggs += ftw.tika

zcml-additional += ${tika:zcml}
eggs += ftw.tika

zcml-additional += ${tika:zcml}
eggs += ftw.tika

Once that is done, run buildout. Then you can start the tika server with "bin/tika-server". Then you can start your plone instance. After that make sure you login and enable the tika add-on in your "site-setup", "add-ons" page.

To allow the tika server to start automatically on Centos 7, create the file /etc/systemd/system/tika.service with the following content:

Description=Tika server

ExecStart=/usr/bin/java -jar /opt/plone/zeocluster/parts/tika-server-download/tika-server.jar -h


Then enable the service with "systemctl enable tika".

Looks pretty nice. Now all office docs are searchable inside.

Sunday, August 21, 2016

Looking back

I haven't actually "looked" at this blog for quite a while. I write to it, of course, but that's mostly as reminders for myself. But today I took it upon myself to at least change the template of the site. And wow... so much memories flooding back.

As I check back the links, even they have to change. There is no more, there is no more Just memories of them now.

My first post was on Feb 9, 2008. Now it is August 21, 2016. That's a good 8 years later. Thanks to this blog I remember I left OSCC around July 28, 2009. Following kaeru to start off Inigo. That didn't last long for me. By April 2, 2010 I was already working at Logistic Consulting Asia. Doing reports in java for their internally developed system. And that stint lasted even shorter. By June 1, 2010 I was working at CIMB. And am still here till this day.

Even my tools have changed somewhat. I barely do any PHP programming nowadays. Mostly writing groovy in great grails framework. And python using the flask framework. And whenever I can, I write a little bit of java for android development. I've been meaning to get into iOS development but haven't found the time nor the motivation yet. Bought the books but that's as much as I have done so far.

Times have changed.

Friday, June 10, 2016

haproxy on Centos 7 with SELinux

Setting up haproxy and varnish with reference to the configuration from these sites: And finally can access plone on the server. But when I check the haproxy status, only client1 can be accessed. All other clients were down with general socket error, permission denied. Googling a bit I finally found out it was due to SELinux. Refer to this page: With the solution from that page, I installed policycoreutils-python and tried to run the command given:
semanage port --add --type http_port_t --proto tcp 8081
But that command failed with the error that the port was already defined. When I looked it up using:
semanage port -l | grep 8081
It belonged to some other type (transproxy_port_t). When I tried to delete the type using:
semanage port -d -t transproxy_port_t -p tcp 8081
Got the error that it belongs in the policy and cannot be deleted. After much frustation and further googling finally found out I can modify the port
semanage port -m -t http_port_t -p tcp 8081
And finally haproxy was able to use the other clients. Finally.....

Thursday, June 9, 2016

Installing Centos 7 on HP G7 Server

When I first initially tried it, the installer cannot detect any local hard disk to install to. After much googling found out that it was because a certain driver for the Smart Array Controller is no longer available on Centos 7. To allow for use of the new driver on old hardware, you need to enable the option. Once the DVD has booted and on the first menu screen, highlight the first option and then press tab which would bring you to a command line where you can add additional parameters to boot. Add the following parameters:
hpsa.hpsa_allow_any=1 hpsa.hpsa_simple_mode=1
And then press enter to boot. You should now be able to install as you wish. After installation, on the first boot, make sure at the menu, press 'e' to edit the parameters and add them again. Then once booted, go to /boot/grub2/grub.cfg to permanently add the parameters to the menu. Refer to and it's comments for the explaination.

Monday, October 19, 2015

Code base to jump start flask-classy system

This post is just to announce my sharing of a source code base which can be used to jump start development using the python micro framework flask and it's excellent extension flask-classy. Do note that this code base uses the Ace Admin bootstrap theme. Please purchase the license for your use from wrapbootstrap or remove it from your source code referencing it.

To begin, you need to clone the repository using mercurial:
hg clone examplesystem

Then you need to create the virtualenv for your system:
virtualenv --python=/usr/bin/python2 examplesystem

Do note that my example here is running on arch linux which uses python3 as the default python version. I suggest the above command to use python2 in your virtualenv because it makes things easier to migrate to systems using python2 (eg ubuntu, centos and others).

The you need to go into the directory and activate the virtualenv:
cd examplesystem
source bin/activate

Then you need to install all the required python modules into your virtualenv:
pip install -r requirements.txt

Once all that is done you need to configure your database access by editing the file app/
Update the SQLALCHEMY_DATABASE_URI line with your own database setting:
SQLALCHEMY_DATABASE_URI = 'postgresql://<username>:<password>@localhost/<database>'

So for this example I changed it to:
SQLALCHEMY_DATABASE_URI = 'postgresql://exampleuser:examplepass@localhost/exampledb

You'd probably want to update the SECRET_KEY, APP_NAME and COMPANY_NAME too.

Then you need to create the appropriate postgres database, role, grant and allow the user to login.
sudo -u postgres psql
postgres=# create database exampledb;
postgres=# create role exampleuser with password 'examplepass';
postgres=# grant all on database exampledb to exampleuser;
postgres=# alter user exampleuser login;
Then you can test the user and database connection:
postgres=# \c - exampleuser
postgres=> \c exampledb
If there is no error, then you can continue to the next step after you quit postgres:
exampledb=> \q
You then need to init the database by running:
./ db init
./ db migrate
./ db upgrade
That should get your database updated with all your models (which currently is only User)
You can try running it now:
Then in your web browser go to the address below and register your new user:

After all of that, you should probably edit your .hg/hgrc file and point the default path to your own repository.

Once everything is set, you can begin your development. Add a new model by adding a file in the app/models directory. For example lets add the file app/models/
from app import db

class Post(db.Model):
 id = db.Column(db.Integer,primary_key=True)
 name = db.Column(db.String)
 content = db.Column(db.Text)

Then you need to tell your app about the existence of this model by adding the following line to app/models/
from Post import Post
Once you have added your model files, you can generate the view associated with that model:
./ genview

You can then see the generated view files at app/views/

Before you can view the view in your web browser, make sure your database get updated first with your newly added model:
./ db migrate
./ db upgrade
Then you can view the view page by pointing your web browser to:

You can then start editing the view for your model and your processes. For example we can add the Post field in your form by changing the ItemForm class in your app/views/
class ItemForm(Form):
 name = StringField('Name',validators=[DataRequired()])
 post = TextAreaField('Post')
That's all for the introduction to this code base. Hope it is useful for you to jump start your development using flask and flask-classy.

Wednesday, June 3, 2015

Hard Link In Rsync

I've been struggling for a few days trying to backup a folder using rsync. The folder is huge but there should be enough space on the destination server. But everytime I did a backup it never finish because the hard disk is full. It seems like the destination folder became bigger than the source folder after using rsync. After much googling, I found out that it might be because of the way rsync handles hard links (which is it creates a new file for each link). Refer to Directory backed up with rsync is much bigger than source . So finally to do the backup properly, the command I had to use was:

rsync -H -a -vv -z -e 'ssh'

Haiya ala Solah