Dan’s technical ramblings

99 Bottles of Beer in Totallylazy

January 13th, 2012 Posted in Uncategorized | No Comments »
import static com.googlecode.totallylazy.Runnables.printLine;
import static com.googlecode.totallylazy.lambda.Lambdas.n;
import static com.googlecode.totallylazy.lambda.Lambdas.λ;
import static com.googlecode.totallylazy.numbers.Numbers.decrement;
import static com.googlecode.totallylazy.numbers.Numbers.range;

public class BottlesOfBeer {
    // Run with -javaagent:enumerable-java-0.4.0.jar -cp:totallylazy-598.jar:enumerable-java-0.4.0.jar
    public static void main(String[] args) {
        range(99, 0).map(λ(n, verse(n))).each(printLine("%s of beer on the wall.\n"));
    }

    private static String verse(Number number) {
        if (number.equals(0))
            return "No more bottles of beer on the wall, no more bottles of beer.\n" +
                   "Go to the store and buy some more, 99 bottles";
        return String.format("%s of beer on the wall, %1$s of beer.\n" +
            "Take one down and pass it around, %s", bottles(number), bottles(decrement(number)));
    }

    private static String bottles(Number number) {
        if (number.equals(0)) return "no more bottles";
        if (number.equals(1)) return "1 bottle";
        return number + " bottles";
    }
}

Slow TrackPoint on Dell Precision M6500 under Ubuntu 10.10

March 3rd, 2011 Posted in Uncategorized | 2 Comments »

If you have a Dell Precision M6500 with a Synaptic TouchPad + TrackPoint) (rather than an ALPS version) and you are running Ubuntu 10.10 you may find the TrackPoint / TrackStick / Nipple is being detected as a standard PS/2 Generic Mouse and this is causing the movement to be very slow.

You can check this by typing:

xinput list

If you see something like this:


Virtual core pointer id=2 [master pointer (3)]
↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
↳ SynPS/2 Synaptics TouchPad id=11 [slave pointer (2)]
↳ PS/2 Generic Mouse id=12 [slave pointer (2)]

As you can see the TrackPoint is not listed and as such you wont see it in any of the configuration screens.

As I haven’t worked out how to get it to detect it as an actual TrackPoint the best solution I have is to change the acceleration mode to more closely represent what you would expect:

xinput set-prop "PS/2 Generic Mouse" "Device Accel Profile" 6

I then just add this to the startup applications for my profile.

Off topic – a very addictive little game for Windows, Mac and Linux…

June 29th, 2010 Posted in Uncategorized | No Comments »

http://www.hemispheregames.com/osmos/

Very chilled out…

Crazy Talk – Holistic Web Testing – Some forces…

June 29th, 2010 Posted in crazy talk | No Comments »

So given the above, the forces I am trying to balance are

  • Make it easy for people to do the right thing, hard to do the wrong thing.
  • Make it valuable (Finds more bugs than false alarms)
  • Make it resilient (Allows me to refactor like the true crazy person I am)
  • Make it fast (Magnify it’s value rather deminishing it)
  • Make it good enough (Give me enough confidence to do more crazy stuff but don’t become dogmatic)
  • Allow people to do what they are good at

Next I’ll talk about how the default setup I use to do, in-memory, out of container testing.

Crazy Talk – Holistic Web Testing – Whys and Values…

June 22nd, 2010 Posted in Uncategorized | No Comments »

Now for some web specific whys/values I do the in-memory acceptance testing…

  • Semantic Html is my golden hammer
  • Progressive enhancement is my swiss army knife
  • I love JavaScript but try to never write any but if i must I make sure it’s generic. I try very hard to make sure no else writes any either and if they do I just refactor it till it deletes itself.
  • I love AHAH and barely tolerate AJAX / JSON
  • REST is my natural state not something I read about

All of these forces / values / beliefs drive me to solve the problem of web testing in a very different approach from most people. It is about an alternative holistic approach to web architecture, testing and productivity.

So now I have expressed some of the forces / the whys, I will try cover the hows and whats.

Crazy Talk – Holistic Web Testing – Some values…

June 1st, 2010 Posted in crazy talk, Uncategorized | No Comments »

(Previously on TWSDEV)

