Setting up Karel the Robot In Eclipse

Exception in thread "main" java.lang.NullPointerException
	at acm.program.Program.main(Program.java:917)
	at stanford.karel.Karel.main(Karel.java:202)

If you are getting this error after you tried to run “Karel the robot” , you are not alone.
Apparently, if you download the version of eclipse that Stanford provides you are unlikely to get the error but if you are like me trying to run your own version of eclipse you will likely get the error.

Here is how to fix it:

First

Manage to get your application into eclipse. Follow the Stanford tutorial

Second

Click on “Run as Configuration”

Third

Change the main class settings to “stanford.karel.Karel”

Fourth

Then probably the most important step: Enter “code=CollectNewspaperKarel” in program arguments under the arguments tab.
Click on Apply and then Run your program.

Final Result (Eclipse Indigo)

That should be it.  This was supposed to be easy apparently.

Interesting links:
http://www.stanford.edu/class/cs106a/cgi-bin/software/
http://www.freesoftwaremagazine.com/columns/getting_stanfords_karel_robot_run_debians_eclipse
http://www.youtube.com/watch?v=jWMW2ZfYPo4

WdsClient: There was a problem initializing wds mode

After loosing a couple of nights trying to set up WDS, here comes the moment of truth. You have to deploy your first computer and you are hit with this stupid error message:

“WdsClient: There was a problem initializing wds mode.”

Sweet! What the heck does that mean?

After some googling around someone finally got the solution that i was looking for here
(http://social.technet.microsoft.com/Forums/en-US/winserversetup/thread/48058acd-3b99-40a0-b47b-8508a3c6f8f6/)

Honestly i have no idea why it fixed it for me but it does work.

change option 67 from :  PXEboot.com  to  wdsnbp.com

I will have to spend some time  later to find what the heck is the difference between PXEboot.com and wdsnbp.com but i will enjoy the solution for now.

Files that Starts with Underscores in PHP

Single Underscore (Drupal)
“If you need to define global variables, their name should start with a single underscore followed by the module/theme name and another underscore.”
http://drupal.org/coding-standards


Zend Framework

“For methods on objects that are declared with the “private” or “protected” modifier, the first character of the method name must be an underscore. This is the only acceptable application of an underscore in a method name. Methods declared “public” should never contain an underscore. ”

“For instance variables that are declared with the “private” or “protected” modifier, the first character of the variable name must be a single underscore. This is the only acceptable application of an underscore in a variable name.”
http://framework.zend.com/manual/en/coding-standard.naming-conventions.html

 

Double Underscore
Double underscores (__) means nothing in PHP  since it is not one of the reserved PHP keywords.
It’s meaning really depends on the project. Do not be surprise when it means something in wordpress and something else in zend framework or cakephp.
(WordPress)
http://codex.wordpress.org/Translating_WordPress#Localization_Technology

Curly Braces in Codes

Method 1

When I first started learning programming a few years ago, the curly braces style that i have always used was the “Allman Style”

The "Allman Style" puts the brace associated with a control statement on the next line.

“Proponents of this style often cite its use by ANSI and in other standards as justification for its adoption.” http://en.wikipedia.org/wiki/Indent_style

Method 2

Lately the style in vogue in almost all major PHP projects is the “One True Brace Style”

The "One True Brace Style" puts the brace on the same line.
http://en.wikipedia.org/wiki/Indent_style 

If you asked me, i still like the Allman style as it is more readable, but when such when large projects such as Drupal and WordPress (see images below) use the “One True Brace Style” it is hard not to use it.

Drupal

WordPress


Interesting links:
http://ycsoftware.net/coding-standards-quick-references/
http://gskinner.com/blog/archives/2008/11/curly_braces_to.html
http://programmers.stackexchange.com/questions/2715/should-curly-braces-appear-on-their-own-line