Simple ASP.NET 301 Moved Permanently Redirector

Posted by Dave Bouwman | Posted in ASP.NET, Blogging | Posted on 25-05-2009

0

I’ve been running DasBlog since I started blogging back in February 2005, and it had been good, but the time came to move on to something that required less hand-on work to keep current. Enter WordPress. You can read how the content migration went in a previoud post, but this is just about the final step in the process – setting up a redirector. 

Armed with my csv file listing the old dasblog based urls and the new wordpress urls, I needed to build a simple ASP.NET app I could drop in the old location, and have it spit back “301 Permanently Moved” responses when someone (or Google) hits the old Urls. It’s important to let Google know that your pages have moved, thus we send a 301 server response, which tells the search engine to never come back to that original location.

I should note that I can do this because my blog’s address changed – from blog.davebouwman.net to blog.davebouwman.com – thus I still had the old location available to run a .NET application, which could do the re-direct. If you are paving over a .NET blog with WordPress, and hosting it on the same Url, you’ll have to find a different option.

What I came up with was a simple Global.asax that seems to work pretty well. Not sure how it would scale if I had 10,000 posts, but at 390, it’s just fine – besides it was the only part of this project that went as predicted. The code below is everything – I do have a simple empty Default.aspx page, and of course the linkmap.csv file, but that’s it. You can try it by following this link:

http://blog.davebouwman.net/2009/01/06/CodeCoverageWhatsEnough.aspx 

 
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e)
    {
        //Load the CSV list into a hashtable and cache it
        LoadUrlsIntoCache();
    }

    private void LoadUrlsIntoCache()
    {
        Hashtable urls = new Hashtable();
        FileStream fs = File.OpenRead(Server.MapPath("./linkmap.csv"));
        using (StreamReader sr = new StreamReader(fs))
        {
            while (sr.Peek() >= 0)
            {
                string line = sr.ReadLine();
                if(line.Contains(","))
                {
                string[] parts = line.Split(',');
                urls.Add(parts[0], parts[1]);
                }
            }
        }
        Context.Cache.Add("UrlCache",
                            urls,
                            null,
                            System.Web.Caching.Cache.NoAbsoluteExpiration,
                            new TimeSpan(0, 0, 20, 0, 0),
                            CacheItemPriority.High,
                            null);
    }

    protected void Application_BeginRequest(Object sender, EventArgs e)
    {
        string requestPath = HttpContext.Current.Request.Url.ToString();
        Hashtable urls = (Hashtable)Context.Cache.Get("UrlCache");
        if (urls == null)
        {
            LoadUrlsIntoCache();
            urls = (Hashtable)Context.Cache.Get("UrlCache");
        }

        string newUrl = "";
        if (urls.ContainsKey(requestPath))
        {
            newUrl = (string)urls[requestPath];
        }
        else
        {
            //Requested Url not in cache... send to "missing content" page...
            newUrl = "http://blog.davebouwman.com/index.php/content-missing/?foo=" +requestPath;
        }

        Response.Clear();
        Response.Status = "301 Moved Permanently";
        Response.AddHeader("Location", newUrl);
        Response.End();
    }

</script>

ESRI Developer Summit Party!

Posted by Dave Bouwman | Posted in Blogging, Community, Dev Summit | Posted on 16-03-2009

1

In past years at the Developer Summit’s there has been an informal blogger meet-up on the Monday night – it was a good chance to meet all the people you interact with on-line, and kick off the week.

This year, DTSAgile – the software division of Data Transfer Solutions (who I work for) – is hosting a blogger/twitter/geo-lackey party. Basically if you are attending the Dev Summit, and are looking for something to do on Monday night, you are invited. All we ask is that you RSVP by this Friday (March 20th) so we have a good idea about numbers so we can gauge beer and food requirements.

What: Party – Free Beer & Burgers. We have a pool, but I’m guessing it will be a little chilly (not heated)

When: Monday March 23rd 6:00pm till you leave

Where: DTSAgile condo in Palm Springs (~1/2 mile north of the Convention center – we’ll email the exact address later this week, after you RSVP).

Who: You and your traveling posse.

RSVP Here: http://www.dtsagile.com/Events/DevSummit

Hope to see you there!

OverheadUpdate.com: AllTop for Geospatial?

Posted by Dave Bouwman | Posted in Blogging, Community | Posted on 20-12-2008

1

Hard to say how this will take off, but I like the idea – kinda what I envisioned for ArcExperts.net, but never quite found the time to carry through with. Anyhow, I had to blog about this as someone felt that my little corner of geo-geekdom deserved a place on the front page (Thanks who ever you are!)

overhead-12-19-08

Minor Blog Update

Posted by Dave Bouwman | Posted in Blogging | Posted on 02-05-2008

0

Seems that I have not been reading my own blog on the site, and apparently the CSS was more than a little jacked up. If your read this @ the site, you may notice that it’s now a fluid layout, and hopefully the font sizing makes a little more sense.

Anyhow – I’m also planning on updating my actual website (It’s on the long list of "stuff" to do while out of the office and not a) hanging with my family, b) cooking or c) riding).  I’ve gotten quite a bit of feedback on the fundamentals section, and I’ve got some ideas on other topics that could be covered there. We’ll see if I can get to that over the next few months.

Data Transfer Solutions: My New Home

Posted by Dave Bouwman | Posted in .NET, Agile, Blogging, careers | Posted on 27-11-2007

3

Yesterday we sent out a press release via Chris Spagnuolo’s GeoScrum blog. Thus, I think it’s now ok to say that my entire team and I are now with Data Transfer Solutions.

DTS_small_web 

The team is super excited about the new opportunities this change brings (the blazing workstations, “green” servers and build out, IKEA workstationsgreat chairs, and a strong interest in adopting agile methods doesn’t hurt either!).

On the technology front, we are still sticking with .NET and ESRI for the most part. We expect to be doing much more web work than in the past, and with the release of Visual Studio 2008 and .NET 3.5 this will be very cool. I expect we’ll be working with ArcGIS Server / tile caches on the back end, as well as Virtual Earth and Open Layers for the client UI. Mix in some unit testing, and it should be lots of fun.

We’re also going to be adding some new capabilities – specifically Agile Consulting and Coaching. This is still in the early stages so I’ll be posting more about it as things develop, but I’m very excited about some things we have planned, and the opportunity to share our experiences, methodologies and practices with others.

I’ll wrap this up by saying that I’m also very excited to work with the existing DTS development team. Although I’ve only met a few of them, and only very briefly, but their depth and breadth of skills are pretty amazing – I heard that someone wrote some ArcGIS Desktop tools using Boo (scratching your head – here’s a hint: Boo is a Python-like scripting language for the ECMA CLR implementations such as .NET and Mono.)  I think they will be keeping us on our toes!

I’ll be posting more about starting up an office, and getting things rolling over the next few weeks. Some tasks on our current backlog - order & setup some servers, get a firewall (advice welcomed!), move out of Chris’s living room into our “temp” space, finalize the build out plans for our “real” space… fun!

Windows Live Writer Publish Date Weirdness…

Posted by Dave Bouwman | Posted in Blogging | Posted on 19-09-2007

0

Windows Live Writer is a pretty good off-line blog editor in most ways, but one thing that just does not make sense to me is the setting of the publish date.

I can understand that you may want to publish something at a future date, and that’s great – but it seems like there is something amiss in it’s defaults.

When you start a post, the publish date is not set…

wlw-pub-date1

If I use the pull down to expose the calendar to set the date…

wlw-pub-date2

it does not seem to re-set the TIME – note 7:15pm is still set. Ok – so what – the time is off by a few hours. The issue comes in RSS and aggregation, where the time stamps will control the order in which posts appear. So, my post on Visual Studio Memory Use (posted about 10 minutes before this one) may actually appear to be pinned to the top of aggregators like PlanetGeospatial and ArcExperts until the post date & time pass.

Anyhow – if you are using WLW, this is something you may want to be aware of.

The GIS Community is an Archipelago…

Posted by Dave Bouwman | Posted in Blogging, General | Posted on 18-08-2007

7

One way to get a conversation started is to bring up something the entire group has in common – in this case the “G” in GIS… and so the un-conversation continues.

[This started as a comment on Aaron's GISDevCafe, but got longish, and so it's here.]

I agree that there is something of a lack of cohesion and conversation between the various users/bloggers/analysts/forum-ers/managers/conference-ers etc involved in “GIS”.  And I think the reason is quite simple – I believe that the GIS “world” is fracturing. Or, looking at it differently - people have been specializing. 

For a long time GIS users were all-around technologists. Pretty much everyone worked directly with data. We all handled weird projections and conversion of strange data formats. Serious thought was put into how to run an analysis because the processing would take so long that you could not simply run it again. Automation was limited but we did what we could and many poor souls took on sed, awk and grep with reckless abandon. Although we may have been using GIS for different purposes, we could all talk about the largely shared experience of “doing” GIS. 

Over the last 5 years, this specialization has been accelerating. I think this is especially prevalent in the developer community, where we have, by necessity, jumped into the software development/engineering pool. Heck we now have our own ESRI conference. The spatial analysis people have headed towards Model Builder / Python land and lived with days of processing time, or gotten all serious and hit it with C++ and GDAL/OGR to get some performance. Data Managers have become DBAs. The meta data crew are now working with Xml and Xslt .  And the web crew have ripped into Xml, REST, Javascript and Ajax. Hell – Google Maps pretty much defined “Web 2.0″. Throw in open source & mashups and you’ve got quite a ruckus just in “online maps”.

As for me, I spend much more time reading .NET & software development blogs than PlanetGeospatial or anything from ESRI. Sure the ESRI blogs are good, but they are still very much about the mechanics. I’ve specialized to the point that I know we can solve the mechanics (sometimes with hacks) but I want to know more about the best way to design the software - for testability, re-use and maintainability. And these topics are never discussed in the GIS “space”. Thus, I spend my time and consequently my “conversations” at locations where these topics are discussed. And this same thing is going on all over the place. Specialization is rampant.

Add to that the fact that there are few really “new” core GIS concepts, and the “GIS Community” as a whole has little to talk about – other than ESRI licensing or other “shared experience” items – Google’s new re-routing feature etc. We are now a whole set of smaller communities, specialized in our own areas, and united by the “where” of the data we work with. And Aaron put it quite nicely…

I see a microcosm of isolated islands loosely held together by the ocean of Geography

And essentially that’s where we are – the “Archipelago of GIS”.

Some may see this as “bad”, but I don’t think so. It’s just a function of a maturing Information Technology sector. Back when Databases were the “new” thing I’m sure there were loads of discussions about all kinds of stuff – like normalization and set theory. Do you think DBA’s are all yearning for those old days? Nah – I’m thinking they kinda like stuffing Xml documents into tables and being able to use SQL and XPath to query them and still getting response times only dreamed of back in the day.

GIS is merging into mainstream IT, and I for one welcome our new better-paying overlords.

New Feeds in ArcExperts.net

Posted by Dave Bouwman | Posted in ArcGIS Devt, Blogging | Posted on 15-08-2007

1

arcexperts-site-title

Just a quick note that I’ve added 5 feeds to the ArcExperts.net aggregator. They are:

Just a reminder – if you write a GIS Development blog and want to see it in the ArcExperts aggregator, just use the contact me link at the top (and I promise to add feeds faster in the future!)

Future of ArcDeveloper.net…

Posted by Dave Bouwman | Posted in ArcGIS Devt, Blogging | Posted on 15-08-2007

5

