Dev Summit Slides on EDN and Planet Geospatial Update…

Posted by Dave Bouwman | Posted in Blogging, Dev Summit | Posted on 29-03-2007

0

First, Rob Elkins posted that the slides from the technical sessions are up on the EDN site. This is great news, as (unlike some people) I did not take photos of each slide in each session. I just wanted to add a kudos to the ESRI team for getting these up and available so quickly – I actually remember which presentations I wanted to review!

Second – a shout out to James Fee for fixing up PlanetGeospatial – the beta site is actually handling blogger feeds – no more “tag:blogger.com,1999:blog-7485601.post-6117499263807661458″, images are inlined, and it looks a whole lot nicer. Hopefully this carries over to the RSS feed as well. Thanks James!

Debugging ASP.NET Unit Tests on Classes in App_Code

Posted by Dave Bouwman | Posted in ASP.NET, Team System, Unit Testing | Posted on 27-03-2007

0

As if the title of the post is not painful enough, I thought I’d just whip up a quick post for others who have run into issues with getting debugging of ASP.NET unit tests working for classes in App_Code.

Just a quick note – ordinarily I’d create a separate assembly, but part
of this code is working with the ProfileCommon class, which is created
on the fly by ASP.NET based on settings in web.config, and as far as I
could find, you can’t access this class outside of an ASP.NET web app.

So – I’ve created myself some classes and had Visual Studio cook up some unit tests for me. I jumped in there and added some legit code, and went to run the test and… I was not getting an error per se – the break points were simply not being hit. In the border of the code, there was a small icon as shown below…

Mousing over this, I got the highly informative message: “The breakpoint will not currently be hit. No symbols have been loaded for this document”. So the obvious thing you’re thinking is that I need to attach the debugger to the ASP.NET Worker process. Anyhow, that’s what some intensive Googling revealed.

The MSDN guidelines on setting up debugging of ASP.NET Unit Tests is here. And while it is conceptually correct, the only issue is that my version of Visual Studio 2005 (Team Edition) does not have “Attach to Process” on the debug menu (not sure why) . Which led to this article which notes that it may also found at “Tools –> Attach to Process”. Armed with this, I was able to make some headway…

Here are the abridged steps:

  1. Write some classes in App_Code that you want to test
  2. Create a test project, and have it generate the tests – this is critical as it will build private accessors for you.
  3. Attach the VS debugger to aspnet_wp (XP) or w3wp.exe (Windows Svr 2003)
  4. Then run your test from the Test View (Test –> Windows –> Test Viewer)

Even like this, it’s not exactly bomb-proof. I need to re-attach a lot, and start/stop standard debugging of the site occasionally. All the more reason to put your business logic in another assembly if at all possible!

EDN Batch Files & SlickRun Magic Words…

Posted by Dave Bouwman | Posted in Productivity | Posted on 27-03-2007

1

I’ve had a few mini-posts about various handy things lying around, and I thought I’d lump them up into a single post. Here goes…

EDN Batch Files
If you are like me, and have loaded your entire EDN subscription onto your development box, you may have a whole mess of services gobbling up resources when you really don’t need them. I got a little sick of this so I created some batch files to start and stop services as I need them. These are super simple to create, but I thought I’d throw the code up here so you can simply copy/paste.

arcstart.bat

net start MSSQLSERVERnet start esri_sdenet start "ESRI Image Server"net start "ESRIImageServerReporter"net start "ESRI Image ServiceProvider: 3983"net start ArcServerObjectManager

arcstop.bat

net stop ArcServerObjectManagernet stop esri_sdenet stop MSSQLSERVERnet stop "ESRIImageServerReporter"net stop "ESRI Image ServiceProvider: 3983"net stop "ESRI Image Server"

[Notes: If you're running Image Server on a different port, you'll need to change the 3983 to your port number. Also - if you're using SQL Express, the service name is MSSQL$SQLEXPRESS]

I also created some subsets of these scripts to start just MSSQL/ArcSDE if I’m working with ArcMap only, just Image Server if that’s what I’m up to, and just ArcGIS Server if that’s what I need. It’s nice to have these packages on my workstation, but when they are all up and running they can easily eat a more than a gig of RAM – so it’s nice to be able to start and stop them as needed. To make this even easier to user, I map these scripts into SlickRun…

SlickRun
For anyone who spends their day working with a PC, SlickRun is awesome. Get it now. Really. Now. I’m not kidding. It takes a little getting used to (like 5 minutes), and then you are hooked. Basically it’s a n application launcher, but a pretty smart one. When not in use, you can set it to be hidden so it does not clutter up your desktop. When you need to do something, just hit the hot-key (configurable) and it will jump to your mouse and you can type in what you want. A simple example would be mapping “vs” to open visual studio – this is the most basic usage. You can get more complex though.

For example – if I want to search EDN for IWorkspace, I hit my hot-key <win+Q> type “edn IWorkspace” and hit enter. It then opens my browser and executes the search. Nice.

Here are some of my Magic words…

Magic Word
Description Target
Google Search http://www.google.com/search?hl=en&q=$W$
edn EDN Search http://edn.esri.com/index.cfm?fa=search.results&c_2_a=on&dl_1=on&sa=2&q=$W$
map ArcMap C:\Program Files\ArcGIS\Bin\ArcMap.exe
cat ArcCatalog C:\Program Files\ArcGIS\Bin\ArcCatalog.exe
em:<name> Email someone C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /c ipm.message /m “<email address>”
msdn Search MSDN http://www.google.com/search?q=site%3Amsdn.microsoft.com+$W$
2003 VS2003 C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe
2005 VS2005 C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe
blog my blog http://blog.davebouwman.com
arcstart Start EDN Services c:\batch\arcstart.bat
arcstop Stop EDN Services c:\batch\arcstop.bat

You’d be suprised just how much time slick run saves over a given day.

Dev Summit Wrapup & .NET SIG Presentation

Posted by Dave Bouwman | Posted in Dev Summit | Posted on 23-03-2007

2

Made it back to Colorado today, and finally got some time to post a little more about the Dev Summit. Unfortunately we scheduled out flight home at 1:00pm, and could not hit the closing session, so I hope to read other peoples thoughts on that.

Overall, it was a great conference. One thing that I think went over really well was the choice to focus the sessions on 9.2. As with last year, the chance to meet with so many of the ESRI team members and other developers to discuss various development strategies is incredibly valuable. Even with twice the number of attendees, it is certainly the event of the year for ESRI developers.

There are only two suggestions I’d make for next year:

Session Scheduling
Session scheduling is always really difficult, but many of the “Deep Dive” sessions were slotted at the same time. I can see this organization working for people following “tracks”, but I work with  pretty much the entire product line, and there were many sessions that I wanted to attend that I could not. At least the slide decks will be put up on EDN.

Down Time
The sessions were stacked up all day long, with tons of great content, but there were other things going on at the same time – Meet the Teams, Tech Talks, blogging, trying out what you just heard, and just talking with people.

I’d like to see the Dev Summit extended by at least a day – with more repeat sessions on the deep dive topics. This would make the decision to skip a session to meet the team a little easier – you would have a chance to hit a repeat the next day.

.NET SIG Presentation
Thanks to Art Haddad for giving me the opportunity to talk at this meeting. From the feedback I got after the talk, and postings on other sites, it sounds like people enjoyed it. As promised, I’ve uploaded the presentation. If you have any questions about the presentation, use the Contact link at the top of the page.

Download Powerpoint (includes notes)

Thanks to the entire team at ESRI who put these conferences together and make them the great events the are. See you all at the User Conference!

Dev Summit: Plenary Session Notes

Posted by Dave Bouwman | Posted in Dev Summit | Posted on 20-03-2007

0

Just some notes from the Plenary Session that I thought I’d share…

 

Jim McKinney

Service packs will start including additional functionality as a means to ship updates prior to major releases. Mainly focused on ArcGIS Server

 

Scott Moorehouse – ESRI Architecture

Mainly a review of the overall ArcGIS software architecture – pretty high level stuff. The section on “new” stuff

- mentioned top priority for bugs and documentation.

-planned overhauls to the ArcGIS Desktop UI (”ribbons” – not stated specifically, but I’d guess this is really a WPF / AXML update to the UI) 

- overhaul code components: geodatabase, mapping, graphics

- and the usual “we will improve ArcGIS Online”

Currently two development tracks

- 9.3 Service packs will add functionality – specifically mentioned

    • more OGC support
    • PostgreSQL support
    • More work in the Web ADF
    • “google maps”-like Javascript API based on MS AJAX
    • Vista support for Desktop

- 10.x focus on core changes

    • 64bit support
    • multi-threading support for multi-core chips (specifically geoprocessing and display)
    • additional coarse grained objects
    • updated graphics engines
    • performance improvements in Geoprocessing framework
    • open API for the file geodatabase
    • Adding metadata catalog into the geodatabase (searchable, tagable)

Conceptual architecture will remain the same, mainly a modernization of the codebase.

 

Dave Wraizen – ArcGIS Server

Promoted the ArcGIS Server Team blog. Rumor has it that there will be more teams blogging shortly.

Also talked about their “big idea” pattern: Author, Serve & Use

The demo was pretty standard – author a map in ArcMap & GP Model, publish them into server, create a default web app, and then customize the app in Visual Studio to add some MapTips (on point features).

Task Framework touted as a good extension point – not sure I agree, but would be good if you just want to add simple functions into the out-of-the-box type of system. However, I’m thinking that for larger, more custom applications, the task framework is likely a little to coarse grained.

Enterprise Integration Demo

This was the SOA/ESB drag & drop BPEL love fest. I’m sorry, but I’m not really convinced that the resulting “agility” of this architecure is worth the expense , complexity and performance penalty (serialized/deserialize all over the place). If you have an enterprise big enough to support the cost, I’m guessing that most of your business processes are relatively static at the coarse grained level. What’s more likely to change are smaller variations, which will usually require a low level change in the code. Conceptually interesting, but I’m just not ”feeling” it yet.

 

Mobile Demo

Drag & Drop development demo with the Mobile ADF – quite cool. Personally, I think the Mobile ADF is pretty under rated, and hopefully we’ll see more people using this in place of MapObjects type applications.

 

ArcGIS Explorer Demo

Exposure of Tasks – loading an excel spreadsheets of addresses on the client side. the E2API is lean, but powerful. Can use a standard user control and parent that into the Task Center arae in the Explorer Interface. Tasks are spawned into separate threads in the Explorer. They hide the threading for you. They have also created an automated task installer – you basically specify a download location in an Xml file.

 

Running out of battery power, I’ll post more on the technical sessions later.

.NET SIG Presentation @ Dev Summit…

Posted by Dave Bouwman | Posted in Dev Summit | Posted on 16-03-2007

1

I was thinking that there would be some more details posted at the Dev Summit site about the SIG meetings, but apparenly this is it…

.NET Special Interest GroupArt Haddad
Primrose B
Come join us as we discuss .NET Development with ArcGIS 9.2. Learn what
people are doing with .NET and GIS. Let us know what you would like to
see the .NET teams do to help you develop your applications and
anything else of interest. Help us grow the community of .NET
developers by sharing your ideas.

 

Art Haddad asked me to give a talk at this years .NET SIG – The theme of the meeting is “Agile Processes”, and I’ll be talking about changes we made to our coding practices to enable us to be more adaptive and allow our codebase to be more “change-tolerant”. Here’s the opening slide…

As an aside, over the last 6 months or so, I’ve seen a few really good presentations (via google video) by top tier presenters. These two by Seth Godin and Lawrance Lessig specifically stick out. I though that for this one (since it’s not a for a client), I’d try some of the techniques used by those guys and discussed over at PresentationZen.com. If you come to the SIG, I’d love to hear what you think of it.
 
The meeting is Wednesday from 12:00 to 1:30 in the “Primrose B” room. Hope to see you there!

Dev Summit Blogger Meetup Reminder

Posted by Dave Bouwman | Posted in Dev Summit | Posted on 15-03-2007

2

Just a quick reminder before we all head off to Palm Springs – the Dev Summit Blogger Meetup will be:

Monday night, at 7:00pm in the Wyndham Hotel Bar.

So when they kick you out of the Solutions Expo, ESRI Showcase, or Community center, go out the doors, walk past the Wyndham pool and into the bar (it’s basically in the hotel lobby). We’ll be waiting.

To make the actual “Meet-Up” part of the meetup easier, I thought I’d throw up a relatively recent photo of myself in case we’ve never met – whether you make it to the meetup or not, be sure to say hello if you see me wandering around.

Dev Summit Pre-Conference Survey Results…

Posted by Dave Bouwman | Posted in Dev Summit, ESRI | Posted on 14-03-2007

5

ESRI has posted a PDF with summary stats of the Dev Summit pre-conference survey results. I think it’s very cool that they have released this information, and there are a few interesting nuggets in there…

Importance of Blogs as a Resource


I find this pretty suprising, since I believe that if you asked the same question to the much broader .NET developer community, blogs would be in the top 5 – mainly because of the positive impact that the Microsoft developer blogs have had. Since 97% of respondents said that “Developer Resources” are important, I believe that this result simply reflects slow adoption within the GIS community.  Despite this result, I hope that ESRI increases blogging by the product teams and professional services.

Developer Technologies


Three things stand out on this one…

ASP.NET Supremacy
ASP.NET seems to be pretty important to almost 80% of the respondents. Since I’m pretty sure that there are still an awful lot of people writing code for desktop, it makes me think that there is a tight correlation between ArcGIS Server developers and a willingness to take on-line surveys.


Visual Basic 6 beats Python, Java….
This suprised me. I loved VB6 when it was the only tool we had to work with, but it’s just so painful compared to using .NET – and the transition to VB.NET is about a smooth as can be – and you can get the Free Express Editions – why why why are you still writing VB6? (I can understand support & maintenance) The fact it beat out Python and Java makes me think that there are not many Python/Java/Perl etc. developers out there.

REST? What’s a REST?
While this is still a fermenting concept, REST architecture is a great way to do simple “servicey” things. I’m glad that ESRI included it on the list, and I think it will move up as more people start grokking it.

Subversion 1-Click Setup

Posted by Dave Bouwman | Posted in Devt Tools, Software | Posted on 06-03-2007

0

A while back I posted about setting up my home source control server using Subversion. The original post basically listed the steps to getting it installed.

I was just reading Omar Shahine’s blog, and he noted that there is now a 1-Click Subversion setup package for Windows users. I had not heard about this, and thought I’d point this out to others. Installing subversion was pretty simple before, and now it’s virtually painless.

So – if you still have a list of reasons why you were not using source control, you can strike out “difficult to install” and “cost”.

Powershell + ArcObjects = Automation

Posted by Dave Bouwman | Posted in .NET, ArcMap, Powershell | Posted on 06-03-2007

0

In my last ArcDeveloper talk, I discussed how to automate common ArcMap tasks without actually using ArcMap. The talk was based on a previous blog posting: Automating Maps: Using ArcObjects without ArcMap. I did not have time prior to the talk, but I had wanted to show how you can take the simple MapMaker class in that example, and wire it into Powershell to create a simple command line utility that could spit out maps. I found an our this evening, and whipped this up. It’s my first foray into PowerShell, so be kind ;-)

