YottaByte

hacking life….

Enjoy a nice brew

Mar-7-2011

I’ve been using a mix of Fink and MacPorts on my Macs, but it has always felt clunky. If you feel the same you might want to try Homebrew, an absolutely slick replacement.

Homebrew uses Git as the underlying mechanism for the formulas, small Ruby scripts that contain the installation configuration for a package. This mean that you can write your own recipes or simple modify an existing one to suit your needs.

Getting Groovy with the Armory

Oct-21-2010

The Groovy Language is a great Agile language and the WoW Armory is a cool site for getting information from the World of Warcraft game. Combine the two and you can get some very useful information quickly.

@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.1' )

import groovyx.net.http.HTTPBuilder
import groovy.util.slurpersupport.GPathResult
import static groovyx.net.http.Method.GET
import static groovyx.net.http.ContentType.XML

def armoryUrl = "http://armory.wow-europe.com/" // EU Server
def realm = "Realm"  // Change to your realm
def name = "Char"    // Change to your character name
def userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"

def http = new HTTPBuilder()

http.request( armoryUrl, GET, XML ) { req ->
  uri.path = 'character-sheet.xml'
  uri.query = [ r: "${realm}", n: "${name}" ]
  headers.'User-Agent' = userAgent
  headers.Accept = 'application/xml'

  response.success = { resp, xml ->
    assert resp.statusLine.statusCode == 200

    // This will fetch the battleGroup attribute from
    // <characterInfo><character battleGroup="somevalue"></character></characterInfo>
    println "Battle Group: ${xml?.characterInfo.character.'@battleGroup'.text()}"

    // This will fetch all the xml nodes under baseStats
    xml?.characterInfo.characterTab.baseStats."**".findAll {
        print "${it.name()}: "
        it.attributes().each() { key, value -> print "${key} = ${value} " };
        println ""
    }
  }

  response.'404' = {
    println 'Not found'
  }

  // Used for all other failure codes not handled by a code-specific handler:
  failure = { resp ->
    println "Unexpected failure: ${resp.statusLine}"
  }
}

Why not try changing the code to fetch the spell.bonusDamage and display that.

Fixing Eclipse XML Validation

Oct-21-2010

Getting XML validation errors in Eclipse when using ActiveMQ namespaces?

Well here’s how to fix it.

In Eclipse, Windows->Preferences->XML->XML Catalogue

Add a new User Specified Entry

Location: http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd
Key Type: Namespace Name
Key: http://activemq.apache.org/schema/core

Add another entry

Location: http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd
Key Type: Schema Location
Key: http://activemq.apache.org/schema/core/activemq-core.xsd

Click OK and re-validate your XML and all should be fine.

Simple Calculator written in Flex

Jul-20-2009

At my job the project I am currently working on required a very simple calculator for a web-based exam. The requirements were a reasonable light-weight and multiple browser support, but after a lot of Googling I came to the conclusion that the best solution was to write one from scratch and Open Source it. So after a few hours work here is my first Adobe Flex application.

If you are interested in getting the source code you can get it from http://github.com/jasonfagan/flex_calculator/

To build the application you will need to download and install the Open Source Flex 3 SDK from http://www.adobe.com/products/flex/

Find the source archive for an installed package in apt

Jul-17-2009

Sometimes you want to know which archive was used to install a package in apt. Well it’s quite simple really, open a terminal and type

apt-cache policy package-name

Easter? No, but here’s some eggs

Jun-24-2009

Here is some of my favourite easter eggs (a little surprise left in an application by the programmers). Whilst these have worked for me, they may not work for you and I can not accept any liability for your disappointment, try these at your own risk.

Open Office Star Wars

  1. Go to the spreadsheet application in the OpenOffice
  2. Go to any cell
  3. Type in: =game()
  4. The response will be “say what?”
  5. Type in: =GAME(“StarWars”)
  6. Press the enter key — the opening screen shows up
  7. Pick your icon — a message will appear in German
  8. Pick your level (again, in German)
  9. Click ‘start’

Fishy Linux?

  1.  In Linux (Ubuntu 8.10 in this case), press Alt-F2
  2. In the box, type: free the fish

Ubuntu contains alien technology?

  1. In Linux (Ubuntu 8.10 in this case), press Alt-F2
  2. In the box, type: gegls from outer space

The cows ate my packages

  1.  On Debian-based Linux distros (works in Ubuntu too) ,
    go to Applications > Accessories >Terminal
  2. Type in: aptitude moo
  3. After the response, type: aptitude -v moo
  4. After the response, type: aptitude -v -v moo
    (At this point, after the computer program argues with you, you’re just adding one more -v each time.) Remember that five is your lucky number!

Firefox and killer robots

  1. In Firefox 3, go to the Location bar
  2. Type in: about:robots