As I sit here looking at my little $10/month hosting account, I’m seeing that ArcDeveloper.net is taking up a lot of space, and getting relatively little traffic. In addition, I believe that the vast majority of the “1279″ the registered users are actually spam accounts which never activated because their email addresses were bogus. And you can bet I’m enthusiastic to dig in there and clear them all out. 

On the bright side, Google Analytics shows a consistent 100 or so visits a day, with 70% of the traffic coming from Search Engines – at least it shows that people are searching for what the few participants are discussing.

arcdeveloper-analytics

And I know from talking to some of you that it has been a good resource from time to time. But, as ESRI is now fully supporting .NET 2.0 (a primary reason for starting this up), and their forums are threatening to add RSS feeds any day now, perhaps this site’s time has come and gone.

The question for me (and I guess for you) is – should I keep it going? I’ve got a lot of other stuff on the go, and so promoting/maintaining the site is just not happening. The wider ESRI Developer crowd has not jumped in either – I’m guessing it has too much overlap with the main support forums.

If people think it’s still useful, please let me know in the comments, or via the Contact link at the top of this page. Is there anything else you’d like to see on the site? Different forums? Should it be running on different software (Community Server does many things “ok”, but nothing really well in my opinion – and it’s a pain to administer).

What would drag me in is one or two simple forums:

1) Agile Development and ArcGIS – which would cover things like Test Driven Development, Continuous Integration, Automated builds, WiX, Sandcastle, and all the other good “goo” that goes around a successful development team.

2) Quick Hits – killer questions and  simple solutions. Kinda like a light-weight community blog where you can post questions that just are not going to get any play at the ESRI forums, and where people without blogs can post how-to’s.

Another option would be to kill Community Server all together and slap up a semi-secured wiki (i.e. read-only for public, editable for email validated users). Much more free-form, but that also has it’s uses.

Anyhow – let me know what you think the future of ArcDeveloper.net should be. If someone else wants to take over the site (and move it to their hosting account) I’d be up for that too.

Agile Update…

Posted by Dave Bouwman | Posted in Blogging, Fundamentals, Productivity | Posted on 10-08-2007

0

Back at the 2007 ESRI Developer Summit, I did a presentation on “Being Agile“. At that time, I mentioned that we simply followed general agile principles, but did not particularly follow any doctrine. For a variety of reasons we have had to become more formal in our quest for agility, and have adopted Scrum.

For those not familliar with Scrum, it’s a very light-weight project managment methodology that’s based on agile principles. Work items are managed in a set of backlogs and are done in a series of 2 or 4 week sprints at the end of which they produce a “potentially shippable product increment. Here’s a good diagram that shows it all. Every day the team meets for 10-15 minutes to repost status – this is the “scrum”.

What’s really nice is that there are alot of success stories that one can reference with “selling” Scrum within an organization and to clients. Not to mention a slew of great books. Including what I’d recommend as a really good intro to the topic  Agile Project Management with Scrum (Microsoft Professional) by Ken Schwaber.

Thus far, I have to say that it’s the best way to develop software that I’ve ever seen. It’s easy – nothing in it seems to be “extra” – to put it another way – no TPS reports. Things proceed smoothly, the team is all bought in, and we are cranking out the code. Last week my co-worker Chris Spagnuolo and I attended a “Certified Scrum Master” training course in Denver. Led by Mike Cohn (blog), this was a great two day class that covered everything you need to know to run a scrum team – aka being a “scrum master”.

We liked this initial class so much that we are heading out to Orlando in September for Mike’s course on Agile Estimating (here’s Mike’s book on the same topic and YouTube videos – part 1 and part 2 - of a presentation he gave @ Google in March 2007). We are really excited about this because it will be driven by the detailed historical data from our team’s sprints and it should be more much more accurate than other “gut-based” estimating systems.

If this sort of thing strikes your fancy, Chris Spagnuolo (our “scrum master”) has started a GeoScrum blog where he will be covering the on-going journey of managing a cutting edge geospatial development group with Scrum. We are constantly adapting the process and our tools and Chris will share tips on what works and what doesn’t, as well as general project managment zen.