Subversion With Mac OS X

Tuesday - 14 April 09

Looking for a way of updating subversion that comes on Mac OS X, I came across this excellent tutorial @ Ruby Robot:

http://www.rubyrobot.org/tutorial/subversion-with-mac-os-x

Not only does Ruby Robot provide this valuable information, but also provided is a run through using subversion on the Terminal. Everything from creating a simple repository to 'checking out', 'updating' and 'committing' changes.

I have always found the svn diff function on the Terminal (or any other command line) pretty painful to use. I like FileMerge on Mac so I wondered is it possible to use FileMerge for diff and merging?

FileMerge is an app provided as part of the Apple Developer Tools. It's very simple to use (I believe it has some history from the NeXT days).

Launching FileMerge from svn on the Terminal would be very handy indeed...

...So the search began, which brought up this groovy little result:

Using FileMerge as a diff command for Subversion

Volia sorted for SVN!



Spanning Sync

Saturday - 28 February 09

Synchronize iCal and Address Book with Google Calendar and Gmail Contacts. Share calendars and contacts among multiple Macs. And while you're at it, connect Google Apps to your iPhone or iPod.

It all sounds very good. I am just a walking advert? Well the truth is I actually think Spanning Sync is a great tool. I first discovered Spanning Sync before Google CalDAV came about.

When attempting to organise my life I started using Google Calender back in 2006. Then after getting a Mac I wanted to use iCal. So I soon found myself searching high an low for a tool to sync up Google Calendar and iCal. Spanning Sync was the first tool I tried and in typical Mac style it is simple to use.

Spanning Sync so far has got by with practically no advertising, purely relying on recommendations and word of mouth. Their save 5 make 5 idea has been a great success by actually giving $5 back to its users! One guy has made $1,000, which is pretty amazing. Having been so impressed with the software I didn't mind actually paying for it, and I have gone ahead and purchased a lifetime subscription.

Check out the video to see how simple it is: http://spanningsync.com/screencasts/intro/



Validate JavaScript variables with WATIR

Sunday - 23 November 08

Recently I was required to add 3rd party JavaScript Tracking Tags to an order confirmation page. The JavaScript passed the quantities of products purchased onto the 3rd party.

I wanted to validate the tags using Watir. It is easy enough to access the DOM using Watir and previously I have validated tracking tags placed in an iFrame url using xpath:

Access the iframe element using xpath (returns an array):
frame = @ie.elements_by_xpath("//[@id='my_iframe_id']")

Access the src of the iframe:
frame[0].src

Then simply assert the src to ensure the right data was been passed via the URL.

This time I wanted to actually validate variables set up in the JavaScript. At first I was thinking about how I could access the script tag, then a much simpler idea came to me:

Retrieve the source code!
html = @ie.html

Assert the contents using a regular expression:
assert(html.match(/SOME_PRODUCT="\+escape\(1\)/), "SOME_PRODUCT quantity should be: 1")

Watir resources



JAX-WS Tutorial

Sunday - 31 August 08 :: 1 Comment

Developer and fellow colleague Paul Taylor, has taken the time to write an excellent and easy to follow JAX-WS tutorial.

Check it out at JavaCoda

Lessons covered:

  1. Basic JaxWs service with defaults & simple client.
  2. Generated client.
  3. Annotations & mapping.
  4. XmlJavaAdapters
  5. SOAPFaults. Handlers.
  6. JaxWsPortFactory with timeouts.
  7. Asynchronous calls.
  8. Spring injection
  9. Field/Property mapping quick examples. Marshalling tests.



NetBeans has TextMate style code templates

Saturday - 09 August 08 :: 2 Comments

Since owning a mac, I have been an avid user of TextMate. Therefore I have picked up some of the TextMate shortcuts for Ruby.

I mostly develop on Windows in the workplace (not out of choice) so I use NetBeans as my main Ruby IDE on both platforms. So I was surprised to find NetBeans contains many of the TextMate code template shortcuts (Known as Bundles in TextMate).

Here are some of the most useful ones:

To activate a code template type the shortcut name followed by the ->| (TAB key)

Shortcut Result
rb #!/usr/bin/env ruby -wKU
req require ""
rw attr_accessor :attr_names
rattr_reader :attr_names
w attr_writer :attr_names
eaeach { |1| }
eaieach_index { |1| }
eakeach_key { |1| }
delidelete_if { |e| }
::key => "value",
dodo |1|
end
def def method_name

end
if if condition

end
unless unless condition

end
while while condition

end
until until condition

end
DirDir.glob() { |3| }
FileFile.foreach("path/to/file") { |3| }
beginbegin

rescue Exception => 1
   code
end
claClassName = Struct.new(:attr_names) do
   def method_name
   end
end

Unit Test code templates:

Shortcut Result
tsrequire "test/unit"

require "tc_test_case_file"
require "tc_test_case_file"
tcrequire "test/unit"
require "library_file_name"

class Test < Test::Unit::TestCase
   def test_case_name
   end
end
asassert(test, "Failure message.")
aseassert_equal(expected, actual)
asneassert_not_equal(unexpected, actual)

The main shortcut that is different is 'cla' in NetBeans this creates a new Struct, but in TextMate it gives you a choice of class options.

Fear not! NetBeans lets you add new code templates by going to: Preferences > Editor > Code Templates.

They're loads more unit test code templates too.



Macs n stuff

Monday - 04 August 08

A couple of guys I work with have started a new blog about mac tips and hints:

www.macsnstuff.com

These guys really do live and breath macs.



Online, on rails

Sunday - 03 August 08 :: 1 Comment

At last my new site is online, knocked together with Ruby on Rails.

I feel it's still in experimentation mode. I may change the design, besides I am continually tweaking the Ruby code :)

Never the less dreampixel is online again, this time with a blog flavour to keep me amused whilst I work on the rest of the site.

Although it has taken a while to get the site online, the actual coding took no time at all with Ruby and Rails.

Resources that guided me in my quest: