Skip to main content


Showing posts from 2010


Something I came up in during the small FAD we had in .MY last week.

Yum's fastestmirror plugin is kindof broken by design, because the plugin's definition of 'fastest' means shortest handshake time, rather than shortest download time (highest bandwidth).

If a particular country had nearby mirrors which have a really low bandwidth, fastestmirror actually made the download speed slower for users who are using it. (in my case, the nearby mirrors are extremely slow, its faster to simply force yum to grab from Taiwan mirrors, and I believe lots of local users here are also affected by this)

This plugin is a hack which complements fastestmirror by timing the metadata download time of repositories, sort them and set fastestmirror.conf to only include the top 3 mirrors with shortest metadata download time for each repository.


To install, simply copy the file into /usr/lib/yum-plugins/ and create a /etc/yum/pluginconf.d/timemirrorbandwidth.conf with …

Hooking zope.component to any python project

Zope Component Architecture is a set of libraries used for aiding in writing component based applications using python. It provides some useful libraries to handle common patterns such as factory, adapter, multiadapter, and subscribers.

In Inigo, we utilizes Zope Component Architecture widely in our development process as it helps us in decoupling components in our system.

Anyway, lets get straight to the point of this post. Basically, what I'll go through in this post would be one method of hooking zope.component together with a configure.zcml into your current python project. It might not be the best way, but the simplest that I know of.


You'll need to have these installed in your python environment: zope.component, zope.configuration.Your project is packaged as an egg (probably possible if not as an egg, but I never tried that)

Setting up

In your project egg module directory, create a file called configure.zcml with this content:

<configure xmlns="http://name…

Fedora 14 Release Party KL

Date: 6th November 2010 (Saturday)
Location: Inigo Consulting Sdn Bhd, B-06-08, Subang Empire SOHO
Time: 14:00-18:00

What we'll be having there (tentative):

Some noms :P (obviously)A Fedora local mirror for anybody who want fast download when installing/upgrading their Fedora to F14Discussion/planning session on how to kickstart the stalled local community (yep I know most of us are quite busy recently)Games? (bzflag? or any games even, card games such as Monopoly Deal are fun too, you decide ^.^)

And probably any random stuff we might came up during that period XD

For more info, ping the Fedora Malaysia mailing list at

