Archives

Archives / 2007 / October
  • Check if Unique Constraint will be violated before Insert with LLBLGen

    I needed to determine if a unique constraint would be violated so that I could programmatically update the Name of a business object to make it unique today.  I use LLBLGen for this project's database layer, and I have a unique constraint (actually a unique index) set on the database.  In this case it covers two columns, an integer ID and a string Name, but the nice thing about LLBLGen is that it provides helper methods that generate the predicate needed.  The code required looked like this: public static bool CampaignNameInUse(int advertiserId, string campaignName){  using (DataAccessAdapter adapter = new DataAccessAdapter())  {    CampaignEntity … more

  • Limit Rows In DataTable or DataSet

    I wrote some quick and dirty ADO.NET code to go against an RSS feed instead of a flat XML file today.  In the process I had to figure a way to limit the number of rows returned by the function, which returns a DataTable.  The simplest method I found was this one, which uses the DataTable.Select() method.  Using this technique, you could also pass in a sort parameter (second parameter to Select()) which would let you grab the top N rows from the DataTable after sorting it on whichever column you wished (syntax for sortexpression is "column" which defaults to ascending or "column DESC" for descending).  And of course you can also do a filter, etc., but I didn't … more

  • Silverlight Detection and Installation

    Tim Sneath just posted some tips for optimizing the Silverlight install experience for your site's end users.  I've noticed many people on mailing lists and forums discussing (lamenting) the fact that Silverlight's install process requires the user to leave the site they're on, but this is not the case.  Silverlight supports two modes of installation: direct and indirect.  Direct means the installer launches directly from the website the user is visiting.  Indirect redirects the user to download Silverlight from its source website, after which they can return to the original site.  The inplaceInstallPrompt parameter in the CreateSilverlight.js file controls whether … more

  • Google PageRank Deductions

    There's a great deal of discussion going on this month about recent deductions Google has made to Toolbar PageRank (not real PageRank) in October 2007.  ASPAlliance.com, a well-respected developer site (IMHO) with a ton of content, was dropped from a TBPR of 7 earlier this month (which it's had forever) down to a 4 (ouch!).  Apparently this is shared by Forbes.com - hardly nefarious black-hat sites here.  Based on a variety of sources, the issue seems to be that the site has a few sponsored links to relevant related content, such as ASP.NET shopping cart and charting controls and web hosting.  Sadly, Google is strong-arming publishers into compliance with this … more

  • VaryByCustom Caching By User

    Ran into an interesting bug today with one of my applications.  A user control that provides messages based on a user's account was showing the wrong information to other users in our testing.  The user control was set up with an output cache directive and a VaryByParam="*" setting, yet it was showing other users' messages (one in particular) to basically everybody - not good.  The funny thing was, it was only doing it on one server instance, not on localhost, despite its having the same code and same database. Well, we quickly figured out that this was a caching issue.  The problem was that everywhere in the application, the account the user is accessing is specified … more

  • One Week to DevConnections

    The Fall 2007 DevConnections conference is next week in Las Vegas.  This is definitely going to be the biggest conference in the United States for developers for the second half of 2007 (TechEd being the only larger one this year, I think), and I'm sure the show will be bolstered significantly due to a lack of a PDC event this year.  This show has nearly sold out and already has nearly 5,000 registered attendees. Can't come?  Be sure to follow along on the DevConnections Blog. I'll try to blog about some of my experiences, as usual.  I'll be speaking on the following three topics: ASP.NET AJAX Control Toolkit ASP.NET Personalization and Membership Test Driven … more

  • TFS Beta 2 VPCs Expire November First

    In case you haven't seen this news from last Friday, the TFS Beta 2 Virtual PC images have an operating system timebomb in them that is set to expire on 1 November 2007.  This is not, however, the end of the world if you have been using these builds for demo or test purposes, though if you've got them in anything close to a production mode you'll have problems.  Jeff Beehler's follow-up post describes exactly what will happen when the date is reached/passed, and some workarounds for it.  From the sounds of things, you'll have about two hours per reboot of the machine before it forces a reboot due to the timebomb.  That means you should be able to use it for most demo … more

  • BrowserHawk 11 Released

     CyScape recently announced the latest version of their browser capabilities control, BrowserHawk 11.  While I haven't had a chance to review this new product yet, it touts some new features that at least appear to be pretty compelling.  I use BrowserHawk and CountryHawk for LakeQuincy's advertising solution, AdSignia, to quickly determine each ad request's geographic location, allowing for certain ads to be targeted accordingly.  We also pull some data from the user's browser which we use primarily for statistical analysis (for example, what percentage of our users are running a particular screen size). It's a rock solid and very fast set of products … more

  • Render User Control as String Template

    Scott Guthrie has a great example of how to use an ASP.NET user control as a template which one can dynamically bind to data and then pull the results out as a string.  One place this is useful is in AJAX scenarios in which you want to replace the contents of a region of the page with the rendered output of a user control.  I'm using this very successfully in Lake Quincy Media AdSignia for our dashboard pages, to enable me to load the page instantly and then dynamically fetch the individual charts and dashboard controls asynchronously via ASP.NET AJAX.  I'll be writing up a full article on this whole process soon, but for now I just want to show my version of ScottGu's … more

  • Hosting Company Breached

    Fasthosts, "the UK's number 1 web host" (by self acclamation I'm sure) is in the news today because apparently all of their customers' passwords (in plaintext) were compromised by a security breach.  They've asked all of their customers to change their passwords immediately, and of course since many people use the same passwords on multiple web sites, the breadth of this breach could be quite large. I first heard about this on Brad Kingsley's blog, and I have to share Brad's thoughts on the one thing Fasthosts said that makes no sense whatsoever (and if you read the comments on the Register article you can see most people share this opinion).  They claimed: "Historically, … more

  • Sharing Resources Between Projects in .NET

    ASP.NET has some great support for Resources (for localization and internationalization, mainly), but unfortunately by default they're limited to the same project because they're generated with the internal keyword.  I wanted to be able to share common strings for things like Exception messages, format strings, and default messages between members of my business objects and within my ASP.NET application, without duplicating the resources between these two separate projects.  I did some searching and found a great writeup by Rick, but it didn't quite do the trick.  However, fellow RD Guy pointed me to this great tool on CodeProject that "just works".  It does two things … more

  • Cruise Control Configuration File Editor

    One of my developers is doing some work on our Cruise Control setup and found this gem that I'd somehow missed: CCNetConfig.  A slick little GUI for editing your ccnet.config file (screenshots).  Seems to work well enough for most of the common settings - I haven't used it enough myself yet to really fully review or evaluate it, but the project seems to be pretty active, and it's open source so if you really need something to work, you could always add it... more

  • ASP.NET Model View Controller Architecture

    A little while ago, Scotts Guthrie and Hanselman presented on MVC in ASP.NET (and Dynamic Languages) at the oddly named ALT.NET conference in Texas.  I'm with ScottH that "Alt" is a pretty silly name and something like Agile or Pragmatic would be a much better descriptor.  Alternative is not terribly descriptive since anything that differs from the norm is alternative, and not necessarily better.  It reminds me of how all music sought to be "alternative" regardless of its actual style just to earn cool points.  And nevermind that calling something alt.net and not actually owning that domain name is just asinine.  Incidentally, you can find the conference's actual … more

  • Welcome New INETA Speakers

    Please congratulate these new INETA Speaker Bureau Members: Todd C. Bleeker Don Demsak Mark Dunn Daniel Egan Markus Egger Caleb Jenkins Nickolas Landry J. Ambrose Little Kevin McNeish Mark Michaelis Mark Miller Jeffrey Palermo John Papa Rod Paddock David Yack I know about 2/3 of these individuals and they're all definitely knowledgeable and will make great additions to the INETA Speaker Bureau.  Congratulations! I'm a bit late with the news, I apologize.  For more, read Julie's earlier welcome post.  At least I was nice enough to link to all of their blogs/websites... more

  • Caching Talk in Phoenix

    Tuesday night I gave a presentation on caching in ASP.NET (with a bit of async performance tips thrown in at the end) to the Arizona .NET User Group in Phoenix, Arizona.  A lot of the demos were similar to ones I've given before, including in my recent DNRTV Show on Caching.  I've posted the samples from Tuesday night's talk here, which include the async demo I did as well as an updated version that uses a templating approach for loading up the user controls.  I expect to have a full blown articles and/or video on that topic soon. more

  • Open Source .NET in 3.5

    ScottGu just made a very exciting announcement - as of Visual Studio 2008 and .NET 3.5, the base class libraries will ship with source and debug symbols!  What this means to developers is we'll no longer need to resort to tools like Reflector to see what is going on under the covers when we use framework libraries.  These libraries are being released under the Microsoft Reference License (MS-RL), and can be browsed locally as well as being used within the Visual Studio debugger. In addition to making it easier to see why a certain thing is failing or behaving unexpectedly, this will also make it much easier for developers to see real examples of the established patterns and … more

  • Nice Products for Developers

    We have a new intern starting with us at Lake Quincy Media today, and in the course of getting him set up, I thought I would mention of a few products we're using that work quite well for us here.  The first one relates to training new interns with limited real world programming experience (Kent State University doesn't do us any favors here - no Microsoft technology, no SQL technology, and no web technology has been covered for most of their computer science graduates, much less students).  For training, we use and have been very happy with AppDev.  (sidenote: neither AppDev nor KSU's web sites works without a www. prefix, making both of them unnecessarily difficult to access … more

  • Caching in ASP.NET Show on dnrTV

    I'm on dnrTV this week with a show about Caching in ASP.NET, one of my favorite topics.  I think the whole show is a bit under an hour and I go through a bunch of demos and show off some of the less-well-known features of caching, such as cache profiles, programmatic output cache invalidation, and the Substitution control that lets you have dynamic contents on a fully output-cached page.  I also cover SQL Cache Invalidation and Micro Caching, the demo that helped win me Speaker Idol at TechEd 2007.  It was fun to record and I hope you enjoy it. Thanks again, Carl, for inviting me on the show! more