For those who have not heard of it, PowerShell is the new Windows shell. It exposes “korn shell”-like power (you recall all that grepping, awking and piping fun), but mixes in objects.

Here’s how the Powershell documentation describes it…

Unlike most shells, which accept and return text, Windows PowerShell is
built on top of the .NET common language runtime (CLR) and the .NET
Framework, and accepts and returns .NET objects. This fundamental
change in the environment brings entirely new tools and methods to the
management and configuration of Windows.

If that’s not enough to pique your curiosity, I’ll also add that pretty much anything that Scott Hanselman says is cool is worth looking at.

I’m not going to walk through all the details of installing powershell and configuring it – I’ll leave that to you (resource links at the bottom will help). I will show the basic pieces, how to register the PowerShell Snap-in with PowerShell, and how to use it.

Creating a Powershell cmdlet

Create a new class library project in Visual Studio 2005, create a class and throw this in.

using System;

using System.Text;

using System.Management.Automation;

using System.Management.Automation.Provider;

using System.Diagnostics;

using System.ComponentModel;

 

    [Cmdlet(VerbsCommon.Get, "ParcelMap",DefaultParameterSetName = "")]

    public class GetParcelMapCommand : PSCmdlet

    {

        private string _pid;

        private string _outputFile;

 

        [Parameter(Position = 0)]

        [ValidateNotNullOrEmpty]

        public string PID

        {

            get { return _pid; }

            set { _pid = value; }

        }

 

        [Parameter(Position = 1)]

        [ValidateNotNullOrEmpty]

        public string OutputFile

        {

            get { return _outputFile; }

            set { _outputFile = value; }

        }

 

        /// <summary>

        /// Code here runs the commandline parameters

        /// </summary>

        protected override void BeginProcessing()

        {

            //We are hardcoding the location of the mxd file and the output type

            DaBo.MapMaker.MapMakerService service = new     DaBo.MapMaker.MapMakerService(“ParcelMap”,@”c:\parcelmap.mxd”,“Parcels”,“PIDN”);

            DaBo.MapMaker.MapMaker mm = new DaBo.MapMaker.MapMaker();

            //we just pass in the parcel id and the output file

            mm.ExportMap(service, DaBo.MapMaker.MapTypeEnum.PDF, _outputFile, _pid, 10, 10);

        }

 

        /// <summary>

        /// If we implemented code here, it would allow pipleline type operations

        /// </summary>

        protected override void ProcessRecord()

        {}

 

    }

