Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

Archive for the ‘OSS’ Category

Yii overwrite accessRules in base class

leave a comment »

Suppose you defined a base class Controller with basic accessRules

class Controller extends CController
  public function filters()
    return array(
      'postOnly + delete',

  public function accessRules() {
    return array(
      // allow authenticated user to perform 'create' and 'update' actions
      array('allow', 'actions'=>; array('index', 'view'), 'users' => '@'),

      // deny all users
      array('deny', 'users'=>'*'),

and you want to add (overwrite) rules in derived class, using array_merge here how you do it:

class Site extends Controller
  public function accessRules()
    return array_merge(
      // allow all user to perform 'help' actions
      array( array('allow', 'actions'=> array('help'), 'users' => '*') ),

      // parent go last

As best practice your base class default access rule is deny all by default.

Written by Chorn Sokun

October 22, 2012 at 3:34 pm

Code Reading Skills for ExtJS newbie

leave a comment »

@samnangchhun wrote a blog post talking about this particular subject, I just want to share my experience exploring a new tool especially the ExtJS library from

Now there is something special about which I love, they put alot of effort in documenting their library API as well as sample projects in every release.

But like any other developers out there the only page in the document that I would read slowly is getting start, once I could say hello I would try to solve my problem with this new library/framework. That the only way that keep me focus and dig deeper into the document, source code, sample project, testing unit whatever available. At the end of the day I would know that this is the right tool or not.

How do i get this quick in adapting with new environment? I walk the same path as what @samnangchhun described in his blog and I did it enough that I can quick capture the convention and pattern of the thing I want to know. So if you haven’t read enough code do it now ;)

Great weekend everyone.

Written by Chorn Sokun

May 5, 2012 at 4:23 pm

Build monodevelop on ubuntu 11.10

with 11 comments

Again? yes but this time I don’t have to built mono runtine Ubuntu 11.10 packed with mono 2.10.5 which good enough since what I am after is dynamic.
However monodevelop I got from Ubuntu Software Center (USC) is 2.6 and the official release is 2.8.x so I take my on my gut to try and built me an IDE ;)

This time it much easier what I have to do is get latest copy of the source code from

> git clone git://

Then install build dependent by issuing this command

> sudo apt-get build-dep monodevelop

I don’t know why mono-gmcs was not install as part of the previous command (if you know why please comment) for now I have to install another package

> sudo apt-get install mono-gmcs

and then I’m ready to

> ./configure
> sudo make && make run

> monodevelop


MonoDevelop 2.8.2
Installation UUID: b220bfc2-57c6-4b94-840e-ff6c6477632d
	Mono 2.10.5 (Debian 2.10.5-1) (64-bit)
	GTK 2.24.6
	GTK# (
Build information:
	Git revision: e047f99f6df7b5c801102c03f903d4dd722b2989-dirty
	Build date: 2011-11-11 15:03:47+0000

Thanks to mono packaging team, you guy rock!

Written by Chorn Sokun

November 11, 2011 at 11:12 pm

.NET developer survive on linux

leave a comment »

I’ve been joking with my friends “the open source fan boyz” that I am a Microsoft slave for the fact that I am a dedicated .NET developer. But for all the joke I found some competitive disadvantage for me moving forward. If customer is looking for a low cost solution .NET is not the way to go. Base on what I do for a living, I build desktop and web application in .NET. But I tend to focus more on Web Application which dragged me to ASP.NET MVC.

Let taking ASP.NET MVC to build solution for me it yield a great ROI for me

  1. I got to learn more about .NET library
  2. it still .NET so I can use all the skill I got
  3. got great IDE support => productivity is high so and so …

for clients :/ intranet deploy

  1. invest on the server hardware (normal)
  2. software license just take Microsoft Windows Server + SQL Server hmm

and for Internet deploy ASP.NET hosting generally more expensive than LAMP stack. If I am about to help client cutting down expenditure cost I got to get rid of the underline infrastructure need to run the application. Possible with Mono but I am keep hearing incompatible issues on ASP.NET + Mono.

Anyway let me (us) forget all about ASP.NET glorious day. Recently, I start caught up with a movement in two different communities. Both of them trying to escape from ASP.NET sandbox and they both  gave birth to two unrelated open source projects manos and Nancy that the cool part.

These two project promised to free its user from underline infrastructure (no more IIS is required!) and it work x-platform.

Up to this point I can only make manos serve page, I am keep watching and follow-up with Nancy development. I hope to be able to compare advantage and disadvantage between the two projects in the future.

“Nancy start with a full range of view template to choice from, and I do not think it hard for manos to do the same thing”.

Which one is the best? is not really important at this point, what important is when these projects are matured we can use it to build low cost solution for my clients while still enjoy writing C# “YES, it pronounced C-Sharp” :D, but how? Here the spec

  • Web Application power by [manos | Nancy] + a few open source libraries
  • Mono 2.8.x or higher
  • Server OS OpenSuse 11.13
  • Back-end database name a few open source DBMS

Why OpenSuse? it is mono home’s os, and if you want to get hot-fix on time that the way to go. So let me end this blah blah post with a teasing screenshot!

Hello World from manos running on OpenSuse 11.13 inside VirtualBox, client access from Ubuntu 10.10 if you care about the environment :D

There you go it’s how a .NET developer survive on linux nice hacking weekend everyone!

Written by Chorn Sokun

January 22, 2011 at 10:36 pm

How to changing default Khmer Unicode Font in Ubuntu

with 2 comments

In Ubuntu 10.10 release cycle ttf-khmeros version 5.0.3 was included. However the only problem I had with Chrome.  Later on I was told that the fix is by trying various font until we find the one that work properly.

So the idea is to change default Khmer Unicode font so let see how we do it:

sudo gedit /etc/fonts/conf.d/65-khmer.conf

you can replace <family>Khmer OS</family> with <family>Khmer_Unicode_Font_Of_Your_Choice</family> or if you do not want to touch the line you can just add another line on top like this:

<family>Khmer OS</family>

next step issue the following command to update font package:

sudo dpkg-reconfigure ttf-khmeros

logout and log back in again.

Thanks @rithy for sharing this technique.

Written by Chorn Sokun

December 10, 2010 at 8:27 am

Posted in OSS, Tips & Tricks, Ubuntu

Ubuntu (NHibernate Mono MySQL) Take 2

with one comment

In my previous post I am talking about the setting mono, Nhibernate and MySQL stack on Ubuntu, it was a fun experience. However I made a mistake since I didn’t intend seriously use mono at the time I just wipe the whole os off my laptop and boom all the sample code and assembly gone too. But guess what this time I did it again with the combination of

  • Nhibernate 3 (beta build from trunk)
  • ConfORM (just so I don’t have to worry about .hbm.xml files)
  • MySQL driver install via Synaptic Package Manager (cuz I’m a bit lazy this time)

Now see what I got:

SchemaExport in Action ;)

And of cause I do make the sample code & assembly accessible at .

Written by Chorn Sokun

October 19, 2010 at 9:43 pm

Posted in Mono 2.6, NHibernate, OSS, Ubuntu

Tagged with ,

Build mono on Ubuntu Karmic 9.10 x64

with 8 comments

As always I would start off with CRY ME A RIVER :L, lol I told myself that I will never ever build mono from release source or /trunk again. I am lying myself :( ok here I go again this time I load Ubuntu Karmic x64 on my Toshiba M100 ~2 years old the original purpose is to just load it with multimedia app so that my wife could enjoy watching DVD, play MP3, browse the Inernet and blah blah blah … all just for entertainment :) It turn out !

Ok, here is the main story it turn out that I caught an e-mail from mono mailing list Mono 2.6 for Ubuntu its haunting me. Why don’t I just spend sometime with that instead of wasting time playing JX2 :D yeah let try.

  1. Download Mono 2.6.1 stable source
  2. Read instruction Parallel Mono Environment; ** people keep telling me to reference this instruction although I did follow the exact step, perhaps someone better shot a webcast instead of writing unworkable instruction.

Build Source

First thing first extract the source code from .tar.bz2 since I not a command savvy *yet* I use nautilus context menu to extract the source file; when all source code extracted let get into command line:

// create mono-dev-env using script written in
> ./mono-dev-env
// your command prompt now shall look like this where ~src is the location that I stored source code
[mono] ~src @


// just in case execute
[mono] ~src @ sudo apt-get build-dep libgdiplus
// ... now you are ready to build libgdiplus-2.6
[mono] ~src @ cd libgdiplus-2.6
[mono] ~src/libgdiplus-2.6 @ ./configure --prefix=/opt/mono
[mono] ~src/libgdiplus-2.6 @ make; sudo make install


[mono] ~src @ cd mono-2.6.1
[mono] ~src/mono-2.6.1  @ ./configure --prefix=/opt/mono
[mono] ~src/mono-2.6.1  @ make; sudo make install


Here come the pain :D as gtk-sharp depend on a lot of library we need to make sure those library are installed first before compile gtk-sharp-2.12.9 as of Ubuntu Karmic I need to install the following packages:

> sudo apt-get intall libpango1.0-dev libatk1.0-dev libgtk2.0-dev
// after that I can just do
[mono] ~src/gtk-sharp-2.12.9 @ ./configure  --prefix=/opt/mono
[mono] ~src/gtk-sharp-2.12.9 @ make; sudo make install


// dependency library just in case
> sudo apt-get install libgnomecanvas2-dev libgnome2-dev
// resume build task
[mono] ~/src/gnome-sharp-2.24.1 @ ./configure --prefix=/opt/mono
[mono] ~/src/gnome-sharp-2.24.1 @ make; sudo make install


[mono] ~/src/gnome-desktop-sharp-2.24.0 @ ./configure --prefix=/opt/mono
[mono] ~/src/gnome-desktop-sharp-2.24.0 @ make; sudo make install

The rest of the library seem to go just fine, I learn that execute sudo ./configure cause me a lot of troubles thanks @alex for pointing this out.


description on what this library give coming up next …


description on what this library give coming up next …


As I reached to this point ./configure started to complain me like this > configure: error: Cannot find termcap library to solve the problem I need to install

// ref:
$ sudo apt-get install libncurses5-dev

Side Note

Petit Eric <surfzoid[at]gmail[dot]com> wrote:

For those who want 2.6.1 deb, there is OBS repository for i586, the X86_64 are available here or
in sources directory you will find  libgdiplus sources and all files need to build deb from them (.dsc, …) here you will find mono2.6 idem

Written by Chorn Sokun

January 15, 2010 at 9:30 pm

Posted in Mono 2.6, OSS, Ubuntu