Category Archives: tutorial

Stuck on Checking Battery State

Yesterday, i’ve updated my desktop computer from Ubuntu 11.04 Natty to 11.10 Oneiric. But after system reboot, it stuck on “checking battery state”. After some googling, i’ve found a solution on a comment by Josh.C in here.

This issue was resolved for me by running the following command at a command prompt (ssh, or Ctrl+Alt+F1):

sudo apt-get install lightdm-gtk-greeter

Apparently the upgrade didn’t bother to install the greeter for LightDM, so it fails to fully initialize.

 

And it’s works!! 🙂

Multiple Argument in CodeIgniter’ s Form Validation Callback

CodeIgniter have a powerful form validation class out of the box. We also can create our validation method using a callback. By default, “callback” just accept 1 argument. I didn’t found in user guide, how to make callback accept more than 1 argument.

But, after doing little googling i found a way to do it. For example:

$val->set_rules('field', 'Field Name', "trim|xss_clean|required|callback__example_callback[{$argument}]")
......

function _example_callback($default_argument, $argument) {

.......

See the bold text. Done. 🙂

Hide Friend or Apps From News Feed on Facebook

Today, facebook and twitter became the most popular social network. Almost all of my friend have facebook and or twitter. Social Network became the next world. We posted on someone’s wall, we share anything in status/tweet, we comment on someone’s status /tweet. It’s like another world in our ordinary life.

But somehow, we want to not following or see someone’s updates/tweet. In twitter, we can just unfollow. And we can remove friends from facebook, but in facebook there is so many consideration. 🙂

Continue reading

Send SMS using Python Gammu

Gammu is a command line utility for controlling a phone (or modem) written in C. Gammu can be used for phone management software or maybe a SMS Gateway. Gammu can manage SMS, MMS, Phonebook, Calendar, phone’s file system and Call.

Today, i try to install Gammu and Python Gammu on Ubuntu 10.10 Maverick. Then, i write some code to send sms using command line.
Continue reading

Enable Mod Rewrite on Snow Leopard

After enable Apache and PHP (also installing MySQL) on my macbook, i want to enable mod rewrite (Rewrite engine) .  From wikipedia, Mod rewrite (rewrite engine) described as  software that modifies a web URL‘s appearance (URL rewriting). Rewritten URLs (sometimes known as short, fancy URLs, or search engine friendly – SEF) are used to provide shorter and more relevant-looking links to web pages. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world.

By default, mod rewrite has been enabled. But we need edit some configuration before we can use it.

  1. Go to /etc/apache2/httpd.conf than edit the <Directory /> section. Change AllowOverride to All
        AllowOverride All
  2. Edit /etc/apache2/users/youruser.conf, change to this:
    <Directory "/Users/youruser/Sites/">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride All
     Order allow,deny
     Allow from all
    </Directory>
    
    <Directory "/Users/youruser/Sites/*/">
     Options Indexes MultiViews FollowSymLinks
    </Directory>
  3. Done. 🙂

Apache PHP MySQL on Mac OS X 10.6

By default, Mac OS X come with preinstalled Apache and PHP. But for a while, i’m using XAMPP for Mac in my macbook because in my first time using Mac OS, i don’t know about it.

Yesterday, i tried to using preinstalled Apache and PHP, also adding MySQL. For enable Apache, it just take a click. Go to System Preferences -> Sharing
Continue reading

Sub Query in CodeIgniter

Few month ago, i posted about sub query in codeigniter here. And today i’ve found another way. It using active record class in codeigniter. For example:

$this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE);
$query = $this->db->get('mytable');

Just put ‘FALSE’ to second parameter in select() function. $this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.

So simple. Isn’t it?:D