Thursday, January 28, 2010

JQuery DataTables

I've recently been working on an MVC.NET project. Whats interesting is that most WebForms User controls don't work because there is no post back and code behind. (Don't quote me on this, I'm still very new to it).

So anyway, I needed a table that could Sort Columns, Search Filters, Paging... I conveniently found some JQuery Tables that work on HTML Tables.  See

My solution built in MVC is to have a model of the data, and have the view output the model using HTML tables.  This is done in ASP.NET so you use angle brackets inside the asp code to loop through all the entries.  Then you use the above jquery library, which is completely client side, no server side calls.

The downside is, you retrieve all your data the first go, and load the entire table, which is slower than real paging.
Reblog this post [with Zemanta]

Saturday, January 23, 2010

Wednesday, January 20, 2010

Update on My Life so far

South Island DVD
Took me way too long, but managed to get there in the end.  Sorted through hundreds of photos to turn them into slide show movie files, one file per day. Then add music and a DVD menu to turn it into a proper DVD. Looks very kiwi/amateurish but its pretty cool. I usedDVD-Styler and DVD slideshow GUI both open source apps to make the DVD.

Back to School - well work actually.
Getting back from a massive South Island
road trip has been hectic.  At work, I'm straight into with a new project kicking
off.  I'm organizing Round the Bays for the company, so that will be great
fun!  Our first running-bunch session starts tomorrow.

Fire on Cawley St
Check it out... its down the road from where I work, and I saw it!! wowzers it was

Church @ Salvation Army I've attended once this past month and a bit, as
I haven't been in Auckland on Sundays much.  I did however visit their new
website... nice!

Decommissioning my beloved basketball hoop
Its lasted some 3-odd years, but the rust has made it dangerously unstable.  Not too sure what i'm going
to do with it, whether I'll buy another one or make my own...

Braces: 12 months and counting
 Its been 1 year since I first got my braces.  It was thought that we could get them off in 9 months and then use the retainers.  But its taking a bit longer than expected and I'm not enjoying it one bit.

Orlando is not doing as well as expected.  The team is too muddled by new players and chemistry despite having one of the best teams on paper.  Their last loss to the Lakers was particularly bad after falling behind in the 1st half, crushing the Lakers in the 3rd quarter and collapsing in the 4th.  The Lakers are on a roll despite Kobe's injuries.  LeBron has the Cavs right up there despite Shaq getting in the way.

Friday, January 15, 2010

C# Reading from a closed Stream

Basicaly, when you read from a Stream, you must close it after you are done.  But what if at some point later you need to open it and read it again?  Even after trying to reopen it, it seems like the pointer is at the end and it just finishes :S

We copy the stream we want to read first, then read that copied stream.  I found this code on the net somewhere, can't remember now.  Very handy, stored here for later reference :)

*edit* updated by adding one line to the CopyStream method

//Copy the stream first so we can open it several times
Stream responseStream = CopyStream(attachment.ContentStream);

// convert stream to string
using (StreamReader reader = new StreamReader(responseStream))
    string text = reader.ReadToEnd();
    return text;

/// Copy the stream for reading and writing
private static Stream CopyStream(Stream inputStream)
    const int readSize = 256;
    byte[] buffer = new byte[readSize];
    MemoryStream ms = new MemoryStream();

    int count = inputStream.Read(buffer, 0, readSize);
    while (count > 0)
        ms.Write(buffer, 0, count);
        count = inputStream.Read(buffer, 0, readSize);
    ms.Seek(0, SeekOrigin.Begin);
    inputStream.Seek(0, SeekOrigin.Begin); 
    return ms;

Thursday, January 14, 2010

Geeky email


Dear Tech Support

This year I upgraded from Boyfriend 5.0 to Husband 1.0 and noticed a distinct slow down in overall system performance, particularly in the flower and jewellery applications, which operated flawlessly under Boyfriend 5.0.

