Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts

Wednesday, January 16, 2013

Wordpress & XAMPP

So, if you're not familiar XAMPP is an all-in-one solution running on multiple platforms (X), Apache, MySql, Perl and PHP (and Tomcat).  I've used this well for PHP development before back around 2006.

However when I went to use this to host a local Wordpress instance for development purposes I kept getting an invalid database connection message.  After hours of struggle and frustration, wikihow had a great article with a step by step tutorial on this.  It turned out my DB encoding was wrong (thanks regular tutorial and error messages for being so obtuse!).

Sunday, April 15, 2012

Best of Perl - Plain English if Statements

I worked with Perl for a couple of years and I miss being able to write code that feels like plain English.  I've managed to capture a bit of this into plain old Java by using self-documenting booleans instead of actual statements in if statements, as in the following:
final boolean fooExists = foo == null;
if (fooExists) {
  // code here
}
Hater's Gonna Hate at Zoitz.com
This seems almost too simple to deserve the declaration, but you can also write more complex statements like "if (fileIsOpened)" or "if (stringHasContents)" (i.e. not null and not empty / blank).  In particular, it helps when re-factoring someone elses code to understand what an if block actually does or MEANS.