Prevent word wrap in Yii CGridView column

February 15th, 2013

Sometime there are long data need to be displayed in Yii’s cgridview and you don’t want it to be wrapped. This can be achieved by setting appropriate CSS/style in the particular cell or column, for example specifying the width or nowrap.

$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'my-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		array(
			'name'=>'LongAssetTag',
			'htmlOptions' => array('style' => 'white-space: nowrap;')
		),
		......
	),
));

Popularity: 14% [?]

How long have I been asleep?

October 23rd, 2008

…It has been quite a while since i last updated my blog. There are so many things going on in my life lately (in a good way) and I can say that I’m in a verge of a major shift of paradigm and perspective especially with regards to my career & future. And yes, Open Source is still the key element of it. :)

Recently I’ve been leading a project to implement a solution consisting of Nagios and OCS Inventory (with GLPI) fo a local company which have a large number of IT assets spreaded all over Malaysia. It was quite an experience and I can say the scale of the project is the largest I’ve been involved so far in my career. There are a lot of chalenges, hiccups, headaches and even frustations during the project but at the end everything completed successfully.

I will provide the details if I have spare time, so stay tuned for more updates

Popularity: 69% [?]

Window Vista’s Source Code !

July 5th, 2008

Some guys manage to get their hand into the source code of Windows Vista. And it is now circulating through the internet.

Click on the image below to view the source code.

Vista Source Code

:P

Source:
http://tuxmax.blogspot.com

Popularity: 47% [?]

Installing Mozilla Firefox 3 on Gentoo 2008.0

July 3rd, 2008

I cannot hold myself anymore. I want Firefox 3 on my Gentoo machine ASAP. I don’t care about the feature, the risk and the hassle I might be facing installing unstable/testing application in my machine, I just want the new version on my PC! :)

Using emerge to search the package

emerge --search mozilla-firefox

Result:

* www-client/mozilla-firefox
Latest version available: 2.0.0.14
Latest version installed: 2.0.0.14

Fair enough, the stable branch only have version 2.0.0.14 as the latest one. So I enable unstable/testing branch for that particular package by inserting the line below in my /etc/portage/package.keywords

www-client/mozilla-firefox ~x86

Do the search again

emerge --search mozilla-firefox

Result:

* www-client/mozilla-firefox
Latest version available: 3.0-r1
Latest version installed: 2.0.0.14
Size of files: 50,442 kB
Homepage: http://www.mozilla.com/firefox
Description: Firefox Web Browser
License: || ( MPL-1.1 GPL-2 LGPL-2.1 )

Nice, they have version 3.0-r1 in the repository.

After thinking for a while, I decided to proceed with the installation. Of course I have to enable some other unstable/testing packages in order to meet the dependencies.

I added those lines below in my /etc/portage/package.keywords file

net-libs/xulrunner ~x86
dev-libs/nspr ~x86
dev-libs/nss ~x86

Specifying custom USE parameter in /etc/portage/package.use file

www-client/mozilla-firefox java linguas_en_US -ipv6 

I don’t need IPV6

And start the installation process

emerge -av mozilla-firefox

I answered ‘yes’ when asked and the installation process started. It took almost 20 minutes for the system to compile them. When it finished, I’ve been greeted with the message below.

* Old versions of installed libraries were detected on your system.
* In order to avoid breaking packages that depend on these old libs,
* the libraries are not being removed. You need to run revdep-rebuild
* in order to remove these old dependencies. If you do not have this
* helper program, simply emerge the ‘gentoolkit’ package.
*
* # revdep-rebuild –library libnspr4.so.6
* # revdep-rebuild –library libplc4.so.6
* # revdep-rebuild –library libplds4.so.6

Ok. Some post installation works to do. But I would skip those steps for now. I will do them if I encounter any problem on other applications.

So I restarted my Firefox, went to some normal plugin/extension upgrade process and there I go, Firefox version 3 !

Firefox Version 3

Popularity: 51% [?]

Dynamic email signature for your mail clients

June 25th, 2008

Actually it is not that dynamic. Basically I just want to embed the list of my 3 latest blog postings in all my outgoing mails, just below my signature. So what I meant by dynamic is that the text file which is holding the signature will get updated from time to time via a cron-job and a simple script.

The script will read the RSS/Atom feed from my blog and capture the title & url of three latest postings and pump them into my signature file. I use Python script and the marvelous Universal Feed Parser.

For most of linux system python would already been installed by default. However you might need to install Universal Feed Parser (python-feedparser) in order for the script to work.

In my Gentoo machine
emerge -av dev-python/feedparser

For Fedora Users
yum install python-feedparser

