Welcome to TheRunTime.com

We are a community of technical bloggers devoted to improving the business of development. This is a place where you will find expert advice on some of the advanced technical topics facing developers today. There will also be tutorials geared at novice developers, and content about the business aspects we must all deal with. Our number one commitment is to keep the content in our main feed relevant, reliable, and useful to you. I hope you enjoy our site and encourage you to subscribe to the main feed today.

Latest Posts

DLRScript 0.55 released for Silverlight2 Beta2

It took a bit of time for this release. In the end I had to take everything a step back (as well as there are probably a few "mid thoughts" in here as the release of SL2 Beta 2 caught me a bit by surprise... actually the changes to the DLR caught me more by surprise).

The step back is that we no longer get script code lines when there are issues. I’ll try to bring this feature back, but right now if it breaks, you’ll know it via an alert with a .NET error.

Future direction
I need some feedback on this. I’ve been thinking about scrapping any attempt at jscript compatibility and am thinking more about ecma3 support (DLRJScript has an ecma3 mode). The benefit there is that I could start focusing on building a better set of client-side APIs instead of a more compatible one. That said, I’m not sure how qualified I am at coming up with a "better" set of client-side APIs.

I do want some feedback though. Let me know what you think: jkimble-at-gmail.com.

posted @ 7/24/2008 4:12 PM by Jay Kimble

MS MVC Thoughts

[NOTE: I haven’t quite had much of a chance to look at the new Preview 4, so take this as someone nearly informed. I haven’t read about anything in the Preview 4 that changes what I’m going to say. Also, remember that I am the admin/editor of the blog site which is Alt Alt.NET... so testability/mockabilty doesn’t really resonate with me.]

I know it’s shocking that I would have something to weigh in on MS MVC, but I do. For those who don’t know. I took some issue with Ayende’s "leaky abstraction" back in my CodeBetter days (they had to love having me around). BTW, I understood and agreed in some respects, but in others I was less than agreeable. I still think Web Forms are viable and usable, but in some cases the paradigm breaks down, so the need for another paradigm is both welcome and interesting (and before anyone brings up Castle, PixelDragon, or CodeStory MVC frameworks, I have looked at them as well and found them --in general--way too complex to get started with which is not to say that a couple templates could help you guys out...).

Why I’m interested?
Ok, the reason I’m interested is summed up in one word: RIAs. I could have summed that up in 2 words: Ajax, and Silverlight2. The other thing is that I have used the MVCContrib’s Restful feature to build REST services (way cool).

The Good
I really like the simplicity. I mean MVC isn’t simple, but the MVC framework makes it easy to keep your layers separate... you still have to think about what you are doing, but on the whole it’s pretty easy to use. The MVC paradigm allows for a truer coding experience (the engine doesn’t pretend to be a Windows application in any way although you can still use things like session and the forms authentication engine in ASP.NET).

The MVCContrib library is indispensable. It’s an open source library that is a community project that adds additional features to the MS MVC architecture. For instance there are a number of alternative view engines; I haven’t investigated all them yet (and for the most part I am sticking with the ASPX engine... although my later comments may lead you otherwise).

The Not So Good
Before I say this I want you to realize I have written a grand total of 2 apps with this. App1 used the Restful plugin and really shouldn’t count, so I have written exactly 1 app (so definitely take this with a grain of salt).

Complaint number 1 is that I felt like I was writing old ASP code. I used the inline code method for writing output into my HTML. I probably could have written in the codebehind and had a clean web template with code separation (something I’m a believer in, but it was my first app)... probably more my fault than the engines, but there is a lot of sample code out there already that lead you down this path.

Complaint number 2 really is valid. The whole idea of MVC is that I should be able to swap out the view engine. Or better yet, be able to respond to a request and supply a view that is more suited for the client. Someone pointed out to me that one of the big features of ASP.NET 1.0 was that it would supposedly do this... I would really love for MVC to make it easy to determine that "this is a mobile browser" supply the mobile template (if one exists). Or better yet, this client is requesting that I send XML... evidently it’s some kind of Rich Client. Specific methods can be triggered to deliver a specific type, it would just be nice if the framework would detect that the client "accepts" (that’s a ServerVariable pushed in the header) only "Application/Json" so the MVC app should use a JSON result or convert the result I got to JSON and push it directly down to the client.

This would make the MVC part of this more useful to me (remember all the stuff I said up front... and Yes, I know I can do this myself and have... it just would be nice if I could get the controller framework to make it easy for me to configure and then do this for me)

posted @ 7/24/2008 9:45 AM by Jay Kimble

WiimoteLib and BSOD – Part 2

Well, after a few survey responses and posts to my forum, it appears that everyone experiencing the BSOD issue with WiimoteLib is running the BlueSoleil stack.  I was also pointed to the following links on www.wiimoteproject.org with others having the problem and apparently BlueSoleil is aware of the issue.

So, I guess the only solution now is to wait for BlueSoleil to issue a patch and fix the problem on their end.  If/when I get any news on this (or if someone notifies me if I miss it), I’ll be sure to post the resolution here and update the WiimoteLib docs.

Cross Posted from www.brianpeek.com.

posted @ 7/23/2008 4:05 AM by Brian Peek

Core Addin Challenge : Hello CodeRush/Refactor Pro

