DDD South West


This weekend was DDD South West, part of the ever increasing DDD brand, run by Guy and his crew, who did a most excellent job as usual. Situated at the University of West England in Bristol, we had perfect weather to accompany the great talks, and for once I saw a talk in every slot. I started out with Liam’s talk on software development and how not to go bust, a feat which I’ve barely managed to accomplish. Next was Chris Alcock and reactive extensions; I’d seen Jon Skeet do a talk on this a few weeks ago and wanted to learn more, and Chris’s talk was pitched perfectly; lots of simple examples, giving a really good overview of the features and uses. I finished off the morning with Phil talking about crap code, a session that was mostly a WTF list of things not to do. It turned into a good discussion and really brought the audience together, since it seems almost everyone has seen (and written perhaps) code like this.

After lunch was jQuery with George Adamson, which for me was the best talk of the day. I know enough about jQuery to not have to concentrate too much, which left me to really enjoy George’s style; there’s a little bit of mad professor in him I think, and I really enjoyed both his style and the talk itself.

I finished off with my talk on Clean User Interfaces with WebForms, which despite the good marks, I wasn’t really that happy with. It needs more content I think. Phil suggested taking a few bad WebForm pages and working through them to clean them up, and since I’m doing this talk at NxtGenUG next month, I’m going to make some changes to add a bit more practicality to it. I was generally happy with the deck though, which was a big change for me; just pictures, no bullet points. I’m not sure that style will fit every talk I do, but I think it worked for this one. Plus it had kittens. The deck and sample application can be downloaded from the samples page.

Overall it was a great weekend, and with 300 people attending it shows what a great community we have in the UK. Lots of motivated people, new speakers, great talks.

Flickr Tags:

author: Dave Sussman | posted @ Tuesday, June 08, 2010 9:24 AM | Feedback (0)

Site Map Security Trimming With WebForms and Routing


The routing framework that was introduced with MVC has been available for use in WebForms since version 3.5, but doesn’t integrate well with some existing features, notably security trimming with site maps. This is where the site map provider will honour authorisation, only showing nodes for which the user is authorised. The trouble is, the url in the site map would be a route url, not the url of the physical file, so the security checking on the node doesn’t work. It doesn’t fail, just doesn’t work at all.

The solution is to customise the provider, which is easy enough since the code for all the providers is available at http://tinyurl.com/ASPNETProviders. Modifying the XmlSiteMapProvider, you can add the following:

public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
{
    if (!this.SecurityTrimmingEnabled)
        return true;

    SiteMapNode newNode = node.Clone(true);

    if (!string.IsNullOrEmpty(node["routeName"]))
    {
        Route r = (Route)RouteTable.Routes[node["routeName"]];

        if (r != null)
        {
            newNode.Url = ((PageRouteHandler)(r.RouteHandler)).VirtualPath; ;
        }
    }

    return  base.IsAccessibleToUser(context, newNode);
}

This simple looks up the route name in the route table and gets the url of the physical file, passing that through to the base security checks. You also need to add the routeName attribute to your siteMapNode, so that an easy lookup can be done. You could iterate over the site map nodes finding the right one, but this is a slightly faster solution, although “faster” may not be that measurable.

author: Dave Sussman | posted @ Wednesday, June 02, 2010 9:15 AM | Feedback (0)

Fixing Internationalisation in ASP.NET


I’ve just read this blog post and while I’m keen to encourage localisation of web application and anything that makes it easier, I’m curious as to why Jason feels the need to say that localisation is “hopelessly broken in ASP.NET” and you have to do all the localisation by hand, for every control. There’s no comments feature on his blog, which is why I’m commenting here.

I’d agree that localisation in ASP.NET isn’t perfect; the server code has to have the additional meta resource keys, and you have to wrap all text to be localised, but this doesn’t have to be done by hand. Visual Studio will automatically parse the page, adding the meta resource keys to all controls that are localisable and creating the resource file for you. Yes it’s an XML file, but Visual Studio has an editor for it, and there are other tools I’ve seen that allow editing of resource files, so it’s not like you have to hand edit the XML. It’s obviously harder if you need an external person to do the translation, but not that much harder.

The other issue I have is Jason says:

In practice, it's so much extra work that nobody actually does it. That, my friends, is the reason you hardly ever see any multi-language websites written with ASP.NET.

That’s a really sweeping statement and completely misses the point. Most people don’t do localisation because they don’t care; English is their major language, a language spoken by the majority of the people they target their site to, so it’s just not relevant. It’s also a much bigger issue than just the text on the page, with database text (eg product descriptions, etc) requiring the same treatment, support for right-to-left languages, etc.; those, I’d agree, are areas where ASP.NET’s localisation falls down.

