Tuesday, November 22, 2005

No images allowed in the app_data folder

I had my first opportunity today to try to create a web site with Visual Studio 2005. I made it about two steps before running into a brick wall. The concept of Master Pages seems like a really cool one, but I'm not sure how to make it work together with CSS and maybe two or three user controls. So I tried to set up a master page; no problem; tried to associate default.aspx with it; problem. The property is grayed out. A little research told me that the field could be filled in through code in the @page declaration, so I tried adding that with trepidation. I was pretty sure that the field was grayed out for a reason, and sure enough, that didn't get me what I was looking for.

I quickly found out that "Content" pages are the only kind of page that can be associated with master pages, but all the intuitions I've built up about finding things don't apply to 2005. For example, I tried to "Add New Item" to the solution, expecting to find "Content Page" as an option. No dice. I tried looking through the toolbox for something I could drag onto the page to make it a content page; nothing. So I did quite a bit of additional research and poking around on the web, and in Dev Studio, and in the Dev Studio help. But it took me quite a long time to actually find the solution, which I did by trial-and-error: right-click in the content placeholder in the master page and choose "Add Content Page". I'm sure I could have found help on this...somewhere.

This was directly followed by problem #2; I simply tried to add an image to my page. Copy-and-pasting from VS 2003 on my system failed, to my mild surprise, but then I noticed this nice "App_Data" folder in the project, and it was clear that any images or sounds needed to go here. Right-click on it, add new item, and drag the picture to my page, no problem!

Except that when I hit F5, no image is to be seen. Back to the web. This time, there's a fundamental problem: I can't figure out any terms to search for that describe my problem with any hope of clustering to the right solution. I tried "visual studio app_data image doesn't show up", "asp.net image failing", "Visual Studio 2005 images", "visual studio 2005 add jpg to web page", but all these terms give me much too generic results back. If the solution to my problem was in one of those result sets, it must have been on page 37 at least.

Finally, I went to the Microsoft forums, and specifically to forums.asp.net . Here, a search for app_data turned up dozens of results, and I tried to narrow it down by searching for "app_data debugging", which was what I was trying to do. Bingo! By sheer luck it turned out that the problem involves permissions and running inside the debugger, but the fact of the matter is that the app_data folder is not supposed to hold images at all, only databases.

I added a separate folder for the images and everything worked fine. Whew. What adventures await me in Visual Studio tomorrow?

Icerocket tags

Thursday, November 17, 2005

Indianapolis Workshop on Software Testing

This looks like an interesting, if tiny, local software testing group. I found it through this post, from Mike Kelly, who appears to be the ringleader, with an impressive list of publications on his site. Mike, how about blogging more than once a month though, huh?

They say the best way to get an invite to their meeting is to submit a paper. I think I'd like to sit in on just one or two first though; maybe I'll try to finagle an invite from somebody. I joined this group anyway, which was free. Don't suppose I'll ever hear from them though.

Edit: fixed link

Monday, November 14, 2005

Customer Service: Compare and Contrast

Way back when I posted about sending a note to the Bloomington newspaper about adding an RSS feed to their website. I did that again this week, at the site Macadamian.com, which has a regular column called Critical Path, tips for software managers. Got almost an identical response, actually, with a quick response from an editor saying they were considering it, followed a few hours later with a link, and now I'm subscribed to it in my feedreader. Very nice; great customer service.

Now a month or so ago, I sent not the exact same question, but a similar question to the Indiana University School of Informatics, where I think I might be an alumni. (I was for a while, and then I wasn't again, but now I hear that the IU Computer Science department has been assimilated, and so I must be again. Unless I'm not. Anyway.) The school has an RSS feed, which is good, but the unfortunate bit is that the feed is just old-school marketing, PR stuff. IU Research in Spotlight at Seattle Supercomputing Conference. Now, by no means do I object to reading that stuff; a lot of it is important and interesting. But if this is a cutting-edge school, I want a cutting-edge web page. I want to read student and professor blogs, with comments, utilizing new technology to block spam. I want to see wikis, and web pages with Ajax components. I want podcasts of lectures and symposiums. I don't want a bunch of static web pages that no one is ever going to look at, except for the one time a month they need to look up an email address.

So, on their comment page, I wrote up my request.

No response. At all. My comment was ignored completely.

So what's the deal here? Does the industry just change too fast for universities to keep up with? Is it a problem specific to Indiana University? Or is it just that they're not a business and therefore have no interest in responding to customer requests?

I don't know. I'd like to know.

Icerocket tags

Saturday, November 12, 2005

Midsummer Night's Dream at IU Opera Theater

I went and read the Peter Jacobi article in the Herald-Times before writing this. He's got something of a reputation for sticking to positive items in his reviews, and if that's true, this opera must have been deeply troubled, since he presents a series of negative comments from the director, even if you have to read between the lines a little to get them. "Lack of stagecraft", "Not enough rehearsal time", "Children may need to be miked", were some of his comments.

