Friday, April 29, 2005

Nasty little ASP.NET 401 problem

I discovered this nasty little problem the other day while building a couple of simple little pages and I thought I should post it so I don't forget and waste ages on it again!

Essentially the issue is that if you have custom error pages for different types of http status codes such as 401, 403 or 404 then you will have be prepared to do a little bit coding for your 401 page to be displayed unlike your other error pages which you can automatically redirect to by turning on customErrors in the web.config file like so:


<customErrors mode="Off" defaultRedirect="Error.htm" >
    <error statusCode="403" redirect="AccessDenied.htm"/>
</customErrors>

The problem with 401 is that if you are using the web.config authorisation section as well, and you have explicitly denied the user permission then their request will be authenticated but not authorised and appears to be terminated before the ASP.NET custom error handler can run. For example:

<location path="MySecurePage.aspx">
    <system.web>
        <authorization>
            <allow users="james" />
            <deny users="*" />
        </authorization>
    </system.web>
</location>

Here the only way to redirect your user to your custom error page will be to check for this condition in the application_end event in the global.asax like so:

protected void Application_EndRequest(Object sender, EventArgs e)
{
    if (Response.StatusCode == 401 && Request.IsAuthenticated == true)
    {
        Response.ClearContent();
        Response.Redirect("AccessDenied.htm");
    }
}


Note: trying to set your custom 401 page in IIS won't work either as user is authenticated by IIS, but their authorisation fails at the ASP.NET level

Nasty!

Thanks to Ashraf Moollan

Sunday, April 24, 2005

Some productive hacking

Over the weekend I have made a pretty decent amount of progress with my vision project. I have created a simulated stereo system by taking images with the camera on the left hand side, moving the camera and then taking images of the same scene from the right hand side. I then load these images from disk simultaneously to simulate the effect of having two cameras. Hopefully I will get my other camera soon as this solution won't work for long.

I am now at the point where I can match features between the stereo images and extract depth information from the stereo nature of the images. I have also completed the matrix mathematics that will give an estimate of the image coordinates of a given feature in the next frame given the camera translation between frames. This last bit of work was a bit challenging as it required me to relearn a bunch of linear algebra and trigonometry which I hadn't used since University.

My next challenge is to use least squares minimisation on the features successfully matched between frames to find the error between the projected feature location and the actual feature location. This will then feed back into the camera location calculations as a sort of error term. I am thinking I may even use a kalman filter to integrate the robot odometry and calculated camera ego motion.

I still have a long way to go before this prototype is finished and I know whether the system will even work or not, but it is pretty exciting to be able to do what I have already accomplished!

Tuesday, April 19, 2005

Mono and Monodevelop - state of the nation

I installed the new builds of mono and monodevelop last week and having used them a little over the last couple of days I can say they are pretty neat so far.

I haven't used any of the new features in mono (since 1.1.4) but it does seem to be a little faster, and also fixed a nagging problem I had where everytime I rebooted my machine I had to delete my ~/.wapi directory before I could build/run any mono application.

Monodevelop is looking a little more polished since the 5.1 release. It also runs on 64bit native mono at last which I am totally stoked about! I also installed a (experimental) plugin for svn integration that had been posted to the monodevelop mailing list and this looks promising, although the history functionality crashes monodevelop on my machine (I suspect this may be to do with the version of svnlib I have installed). My only complaints at the moment are that it is a little unstable and seems to crash unexpectly (I'm planning to figure this out and submit a bug report at some stage), and the lack of C# 2.0 syntax support. I am using generics pretty heavily in my current project and including this syntax totally breaks code completion.

Monodevelop is a pretty promising IDE and a great project which I would love to contribute to, if only I had a little more time!

In slightly unrelated geekage, I finally got round to setting up some samba shares on my home network last weekend. So now my house mates can all stream mp3s, video etc from my machine via the wifi network. It's pretty cool having Linux, Mac and Windows machines all interoperating nicely togeather!

Sunday, April 17, 2005

I wish weekends were three days long...

Well, it's Sunday night and I really wish that weekends were three days long. I could really do with just one more day off this weekend. I feel like I haven't had a decent break in ages and need a bit of relaxing and unwinding time. Most of the travelling Anthea and I do is pretty full on and not much time for relaxing so I haven't really had a break since Christmas and beginning to feel a bit flat.

Had a few little wins over the weekend and am feeling pretty happy about it. I finally seem to have my xdaIIi syncing with Evolution properly. I am using SynCE and multisync to sync my Evo contacts, task list and calendar. It seems like a pretty solid setup now. I think my initial problems were down to some faulty partnerships I created while trying to set everything up.

I also managed to get a bit of solid hacking done on my Vision project this weekend. I don't really have any visable results to show for my efforts, but I know I am making progress. Hard to explain to your significant other that you are really excited because you've finally figured out how to calculate the intrinsic matrix for your camera and undistort images ;-)

I also managed to get some of the translation and rotation matrix multiplication working. Well actually it's still untested as of yet, but it compiles and runs. I am rapidly approaching the point where I am going to need to get the other camera now so I can do proper stereo. I was holding off purchasing until I was sure I was going to be able to get the first one working correctly with opencv and mono and have now reached the point where I am pretty happy with it.

Anthea and I went for a huge walk around Hyde park in the sun today. It's amazing the change in Londoners when spring rolls round and the sun comes out. I'm sure half of London was in the park playing frisbee or walking the dog or playing with the kids, and it's really nice to see so many people out and enjoying themselves.

Friday, April 08, 2005

Gmail is cool

Ok, I have to say it, gmail is really great. I wasn't a big fan of the whole conversation thing when I first started using it but now I love it to bits.