That’s the cmdlet itself. But for Powershell to know about it, we need to create a snap-in. This is very simple code that you can look at in the source code, but basically all I did was copy/paste from the sample code at MSDN and change a few names. Here’s the top few lines…

 /// We’ll use the name of this class with add-pssnapin later

  [RunInstaller(true)]

  public class GetParcelMapPSSnapIn : PSSnapIn

  {

 

    public GetParcelMapPSSnapIn() : base()

    {    }

   ///code continues…

Post-Build Events
Once you have your assembly built, you’ll need to put it someplace that powershell can access it. I’d suggest copying the file to a common location for all your powershell snap-ins instead of having these things scattered all over the place. An easy way to do this is via post-build events in visual studio. I chose to put my stuff into c:\powershell.

Thus my post-build event is:

copy $(ProjectDir)$(OutDir)*.dll c:\powershell

I’m copying all the dlls to ensure that any dependancies (i.e. the MapMaker assembly) are brought along for the ride.

Register the Snap-In with PowerShell
Once it’s there, it’s time to open PowerShell, register the Snap-In and start spitting out maps. I’m sure that this part could be automated (someone likely already automated it using powershell itself). Anyhow – here’s how you do it manually.

In Powershell, cd to the folder where you have copied your assembly – c:\powershell for example.
Then issue these commands:

set-alias installutil $env:windir\Microsoft.NET\Framework\v2.0.50727\installutil
installutil dabo.powershell.dll
add-pssnapin GetParcelMapPSSnapin

That’s it. You can check that it’s registered by running this cmdlet

To use the cmdlet, simply feed it the parcel pin and an output file

And here’s the map it cranked out (as you can tell, cartography is not my strong suit)

Summary
Now I know that this is not the most useful example in the world – the command line is much more cryptic than using a simple winforms app. But if we look past the specifics of the example, and recall all the cool things we could do when combining Workstation ArcInfo with the unix shell commands, things start to open up a little. Particularly if you work in a production environment whre you are moving lots of files, transforming them along the way – it’s very common to need to string together a series of tasks in rather ad-hoc ways. By creating a library if geospatial cmdlets, you would be able to do this same style of processing. Have fun!

Resources
Source code  and data for MapMaker
Get-ParcelMap cmdlet source code
VS 2005 cmdlet template (from Scott Hanselman’s blog)
MSDN: Creating a cmdlet with parameters
MSDN: Registering a cmdlet with PowerShell