http://www.catchoftheday.com.au/smallfish_info.php?products_id=3253
Saturday, 1 August 2009
Sunday, 21 June 2009
Formatting a hard drive > 32Gb in FAT32
have, in terms of a near-universal file system. FAT32 is good enough,
except for those cases where you have >4Gb files. This will probably
happen more often, now that Virtual Machines are becoming more normal,
and people are dealing with BlueRay extracted media files and DVD ISO
files.
I got a new LG 500Gb portable drive, and now have to format it for use
with my WD TV HD Media Player. It's formatted NTFS by default, but I
have a Mac, so I can't write to the damn thin without installing
something like NTFS-3G, which *should* be stable enough these days,
but I've no experience with it, so I'll do more research before going
NTFS on my external drives. I'll just keep my virtual machines on my
local drive for now. (they're going to be faster that way anyway)
For large drives, previously I've had to go through crap like creating
a small partition because Windows format command only supports drives
up to 32Gb for FAT32, formatting in FAT32, and then expanding the
partition using PartitionMagic.
Someone has written a free utility to format a large drive quickly in
FAT32. Incredible speed - formatted my 500Gb drive in seconds!
Doing our bit to stimulate the economy... buy buy buy!
What have we bought?
1. Media Player and
2. 2.5" HDD - Bought this online on Tuesday from mwave.com.au. They
had a sale on the Western Digital WD TV HD Media Player, at around
$175. And I also got an LG 500Gb 2.5" portable hard drive, at $140.
Went to the Mwave offices in Lidcombe (it's local!) to pick it up. The
place is pretty much a warehouse, with a small room for a "public
shopfront". It's not really a retail outlet, since there's no items
there to look at and buy directly. Finally I'll be able to watch the
backlog of DivX files I've had over the past 2 years, and clear out
space on my main computer (only 4Gb available!).
3. Netbook - OMG, the perils of getting a redundancy, having $$$ in
the bank, and being at home browsing those "one bargain a day" sites.
At catchoftheday.com.au on Thursday they had a sale on the ASUS EEE
1000HE laptop, which is a new model with Atom N280 1.6Ghz, 1Gb RAM,
160Gb HDD, Wireless-N, Bluetooth, 10" screen, 92% size keyboard. Very
very nice. Couldn't resist a bargain at $619 (after $40 discount if
you used Paypal)! Current retail is around (according to Shopbot)
"Price range: $669.00 to $934.95 at 55 stores". So I got it, thinking
if it doesn't work out between us - I fear the small screen could be a
problem when working with an IDE - I can always sell it *and make a
profit*, but still way below retail prices!
4. Lanwmower - our GMC lawnmower carked it about a month ago, so got
ourselves to Bunnings on Friday and bought a Flymo lawnmower. I think
it's by Husqvarna, since that's the name on one of the stickers on the
box. Or maybe they're the importers? Anyway, it looks quite
"Scandinavian".. my son said "Big Red Car" when I carried the box
inside. My brother says it looks like a race car. It's the kind of
lawn mower that'd fit in at IKEA, if they sold em there. Was thinking
of getting this other, much smaller lawnmower also from Flymo, but
this was different because it was like *a hovercraft lawn mower*! It
floated on a bed of air, and cut the grass, but didn't have a
container for storing the clippings. I guess the clippings just stayed
on the ground and you had to rake it. Which means I'd have to get a
rake, and do more work? No thanks. Someday, I *will* get a
hovercraft-something. Hovercraft food processor? Hovercraft vegetable
slicing julienne tool. Yeah, someday, my hovacraft will come, boiee..
5. Steam Iron - Also on Friday, we got the Philips GC4420 steam iron
from Good Guys for $95, to replace our steam iron which I stupidly
dunked in a pail of water. People - *never* iron your clothes in the
bathroom. Stupid ironing board had a board cover that was oversize,
and covered that metal tray on the right side where you place the
iron. Anyway, I placed it there, but on its rear, so it was unstable
and fell in the bucket of water. And - this is what I moron you get
when you're sleep-deprived - I almost put my hand in the water to
retrieve the iron! All while it was plugged in to the outlet. Good
thing I stopped and thought, "Yeah, I should probably turn off the
power outlet first!" By which time the safety switch kicked in anyway
and all the electricity in the house turned off. So got on the forums
- thanks whirlpool.net.au forums - and word on the street is that
Tefal and Philips are the brands to go for. Also learned about this
extremely expensive - but allegedly excellent - brand called
LauraStar. Holy shit, their "systems" can cost up to $1400!! The irons
themselves are selling for $500+, after heavy discounting already. I
don't wanna know the "normal" price. Anyway, another brand name I can
fake and claim that I own, just like Lexus, Miele, Dyson and Apple.
Oh, I do have the latter two. Anyway, it has auto-stop (so it turns
off if you accidentally forget it lying around) and anti-calc system
(so you don't get that yucky particulate flakes coming out of the
steamer when you iron, thereby fucking up your just ironed clothes),
which are the most important features for me. Also had to be light,
since my mother-in-law does an unfair majority of the ironing around
here, so that kicked the GC 4630 out of the running (that had the
Ionic Steam feature). And this model also has Steam boost, so giving
out 100g instead of 40g of steam. Awesome.
6. Running shoes - Friday too, wife and I bought new running shoes at
Paul's Warehouse, Homebush. The bargains are not that extreme as the
ads make it out to be. Tons of stuff were selling for $100+ anyway.
How the fuck can they justify these prices for running shoes? It's not
like they now have cpus and memory foam and teflon. My old ones are 4
yrs old anyway, and looking ratty, so was a good time to get. Total
cost - $170.
All through the week I've been checking out deals on the iPhone
(unlimited broadband for $50 on Optus... please please) and the Nokia
E63 on 3 ($29/mo for 12 mos.. wow). Must forget all this and realise
I've survived this far without this anyway.
Okay, economy, get better!! I just paid you to do so. =)
Wednesday, 17 June 2009
500 Days of Summer - International Trailer
I'm really looking forward to this film! :) Nothing's made me feel like this in a while.
Tuesday, 16 June 2009
Rapid SVN for OSX - doesn't work at all
Friday, 12 June 2009
Removing .svn directories and getting "Operation not permitted" on OSX
into another repository. The cleaner way to do this would have been to
export the directories I wanted, so that .svn directories didn't get
created. But I no longer had access to the original repositories, so I
have to remove the .svn directories recursively.
And I found this bit of shell scripting would work on OSX (currently
on 10.5.7) after moving to the top of the directory tree where i
wanted to delete .svn:
find . -name .svn -exec rm -rf {} \;
Source: http://codesnippets.joyent.com/posts/show/104
most of the time.
Except when I would get "Operation not permitted" with some directory
trees. Turns out these files under .svn had the immutable flag set on
them, and we have to use the 'chflags' command with the 'nouchg' to
remove the immutable flag.
chflags -R nouchg [name of directory containing .svn directories]
eg: chflags -R nouchg MyProject/
Source: http://www.osxfaq.com/tutorials/learningcenter/AdvancedUnix/ugp2/page2.ws
Yay!
Saturday, 6 June 2009
Tuesday, 12 May 2009
Spring FAIL - incomplete documentation on JibxMarshaller from spring-oxm library
documentation and non-existent examples.
<bean id="jibxMarshaller"
class="org.springframework.oxm.jibx.JibxMarshaller">
<property name="targetClass" value="au.com.company.JOB"/>
<property name="indent" value="4" />
<property name="bindingName" value="jibx_binding" />
</bean>
The javadoc for setBindingName() in JibxMarshaller simply says:
/** Sets the optional binding name for this instance. */
There is no indication what it actually means - is the bindingName the
same as the binding file? Should I be indicating the location of the
file??
I try this:
<property name="bindingName" value="classpath:jibx-binding.xml" />
and I get
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'jibxMarshaller' defined in class path
resource [batchContext.xml]: Invocation of init method failed; nested
exception is org.springframework.oxm.jibx.JibxSystemException: Binding
'classpath:jibx-binding.xml' not found for class
au.com.careerone.xmlbinding.adicio.JOB; nested exception is
org.jibx.runtime.JiBXException: Binding 'classpath:jibx-binding.xml'
not found for class au.com.careerone.xmlbinding.adicio.JOB
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 32 more
Caused by: org.springframework.oxm.jibx.JibxSystemException: Binding
'classpath:jibx-binding.xml' not found for class
au.com.careerone.xmlbinding.adicio.JOB; nested exception is
org.jibx.runtime.JiBXException: Binding 'classpath:jibx-binding.xml'
not found for class au.com.careerone.xmlbinding.adicio.JOB
at org.springframework.oxm.jibx.JibxMarshaller.afterPropertiesSet(JibxMarshaller.java:137)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
... 42 more
Caused by: org.jibx.runtime.JiBXException: Binding
'classpath:jibx-binding.xml' not found for class
au.com.careerone.xmlbinding.adicio.JOB
at org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:180)
at org.jibx.runtime.BindingDirectory.getFactory(BindingDirectory.java:197)
at org.springframework.oxm.jibx.JibxMarshaller.afterPropertiesSet(JibxMarshaller.java:130)
... 44 more
I then tried putting in the mapping name, even though it doesn't
really make much sense:
<property name="bindingName" value="JOB" />
Still no dice.
I look in the source for JibxMarshaller, and find this line where
bindingName is used:
bindingFactory = BindingDirectory.getFactory(bindingName, targetClass);
I look in the Jibx class BindingDirectory, and find:
public static IBindingFactory getFactory(String name, Class clas,
ClassLoader loader) throws JiBXException {
String list = getBindingList(clas);
String match = GENERATE_PREFIX + name +
BINDINGFACTORY_SUFFIX + '|';
int index = list.indexOf(match);
where GENERATE_PREFIX and BINDINGFACTORY_SUFFIX are:
/** Prefix used in all code generation for methods and classes. */
public static final String GENERATE_PREFIX = "JiBX_";
/** Suffix of binding factory name. */
public static final String BINDINGFACTORY_SUFFIX = "Factory";
Then I look around in my /target directory (I am using Maven), and see
that there is a class called:
JiBX_jibx_bindingFactory.class
Opening this in Notepad++, I find a string:
au/com/careerone/xmlbinding/adicio/JiBX_jibx_bindingFactory
So it looks like Jibx first converts the name of the binding file into
Java class format, and the '-' in jibx-binding becomes an underscore.
So we get: jibx_binding
But was this documented anywhere? No!
This Jibx bug helped me figure it out:
https://svn.sxc.codehaus.org/browse/JIBX-210
Oh well.
Monday, 27 April 2009
Maven: replace a shell script with a Groovy script run by gmaven-plugin
looks quite awesome.
Text below is just cut and pasted from the Maven mailing list.
================================================================
PROBLEM:
At a customer site there is a custom, company-wide dictionary available for
spellchecking. This dictionary is managed in an proprietary application from
where you can export it. For the webapp we're building we need to transform this
dictionary into a very simple format: a single file with one
dictionary entry per line. The export format is somewhat special as
its spread over a bunch of files (one for each letter of the
alphabet), contains additional syllabication info, which we don't need
and also has some comments that have to be removed. The specifics of
the format aren't really that important here though...
After some testing I came up with the following short bash-script that fullfills
all my needs:
8<-----------------------------------------------------------
tmp_folder=target/dict
cls_folder=target/classes
mkdir -p $tmp_folder
mkdir -p $cls_folder
cat src/main/dictionary/*.lst > $tmp_folder/tmp1.dict
sed "s/[~?]//g" $tmp_folder/tmp1.dict > $tmp_folder/tmp2.dict
sed "s/ .*$//g" $tmp_folder/tmp2.dict > $tmp_folder/tmp3.dict
sort -u -o $cls_folder/my.dict $tmp_folder/tmp3.dict
8<-----------------------------------------------------------
(In other words: Take all files src/main/dictionary/*.lst, concat them into one
single file, match some strings with simple regexes and remove those, and
finally sort the dictionary entries and remove all duplicates.)
This script is then called from within maven with exec-maven-plugin. Afterwards
maven-jar-plugin wraps the file in a simple jar, so the dictionary can
be easily consumed in Java using
getClassLoader().getResourceAsStream().
Now all is well & nice and this script even performs sufficently given about 1.6
million dictionary entries (~38MB). But of course it's not really the
Maven way to do things, especially because it's not portable. You need
to have some kind of Unix-like enviroment in place for this script to
work.
SOLUTION:
Assuming the dictionary source files are already broken down by letters
of the alphabet, then the following 5 lines of code does most of it.
(Note that the sed scripts are pretty close to just a line by line
trim() and, of course, you may need to sort the file names.)
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
<![CDATA[
new File( "target" ).mkdirs();
def resultfile = new File( "target/dictionary" );
new File("src/main/dictionary").eachFileMatch(~/.*\.lst/){ file ->
file.readLines().sort().each(){resultfile << it.trim() + "\n";}
}
]]>
</source>
</configuration>
</execution>
</executions>
</plugin>
Saturday, 18 April 2009
Random videos
Aaaaaw....
This next one hurts a li'l bit, cos I play bass. :(
Wednesday, 18 March 2009
Gmail fixes "mark as unread" annoyance - you can now mark individual messages instead of the whole thread
marks *the whole thread* instead of just the specific message that you
wanted to mark as unread. I'm just surprised it took so long to get
it fixed.
http://gmailblog.blogspot.com/2009/03/small-but-helpful-change-to-mark-as.html
Tuesday, 17 March 2009
Jaxb notes: specifying a package for a classes generated from a schema
to define the package name for the schema.
For example, the following defines the package name for all JAXB
classes generated from the simpleservice.xsd file:
<jaxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
schemaLocation="simpleservice.xsd"
node="/xs:schema">
<jaxb:schemaBindings>
<jaxb:package name="examples.jaxb"/>
</jaxb:schemaBindings>
</jaxb:bindings>
Taken from http://edocs.bea.com/wls/docs103/webserv/data_types.html#wp223112
Saturday, 7 March 2009
Getting a replacement power supply for Western Digital external drives - easy as pie
Saturday, 29 November 2008
Saturday, 8 November 2008
Re-ordering songs in a playlist in iTunes - you first need to click on the playlist number (1st column)
I was preparing a CD songs for my son, and I had the songs in a playlist. The first group of songs I added was from a single CD, so that was easy enough. I added a few more songs later, and discovered that changing the order of the songs in a playlist can be a bit puzzling. Trying to drag around a song in the list, which normally you'd expect to be enough to change the sequence, had no effect. Googling it reveals that it doesn't work when the list of songs is already sorted on a column other than the first one, which is the list number. However, there is no indication anywhere in the interface that this restriction is in place!
Now from an implementation point of view, I can see why they don't allow it. For example, if the list of songs is sorted by Name, in ascending alphabetical order, allowing the songs to be dragged around and resequenced would be inconsistent with what the table widget is meant to
be doing.
But this is a totally inadequate user experience! If you can't drag and drop the songs while it's sorted on any of column after list number, then why couldn't they tell that to the user? There should be a drag/ drop event detectable from the GUI toolkit, so why couldn't they put in a condition like:
IF (song is being dragged and dropped) AND (songs are sorted on any
column from 2 onwards) THEN
SHOW MESSAGE "Click on 1st column before changing the order of the songs"
Unfortunately, iTunes has worked like this for a while (and so have complaints about it), so I don't think Apple will be making this operation a bit easier.
So to change the order of songs in an iTunes playlist, click on the first column to cancel out any other sorting on the list, before dragging the songs to the desired sequence.
NOTE: Make sure that the shuffle button in the bottom left is not clicked. (thanks Andrew!)
Thursday, 30 October 2008
Xpath info - don't use "/" at the end of a xpath query
you'll get this error:
javax.xml.transform.TransformerException: A location step was expected
following the '/' or '//' token.
http://p2p.wrox.com/topic.asp?TOPIC_ID=8429
"A path expression never ends in "/", except for "/" used on its own
to refer to the root node."
Thursday, 11 September 2008
O'Reilly Maker

http://www.oreillymaker.com/link/19781/groping-for-admins/
I'm pretty sure I've come across it before but didn't have the requisite brain cells to come up with something.
The things you do at 2 in the AM....
Sunday, 20 July 2008
Problem upgrading firmware on Billion 7300G ADSL Modem? Try using Firefox. + Hidden config pages.

I was trying to upgrade my Billion 7300G modem to firmware ver. 1.36 using my iMac, and kept getting up to a certain point and then bomb out around at the 24% mark and return an alert/dialog box that just had:
http://192.168.1.254
Error!
Great, talk about informative error messages!
After a bit of Googling, I found out that this problem only occurs when performing the upgrade from Safari, and Billion have supposedly promised to fix this. I But there haven't been any more firmware updates after ver. 1.36 anyway. The only solution is to use another browser like Firefox.
On another note, I've also sorted out my issues with my wi-fi at home simply by boosting my wireless signal.
My modem/wifi router is in a room on the second floor, while my main computer, a 24" iMac, is downstairs. Now the problem was the iMac would keep losing the wi-fi connection when it came back from Sleep mode. After this any open tabs in Safari would no longer work, and the only workaround I've had was to turn off Airport, then turn it back on again.
The Billion has some hidden configuration pages, and going to http://192.168.1.254/wireless_txpower.asp shows the Wireless signal is only transmitting at 70% strength! Setting the value to 100% sorted out my issues.
Google's Blogger widget for Mac OSX is rubbish
The only thing I found interesting was that it encodes punctuation marks so you end up with ' instead of the (') character. But that's probably Blogger itself, and not the widget making those changes.
WTF? It's 2008, guys. I'm sure you can do better than this!
I've never been so insulted by Google Ads!

So how are we meant to describe musicthing's audience, based on these two ads? "Overweight and buys a lot of games and DVDs"?
Quotes from Anchorman: The Legend of Ron Burgundy
Yes, I realise this has probably all been done before, and I this is all wasted effort and I should've Googled it first... but what can I say? I felt the urge! It was a labour of love. :P
"I know what you're asking yourself - and the answer is yes, I have a nickname for my penis. It's called The Octagon. But I also nicknamed my testes. My left one is James Westfall, and my right one is Dr Kenneth Noisewater. You ladies play your cards right you might just get to meet the whole gang."
"People seem to like me because I am polite and rarely late. I like to eat ice cream and enjoy a nice pair of slacks. "
"We've been coming to the same party for twelve years now, and in no way is that depressing."
"I don't usually do this, but I felt compelled to tell you something. You have ... an absolutely ... breathtaking ... heinie. I mean, that thing is good. I wanna be friends with it."
"I'm very important. I have many leather-bound books and my apartment smells of rich mahogany."
"(to Baxter the dog)You're so wise. Like a miniature Buddha, covered in hair."
"(to Baxter the dog) You know I don't speak Spanish. In English, please."
"(to Baxter the dog) You pooped in the refrigerator - and you ate a whole wheel of cheese? How'd you do that?"
"Well, I could be wrong, but I believe Diversity is an old, old wooden ship that was used during the Civil war era."
"It is anchor-MAN, not anchor-LADY, and that is a scientific fact!"
"It's terrible! She has beautiful eyes and her hair smells like cinnamon!"
"I read somewhere that their periods attract bears. The bears can smell the menstruation."
"Hey! Where did you get those clothes? At the... toilet store?"
"I will smash your face into a car windshield, and then take your mother Dorothy Mantooth out for a nice seafood dinner, and never call her again!"
"You know those ratings systems are flawed. They don't take into account houses that have more than two television sets."
"Can't say one word? Even the guy who can't think says something, and you guys just stand there?"
"But I think my son is just going through a phase. I have no idea where he would've gotten hold of German pornography."
"But you and I are mature adults who've both seen our share of pornographic materials - oh, you never have? Of course you haven't, how stupid of me, neither have I. I was just speaking in generalities.... I'll stop by the school later Sister Margaret."
"What do you say we go out on a date? Have some chicken, maybe some sex. You know, see what happens."
"It's called Sex Panther, by Odeon. It's illegal in nine countries. Yep, it's made of bits of real panther. So you know it's good."
"They've done studies, you know. Sixty percent of the time it works every time."
"Its smells like a used diaper filled with indian food!
What is that? Smells like a turd covered in burnt hair!
Smells like Bigfoot's dick!"
"I would like to extend to you an invitation to the pants party....
The party.. with the pants....
Party with pants..."
"The only way to bag a classy lady is give her two tickets to the guns show... (kisses 'guns').. and see if she likes the goods"
"But now I am too hurt.. and shocked.. and offended.. and... hurt!"
"Veronica: Mr Burgundy, you have a massive erection.
Ron: Yes... I do... I'm sorry... it's... the pleats. Essentially an optical illusion... the pattern on the pants it's not flattering in the... the crotchular region. I'm actually taking them back right now."
"This is a mistake, he's very cute... No he's not, he's not, he's hairy."
"San Diego - drink it in, it always goes down smooth. It's a fact, it's the greatest city in the history of mankind. Discovered by the Germans in 1904, they named it San Diago, which, of course, in German means 'a whale's vagina.'"
"Ron: I don't know what it means. I'll be honest, I don't think anyone knows what it means. Scholars maintain that the translation was lost hundreds of years ago.
Veronica: Doesn't it mean Saint Diego?
Ron: No."
"We have a saying in my country about people like him - 'The coyote of the desert always likes to eat the heart of the young, when the blood drips down to the children for breakfast, lunch and dinner, and only the ribs will be broken in two.'"
"Well, I have one great passion that lives deep within my loins like a flaming, golden hawk."
"Wait.. what if just for tonight we weren't co-workers - we were just co-people.
You be a woman. I'll be a man. That's all."
"Veronica and I are trying this new fad called jogging. I believe its 'jogging' or 'yogging', it might be a soft 'J', I'm not sure. But apparently you just run for an extended period of time."
"I know that one day Veronica and I are gonna get married on top of a mountain. And there's gonna be flutes playing, and trombones and flowers and garlands of fresh herbs. And we will dance til the sun rises, and then our children will form a family band. And we will tour the countryside and you won't be invited!"
"It seems our youngest, Chris, was on something called 'acid', and was firing a bow and arrow into a crowd. You know how kids are."
"This city needs its news, and you're gonna deprive them of that because I have breasts? Exquisite breasts?"
"I'm in a glass case of emotion!"
"Why are you being this way? Why can't you just be proud of me as a peer and as my gentleman lover?"
"Veronica: You have man boobs.
Ron: You've got a dirty whorish mouth. I'm gonna punch you in the ovary, that's what I'm gonna do.
Veronica: Jazz flautist for little fairy boys.
Ron: Okay, you know what - that's uncalled for! I can't work with this woman."
"Ron: There's only one thing a man can do when he's suffering from a spiritual and existential funk.
Champ: Go to the zoo? Flip off the monkeys?
Ron: No. Buy new suits.
All: YAAY!!!"
More to come once I get the urge to surge. No, I don't know what that meant.
Let's end this post on a high note. I wanna talk about love.
"Brick: I love... carpet. I love... desk.
Ron: Brick, are you just looking at things in the office and saying that you love them?
Brick: I love lamp.
Ron: Do you really love the lamp or are you just saying it because you saw it?
Brick: I love lamp. I love lamp."
You stay classy, Information Superhighway.
Thanks for stopping by.
Saturday, 19 July 2008
Video interview with Adrian Utley of Portishead at sonicstate.com
Part 1:
Amazingly, his daughter actually sits still for this entire interview. I wonder if she's developed an affinity for modular synths by now. Bonus points for a really gritty sounding version of "I'm a little teapot". :P
Part 2:
More gear - mixing desks, drums
Part 3:
Mikes galore! And the el cheapo guitar used on "The Rip".
Saturday, 31 May 2008
Monday, 26 May 2008
Java code to concatenate values from get__ methods of a class dynamically
exercise to learn a little about Java reflection methods.
This was based on code from HashCodeBuilder in Apache commons-lang,
which can generate hashcodes via reflection - ie,
HashCodeBuilder.reflectionHashCode(this);
/**
* Given an object of type clazz, go through the fields in that
class and concatenate the
* values of all the fields, excluding the ones listed in excludedFields.
* This will only work on bean-type getter methods that 1. do not
have parameters
* and 2. return a String.
* This code does not do any lookup on inherited methods.
* @param object instance where we are getting field values from.
* @param clazz the Class of the object.
* @param builder StringBuilder object to contain our concatenated values.
* @param excludeMethods fields that are not to be included in our builder.
* @throws InvocationTargetException when an error occurs while
calling a method in our object.
*/
public static void concatenateFieldValues(Object object, Class
clazz, StringBuilder builder,
String[]
excludeMethods) throws InvocationTargetException
{
List excludedMethodList = excludeMethods != null ?
Arrays.asList(excludeMethods) : Collections.EMPTY_LIST;
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods)
{
// only get values from public getter methods that are not
in exclusion list
if ((method.getName().indexOf("get") == 0)
&& !excludedMethodList.contains(method.getName())
&& (Modifier.isPublic(method.getModifiers()))
) {
try {
// this will only deal with bean-type get methods
without params
assert method.getParameterTypes().length == 0;
// TODO - shouldnt we explicitly check and throw
an exception here?
Object fieldValue = method.invoke(object);
if (fieldValue instanceof String) {
builder.append(StringUtils.remove(fieldValue.toString(), ' '));
}
} catch (InvocationTargetException e)
{
throw new InvocationTargetException(e, "Unable to
invoke the method: " + method.getName() +
" from
instance of: " + clazz.getName());
} catch (IllegalAccessException e) {
// this can't happen. Would get a Security exception instead
// throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected
IllegalAccessException");
}
}
}
}
Friday, 23 May 2008
Java generics - assigning a List<C> where type D implements interface D to a variable of List<D> - can't be done - AKA:Type Erasure ARRGH!
A work colleague was asking me something about assigning typed lists
and it wasn't working the way
it would work if you were simply dealing with single variables.
Class C implements interface D.
Then we have a list of interface D.
Another class E has a method findAll() which returns a list of type C.
But we can't assign E.findAll() to a list of type D.
List<Comparable> listOne;
listOne.add("String");
listOne.add(new Long(1000));
BUT
listTwo = new ArrayList<Long>();
listTwo.add(new Long(33));
listOne = listTwo;
Error: "Incompatible types, Required List<java.lang.Comparable> Found:
List<java.util.List>"
Hmm... maybe we can cast the list?
listOne = (List<Comparable>) listTwo;
Error: Inconvertible types; cannot cast
'java.util.List<java.lang.Long>' to
'java.util.List<java.lang.Comparable>'
But why?
Maven IDEA plugin generating incorrect references in .ipr file in multi-module project
I normally do most of my command-line work in the Cygwin environment, and
have not experienced this problem on my previous project, which was a
single-module project.
ERROR in parent project file:
- generated this when running mvn idea:idea under cygwin
- trying to open the project file results in error dialog box:
"Cannot load module file
'C:\work\Fads\C:\work\Fads\FeedProcessor\FeedProcessor.iml':
File C:\work\Fads\C:\work\Fads\FeedProcessor\FeedProcessor.iml does not exist.
Would you like to remove the module from the project?"
<modules>
<module fileurl="file://$PROJECT_DIR$/C:/work/FeedsProject/packaging/FeedsProject.iml"
filepath="$PROJECT_DIR$/C:/work/FeedsProject/packaging/FeedsProject.iml"
/>
<module fileurl="file://$PROJECT_DIR$/FadsParent.iml"
filepath="$PROJECT_DIR$/FadsParent.iml" />
<module fileurl="file://$PROJECT_DIR$/C:/work/FeedsProject/FeedProcessor/FeedProcessor.iml"
filepath="$PROJECT_DIR$/C:/work/FeedsProject/FeedProcessor/FeedProcessor.iml"
/>
<module fileurl="file://$PROJECT_DIR$/C:/work/FeedsProject/FileService/FileService.iml"
filepath="$PROJECT_DIR$/C:/work/FeedsProject/FileService/FileService.iml"
/>
</modules>
- the fix is to generate the IDEA project file under DOS - mvn idea:idea
- this file is correct.
<modules>
<module fileurl="file://$PROJECT_DIR$/packaging/FeedsProject.iml"
filepath="$PROJECT_DIR$/packaging/FeedsProject.iml" />
<module fileurl="file://$PROJECT_DIR$/FadsParent.iml"
filepath="$PROJECT_DIR$/FadsParent.iml" />
<module fileurl="file://$PROJECT_DIR$/FeedProcessor/FeedProcessor.iml"
filepath="$PROJECT_DIR$/FeedProcessor/FeedProcessor.iml" />
<module fileurl="file://$PROJECT_DIR$/FileService/FileService.iml"
filepath="$PROJECT_DIR$/FileService/FileService.iml" />
</modules>
Saturday, 3 May 2008
OutOfMemory error when using Findbugs plugin in Maven? Set the Maven heap size via MAVEN_OPTS
where it's using the Findbugs plugin:
[INFO] Generating "FindBugs Report" report.
[INFO] No effort provided, using default effort.
[INFO] Using FindBugs Version: 1.2.0
[INFO] No threshold provided, using default threshold.
[INFO] Debugging is Off
[INFO] No bug include filter.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Java heap space
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.OutOfMemoryError: Java heap space
at edu.umd.cs.findbugs.ba.vna.ValueNumberFrame.getUpdateableAvailableLoadMap(ValueNumberFrame.java:409)
at edu.umd.cs.findbugs.ba.vna.ValueNumberFrame.copyFrom(ValueNumberFrame.java:285)
at edu.umd.cs.findbugs.ba.FrameDataflowAnalysis.copy(FrameDataflowAnalysis.java:38)
at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.trans
After a bit of research, I set this variable to give enough memory to
Maven, and it fixed the problem. Obviously, change the Xmx value
depending on how much RAM you have to spare.
MAVEN_OPTS="-Xmx1024m -Xms128m -XX:MaxPermSize=512m"
Other posts have mentioned that it's actually setting a MaxPermSize
higher than the default value (32m) that makes the difference. So
let's test it by just setting the first two values:
MAVEN_OPTS="-Xmx1024m -Xms128m"
Actually, it works!
INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 11 seconds
Other people have recommended setting the plugin property
"maven.findbugs.jvmargs" but I have not tried this out yet. Now in my
pom.xml, I currently have:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
Which isn't actually the latest version anymore. Maybe the newest
version of the plugin - 1.2 has fixed it.. Let's change it to:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.2</version>
</plugin>
But this time, let's NOT have anything in MAVEN_OPTS. Let's see if the
newer version can do it with the default java settings. Now run mvn
site again.
(Long delay follows). Oh great, more jars to download. WTF? castor?
openejb? xstream? Hardly a build goes by where I don't get yet another
surprise download due to transitive dependencies. Am glad we have
Artifactory set up at work, so only one person has to suffer the
delays of downloading each new jar file.
No dice. OutOfMemoryError again. Let's set our heap to a smaller
figure, compared to before, see if that's enough.
MAVEN_OPTS="-Xmx256m -Xms128m"
Works!
I think this last one can be a safe starting value to use if you ever
run into the OutOfMemory error Findbugs from inside maven. I was
surprised to find out that the default heap is only 32m when JVM is in
client mode, and 64m when in server mode. See here:
http://www.unixville.com/~moazam/stories/2004/05/17/maxpermsizeAndHowItRelatesToTheOverallHeap.html
Sunday, 20 April 2008
The Element Song: various versions
in the city... (http://au.youtube.com/results?search_query=dj+shadow+the+hard+sell) then checked my email... noticed a link about Tom Lehrer, who's famous for the Element Song, a crazy romp through the periodic table, sung to the tune of Gilbert and Sullivan's, "I Am the Very Model of a Modern Major-General" from Pirates of Penzance (thanks to Bob Funchess for the song title)
end result: just spent 30 minutes going through youtube, checking out
various versions of The Element Song.
Damn you Google blog!
http://googleblog.blogspot.com/2008/04/heres-to-tom-lehrer-elemental-geek.html
(and he also did that song about "silent e" for Electric Company! OMG.)
my faves so far:
the original (audio only):
http://au.youtube.com/watch?v=WNfx0FO4hzs&NR=1
great version at a talent show:
http://au.youtube.com/watch?v=9cbgAELAX18&feature=related
sung by a 4-yr old (who kinda sounds like Martin Price from the Simpsons):
http://au.youtube.com/watch?v=QWkVO6Bp8VM&feature=related
showing the elements' location in the table:
http://au.youtube.com/watch?v=WNfx0FO4hzs&NR=1
this isn't a version.. but still interesting rapping with *some* of
those elements..
Saturday, 19 April 2008
OpenSocial for MMOGs?
Came across an great post on another gaming site, "Player vs. Everything: When will the players leave WoW?", discussing why people aren't going to be leaving WoW anytime soon.
Interesting how the social aspect - in this case networks of friends from all over the net - is such a big factor in the "stickiness" of these games, whereas before it was completely based on the gameplay. It makes it much harder for rivals to make a significant dent in the market. Not only does your game need to be much more compelling, but you need to factor in that networking aspect, which goes beyond coding wizardry or eye candy. You can't just fix pain points, or be slightly better. You have to make it compelling enough not just for one new player, but all that player's friends to play and stay with your game.
If you have a new player, how do you make it easy for them to move over as much of their current network to your game? Signup bonuses? Almost-free copies of the game, which you can't really play standalone? (I think WoW already have this?) In-game equivalents of pyramid schemes? Those horrible Facebook apps do it by spamming everyone you know - actually, it's not the app, it's you doing the spamming! But how the hell will that apply to a MMOG?
It's quite similar to the stickiness of the current "web 2.0" hotspots like MySpace, YouTube... once you've built up relationships and conversations in one area, it'll be very difficult to get out and start anew, since you've built up all this content and would be loath to just throw it all away. Social networks are the new vendor lock-in. (yes, someone else came up with that)
The only sites I can think of that make it a bit easy to migrate are the blogs, but mainly because the content is fairly generic (text, tags, comments!) and easily restructrured. I can't see this model ever being applied to games - "Why sure, we'll let you move on to another MMO, no probs!" OpenSocial for MMOGs, anyone? Of course, the question here becomes: is there anything at all that is portable across different games?
Saturday, 12 April 2008
How to run code when your Java program is being terminated? Use ShutdownHook!
At first, I thought that a try-finally would give me what I wanted. A little bit of testing proved me wrong. The try-finally structure can handle exceptions, and ensure that code enclosed in finally is called, but only in the case where the process is running normally, and not terminated externally. The statement inside a finally{} will not execute if the JVM is terminated.
The ShutdownHook is what I needed, which was added in JDK 1.3.1. The method to use is Runtime.addShutdownHook(). The shutdown hook is pretty much any code you put inside the Thread.run() that you pass to this method.
public class FinallyTest {
public static void main(String[] args) {
final int thisNumber = 9;
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
System.out.println("I am now calling my shutdown stuff. EVERYTIME!");
System.out.println("This number: " + thisNumber);
}
});
try {
System.out.println("FinallyTest.main");
boolean loopIt = true;
int i = 0;
System.out.println("Now entering infinite loop.");
while (loopIt) {
i++;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} finally {
System.out.println("Finally has been called!");
}
}
}
Running the program, and then killing it gives me (this is on OS X, on an iMac):
krangsquared$ java -cp . FinallyTest &
[1] 5735
krangsquared$ FinallyTest.main
Now entering infinite loop.
Okay, we now have a process Id. Let's kill it!
krangsquared$ kill 5735
krangsquared$ I am now calling my shutdown stuff. EVERYTIME!
This number: 9
[1]+ Exit 143 /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java -cp . FinallyTest
The only catch to this is that this will not work if you terminate the program using "kill -9". And I haven't checked this yet on Windows to see what happens if you kill it using TaskManager. (is there a "kill -9" equivalent on XP?)
Hope this helps someone out there! Or maybe someone who has a better idea or suggestion can make a comment. I need all the help I can get. :)
Btw, I've found a blog post with a nicer way of doing this - instead of dumping a whole lot of stuff in a Thread.run() as an anonymous inner class (insert. closures. proposal. here.), have another Runnable inner class to contain all the shutdown code, then pass that in to the constructor of a new Thread that you pass to addShutdownHook().
Sunday, 16 March 2008
Looking Through The Eyes of Love - chords
Thursday, 13 March 2008
Activating root account in OS X to enable sudo
trawling the net for information, so I'll put it here.
If installing ruby gems, you need to do it as root or to do 'sudo gem
install [gem name]'
But you can't sudo if there's no root account!
So....
1. Enable root
In OS X 10.5 - you do it using the Directory Utility application. Log
in on an Admin account, run Directory Utility, and in the Edit menu,
select 'Activate Root account' (or a menu item similarly named). You
then enter the root password and verify.
2. Add your normal account to sudoers file.
Run visudo - a command-line util to edit the sudoers file in
/etc/sudoers, which contains the users or group that are allowed to
su-su-sudio.. er, ahem.. run sudo. :P
Using visudo is better than editing sudoers file directly because it
prevents any changes being saved if there are any incorrect entries.
Incorrect entries are BAD news for sudoers, since it prevents you from
doing sudo, and you have to call sudo to edit it or run visudo!
(chicken or egg!)
Under the section "# User privilege specification" - add a similar
entry with your username, like:
[username] ALL=(ALL) ALL
In this case, the username is the unix user, not the long Mac user
name you see when you log in.
3. Log out of the Admin account, then try doing something with sudo, like
sudo gem install mechanize
to see the results of your handiwork.
Gurus, please send corrections if any of the above is not exactly correct!
Saturday, 8 March 2008
Maven settings.xml that uses Artifactory, and restricts snapshot repository use
projects but have to use other libraries and Maven plugins that are
still in the pre-release stage.
We are using Artifactory at work as a local repository proxy for Maven.
We also have a project that makes use of some snapshot libraries for
the CXF project, which is currently under incubation in Apache.
Previously, we were just using a <mirrors> but this resulted in Maven
getting its metadata settings both from the central repository and the
snapshot locations. We ended up getting snapshots of Maven plugins
that we never really wanted, as Maven would get plugin metadata from
both the repository types, and of course, the latest version would be
the snapshot ones.
To remedy this, we had to change settings.xml so that the only time
the Apache snapshot plugin repositories are used is in the projects
that require the CXF plugin and associated dependencies. The important
thing is to make sure the id element in the repository settings match
the repository setting id in the project pom.xml. The pom.xml settings
can still point to the live, non-proxied repository, but Maven will
first look at the id in that pom file and see if there is an entry
with the same id in the settings.xml
<settings>
<!-- uncomment this section and comment out the profiles section if
the Artifactory (local maven repository) is broken -->
<!--
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>company.proxy</host>
<port>8080</port>
</proxy>
</proxies>
-->
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<url>http://internal.company.proxy:7070/artifactory/repo1
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://internal.company.proxy:7070/artifactory/snapshots-only
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>everything-else</id>
<url>http://internal.company.proxy:7070/artifactory/releases
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!-- used by SomeWebService/pom.xml The id here
*must* match what's in the pom file -->
<repository>
<id>apache.org</id>
<url>http://internal.company.proxy:7070/artifactory/apache-m2-snapshots
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- used by SomeWebService/pom.xml The id here
*must* match what's in the pom file -->
<repository>
<id>apache.incubating.releases</id>
<url>http://internal.company.proxy:7070/artifactory/apache-m2-incubating
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://internal.company.proxy:7070/artifactory/repo1
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>http://internal.company.proxy:7070/artifactory/snapshots-only
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<!-- used by SomeWebService/pom.xml The id here
*must* match what's in the pom file -->
<pluginRepository>
<id>apache-plugin-incubating</id>
<url>http://internal.company.proxy:7070/artifactory/apache-m2-incubating
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
Wednesday, 5 March 2008
Maven reporting plugins - useful for generated reports in the Maven-generated project site
have more documentation on various aspects of each project. Adding
these settings to a Maven projects pom.xml would generate a lot of
useful information that would cover our needs.
<reporting>
<plugins>
<plugin>
<artifactId>maven-changes-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<!--
<plugin>
This plug-in provides functionality for accessing FindBugs
from Maven.
<artifactId>maven-findbugs-plugin</artifactId>
</plugin>
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<!--
The JXR plugin produces a cross-reference of the project's sources.
The generated reports make it easier for the user to
reference or find
specific lines of code. It is also handy when used with
the PMD plugin
for referencing errors found in the code.
for multi-module projects, see:
http://maven.apache.org/plugins/maven-jxr-plugin/examples/aggregate.html
-->
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
<plugin>
<!--
The PMD plugin allows you to automatically run the PMD
code analysis tool on your
project's source code and generate a site report with its
results. It also supports
the separate Copy/Paste Detector tool (or CPD) distributed
with PMD.
-->
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<linkXref>true</linkXref>
<targetJdk>1.5</targetJdk>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
<plugin>
<!--
This plugin is used to inform your users of the changes
that have occured
between different releases of your project. The plugin can
extract these changes,
either from a changes.xml file or from the JIRA issue
management system,
and present them as a report.
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
===================
Updated 6 March 2008: Commented out the Findbugs plugin entry because I can't get it to work yet. The settings above are actually for Maven1. To use the Maven2 plugin it should be like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
We are using Artifactory, but for some reason I get this Maven error:
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to build project for plugin 'org.codehaus.mojo:findbugs-maven-plugin': POM 'org.codehaus.mojo:findbugs-maven-plugin' not found in repository: Unable to download the artifact from any repository
org.codehaus.mojo:findbugs-maven-plugin:pom:1.1.1
from the specified remote repositories:
everything-else (http://192.168.1.1:7070/artifactory/releases),
snapshots (http://192.168.1.1:7070/artifactory/snapshots-only),
central (http://192.168.1.1:7070/artifactory/repo1)
However, when I got to repo1.maven.org (which is in my proxy configs), the Findbugs plugin is there at:
http://repo1.maven.org/maven2/org/codehaus/mojo/findbugs-maven-plugin/
So why is Maven (or Artifactory) unable to retrieve this plugin?
Again, what is going on here?
I guess I should test this first by removing Artifactory from the picture, removing the proxy settings from my settings.xml. If it fails, then it's a Maven issue. If it works, maybe it's Artifactory.
========================
Update:
Removed the Artifactory settings and Maven was able to download the plugin correctly. Maybe I should expire some caches and see if it is able to get the plugin?
Wednesday, 27 February 2008
Maven updates its plugin metadata then says it can't find the plugin - WTF?
Then I got an error:
mvn idea:idea
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'idea'.
[INFO] artifact org.apache.maven.plugins:maven-idea-plugin: checking
for updates from central
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-idea-plugin
Reason: Error getting POM for
'org.apache.maven.plugins:maven-idea-plugin' from the repository:
Failed to resolve artifact, possibly due to a repository list that is
not appropriately equipped for this artifact's metadata.
org.apache.maven.plugins:maven-idea-plugin:pom:2.2-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
Now I look in my Maven repository, in the maven-idea-plugin directory, in
\.m2\repository\org\apache\maven\plugins\maven-idea-plugin
and I find the maven-metadata-central.xml which has this:
<?xml version="1.0"?><metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<versioning>
<latest>2.2-SNAPSHOT</latest>
<release>2.1</release>
<versions>
<version>2.0-beta-1</version>
<version>2.0</version>
<version>2.1</version>
<version>2.0-beta-2-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</versions>
<lastUpdated>20070716221242</lastUpdated>
</versioning>
</metadata>
But when I look in the location:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-idea-plugin/
And get the maven-metadata.xml, it has:
<metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<versioning>
<latest>2.1</latest>
<release>2.1</release>
<versions>
<version>2.0-beta-1</version>
<version>2.0</version>
<version>2.1</version>
</versions>
<lastUpdated>20070604220104</lastUpdated>
</versioning>
</metadata>
The only possible reason I can think of for this happening is that
Maven is getting the metadata from somewhere else. We are using
Artifactory and one of the repositories we have set up is an entry
pointing to http://people.apache.org/repo/m2-incubating-repository.
The artifactory.config.xml contains this:
<remoteRepository>
<key>apache-m2-incubating</key>
<handleReleases>true</handleReleases>
<handleSnapshots>true</handleSnapshots>
<excludesPattern>org/artifactory/**,org/jfrog/**,au/com/company/**</excludesPattern>
<url>http://people.apache.org/repo/m2-incubating-repository
<proxyRef>work-proxy</proxyRef>
</remoteRepository>
Now in this repository, there is a directory for maven-idea plugin, at
http://people.apache.org/repo/m2-snapshot-repository/org/apache/maven/plugins/maven-idea-plugin/
and there is a file
http://people.apache.org/repo/m2-snapshot-repository/org/apache/maven/plugins/maven-idea-plugin/maven-metadata.xml
that contains:
−
<metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>2.0-beta-2-SNAPSHOT</version>
<versioning>
<latest>2.2-SNAPSHOT</latest>
<versions>
<version>2.0-beta-2-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</versions>
<lastUpdated>20070716221242</lastUpdated>
</versioning>
</metadata>
Now the strange thing is that this info is not exactly the same as
what's in my local repository. So it looks like the
maven-metadata-central.xml I have for maven-idea-plugin did *not* come
from this location. So where did it come from? I should probably add
to the exclusion list for the above repository so it doesn't try and
get maven plugins from there. But from the error message I got, it
looks like it only goes to the central repository at repo1.maven.org
for plugin updates. If that's the case, why does it seem to go
somewhere else for it's plugin updates?
What the hell is Maven actually doing?
Thursday, 21 February 2008
Maven woes # 2923928923829: Maven metadata not reflecting what's on maven repository
Alternate longer title: What the hell is wrong with Maven and why do
they push out these SNAPSHOT plugins with releases to other SNAPSHOT
jars that don't even exist? As a matter of principle, should you
really be forcing non-release, snapshot software upon your users?
Here's what I was getting:
Error: Reason: Error getting POM for
'org.apache.maven.plugins:maven-archetype-plugin'
Unable to run Maven archetype because it is trying to download a
plugin that it can't get from the central Maven repository.
Turns out it's because of an inconsistency between the settings it has
in the location
\[username]\.m2\repository\org\apache\maven\plugins\maven-archetype-plugin\maven-metadata-central.xml
and what is actually on
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/
C:\dev>mvn archetype:create -DgroupId=au.com.company.myapp -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin:
checking for updates from central
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-archetype-plugin
Reason: Error getting POM for
'org.apache.maven.plugins:maven-archetype-plugin' from the repository:
Failed to resolve
artifact, possibly due to a repository list that is not appropriately
equipped for this artifact's metadata.
org.apache.maven.plugins:maven-archetype-plugin:pom:2.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project org.apache.maven.plugins:maven-archetype-plugin
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Feb 20 17:35:46 EST 2008
[INFO] Final Memory: 1M/254M
[INFO] ------------------------------------------------------------------------
Solution:
1. Go into
\[user]\.m2\repository\org\apache\maven\plugins\maven-archetype-plugin\maven-metadata-central.xml
rename this file or delete it.
2. Get the file
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
Download it to .m2\repository\org\apache\maven\plugins\maven-archetype-plugin\
and save it as maven-metadata-central.xml
3. Rerun the above process
mvn archetype:create -DgroupId=au.com.mydomain.myapp -DartifactId=my-app
now maven metadata is pointing to files that actually exist on the repository.
But the big questions here are:
Why is there a discrepancy at all? What other repositories could the
maven-metadata-central.xml be talking about if not the main
http://repo1.maven.org? Where did the maven-metadata-central.xml come
from anyway?
As a matter of design, why do I end up receiving - without my asking
for it - bleeding edge snapshot plugins? Shouldn't the policy be to
only use release versions?
Okay, maybe this argument is not really valid in this instance because
we are talking about the archetype-plugin. From the looks of what's on
the repository, it went out as 1.0-alpha-3 then to 1.0-alpha-5, then
1.0-alpha-7 - and now it's at 2.0-alpha-1. Good god, is this thing
*ever* going to get to an actual release number, one that doesn't have
greek letters after the .0?
Update on 6 Oct 2011:
NOTE: As commenters below have pointed out, the mixup normally occurs when you are - probably unknowingly - getting artifacts from both release and snapshot repositories.
The thing to remember is to make a distinction between release and snapshot repositories. The fact that you are pointing to a public repository is not enough. A repository obviously has to be public so that other people can access it. The question is: what types of artifacts are the repository providing? They may actually have both types.
Friday, 15 February 2008
iPhoto alternative found! Photo Mechanic - retains your directory structure, doesn't have its ownf format for your photos, allows editing of EXIF metadata
of whether or not to use iPhoto is.. uh, pretty vexing. I've heard
iPhoto stores all of its photos in pretty much one database file, and
I've got about 50Gb of photos accumulated over the past 5 years, so I
want to be sure that 1) it won't slow down to a crawl and try to load
all my photos every time it runs; 2) will retain any EXIF information
I have in them and allow edits to them as well.
I found this blog entry about a program called PhotoMechanic that
seems to fit the bill and do a lot that I've gotten used to in Picasa
on the PC. It retains all the photos in their own directories,
according to how I've organised them, it allows editing of a *lot* of
EXIF metadata (which on the PC i perform using the excellent utility
Exifr), and it doesn't force you to add them to its database of
photos.
It doesn't allow photo editing, and is not as good at slideshows, but
I don't do much of the latter anyway. I hope I find a clean way of
integrating the photo editing into my photo workflow.
http://www.comatosed.ca/writing/writing/reviews/exif_iphoto_vs_photomechanic1.html
I'll download it and see if it's a better fit with the way I use my photos.
<2 minutes later>
Oh great. They don't sell it online.
"We do not have web sales setup yet. To place an order for the
products above, please contact Camera Bits, Inc. directly. We accept
Visa, Mastercard, and American Express credit cards for payment."
Haven't these people heard of Kagi? (http://www.kagi.com/index.php)
Shareware vendors have been using this for years!
Where is my Picasa for OS X? Pleeeease, Google-matrix-skynet, out with
it already! But put in a plug-in architecture so that people can
develop Flickr uploaders. I know you have your Picasa Web Albums but
it's not in the same league, not even the same country, not even the
same planet as Flickr.
Thursday, 14 February 2008
I've never been to me
balance is NEGATIVE, which kinda threw shit on my plans to have a
romantic Valentine's dinner with my wife at the local Vietnamese
place.
Now when I find myself in times of trouble, I turn to the classics. In
this case, the nearest one on hand was Charlene's "Never Been To Me".
I'd never listened to it closely before, but I worked out the part
where she's doing the narration, and I didn't realise it's actually a
bit of a cynical song.
"Hey, you know what paradise is? It's a lie, a fantasy we create about
people and places as we want them to be.
But you know what truth is? It's that little baby you're holding. It's
that man you fought with this morning, the same one you're going to
make love with tonight.
That's truth. That's love."
D'ya hear that people?
PARADISE IS A LIE! A FANTASY WE CREATE ABOUT PEOPLE AND PLACES AS WE
WANT THEM TO BE!!!
Now if that ain't fodder for your next up-and-coming emo band, I don't
know what is. Come on kids, work on those Charlene samples and get
'em into those anthemic choruses! I believe in you! Yizzgaarnoff,
maaaate!
That's the truth. That's love.
Wednesday, 13 February 2008
Configuring Subversion authentication using Windows Active Directory and Basic Auth from a file - problems encountered and workaround
Windows authentication. This keeps everyone's SVN logins updated
whenever their network logins change. All well and good, but then we
had to set up a build server using Cruisecontrol, and we are not able
to get a Windows network username for that. So we had to create a user
set up in a config file, and use Basic Auth for that.
WHAT DIDN'T WORK:
The first attempt at configuring Apache's httpd.conf, which was the
example show in other blogs and forum posts was something like:
# Location of our Subversion repository
<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath "D:\repository\svn"
AuthName "Subversion repositories"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative Off
SSPIDomain NEWS
SSPIOfferBasic On
# need to set this up so only select users/ group can have chk-in access.
# might want to restrict who can read as well.
# make sure this file is outside the SVNParentPath
AuthzSVNAccessFile "D:\repository\svnaccessfile.txt"
AuthType Basic
# make sure this file is outside the SVNParentPath
AuthUserFile "D:\repository\svn-httpasswd.txt"
AuthBasicAuthoritative Off
Require valid-user
</Location>
The problem was it never worked. The Basic Authentication never
worked. Only the Windows Authentication allowed me to get in.
WHAT WORKED:
So I ended up creating another Apache <Location> for use solely by
CruiseControl. And this has worked fine without any problems.
# Location of our Subversion repository
<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath "D:\repository\svn"
AuthType SSPI
AuthName "Subversion repositories - Active Directory authentication"
SSPIAuth On
SSPIAuthoritative On
SSPIDomain NEWS
SSPIOfferBasic On
# need to set this up so only select users/ group can have chk-in access.
# might want to restrict who can read as well.
# make sure this file is outside the SVNParentPath
AuthzSVNAccessFile "D:\repository\svnaccessfile.txt"
Require valid-user
</Location>
# we were unable to get the /svn working to use BOTH Active Directory
and Basic Auth from a file,
# so we have to set up another one.
# Location of our Subversion repository used only by CruiseControl
# all others should use the standard /svn URL defined above
<Location /cruisecontrol>
DAV svn
SVNListParentPath on
SVNParentPath "D:\repository\svn"
AuthName "Cruisecontrol Subversion repositories"
AuthType Basic
# make sure this file is outside the SVNParentPath
AuthUserFile "D:\repository\svn-httpasswd.txt"
Require user cruisecontrol
</Location>
Tuesday, 12 February 2008
GTD - toread
lists, not checking them enough, and haven't implemented enough task
breakdowns and specific, more physical "Next Actions". Actually, I
only have a big to-do list, not broken down into Projects (with more
than one action) and simple To Do list. And I don't have that Someday/
Maybe list.
I mentioned it to a friend and he sent me a link:
http://lifehacker.com/software/feature/practicing-simplified-gtd-335269.php
Then all these links got added, as the article links to these, etc etc.
http://lifehacker.com/software/geek-to-live/the-art-of-the-doable-to+do-list-270404.php
http://www.43folders.com/2007/06/19/buffington-igtd-01
http://www.43folders.com/2005/09/12/building-a-smarter-to-do-list-part-i
http://www.43folders.com/2005/09/13/building-a-smarter-to-do-list-part-ii
http://www.macworld.com/article/51703/2006/07/augworkingmac.html
http://lifehacker.com/software/getting-things-done/getting-into-the-weekly-review-habit-278118.php
http://lifehacker.com/software/top/geek-to-live--empty-your-inbox-with-the-trusted-trio-182318.php
http://jonathanstoolbar.blogspot.com/2007/02/12-to-do-find-to-do-list-manager.html
Then found software that looks perfect for GTD (and it's free):
Sunday, 3 February 2008
Email to Flickr about Microsoft bid for Yahoo + Flick reply
"I am terribly depressed about the news of the Microsoft bid for
Yahoo. Would there be any way on earth of ensuring that MS keep their
fists of ham away from Flickr, thus keeping it as the world's best
photo sharing site? Somehow, I think the answer is no. The very least
they would do is re-brand this sucka, which I can live with. But
almost certainly they won't leave it at that. That would be too
different from past behaviour.
I can't imagine that this mass acquisition of web properties won't tie
into their grand scheme of "fixing this platform independent internet
problem". Of course they'd use this to extend their hold on the
desktop. A Flickr uploader that requires Vista *and* Silverlight?
Start boning up on your .Net, guys... And maybe they'll get some of
those ad dollars going to Google... ads and IE-only pages on Flickr,
even for paid users... coming soon.
Good thing I don't keep stuff on Yahoo Mail, or I'd be in utter torment. "
--------------
(updated)
And last night got a reply from Flickr:
"Hello,
Thank you for contacting Flickr Customer Care.
On January 31, 2008, Yahoo! received an unsolicited proposal from Microsoft to acquire the Company. The Company's Board of Directors will evaluate this proposal carefully and promptly in the context of Yahoo!'s strategic plans and pursue the best course of action to maximize long-term value for shareholders.
We remain committed to you and to continue to provide you with industry-leading products and service.
Thank you again for contacting us. If you have any other questions, please feel free to reply to this email.
Regards,
Maria
Flickr Customer Care"
Saturday, 2 February 2008
Unix tips: count total number of lines in a directory tree of files
find monthly_reports/ -iname '*.csv' \
| xargs -n 1 wc -l \
| cut -d' ' -f1 \
| (SUM=0; while read NUM; do SUM=$(($SUM+$NUM)); done; echo $SUM)
PROBLEM: this has trouble if file names have spaces in them.
To find out how many lines in total are contained in a subdirectory of
files, there is the "Wc" command, which is a recursive version of "wc"
Wc -l monthly_reports/*/*.csv
-l specifies count the lines
