mostlylucid

February 2004 Entries

Got to get back to it...

Posting that is - it's not that I have nothing to write about, just no particualr inclination to write it...I will try to maintain at least one post a day on a vaguely interesting .NET related subject for the next two weeks - promise :-)

iPod Love

Well, got my iPod exchanged...working perfectly now. Firewire just rules (as does USB 2.0 which I use at work) - got roughly 3000 songs transferred over in under an hour...this is really just the prettiest thing I've ever owned, I just can't fault the design in any way.

When good toys go bad...

AARGGHHHHH! Man I hate it when you get a nice fun gadget and it doesn't work...So anyway, I decided to buy myself a nice new iPod (20Gb model in case you're interested), got it home, read the instructions (for a change), installed the software, rebooted and plugged it in to the Firewire port on my main PC...nothing...nada...zilch. So I thought - well that's probably just the Audigy crappy Firewire version SB-1394...so I tried it on one of my other machines which has bog standard Firewire - nothing...so I installed the previously uninstalled Firewire header card for my motherboard on my main machine...nothing...so I tried it on my laptop which has 4 pin Firewire..nothing. Anyway, after 4 hours of fustration (and looking lustfully at the lovely, lovely iPod)...I've given up. Thankfully I bought it at a local store, so I can just take it back and get a replacement (and a USB2 cable which I trust way more than new fangled Firewire) - which is a vast improvement over internet shopping in this instance - online it would take days to get a replacement...
Sorry, just had to let off a bit of steam...

This strikes me as incredibly useful! AzMan - lets you assign your own permission types (like 'CanEatPizza')

Found this on Loren Halvorson's Blog...he (?) explains it best, so here's just a complete copy of what he wrote...

Is anyone using AzMan?

We are in the process of developing a common role based authorization layer for several of our applications and stumbled across the Microsoft's Authorization Manager. I had originally passed over it because I thought it was tied to Windows Server 2003, but it turns out that it runs on Windows 2000 which we are using in production, and Windows XP which developers use. On XP, just install the Windows Server 2003 Administration Tools Pack and you'll get it.

