atc » Programming http://blog.alexcollins.org Musings of technology, sport, life et al Thu, 10 Jun 2010 10:24:24 +0000 en hourly 1 http://wordpress.org/?v=3.0.5 Weblogic Errors http://blog.alexcollins.org/2010/03/22/weblogic-errors/ http://blog.alexcollins.org/2010/03/22/weblogic-errors/#comments Mon, 22 Mar 2010 17:27:35 +0000 atc http://blog.beplacid.net/?p=141 I’ve been plowing through Maven2 & Weblogic at work recently, in an attempt to get an EJB/MDB & EAR deployed for testing out JMS. I would often hit the following errors when deploying an App in Weblogic 9.2:

  • Unable to access the selected application.
  • Exception in AppMerge flows’ progression

Baffled, I almost gave up – the errors mean nothing.

Thankfully trial and error (and plenty of web searching) I have discovered that the errors are caused by invalid deployment descriptors or invalid WAR/EARs (an empty WAR or EAR will cause these errors immediately). So don’t fret, it’s not the end of the world!

First check your web.xml, application.xml and then ensure the contents of the WAR/EAR are as expected – APP-INF, META-INF only for the latter!

Hope that helps someone, it annoyed me for a while!

]]>
http://blog.alexcollins.org/2010/03/22/weblogic-errors/feed/ 0
Ant TODO Update http://blog.alexcollins.org/2010/01/02/ant-todo-update/ http://blog.alexcollins.org/2010/01/02/ant-todo-update/#comments Sat, 02 Jan 2010 21:34:38 +0000 atc http://blog.beplacid.net/?p=111 Quick update regarding Ant TODO: there’s now a JAR available for download, so you can get it running even quicker!

]]>
http://blog.alexcollins.org/2010/01/02/ant-todo-update/feed/ 5
Ant Task for TODOs http://blog.alexcollins.org/2009/12/31/apache-ant-task-todo/ http://blog.alexcollins.org/2009/12/31/apache-ant-task-todo/#comments Thu, 31 Dec 2009 15:58:35 +0000 atc http://blog.beplacid.net/?p=108 I often felt the need to scratch an itch when it comes to source code and a little fragment called //TODO. It’s scattered everywhere; I’m sure you’ve seen it. Yet no matter what codebase you’re looking at, there’s never any real exposure to them.

I therefore decided to implement an Ant Task for parsing TODOs in source code. You can read more about it over on the Google Code project. Please feel free to review code, suggest features or try it out and report a bug.

Happy new year to all; many happy returns.

See you in 2010!

]]>
http://blog.alexcollins.org/2009/12/31/apache-ant-task-todo/feed/ 0
Sky Songs and Linux http://blog.alexcollins.org/2009/12/15/sky-songs-and-linux/ http://blog.alexcollins.org/2009/12/15/sky-songs-and-linux/#comments Tue, 15 Dec 2009 22:55:02 +0000 atc http://blog.beplacid.net/?p=104 If you want to use the Sky Songs download client in Linux (say Ubuntu or Debian), just paste the following into a file called skysongs in $HOME/bin and then chmod a+x it:
cd $SKY_SONGS_DIR; /usr/bin/java -cp . -jar downloader.jar $*

Note, $SKY_SONGS_DIR should be changed to your installation directory. If you used wine to install Sky Songs, have a look under /home/YOURUSERNAME/.wine/drive_c/windows/profiles/YOURUSERNAME/Local Settings/Application Data/Sky  Songs/.

Sky Songs works by giving you “SKS” files that describe to its client (“Sky Songs MP3 Downloader“) what and how to download; i.e. your songs. Once you’ve downloaded one (say Renegades.sks; the “Renegades” album by Rage Against the Machine), just execute the skysongs script as follows:
alex@prometheus:~/Music$ skysongs Renegades.sks

Thankfully the Sky Songs download client is written in Java so it’s not only cross-platform but its structure is obvious.

Please note that these instructions are absolutely not intended for circumventing Sky’s download procedure, nor are they to be used to break the Terms of Service you’re most likely bound to by law. This information is purely for educational purposes and to assist those who are new to Linux get to grips with their everyday software in a new environment.

]]>
http://blog.alexcollins.org/2009/12/15/sky-songs-and-linux/feed/ 0
Google Wave Extensions Python API – Annotation Documentation http://blog.alexcollins.org/2009/10/19/google-wave-extensions-python-api-annotation-documentation/ http://blog.alexcollins.org/2009/10/19/google-wave-extensions-python-api-annotation-documentation/#comments Mon, 19 Oct 2009 06:57:53 +0000 atc http://blog.beplacid.net/?p=93 Quick post documenting the much-sought-after structure of the Python API’s Annotation name/value pairing. If you want to annotate a blip’s content, you’ll need to utilise the values below:

  • conv/title
  • lang = en
  • style/fontWeight = bold
  • style/fontStyle = italic
  • style/textDecoration = underline
  • style/textDecoration = line-through
  • style/fontSize = 2em
  • style/color =r gb(229, 51, 51)
  • style/backgroundColor = rgb(51, 127, 229)
  • link/manual = http://example.com/

