Monmonja Programming Blog

September 4, 2009

Fixing ExtJS setStyle problem in IE

Filed under: Javascript,Programming — admin @ 2:29 am

Content Moved to http://www.almondjosephmendoza.com/2010/03/fixing-extjs-setstyle-problem-in-ie.html

December 11, 2008

Converting CakePHP array to xml

Filed under: CakePHP,Php,Programming — Tags: — admin @ 11:58 pm

Content moved to http://www.almondjosephmendoza.com/2010/03/converting-cakephp-array-to-xml.html

December 6, 2008

Faster way to resize a picture in Linux

Filed under: Ubuntu,linux — Tags: — admin @ 12:46 pm

Here is the fastest way to resize a picture in linux through command line.

Download imagemagick and install it using the ./configure, make, make install or if your using Ubuntu you could sudo apt-get install imagemagick

Open terminal (Alt+F2 gnome-terminal)
Go to the director of your picture, eg desktop
cd ~/Desktop
Convert your picture
convert -resize 100x100! myPic.jpg myPic.png

Explanation:
convert is the program you need
-resize is the function you need for the resizing
100×100! – destination width and height, add ! to force it to 100×100, remove ! and it will respect the ratio of the picture
myPic.jpg is the source file or the file you want to resize
myPic.png is the destination file after the resize is done

Hope it helps

December 5, 2008

Remove Sounds in Terminal in Ubuntu

Filed under: Ubuntu — Tags: — admin @ 1:04 am

Here is how to remove the sounds in terminal in ubuntu.
* Go Edit
* Profile Preferences
* On the General Tab unlick the Terminal Bells

Hope it helps

November 16, 2008

Order MySQL results according to how you want it

Filed under: Database,MySql — Tags: , — admin @ 3:34 pm

Here is a mysql function that is very useful when you want to order results according to how you want it, ofcourse when used with full query result its kinda useless, so i only suggest you to use this on a portion of a query. For example you have the following data:

Id | Name
1 | Tom
2 | Jerry
3 | Donald
4 | Roland
5 | Willie

And you want to order this so that Donald comes first followed by Willie, then randomized the remaining names.

In MySQL you could achieve this by using the function find_in_set. The answer to the query question above is:

SELECT id,IF(FIND_IN_SET(id, '3,5') > 0,FIND_IN_SET(id, '3,5'),3)
AS sort_column FROM table_names ORDER BY sort_column,RAND()

find_in_query would find 3 and 5 (3,5) in the field id and return a chronological order from 1 to n, the reason why we use IF is that for the remainding name the function would return 0 coz it didnt found the other id in the find_in_query arguments, so to have an ascending order and have Donald and Willie goes first, we must assign 3 (thats 3,5 which is 2 numbers plus 1) to the sort_column.

Hope you guys understand this. :)

November 15, 2008

How to change frequency on CakePHP’s describe query

Filed under: CakePHP,Php,Programming — Tags: — admin @ 12:08 am

By default if you set the debug to 0 in your core.php the frequency of executing a describe query is 999 days, but if your developing your application the duration is 10 sections, meaning every 10 sections it would ask your database to describe the tables that you need in your controller. To change the 10 sections to a higher value you could do this.

open configure.php in cake/libs/
locate the function __loadBootstrap
inside this function locate the following
if (Configure::read() >= 1) {
$duration = '+10 seconds';
} else {
$duration = '+999 days';
}

Change the ‘+10 seconds’ according to your requirement, say you want to describe a query every 1 minute, you would change it to
if (Configure::read() >= 1) {
$duration = '+1 minute';
} else {
$duration = '+999 days';
}

November 9, 2008

Debian OS in Android

Filed under: android — admin @ 4:38 pm

Last week or so, it was Gameboy emulator on andriod, now its a Debian, a linux operating system. Jay Freeman has written a post on how to install it on your gphone http://www.saurik.com/id/10. And btw i had saw a g1 here on Hong Kong for 570USD, and i still have no plans to buy it since its too expensive.

Older Posts »

Powered by WordPress

Monmonja Programming Blog is Digg proof thanks to caching by WP Super Cache