Monday, December 29, 2008

System.RunTime.Serialization.SerializationException: The input stream is not a valid binary format. The starting contents (in bytes) are: 3C-68-74-6D-

System.RunTime.Serialization.SerializationException: The input stream is not a valid binary format. The starting contents (in bytes) are: 3C-68-74-6D-6C-3E-0D-0A-20-20-20-20-3C-68-65-61-64 ...

This is the Remoting exception IIS was consistently giving me after a deep search. The search was returning some mammoth blob's and failing after a few minutes.

I thought it might be an IIS error, sure enough after firing up TCPTrace and sniffing around, I found


HTTP/1.1 100 Continue
Server: ASP.NET Development Server/9.0.0.0
Date: Sun, 28 Dec 2008 23:52:31 GMT
Content-Length: 0

HTTP/1.1 500 Internal Server Error
Server: ASP.NET Development Server/9.0.0.0
Date: Sun, 28 Dec 2008 23:54:35 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 2549
Connection: Close

--snip html
Request timed out.
--snip html

So rather than throwing a relevant HTTP response code, we get a html error page that can't be serialized. Hopefully this saves fellow insane technologists a little time.

Wednesday, September 24, 2008

Returning lambda's from a ternary in C#

In the midst of some mad refactoring I came across something similar to the following snippet:

 1 if (count == 0)
 2   choice.Finish = result => { return; };
 3 else
 4   choice.Finish = result => { letter.MailMerge(result); };

Looked like a decent candidate for refactoring with a ternary / conditional operator:

 7 choice.Finish = (count == 0) ? result => { return; }
 8                              : result => { letter.MailMerge(result); };

Type of conditional expression cannot be determined because there is no implicit conversion between 'lambda expression' and 'lambda expression'

Hold your horses, say what?

