Pages

Wednesday, December 31, 2008

Regular expressions in Cocoa using NSPredicate

I spent some time tonight figuring out how to exploit the NSPredicate class from Cocoa for my regular expression needs. I've been trying to do some test-driven development in my iPhone development endeavors and had a need for regular expressions. NSPredicate seems to be the tool for the job, so I wrote up the following wiki page so I could keep this information around.

http://sites.google.com/a/pintailconsultingllc.com/objective-c-and-cocoa/Home/nspredicate-examples

I even cracked open my "Mastering Regular Expressions" book tonight.  Excellent tome on all things regular expression.  Highly recommended.


Tuesday, December 23, 2008

Can't login to the Apple iPhone Dev Connection

Hmmm... I'm having issues logging into the Apple iPhone Developer Connection. I can authenticate on the Mac Developer Connection site and ADC, but the iPhone Developer Connection site doesn't seem to use the same session information, so navigating from one Apple developer site to another seems to be impossible. Anyone else seen this?

Saturday, December 20, 2008

Using Subversion from Xcode 3.1.1

I started using the integrated Subversion SCM support in Xcode today. I've been working through some iPhone development examples from the Beginning iPhone Development book (the grapefruit book). I've been using the command line client and SmartSVN on my Mac up until now. Well, I found out that both the command line client and my SmartSVN client are both version 1.5.x and that the built-in support within Xcode is still at version 1.4.x. The working copies for a 1.5.x client won't work with the older client support that Xcode has linked into its executable. Therefore, if you plan on using Xcode's Subversion support, use only Xcode to interact with that working copy. A 1.5.x client will silently update the metadata in the .svn directories if used against a 1.4.x-based working copy, so be very careful with inadvertantly dropping down to the command line to do some SVN work. You'll most likely render your working copy unusable within Xcode if you do. Here's hoping that Apple will update Xcode and link it against a 1.5.x SVN client library.

Other than that little gotcha, the Subversion support within Xcode is pretty good. I think I prefer how the Java IDEs have it implemented (Eclipse and IntelliJ IDEA). Those tools make the SCM interactions much more seamless. In Xcode, it seems kinda off to the side. I'd really like key mappings for Commit Entire Project... and Update Entire Project. I'll have to look into that and see if that's possible.

Friday, December 05, 2008

EclEmma, a code coverage plugin for Eclipse

If you're an Eclipse user and you're full on with TDD, then you owe it to yourself to install the EclEmma plugin for Eclipse.  It's an open source tool for instrumenting code from within the Eclipse Workbench and then running tests to determine how much test coverage you have.  I've been a Cobertura user, but AFAIK there isn't a Cobertura plugin for Eclipse.  EMMA is another code coverage tool (and is baked into Jetbrains IntelliJ IDEA).  This plugin is very well done and really helped me to understand where I needed more tests.  The best thing about this plugin is that you can get code coverage on a single class that you're unit testing, so the turnaround time is very small for determining where you have holes in your test coverage.  Very impressive.  One gripe that I do have with it is the inability to turn off coverage on the tests.  I don't want to instrument those, but the tool seems to want to select the tests to instrument along with your source.  Not a big deal...I just ignored any of the coverage information pertaining to tests.

Thursday, November 27, 2008

iPhone development fun

Since I used up quite a bit of my Thanksgiving eating, sleeping, and struggling with Apache Ivy, I was only able to spend a little time working through some of the examples from the book "Beginning iPhone Development" from Apress.  So far it's been a pretty good book.  I've been messing around with Xcode for about 3 weeks now and I'm truly impressed with the Mac development environment.  The Cocoa framework is very well thought out and easily to use.  I really like how Interface Builder works, wiring up outlet and actions to code.  I can see why there's so much hype around iPhone development.  It's quite pleasurable.  The tools are really easy to use and the frameworks and Objective-C are fairly straightforward to pick up.  I've been doing the development on a MacBook and it's very much up to the task of Mac/iPhone development (it helps to have 4 GB of RAM in this thing though).  So far, I've had a ball doing iPhone development.

Apache Ivy...cool concept, but terrible out of box experience