All that said, I thought the opera was stunning. Now, when I write reviews, I write them not just of the production, but of the opera. I can't compare this production to the debut at the Aldeburgh Festival in 1960, or even the one at the London Coliseum in 1994. So I wasn't sure if the role of Oberon was always played by a countertenor or if that was just someone's cool idea (it always is) or if Puck is always a ballet dancer who shouts his lines (he shouts, but isn't necessarily a dancer).

And I wasn't blown away by Oberon at first. It took me a while to get used to the rhythm of his lines, but once I did, I thought it fit in perfectly with the beautiful mystic green in the abstract sets and lighting. The fairy costumes were done in modern punk, which was bright and colorful enough to work perfectly with the sets, and the four lovers were dressed in street clothes. Lysander came out in a T-shirt with the name of a fraternity on it, which got a big laugh when Oberon instructed Puck to "Look for a mortal in Athenian dress." (Athenian, fraternities, Greeks, get it?).

Some of the children did have to be miked; of the four majors, I think it was two and two, but that didn't matter. As far as stagecraft, it's certainly been a long-held belief of mine that singers can't act, which has been true here at IU at least. So the fight scene was drab at best. The rude mechanicals weren't bad - I suppose you can tell a good actor by how convincingly he can badly act - and Bottom was pretty good, although my "feel" for the character has always been a bit more boorish.

Of course, that's a judgment on the play. And while I'm at it, I could have happily left after Act 2, because I always feel badly for the mechanicals when everyone makes fun of them. But the music, the countertenor, the costumes, the dancer, in the first two acts, all combined together to make this one of the three or four best operas I've seen at IU. Dreamy.

Icerocket tags

Friday, November 11, 2005

Automated testing using Ruby

So here’s the problem statement: Write a Ruby script that will open a database, check it for accuracy, and if it is NOT accurate, send an email describing the issues.

So this will require (a) opening a database in Ruby, (b) running a test in Ruby, and (c) sending an email in Ruby. None of these is probably very difficult, but not being a Ruby expert I went searching for examples on the web. I wasn’t thrilled by the examples I found for these tasks, so I thought I’d write up what I did.

Databases: This is code that will open an Access database and grab all of the rows in the Exam table:

require 'dbi'

DBI.connect("DBI:ODBC:driver=Microsoft Access Driver
(*.mdb);dbq=" +
ENV['TESTINSTALLDIR'] + "db1.mdb ") do dbh

rows =
dbh.select_all('select * from Exam')

Tests: I started by writing my own little test procedures, until I stepped back and looked at what I’d done – I’d developed a rudimentary RUnit, along the lines of NUnit or CPPUnit. At that point I was sure that it had been done before, and it had – and not only that, but it turned out to be part of the Ruby standard library. Although what I’m doing here isn’t really what I would call unit testing, it’s close enough that I decided to use that instead.

require 'test/unit'
require 'test/unit/ui/console/testrunner'

DatabaseTest < Test::Unit::TestCase
def test_dbContents
assert(rows[1]["Media Type"] == "Image Server")


Email: There are some good email sending examples around. I started with this one and ended here:

require 'net/smtp'

class FailCounter

def TextBody()
email_text = <<END_EMAIL
To: "Ben Fulton"
From: #{@from_addr}
Subject: #{@project}
automated test failure

An automated assertion failed for the project



return email_text

def Finalize
if (@counter > 0)

Net::SMTP.start("myprovider.net") do smtp
smtp.sendmail( TextBody(),
@from_addr, @to_addr )
puts "No failures!"

Now, my goal was for the results of the test to be put into the email. That took a long time to figure out. Step 1 of the solution was to realize what the automated test runner was doing under the covers, and take advantage of it. So I replaced the run(DatabaseTest) line with this:

tr = Test::Unit::UI::Console::TestRunner.new( DownloaderTest)
passed = tr.start()
Now I have the results back in a TestResult, which I can examine for failures, so emails only go out if some tests actually failed:

if (passed.failure_count() > 0 passed.error_count() > 0)
fc =
fc.Add( “Failures found” )

Step 2 of the solution is to get the information from the test in a format that I can put in an email. It turns out that TestRunner.new can take a parameter defining where output should go, which defaults to STDOUT. I could have redirected it to a file, but that seemed like unnecessary work, so after a lot of searching I came up with what I was looking for, StringIO, which takes output and writes it to a string:

sio = StringIO.new
tr = Test::Unit::UI::Console::TestRunner.new(
DownloaderTest, Test::Unit::UI::VERBOSE, sio )

I also changed the default NORMAL verbosity parameter to VERBOSE. Then I replace the FailCounter “Failures found” line like this:

fc.Add( “Failures found: “ + sio.string )

And that was it. I’m not going to glue all this code together here, since this post is already too long, but hopefully if you’re interested it should be straightforward. Good luck!

Icerocket tags

Wednesday, November 09, 2005

Kansas school board redefines science

Kansas, for shame!

I hereby pledge that I will never move to Kansas, nor allow any member of my family to attend any school in that state.