In the spirit of fairness, I too admit to not having localised many sites, but those I have done have been done very quickly. Yes you have to process each page, which is a burden, but a relatively small one since Visual Studio does it for you. I have a fairly large application to localise soon and it will take me a while to go through all of the pages, but the real effort of what I need to do is support right-to-left languages, so it’s not just the text that needs changing, but the entire site layout. That though, is another issue.

Jason’s idea is sensible in some areas, in that if you code from scratch using his method, then localisation is simply a matter of the source text, so you don’t need to touch your site at all. Likewise, I could have done the same with every site I’ve done, using the built-in features. Jason’s method might fit you better if you’re in the MVC space or have come from another framework.

I don’t wish to be negative about this Jason; please continue to localise sites and to push localisation as a good thing to do. Use whatever method is suitable. But don’t discourage people from using the built-in methods when the tools provide some great features; let’s tell everyone all the methods available, give guidance on the pros and cons of each and let them pick the best for their needs.

author: Dave Sussman | posted @ Tuesday, March 02, 2010 9:45 AM | Feedback (1)

Windows Media Centre – Does the UK care?


I’ve been a big fan of PVRs for years, buying a TiVo for the few months they were available in the UK. I retired that and bought an Acer Aspire iDea 500 as soon as it was released in 2006, it being the first MCE machine designed for the UK; Core 2 Duo, quiet(ish), plenty of connections, including SCART, which given my ancient CRT TV is a requirement. To this day it’s one of the few, if perhaps only, machine with SCART. These days plasma and LCD TVs are easy to connect to, but any CRT TV in the UK is SCART based.

Recently the power supply on the MCE box failed (a common problem it seems, which could be why Acer don’t make it any more), but a new one was sourced, more memory was added and I installed Windows 7. It’s perhaps a little underpowered, the VFD display doesn’t work, but otherwise is mostly excellent. Occasionally, and for the last few days, a couple of channels are suffering massive breakup and are therefore unusable and won’t record. It could be the transmitter, the weather, or maybe one of those fat pigeons I see in the garden, sitting on the aerial. My Windows 7 machine upstairs has no problems, nor does the TV itself, which puts it down to a tuner/driver issue, but given the MCE box under the TV isn’t officially supported by Windows 7, I have little come back. But I can’t live without it and can’t afford a new one. So I’m left to rant, like the old man I am.

Looking around, there are very few dedicated MCE machines in the UK, even fewer designed as one you’d want under the TV. There are a fair number of dedicated PVRs, obviously cheaper, but more limited in capabilities than MCE and from what I’ve seen, mostly having awful UIs that are hard to use. No one seems to care. Hardware manufacturers don’t, and I doubt Microsoft do either. There’s so little MCE in stores that most people haven’t heard of it. A PVR is a consumer product, sold alongside TVs, literally, shelved underneath them in the stores. An MCE machine? Well, computers are over the other side of the store; they’re computers, not PVRs, right?

And anyway, I’m not sure I’d recommend it for the general public anyway. So many have enough problems with PCs that a PC under their TV controlling the recording of their shows, just isn’t sensible. A dedicated PVR, at around £100 and you don’t expect perfection and is almost an impulse buy; a PC for £500, well, you think twice about the cost and expect it to work. All the time. No problems.

The MCE interface itself is consumer ready, but everything around it isn’t and until these things get to the white goods level of simplicity I doubt they’ll ever take off big time. Apart from Windows and Office, Microsoft’s penetration into the consumer market in the UK is so small that it’s no wonder things don’t get released here. The vicious cycle of “no product, no demand” just escalates. The Windows Phone 7 Series will be interesting once it reaches these shores; a device firmly aimed at consumers might raise awareness and might be the tip of the iceberg for Microsoft realising that the UK actually exists.

author: Dave Sussman | posted @ Thursday, February 25, 2010 12:31 AM | Feedback (0)

Want to be an author?


Since I don’t have time to write books at the moment, I’m forwarding this to world. Packt Publishing, are expanding their portfolio and looking for books on Visual Studio Integration, Administration and Reporting.

Packt Publishing today announced their plan to advance their line up of Enterprise focused titles, and invited potential authors with Visual Studio skills and book ideas.

When it says today, it actually means last week, but I’ve just found out about it. If you’re interested in writing Visual Studio books, Packt wants to hear from you! Please visit the Packt Authors Website for submitting your book ideas and title suggestions.

Other publishing companies exist. Your royalties may go up or down depending upon the economy.