[Disclaimer: Before I start this series I want you all to know that I love Resharper! It has made me a better developer, and if you pay attention you will see why I think that. At the same time I love Dev Express. As a company they are constantly giving back to the community. While I’m not a fan of Mark Miller’s humor, their addin framework is about the best you will find IMO... and Scott Hanselman (ScottHa from here on) loves CodeRush/Refactor. I love ScottHa; he has shown me all kinds of cools utility that I couldn’t live without... he is angelic... I went looking for a halo for his picture... nahh been done <grin />. Anyway, this article series I hope will do a good job of comparing and contrasting the 2 VS2008 IDE adds in their current forms (which CR is at 3.0.8 and R# is at 4.0)... and this is really from my personal perspective on what I use]

I’ve been using R# for quite awhile and honestly I have felt that it made me a better developer. I know I’m not a TDD guy, but there are so many goodies in it that I just simply loved it. BUT, my license ran out. I was in a debate about what I was going to do.

As it turns out (late) last year, I was given a license to CodeRush/Refactor Pro. I had been intrigued by their lengthy list of Refactoring and how they were doing ASP.NET refactorings. Well, about that time the betas of R# started happpening and personally I was going through the collapse of my business (and the amount of development I was doing dwindled, so honestly I did the bad thing and forgot to blog about it.

Like I said my R# ran out, but I remembered that I had CR/RFP, so I decided to re-install it and look around (and really look around), so for the next 30 days I will be exclusively using CR/RFP and will be looking to see how it compares to the features of R# that I actually use (you might use other things), and will of course be blogging about it.

The number 1 feature of R# that I use is it’s code analysis I love being able to look at my C# code and at a glance am able to tell if there are issues with the code at a glance. I have actually learned things from the suggestions it gives me... so I can’t live without that.

Guess what, I remembered reading a veiled reference to CR’s Code Analysis on Dave Hayden’s blog. It’s off by default, so if you are playing with CR... here’s how to turn it on. Bring up the DevExpress menu’s options, turn on Expert mode (I think you need that), and type "Code Issues" in the Search Text box. Check the enabled check box when the Code Issues options appears and Viola! You now have analysis on your code.

My initial knee jerk reaction is that the Code Analysis is almost as good as R# (almost), but then sometimes R# recommends things that I’m not really interested in doing (I know you can tweak it’s suggestions).

On the other hand, CR doesn’t seem to bog down the environment for me!

So take your pick... CR has come a long way from when I last used it. It used to have some annoying "features" that seemed to have been tuned. (their auto-complete used to annoy me/get in my way... I would say that it neither gets in my way nor annoys me)

posted @ 7/22/2008 9:09 AM by Jay Kimble

Flexible Audit Trigger for SQL Server 2005

I came across a really interesting audit trigger for SQL Server 2005 a little while back, and thought it was worth re-posting it here.

The trigger basically logs changes for only columns that are affected into a generic audit table. It's got some fancy bit manipulation coding (that I still don't fully understand) and uses dynamic SQL, but hey, since I normally stay away from triggers anyway, I can accept a little dynamic SQL :-)

The alternative is to have an audit table that closely resembles my real table and log changes to that. And then run queries to find what was changed, and when. And then do this for every table I want to audit. And then...you get the picture.

You can find this amazing trigger at Pop Rivett's SQL Server FAQ No.5: Pop on the Audit Trail. It met my needs perfectly, but it may not meet yours: it's worth testing the impact of dynamic SQL and the effect if you use @@IDENTITY after inserts.

Links: http://www.simple-talk.com/sql/database-administration/pop-rivetts-sql-server-faq-no.5-pop-on-the-audit-trail/

Tags: , , ,

posted @ 7/22/2008 9:20 PM by Thomas Williams

WiimoteLib and BSOD

I’ve gotten a few emails of late with people getting BSODs when using WiimoteLib.  It appears most, if not everyone, experiencing this problem is using BlueSoleil.  That said, I’m still unsure what is happening, when it started happening, or what the resolution is.  Therefore, I have put together a short survey that I’m hoping anyone experiencing the issue will take the time to fill out that might help me determine what the root cause is.

I’m looking for answers from people who are specifically having an issue where using WiimoteLib or an application using WiimoteLib is causing their computer to spontaneously BSOD and/or restart.  If that’s not you, please do not fill out the survey.

To take the survey, please click here.  Thanks!

Cross Posted from www.brianpeek.com.

posted @ 7/22/2008 5:41 AM by Brian Peek

Tampa User eXperience (TUX) User Group is coming September 10th, 2008…

I am proud to announce that I and a couple other guys are starting User Group that revolves around User Experience (or UX) in the MS tools eco-system. The other guys are Shawn Cady, Perry Panagopoulos, and Bill Reiss (MVP) [Bill always gets his MVP props].

I could give you all their backgrounds, but I’ll make them do it at the first meeting. I’m sure Papa Fish (aka www.devfish.net) the local MS Dev Evangelist (my Blog Father) Joe Healy will be around (at least for the first meeting).

TUX' Focus
Our focus will be on the "now" of Ajax and how it integrates with ASP.NET (in all its various forms), and the "future" of Silverlight2, and anything in between (like adding Silverlight2 controls to Ajax sites, etc); we’ll not be stuck in just Web either... we’ll probably do some WPF as well. We’ll also be  dealing with some of those more abstract things that you need to get better at (like how to be a better designer, creating good user experiences, etc.), and we will do our best to keep this group "devsigner-friendly" (devsigner is a developer who is also a designer).

We have a lot of really creative ideas to make this fun and useful to you today as well as with an eye for the future (but I don’t want to blow them all)... We will definitely keep this interactive and will try to help you solve your problems as well (at least we’ll be around to chat with you before and afterward).

First Talk: Intro To MS Ajax Scripting
The first person to present will be me. I will be pulling a talk out of my paid pile which means that you have probably never seen me give this talk (unless you work at one of the companies I gave it at)... this is very special and will never be repeated (well, maybe). This talk is one that I have yet to see anyone give (for free). It’s an introduction to the MS Ajax scripting framework. Oftentimes you see a demo where someone shows you how to build an Ajax Extender control where a JavaScript is thrown in, but rarely (I’ve never seen it done) does someone talk to you about building the script behavior which is used to create the Server-Side Extender (I will in fact be doing just this). You will leave this talk with the knowledge of how to do it. As is often the case when I talk about JavaScript, I’ll end with a Script# demo which will make your life a lot easier (so we’ll build the last demo in C# which will be compiled to MS Ajax-style JavaScript); this big demo is a selection grid behavior that I built for my employer to replace a commercial grid component that we were using; you’ll definitely have a use for it.

Bonus
We’ll have Pizza provided by Answers Systems, so just get there after work... you don’t need to eat first.

AND!!!! Bill Reiss (MVP) has graciously given us an MSDN Premium Subscription (used to be MSDN Universal) to give away, so don’t miss it.

Where/When will it be?
We will be holding these events at my workplace: Answers Systems in Oldsmar, FL. Better directions than this will follow in the near future (we will have a web site soon), but it’s right next to (West of) the Oldsmar Fleamarket on Tampa Rd (aka Hillsborough Ave). We plan to open the doors at 6:30pm with the activities starting at 7:00pm.

Can’t make it, but you really wanted to see my session?
<sarcasm>So you are in my fan club (Eric Wise, I know that’s you since you maintain some of my stellar code), but you live in another state (like say the cold state of Ohio... where it’s 40 degrees Fahrenheit in August) so there is no way you could see this session by me, but you really, really want to see it, but the plane ticket is so expensive.</sarcasm>

Well, we plan on videoing our sessions and making them available online (as long as the speaker is OK with it, and I am... SO this is the LAST time I’ll be able to charge for this session... unless I revamp it which I will).

Afterwards...
I’m not Joe Healy so I can’t pick up the tab, but there is a Starbucks down the street that many of my colleagues and I like to frequent (Stimulants... I need a good stimulant not a depressant... but we could be talked into depressants), so don’t be surprised if we all end up somewhere afterwards or maybe somewhere else...

RSVP
If you plan on coming please drop me a line via the contact form on this site. We need this to help us figure out how much Pizza to buy. 

PS
In October (the 2nd Wednesday), Bill will be doing a Silverlight2 talk (He’s a Silverlight MVP and a soon-to-be Silverlight book author). It will be more of an intro, but he plans on really giving a nice overview from both the diesgn standpoint and the development standpoint.

And, yes, we actually have a a list of things we’re thinking about for November... nothing definitive (yet), but we plan on being way ahead of the game (as best as we can).

posted @ 7/17/2008 11:35 PM by Jay Kimble

The Perfect Storm of Source Control

I've been holding off upgrading my Subversion repository and tools, until last week or so when the "perfect storm" of source control arrived: VisualSVN Server with Subversion 1.5, TortoiseSVN 1.5, and the last piece of the puzzle, AnkhSVN 2.0.

If, like me, you've been waiting for the right time to upgrade your Subversion source control to the newly-released 1.5, then the free VisualSVN Server is one official (and dead-simple) way to do this as CodeBetter's James Kovacs recently noted. My older 1.3 repository was upgraded painlessly using VisualSVN Server, although I could have also called svnadmin upgrade from a command line as per this advice.

To Watch Out For: One point of confusion for me was the fact that I was running SvnService, installed with "Subversion 1 Click Setup" years ago, which still used the old Subversion binaries. I stopped the service, removed it and then renamed the old "Subversion" folder so that I could use the 1.5 binaries shipped with VisualSVN Server. VisualSVN Server doesn't add the path to the Subversion binaries to your environment variables though - this is one step you might have to do manually.

TortoiseSVN is a Subversion front-end for Windows Explorer. I've used it for years and have just upgraded to the latest 1.5 version, after upgrading my repository. The new version offers better icons...and of course much more (!), in addition to the existing integrated spell-checking, diff and merge tool, icon overlays, support for all Subversion protocols, etc. My "better icons" comment, while tongue-in-cheek, is actually serious: files not under version control or that are ignored are marked with different icon overlays, which is very handy.

Although I'm happy with TortoiseSVN, I wanted to include AnkhSVN 2.0 in my toolkit for its Visual Studio integration. I've been reading the Subversion blog and noted that AnkhSVN 2.0 offers full integration with Visual Studio 2005 and 2008. It certainly worked as advertised for me, installing simply enough and working immediately without any mucking around.

Good luck with your own upgrade - you'll have to decide for yourself whether this latest "perfect storm" of synchronised releases is worth upgrading to. And may your experience with the latest Subversion version and associated tools be as good as mine!

Links: VisualSVN Server http://www.visualsvn.com/server/, TortoiseSVN http://tortoisesvn.tigris.org/, AnkhSVN http://ankhsvn.open.collab.net/

Tags: , ,

posted @ 7/16/2008 10:58 PM by Thomas Williams

Too Much Quality

deluxe doghouse The latest .Net Rocks podcast was from a panel at TechEd 2008 (that I sadly missed while there). Richard Campbell was the moderator and the topic was Software Quality. It was a good, if somewhat one-sided discussion and I recommend giving it a listen if you are so inclined.

I particularly liked Billy Hollis' perspective on quality because it was a perspective that was grounded in both reality and sound business principles. He kept bringing up quality in terms of trade-offs and the others kept trying to waltz around those comments with a more absolutist, almost dogmatic, vision of software quality. I think it was a real shame that Billy Hollis was so out numbered because his points are important if we are to gain the stature we desire as a profession.

The final comments completely got on my nerves. Which is fortunate because it helped crystallize my discomfort with the others.

Billy Hollis started off with this simple statement.

My key insight that I try to communicate is it’s all a matter of trade-offs. And getting to what the user needs is first and quality is defined within that context.

To which Neil Roodyn responded.

I’ll disagree. It’s about quality. You’ve got to get your quality as high as you possibly can. Always. The higher the quality of the software, the higher the quality the software will remain through the development life cycle. So right from iteration zero keep that quality as high as you possibly can.

And Jeffrey Palermo added.

The higher the quality the better. You can’t have too high of quality, you would just say you have too much behavior for the situation.

The thing is that Hollis is right and the other two are not only wrong, but dangerously wrong. Other members of the panel (David Platt and Neelesh Kamkolkar) didn’t support Hollis either, though they weren’t as overt as Roodyn and Palermo.

What Are You Trading?

The thing is that software quality, besides being pretty much impossible to measure, isn’t a first-order good in the first place—i.e. it isn’t valuable in and of itself and delivers what value it adds indirectly. You can make the reality of this simple business fact plain by pointing out how the deciding factor between two competing products is often not quality. Betamax anyone? Rolls-Royce? Sun Microsystems?

People choose software for a lot of different reasons and those reasons are very rarely explicitly the “quality” of the software. Price, availability, familiarity, and usability all play roles in the purchase (or use/approval if internal) of software and these factors need to be kept in mind. It could be that it is better for your company to have software that is harder to maintain but completed two months earlier. I do this all the time because I have lots of projects that are single-use and with a restricted domain.

Software development involves time, money, commitment, and concentration. Spending those valuable resources should be done carefully and be based on actual value to the company. Quality has a cost. Quality doesn’t always have a pay-off. Business people have a term for a cost that doesn’t return a pay-off. That term is usually “good bye”.

Dangerous?

So Palermo and Roodyn are wrong, but why are they dangerous? This comes back to my observations during the dot com bust. I observed the glee in putting IT back in its place. You see, during that whole tech bubble IT got arrogant. Technical folks were wagging the business dog, dictating strategy, policies, spending, and sometimes even remapping the boardroom to their liking. Which would have been fine if the business rules really had changed as some thought. Unfortunately, they hadn’t. This arrogance set the entire profession back because business leaders learned not only of our arrogance, but of our ignorance as well.

We don’t bother learning even basic business principles before we make important, even critical, business decisions. This discussion of quality is an example of just such thinking. Roodyn and Palermo are talking about dictating business resources without any concern for accommodating business realities. Worse, they don’t seem interested in even learning about or exploring the business realities they, of necessity, work under.

As much as we might like the universe to bend to our personal theories and values, the fact of the matter remains that there are a lot of reasons to compromise aesthetical purity when the rubber meets the road. Those reasons don’t simply go away just because they make us uncomfortable. Indeed, how we react to the inevitable trade-offs required will largely determine how much business leaders decide to trust us in the future.

Here’s a helpful exercise. Imagine you are a business leader evaluating which company to hire to solve some software need. As part of your vetting process, you ask two finalists their stance on software quality. The first one answers with “Getting you the things you need is our first priority and quality will be defined in that context.” The second one answers with “Quality is number one. Always. Quality cannot be too high though it could be that you want too much behavior for the situation.” Which would you hire? If you answered the second, it is because of ideological blindness. Actual business leaders will not only tend to go with the first, but will have confidence and trust in doing so.

Are You Agile?

A lot of the value in IT comes from giving businesses flexibility. Processes that used to take indoctrinating a new generation of workers can now turn on a software release. While this is both a blessing and a curse for businesses, it remains a key to our value in IT. Businesses have learned to be wary of our use of resources, however, and with some cause. It is unfortunate that they cannot trust IT, but until we let the needs of the business drive our development I’d say that their trust hasn’t yet been earned. If we really want to be masters of our own fate, we must learn to live in the messy world of business. We can only do so by proving that we will use the flexibility inherent in our profession wisely.

posted @ 7/10/2008 7:20 PM by Jacob

OT: Logo for SQL Bits

SQL Bits is having a logo competition, and I entered the following:

My goal was to feature the familiar (often yellow) database cylinder, with simple text. I don't expect to win, but given the prize (an XBox 360) I thought it would be worth a try :-)

Links: http://www.sqlbits.com/LogoCompetition.aspx

Tags: , ,

Blogged with the Flock Browser

posted @ 7/8/2008 4:45 PM by Thomas Williams

Types of Silverlight2 apps

I want to go on record for a prediction. I believe when the dust settles with Silverlight2 (SL2, hereafter), we will have 2 major types of apps. To me this is fairly obvious, but if all you did was look at SL2 tutorials you would get a different view altogether. You see all the tutorials that exist out there show you what I think is the preferred way: a single application that lives in the browser as a plugin.

I also see another SL2 type of app: the SL2 enhanced Ajax App. Seriously, there will be those who will use some of the fancy SL2 controls (and I’m talking about the third party ones that will be developed) to bring their Ajax apps into a new domain. So from a plumbing perspective they will stick with the familiar page model we have today. I think the draw of Ajax is strong and I would rather this not happen because it is my view that the SL2 framework is way better than classic DHTML/Ajax/Web2.0. There are those who will say, "I can’t leave the rich experience of JS on the client." (phooey... just code in DLR JScript instead if you want JavaScript).

BTW, I also see a third model. The old model built with a single Sl2 applet on each page. I think this will be a minor idea, but I see it coming.

-----------

On another note, I’ll be putting up a few SL2 posts. I have been doing a fair bit of work with it in the last month or so. It definitely involves a slightly different mentality than classic web apps.

My SL2 prototype actually uses a REST service built with MS MVC and with the MVC Contrib project’s Restful feature. I will write some on this in the not too distant future. I have really grown to like REST (and building a service the way I have is really great for quick prototyping).

I’m actually starting to chew on Databinding (and doing CRUD operations on the data), so in time I’ll be writing about some of that stuff too.

--------------

Additionally, I am also working on starting a .NET UX user group here in Tampa Bay. I’m working with a couple of the local personalities to bring together a really good group. The group would focus on MS Ajax (and other Ajax Frameworks with ASP.NET and MS MVC) and Silverlight2 based apps. I can’t wait. It’s really exciting!

posted @ 7/7/2008 5:03 PM by Jay Kimble

Windows Mobile Devices and Power States

I’ve been doing some Windows Mobile development with the .NET Compact Framework recently and ran into a scenario where I needed the device to be in “full power” mode at all times with the back-light on.  The device is constantly powered, so battery life is not a concern.

The obvious choice is to go into the Brightness and Power control panels and turn off the appropriate settings, but I learned that there is a way to handle this at an application level so the behavior only occurs while the application is running.

Power State