So I spent some quality time with Apache Ivy this Thanksgiving holiday.  I wish I could say that was time well spent.  I really like the concept of Ivy...but the implementation is really complex and poorly documented for first time users.  For starters, all the configuration is in XML.  No big deal, but the XML configuration can get quite convoluted and it seems like the defaults are never what you want,so you end up writing more configuration to get the results you want.  I was never able to find a good ivysettings.xml example (full example, not bits and pieces).  The ivysettings.xml seems to be a prerequisite to configuring which Ivy repositories you will pull content from.  I wanted to pull my content from SpringSource's Enterprise Bundle Repository, which is not the default.  SpringSource has snippets of ivysettings.xml configuration, but not a base configuration that you can just copy and use.  Second, the bundle repositories seems to be in shambles.  Of all the repositories that I could find, only SpringSource's was documented enough that you could figure out how to pull the bundle dependency.  Unfortunately, I couldn't get my settings to connect to that repository.  Third, pulling dependencies like Spring Framework will pull in a whole bunch of unnecessary stuff, JARs that I did not want.  I really don't want to have to spend 2 days learning Ivy.  It's a nice to have feature for managing dependencies.  I just want it to work.  But it seems that Ivy expects a significant investment of time and work to get working properly.  Too bad, as I'll probably dump it for something else.  Am I being too critical of Ivy?  Should I not expect a good out of box experience with this tool?   

Monday, October 13, 2008

Line numbers in Java exception stack traces

Today at work, our development group was debugging an issue with our CI server deployment.  The log file contained a stack trace without any line numbers or other information.  This prompted some Googling on the subject, and elicited this blog entry:

http://sahyog.blogspot.com/2008/02/line-numbers-in-java-exception-stack.html

Good information about the javac task in Ant.  I did not know about the debuglevel option.


Wednesday, October 08, 2008

Custom argument matching with Mockito

I wrote up a wiki entry on my continuing adventures with Mockito.   This time, I'm trying to perform state verification of the inputs to the test double dependency.  And again, Mockito does not disappoint with its awesome Matchers and ArgumentMatcher support.  I'm really enjoying the use of Mockito.  Very much recommended.

 

Saturday, October 04, 2008

Updated my Mockito example

I updated my Mockito example on my wiki.  The example now uses Mockito's annotation support.  Cleans up the setup considerably.

http://sites.google.com/a/pintailconsultingllc.com/java/mockito-examples

Thursday, September 18, 2008

Using Rhino Mocks wiki entry

http://sites.google.com/a/pintailconsultingllc.com/net/using-rhino-mocks

My first foray into unit testing with a mocking framework in .NET.  Rhino Mocks has a very similar feel to EasyMock in the Java world.

Copy Source as HTML Visual Studio 2008 Addin

If you ever have a need to document source code in a wiki or a blog, this addin is very handy. 

Using Rhino Mocks with MS Test

This post helped me out tonight. If you get some silly message that Rhino.Mocks.dll is not in a trusted location, the resolution of the problem is fairly straightforward.

Thursday, September 11, 2008

Implementing object identity when using Hibernate

A good article on how to effectively implement object and database identity with Hibernate-mapped domain objects. Probably not specific to Hibernate, but for any domain object mapped by an ORM framework. Good read.

http://www.onjava.com/pub/a/onjava/2006/09/13/dont-let-hibernate-steal-your-identity.html

Friday, September 05, 2008

jMock example is now up

http://sites.google.com/a/pintailconsultingllc.com/java/jmock-examples

Of the three mocking frameworks that I've now briefly looked at, I'm most impressed with jMock. I just like the simplicity and feel of it. Very easy to use and I really like it's expectations implementation. I've started building out a sample Spring MVC web app which I will drive with TDD and mock object usage, utilizing jMock for object mocking. So far so good. I'll post more when I get the chance.

Wednesday, September 03, 2008

Custom JSP 2.0 tags example is now up

http://sites.google.com/a/pintailconsultingllc.com/java/custom-jsp-tag-libraries