For Ubuntu users
apt-get install python-feedparser

The phyton code (take note that I’m new to python. If you find that the script is not appropriate please do advise me)


#!/usr/bin/python

import feedparser

#the signature file (output)
filename = '/path/to/your/home/folder/.signature1'

#numbers of items to be displayed
num = 3

#feed address
feedurl = "http://feeds.feedburner.com/RidingLinux"

#your signature. Change accordingly
text = """Regards
Your Name
Your Company
Address
Telephone

My latest BLOG posts:

"""

d = feedparser.parse(feedurl)
if d.feed.has_key('title') :
	file = open(filename, 'w')
	for i in range (num) :
		text = text + d['entries'][i]['title']+"\n"+d['entries'][i]['link']+"\n\n"
	file.write(text)
	file.close()

Save the above script in your home folder (eg: /home/yourname/signature-update.py) and test it out.
Once everything is ok, add a cron-job for it to be executed in schedule.

Example (if you are using ‘crontab -e’) command

0,30 * * * * python /home/yourname/signature-update.py >/dev/null 2>&1

This will execute the script every half and hour.

Sample generated file

Regards
My Name
My Company
My Address
My Telephone Number

My latest BLOG posts:

Vuurmuur firewall management interface for Linux Iptables
http://www.ridinglinux.org/2008/06/23/vuurmuur-firewall-management-interface-for-linux-iptables/

Food Strainer - Your Wifi reception booster!
http://www.ridinglinux.org/2008/06/15/food-strainer-your-wifi-reception-booster/

Simple port forwarding with Iptables in linux
http://www.ridinglinux.org/2008/05/21/simple-port-forwarding-with-iptables-in-linux/

Now I can simply point my mail client (Evolution, KMail, Claws-Mail or Thunderbird) to use the above file as my signature.

Popularity: 64% [?]

Vuurmuur firewall management interface for Linux Iptables

June 23rd, 2008

In my previous post regarding iptables, I’ve mention about an iptables management tool called Vuurmuur (http://www.vuurmuur.org/). Most people have probably heard about FireStarter, KMyFirewall and ShoreWall. Basically Vuurmuur serves the same purpose, which is providing easy way to manipulate iptables rules for users to manage their firewall without having to worry about all those complex iptables commands. Those tools give us the ability to play around with iptables either by using graphical interface or adjusting configuration files.

Vuurmuur Rules List

The thing I like about vuurmuur is that it uses Ncurses GUI interface, meaning that you can manage it via a terminal console or SSH. The drawback of using tools such as FireStarter, KmyFirewall is you need to have a graphical desktop, thus making it hard to manage them remotely especially via slow internet connection or if you are using Windows machine to do the administration process. While some other tools provide web-based management interface such as Smoothwall (via Webmin) or a dedicated firewall box like IpCop and Astaro Internet Security, allowing those web interface to the internet wouldn’t be a recommended practice. Furthermore, the web interface provided by Astaro Internet Security is too slow for a remote user.

So if you need a very light (and yet POWERFUL) solution suitable for frequent remote administration, its either you use the pure command line iptables command, or using config file based tool such as ShoreWall, or lastly if you really need non web-based GUI then Vuurmuur would be an ideal answer. You can simply SSH from anywhere (provided that you allow SSH remotely) or by using Windows SSH interface called Putty.

Apart form that, I am also pleased with it’s ability to do other things such as providing realtime log viewer, traffic shaping, traffic volume monitoring and lots more. Combine those things with Iptraf, then you will get hooked if front of your ‘blue screen’ for the whole day, even worse than watching blue film. ;)

Vuurmuur realtime log viewer

Popularity: 52% [?]

Food Strainer - Your Wifi reception booster!

June 15th, 2008

I recently moved to a new house. Everything went well apart from my telephone & internet line migration. As for now, the telco/ISP (the Malaysian TMNet aka TMNut) cannot do the migration process due to technical problems. Been whacking their customer service almost everyday but they seem to have a trick of looping our reports and complains into some kind of black hole. They responded with varies of reasons such as no ports available, faulty line ect..etc.. but none of them seems to make any sense.

I desperately need internet connection at home and luckily a neighbor who are a broadband subscriber willing to share his internet connection with me via Wifi. He already have a wireless AP installed at his home for personal use.

So I plugged in my USB wifi adapter and manage to connect to his AP.

My USB wifi adapter

But the signal is very sluggish which is expected due to the distance between our house. The link quality barely archive 50% and I got frequent disconnection.

Wifi before food strainer

Fortunately a few months back I’ve stumbled upon some funny trick of using food strainer to boost wireless signal. So this is the most suitable time try it out.