author: Dave Sussman | posted @ Wednesday, February 10, 2010 12:09 PM | Feedback (0)

The Conference Speaker’s Dilemma


Gary has an interesting post about conference feedback, in particular around the usefulness of a session. As both a speaker and organiser, I was going to reply in the responses, but maybe it’s worth a broader audience. Is the usefulness of a session actually relevant to anyone at all? I go to plenty of sessions that aren’t useful in my day to day job, but that doesn’t mean it wasn’t a good session or I didn’t enjoy it. Here’s what I make the choice based on:

  • Do I have a pressing need to learn the topic and will the session give me the knowledge I need? It’s mostly about pointers to the technology, the speaker’s insight, that one nugget of information that makes it worthwhile.
  • Do I enjoy the speaker? Sometimes a session is worthwhile just because the speaker is entertaining, even if I know I’ll get nothing out of it.
  • Is it something I know nothing about? I sometimes attend sessions I know will have little or no impact on my daily work, just because I feel I ought to have a passing knowledge of the topic; sometimes that’s even as slight as what the heck it is.
  • Is it something I know I’ll never master? I’ll attend lots of design and user experience talks, because those are particular interests of mine. I know I have limited (none, some would say) design skills and am intensely jealous of people who do. But I go in the faint hope that some of the sparkle will rub off.

Assuming I stay through the session, or the majority of it at least, I’ll always leave feedback, because as a speaker I know I value that feedback. If I did badly I want to know why, which is why it’s so frustrating to receive a low score with no indication of why. I once had “terrible session” written alongside a low score; if I’m so bad, how am I going to know why you thought it was terrible? My response is “terrible feedback”. Still, it beats “didn’t like his accent”; sorry, but it’s the only one I’ve got.

Now technical knowledge, speaker ability, etc, are easier to score numerically, and these are valuable to the organiser. But usefulness? Maybe for a big conference, trying to gauge the sessions to include, but for smaller events such as DDD, where the topics are picked by the public? Don’t blame the conference or the speaker if it wasn’t useful, you picked it. Now it’s a different matter it the session didn’t match the abstract, as that’s what you made your decision on, and that is useful information; maybe the speaker didn’t write a concise enough abstract, or got off topic, or any number of other reasons, but don’t just say it wasn’t useful, say it didn’t match the abstract.

I’m not suggesting we get rid of usefulness altogether as a question, it can help balance the other scores (eg a new speaker, with nerves, who doesn’t perform well, but still provides useful information). Maybe we just need to force a textual response if the usefulness is scored low. Or perhaps if any session is scored low.

Once of the biggest problems conference organisers have is getting feedback, and therein lies an immediate dilemma. The paper feedback form, handed in at the end of a session (or the day) gives you the immediacy; you’re less likely to forget what you thought of the session, but sometimes you need time to think about it. Plus, the organisers need to type all this information in if they want any form of analysis. On the other hand, the online form is convenient for later analysis and probably easier for attendees, but lacks the the ability for immediate response, unless it’s available during the session and there’s a network connection available.

So ultimately this comes down to a plea. If you attend an event, no matter what size, and are asked for feedback, please give it; make it useful feedback though, tell us what did and didn’t work, what you liked and what you didn’t. Certainly for UK events, where we have an active community, all of that information gets shared, so all events benefit.

author: Dave Sussman | posted @ Monday, February 08, 2010 12:20 PM | Feedback (0)

ASP.NET Web Forms and MVC


I’m not really sure I need to blog this, because if you read this blog and not Scott Guthrie’s I’d be very surprised, but Scott just posted about technical debates, including WebForms versus MVC. Worth a read, including the comments.

author: Dave Sussman | posted @ Monday, January 25, 2010 8:47 AM | Feedback (0)

RedGate SQL Search


I’m a big fan of RedGate’s tools, and their next little one has hit beta. SQL Search provides a quick and simple way to search for, and through, objects on SQL Server and is invaluable if you have a large number of objects. It’s fast, unobtrusive and works really well. Go give it a try.

author: Dave Sussman | posted @ Thursday, January 21, 2010 12:29 PM | Feedback (0)

WebForms aren’t dead


The post could equally be about me, given my lack of content recently, but clients, lack of time and general apathy all play their part. However, what I really want to say is mostly explained by the title, that of the future of WebForms, in particular that they have a future. A lot of what we read in blogs, articles, etc is MVC related and that’s fair; it’s still relatively new to the ASP.NET arena, and new and shiny always gets press; WebForms had lots of coverage when it was released – it was “A Big Thing”. Those that blog and speak at conferences and user groups tend to be the ones passionate about their technology, the vocal few who believe strongly, and it’s easy to get sucked into the new technology vortex, the belief that what they are saying applies to every project you are on.