Icerocket tags

Build/Test machine

I posted here about our plans for updating the ProSolv build process. It's been going pretty well; the hallway machine is up and running, although I had to bring a table from home to set it up on, and now someone wants to buy it from me :)

Builds are scheduled for 6 PM each night, and an automated test script runs all day. Right now we just have a single script that takes about 15 minutes to run. It's powered by Ruby and by AutoHotKey, which works nicely as an automator. I especially like that the scripts are simple text files.

A lot of people don't quite understand what I'm trying to do. They look at the machine and say, "What's the point of running a test that doesn't log any results?" The answer is, that there is a lot of importance to just exercising the UI. If we have a build one day where you click on a study image and the application crashes, this test process will find that.

Nevertheless, as long as this machine is running scripts, there's no reason for it not to log results. I thought for a while that I would have to add code to the application to write out sensible log results, which is not a process to undertake lightly, but it occurred to me recently that the GUI manipulations that the script is doing mostly result in predictable changes to the file system and database. So I spent a little quality time with Ruby's DBI and Test/Unit modules, and wrote up some assertions that will send an email to me at the end of the script if the database isn't in the state I expect. It's only a start, but now I can add more assertions in the middle of the process, or add new assertions as I extend the test scripts. It's coming together very nicely!

I'm thinking also about modifying the machine to alternate test runs with kiosk-style data updates, such as how many files were compiled last night, or how many support calls were handled yesterday. It'll be interesting to see how people respond to that :)

Icerocket tags

Thursday, November 03, 2005

Gadgets and Office alive alive-o

Microsoft previewed its new Windows Live strategy yesterday. My reaction, along with a lot of other people's: It's a portal, and we don't want or need another portal, no matter how skillfully it's put together and how many neat gadgets are available on the site.

That said, here's what really got my attention in the announcement:

Windows Live™ is a set of personal Internet services and software...

So what exactly are we talking about, Internet services? Are we talking web services here? That would be cool. Here's what I want: The ability to add, to my site and not to Microsoft's, a Word document that can be edited by approved people. The document would ideally be stored on my site, but could then be bounced to a Microsoft service for some Ajax magic and editing. Is this the sort of thing that Office Live is going to make available. That would be awesome!

But I've gone searching around the web looking for any evidence that anything on Live is going to be addable to other web sites. Scoble said something - when does Scoble not say something? - but he didn't go into any details other than, "I’m still struggling to understand what I’ll get by putting a new Windows Live service on my blog or business site".

Robert, it depends on which direction it goes. I'd be thrilled to call out to a Windows Live web service as part of a mashup for my site - maybe a Click-To-Talk button using Messenger to dial my phone directly? - but if you're expecting me to make something available that users can only reach through the Live site, forget it.

So for me, the jury is still out until we get more details for developers.

Disclaimer: I own stock in Microsoft.

Icerocket tags

Wednesday, November 02, 2005

Code Reviews

Ed Gibbs says his team is about to institute code reviews. Of course, if you do pair programming regularly code reviews are pointless, since - turning all the knobs up to 11 - all of the code is reviewed all the time. But I've never worked in a shop where pair programming really took off. I'd be curious to hear how prevalent it is.

As I understand it, we at ProSolv are required by FDA regulations - perhaps here? - to do design and code reviews, although, especially for small projects, we often combine them into a single review. Currently I'm not convinced that they add anything to the quality of our software, although, as I've stated before, I think ISO can potentially be a big gain for a company and not just overhead. All the usual difficulties of code reviews apply - what sorts of things are worth bringing up? Is coder A receptive to constructive criticism? Is coder B tearing things down for the sake of doing it? Is coder C reluctant to make a great suggestion for fear of hurting feelings? Should the code be perfect, or just good enough? - and in the final analysis the review is either marked passed or failed.

I'm sure this process can be improved, but I'm not sure how. Maybe design reviews could be accompanied by UML diagrams. Maybe we just need a big slab of coding standards that have to be applied. For example, a review I'm looking at now introduces two new global variables to a C++ application. I think the industry consensus is that global variables are bad, but certainly the code works. Do we need a coding standard that says to avoid global variables? If we did that, how much extra overhead is added to the process?

I'm seriously considering offering a bounty of ten cents a line for any project that can remove lines of code from an application rather than adding them. I bet that would be more effective than fifty code reviews!

Icerocket tags

Tuesday, November 01, 2005


After my post yesterday on SysInternals and listening to the RootKit episode of Security Now, I decided to give RootkitRevealer a whirl on my system. It turned up a slab of hidden registry class ID keys underneath HKLM\SOFTWARE\Classes\CLSID:


I was mildly worried and spent a bit of time tracking down these keys. I think I can say pretty definitely what they're for now; it's Pinnacle Studio 9 hiding their registration keys. Irritatingly, Studio doesn't handle logging in as a non-admin properly, either - every time I start it I have to click the little message that says "Don't show this screen again".

Icerocket tags