I bought myself a new food strainer for RM11.00 and I cut a little hole just about the size of my USB wifi body.

My New Food Strainer

Put the device through the hole

Wifi inside food strainer

Wifi inside food strainer 2

And… PRESTO!!!

Wifi after food strainer

Neat (ugly) huh… But it surely works. My connection is now very stable.

My desktop show off ! (pardon my old hardwares. I’m a cheap geek..)

My powerful desktop

***I’m now thinking of permanently unsubscribe my TmNut telephone/internet line ;)

Popularity: 48% [?]

Simple port forwarding with Iptables in linux

May 21st, 2008

One of the most common question I received from my customers is how to setup a simple port forwarding on top of their existing iptables firewall rules. Most of my customers are using Centos 5 and only uses the standard iptables provided by default upon operating system installation. For a more complicated setup I usually recommend existing iptables manipulation interface/packages (my favorite is Vuurmuur), but for those who just need one simple rule the the guide below should be enough to handle them.

Assumptions:

  • Only use IPV4
  • Two unit of machines involved, the linux machine that will act as the gateway/forwarder (IP: 192.168.0.1) and the destination machine (IP: 192.168.0.100)
  • The port to be forwarded is 5901 (Change to whatever port you want)
  • This guide is based on linux Centos 5, some other distros could also use the same setup but some other might need additional modification
  • Iptables service is turned on, and SELinux is turned off

Firstly, we have to make sure that the kernel allow port forwarding. Edit /etc/sysctl.conf and make the amendment below

net.ipv4.ip_forward = 1

To activate the rule above immediately without a reboot, run

sysctl -p /etc/sysctl.conf

Then run each of the commands below

To allow forwarding rule specifically to machine 192.168.0.100 in the FORWARD chain

iptables -I FORWARD -p tcp -d 192.168.0.100 --dport 5901 -j ACCEPT

The actual port forwarding rule

iptables -t nat -A PREROUTING -i lo -p tcp --dport 5901 -j DNAT --to-destination 192.168.0.100:5901

To masquerade the routed connection so that the firewall will treat it as local connection.

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

The port forwarding rules should be ready by now, you can test it by using some common tools like telnet.

To view the current rules, run

/etc/init.d/iptables status

Bear in mind that the iptables modification above will only effective on this boot session. It will be destroyed/reverted back to original setup after reboot. To make the rules permanent, make sure you backup your existing iptables template first. Simply copy /etc/sysconfig/iptables to another place or name.

After that, just run command

service iptables save

This will store your modified iptables rules into /etc/sysconfig/iptables thus making it persist even after reboot.

Popularity: 100% [?]

MAMPU pioneered OpenOffice adoption for Malaysian Government

March 19th, 2008

Malaysian Administrative Modernisation And Management Planning Unit - MAMPU (http://www.mampu.gov.my) have recently making a bold move by introducing a policy to migrate to the OpenOffice.org open source productivity suite instead of the current widely used MS Office. The official adoption date will be on the 1st of April 2008 and the agency will also uninstall all copies of Microsoft Office by the end of 2008.

MAMPU Migrates to OpenOffice.org

Putrajaya, 19th March 2008 - The Malaysian Administrative Modernisation and Management Planning Unit (MAMPU), today officially adopts a policy to migrate to the OpenOffice.org open source productivity suite. This is in line with the Malaysian Public Sector Open Source Master Plan, which calls for government agencies to reduce costs, increase freedom of choice and interoperability.

From April 1st, MAMPU will start adopting the OpenDocument Format (ODF), standard for all new documents created. ODF the ISO open standard for electronic documents is also the default format for OpenOffice.org. The agency will also uninstall all copies of Microsoft Office by the end of 2008.

To ensure a smooth migration, presently over 80 agency staff have been trained by the Open Source Competency Centre (OSCC). Additional staff will then be trained internally by the IT department, which will also provide support for OpenOffice.org.

More info at
http://www.oscc.org.my/index.php?option=com_content&task=view&id=189&Itemid=128

Read the rest of this entry »

Popularity: 45% [?]

MyFina - Web-based Personal Financial System

March 6th, 2008

I’m releasing the source code and also live demo version of my application called MyFina.

MyFina is a simple web based personal finance and budgeting program for managing accounts and expenses. The system aimed at those who have little or no financial background to gain control over their money. The system supports multiple numbers of users. In making this software, the developer has attempted to make things as simple as possible, while still retaining enough functions to satisfy most home users.

More info at http://myfina.ridinglinux.org/

UPDATE
This project has been registered at Sourceforge
http://sourceforge.net/projects/myfina/

Popularity: 51% [?]