In addition, Husband 1.0 uninstalled many other valuable programs, such as
       Romance 9.5 and
       Personal Attention 6.5, and then installed undesirable programs such as
       NBA 5.0,
       AFL 3.0  and
        Golf Clubs 4.1.

Conversation 8.0
no longer runs, and Housecleaning 2...6 simply crashes the system.

       Please note that I have tried running Nagging 5.3 to fix these problems, but to no avail.

What can I do?




First, keep in mind,
       Boyfriend 5.0 is an Entertainment Package, while
       Husband 1...0 is an operating system.

Please enter command: ithoughtyoulovedme.html and try to download Tears 6.2 and do not forget to install the Guilt 3.0update.
      If that application works as designed, Husband1.0  should then automatically run the applications Jewelry 2.0 and Flowers 3.5.

However, remember, overuse of the above application can cause Husband 1.0 to default to Grumpy Silence 2.5, Happy Hour 7.0 or Beer 6.1.

Whatever you do,
DO NOT under any circumstances install Mother-In-Law 1.0 (it runs a virus in the background that will eventually seize control of all your system resources.)

In addition, please do not attempt to reinstall the Boyfriend 5.0 program.These are unsupported applications and will crashHusband 1.0.

In summary, Husband 1.0 is a great program, but it does have limited memory and cannot learn new applications quickly. You might consider buying additional software to improve memory and performance... We recommend
       Cooking 3.0 and
       Hot Lingerie 7.7.

Good Luck Babe!

Tech Support

Epic South Island

Is it more kiwi-like to go to the South Island or to not?  - or is it just an Aucklander thing?  Well of all the places I have been to, which is not a lot, the South Island is by far the most amazing, the most epic, and the most beautiful.  I have travelled the North Island extensively, Rotorua is fairly exciting, New Plymouth, Muriwai, Cathedral Cove, Goat Island are all very nice beaches but none as complete as places around the South Island.

On our first day, we landed in Christchurch.  After picking up our rental car, we went straight to Fox Glacier via Arthur's Pass stopping at Franz Joseph Glacier.  The straight roads and massive planes immediatly struck me with awe.  The mountains that loomed over us could only be descriped as EPIC - I don't know how many times I've mentioned that already, but I said it a lot more in the car!

All the scenery was unreal.  Its the only place where I've seen pictures, and then see that the real thing is just as good.  There were a few places where it was raining and misty, and we didn't have such a great view, but we caught a break in other places so that was good.

Another awesome thing about it was the heritage.  There are plenty of history to see, lots of old buildings.  Theres plenty of Gold mines, including the Chinese Settlement in Arrowtown, which was home to many of the first chinese to settle in NZ.

There are plenty of activities, plenty of tourists and an overall great place to spend your holiday.  I wouldn't mind living there for a few months, working and traveling in the weekends.  Would be a welcome change from borring old Auckland for a while.  But I think it would get borring soon, as most of the townships were pretty small.  Christchurch being the largest city, but Queenstown being the most interesting and happening.  Oh and its home to the great Ferg's Burgers, the best burgers in New Zealand!

I'm already looking forward to going back.  I would love to see it in the South Island when all the mountains become snow capped.  Go on some other adventure activities, and just experience it all over again!

Wednesday, January 13, 2010

Avatar Plot Fail

In an earlier post, I complained about Avatar's plot.  Check out this Fail Blog post:

Monday, January 11, 2010


"For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

"Q: What is the difference between Mechanical Engineers and Civil Engineers ?
A: Mechanical Engineers build weapons, Civil Engineers build targets."

A man was crossing a road one day when a frog called out to him and said: "If you kiss me, I'll turn into a beautiful princess".
He bent over, picked up the frog and put it in his pocket. The frog spoke up again and said: "If you kiss me and turn me back into a beautiful princess, I will stay with you for one week."
The man took the frog out of his pocket, smiled at it and returned it to the pocket. The frog then cried out: "If you kiss me and turn me back into a princess, I'll stay with you and do ANYTHING you want". Again the man took the frog out, smiled at it and put it back into his pocket.
Finally, the frog asked: "What is the matter ? I've told you I'm a beautiful princess, that I'll stay with you for a week and do anything you want. Why won't you kiss me ?"
The man said, "Look I'm a software engineer. I don't have time for a girlfriend, but a talking frog is cool."