An application can force a specific power state using the SetPowerRequirement method, and release that state using the ReleasePowerRequirement method.  Using P/Invoke, these methods look like the following:

   1: public enum CEDevicePowerState
   2: {
   3:     D0 = 0,    // Full On
   4:     D1,        // Low On
   5:     D2,        // Standby
   6:     D3,        // Sleep
   7:     D4,        // Off
   8: }
   9:  
  10: [DllImport("coredll.dll", SetLastError=true)]
  11: static extern IntPtr SetPowerRequirement(string device, CEDevicePowerState ceDevicePowerState, uint deviceFlags, IntPtr systemState, ulong stateFlags);
  12:  
  13: [DllImport("coredll.dll", SetLastError=true)]
  14: static extern int ReleasePowerRequirement(IntPtr handle);

SetPowerRequirement will allow you to set a specific power state on a specific device.  In my scenario, I wanted to set the back-light to full power.  The name of the back-light on most (not all) Windows Mobile devices appears to be “BKL1:”.  So, to set the back-light to full power (the D0 state), you would call the method as follows:

IntPtr handle = SetPowerRequirement("BKL1:", CEDevicePowerState.D0, 1, IntPtr.Zero, 0);
 
The power state will be returned to its default settings when the application exits, or you may call ReleasePowerRequirement, passing in the handle returned from the call to SetPowerRequirement to reset it yourself.
 
Suspend
 
The above will leave the back-light on at all times, but it will not stop the device from going into a suspended state as configured in the control panel.  To stop this from happening, simply call the SystemIdleTimerReset method at a short, regular interval:
 
   1: [DllImport("coredll.dll", SetLastError=true)]
   2: static extern void SystemIdleTimerReset();
   3:  
   4: // reset the system's idle time every 10 seconds so it doesn't suspend
   5: Timer timer = new Timer(IdleReset, null, 0, 10000);
   6:  
   7: private static void IdleReset(object state)
   8: {
   9:     // no suspend
  10:     SystemIdleTimerReset();
  11: }

Lines 1-2 contain the P/Invoke signature.  Line 5 sets up a timer that will be called every 10 seconds (10000ms) to reset the idle timer, and lines 7-11 are the timer callback method which actually calls the SystemIdleTimerReset method.

And that’s that.  With both of these methods in place, my application remains running with the device at full power, never suspending, and with the back-light always on.

Cross Posted from www.brianpeek.com.

posted @ 7/3/2008 6:00 AM by Brian Peek

Hello TheRuntime!

I'm Thomas Williams, and I blog about SQL Server, Reporting Services, .NET, and development in general.

My old blog at DotNetJunkies was in desperate need of updating - thanks to Jay for setting me up here at my new home! Please subscribe to TheRuntime main feed or my personal feed to make sure you stay up-to-date with my posts.

More about me

I work in the health industry in Frankston, Victoria, Australia and live with my beautiful wife Olivia and 3 young kids. I am an MCP (going for MCAD.NET) and a MCTS in SQL Server 2005.

My full-time job involves writing software to process large amounts of data for enterprise data sources, using SQL Server 2005, SSIS, Reporting Services, and windows and web front ends (this is what I find myself blogging most about too, surprisingly).

I have a personal blog at Thomas Williams.blog, and I also enjoy movies, reading, board games, XBox, and some non-geeky things as well :-)

Tags: , ,

posted @ 6/30/2008 12:50 PM by Thomas Williams

Welcome Thomas S. Williams... or TRT goes global

You may have noticed that our main feed was recently populated with a bunch of of our new blogger Thomas S. Williams posts (the SubText BlogML importer’s fault... sorry about that... I have tried to correct the problem... sometimes I swear that no one who develops for SubText really tests on community-based sites).

Thomas has been blogging for almost as long as I have (4 years). He specializes in SQL and VB. Check out his stuff! Oh yeah, he’s our first non-US blogger (he’s from the land down under).

posted @ 6/29/2008 3:00 PM by Jay Kimble

May 2004 Melbourne SQL Server SIG - Reporting Services Deployment

My musings on the May SQL Server SIG in Melbourne, Australia (a few days late)...

The Rundown
I went to a Special Interest Group meeting at Microsoft in Melbourne a couple of weeks back. I had seen the presenter, Jason Buck, before and once again he demonstrated how well he knew the product (assisted by David from MS and Greg, a consultant tasked with "..extracting out of the community...expertise..."). There were lots of people there (more than I'd seen at an SQL Server SIG before), which is a good indicator of the poularity of this add-on to SQL Server 2000 - I know it's hard to tell a book by it's cover (or a man by his clothes), but looking at the range of people and judging by the suits, there were some BI-type people, some developers, some managers.


The Highlights
Jason focused on deployment and backup. He kind of powered his way through the slides, and part of the reason for that was the side discussions that kept coming up based on questions from the audience. I was hoping to see more "tips and tricks" relating to advanced report design as our deployment here was fairly painless - I guess I'll wait for the "Hitchhiker's Guide to SQL Server 2000 Reporting Services" book (see
http://www.sqlreportingservices.net). One 'wow' factor was a command-line tool to build folders, set permissions and deploy reports called "rs.exe" which used special ".rss" batch files written in VB.NET. Very cool.

The other highlight was the amount of feedback the team running the night asked for, in terms of future topics with the SIG and the desire to build a community. I see this commonly online, but in person I find it's even more rewarding. Looking forward to the next SIG in June (see http://www.local.microsoft.com.au/australia/events/register/home.aspx?levent=268429 for details).

posted @ 6/3/2004 3:46 PM by

Me, Me, Me

Obligatory first post - my name is Thomas Williams, I'm a Melbourne, Australia-based senior systems analyst working mainly with SQL Server (and Analysis Services, Reporting Services) and VB.NET. I'm 30 years old, and I'm looking forward to sharing what I've got with anyone who might be interested!

I've been reading blogs for a year or so now, and writing my own personal blog at http://thomasswilliams.blogspot.com/ since September 2004.

posted @ 6/3/2004 3:51 PM by

SQL Server Developer Centre

Via Early Adopter comes new of an Microsoft SQL Server Developer Centre with the standard articles, downloads and KB's, but also links to blogs and an RSS feed.

posted @ 6/4/2004 2:23 PM by

GUI Design Guidelines

It's a little out-of-date, but the Isys Information Architectssite has a whole lot of examples of good (Hall of Fame) and bad (Hall of Shame) GUIs, dialog boxes and "features" (from I don't know where).