I had a need to create a view helper for a web view that I was building, so I did a small spike solution on JSP 2.0 tags. They seem much easier to write than they were previously (I haven't written one in many years). I thought I'd put it up on the wiki for others to use. Hopefully it proves useful. This example is done using Spring MVC as the web framework. Nothing special needed to integrate the JSP 2.0 tag into the Spring MVC web app.

Sunday, August 31, 2008

Mockito example is now up

http://sites.google.com/a/pintailconsultingllc.com/java/mockito-examples


Same set of classes as the EasyMock demo. Not much difference between EasyMock and Mockito, at least not yet. Mockito probably is a bit easy to use (no replay method to be invoked before testing).

EasyMock example

We're starting to look at mock object frameworks at my current consulting gig, so I thought I'd put together a small example of how to use EasyMock.


http://sites.google.com/a/pintailconsultingllc.com/java/easymock-examples


Pretty simple but gets the point across on how to get started with EasyMock. Mockito examples are forthcoming.

Tuesday, August 12, 2008

Teaching programming with Python

Using Python to teach my daughters about programming. Thought it would be fun and get them to apply some of things they've learned in school. So far so good. We did a Hello World python script tonight.

Saturday, June 28, 2008

JavaScript apps with SproutCore

Installed the SproutCore Ruby gem this evening and I'm starting to play around with SproutCore. More information about SproutCore can be found at http://www.sproutcore.com. SproutCore uses Ruby and some other Ruby gems (Mongrel, Merb, and others) to help you build and test JavaScript apps. Apple is using this for their Mobile Me service. Looks really interesting and so far the examples are pretty cool.

Sunday, June 22, 2008

Valuing simplicity

I've been reading Douglas Crockford's JavaScript: The Good Parts. A good read, especially if you've done JavaScript in the past and didn't think much of it at the time (like myself). It's been an eye opening read. One of his lines in the book, "We value simplicity, ..." struck a chord with me. A very simple statement, but it sums up something that I hold very dear to my heart these days.

I value simplicity. A lot. That's why I think I like my Mac so well, after working with Windows and Linux. I like Windows because it's familiar, but there are so many options, and the options seem to change in every Windows release. The reliability of Windows also is a concern. Linux just isn't simple...it's not designed to be simple nor do it want to be. That's good for some situations, but terrible if you want to appeal to the masses. The Mac and other Apple products appeal to the masses due to simple by stylish designs.

I'm not finding all this AJAX, JavaScript, and DOM manipulation simple in design. It's quite the opposite. It's seems very messy and chaotic using HTML, CSS, and JavaScript for building web applications. And the interfaces that are being built still pale in comparison to rich applications. Hopefully things get better over time with the RiA technologies (Flex/Flash, Silverlight, etc.).

Extra-lazy collection fetching in Hibernate

I came across some new functionality in Hibernate recently, extra-lazy collection fetching. This functionality, which seems oddly named, basically allows you to initialize individual list or map items, if you have everything configured in Hibernate just right. The details of my spike solutions are written up on my wiki:

http://sites.google.com/a/pintailconsultingllc.com/java/hibernate-extra-lazy-collection-fetching

For small lists, I would recommend not using this functionality, as every item is a SQL call to the database. For a large list or child objects which are expensive to create, this might be just what you're looking for. It took me a while to get the list semantics to work properly. The @IndexedCollection is very important. I have not played with a map collection yet, but in theory that collection should work similarly.

Tuesday, June 17, 2008

Hall monitor tests

Hall monitor tests are tests included in your unit and integration test suites that ensure that coding conventions are followed. They codify and automate the tribal wisdom of the development group. I used them very effectively on a .NET project about a year ago. Kudos to Joe Muraski, Brad Hill, and Bob Schultz for their efforts with "hall monitor" tests.

Monday, June 16, 2008

kuler - Adobe's fabulous color picker/theme organizer tool

If you ever need to do any styling and need a set of colors for a theme, check out Adobe kuler tool. A Flash-based web tool that is simply amazing. Free for use; just log in with your Adobe ID and you're off and running.

http://kuler.adobe.com/

Friday, May 23, 2008

A rabbit killed my Internet connection

First off, kudos to the Comcast technical support person that came out to my home and quickly diagnosed the issue with our cable connection. It seems that rabbits around our parts have a taste for coaxial cable insulation (the black plastic covering of the cable). Our Internet service went on the fritz about a week ago. All my attempts to get it back online proved futile. Coinciding with this outage was the recent irrigation system work on Thursday. So I was all ready to place blame on the irrigation installers.

The Comcast technical support person stopped out a couple of days ago and inspected everything. He said he'd like blame it on the irrigation guys too because then they can bill the irrigation guys for the work and materials to fix it. Nope, the insulation on the coaxial cable was nibbled away very close to the house, two sections, each of about 2 inches in length. The Internet connection has been restored and the Comcast guy put some electrical conduit around the cable where it comes out of the ground and into the house to deter the rabbits from doing this again.

Monday, May 05, 2008

Understanding Flash window modes for embedding HTML rendering in Flex app

An excellent write up about Flash window modes. I'm attempting to use an IFrame in my Flex application to punch a hole into the Flash movie and allow HTML rendering in my Flex application. When doing this, one needs to understand window modes. I'll probably have more to say about the IFrame solution in Flex, but for the meantime, here are some very relevant links:

http://www.communitymx.com/content/article.cfm?cid=e5141


http://ccgi.arutherford.plus.com/blog/wordpress/?page_id=171


http://ccgi.arutherford.plus.com/blog/wordpress/?p=173

http://ccgi.arutherford.plus.com/blog/wordpress/?p=133

http://www.deitte.com/archives/2007/09/html_in_flex_wi.htm

Sunday, May 04, 2008

Getting Hibernate to format generated SQL

Use the configuration property hibernate.format_sql to have Hibernate format generated SQL. This feature needs to be used in conjunction with the hibernate.show_sql configuration property. Both need to be set to true to get nicely formatted SQL. Very handy for understanding what Hibernate is doing.

Saturday, April 26, 2008

flexcover: A code coverage tool for Adobe Flex

Found this interesting tool for Flex development. I've been using dbUInt Flex testing framework to do TDD with Flex. Having a code coverage tool will be very helpful for my TDD efforts.

Understanding Flex transport protocols

I've been doing some investigation of Adobe Flex remoting and messaging protocols. I've used the HttpService before and was somewhat underwhelmed by its performance. Recently, I've looked at BlazeDS and the AMF3 binary protocol. AMF3 seems much faster than transporting XML over HTTP. Well, James Ward has an excellent Flex application that quantitatively demonstrates this performance difference.

http://www.jamesward.org/census/ (Source code here)


Very well done and quite informative.

Sunday, April 13, 2008

First Flex app up and running with BlazeDS

Well it took me a while and a lot of browsing the web for the proper incantations, but I finally got a Flex app up and running with BlazeDS 3.x. Their reference documentation is not very clear about the Flex compiler arguments that you need to specify to reference the services-config.xml and to specify the servlet context root. I have a document of the steps that I went through, with screenshots, so others might have an easier time with this. BlazeDS remoting seems very quick and performant. For my application, I built a new Java web app up from scratch and did not use any of the turnkey stuff. In hindsight, it seems that magic revolves around the Flex compiler arguments. This Flex app also uses Cairngorm microarchitecture framework, which seems pretty straightforward to use. Next up is to hook in Spring and Hibernate on the Java server side.

Saturday, April 12, 2008

Silverlight 2.0 does have unit testing

Seems that Silverlight 2.0 does have some unit testing potential.

http://www.jeff.wilcox.name/2008/03/31/silverlight2-unit-testing/

Excellent tutorial on Cairngorm framework

If you do anything of any substance in Adobe Flex, you'll undoubtedly come across the Adobe Consulting Cairngorm framework. It can be a rather daunting framework to grasp at first, but David Tucker has an excellent multi-part tutorial to guide you on your way. Very much recommended.

http://www.davidtucker.net/category/cairngorm/

Tuesday, April 08, 2008

MSTest tools don't seem to work with Silverlight 2.0 projects

I've been playing around with Silverlight 2 beta in Visual Studio 2008. I tried to create a Test project in my Silverlight solution and add a Silverlight project as a reference to the Test project. No go! Complains about Silverlight assemblies can only be referenced by other Silverlight assemblies. This sucks...I wanted to drive a lot of my design of non-visual classes in the Silverlight project using tests. I assume that NUnit testing won't work either. Could be very interesting developing for the CoreCLR.

Friday, March 21, 2008

Sonos ZoneBridge now installed

Added the ZoneBridge to my Sonos music network tonight. Very easy to install--it's pretty much plug and play. My ZonePlayer is now connecting wirelessly to my ZoneBridge and the ZoneBridge is connected to my Airport Extreme access point in my living room. Not bad for about 20 minutes of configuration and software installation and setup. I have a pair of Definitive Technology ProMonitor 1000 speakers connected to the ZonePlayer ZP100. Sounds great.

Sonos Music System up and running

Received our Sonos music system today. For more information, go to http://www.sonos.com. I bought the Controller 100 and ZP100 Zone Player combo for $699. Set up the computer software on my Macbook. Installation on the Mac is effortless and I literally had it playing music from my NAS device in 5 minutes. Looks like it uses Windows Networking (aka SMB or CIFS) to access music libraries. I have a 1 TB Western Digital MyBook World NAS device connected to the network where I've been burning my WMA files to. Haven't tried Ogg Vorbis or iTunes collections yet. I absolutely love this music solution. Great out of box experience. Kudos Sonos!

BTW, I also purchased a Zone Bridge from Sonos, but have not connected that to the network yet. I post more when I get that online.

Thursday, February 28, 2008

New Airport Extreme

Man, these Apple products are like crack! Now that I have the MacBook, I wanted to upgrade the living room wireless access point. Went out to the Apple Store and ordered an Airport Extreme. Super easy to setup, very small and stylish, and it seems to run great. I'm using it in bridged mode and 802.11n only (radio set at 5 GHz). Hopefully I'll be able to use wireless outside in the backyard pool area. Highly recommended!

Saturday, February 16, 2008

New MacBook!

Just bought my first Mac...a black MacBook. I bought it with 1 GB of RAM, but immediately went to Newegg.com and purchased 4 GB of RAM to replace the original 1 GB that came with the system. So far so good. My Dell XPS went on the fritz late last week. It looks like the nVidia video card went to hell and now none of the operating systems will boot up on it. And the Dell is off warranty, so it's going to cost me some money to get the thing fixed. Oh well. So I'm rolling with the MacBook. For Windows, I'm going with VMware Fusion on the MacBook.

Tuesday, January 22, 2008

Continuous testing using Fireworks

This past weekend I installed the Fireworks plugin for IntelliJ IDEA. Fireworks will periodically check your source directories and if anything changed, will run all the tests (after recompilation) without you, the developer, having to initiate the test runner. There are some things that I'd like to see different in the plugin (e.g. the ability to exclude integration tests from continuous build), but overall, it's a worthwhile tool for the arsenal. One other gripe is that Fireworks pops up the compilation dialog. I think I can actually get this to work in the background by tweaking an IntelliJ preference. You can still use the test runner within IntelliJ; Fireworks just ensures that you're running tests more often. Thumbs up!

Powered by ScribeFire.

Saturday, January 19, 2008

Fireworks IntelliJ IDEA plugin for continuously running unit tests

Just installed the Fireworks plugin for automating the running of unit tests. Very cool. The plugin installs a tab that changes its icon depending on whether the test suite running successfully or not. Very similar to autotest in Ruby's ZenTest gem. Very nice complementary tool for TDD. Definitely a good find.

Powered by ScribeFire.

Wednesday, January 09, 2008

Compiz Fusion on Kubuntu 7.10

sudo apt-get install compiz compiz-kde compizconfig-settings-manager emerald

Alt-F2 to run compiz -replace
Alt-F2 to run emerald -replace

Configure Compiz and Emerald from KDE Menu, Settings.

Very, very cool. Much better than Vista and Mac OS X.

Powered by ScribeFire.