Book of Mozilla

  1. In Firefox location box, type: about:mozilla

Life goes on……

Jun-23-2009

Well like 98% of all blogs this one is lacking in content. Why? well is my life really that interesting? nah… Uh oh I’m talking to myself on my own blog, this is way too sad… Oh and there are those dots….. argh!… must….stop…..

Ok mad moment over with.

So not much to talk about really. But here is some things that have caught my interest in the last few months.

Music

I popped back to blighty a few months back (yes it’s been that long) to see my family and basically sell my beloved Triumph motorcycle. While back I had time to chill with my mum, step-dad and their friends and listen to some cool music, which is how I came across Rodrigo y Gabriela, not my normal choice at the music store, but I really liked it.

Software

I’ve been dabbling with a few languages & software frameworks, in particular Groovy and Grails, I’m not too sure of the practical applications for the stuff I am developing at the moment as the hosting provider doesn’t allow hosting of Grails, so I’m sticking to Ruby on Rails for that. But any way, keep your eyes on this blog and hopefully I will reveal more about my experiences.

Gadets

I finally got seduced by the dark-side and bought a Google G1 Android developer phone it ended up being way cheaper to sign up for the developer program and buy the phone from the states, than sign up for an extortionist 2 year contract in the Netherlands.

First impressions of the phone is that it is slow starting up (so I don’t turn it off) and it eats the battery when you play with it too long. However that said, the GPS integration with Google maps is cool, but Google Sky map is fantastic.

My next step is to start writing some simple apps for the phone, at the moment I am stumped for an original idea, but I have an idea simmering in my mind.

Life

Now I live in the Netherlands I have to make the effort to learn the language, so far I have done ok, I can read a bit, have conversations, buy stuff and even get a discount. But now it is time to get serious and stop speaking NEngels, so I have decided to put aside more time to study. Wish me luck :)

Well that’s it for now, check back in another year and I might of posted something else (joke).

The First Rule of Fight Club is….. Kinetic Typography

Jul-15-2008

Just awesome…

What the Frack!!

Jun-23-2008

Meh!

You tired of all the “kiddy-speak” that you just don’t understand, are you completely Fracked-off with the whole jibberish??

http://en.wiktionary.org/wiki/ will clear things up…..may be…..

SuppressWarnings Options

Jun-22-2008
SuppressWarnings Options
Option Notes
“all” @SuppressWarnings( “all” ) means suppress all warnings
“allDeprecation” deprecation even inside deprecated code
“allJavadoc” invalid or missing javadoc
“assertIdentifier” occurrence of assert used as identifier
“boxing” autoboxing conversion
“charConcat” when a char array is used in a string concatenation without beingconverted explicitly to a string
“conditionAssign” possible accidental boolean assignment
“constructorName” method with constructor name
“dep-ann” missing @Deprecated annotation
“deprecation” usage of deprecated type or member outside deprecated code
“emptyBlock” undocumented empty block
“enumSwitch” incomplete enum switch
“incomplete-switch” incomplete switch
“fieldHiding” field hiding another variable
“finalBound” type parameter with final bound
“finally” finally block not completing normally
“hiding” shorthand for fieldHiding, localHiding, typeHiding and maskedCatchBlock
“indirectStatic” indirect reference to static member
“intfAnnotation” annotation type used as super interface
“intfNonInherited” interface non-inherited method compatibility
“javadoc” invalid javadoc
“localHiding” local variable hiding another variable
“maskedCatchBlocks” hidden catch block
“nls” non-nls string literals
“noEffectAssign” for assignment with no effect
“null” missing or redundant null check
“over-ann” missing @Override annotation
“pkgDefaultMethod” attempt to override package-default method
“serial” missing serialVersionUID
“semicolon” unnecessary semicolon or empty statement
“specialParamHiding” constructor or setter parameter hiding another field
“static-access” shorthand for indirectStatic and staticReceiver
“staticReceiver” if a non static receiver is used to get a static field or call a staticmethod
“suppress” enable @SuppressWarnings
“syntheticAccess” when performing synthetic access for innerclass
“synthetic-access” when performing synthetic access for innerclass
“tasks” enable support for tasks tags in source code
“typeHiding” type parameter hiding another type
“unchecked” unchecked type operation
“unnecessaryElse” unnecessary else clause
“unqualified-field-access” unqualified reference to field
“unqualifiedField” unqualified reference to field
“unused” shorthand for unusedArgument, unusedImport, unusedLocal, unusedPrivateand unusedThrown
“unusedArgument” unused method argument
“unusedImport” unused import reference
“unusedLocal” unused local variable
“unusedPrivate” unused private member declaration
“unusedThrown” unused declared thrown exception
“uselessTypeCheck” unnecessary cast/instanceof operation
“varargsCast” varargs argument need explicit cast
“warningToken” unhandled warning token in @SuppressWarnings