Archive for the ‘Tech’ Category

A square meal

Thursday, December 2nd, 2010

A square meal

The Android Emulator Lies!

Friday, October 29th, 2010

Working on an Android application and aiming to support a variety of different hardware is an interesting challenge, not least of which being that the Android emulator lies to you about its capabilities.

I created a new AVD (android virtual device) and specifically set the parameter (which the documentation says defaults to “no” anyhow) so that there would be no camera:

AVD details

Later on, just to check what my code was doing I added a log statement after I queried what the package manager thought would be the capability:

    boolean hasCamera = packageManager.hasSystemFeature(
    Log.e("DeviceSettings", "Package manager said about camera: "+hasCamera);

And the output?


The emulator lies! How am I meant to do my job? *sigh*

Strangeloop v1.0

Thursday, October 14th, 2010

Going to the Strangeloop conference today and need some way to capture my notes and practice typing on my iPad. Guess it’s time for ‘live blogging’ or something.

I am not a touch typist for sure but this on-screen keyboard isn’t too bad. Just strange the way that it is lagging so horribly behind my paltry typing speed. This simply won’t do! I have fifty thousand words to write in November, how will I manage that with this level of lag?

PHP-on-Tomcat (Part II)

Sunday, December 13th, 2009

The original goal of being able to run PHP on top of Tomcat was to allow simple development of PHP based applications like WordPress and/or bbPress. To get these working I needed a database.

The wildly popular mySQL database has a nice installer for OS X. Mine installed to /usr/local. I did the install ages ago and forgot what the “root” database user password was. Ooops! No matter, there are some great resources online talking about how to go about resetting permissions. I opted for the incredibly easy, but utterly insecure method (from inside the terminal) :

  1. Stop the existing server
  2. Restart telling it to turn off permissions: mysqld_safe --skip-grant-tables --user=_mysql &
  3. Jump into the mysql shell application: mysql -u root mysql
  4. Change the “root” password: UPDATE mysql.user SET Password=PASSWORD('#########') where user='root';
  5. Persist privilages: FLUSH PRIVILEGES;

Next on the list was exposing my mySQL database to the Tomcat hosted PHP code. Step 1 was making sure I have mySQL JDBC drivers installed, Step 2 was creating a JNDI datasource in the context, and step 3 was getting the PHP to use it.

The officially supported mySQL Connector/J was a quick download. The JAR file for it was dropped into the $CATALINA_HOME/lib directly. Good to go. The context file was more of a challenge, under the $CATALINA_HOME/conf/Catalina/localhost I created an XML config file that matched the name of my webappphp.xml – where I declared the JNDI datasource. It took some tweaking and reading around but finally ended up coming together:

<Context reloadable="true">

The documentation for Quercus states

Scripts can use the jndi name directly:


  // standard PHP
  //mysql_connect($host, $username, $password, $dbname);

  // using JNDI lookup


But that doesnt help me to run WordPress as I’m not about to go modifying their code. Never fear, there’s another option. The documentation for Quercus also says that you can put an entry into the WEB-INF/web.xml file that forces all database connections to go through the same underlying JNDI datasource:

      Tells Quercus to use the following JDBC database and to ignore the
      arguments of mysql_connect().

So, a quick update to point at my own datasource and wall was ready to go. I downloaded and unzipped wordpress into the PHP webapp directory, pointed a browser at http://localhost:8080/php/wordpress and found myself stepping through the famous 5 minute install. Less than 5 minutes later I was looking at the main page of a fully-functioning WordPress install.


Saturday, December 12th, 2009

I am generally a Java programmer (if my day-job is to be believed) and hacking my way through Apache configuration isnt my idea of a fun evening. For some odd reason my trusty old black MacBook hasnt had the best of times when I try to enable “web sharing” and then try executing PHP scripts – all I get is a dump of the source. Time for a creative solution to the problem!

The folks that created the Resin App Server have a 100% Java implementation of PHP 5 released under the Open Source GPL license, known as Quercus. So step 1 was to download the latest release that will run on non-Resin app servers: quercus-4.0.1.war.

This was the point where I also realized that I dont have an up-to-date install of Apache Tomcat on my system either. Step 2 was to go download Tomcat 6.0.20 and install it.

Many applications need to know where Tomcat lives, and that means setting the CATALINA_HOME environment variable to point to the install. In a terminal I edited the global startup file for the terminal: sudo vi /etc/bashrc to add the line:


Step 3 was to $CATALINA_HOME/bin/ to start tomcat and then point a browser at http://localhost:8080/quercus-4.0.1/ where I saw confirmation that all was well:

Testing for Quercus™…

Congratulations! Quercus™ Open Source 4.0.1 is interpreting PHP pages. Have fun!

I didnt like the URL though, but that’s easily changed. I simply nuked the quercus-4.0.1 directory under $CATALINA_HOME/webapps and renamed the Quercus WAR file “php.war”. I bounced Tomcat and bingo – a “php” directory I could drop files into. As a final test, I created info.php




and hit it on the pretty URL: http://localhost:8080/php/info.php. All displayed correctly. I was off and rolling running PHP on top of Apache Tomcat! Stay tuned for Part II – getting WordPress running on top of PHP running on Tomcat!

Let me count the ways

Thursday, November 12th, 2009

Eclipse IDE

How do I loathe thee? Let me count the ways.
I hate thee to the depth and breadth and height
My soul can reach, when feeling out of sight
For the ends of Being and ideal Grace.
I loathe thee to the level of everyday’s
Most quiet need, by sun and candle-light.
I despise thee freely, as men strive for Right;
I loathe thee purely, as they turn from Praise.
I loathe thee with the passion put to use
In my old griefs, and with my childhood’s faith.
I loathe thee with a hatred I seemed to lose
With my lost saints,—I loathe thee with the breath,
Smiles, tears, of all my life!—and, if God choose,
I shall but loathe thee better after death.

With apologies to the original author. How is it possible for a simple piece of computer software to draw out such ire? Grrr.


Wednesday, December 3rd, 2008

Blogging : Never before have so many people with so little to say said so much to so few

Never before have so many people
   with so little to say
      said so much
         to so few.

And the score: IBM 0 / MacBook 2

Monday, October 13th, 2008

What an amazingly frustrating weekend. <sigh />

The annoying IBM Thinkpad refused to connect … neither wired, or wireless (on any one of three different wireless networks, no less). On the other hand my trusty MacBook hopped online in every given scenario. Oh, and before this turns into a Windows vs. Apple cage match, the Dell Inspiron laptop also connected flawlessly in every case.

Can I have those hours of my life back, maybe trade them in against 5 minutes of something more productive … like fly-fishing in an empty pond or something?

Oh, and running the build-tool (“maven”) offline proved to be interesting – looks like when I get back to the corporate network the central code repository has been “blacklisted” by the tool because it was unreachable in multiple builds. Just perfect!

SCRUM in the news

Friday, September 19th, 2008

The gaming site Gamasutra recently posted an article about EA building “Battlefield Heroes”, and how their use of an agile SCRUM-based development methodology allowed them to release in the aggressive timescales that the executives asked for. Very cool!


Wednesday, September 10th, 2008

Every year during the National Novel Writing Month they publish a weekly podcast called “WrimoRadio“. I have been consistently impressed with the quality and have thought to send in a small editorial piece to them but was too busy with other things (like writing a 50,000 word novel in a month). I am very tempted to send in the “plot bunnies” piece this year though.

I was on Facebook and noticed Chris Baty (founder of the National Novel Writing Month) changed his status to “Chris Baty needs a WrimoRadio producer so he doesn’t die in November.”

Podcast production is something I enjoy, I have the hardware investment and the previous experience. Should I ping him and offer? With everything else I am doing that would be one more reason I might not make 50,000 words. On the other hand I could put it on my resume – “podcast production for the National Novel Writing Month” – so it has its benefits too. Maybe I am oversimplifying what it would take … it wouldn’t be the first (or the last) time I’d done that!