The idea seems great. It allows you to define logical operations like "CanApproveExpenseReports", map those to logical roles in your organization like "Manager". Then assign users to the roles. (The model is extremely flexible...I recommend Dave McPherson's article). There is a COM runtime and a .NET interop assembly for use from .NET, that allows your application to quickly check to see if the current user is allowed to perform some operation. Following is not the actual API, I just wanted to give you a feel for how you use it in an app:

if (azMan.CheckAccess(user, "CanApproveExpenseReport")
{
    // Approve expense reports code goes here
}

It also provides an MMC snap-in tool to manage everything. If it works out, it promises to save us a ton of time.

I see the Patterns and Practices Authorization and Profile Application Block has a provider that can use it, and there is a RoleManager Provider in Whidbey that uses a part of it too. So Microsoft seems to think it fits the problem.

Actually while I'm on the subject of Whidbey, I was surprised that it doesn't seem to provide a general purpose authentication mechanism other than IsInRole. Roles are good for some things, but they are too course-grained for deciding whether a button is visible or not, or whether a user can delete items from a table.  There can potentially be hundreds of these fine-grained secured operations scattered throughout your application, and hard-coding role names (if (User.IsInRole(“Manager“)...) throughout your app is not an acceptable solution in my opinion because it limits the ability to redefine the permissions of each role later on without touching code.

Authorization Manager (or AzMan for short) seems to fit the bill perfectly. However I hesitate to jump in too quickly because I don't see very much buzz about this technology on the web. I'd like to read other people's experience with it. Has anyone tried to use it in a .NET Application?

Another short one...how to read the contents of an entire file into a Byte Array...

This just another one of thoise dumb little snippets that I always forget and is a bit of a bugger to find...so, if you for some reason (e.g., compression / encryption) need all of the contents of a file to be held in a byte array, here's the simplest way I've found to do it:

byte[] inArr;
using(Stream s=File.Open("myfile.dat",FileMode.Open))
{
inArr =
new byte[s.Length];
s.Read(inArr,0,inArr.Length);
}

Nested repeaters - new article on Codeproject and why you shouldn't do it that way!

Just been reading this article on Codeproject.com...hmm...I have a few issues with how he does things:

  • DataBinder.Eval - I have what is becoming an obsession about this now - there's just NO NEED for this in most cases, it sucks in terms of performance (you can typically lose about 20% compared to the stongly typed method. I've posted a couple of times about this here and here.
  • OnItemDataBound - now, I've yet to do a benchmark comparing to member methods (just reminded myself actually, I might do one this weekend). I use to use this method all the time for nested repeaters until I saw the light and moved on to Member Methods - which as well as feeling a lot 'cleaner' than the event based approach - I feel will be significantly faster - since it avoids the overhead of events and casting required for the ItemDataBound approach.

So anyway, I will put my money where my mouth is and finally get down to writing an article about the relative merits of these approaches...but the bits I've mentioned above are based on a LOT of uses in real applications - believe me I make these suggestions not on a whim but based on a lot of trial and error!

Gettin' into SCRUM

I'm currently working my way through the book "Agile software development with Scrum" by Schwaber and Beedle [US] - gotta say, it's looking pretty good!  I'm only about half way through but so far it looks like the only development process which may actually work for a company like the one I currently work at, problem is that we tend to do quick projects with very small teams (mostly teams of 1 developer with occasional design / business analyst input) and rapidly 'evolving' (i.e., horribly mutating) requirements - so the old monolithic development processes just don't fit with the way we work. What's really cool about SCRUM is that it is designed to fit around existing development processes (such as Extreme Programming), it just gives a bit more control / visibility to the whole process.
The odd thing is that some of the best managers I've worked with  at previous companies have used very similar methods - though not actually based on this specific process, just because it seemed like the right thing to do. So, if you think there's nop development process which could ever fit in with the way your company works, check out SCRUM - you may be very surprised!

Convert a DataSet to Excel in one easy step...

I found this really useful little assembly / code when looking for a simple, free way to convert a DataSet to Excel - couldn't be easier, just one line of code required for the conversion, here's the line I'm using:

DataSetToExcel.Convert(ReportsDAL.GetSummaryStats(10, Page.FromDate,Page.UntilDate,Page.MailClientId,0,Page.MailAppId,(

int)Page.MailJobStatus),Response);

 

Visual Studio .NET is causing me pain!

You know when you get to the point where you're happily coding away then suddenly, Visual Studio .NET causes you to want to kill someone...two things are really bugging me right now:

  • Editing stored procedures - so, you use the nice designer (I believe Da Vinci is the real name of this) to create a bit of SQL in your Stored Procedure, you save it and go back to the SP - every time, it becomes read-only, meaning you have to close down the edit window reload the SP to modify it again...grr...when it happens a few dozen times a day it becomes a bit of a pain (especially when the edit you made means you can't save the SP - so you have to copy then past it back in just to fix the damn thing!)
  • Freeze during debug - pretty infrequent, but occasionally when debugging, VS.NET just hangs (actually, the ASP.NET WP hangs...and has to be killed to get it back again...very annoying)

Anyway, just had to vent a little (this stuff never happend in JBuilder :-))

J2EE Development using Visual Studio .NET

I thought this was pretty interesting - compiles MSIL into Java Bytecode so you can run C# or VB.NET (or any other . NET language I assume) on J2EE application servers. At first glance, the question qhich arises is 'why the hell would I want to do this?' but think about iot, large corps have huge investments in existing Sun etc... hardware which already has pretty expensive (usually £80k+) application servers. Anyway, the way I noticed this was this link from the BBC looks like there's a chance (though no proof at the moment) that Mainsoft could be the source of the leak...shame if this impacted what looks like a really interesting product...anyway, here's the bit from the BBC article:

In files found with the chunk of source code is information that points to Mainsoft engineers.

Attention is focussing on a file called a "core dump" that is created during a crash and helps programmers work out what went wrong.

Mainsoft said it would cooperate fully with the investigation into the leak.

"Mainsoft takes Microsoft's and all our customers' security matters seriously, and we recognize the gravity of the situation," said Mike Gullard, chairman of Mainsoft.

Experts say that a mention of Mainsoft in the code does not mean the company is the source of the leak.

Great article on CAPTCHA on 15 Seconds today - Fighting Spambots with AI

Found it as ASP.NET...this is rapidly becoming pretty much essential for any site where users can register and post text, blogs, forums, the lot...this article provides an extensive review of current uses of CAPTCHA, ways to break it and how to avoid those breaks : here's a brief bit about it from the first part of that article:

Scientific research in academia is tightly coupled with today's technological revolution. In this article we will discuss the design, development, and use of CAPTCHA (Completely Automated Public Turing Test to Tell Computers and Humans Apart). We experience various forms of CAPTCHAs in our everyday lives, for instance, signing up for an email account, performing DNS lookup (whois), or using images to differentiate between a person and a software program. All major vendors, Web portals, and email providers use CAPTCHA to improve their quality of service. Search engines and Web directories are utilizing CAPTCHA to avoid skews in their listings, possibly caused by autonomous rogue submission programs. Online polls use this technique to avoid multiple voting, as proxy addressing and/or IP spoofing makes it difficult to maintain the integrity of online polls. Protection from brute force or dictionary-based password attacks are also provided using this simple but effective practice.

First I'll describe a short history of CAPTCHA and provide a definition of Turing's test and machine vision. Then I'll define how Yahoo!, AltaVista, PayPal, and other portals use the CAPTCHA approaches in various ways to protect their digital assets. Finally I'll explain how to write a program in ASP.NET to protect a Web application from autonomous bots. Apart from the theoretical discussion, I'll explain the code snippets for manipulating images in ASP.NET and C#. Three in-depth examples will cover dynamic image generation, dictionary-based CAPTCHA style imaging, and Web services to return such images. Besides CAPTCHAs, this article will enhance our knowledge about .NET imaging libraries, on the fly image generation, and serving binary data using XML Web services.

CAPTCHA is an acronym for "Completely Automated Public Turing Test to Tell Computers and Humans Apart". As the name suggests, it's a test to distinguish the degree of being human. As defined on the CAPTCHA home page at the Carnegie Melon University School of Computer Science's Web site:

CAPTCHA is a program that can generate and grade tests that
  • Most humans can pass.
  • Current computer programs can't pass.

Firefox rules - no, not the dodgy Clint Eastwood movie!

Been playing with Mozilla Firefox - gotta say, it really is fantastic! MUCH faster than IE at loading pages, more standards compliant, skinning, better privacy settings...basically what IE should be (and would be if MS had any competition in that space IMHO).  Oh, and I wonder if they know there's an awful movie with the same name?

Where will it end?

Interesting story about George W. Bush trying to get rules to curb the proliferation of Nuclear Weapons - an admirable thing to do, Nukes are generally not good things. Did get me thinking though...the US has currently the single largest stockpile of nuclear weapons in the world, and they're the only country to have ever used nuclear weapons against another nation...hmm...makes me long for something like Arthur C. Clarke wrote about in the book 'The Trigger', a device which would deactivate all mechanised weapons instantaneously.
It's sad that we managed to get into a state where we can't get rid of such horrific weapons for the fear of the same weapon being used against us - I just can't see a way out of it, problem is, no-one trusts anyone anymore...

Brain Shutdown...oh and some semi-useful links...

Well, it's 1am, I have at least 8 hours work ahead of me but my Cerebral Cortex has unfortunately decided to cease functioning. I'm also listening to the .NET Rocks show where Chris Sells and Rory Blyth interview Carl Franklin...hmm...Carl si currently going on about some conference they had at Microsoft - feeling pretty isolated in my little flat in Edinburgh right now we never seem to get anything good up here and my company is really too small to send me on any conferences etc...ah well, just have to settle for observing from the sidelines.
Well, I really should get back to my app, just a bog standard reporting application for my bulk mail thing - I really have to get time to play with SQL Server 2000 Reporting Services it looks really useful, think Access-like reports with all the power of SQL server as well as full VS.NET designer support...well, I'll get time at some point!
While I'm procrastinating, I thought I'd mention a few of the controls I'm using in this proejct...first is WebChart, an excellent free WebCharting control, lets you do lovely graphs to impress your clients!
Next up is Denis Bauer's DynamicControlsPlaceholder - which if you haven't used yet - you should. I mention this control a lot but is really is fantastic for ASP.NET with dynamic UserControls.
Next...TaskScheduler, a phenomenally useful C# wrapper for the Windows TaskScheduler - now you can run tasks whenever you want!
Right, enough...gonna get some coffee (Whittards Guatemala Elephant, gorgeous chocolatey coffee perfect for espresso)..then try to get back into doing some work (might have to turn off DotNetRocks - getting a bit wearing!)

New version of BlogJet - now with HTML Source Editing!

From Jon Galloway's blog, a new version of BlogJet - with a bunch of new features including, finally, HTML Source editing - this is fantastic news!

New BlogJet!

Well, it's beta, but I'll take it - it adds HTML source code editor!

Download it

Release notes:
BlogJet 1.0.0.14 BETA Release Notes
February 11, 2004

FEATURES
* HTML source editor with highlighting and code completion.
* Indent/Outdent (for those who use <BLOCKQUOTE>'s).
* Link text and target in Insert Hyperlink dialog.
* Post Properties (allow comments/pings) for MovableType, Blogware and TypePad.
* Link insertion with drag-and-drop.
* Hotkeys for top-level menus.
* New progress indicator.
* New sweet icons for categories.
* New About window.
* DasBlog support.

BUG FIXES
* Fixed issues with View History in TypePad.
* Deleting entry now forces blog republish.
* Fixed issues with images path.
* Fixed deleting post which is being edited.
* Fixed various bugs with Micro Editing mode.
* Minor fixes.

Very nice free bits and pieces from Lumisoft

I was hunting for some POP3 stuff in .NET when I happened across this thing, basically a fully-featured POP3 / IMAP/ SMTP / WebMail client written in C# with Source code for free! It's really nice and basically provides all the bits I need for my POP3 mail toy I'm working on (basically for handling bounced emails from a bulk mail system). I've yet to poke about in dasBlog to see how they do POP3. Anyway, Lumisoft, the company behind this also have a bunch of other projects which are really all pretty nice...

ASP.NET Resource Kit

Kent Sharkey writes that this is currently down again - seems that some people were a bit quick off the mark in posting the download...anyway, keep checking, apparently there's going to be a couple of pages with some more info about it there as well

Found out about this from John Mandia's blog, full of lovely components and other stuff for ASP.NET -  you really should download it! I'll post a bit more about it once I've had a play...

UPDATE: John just posted on the MsWebDev group with sopme details of the components it contains:

Basically a few very useful components:

* ComponentOne

This special edition of ComponentOne Studio for ASP.NET includes a development license for all of the Q2 2003 versions of ComponentOne Studio for ASP.NET (WebForms) components. Studio Enterprise for ASP.NET is a comprehensive suite of components including grid, reporting, charting, data, user-interface, and eCommerce components for ASP.NET.

* Infragistics

Infragistics

Infragistics NetAdvantage 2003 is the ultimate framework of presentation layer components available for COM, .NET (rich client Windows Forms

components) and ASP.NET (Web Forms components). It includes best-of-breed grids, charts, toolbars, menus, tabs, trees, web navigation components, GUI components, listbars, explorer bars, editors, and much more, 88 components in all. Always innovators, Infragistics offers as part of Infragistics NetAdvantage 2003’s Subscription and Enterprise Editions full source code for all of its .NET and ASP.NET components. This source code allows the developer not only to feel secure in his/her purchase, but serves as an ideal learning and debugging tool. Gain the advantage now with the NetAdvantage 2003 by installing the NetAdvantage ASP.NET grid (included on this CD). The NetAdvantage ASP.NET grid is an advanced grid with true hierarchical support and unbound mode, allowing you to provide a rich-client look-and-feel in your ASP.NET application. Click here to learn more about these products.

* /n software

IP*Works! CC ICharge provides and easy-to-use interface for communicating with major Internet Payment Aggregators (Payment Gateways). As a true .NET component, ICharge can be easily integrated in ASP.NET applications and provides a fast and easy solution for businesses that need to accept credit cards. By offering a common interface to all major gateways, ICharge isolates developers from differences in gateway interfaces, thus simplifying development and greatly reducing integration costs. Install IP*Works! CC ICharge and try out this cool control.

* SAX.NET

Sax.net Security for ASP.NET allows you to protect your server from automated programs. A web page that contains the Sax.net Human Verification Component acts as a virtual gatekeeper who ensures that only real people and no automated programs fill out forms on your site. The component does this by displaying a code in an image that cannot be read using Optical Character Recognition and requiring the user to enter this code in a text field. If the code matches, you can be sure that you are dealing with a real person and proceed. If the code doesn't match, the validation for the page will fail and an error message will be shown. Install Sax.net Barcodes for ASP.NET and Sax.net Security for ASP.NET and try out these cool controls.

* telerik

telerik r.a.d.rotator is a multipurpose component for DHTML content rotation and personalization. From stock tickers and news scrollers, to product spotlights, weather forecasts, testimonials, running promotions and banner ads, r.a.d.rotator delivers high interactivity and user involvement. The product is extremely easy to customize through flexible frame templates. The rotated content can be obtained by databinding with XML files, strings or streams, DataSet, DataReader, or ArrayList. telerik r.a.d.spell enables developers to add multilingual spellchecking capabilities to their ASP.NET applications. The component is completely customizable and can be attached to any server- or client-side editable element (textbox, div, iframe). It currently supports 18 languages and can have custom user dictionaries for every language. Install telerik r.a.d. rotator and telerik r.a.d. spell and try out these cool controls.

Plus walkthroughs, articles, hosting offers etc.

Pretty good and worth the download.

John

Recruiters...morons!

Don't know why I expected any different, especially with this post...Talking to a recruitment consultant today...interesting experience...apparently my experience as a J2EE architect has no bearing at all on .NET - as the two are related in no way. Also the fact that I'm up against (according to her) 'guys with 3-5 years ASP.NET experience' puts me at a disadvantage - since I have no time machine.
I don't know, I am seriously considering just packing the whole gig in - the problem is, there's no way for me to know which of the dozens of possibles these roles are for, I have to go through this woman who has no idea what an architect is (she seems to think I'm mostly a systems admiistrator). So - here's the deal, if you are a semi-intelligent company in the UK (or know of one) who thinks they have an interesting contract for me (and of course, I'll send my CV on to you - mine is accurate in contrast to most of the ones you'll see) please get in touch at scott@mostlylucid.co.uk

Moving on without making your old company feel bad...

Well, as you've probably gathered from recent posts, I'm seriously considering moving on to pastures new, this brings up a dilemma - how do I leave my old company (when / if it comes to that) without making them feel like they've done something wrong?
What I'm trying to get at is, the place I work right now is a great little company, very little politics, nice small team, in short if you like that sort of environment it's ideal, my problem isn't with the company, it's with my skillset and development. You seen, whatever happens with the company I'm at right now, they just don't have large teams / sturctured development plans / strong methodologies / test-driven development, why? The answer is simple, they just don't need it,  the clients don't want it and there wouldn't be much benefit from it (our projects tend to be quick, straightforward 1-2 man projects).
Problem is, I do want those things, I feel like I'm treading water right now just reusing the same skills over and over without actually learning anything new - for some that is just peachy, it drives me nuts!

So, in short, I plan to leisurely look for a new role, I'm not just going to jump ship with no warning and I'm not going to leave my current company in the lurch (in other words, I plan to finish all projects to which I'm currently committed if possible). Which leaves me with a problem, they probably already know what I want to do(I know at least one other person at my company reads this blog for starters...), and  I think I'm  a pretty valued employee - so, how do you leave a perfectly good job and leave things amicable between yourself and the company you plan to leave? (and why does this sound so much like marriage guidance?)

MonoDevelop - SharpDevelop on Linux w/ Mono

Just found out about this, MonoDevelop is a port of SharpDevelop to Linux using Mono (more news) it actually looks pretty good, I am really going to have to try this out - I'm all for MS but some clients just won't consider using MS products, being able to offer Linux / Apache based hosting for apps developed on MS platforms (maybe using MySQL) would just rule...

Taking the leap...

I'm ALMOST decided that I'm going to move from full-time to contracting / free-lance work. Got my 'Start your own business' book, and am reworking my CV to be more suitable for this type of role...all I have to do now is actually get up the nerve to pack in my job...any tips, what's the best way to start contracting?

Couple of nice articles...

Got these from ASP.NET - yes, I am well aware that everyone who reads this will have seen these there...it's really just to remind me!

Anyway, great article on  DotnetJunkies about Base Pages - these are just incredibly useful when trying to build a web site which has common functionality between pages without using some sort of template system like MasterPages.

The second is an article on WWWCoder on an email tracking system - which is really nice (and annoying, I just wrote this same functionality for a mail project I'm working on grr...).

Anyway, that's it for now...better get back to work before I get fired...

Excellent post on testing practices...I really wish there was an easier way to integrate 'Watson' into all applications...

Chris Pratley posted this lovely long post on bugs and testing, he also covers some stuff about 'Watson' that little dialog which pops up when an application crashes inside Windows XP, very interesting stuff...I just wish an application block were avaialble which lets me duplicate the functionality for all of my applications, imagine how handy that would be!

Grr...why is Visual Studio so sucky with Source Control!

I'm really at the end of my tether with VS.NET and source control. I'm working from home this morning, accessing the office Sourcesafe over my VPN using SourceOffSite - fine, SourceOffsite is a great product, just VS.NET seems to just lock up totally when accessing any form of Source control. I suspect (as I've used various types of source control provider) that the issue is with the SSAPI in VS.NET.

Why is it that it's so much more pleasant to use SourceSafe with JBuilder (and now C# Builder) than it is with VS.NET? Just one more reason to stop using VS.NET if a comparable compeitor arrives...Intelli# IDEA anyone??

Oh dear..."Janet Jackson and the Publicity machine"...

Pretty sad really, why didn't they just accept it was planned...anyway, this article has the best pictures and the full story...(warning, contains picture of Justin Timberlake looking 'concerned' - not for the faint hearted)

Geek hero...someone actually called their child Version 2.0!

I just love this...especially as I'm currently going for me V1.1 (wonder if I should use that title :-))...

Consultancy in the UK...

Theoretically :-) if I wanted to become a consultant in the UK - how would I go about it, where would I find contracts? Does anyone know if it's possible to do this and still live in Scotland?

Wow - IntelliJ is doing IDEA for C#!

I used this IDE a fair bit in my Java days, all I can say is WOW! It really is an awesome IDE - check out some of the features! So I am really pleased that there's a plan to release a version of IDEA for C#. Found this on Stefan Demetz's blog...
If Roy is reading...calm down...just breathe ;-)