Contents tagged with Mapping

  • Silverlight Adventures - The Process So Far

    I’m currently in the process of rebuilding my Silverlight application. The initial beta of this app was somewhat underwhelming in that the problems it solved were those I found most interesting, not necessarily those the beta testers were looking for resolutions to. So we head back to the drawing board, this time to build out something that benefits my users as well as provides me with exposure to real world problems that I may not encounter in my day job.

    My employer has a number of MVP’s, authors and early adopters in various technologies, mostly Microsoft focused. They get their experience through lots and lots of study, helping out on projects they are not officially a part of, writing and public speaking. I’m fortunate to be a part of such a talented team but I have found that for various reasons, writing, public speaking and dissecting toolkit bits are not really my bag. It’s just too hard to focus on the abstract without a real business problem to apply it to. Building out MuddyGPS.com has provided that focus. I hope that at some point it will make a few dollars and pay for the hosting but in the mean time, it’s a valuable tool for thinking through the architectural solutions for various problem spaces. I have at least 3 or 4 other ideas for ‘amazing’ Silverlight applications in areas where I have some extra-development experience. If only there were another 8 or 10 hours in the day, I’d be good to go!

    So here are a few items I’m currently monkeying around with:

    Securing Data from Authenticated and Anonymous Users

    ·         My trails are available only from my site. I want to keep everyone, including my users, from seeing that raw data. They should only be able to view the trails within a map extent via my viewer. They should not be able to ping my service directly and scrape my data.

    ·         Once authenticated, a user can hit my web services all they want. I haven’t looked too deeply into javascript injection for a while but I know it’s possible because I’ve watched my logs and found that at least one caller is ‘tiling’ my maps looking for everything in my system. Of course it didn’t work but it didn’t stop him from trying.

    ·         Anonymous users are easy but there are some steps you need to consider in setting up your site when it’s in a hosted environment to be sure it’s secure.

    Asynchronously Loading Data To and From a Web Service

    ·         Once security was taken care of I found that loading 2,500 lines onto a map would cause the UI thread to hang long enough that I’d break into the code to see if something was busted.

    ·         Taking large data calls, breaking them up and recomposing the messages both on the client and server can take longer but providing the UI with a chance to redraw a small part of the screen at a time gives an animation effect that can be informative to the user, more interesting than a percent bar and give your user a more patient outlook on things.

    ·         Background threads are also fun but getting back to the UI update in a pattern-based operation can introduce some spaghetti-like coding habits that nobody wants to read or debug.

    File Uploads and Downloads

    ·         The most important questions for file uploads are:

    o   Do you upload the file as-is and process on the server?

    o   How long will the entire upload operation take?

    ·         Processing a file on the server has advantages in that you have the file and can always go back and reprocess it. The down side is that if you are not using all the data from the file, you are consuming more bandwidth than necessary. You are also probably storing both the file and the data from that file so you are dramatically increasing your server storage requirements. I’ve currently got about 370 Gb of GPS data on my server and it’s growing all the time. If I put all of this in my hosted environment I’d be out of money pretty quickly.

    ·         For images being uploaded to a site, you also need to consider whether or not you want to shrink the image before upload. I’m not there yet so I don’t know what SL 4 has in store for me in that venue.

    ·         In considering the upload time for a file, you need to decide what kind of proxy your WCF service will use. A custom binding with BinaryEncoding will allow for very large downloads but I’ve been personally unable to increase the upload size past 8,192 bytes. Also, since upload speeds are almost always slower than downloads for residential broad band, you need to think about whether or not you should break out the code into multiple uploads and whether or not a Polling Duplex service that gives some feedback about progress is appropriate.

    SQL Server Geography Types

    ·         It’s interesting to me that there is so much discussion of geo-this and geo-that at Microsoft but very few people are discussing how to effectively use the geography and geometry types in SQL Server. Perhaps it’s because they are not supported outside of SQL Server in EF, ADO.Net or pretty much anything else.

    ·         My experience so far is that you should store both the geographic raw data AND the compiled geography field when using these types. Each has their own place and together you can get a lot of information very quickly.

    ·         The biggest problem with geography types is their speed. When I’m looking for all points in a map extent, I cannot define a geographic index and then get everything in it. My users may only be viewing that extent for 10 seconds. It’s much easier to store my center points or individual lat/longs in decimal columns and then index those. Crazy fast and I still get the geography features once I have my base rowset to work with.

    ·         The general rule I follow is to use geography types to calculate but not to select.

    Patterns and Practices

    ·         I’m pretty happy at this stage with MVVM Light from Laurent Bugnion of GalaSoft. It’s a very easy to use, free helper tool kit for both WPF and Silverlight. What it took a few days for me to get through my thick skull was that MVVM is a pattern for the client. That’s all. As a developer, you need to implement other patterns on the server (service) side. Probably a no-brainer for most but I’m old and set in my ways so it took a bit to sink in.

    ·         The challenge for me is still the Inversion of Control (IOC) stuff, TDD for Silverlight and mocking. Again, all in good time. It’s difficult to hold off forging ahead solving the cool problems and take a breath to build out some unit tests. The results are almost always a stronger platform though and I AM learning.

    Styling

    ·         The greatest thing for me about Silverlight is the ability to provide an immersive environment to a user where subtle queues guide a user through the process of doing whatever you want him to do. This is a blessing and a curse because all of these styling operations can take a lot (!!!) of time if you hand-code them or much less time if you learn to use Expression Blend right the first time! Blend is a true designers tool and I’m no designer. I have a couple of friends who do a lot of graphic design and I’ve been trying to convince them to start working with Xaml. No luck yet but I really believe there will be a thriving employment market for top-shelf Xaml designers very soon.

    ·         The other problem with styling is deciding how much is too much. For instance, CompletIT has an amazing Silverlight presentation on their site but it’s literally so much that it’s distracting! There is no doubt that they know their stuff and as a design firm, perhaps that site shows the coolness. To me though I would rather see fewer effects and more usability. See a previous post about a good hammer…

    So I’ve started blogging again. I think that I’m going to tinker around with an MVVM-friendly background worker for uploading large contents and see how it goes.

    Probably the best thing about Silverlight for me is the fact that it's not BI, it's not Sharepoint, it's not CRM and it's not BPM. I had considered the shrink-wrap-framework-package-as-a-foundation-for-everything-under-the-sun to be the wave of the future. It still may be, but I have found that development job to be tedious and uninspiring. I have some experience in all those packages and am looking forward to seeing how an immersive RIA technology like Silverlight can make them even better. An effective UI provides the user with guidance to get their job done better and faster. Now THAT sounds like a project that would wake me up in the morning.

     

    Read more...