Recently on a mailing list I’m on, there’s been a thread about MVC versus WebForms. Lots of good arguments and one exceedingly well constructed message from someone important; I hope it gets blogged because it will go a long way to quell the fears that many have, that WebForms is a dying technology. It’s not. It’s still being actively developed (the WebForms and MVC teams are about the same size) and still plays an important part in Microsoft’s web strategy.

The thing is, there are good and bad points for both frameworks and which one you use depends on many factors: the project requirements, available skills, etc. Here’s my take.

MVC

Advantages

  • Complete control over UI. With no server control framework you can construct exactly what you want, how you want, making it easier to use script frameworks.
  • Great for Test Driven Design. The separation between components makes TDD much easier. It doesn’t solve all your TDD problems, but it does make them easier.

Disadvantages

  • More UI work. Since you don’t have a rich set of controls, you have to create your UI yourself, although there are helpers to, well, help.
  • Learning curve. While MVC isn’t hard to learn, it’s very different from WebForms, so don’t think you can just jump in.

WebForms

Advantages

  • Maturity. It’s a well established, stable framework. Don’t confuse older with superseded.
  • Control framework. The rich set of controls make pulling together a UI very quick. That can have disadvantages, but if you know what you’re doing the UI can be almost as clean as an MVC one.
  • Postback and ViewState. Yes they are hacks on top of HTTP and can cause many issues, but they work very well for what they were designed for. The event based lifecycle is very easy to understand, especially for beginners.

Disdvantages

  • ViewState. The defaults produce more ViewState than is really necessary, leading to larger pages.
  • Test Driven Development can be hard, especially testing UI code. Abstracting as much code out of code-behind files can help, but you’re still bound to the postback architecture.

That’s just my top picks, there are plenty of other points worthy of mention. I’m a big fan of WebForms, but that doesn’t mean I don’t like MVC too. Bits of MVC I don’t like, in particular the standard view engine (I’ve never really liked inline <%%> code , even in ASP and ASP.NET WebForms, but that’s a personal thing), so I’d probably use Spark View instead. The one thing I’ve said right from the very first previews of MVC is that it needs some form of control architecture; not server controls, because remember, there’s no page lifecycle, but controls to abstract the common rendering; some people, including myself, find the <%%> hard to read, while a declarative control is easier. I doubt a control framework will appear when the helpers work so well, hence my preference for another view engine, which is another advantage – better pluggability. I like the controller architecture, and routing (oh, and routing is supported in WebForms too).

It’s also important to remember that not every project has the same requirements. Two projects I work on are WebForms, mainly because they predate MVC, but even if they didn’t, I’d still use WebForms. Why? Well they are both Intranet/Extranet applications, low numbers of users; one has lots of data editing via forms, the other less so, but still enough that WebForms and the UpdatePanel (yes, I use the UpdatePanel) work perfectly well. Page size and rendering performance aren’t an issue in these applications (and considering that one of them uses databases with 30-50 million rows of data; rendering is a minor issue compared to database performance).

And furthermore, both MVC and WebForms are just a part of ASP.NET; remember all the services (membership, roles, etc), providers, and so on, that are fully supported by both frameworks. ASP.NET 4.0 improves WebForms and although the changes look small, they have an important impact on the framework. Just because WebForms isn’t evolving at the same rate as MVC, doesn’t mean it’s been forgotten. WebForms doesn’t need to evolve so fast.

Scott Hanselman did a blog post on Dynamic Data, which is a good read in itself, but at the bottom there are a bunch of links to WebForm resources. Some may talk about MVC, but there’s still plenty of movement on the WeForm front.

author: Dave Sussman | posted @ Thursday, January 21, 2010 11:42 AM | Feedback (7)

Silverlight Bing Maps Zoom Scrolling Bug


If, like me, you’ve just upgraded to the V1 release of the Silverlight Bing Maps Control, and are wondering why the mouse wheel no longer zooms the map on browsers other than IE, it’s because you’ve got Windowless set to true. Eg:

<asp:Silverlight ID="Xaml1" runat="server"
Source="~/ClientBin/SilverlightApplication1.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%"
Windowless="true" />

 

The solution is to set Windowless to false, or remove the attribute since false is the default. Of course, if you need windowless, then you might have to wait for a fix, or use IE.

There’s a post on the forums where you can document and discuss bugs.

author: Dave Sussman | posted @ Wednesday, November 11, 2009 12:24 PM | Feedback (0)