Test-Driven Development - A Win!
- “Quick Fix” which suggests code amendments on request – such as adding class imports, declaring new classes, and the like.
- “Refactor” which lets me rename a class and automatically rename the class file as well, since Java wants it that way. Lots more capabilities in refactoring – will be looking at that soon!
- Java debugging with breakpoints in Eclipse – I came from the “old school” way of gdb and text based debugging. Printf statements anyone? I still use printf’s to output tracing statements even when there’s debugging capabilities in XCode or Visual Studio.
With the advent of Test-Driven Development and the plethora of tools supporting that methodology, testing becomes easy, almost fun! Key mantra:
Make something easy to use, it becomes an enabler
In my case, I used the built-in JUnit integration which Eclipse provides. I can right click on a class file, ask for a JUnit test to be created, and designate which Java package the resulting JUnit test class file is to be added to. What you do to write a test case is to simply write a Java function to exercise the function being tested.
I started using JUnit 3 and finally settled on JUnit 4 which uses annotations – part of Java 5.0 – to designate which test case functions are to be run by JUnit.
JUnit example after the break – more...
RapidWeaver Local Exports
- Go to System Preferences
- Select Sharing
- Click on the Web Sharing checkbox
The RapidWeaver theme I’m using for Free Range Coder is Unity 2.0 from NimbleHost. It’s a really nice simple theme which automagically adapts itself for the iPhone / iPod sized devices. It also uses PHP and the default configuration file for Apache in Snow Leopard does not have PHP enabled. I found this site which walks you through the configuration file changes for Apache and setting up the PHP initialisation file. In a nutshell:
To enable PHP in Apache - uncommenting the line below in /etc/apache2/httpd.conf:
LoadModule php5_module libexec/apache2/libphp5.so
Copying the default php.ini file from php.ini.default file in /etc:
cd /etc
sudo cp php.ini.default php.ini
The article goes on to show how to fix a warning in phpinfo() by setting the timezone in php.ini.
Back to RapidWeaver... So I dilligently exported the Free Range Coder website into frc in Sites within my Home directory. Launched Safari and typed in http://localhost/~kirschen/frc in Safari’s location bar and the page came up. But... It wasn’t what I had expected – the Unity theme style had not been applied.
And then I remembered what I had heard at the end of the Nosillacast Episode 301 - I’ll just check the Console Logs! I fired up Console (which we all know lives in the Utilities folder under Applications) and switched to All Logs. I typed in “apache” in the search bar in the upper right. And I saw bajillions (and that’s a technical term) of errors, all similar, one of which read:
[Sat Mar 05 12:43:41 2011] [error] [client ::1] (13)Permission denied: file permissions deny server access: /Users/kirschen/Sites/rw_common/themes/unity_v2.0/scripts/extracontent.js, referer: http://localhost/~kirschen/index.php
Aha! The plot thickens! This told me that some files were not readable by the Apache server, and where the files resided. Yes - the Unity theme. I whipped up a Terminal window and cd’ed over to /Users/kirschen/Sites/rw_common/themes/unity_v2.0 and listed the files therein using the ls -al command. The errant files had the same Unix permissions, an example – the one referenced in the Console Log – was:
-rw------- 1 kirschen staff 217 Mar 5 2009 extracontent.js
The rw indicated that the user (myself) had read and write permissions on the file, the dashes showed that members of my group (staff) and other users had no access permissions at all. So how does one fix permissions like this? No, you cannot use the Disk Utility “Repair Permissions” as Mac OS X knows nothing about what the correct permissions for these files should be. We’ll have to make the permissions changes ourselves from the Terminal. I could change the permissions in the frc directory but the next time an export was made from RapidWeaver, the Unity theme files would be overwritten and I’d be back changing permissions again. No, I had to make the change in the RapidWeaver theme directory. So, here are the steps from the Terminal:
cd “~/Library/Application Support/RapidWeaver” – This brings us to the RapidWeaver application support directory in which the Unity theme is installed
chmod -R go+r Unity-v2.0.rwtheme – The Unity theme shows up as a file in the Finder but it’s actually a file bundle. The chmod command will change the permissions so that the group (g) and others (o) get read permission (+r) and the -R option tells chmod to recursively go down the directory structure within the Unity-v2.0.rwtheme directory.
Re-exported the Free Range Coder site into frc – and it works as advertised! So now I can tweak the CSS files to my hearts content before committing the changes to the theme directly.
Review of MailTags
MailTags is a Mac OS X Mail application plug-in much like Mail Act-On. It’s from indev software at indev.ca. What MailTags does is it lets you add tags to your mail messages, and much much more.
So - as always, what’s the problem to be solved? more...
Review of Mail Act-On
You like to be able to triage your e-mail inbox in your quest to attain inbox zero nirvana. My problem always has been that in order to get that inbox to zero, I had to move the e-mail to a folder to file it away. This of course meant either dragging the mail item to the appropriate folder - many times inadvertantly filing into the wrong folder.
Alternatively you could use the menu command Move To or Copy To and scroll down to pick the folder - not terribly useful if you had several bills to file away and you had to pop the menu, scroll, and click to select the same folder.
Of course you could create rules to automagically file the items away but for me, that meant “out of sight, out of mind” and I didn’t get to look at that e-mail anyway. And what's more you'd have to tweak the rules time and again when new e-mails need to get categorised.
more...
Prompt Puppy review
Markdown and "Little Languages"
David Sparks @macsparky and Katie Floyd @katiefloyd in their MacPowerUsers 37 podcast talked about Markdown and MultiMarkdown. I actually used Markdown - see John Gruber’s Daring Fireball Markdown Syntax - in a project at work in which I had to generate documentation formatted as docbook. Fortunately there was a Markdown to docbook translator called Pandoc and it performed (almost) flawlessly - I had to add in a small macro in (ugh) UltraEdit to clean up the generated documentation so the Eclipse postprocessor would be happy with it.
This led me to recall a chapter I had read in Jon Bentley’s highly recommended programming book “More Programming Pearls: Confessions of a Coder” (ISBN 0-201-11889-0). Jon talks about what he calls “little languages” in Column 9, in which he describes a language as ‘any mechanism to express intent’ - thus the linkage to Markdown. Notations or languages such as LaTex, TROFF, and Markdown are akin to other “programming” languages such as C and FORTRAN in that they instruct the computer to process input and generate output. It’s just that these little languages hide a huge amount of complexity in their brevity and let us get on with the things we want to do instead of worrying about the actual syntax of the final output (docbook XML, HTML, instructions to a typesetting system…)
PS This post is written in Markdown within the RapidWeaver application for Mac OS X. The Markup Plug-In for RapidWeaver comes courtesy of André Pang, source code hosted at GitHub.
PromptPuppy: A cute little teleprompter
Another neat thing is using the scrollwheel to control the speed at which the text scrolls - neat. The spacebar is used to toggle prompt mode on and off. Send a suggestion to allow you to save the window size, line spacing and font settings - this would make it so much easier to set up.
The folks at DVCreators.net, who make PromptPuppy and PromptDog, really take care of their users’ questions - got a couple of very quick responses. Got pointed to PromptDog / PromptPuppy by Cali Lewis (GeekBeat TV) in her “Behind the Scenes” episode in which she mentions PromptDog.
Best of all, you can install PromptPuppy on two computers - how neat is that! It runs under Mac OS X and Windows as well, and the two computer license covers either (or both) operating systems.
PS Do remember to note down the special referral code shown on the PromptPuppy site so that you get a discount when you decide to purchase it - every little bit helps!
OO Coding and Software Principles
Agree or NO? "Interestingly with the influx of developers moving into OO coding there seems to be a revival of software principles"
Agree wholeheartedly! Here are some considerations:
- OO coding brings in rigour in coding practices - leading to implicit adoption of good coding methodology.
- Starting on learning something different and new, such as OO methodologies, may lead to developer to explore and learn good software principles, especially when OO methodologies are closely associated with software principles.
- OO practitioners are by and large well founded in software principles - so a developer moving to the OO coding methodology would be motivated to adopt good software principles.
AADL Musings
The AADL lets you model systems as a hierarchy of components, themselves systems. Systems are interconnected via data and event flows. You can also specify properties such as latencies, power consumption, execution time, heat, and weight - both expected and nominal values for each component. Analysis tools, such as those implemented in OSATE, can take these properties and check if the end-to-end latencies, power consumption etc. meet the expected values. Realisations of systems take the form of system implementations and it is possible to try out several different system implementations (e.g. multiprocessor, multicore, uniprocessor) and make several analyses to see which one works best. On top of that the AADL has a very well defined set of semantics for how threads are scheduled, how processes interact, the life cycle of a process, and so on. The AADL is also a standard maintained by the SAE.
I think there’s a place for the AADL in the software development realm - we haven’t done much in the way of rigorous analysis of throughput, many times only as an afterthought. I strongly encourage software system designers and developers to take a hard look at the AADL and see where we all can use the notation and properties to help us better analyse the throughput, latency, and other key performance factors in our systems.
QuickTime Development in Windows XP
Did some judicious websearching and came up with this link: “The easy way to add controls to the VS2005 Toolbox” - which also works for VS 2003. Just drag and drop the DLLs into the Toolbox and voila - they appear! Easy yet quite obscure... Apparently the “Add Item” command works with VS 2005 but I haven’t tried it in VS 2003.
Programmer's Cheat Sheets
http://devcheatsheet.com/
and
http://www.cheat-sheets.org/
I sourced the two Objective-C cheat sheets from the first site:
Objective-C Reference Card for Java Programmers (PDF)
and
Beginners iPhone Objective-C 2.0 Cheat Sheet V4 (PDF)
More on Things
I’ve also emptied my e-mail inboxes for home and work - yes, there are NO messages in ANY of my inboxes! I triage my inbox each time mail comes in and move things to @Action, @ReadReview or @Reference mail folders, as mentioned by David Allen in his book. Then when it comes time to take action, I sweep through my @Action folder and dispatch them. Any e-mails which I need a response to, get filed into @WaitingFor - which I review regularly to keep track of the response.
It’s been almost 2 months since I started on my voyage with GTD, prompted by articles in ATPM (About This Particular Macintosh). It takes discipline to focus, organise references, gather tasks and determine next actions but the result has been worth it. My brain feels a whole lot less stressed since I’ve started putting all my project tasks and actions into Things - even home chores! I still need to sort out my filing system at home and at work - I’ve bought a Brother P-touch PT-2700 labeller (which works with Mac OS X) for home, and use the Brother labeller from my lab at work.
