Kategorier
jiu jitsu

A challenge!

Do one hundred consecutive push-ups. In 6 weeks. Here!

I’m taking this challenge. Did the initial test, and put myself in rank 4 with a whooping 34 full push-ups, which I consider pretty good.

I’ll continue doing sit-ups and back-arches every morning, but will be following the program for push-ups. Will be interesting to see what that means for me. If it’s good, I guess I’ll be doing the same for sit-ups.

Kategorier
jiu jitsu

Physical training

Over the summer period, the club is somewhat closed down – no regular trainings, but we have one planned for next Tuesday. Instead, I’ve decided to do some physical work out, something I could definately use anyhow.

Started yesterday, intending to do sit-ups, back-lifts, push-ups every morning. The count this morning was 50, 40 and 30 respectively, so I guess I’m not so badly out of shape as I could’ve been.

Kategorier
Role playing

AutoRealm – Mapping software

AutoRealm is a nifty piece of software I stumbled upon in my search for a tool to make maps of Dunderhill.

It’s free (GNU), open source (written in Delphi, though), and pretty cool.

Below is my first map of Dunderhill made in AutoRealm.

Kategorier
Role playing

D&D 4th edition

Well, it’s been out a couple of weeks or so, and I recently ordered this:

D&D 4th edition core books

Expected arrival is August 4, just before my last week of vacation kicks in. I want to RP again… sigh.

Kategorier
jiu jitsu

Planning for the blue belt

I’ve taken up a childhood sport of mine, jiu jitsu. Actually, come this fall, I’ve been doing it for two years since my ten year hiatus. And so, it’s about time I start working on my graduation. The trainers at my club allowed me to keep my grade from ten years ago, so I started as a green belt, and the next one up is nikyu (second grade student), the blue belt.

Over the last two years, I’ve picked up all the old techniques and learnt a lot of new material – some parts of the curriculum is very different from the one I used to train, but that’s just great. One of the things that are different is that students put together their own curriculum – I get to pick from a large set of techniques and decides which ones to apply in which situations during the test. For listing the techniques I’ve chosen, I’ve created a page here, which I’ll expand as I go along my training.

My main plan is to train once a week for two months, give or take, and then take the test. For nikyu, this should be quite doable.

Kategorier
Programming

LINQ code side cascading deletes

Over the last week or so, I’ve been searching around the net for a solution to a problem at work. The problem being that I have a bunch of LINQed objects with parent-child relations between them – the classic Orders -> OrderLines problem.

Normally, you’d create a relation with CASCADE DELETE set on it, but for these objects, I had to do more than just delete the relevant records – for example, I could have a file on disk related to each OrderLine. Deleting the OrderLine should delete the file as well – even if it was a cascaded delete.

You could implement the partial methods DeleteOrder and DeleteOrderLine on the Context class, and delete the file from there. That works for direct deletes, but not for the cascade case, since that only takes place on the sql-server. Also, you cannot call DeleteOnSubmit during SubmitChanges, which is where the partial methods are called.

All I got from google was a bunch of notes on using DeleteOnNull, which doesn’t help me any.

Finally, it dawned on me: You can override SubmitChanges on the Context class. Here’s how I did it:

Public Overrides Sub SubmitChanges(ByVal failureMode As System.Data.Linq.ConflictMode)
  Dim c As Integer = 0
    Dim cs As Changeset = Me.GetChangeSet()

    ' Use a While loop because the count can (will) increase
    While c > cs.Deletes.Count
        Dim deleted As IDeleteEventHandler = TryCast(cs.Deleted(c), IDeleteEventHandler)
        If deleted IsNot Nothing Then
            ' Notify the object that it is about to be deleted.
            deleted.OnDeleting(Me)
        End If
    End While

    MyBase.SubmitChanges(failureMode)

    ' Here I can use a For Each loop because it's
    ' too late to add to the collection anyhow.
    For Each deleted As IDeleteEventHandler In cs.Deleted
        ' Notify the object that it has been deleted.
        deleted.OnDeleted()
    Next
End Sub

And on each object that had to cascade deletes code side, I’d implement the IDeleteEventHandler interface (that I defined to have two methods – OnDelete and OnDeleted), like so:

Partial Public Class Order
    Implements IDeleteEventHandler

    Public Sub OnDeleting(ByVal context As Context) Implements IDeleteEventHandler.OnDeleting
        ' Also delete OrderLines
        context.OrderLines.DeleteAllOnSubmit(Me.OrderLines)
    End Sub 

    Public Sub OnDeleted() Implements IDeleteEventHandler.OnDeleted
        ' No context passed to this method because you shouldn't
        ' do stuff with the context here.

        ' Delete order file from disk
        System.IO.File.Delete(Me.FileName)
    End Sub
End Class

Tah daaaah! There you have it, code side cascading deletes in LINQ.

Kategorier
ewai

TinyMCE in ewai!

I’ve just added TinyMCE into a version of ewai, so that text entries can be edited on all sorts of OS’s and browsers. A small step towards independence. Before my getting hacked, I also had context menus working at least somewhat in other browsers, so that’s actually most of the system working if I can put the pieces together correctly.

I’m pondering whether or not to continue the project at all, there’s so little time in a day these days, but on the other hand, with the kids growing older and my sleep pattern returning to a more regular one, I guess maybe, just maybe I’ll find a couple of hours every now and then to keep moving towards that holy grail of mine, the perfect CMS.

Kategorier
Uncategorized

An explanation

Yeah, well…

Turns out my server has been hacked by some Italian, who used the opportunity to upload a phishing site to my mother’s web site. For an Italian bank. To those affected, I’m terribly sorry.

The site was up from a Sunday at 4pm until the day after at noon, where my ISP kindly responded to a complaint about the phishing site by pulling the plug on my internet connection.

I’m thoroughly disappointed with people.

Long story short, I’ve decided to no longer run my own online server. I’ve moved whee.dk to a webhotel at http://surftown.dk (If you’re shopping for hotel space and find surftown to your liking, drop me a note, as I have this kind of link that’ll give you a discount and me a bonus 😉 )

Other sites that I hosted will have to find their own new homes. I’ve offered help moving the ones I could think of, and at least the Wyrden comic is getting closer to having a new home over at http://hellionsart.com/ – I’ll post an actual link some time soon.

In the meantime, I’ve become webmaster for http://sccdk.com/ – I’ve built them a new site, and am actively handling content as provided by board members and others. It’s based on http://WordPress.org/, a blogging system I’ve come to like very much.

Kategorier
Uncategorized

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!