Hello World in CakePHP – 3 steps

Posted by – April 13, 2010

  1. Download and set up CakePHP in your webroot. Stop reading further if you cant do it or you are not sure how to do it.
  2. Create a file named “helloworld_controller.php” in folder “cakephp/app/controllers/helloworld_controller.php” and paste following code in the file
    <?php
    class HelloWorldController extends Controller {
    public $name = 'HelloWorld'; //Controller name, we need it.
    public $uses=null; //The example doesn't "use" any model.
    public $autoRender=false; //Do not render "automagically"
    public function index() {//The default action for a CakePHP controller
    echo __METHOD__;//This will print HelloWorld suffixed with some more info ;-)
    }
    }
  3. Point your browser to CakePHP installation on your server for example “http://localhost/cakephp/helloworld/”

Piece of cake… :-)

Share LAMP Web Development Blog:
  • Print
  • PDF
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Slashdot
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • IndianPad
  • LinkedIn
  • Live
  • MSN Reporter
  • Netvibes
  • Sphinn
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Twitthis
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Problem with NULL in MySQL

Posted by – April 1, 2010

One fine morning you simply login to MySQL Terminal and…
kumar@kumar:~$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 61
Server version: 5.1.37-1ubuntu5.1 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select concat('Hello ',NULL,'World!');
+--------------------------------+
| concat('Hello ',NULL,'World!') |
+--------------------------------+
| NULL |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select 1 + NULL + 3;
+--------------+
| 1 + NULL + 3 |
+--------------+
| NULL |
+--------------+
1 row in set (0.00 sec)
mysql>

WHAT THE ####???
This is unexpected. Normally one would expect concatenating a NULL with string will simply result in string. But MySQL gives you NULL. What???
Look here-> http://dev.mysql.com/doc/refman/5.0/en/problems-with-null.html.
No fear. We have a solution. :-) . We will use IFNULL(). Have a look.
mysql> select concat('Hello ',IFNULL(NULL,''),'World!');
+-------------------------------------------+
| concat('Hello ',IFNULL(NULL,''),'World!') |
+-------------------------------------------+
| Hello World! |
+-------------------------------------------+
1 row in set (0.00 sec)
mysql> select 1 + IFNULL(NULL, 0) + 3;
+-------------------------+
| 1 + IFNULL(NULL, 0) + 3 |
+-------------------------+
| 4 |
+-------------------------+
1 row in set (0.00 sec)

One may also opt for COALESCE().

Share LAMP Web Development Blog:
  • Print
  • PDF
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Slashdot
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • IndianPad
  • LinkedIn
  • Live
  • MSN Reporter
  • Netvibes
  • Sphinn
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Twitthis
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

How to save passwords in TortoiseSVN?

Posted by – March 22, 2010

Follow these steps
a) Right click on local code repo
b) Go to TortoiseSVN > Settings
c) Go to “Network”
d) Browse for SSH Client and use following
“C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe” – Can be found in TortoiseSVN installation folder in c:\Prgram Files
d) Append following replacing username and password with your user name and password
“-l username -pw password
e) Click OK/Apply
That’s it. :-)

Share LAMP Web Development Blog:
  • Print
  • PDF
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Slashdot
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • IndianPad
  • LinkedIn
  • Live
  • MSN Reporter
  • Netvibes
  • Sphinn
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Twitthis
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Fix “Firebug’s log limit has been reached.”

Posted by – February 4, 2010

You open Firebug and are trying to fix some thing in your way-cool-AJAX app. And in you notice something that says “Firebug’s log limit has been reached.” giving you an option to do some thing with preferences. You go to “about:config” and start wondering what to do now? Search for “extensions.firebug.console.logLimit” and increase it from 500 to some thing that suites you better. And thats it. :-)

Share LAMP Web Development Blog:
  • Print
  • PDF
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Slashdot
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • IndianPad
  • LinkedIn
  • Live
  • MSN Reporter
  • Netvibes
  • Sphinn
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Twitthis
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Ubuntu 9.10 – Karmic Koala

Posted by – November 2, 2009

This is bit dramatic.
Day one, a conversation between me and Dr. Abhishek on phone
Dr.: So whats this with new release of Ubuntu, the Koala…have you heard about it, any idea…?
Me: Yeah, I dont think it will be much different in terms of kernel or any thing related to core, though I do expect changes in UI…
Dr.: hmm…is this LTS?
Me: Nopes, if you are looking for LTS then better wait for six months. I guess I will also wait for LTS. I am too lazy to update my laptops…
Dr.: OK
Day two, on Facebook.
Sukhi’s wall post says, “I am waiting for Karmic Koala” and my comment, “I am not going to install Koala”
Day three, on Facebook.
Sukhi’s wall post is all gaga about Koala.
Last day, Dr. Abhishek’s wall post on Facebook indicates he has installed Koala and he likes it…
I ping him and asked him about this breach and he says he “aiwen hi” downloaded the ISO, created a live version, used it and could not resist installing it.
:-|
Today morning, I have successfully upgraded my Ubuntu 9.04 to Ubuntu 9.10. :-)
Updating or installing Ubuntu is breeze. For a dummy, who can just read English, here are the steps to do it, you will need a 1GB USB stick or a pen drive:
a) Download the latest ISO from http://www.ubuntu.com and save it to C:/ drive or any other place where you have enough space to save a DVD movie. You will be most probably downloading a 32 bit Desktop version.
b) Download Unetbootin for Windows XP or Windows Vist or whichever Windows you are using.
c) Insert your USB/Pen drive in USB and run unetbootin.
d) Choose the ISO option and browse for the ISO file you have downloaded in step a), choose the USB drive which will be in most cases already selected and let unetbootin do rest of the things.
e) As soon as unetbootin finishes it will ask you to reboot or exit. Save your work if you are doing and reboot.
f) In most of the cases your laptop or desktop will boot and show you a screen with options saying something like “Default” and “OEM”. Use arrow keys and select “Default” and hit enter gently with your fingers ;-)
g) In 99.9% cases your computer will show you the familiar Ubuntu logo, in remaining cases you need to contact a geek.
h) Your computer will show you a slick desktop. If you have not disconnected your DSL and other plugins from your computer, you will surprised to know that everything works. Unlike Windows, you dont need to add a device driver or software and reboot your machine.
i) Click Application or press “Alt+F1″ and browse the applications. Check out Open Office, its no where near to MS Office but it will still serve well and its free!
j) If any moment you feel Ubuntu is worth installing, click the install button on your Ubuntu desktop. Installing Ubuntu is very easy but demands a bit of computer knowledge. Let the installer decide what is best for you and 99% chances are that you will have dual boot system in 15-20 minutes. Ready to use.

Did I mention that I was browsing Internet on same laptop at the same time when I was installing Ubuntu 9.04? Can an average Joe do this on Windows?

Share LAMP Web Development Blog:
  • Print
  • PDF
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Slashdot
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • IndianPad
  • LinkedIn
  • Live
  • MSN Reporter
  • Netvibes
  • Sphinn
  • NewsVine
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Twitthis
  • Wikio IT
  • Yahoo! Bookmarks
  • Yahoo! Buzz