Friday, 25 July 2014

Linkstation and Windows 8

Turns out that Windows 8 refuses to recognise old NAS drives due to the authentication used.  On top of that the home edition of Windows 8 also doesn't ship with the GUI tools to manage this, so the settings need to be changed via the registry.

Monday, 20 February 2012

Scala + Project Euler

Someone at work posted a message to our scala mailgroup asking about the solution to the first problem on Project Euler, which for the uninitiated is a set of increasingly complicated problems designed to provide the reader with some interesting challenges to learn a new language.

The specific question asked was about why a collection based implementation would be slower in scala than java, but raised a couple of interesting points for me. First of all I didn't actually look at the problem, but went straight to the code, and unsurprisingly neither implementations were particularly clear. Another colleague then posted an alternative implementation, and then I went to read the problem description because the solution seemed so simple! So, know the problem you are trying to solve - that's lesson 1.

Part of the reason the original solution was not immediately clear was the use of a getMultiples method, which was using recusion. Nothing wrong with that, as refactoring promotes lots of small methods, but in writing java in scala the author had produced something unclear.

Contrast:
def getMultiples(base: Int, bound: Int, ms: List[Int]) = {
bound match {
case 0 => ms
case _ => getMultiples(base, bound - 1, (base * bound) ++ ms)
}
}
with
def getMultiples(base: Int, bound: Int) =
base until bound by base
I think this is a great illustration of how a higher level language can make a solution much clearer, or really unclear.

And then a better solution:
Stream.from(3)
.filter(i => i % 3 == 0 || i % 5 == 0)
.takeWhile(_ < 1000)
.foldLeft(0)(_ + _)

Thursday, 16 September 2010

TDD talk by John Smart

I went to a free talk given by John Smart last night hosted by Skills Matter which had a couple of interesting points, firstly that when practicing TDD you should stop writing unit tests called AccountTest with methods such as testGetBalanceOpeningBalance and name your test classes and methods to better represent the requirements they are testing, such as openingBalanceIsZero in a NewAccountProperties test class. I asked him how he would recommend convincing co-developers that the assertion they don't have time to write tests is a fallacy, and he suggested pair programming for a day to show developers how TDD works. I think this is a good suggestion, however in my experience people who don't have time to test, don't have time to pair either.

He also mentioned a couple of interested projects, in particular
  • Infinitest which is a plugin for both Eclipse and IntelliJ which locally runs relevant unit tests as soon as you save a file, cutting down the feedback time between code change and test failure usually experienced with a CI server.
  • easyb which is a behaviour driven development library which allows business requirements to be codified, initially as human readable text, and then fleshed out by developers/testers in code and assertions.
I've installed the Infinitest Eclipse plugin and it seems pretty seamless, I'm looking forward to trying both out in a big project.

Saturday, 31 January 2009

Further joy with Buffalo Linkstation

After running this for a couple of years I decided that I wanted to get rsync running to take incremental backups of my Windows desktop. The follow is what I had to do:
  • Install the latest version of OpenLink firmware to stop the NAS rebooting every 5min (/usr/local/sbin/kernel26.sh)
  • Install avr_evtd
  • Setup SSH using dropbear
  • Upgrade procps to 3.2.7 to fix issues with Unknown HZ value errors
  • Install vim 7.2
  • Change /etc/localtime to point to /usr/share/zoneinfo/GMT
As previously nas-central.org is an excellent resource for this.
I can now connect via SSH as my own user, and via Telnet as root if required

Sunday, 11 February 2007

Val D'Isere

I just returned from a snowboarding holiday in France, and after not being on a board for almost three years I think I made some real progress while I was away. Dispite throwing myself down some blue runs on the first couple of days, after we had a nice dump of snow on Thursday I spent a very cold Thursday and a beautiful Friday practicing my technique on the green "Madelaine" run at the top of the Solaise peak and some of the greens and blues on Olympique finishing up with accidentally taking the tail of a red run down into La Daille before drinking far too many "seriouse" Leffe on Friday night.

We also did a trip over the mountains and down into Tignes on Monday although I didn't make it down to the actual village, rather staying slightly higher up at the bottom of the main lift back to Val. We did a nice blue coming back down to the bottom of the lift, and attempted to visit the Ice Grotto at the top of Tignes but got put off by the choice of walking back uphill to the fernicular or skiing down part of a red to get a lift back.

I have mixed feelings about the resort of Val D'Isere, all the bars make no bones about being English orientated, which I find a little odd, and lack of a bakers for early morning croissant is annoying. On the plus side as quoted from one of this weeks papers the French apparently love the English "unrelenting dedication to binge drinking" so the apres-ski was good! Resolution for next season is definitely to buy my own boots so I can get some which fit properly and get my calves used to the feeling before the first day.

Sunday, 14 January 2007

Buffalo Linkstation

I recently purchased a NAS solution (Network Attached Storage) from Buffalo in order to backup my mp3 collection on my iPod and the photos on my laptop hard drive and access them from any device in my flat. The actual model I went for is the HS-D300GL , mainly for its DLNA support.

The Digital Living Network Alliance (DLNA) have set out some guidelines in order to help guarantee that connectivity between devices will work out of the box, irrespective of manufacturer. Unfortunately this doesn't seem to extend to Microsoft's XBox 360, when I tried to access the data on the Linkstation from the XBox 360 dashboard the device is not visible.

Fortunately all is not lost, with the help of an excellent website Linkstationwiki.net I upgraded the firmware to a custom OpenLink version which enables a telnet connection to the Linkstation and upgraded the linux kernel with the help of this guide. The final piece of the puzzle comes courtesy of TwonkyVision, and their TwonkyMedia software which can spoof the Linkstation as a Windows Media Centre PC and make it visible to the XBox 360. TwonkyMedia is one of the few pieces of software available over the Internet that I've actually paid for so it must be pretty good, compatibility issues due to Microsoft updating the XBox 360 Dashboard are swiftly resolved and €30 seems like a bargain.

I have to say that setting up the Linkstation out of the box took about 5minutes, and upgrading the firmware was also pretty straight forward with DHCP address allocation turned on. I now have a solution where I can access any shared data from any DLNA device in my flat as well as the XBox 360.

Windows Networking & MTU Packet Size

I was recently recommended a piece of software called TCP Optimiser to, as you might expect, optimise your Windows registry settings for the Internet. This is all well and good and may have had some positive effect on my system but it brought back the ghost of a problem I had previously solved. Email unable to send, certain websites, including posting onto Blogger not working and no apparent cause.

Turns out your MTU packet size can actually make a big difference, I'm not sure if this is an issue with Tiscali, my ISP, or my D-Link DSL-604+ wireless router but it has now been replicated in both my new flat and my old student digs. The fix is simple enough, just requiring a reboot, and is nicely described here it just seems strange that default Windows settings don't work properly...