posted @ 6/4/2004 2:33 PM by

GUIs Part 2

While I'm thinking of GUIs, the GUI Olympics (which has to do with skins, rather than full-blown widgets and interfaces) produced some nice looking interfaces. When I ran Mandrake at home I was pleased with the amount of customisation that could be done, being the tweaker that I am.

posted @ 6/4/2004 2:39 PM by

Ohad's Reporting Services Links

Ohad has a list of Reporting Services links that look interesting.

posted @ 6/9/2004 11:00 AM by

MS Application Updater Block

From Brendan, a great step-by-step post on the MS Application Updater block, which I had downloaded months ago and have sitting around for when my app gets closer to deployment (in a month or so).

I also use the Data Access Application Block (V2, currently, as SQL Server support is all I need). I passed over the error logging Application Block in favor of log4net which more than meets the requirements I've got.

posted @ 6/11/2004 2:19 PM by

Finding Stored Procedure/Table Dependencies

Recently I had a problem that I needed to update my stored procedures to point at a new set of tables. I systematically worked through my 3 stored procedures for populating the tables, but I couldn't remember all the stored procedures that accessed them for data retrieval.

Enter information_schema.routines and a tip from Experts Exchange:

select * from information_schema.routines where routine_definition like '%yourtablename%'

The downside is that this searches the stored procedure text (well, the first 4000 characters in the routine_definition column) for the table name, so you'll get hits even where the table name is used in a comment. The upside is that dynamic SQL is accounted for.

posted @ 6/15/2004 11:29 AM by

Upcoming June 2004 Melbourne SQL Server SIG - Replication Lessons from the Real World

Tonight is the Melbourne SQL Server SIG on replication, presented by Adam Thurgar. Replication is not something I know a great deal about - I'm hoping to learn ways to sync our production and development servers as currently I use multiple DTS jobs coded by hand and scheduled with SQL Server Agent. The DTS/SQL Agent approach is very flexible, but I want simple: whenever a new table is added, data is synchronised, and the two servers are kept exactly the same.

Hopefully replication is the answer! I've printed an article from DatabaseJournal called Setting Up Merge Replication: A Step-by-step Guide to read while I'm waiting around beforehand, to at least open my eyes to what can be done.

Anyway I should have more to report on in the coming days.

posted @ 6/15/2004 1:12 PM by

June 2004 Melbourne SQL Server SIG - Replication Lessons from the Real World

Here's my brief overview of Tuesday's Melbourne SQL Server SIG on "Replication Lessons from the Real World", presented by Adam Thurgar at Microsoft Melbourne Offices on Chapel Street:

Adam did a great job presenting the topic (which I have absolutely zero prior experience with), and quickly established his credibility by talking about the work he does with Match.com and it's 90GB database (leaves my largest, at 2GB, looking pretty pathetic). Adam spoke candidly about problems he'd encountered and alluded to several improvements in Yukon, all the while infusing his talk with humour and trying to keep the audience involved. His presentation was mostly theory (no code, no screenshots, no demos) but he was quick to take questions from the group gathered.

