Monday, June 11, 2012

one-line update for all pom versions in multi-module project

We have a multi-module Maven project with many children, so it's a little annoying to bump the version number. Here's a one-liner to do it, just replace _OLD_ and _NEW_ with the old version and new version, respectively.
for f in `find . -name pom.xml`; do sed 's/_OLD_/_NEW_/' $f > $f.new; mv $f.new $f; done
for example:
for f in `find . -name pom.xml`; do sed 's/1.1.23-SNAPSHOT/1.1.24-SNAPSHOT/' $f > $f.new; mv $f.new $f; done

*DON'T FORGET TO CHECK THE DIFF (you ARE using Git, right?)*

** Update (thanks jamcole)**

Or even easier, use the Maven versions plugin (from the top-level project):
mvn versions:set

Saturday, June 9, 2012

Autotest w/ jeweler and 1.9.2-p320

I wanted to take another stab at TDD (and stick with it this time!) so I dusted off my copy of the awesome PragProg book 'Continuous Testing' and tried to get everything working again. Here's what I had to do (since I have trouble getting everything to work anytime I try - not detracting from the hard work the authors put into the writing, but it's never gone smoothly for me) There's just too many moving pieces that always seem to have minor version incompatibilities or quirks.

jeweler - wasn't too tough to set up, I'm using 1.8.3

So, run:

  • $ jeweler --rspec tower_d
  • $ cd tower_d
  • $ rake
Cool, get the expected:
F

Failures:

  1) TowerD fails
     Failure/Error: fail "hey buddy, you should probably rename this file and start specing for real"
     RuntimeError:
       hey buddy, you should probably rename this file and start specing for real
     # ./spec/tower_d_spec.rb:5:in `block (2 levels) in '

Finished in 0.00038 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/tower_d_spec.rb:4 # TowerD fails

Ok, now to get autotest working...

  • $ autotest
loading autotest/rspec2

Uhoh, it just hangs and doesn't run anything... this is where we run off the rails a bit. Time to read through page after page of conflicting advice based on which version of autotest/ZenTest/rspec/etc we're running.

$ bundle list
Gems included by the bundle:
  * bundler (1.1.4)
  * diff-lcs (1.1.3)
  * git (1.2.5)
  * jeweler (1.8.3)
  * json (1.7.3)
  * multi_json (1.3.6)
  * rake (0.9.2.2)
  * rdoc (3.12)
  * rspec (2.8.0)
  * rspec-core (2.8.0)
  * rspec-expectations (2.8.0)
  * rspec-mocks (2.8.0)
  * simplecov (0.6.4)
  * simplecov-html (0.5.3)

$ gem list autotest

*** LOCAL GEMS ***

autotest (4.4.6)
autotest-fsevent (0.2.8)
autotest-growl (0.2.16)
autotest-rails (4.1.2, 4.1.1)
Hmm... ok, well there's this (rspec wiki) that says for rspec > 2.3 (I'm using 2.8.0) to "make sure you have a .rspec file in the project root. That tells RSpec to tell Autotest to load RSpec’s autotest extension." Jeweler created one already, so that can't be it...

Turns out that you need something like this in a file called .autotest (at the root of your project). The way the wiki is formatted, it LOOKS like it applies to rspec-2.0 – 2.2 only, but it must be for all =/

Autotest.add_hook(:initialize) {|at|
  at.add_exception %r{^\.git}  # ignore Version Control System
  at.add_exception %r{^./tmp}  # ignore temp files, lest autotest will run again, and again...
  at.add_mapping(%r{^lib/.*\.rb$}) {|f, _|
    Dir['spec/**/*_spec.rb']
  }
  nil
}

tl;dr: Make sure you have a .autotest file that adds the mapping

Monday, May 7, 2012

Sunday, July 24, 2011

Burn a VIDEO_TS folder to DVD

Suppose you have a VIDEO_TS folder lying around and you want to create a DVD that will actually play outside of your computer...

It's pretty easy to do, tough to remember - just run this command from a terminal window:

hdiutil makehybrid -udf-volume-name <title> -o ~/Desktop/<dvd_name>.iso <location_of_video_ts_folder>


Replace:

'title' with what you want the title of the DVD to be (e.g. 'awesome_summer')
'dvd_name' with the image file name you want (e.g. 'awesome_summer')
'location_of_video_ts_folder' with where your VIDEO_TS folder resides (e.g. ~/Desktop/MyReallyAwesomeSummer)

That will create the iso file in whatever location you specified - in my example, I'd have a file called awesome_summer.iso sitting on my Desktop). Navigate to that file in finder.

Ctrl-click on the ISO and choose 'Open with...' then Disk Utility.

Click on the ISO name from the left-hand side of Disk Utility then click 'Burn'

Tuesday, October 26, 2010

Nifty way (in Oracle) to get comma-separated list

There's a LISTAGG function (11g only?) that will let you create a comma-delimited list.

select LISTAGG(t.item_id, ',') WITHIN GROUP( ORDER BY t.style_id) FROM (select distinct i.item_id as item_id FROM purchase_order_item poi JOIN item i ON i.item_id = poi.item_id WHERE poi.po_id = 12345) t

Friday, May 14, 2010

Calling a SOAP 1.2 webservice from Ruby

An earlier post showed how easy it is to call a SOAP 1.1 webservice from Ruby, but what happens when you've got a SOAP 1.2 service?

soap4r is out(?) - SOAP 1.2 support is on the roadmap, but doesn't look like it's been touched in a long time.

Luckily, there's a SOAP 1.2 client available for ruby called Savon (http://github.com/rubiii/savon).

Savon seems very easy to install and use:
sudo gem install savon
In your code, you'll need to do something like:
require 'savon'

Savon::SOAP.version=2

client = Savon::Client.new 'http://foo.bar.com/someService?wsdl'

response = client.some_soap_method_in_snake_case

# to see what's avail. as a SOAP method
# client.wsdl.soap_actions

Tuesday, April 27, 2010

Upgrade JDeveloper from 11.1.1.2 to 11.1.1.3 - any ideas?



Tried to upgrade jdev on OSX where I have 11.1.1.2 running happily... get the following wonderfully useful error message: The product maintenance level of the installer (blah blah 11.1.1.3) is not compatible with the maintenance level of the product installed on your system (blah blah 11.1.1.2)

I'll post a solution if/when I find one...

[EDIT: Thanks Shay - choosing a new directory to install JDeveloper does indeed work. I'm not so sure upgrading should really require a 1.5GB download/full install into an alt. directory instead of having some sort of auto-update type feature, but at least it's working. I'll admit it's nice to not worry about dependencies. As for the Maven plugin(developer preview), I'm installing it now and crossing my fingers... ]