A Python example of using the above:


msg = "This is a message for you"
doc = wavelet.GetDocument()
doc.SetText(msg)
doc.SetAnnotation(Range(msg[-4:], len(msg) - 1), "style/fontStyle", "italic")

The above should italicise the word “you” in the variable “msg”.

According to Google employee ‘Pamela’, this isn’t set in stone “as we aren’t confident in their stability”. Thanks to Dave of the same Google Group thread for documenting and posting the styling annotation name and value pairs.

Hope that helps someone ;)

]]>
http://blog.alexcollins.org/2009/10/19/google-wave-extensions-python-api-annotation-documentation/feed/ 1
Google Wave Python API and Annotations http://blog.alexcollins.org/2009/10/19/google-wave-python-api-and-annotations/ http://blog.alexcollins.org/2009/10/19/google-wave-python-api-and-annotations/#comments Mon, 19 Oct 2009 01:08:53 +0000 atc http://blog.beplacid.net/?p=90 I spent a considerable amount of time this weekend hacking away at my Google Wave robot, Wave Toolkit. It’s a lot of fun and I’ve managed to write something that allows for quick implementation of ‘commands’ from initial idea to ‘live’.

One of the frustrating things about developing Google Wave extensions is the poor documentation. It starts out great: lovely overview documentation and tutorial, with plenty of insight and step-by-step instructions; and then nothing. It stops there. Apart from reading the API documentation which can be cumbersome, you’re left alone in the dark, weeping like a sad puppy after meeting its new owners.

An example of this is using Annotations within Google Wave; formatting text for bold or italics,  providing nicely worded hyperlinks or embedding images is governed by inserting annotations that ‘explain’ how the text should look. If you try to find out how to use these objects within the Python API you’ll see it’s nearly impossible. I got my answer only from guessing and scouring the Google Group and reading and example in Java, then posting when that didn’t work and finally getting some helpful advice. Please Google, document this protocol more!

So, to save an further frustration, here’s how to use Annotations in the Google Wave python API for robots:
doc = wavelet.CreateBlip().GetDocument()
doc.SetText("THIS IS ANNOTATED TEXT")
doc.SetAnnotation(Range(2, 12), "link/manual", "http://www.google.com")

I hope to hell that helps someone and saves the pain I underwent to work it out! Buggered if I know how to bold text though…Happy hacking!

]]>
http://blog.alexcollins.org/2009/10/19/google-wave-python-api-and-annotations/feed/ 2
Google Wave Extensions – Wave Toolkit http://blog.alexcollins.org/2009/10/17/wave-toolkit-google-wave-extensions/ http://blog.alexcollins.org/2009/10/17/wave-toolkit-google-wave-extensions/#comments Sat, 17 Oct 2009 22:38:36 +0000 atc http://blog.beplacid.net/?p=82 Update: You might find my latest posts on Google Wave helpful.

So I managed to join the select elite bandwagon that is the Google Wave preview, which entitled me to early access to Google’s new masterpiece and 8 invites to bribe friends with (although I only have a few, so the whole eight might not stretch too far…). I have to admit, I’m not sure what the fuss is about. It’s clever, really clever; but there’s not much to it yet. It is, for all intents and purposes, a well-marketed collaboration tool, or put simply: a clever chatroom. Time will tell though. Perhaps its usefulness is yet to be seen.

Being a devout geek, and a sucker for anything Google, I was led to explore the programming possibilities behind Wave. Rather brilliantly Google have created an API that will allow you to do one of two things: create a ‘Robot’ – an automated participant programmed by you – or embed your own ‘gadget’ in a wave (think a Google map, but your content). The API is rich, if its documentation can be a bit light in some respects (where the hell are the CreateBlip() and such methods documented?! All you get in the API docs are ‘Get*’ methods…pointless!).

Introducing Wave Toolkit

Having programmed plenty of bots for IRC and Eternal Lands over the years I had the experience and ideas behind creating an automated character that can be used to aid users, or simply provide a bit of light entertainment. So after plenty of reading and hacking, I managed to come up with Wave Toolkit; a simple Python robot for wave that provides features that are either lacking or a little tool that might aid your chatroom…err I mean collaborative-blue-sky-thinking…yeah.

To get a bot running you do need a Google App Engine account, which allowed me to explore this little world offered by Google. It’s cleverly done and nicely polished. Still think it’s just cleverly managed free-hosting though ;)

The capabilities of robots within the Google Wave extension API are pretty much exactly what a human participant can do: edit, post, delete and edit ‘blips‘, create waves, see who’s participating and apparently manipulate playback. It’s very fun writing something that can do all this too; that wonderful satisfying feeling of achievement when you spam “hello world” to a wave…

Wave Toolkit‘s in constant development so it might be a little ropey, but please feel free to add wave-toolkit@appspot.com as a contact and invite it to a wave, and feel free to suggest new things, report bugs or even tell me you love it. ;)