The highlight of the talk for me was when he covered three or four "don't do this at home" scenarios where he was able to work around some of the limitations/correct replication mistakes using the SQL Server System Tables. I went along with a particular business need in mind, and so was able to extract enough information to make a decision (my decision was yes, we'll use replication, but I need to do some more research first). I'm looking forward to reviewing the PowerPoint slides Adam used, when they get posted (at the Australian SQL Server User Group site).

There were fewer attendees than the last time when Reporting Services was being discussed, which is no problems because bigger doesn't necessarily mean better. Myself, I struggle with large crowds and have absolutely zero networking skills. Maybe it's time to learn some!

Overall I enjoyed the night from a technical side, and I'm looking forward to the future SIG's which will be targeted at Yukon.

posted @ 6/16/2004 11:27 AM by

Re-indexing Tables with Original Fillfactor

As part of a weekly database job that runs out-of-hours, I re-index all the tables in a particular reporting database. After playing around with index fillfactor I arrived at a fill factor of 90 as the tables are mostly being read and only being updated a couple of times a month. For my key tables, I made sure I set up clustered indexes on the fields that were being used most commonly in my queries (which of course speeds data access up considerably)

I discovered a simple script that would rebuild indexes on all tables in a database to have a fill factor of 90 (see http://www.sql-server-performance.com/rebuilding_indexes.asp), but I wanted more customisation so wrote a script to rebuild all indexes with their original fill factor (some of may tables are set higher as the table is never updated, and some are set lower as the table is updated more often).

So, here's the script, which doesn't actually do the re-indexing, just PRINTs the relevant statements to the Messages window (if using Query Analyzer):

  --table name variable
  DECLARE @TableName VARCHAR(255)
  --index name variable
  DECLARE @IndexName VARCHAR(255)
  --original fill afctor variable
  DECLARE @OriginalFillFactor TINYINT
  --override fill factor (can be NULL)
  DECLARE @OverrideFillFactor TINYINT
  --set override fill factor for indexes here, if required. This WILL overwrite the original value
  --for each index! (If commented out, original fill factor will be used)
  --SET @OverrideFillFactor = 90

  --temporary table for holding all indexes
  CREATE TABLE #tempIndexes 
  (
      index_name VARCHAR(255), 
      index_description VARCHAR(210), 
      index_keys NVARCHAR(2048)
  )
  --temporary table for holding table name, index name, index id and fillfactor
  DECLARE @temp TABLE (
      TableName VARCHAR(255), 
      IndexName VARCHAR(255), 
      IndexId INT, 
      OriginalFillFactor TINYINT
  )

  --set NOCOUNT ON
  SET NOCOUNT ON

  --get all the tables using INFORMATION_SCHEMA.TABLES into a cursor
  DECLARE TableCursor CURSOR FOR
  SELECT  TABLE_NAME 
  FROM    INFORMATION_SCHEMA.TABLES 
  WHERE   TABLE_TYPE = 'BASE TABLE'

  --open the cursor
  OPEN TableCursor
  --get the first row
  FETCH NEXT FROM TableCursor INTO @TableName
  --if we got a valid row, continue
  WHILE @@FETCH_STATUS = 0 BEGIN 
      --clear out the #temp table, containing indexes for the passed table
      DELETE FROM #tempIndexes
      --get indexes into #tempIndexes. This may print a warning message "The object does not 
      --have any indexes.", which can be ignored
      INSERT INTO #tempIndexes EXEC sp_helpindex @TableName

      --insert into outer table, the table name, the index name
      INSERT INTO @temp ([TableName], [IndexName])
      SELECT  @TableName, index_name
      FROM    #tempIndexes

      FETCH NEXT FROM TableCursor INTO @TableName
  END

  CLOSE TableCursor
  DEALLOCATE TableCursor

  --drop the temp index table
  DROP TABLE #tempIndexes

  --now get the index id and original fill factors
  UPDATE  @temp
  SET     IndexId = i.[indid], OriginalFillFactor = i.[OrigFillFactor]
  FROM    sysindexes i, sysobjects o, @temp T
  WHERE   i.[id] = o.[id] AND o.[name] = T.TableName AND T.IndexName = i.[name]

  --lastly loop through the @temp table and re-index
  DECLARE DBREINDEXCursor CURSOR FOR
  SELECT  TableName, IndexName, OriginalFillFactor 
  FROM    @temp
  --open cursor
  OPEN DBREINDEXCursor
  --get first row into local variables
  FETCH NEXT 
  FROM    DBREINDEXCursor 
  INTO    @TableName, @IndexName, @OriginalFillFactor
  --loop through cursor while there are rows remaining
  WHILE @@FETCH_STATUS = 0
  BEGIN
      --if we've been given an override fill factor, apply it here
      IF NOT (@OverrideFillFactor IS NULL) SET @OriginalFillFactor = @OverrideFillFactor 
      --do the re-index operation here
      PRINT 'DBCC DBREINDEX(' + @TableName + ',' + @IndexName + 
          ',' + CONVERT(VARCHAR(3), @OriginalFillFactor) + ')'
      --get the next row
      FETCH NEXT 
      FROM    DBREINDEXCursor 
      INTO    @TableName, @IndexName, @OriginalFillFactor
  END

  --close and deallocate the cursor
  CLOSE DBREINDEXCursor
  DEALLOCATE DBREINDEXCursor

  GO

Some indexing resources I found helpful are at http://www.c-sharpcorner.com/Code/2004/March/SQLPerformanceChecklist06.asp, http://www.extremeexperts.com/sql/articles/BestPractices.aspx and http://www.sql-server-performance.com/rebuilding_indexes.asp.

 

posted @ 6/22/2004 11:39 AM by

Reporting Services SP1

As promised by Microsoft, covered by many many others, and incidently delivered right on time, Reporting Services Service Pack 1 is now available.

I'm getting ready to load it up over the next couple of days. The big thing we've been waiting on is better Excel support (for versions prior to 2002) and grouping in Excel (which was in the beta, but pulled for the final product).

The main gripe I'm hearing from my users is not being able to print directly from Internet Explorer. I believe it's got something to do with IFRAMEs, and the workaround I'm offering is to export to PDF and print it there.

posted @ 6/24/2004 12:02 PM by

Reporting Services SP1 - Installed

Reporting Services SP1 is installed, the installation went really well, and one feature that was in the beta is back: Excel "groups" (the plus/minus rollups in Excel). Believe it or not, this was one of the things that got my boss excited about Reporting Services as many of our managers are familiar with Excel, and when it dropped off in the RTM I had to go through and create some copies of reports specifically for an Excel export.

One strange thing is that there seems to be at least two means of creating expandable groups/hiding report items in the designer, for display in a browser. One way is to set the whole group to being hidden, and set a textbox as a toggle item in the "Grouping and Sorting Properties" dialog (figure 1), another is to set report row(s) as being hidden, toggled by the same textbox (figure 2).

Reporting Services Report Designer 'Grouping and Sorting Properties' dialog (Visibility tab)
Figure 1
Reporting Services Report Designer Row Properties Property Grid
Figure 2

 

The second method creates the Excel "groups" that made me and my boss so happy. I did have a small problem with some wording in the Reporting Services SP1 readme that said:

This service pack is independent of Service Pack 4 (SP4) for SQL Server 2000. If you are installing Reporting Services SP1 after SQL Server SP4 is released, Microsoft recommends that you apply SP4 first.

A search at Microsoft's "Service Packs for SQL Server" (http://www.microsoft.com/sql/downloads/servicepacks.asp) site showed there isn't any SQL Server 2000 SP4, yet, but I found clarification on the newsgroups at http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&frame=right&th=f7246d07373b6bb2&seekm=%23koDNGiWEHA.644%40tk2msftngp13.phx.gbl#link3 which had:

The readme was not meant to imply that you need to have SQL Server SP4
before applying Reporting Services SP1. You can apply Reporting Services SP1
now and then later apply SQL Server SP4 when it is released.

The newsgroups also saved me some headache with an error in Visual Studio after applying the Service Pack (it's for client PC's - report designers - as well as for the SQL Server/web server) which read:

Could not load type Microsoft.ReportingServices.Interfaces.CachedDataStatus 

The solution was at http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&frame=right&th=b1ccf47d2cd15078&seekm=epuanhTWEHA.2544%40TK2MSFTNGP10.phx.gbl#link7, which said:

Just out of curiosity, would you do a search under the hidden folder:

C:\Documents and Settings\\Local Settings\Application Data\assembly\dl2

for a file named

Microsoft.ReportingServices.Interfaces.*

If it's there, rename it and see if that resolves the issue.  If it does, you may delete the file.
Overall a fairly painless experience, which has improved the functionality of an already pretty good application.

posted @ 6/25/2004 3:27 PM by

Media Center Theme for Windows XP

Stefano and Girish inform us that the official Windows Media Center theme (called Royale) can be used on Windows XP. Cool!

I like tweaking my colors but am not willing to load themes from 3rd-party sites on my work PC (or don't want to get busted), so it's nice to have an option. There's instructions on where to copy the theme to in the RAR file, which can be downloaded from Winbeta.

UPDATE: Stefano alerts us that the theme has been officially released (called “Energy Blue“), and can be got here. You'll have to extract the relevant files with WinRAR and copy them manually to your Resources directory, though, as the installer is designed for Tablet PC's only.

posted @ 6/30/2004 2:09 PM by

Tips for Optimising Reporting Services Performance from tudortr

tudortr has some tips on measuring and improving Reporting Services performance. I heartily agree with number 1: optimise your queries. I've found that using a) proper indexes and b) creating intermediate tables where necessary (possibly containing summarised data from a month that is reported in many different reports, rather than going to the transaction-level original data table, for instance) are the best things I can do to improve performance on my reports.

posted @ 6/30/2004 2:16 PM by

Philip Su Shows Me The Money

Philip has a great post on when he worked on the Money team at MS - funny, insightful, and memorable.

posted @ 7/2/2004 3:10 PM by

URLScan, FlexWiki and Reporting Services

Here's hoping that someone will find this information useful when working with the IIS Lockdown Tool, FlexWiki and Reporting Services. If the URLScan filter is set to a fairly restrictive level, neither Reporting Services or FlexWiki will work (returning constant 404 errors). I found helpful advice at the following pages:

posted @ 7/8/2004 3:12 PM by

Printing a Form in VB.NET

I don't have a need for it right now, but I know one day that Mathias Schiffer's PrintForm replacement for Visual Basic .NET code will come in handy for allowing users to print what they see.

My current solution is “official“, pre-baked reporting via Reporting Services, and I'm using the ComponentOne FlexGrid for on-screen data displays (I wonder if it has a Print method?)

posted @ 7/13/2004 3:04 PM by

Ordering Task Bar Buttons, and Removing "Use the Web Service to find the appropriate program" Dialog

Omer wants ordering of task bar buttons, and I agree. It sounds trivial but I find that every day I order my buttons (from left to right) Outlook, MyIE web browser, Windows Explorer, the rest. I reckon I save 10 minutes a day just by knowing where my browser window is when I'm switching between programs.

On the other hand, Alt-Tab is probably faster than the mouse.

Next, Kevin posts a 5-second registry tip to get rid of the useless “Use the Web Service to find the appropriate program” dialog that comes up when you try to open a file with an unknown extension in XP. Thanks Kevin!

The Web Service link is still available at the bottom of the “Open With” dialog, so you get the best of both worlds.

UPDATE: Mis-spelt Omer's name - thanks Omer for the notification. Sorry for the inconvenience!

posted @ 7/14/2004 11:59 AM by

Realisations

Jeff reflects on 3 years of experiences and priorities, thinking he was happy (but realising he was actually miserable) and doing something about it. He writes about the need for support (and sounds like he's very grateful that he got that from his wife), self-esteem, balance and ability to take risks (and a lot of other stuff that you'll have to read for yourself).

His post made me think of a time when I felt down in general and I felt bad about my job and future prospects, and I realised something: it's OK to feel bad. I'm learning from that and I still spend a lot of time trying to make myself feel better or avoid bad feelings entirely rather than accept the fact that I'm not always going to feel great, and just get on with things.

Jeff's post also highlights for me a need to be able to take risks:

Finally, the inability to take risks will keep you forever stuck in the same place.

Something to work on!

posted @ 7/20/2004 2:57 PM by

Melbourne SQL Server SIG review for July - SQL Server 2005: What's new in the relational and storage engines

Tony Bain (from Red Rock SQL Services), a Microsoft SQL Server MVP, spoke at Wednesday night's SQL Server SIG at the Microsoft offices in Melbourne. His primary topic was improvements in the core technology of SQL Server over the 2000 version. Tony has been using the software for the last 12 months - since the first beta - and had lots of insights to show for it.

Tony started off explaining that this was a "What's New"-type session, which meant a brief overview of the improvements without any real advice on how to implement them in the real world. Left out of the night's discussion were .NET integration, Reporting Services, Analysis Services, XQuery, and more (which Tony labelled as the "cool" parts of Yukon), and the focus was on the sort of improvements that a DBA is going to spend time in, namely the relational and storage engines and the changes there. Tony discussed (this is not an exhaustive list):

  • replacements for TEXT, NTEXT and IMAGE (BLOB) datatypes: VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) which can be searched in WHERE clauses
  • the ability to take a read-only snapshot of a database at a particular point in time and run queries against them (he admitted one of the shortcomings of these snapshots were that they could not be backed up)
  • referring to queries as variables (Tony called these run-time views), although I didn't see much difference from the current TABLE datatype except that declaration and population can be done at the same time
  • recursive queries, with the afore-mentioned run-time views...I liked the sound of this!
  • inbuilt function to see how often your indexes were being used
  • ability to include columns in an index, that are not part of the actual index but are stored with the index to save the query going back to the table to get the field
  • triggers on Data Definition Language (DDL) statements, e.g. every time a table was added to your database, a trigger could fire
  • more consistent DDL statements - basically a CREATE, ALTER and DROP for almost any object you can think of - to reconcile DBCC commands, extended stored procedures and normal DDL statements
  • function to return the SPID, Transaction name and running time of currently open transactions
  • TRY...CATCH blocks - Tony explained that they currently only caught one type of exception, a transaction fail exception
  • select a random number of rows from a table (very fast)

There was more, but I honestly can't remember all the new things. Suffice to say there is a lot to learn!

I was amazed at how many changes and improvements Microsoft had worked into SQL Server 2005, even given the limited range that Tony covered. Greg Linwood from the user group mentioned that last night's event was the first of a series of Yukon presentations, with the August SQL SIG in Melbourne titled Changes to Backup and Recovery in SQL Server 2005. Looking forward to it...

posted @ 7/22/2004 12:03 PM by