Friday, March 26, 2010

A couple observation on people & the elevator

I use elevator to get to work and to get to home. So I spend time in elevators everyday for at least 4 times, no matter how brief it is, there's plenty to see and comment.

Observation 1 - People are selfish (or probably just ignorant), they don't hold the doors for others


This happened alot at home. It's general rule of thumb, if you're the first one to get in the elevators, be considerate enough to hold the doors for others who's coming after you lah! Most of the time I saw them just go in and right away stood at the very back and just stood there. In over 2 years I've been living here I can count how many times people held the door - it's no more than 10.

99.99% of the apartment's residence are malays. Is this a racial issue? Or is this about being in Putrajaya? In the city where people are more of a mixed race, I encountered better attitude. Whether they know you or not, they hold the doors for you, even more if you're a lady. Because this doesn't happen in the office. I'm not so sure about offices in Putrajaya - is it the same?? Or does this just happen at my apartment?

Guys, be a gentleman. Ladies, show them we have heart by doing so we kick ass.

Observation 2 - We are lazy, we live in first floor we still need to take the elevator


Use the stairs lah! Get some workout. In a country where people are not very health conscious and think gyms are for the rich and for people who have so much time on their hands, taking the stairs is good for you. Unless you have groceries or screaming kids or riding the elevator alone, consider getting some exercise.

I think this happens everywhere here. We are all lazy.

Sunday, March 21, 2010

Custom filter query in symfony 1.4

This cracked my head in this wee hour. Thankfully I got it working.


# add the custom field in myapp/modules/client/config/generator.yml
filter:
display: [ existing_fields, paid_up_cap_more]
fields:
paid_up_cap_more: { label: Paid up capital (RM) - more than }





// in lib/filter/doctrine
class CrmClientFormFilter extends BaseCrmClientFormFilter
{
public function configure() {
$this->widgetSchema['paid_up_cap_more'] = new sfWidgetFormInput();
$this->validatorSchema['paid_up_cap_more'] = new sfValidatorPass(array ('required' => false));
}

public function getFields() {
$fields = parent::getFields();
$fields['paid_up_cap_more'] = 'paid_up_cap_more';
return $fields;
}

// must be in this format addXXXXXColumnQuery
protected function addPaidUpCapMoreColumnQuery($q, $element, $value) {
if (!empty($value)){
$q->andWhere('paid_up_capital >= ?', $value);
return $q;
}
}
}

Tuesday, March 2, 2010

virtualenv

I kept getting back to virtualenv and every time I would totally forget how to go about it and had to start googling. Every time. Frustrating. This is usually when Plone is involved.

So.

$ sudo apt-get install python-virtualenv
$ virtualenv -p /usr/bin/python2.4 /home/cawanpink/python2.4
$ source /home/cawanpink/python2.4/bin/activate
(python2.4)$ deactivate




That's

  • install

  • create the Python 2.4 virtual environment

  • activate the environment

  • to get out of the environment