For some reason the only way to fool it through the compiler is to cast one of the expressions (it doesn't seem to matter which one) to the expected return type.

11 choice.Finish = (count == 0) ? (TypeDelegate<int>) (result => { return; })
12                              : result => { letter.MailMerge(result); };


Go figure!

Tuesday, September 2, 2008

VIM on OpenVMS

This is a note to future Dan and anyone else that may have file permission problems when running VIM on OpenVMS.

Define this logical:

Dan$ define DECC$ACL_ACCESS_CHECK ENABLE

Apparently when disabled the access function only checks the UIC protection and not the OpenVMS ACL's.

There are all other kinds of goodies here

Monday, August 11, 2008

SVN 1.5.1 / Ruby bindings on Windows

Rather than messing around with compiling swig bindings etc:

  1. Download the ruby bindings from the svn site: (http://subversion.tigris.org/files/documents/15/43245/svn-win32-1.5.1_rb.zip)

  2. From the zip - copy ruby\lib\svn into c:\ruby\lib\ruby\site_ruby\1.8\svn

  3. From the zip – copy ruby\ext\svn\ext into c:\ruby\lib\ruby\site_ruby\1.8\svn\ext

  4. copy libeay32.dll and ssleay32.dll from your subversion 1.5 directory into c:\ruby\bin

  5. run irb and test with: require ‘svn/core’

Saturday, June 14, 2008

Why?

css:

.mainMenuHeader {color:#FFFFFF;}
.mainMenuHeader:hover {color:#F26540;}

xaml:

<Style x:Key="mainMenuHeader">
  <Setter Property="Control.Foreground" Value="#FFFFFF" />
  <Style.Triggers>
    <Trigger Property="Control.IsMouseOver" Value="True">
      <Setter Property="Control.Foreground" Value="#F26540" />
    </Trigger>
  </Style.Triggers>
</Style>

Saturday, May 31, 2008

Home Town Hero - That's How I Know

Hopping back in the time machine to 2002 a slightly rockin' album came out - Home Town Hero - Self Titled. It sounds a little grungy like The Exies and a little power-poppy like Rooney.

They had some minor successes opening for STP, Incubus and Weezer. Since then, they have completely fallen off the radar. Apparently there was some unpleasantness with their record label and they are now back under the moniker: Under the Influence of Giants. I gave their new LP a listen, i just couldn't get into it. I think it has validly been classified as disco-rock :)

Nick and I were giving it a thrash this week, so as an ode to the good old days I tabbed out the secret/bonus/acoustico track, as it appears no-one else has.

It ain't the most complicated tune on the planet but stay tuned for Niccolò Paganini's 24th Caprice next week :)

bon appétit!

Begin Tab
Standard tuning (EADGBE)
Intro (let ring)

 C       G\B      Am       F           C       G\B     C
---------------------------------------------------------------------
---------------------------------------------------------------------
-----0-------0--------2--------------------0-------0---------0---0---
---2---2---0---0----2---2------3---------2---2---0---0---2---2---2---
-3-------2--------0----------3---3-----3-------2-------3---3-3-3-3---
---------------------------1-----------------------------------------


Verse

 C       G\B      Am       F         C       G\B     E       F
------------------------------------------------------------------------
------------------------------------------------------------------------
-----0-------0--------2------------------0-------0----------------------
---2---2---0---0----2---2------3-------2---2---0---0-----2-------3------
-3-------2--------0----------3---3---3-------2---------2---2---3---3----
---------------------------1-------------------------0-------1----------

 C       G\B     Am        F    
-----------------------------------------
-----------------------------------------
-----0-------0-------2-------------------
---2---2---0---0---2---2-------3---------
-3-------2-------0-----------3---3-------
---------------------------1-------------

 C       G\B      E          F
-----------------------------------------
-----------------------------------------
-----0-------0----1-1-1-x-x--2-2--x-x-x---
---2---2---0---0--2-2-2-x-x--3-3--x-x-x---
-3-------2--------2-2-2-x-x--3-3--x-x-x---
------------------0-0-0-x-x--1-1--x-x-x---


Chorus (just bang out the chords instead of picking them)

 C   G\B  Am  F  C  G\B  C    (into to bridge)  
-0---3--------1--0--3----0--|--0------------
-1---3----1---1--1--3----1--|--1------------
-0---0----2---2--0--0----0--|--0------------
-2---0----2---3--2--0----2--|--0------------
-3---2----0---3--3--2----3--|--2------------
--------------1-------------|---------------


Bridge

 Am  F   G\B  Am  C  E    Am   F   G\B   Am  C   B\G
-0---1---3----0---0--0----0----1---3-----0---0---3---
-1---1---3----1---1--0----1----1---3-----1---1---3---
-2---2---0----2---0--1----2----2---0-----2---0---0---
-2---3---0----2---2--2----2----3---0-----2---2---0---
-0---3---2----0---3--2----0----3---2-----0---3---2---
-----1---------------0---------1---------------------


Thursday, March 20, 2008

Fixing the Teac HDB820 C.100 Error

The other day I mentioned I was feeling slightly hot and bothered. Well, so was my Teac HDB820.

I woke up this morning and I was greeted by the dreaded C.100 error. I tried turning it on and off, no go. I´ve had it for about 2 years so warranty was no option. On cracking it open one of the 1000uF 16V capacitors had a slight eruption. There are 3 in total and with the weather we´ve been having; i´m not suprised it gave up.

After I got home from work I ducked into DSE and grabbed 3 of these chunky bastards - 1000 uF 35 WV caps. I then whipped out the soldering iron (i knew doing year 11 electronics would pay off one day) and 10 minutes later I was back in sweet sweet HD heaven.

Saturday, March 15, 2008

SVN hooks on Windows with Ruby

I'd been meaning to write a pre-commit hook to catch empty log messages for a while but hadn't got around to it for one reason or another. I had a spare 5 minutes so I got stuck in.

The SVN book mentions that on Windows the hook files extension basically has to be .exe, .com or .bat. Even though .rb is executable on my SVN server it was not being called. So, instead I just called the ruby script from the bat file as such:

pre-commit.bat
1 SET DIR=%1/hooks
2 set REPOS="%1"
3 set TXN="%2"
4
5 c:\ruby\bin\ruby.exe d:\svn\hooks\pre-commit.rb %REPOS% %TXN% %DIR%

It also mentions that for security reasons, the repository executes hook scripts with an empty environment—that is, no environment variables are set at all, not even $PATH or %PATH%. Because of this, it is necessary to specify absolute paths.

Setting DIR above is a bit of a trick for debugging purposes so you can write a log file into the hooks directory to check things out. The ruby script is as follows:

pre-commit.rb
 1 REPOS, TXN, DIR = ARGV[0], ARGV[1], ARGV[2]
 2 SVN_LOOK = "C:/Program Files/Subversion/bin/svnlook.exe"
 3
 4 log_msg = %x["#{SVN_LOOK}" log -t #{TXN} #{REPOS}].chomp.strip
 5
 6 if (log_msg.nil? || log_msg.size < 5)
 7   err = <<-EOE
 8     This commit has failed due to the absence of a meaningful log message.
 9     Please provide a message describing why you changed what you did and
10     then try committing again. Ta -- Dan
11   EOE
12
13   STDERR.puts err
14   exit(1)
15 end

Yeah, I'm a bit of a bastard setting the minimum length of the log message to 5 chars. The only tricky bit of the entire process was realizing that I needed to chomp a new line off the log message. That's where using DIR and writing to a log file helped out.

Tally, ho!

Thursday, March 13, 2008

Sun / Microsoft developer marketing

I just got back from the Microsoft 'Visual Studio 2008' launch event at the Hilton. I can't put my finger on it but a few things just really pissed me off about the whole thing. Maybe it's the hot weather we've been experiencing but I'm fired up.

The ASP .NET session wasn't too bad. Kudos for the Javascript debugging / code completion, but then again firebug has been around for how long? To the people in the audience that debug their Javascript in IE using alerts; you deserve the agony :)

The next session was on Team Foundation Server , in particular the source control and continuous integration features. The presenter was carrying on like Microsoft invented these things. Personally, I found it rather condescending but on looking around everyone was lapping it up. I suppose if all you know is VSS then these things might impress you. These are not bells and whistles! These are essential development practices that you already should have been using. There are already so many existing tools available, I get along just fine with cruise control and svn. I didn't see anything innovative in TFFS at all.

I cast my mind back to the Sun Java developer day I attended last year; oh so many contrasts. Firstly, the Sun event was free, the Microsoft one wasn't (but thanks for sending me work) :). The Microsoft one was full of buzzwords, marketing and testimonials, where the sun one was more developer-centric, presenting some really cool shit, like launching project matisse.

It's a real shame the Sun event was cancelled in Adelaide this year. I dearly hope this isn't indicative of a shift

Unfortunately the biggest highlight of my day wasn't attending the event; it was my taxi almost running over Ahn Do on the corner of Wakefield and Pulteney street.

Saturday, January 26, 2008

Contributing to JRuby

Things have been pretty hectic at the moment but recently I found a little bit of time to contribute to JRuby. I highly recommend it.

The lads are doing a whole lot of good and could do with the help. Charlie wrote a post a while back on how to contribute. Go read it.. now ... seriously, and do something for the betterment of mankind.

Oh, and next time you pass an array to Dir.glob, I really hope it works :)