Top Ten Reasons To Date an Engineer

  1. The world does revolve around us... We pick the coordinate system.
  2. Find out what those other buttons on your calculator do.
  3. We know how to handle stress and strain in our relationships.
  4. Parents will approve.
  5. Help with your math homework.
  6. Can calculate head pressure.
  7. Looks good on a resume.
  8. Free body diagrams.
  9. High starting salary.
  10. Extremely good looking 

Top Ten Reasons NOT to Date an Engineer

  1. T-shirt and jeans are their formal dress. Hot dog and a six-pack is their seven-course meal.
  2. The only social life known of is to post and talk on the net.
  3. Flames like a monster and speaks like a pussycat.
  4. Works from 6:30am to 7:30pm daily. No morning kisses and no evening walks.
  5. No matter how hard you cry and how loud you yell, he just sits there calmly discussing your emotion in terms of mathematical logic.
  6. Only listens to classic rock. Hates everything from Bach to Prince.
  7. Touches his car more often than you.
  8. Talks in acronyms.
  9. Can't leave that damn pencil off his ear for a minute.
  10. Will file a divorce if you call him in the middle of debugging.

You Might Be An Engineer If...

  • You have no life - and you can PROVE it mathematically.
  • You enjoy pain.
  • You know vector calculus but you can't remember how to do long division.
  • You chuckle whenever anyone says "centrifugal force".
  • You've actually used every single function on your graphing calculator.
  • It is sunny and 70 degrees outside, and you are working on a computer.
  • You frequently whistle the theme song to "MacGyver".
  • You know how to integrate a chicken and can take the derivative of water.
  • You think in "math".
  • You've calculated that the World Series actually diverges.
  • You hesitate to look at something because you don't want to break down its wave function.
  • You have a pet named after a scientist.
  • You laugh at jokes about mathematicians.
  • The Humane society has you arrested because you actually performed the Schrodinger's Cat experiment.
  • You can translate English into Binary.
  • You can't remember what's behind the door in the engineering building which says "Exit".
  • You have to bring a jacket with you, in the middle of summer, because there's a wind-chill factor in the lab.
  • You are completely addicted to caffeine.
  • You avoid doing anything because you don't want to contribute to the eventual heat-death of the universe.
  • You consider ANY non-engineering course "easy"
  • When your professor asks you where your homework is, you claim to have accidentally determined its momentum so precisely, that according to Heisenberg it could be anywhere in the universe.
  • The "fun" center of your brain has deteriorated from lack of use.
  • You'll assume that a "horse" is a "sphere" in order to make the math easier.
  • The blinking 12:00 on someone's VCR draws you in like a tractor beam to fix it.
  • You bring a computer manual / technical journal as vacation reading.
  • The salesperson at Circuit City can't answer any of your questions.
  • You can't help eavesdropping in computer stores... and correcting the salesperson.
  • You're in line for the guillotine... it stops working properly... and you offer to fix it.
  • You go on the rides at Disneyland and sit backwards to see how they do the special effects.
  • You have any "Dilbert" comics displayed in your work area.
  • You have a habit of destroying things in order to see how they work.
  • You have never backed up your hard drive.
  • You haven't bought any new underwear or socks for yourself since you got married.
  • You spent more on your calculator than on your wedding ring.
  • You think that when people around you yawn, it's because they didn't get enough sleep.
  • You would rather get more dots per inch than miles per gallon
  • You've ever calculated how much you make per second.
  • Your favorite James Bond character is "Q," the guy who makes the gadgets.
  • You understood more than five of these jokes.
  • You make a copy of this list, and post it on your door (or your home page !)

 "Engineers believe that if it ain't broke, it doesn't have enough features yet."    — Scott Adams.