Contact (Inigo's Office): 03-56111013


hurm .... trying hard to restart blogging .. been quite occupied recently and been procrastinating on blog for quite a long time ..

Anyway, here's some updates on what i've been working on and a rough summary on stuff i've discovered/learnt:


Inigo Consulting is growing slowly and steadily. We're getting better in our specialization stack : Plone, Zope3, Component Architecture. We're discovering lots of new ways to be efficient and modular in coding stuff in Python by utilizing the tools and libraries from the Zope Toolkit and stuff developed by the communities surrounding Zope. (eg: buildout, zope.component, zope.schema, grokcore.component ) by utilizing them for non-zope stuff. Learning new ways to package and maintain python eggs, unittest, by utilizing buildout and a number of buildout recipes out there.

Recently I've been helping out with Startifact / Martijn Faassen and learned quite a lot of stuff from the work I did for him, mainly in Grok, Javascr…

Unifi 10

Kuala Lumpur, MY

Washington, US

Tokyo, JP

Perth, AU

Integrating hurry.resource into BFG

Back in PyCon APAC last week I was introduced to hurry.resource by its author, which is also one of the founder behind Grok, Martijn Faassen.

So, what does it do?.

Read Here

Lets go to the fun part

Setting Up

Assuming you are using one of the default BFG templates

First, enable ZCA. (or just do this in
config = Configurator(root_factory=get_root, settings=settings)

Do this little modification on the get_root function in
from repoze.bfg.interfaces import IRequest

def get_root(request):
return root

Add some component codes, name the file
from hurry.resource.interfaces import ICurrentNeededInclusions
from hurry.resource.interfaces import ILibraryUrl
from zope.interface import implements,implementer
from zope.component import getUtility,adapter
from hurry.resource import NeededInclusions
from repoze.bfg.interfaces import IRequest
from hurry.resource.core import …

"They'll realize that they're different."

Quote from JDrama CHANGE. Episode 5

Keita Asakura

I'm sorry for being arrogant.
I used to be a grade school teacher.
Last year,
I was in charge of the fifth graders.
Anyway, they fight quite often.
But some of them become spiteful
and then sometimes it leads to bullying.
When those problems arise,
I would tell them,
"Let's think."
"You're in the same class,
so when there's something you don't like or you're not satisfied of, then tell them properly,
and listen to them properly."
"Then let's think thoroughly. Then..."


They'll understand each other.

Keita Asakura

They'll realize that they're different.

Since we think we're all alike,
we get mad when we get contradicted.
When someone acts different, we think "What the heck?"
That's when fights and bullying begin.
But no two people are alike.
Everyone thinks differently and ha…

list as default value in class __init__() - watchout for surprise

Note to self: don't use list as a default value in class methods if its going to be modified later, as it might cause some trouble.

Just realized something:

In [1]: class MyClass(object):
...: def __init__(self,data=[]):
...: = data
...: def addData(self,value):

In [2]: obj = MyClass()

In [3]: obj.addData('hello')

In [4]:
Out[4]: ['hello']

In [5]: obj2 = MyClass()

In [6]:
Out[6]: ['hello']

In [7]: obj3 = MyClass([])

In [8]:
Out[8]: []

In [12]: def myfunc(val,data=[]):
....: data.append(val)
....: return data

In [13]: myfunc(1)
Out[13]: [1]

In [14]: myfunc(2)
Out[14]: [1, 2]

In [15]: myfunc(3)
Out[15]: [1, 2, 3]

At first i thought its a bug/weirdness, but after banging my head a bit to wall and a long stare at the ceiling, it made sense.

During class definition, the list object already instantiated. Therefore, th…

Using deliverance as WSGI pipeline to elegantly theme a repoze.bfg project

I was looking around for template inheritance solution for repoze.bfg, as it seems like by default, BFG does not have context view traversal support to acquire template macros.

In Plone/Grok template inheritance can be done by registering main_template as a view, and using a template that fill the slots in main_template such as this:
<html xmlns:tal=""
<div metal:fill-slot="main">
Some content

However, by default, repoze.bfg does not support getting view macro from a context. So a PageTemplate object need to by passed by a view in order to use the macro from the template. Eg:
from repoze.bfg.chameleon_zpt import get_template

def my_view(context,request):
main_template = get_template('templates/main_t…

repoze.bfg - Introduction and bootstrapping it on buildout

2 months without a post here .. T_T ... must .. restart .. blogging ...

Anyway, I've been poking around with repoze.bfg since last week and growing to love it by the days. Been thinking to post a blog on getting started on it but was a bit lazy .. until I saw lowkster's post about bfg at a few days ago.

Full documentation at

A little review

I love Zope Component Architecture because the modularity/reusability it offers, but Bluebream, Grok and Zope2 feels a bit big for simple web apps or for introducing ZCA to new people. Then I saw BFG.

BFG simplifies many concepts which I'm familiar with in Zope2/Zope3, and it does it without overwhelming developers with other parts of the framework. Not endorsing any type of storage backend, and giving an option between URL routing and traversal or a mix of both is a plus.

The initial base code is simple and straightforward, and there are no need to subclass any parent class when you want to crea…

HOWTO: Linux Container (LXC) on Fedora 12

Those who are familiar with BSD Jails or Solaris Zones might be quite familiar to the concept of OS-level virtualization. The Linux world have several options for this, such as the User Mode Linux (UML), OpenVZ, Linux Vserver, and most recently, Linux Container (LXC).

Unlike the other alternatives, which requires specially patched kernels to run it, LXC got fully functional in the upstream kernel since 2.6.29, which is a plus as it made it easier to deploy it in many prexisting distros which ship 2.6.29, including Fedora - without messing around with the distro packages.

In this HOWTO, I'll guide through the process of deploying your own LXC in Fedora 12, with NAT to libvirt's virbr0


yum install libvirt lxc

(ping me if i forgot to add any packages)

start libvirt so that virbr0 is configured
/sbin/service libvirtd start

mount control group in /cgroup
echo "none /cgroup cgroup defaults 0 0" >> /etc/fstab
mkdir /cgroup
mount /cgroup

LXC Fedora Script

The lxc rp…

FOSS.Org.MY Meetup : March 2010

FOSS.Org.MY (formerly: MyOSS) Meetup is BACK!!!! with a new name, and a new format, and new timing!!

We will be having Lightning Talk session after the speaker's talk, if you have anything to share, do contribute to the Lightning Talk.

Open Source Software in Digital Content Creation

A general overview of OSS used in Digital Content Creation industries with a focus in animation production from small personal projects to Hollywood production.

About the Speaker

Victor Yap helps companies build cost-efficient production workflow for 3D animation. His current project migrates open source solutions, with programs like Blender to a constantly developing 3D animation environment. Blender is a strong open source contender to mainstream programs such as Maya and Softimage. Armed with an Electronic Arts degree and deeply involved with Open Source Software (OSS) …

Event Report : IIUM FOSSDay 2010

Event date: 19th Feb 2010
Location: International Islamic University Malaysia (IIUM)

(I know, I tend to be lazy to write reports, anyway , here goes)

Back on 19th Feb 2010, Fedora-My was invited to IIUM FOSSDay 2010 to give some talks and to handle an installfest. Me (fas:izhar), and Snittit/Zul (fas:sniffit) , Rizal and Meng went there representing Fedora-My.

Sniffit handled the installfest, and I gave a talk based on Shakthimaan's I want 2 do project, tell me what 2 do slides and also a general FOSS talk which introduces what is Free Software and what is Open Source (slides)

Crowd for the talk was rather large, around 20-30 people, and for the installfest was, there was around 10-20 people , came and go. Bunch of Fedora 12 LiveCDs was given out to the crowd during the event, especially to the installfest attendees.

Besides us, the PCBSD-My group and OWASP-My group was there too, giving talks throughout the event. Overall it was a great, got to met some new faces in the local FOSS sc…

ctypes : Loading simple C library in Python 2.5+

Just discovered this when I was glancing through the pystream (a CUDA library for Python) source codes.

In Python2.5+, it is possible to directly load simple C shared libraries from Python without the need for writing C wrappers for it. (SWIG or manually writing one). This can be achieved using the Python ctypes module.

Lets take a simple example:

/* test.c */
int multiply(int a,int b){
return a * b;

Compile it as a SO library (ref: Writing and using shared libraries):

gcc -c -fPIC test.c
gcc -shared -fPIC -o test.o

Now we got an SO file with a test function, lets load it in Python

In [1]: import ctypes

In [2]: libtest = ctypes.cdll.LoadLibrary('/path/to/')

In [3]: libtest.multiply(30,99)
Out[3]: 2970

Hope this would be useful to someone.

More details :

Happy Hacking :D

The Deen Show : Proper Name for GOD

Video which describes etymology of Allah & Eloh, and the proper word to use to describe GOD - from the Deen Show.

Guest - Yusuf Estes (former National Muslim Chaplain for the United States Bureau of Prisons and Delegate to the United Nations World Peace Conference for Religious Leaders.)

"Allah - The best word to describe the GOD of the Jew, Christian and the Muslims, because this is the GOD of Adam, Abraham, Moses , David , Solomon, Jesus and Muhammad (Peace Be Upon Them All)"

- Yusuf Estes

Allah , Eloh , Elohim

Recent news in Malaysia : local Muslims are in rage on the court ruling to allow the Herald newspaper to use the word Allah to refer to Eloh/Elohim/YHWH.

IMO, they seem to lost touch with the rest of the earth.

A youtube video of a Yemeni Jew explaining the etymology of Eloh / Allah

Etymology of the world Allah:
Eloh/Elohim (Hebrew/Aramaic)
Allah (Arabic)

Both Eloh and Allah shares the same root: Eloh (Alef Lameh Heh) , Allah (Alif Lam Ha).

Where do you think the name of several of our prophets and angels derived from? .. its 'El' !!

Elias (Ilyas) – Whose God is the Lord
Elisha (Ilyasa') – Salvation of God
Gabriel (Jibril) – Strong one of God
Ishmael (Ismail) – Heard by God
Michael (Mikail) – Who is like God?

So on what basis that the word Allah is reserved for the Muslims? , its not, and …