So back to coding more lovely Python, and perhaps writing something useful for all the wavers out there. Right? ;)

]]>
http://blog.alexcollins.org/2009/10/17/wave-toolkit-google-wave-extensions/feed/ 7
Learning Scala – first impressions http://blog.alexcollins.org/2009/09/03/learning-scala-first-impressions/ http://blog.alexcollins.org/2009/09/03/learning-scala-first-impressions/#comments Thu, 03 Sep 2009 18:45:08 +0000 atc http://blog.beplacid.net/?p=74 So every year I learn a new language. It’s fun, insightful and leaves me feelin’ a fresh for new challenges in my new found religion.

This time round I’ve been learning Common LISP and now Scala. Being a Java programmer professionally it makes sense to try the latter. I love the idea of it being its own language – for scripting as well as fully-fledged development – that can run inside the JVM (or if you’re evil, the .NET CLR).

First impressions are that it’s exciting to learn. I love its simplicity, and its productivity. One thing I do hate: the syntax of array indexes. I can’t for the life of me think why it’s a good idea. I like the [] syntax because it makes it explicit as to what you’re working with. Doing array(1) looks like a method call, not great. Sure I’ll find out soon enough as to why it’s done that way.

I wrote the following today whilst waiting for my Grilled Mackerel to finish soaking :)

#!/bin/sh
exec scala $0 $@
!#
args.foreach(arg => for (c <- arg) println(c))

]]>
http://blog.alexcollins.org/2009/09/03/learning-scala-first-impressions/feed/ 2
Configure Log4j To Disable Specific Package (Java) http://blog.alexcollins.org/2008/11/30/configure-log4j-to-disable-specific-package-java/ http://blog.alexcollins.org/2008/11/30/configure-log4j-to-disable-specific-package-java/#comments Sun, 30 Nov 2008 21:49:21 +0000 atc http://blog.beplacid.net/2008/11/30/configure-log4j-to-disable-specific-package-java/ I came across the need to disable logging (debug) for a specific package in Apache Log4j today whilst coding. It’s simple. All you need to do is precede the package name, e.g. net.beplacid, with log4j.logger and follow that with “=LEVEL”, where ‘level’ is one of TRACE, DEBUG, INFO, WARN, ERROR and FATAL – the standard Log4j logging levels. To demonstrate:

log4j.logger.net.beplacid=DEBUG

Would set the logging level to DEBUG for all registered loggers in classes net.beplacid. Similarly:

log4j.logger.net.beplacid=FATAL

Would disable all but FATAL logging calls.

Hope that helps someone, I couldn’t find an ‘easy fix’ page when searching…

]]>
http://blog.alexcollins.org/2008/11/30/configure-log4j-to-disable-specific-package-java/feed/ 3
jQuery.com – Those Mouse-over Tooltips are BAD http://blog.alexcollins.org/2008/09/06/jquerycom-those-mouse-over-tooltips-are-bad/ http://blog.alexcollins.org/2008/09/06/jquerycom-those-mouse-over-tooltips-are-bad/#comments Sat, 06 Sep 2008 22:33:36 +0000 atc http://blog.beplacid.net/2008/09/06/jquerycom-those-mouse-over-tooltips-are-bad/ jQuery is a good thing. It allows you to minimise the amount of Javascript you write, while maintaining elegance and ease-of-use. jQuery.com has recently relaunched with a brand-new design. Feedback from around the web was initially quite negative due to a bizarre decision by someone who thought it’d be great to apply a ‘rockstar’ ethos to the whole redesign. The new landing page initially had a horribly misplaced drawing of a rockstaresque character splattered across the majority of the screen. It was nothing short of embarassing really. It screamed of teenage identity crisis.

Kudos to jquery.com though, who listened to their critics and removed the image. Right now, the site’s looking cool but still a little out of place. This is a Javascript library, not a corporate website. Anyhow, I digress.

Another element of the homepage that thoroughly annoys me is the tooltips on the three links titled “Lightweight footprint”, “CSS 3 compliant” and “Cross-browser”. To me, Web-2.0 (I’m sorry for using that phrase) style UI elements are largely about usability and common sense. jQuery seems to be an embodiment of that, and allows developers to enhance their sites greatly with a small amount of effort.

Shocked and awed I was then, when I moved my mouse around the page while reading only to find these terribly intrusive ‘tooltips’ that show when you hover over the aforementioned links. Right out of how-not-to-do-widgets-school it seems. Those elements on the page go against the original intentions behind underlining text (denoting a hypertext link). Not only are the tooltips pointless, but as widgets they’re very annoying to use. Hovering over them can sometimes show another (unrelated), as well as them hiding text around them – forcing the user to have to move their mouse again, only to find that they’ve set off yet another tooltip. They’re too large, unnecessary and bad-practice.

Whilst I can see the usefulness of such a plugin, I think it’s a perfect example of how not to do it. I can’t sleep at night because it annoys me so much.

Seriously!

]]>
http://blog.alexcollins.org/2008/09/06/jquerycom-those-mouse-over-tooltips-are-bad/feed/ 6