December 2003 Entries
I'll proabbly be posting a lot less for the next 2 weeks, heading home for Christmas...have a great Christmas!
I've posted a couple of times about using RSS from ASP.NET, so this interested me a fair bit, Jason Salas has posted a nice server control which allows very simple generation of RSS feeds based on a query to a SQL Server database. There's been a bit of chat about whether such a control should be included in Whidbey - to be honest I think it's a bit late for this and I'd rather time was spent improving what's already there than adding arbitrary new features.
Just noticed this from the Scaled Composites website:
PAUL G. ALLEN CONFIRMED AS
LONG-RUMORED SPONSOR OF SPACESHIPONE
Allen Sponsors Scaled Composites’ Cutting-Edge X-Prize Entry, Attends Today’s
Successful Test Flight of the First Manned Privately Funded Supersonic Aircraft
MOJAVE, CA and SEATTLE – Dec. 17, 2003 – Investor Paul G. Allen today confirmed
international speculation that he is the long-rumored sponsor behind the innovative
SpaceShipOne project, which broke the sound barrier today during its first manned test
flight. SpaceShipOne and its White Knight turbojet launch aircraft represent the first private
non-government effort to demonstrate a low-cost manned space effort. SpaceShipOne is a
contender for the coveted X-prize.
"Being able to watch...
Noticed a post on Robert McLaws' weblog about Hard-links...go and read the post it'll all make sense... Now, I've recently been working on a project where a requirement existed for an 'uploads' directory to be synchronised between two Web Servers...to cut a long story short, we had to use a product 'approved' by both the host and company for which the site was designed. Now, it is just incredibly simple to write this sort of tool using .NET, but no, we had to use one of these other tools...the ones recommended were WanSync and MS Application Center...overkill in my opinion! Anyway, hard...
I don't usually do this, but I thought I'd post some link to miscellaneous things I've been reading over the pas few days - there's no particular focus, just stuff I found interesting...
MSMQ with ASP.NET - if you haven't used Message Queues before, check this out...provides an easy method to manage very asynchronous, reliable messages..
FullSource - useful little tool which lets you see the actual source which IE uses (if you do a server.transfer for example, IE will show you the wrong source...), alos lets you see modifications made to the DOM by Javascript
Markup text in VB.NET - shows a...
Nice article on CodeProject on generating fractal snow...and a nice screensaver (which now works on multiple monitors) by Thomas Petricek who has also written a couple of other pretty nice articles and he's only in High School - makes you feel old doesn't it!
One of the most common problems with using CDOSYS (which is the underlying class used by System.Web.Mail) is the lack of authentication for sending mail via SMTP, Darren Jefford posted a method to do this, I've reproduced it below since it's currently hosted on GotDOtNwet and so may disappear at some point:
System.Web.Mail and Authentication
A question came up recently on how to send email from .NET, System.Web.Mail offers a nice MailMessage and SmtpMail class that does the trick.
The classes are a wrapper over the CDOSYS functionality that's been around for a bit, and are much nicer than the rather clunky...
I left a comment on Rob Chartier's blog about adding confirmation prompts to buttons, now I do use Andy Smith's Confirmed Buttons controls where I can, but if I need to add a simple confirmation to a button, I tended to use the following sytax from code-behind:
Button1.Attributes.Add("OnClick","javascript: return confirm('Are you sure you want to delete this forum?');");
Now, this does work, but it has a bug around in-page validation - Andy Smith pointed out the error - and the reason why this wouldn't work in .NET 1.0 - which I hadn't noticed! Here's his reply:
Scott, Yes, ConfirmedButtons was originally created because...
Find it here, I posted a comment about compressing ViewState - I'm really surprised that no-one seems to have done this yet - seems to be the most obvious thing to compress in a page and should have pretty good compression ratios - I may try this again myself...keep you posted :-)
Pretty amazing track from Rory Blyth - man I wish had musical talent of any kind; well, I sing but a monkey can sing...not very well, and it obviously appeals most to other monkies...but well, you get the idea...
Sorry if you've been having problems accessing this site over thelast couple of days, my ADSL has been acting up badly...is you have problems, please try again later (I have to cycle the connection to get it back...)
Still waiting for the 0.95 release of .TEXT (which is what this blog runs on), so I don't really want to make any changes to this site until then - as the changes I plan may already be in that release / the changes in 0.95 will be so radical that it will render what I've done inoperable. So, I'm looking for a new project to play with...options currently include:
Blog poster - similar to w.bloggar, except with an in-built HTML editor, the option to use the office dictionary (is this legal?), better UI, pluggable posting layer etc...
A CMS system with a...
Now this could be tremendously useful - here's the description from Craig Hunter: Why wait for Whidbey for this functionality? This macro generates a type-safe Singleton-based C# class wrapper that loads string, images, etc. from an embedded assembly resource on demand i.e. only when first accessed. Allows a CultureInfo instance to be assigned that will specify the culture to apply when loading resources. This is VB.NET exported source intended to be imported into and executed from a Visual Studio 2003 macro project. Developed by Craig Hunter. Oh, and yes, the dumb comment is from me...look it was early...I have a...
Just noticed this at DOtNetJunkies blogs - most interestring link to me was this one which links to the MSDN Regional Directors code center , just a shed load of useful utils there!
Look what I have found :)
ASP.NET server side Back control by Juval Lowy
Common techniques for implementing a Back link on a web page involve using the browser-side script. There are a number of disadvantages to this solution: the application has no control over where the user is going to be redirected. Often you want to keep the user inside the application, and you do not want them to...
Hmm...was fishing through GotDotNet user samples when I came across this...now this is an extermely cool implementation of different types of Binary Search collections - now I have never used the Sorted List collection before - but I should've done! It has a very cool feature which lets you access elements by value or key. The GotDotNet ones do pretty much the same thing except they're more efficient for certain types of data; see here for more info on Splay Trees and here for info on Red-Black trees and here for info on Binary Search trees - pretty useful and could help optimise...
I'm beginning to suspect I'm a bit odd...case in point, one of my favourite films is currently on BBC1, L.A. Story, no idea why, I just love this film! Others include Empire Records, Night On Earth (mainly the Italian section) and The Big Blue. So, what does this say about me??? What are your favourites?
I posted earlier about the difference between DataBinder.Eval and 'strongly typed' binding - mainly to see what other people do...Well in that I mentioned a benchmark I did a while ago to compare the two which showed a roughly 20% difference. So, in the interests of transparency, I've rewritten the benchmark - not looking to win any coding contests, but it should be fairly accurate!Anyway, if you want to try it out / pick fault with my methods (there's probably a few problems, I just hacked it together) you can get it here.It basically binds on to two DataGrids multiple times...
I had a problem where someone linked to one of the images on this site (actually problem still exists), basically a 2mb+ image was being displayed on some forum (I won't include the link :-)) which used a huge amount of my bandwidth... Well, here's a solution, also a pretty nice display of using HttpModules...he also has some nice, hi-res wallpaper here (wouldn't try to deep-link them though :-P)
UPDATE: OK, before anyone points out the obvious (actually after many people have!) - I am aware that DataBinder.Eval promotes code reuse to some degree; you still have to know what your fields are called of course! My point in this post was that I rarely saw the alternative syntax used and that in my experience I have found almost no drawbacks in using the 'Strong' syntax. This was also a trawl for comments to get the opinions of other developers...with that in mind, let the comments recommence...
Incidentally, in the post below, if anything looks screwy, sorry, having problems with...
Sorry, I've been neglecting this thing a little of late (causing trouble on the ASP.NET forums instead...gives me something to write about :-)). Anyway, I'll try and think of something interesting to write about..umm..any ideas, anyone got an ASP.NET question???
Well, had a lovely break...now for some code, this will let you 'impersonate' a user - really handy when, for instance, trying to upload a file to a network location...as usual, no idea where I found this, if it was youre, let me know!using System;
using System.Web;
using System.Web.Security;
using System.Security.Principal;
using System.Runtime.InteropServices;
namespace Components.Security
{
///
/// Summary description for ImpersonateUser.
///
public class ImpersonateUser
{
public const int LOGON32_LOGON_INTERACTIVE = 2;
public const...