As the “crazy” guy behind the in-memory / out-of-container acceptance testing on a number of java/.net projects, I think it’s important I explain to people the “Why” and the forces / constraints I am trying to balance. But first I want to quickly lay down my beliefs and values:

  • I believe in testing as much as possible (UI included)
  • I believe tests must add more value than they cost (Measure it!)
  • I value tests that are fast and are resilient to change more than tests that take a long time to run and are brittle.
  • When refactoring a feature I value acceptances tests and integration test over unit tests.
  • When designing/exploring a new interface / object interaction I value unit tests over acceptance tests to help guide me.
  • I believe that QA’s are so much better at finding bugs than DEVs but worse at writing code / abstractions

A fan with no blades?

October 31st, 2009 Posted in Uncategorized | No Comments »

Wow Dyson have done it again: http://www.dyson.co.uk/technology/airmultiplier.asp

Interestingly they talk about the fact they had to do “Hundreds of iterative tests” to get the design right:

http://www.dyson.co.uk/insidedyson/default.asp#Air_Mult_Tech_Dev

The Crazy Talk Series – An introduction to an alternative web architecture and construction method

October 25th, 2009 Posted in crazy talk, web | 3 Comments »

If you have met me or worked with me in the last 15 years or so, you will know that I am pretty mad about the web as a platform, HTTP as a protocol and HTML as a state engine. Add to this the last 6 years or so practising agile techniques while building highly scalable websites and you tend to find that I have fairly unusual views in the field about how to build and architect web applications.

A lot of people say to me, Dan, you must write about X as the industry seems to be doing Y and while I find it very easy to talk in a face-to-face conversation or even a mailing list, writing an article or post has always been a challenge due to the one way nature of the conversation. Anyway after some gentle nudging by Sarah Taraporewalla, Christian Blunden and Martin Fowler I have decided to jump in head first and try and create a series of articles that will hopefully open a few peoples eye’s to some alternatives.

So enough with the why and onto the what I’m planning to cover in the series:

  • Caching on the wire not in the app
  • Addressable components
  • Personalisation, cachability and composition
  • Moving state off the web server
  • Web server decoupling, in-memory testing and lightning fast builds
  • Some alternative libraries
  • Common HTTP patterns

Google Chromium Team rocks!

September 5th, 2009 Posted in Uncategorized | No Comments »

So I noticed an issue with Google Chromium and it not updating the cached entry with new headers on a HTTP 304 response. So I logged the issue last weekend and bang! 6 days later the issue is resolved and I have a new version of the browser on my desktop.

Not only was the process super fast but I watched the fix being discussed then applied. I looked at the code change and the unit tests being updated all as it happened. Needless to same I am very impressed.

Interestingly I noticed the same issue with Opera and logged an issue with the exact same details on the same day, unfortunately Opera’s bug tracking system is private and so I have no idea if the issue is even being looked at. When they do eventually fix the issue I’ll still have to wait for sometime as they don’t have a public build server for me to download and try the fix before an official release.

Using a fullscreen editor to update my blog

August 31st, 2009 Posted in Uncategorized | No Comments »

So after rediscovering the distraction free editors to write reports, it seemed mad not to use the same environment to update my blog. I really like the fact that the editor only supports plain text and didn’t want to reduce the readability of the plain text by having lots of unneeded markup all over the place.

What I needed was a simple tool to convert my semi structured text into html and then I could just upload that to my blog. Ideally the tool would be a command line tool so I could easily automate the two steps.

I looked at a few different tools but in the end chose to use stx2any as it seemed to be a fairly close fit to the type of plain text I normally use, and also produced the cleanest html.

Then I started to look at tools to upload html into my WordPress blog, I was expecting there to be quite a few but can honestly say I didn’t even find one. I find this a bit wierd as blogs where originally just html and before that text (remember finger). So I started to look at Python scripts that interacted with the MetaWeblogAPI but as my Python is fairly limited I thought I could probably do it quicker in Scala (as thats what I’ve been mainly working in lately).

And so an hour or two later html2blog was born. And here is how I tied it all together:

stx2any --link-abbrevs --make-title off -T html $1 |
 tidy -asxhtml -qc -w 0 | java -jar html2blog.jar

Currently html2blog is very limited in that it always creates a new draft, so the next step will be to make it update an existing entry. I’d also like to get images working at some point.