Thursday, October 30, 2008

SQL Server Geospatial

Here are some bits from a SQL geopspatial talk I attended at the PDC.

1) Geospatial is, in the reality, a set of assemblies registered with SQL server. Software developers can access the assemblies directly. It's built using both managed and unmanaged code. (My guess is the unmanaged code has the hard-core C++ math in it).
2) There are two flavors in the library, geometry and geography. Geometry is for planar, 2D work, Geometry is for shapes projected onto an ellipsoid (like the earth). All routines in the library are available in both flavors.
3) In SQL server, indexes can be created to improve shape intersection performance. However, the query optimizer may need help recognizing when it should use them. If a spatial query is taking too long, examine the plan for "clustered index seek (Spatial)". If it's not there, the query optimizer got it wrong and you need to add a hint (the WITH clause).
4) If you're looking for a utility to load shape files into SQL server, look on Codeplex.com.

Entity Framework and LINQ

I think it's time to take a serious look at the entity framework. (This shipped with .Net 3.5 and Visual Studio 2008 SP1 a few months ago). A new EF (version 2) was announced this week at the PDC.

This might be the first workable answer to one of the "Big Questions" from an earlier post (http://mnigbor.blogspot.com/2008/10/four-big-questions.html)

The best database designs and the best class structures don't look the same. They need to be mapped. It needs to be less painful to design a database in an agile way. The problem with code-gen based solutions is that the database needs to be finished before the coding can start.

http://en.wikipedia.org/wiki/ADO.NET_Entity_Framework

The entity framework as it exists today addresses part of the problem. There are three parts to the EF; the entities, data accessors and an entity mapper. Entities are what your code interfaces with and match the class structures you want in code. The mapper translates these into an ADO.Net service provider.

The buzz on the Internet is that V1 doesn't really get the job done. The basic issues appear to be that it only solves the problem from one perspective: a model-driven one. There are other perspectives, such as reporting services and script writers that don't get much from this approach. Version 2 purports to address many of these issues and broaden the EF's reach.

So, I think it's time to take a serious look at EF.

.Net Framework 4.0

The dizzying pace of updates from Microsoft .Net continues with the upcoming release of the .Net framework 4.0. (We're currently at 3.5).

In a nutshell, you get:
1) Side-by-side support for multiple framework versions in the same program. You can use assemblies targeted to different .Net versions in the same program.
2) New WPF version. Lots of new controls including the ribbon control. Also includes better support for XAML in the designer.
3) Updates to WCF to include support for REST and ATOM protocols. ATOM, interestingly enough, is what's under the covers in Azure. Live services are published using as ATOM feeds.
4) Workflow foundation. See earlier post: http://mnigbor.blogspot.com/2008/10/workflow-40.html

Tuesday, October 28, 2008

Four Big Questions

Sitting in all these sessions at the PDC has got me thinking about big questions. About 10 years ago, while I was learning object-oriented analysis/design/programming, I thought all my software problems had been solved. Shortly thereafter, I learned I was wrong.


I decided I needed answers to four big questions:
  1. Authentication -User ID's and passwords are inadequate for lots of reasons. They aren't particularly secure. Beyond that, a user ID is only good for one application or web site.
  2. Workflow - This is the forgotten third dimension to software (the other two being data and algorithms). Most real-world problems have a life cycle.
  3. Metadata - Data about data. How do I really know that a data or a service really has the information I want?
  4. Object-Relational Mapping- Object-oriented programs look at data differently than relational databases. These differences give me some of the most difficult programming challenges I face. I'm not alone. There have been an almost endless stream of purported solutions from ADO.Net to Hibernate.

Partial answers have started to emerge, but we're not there yet. There's no way to put everything I'm thinking on these topics into a single blog, but this gets the ball rolling.

Windows 7

Windows 7 is what comes after Vista.

We all know Vista's story. The main thing we'll all be looking for from Windows 7 is that it not suffer from the compatibility and stability issues that hurt Vista so badly. (It's arguable that Vista really isn't as bad as many think, but that's another topic for another day).

First the timeline:
  1. Pre-beta is downloadable today. (I'll be brining a copy home from the PDC).
  2. Beta: Early 2009
  3. Release Candidate: TBD but look for late 2009
  4. Release to Manufacturing: TBD

Changes are genarally incremental:

  • There is new functionality in the taskbar to make it easier to manage running applications and desktop real estate.
  • Libraries. Libraries can be used to organize information by location (folder), type or any other attributes the user wants. Libraries are designed to make it easier to organize files.
  • Bitlocker encryption on removable drives. If you lose a memory stick, you at least won't have to worry about the data anymore.
  • Direct virtual hard drive support. You can even boot natively off a virtual hard disk.
  • Improved projector support. (Vista really sucked at this). You can, for example run multiple projectors and it's just like having multiple monitors.
  • Remote desktops can have multiple monitors.
  • Updates to Paint and Wordpad. Wordpad can natively read Office XML documents.
  • Lower overall memory requirements.
  • Scales to 256 processors

Windows 7 is uses the same kernel as Server 2008 (and Vista).

Workflow 4.0

This, like some of my previous posts is part of the .Net framework 4.0 rollout.

What's new? The overall themes are:
  • Simpler authoring, generally requiring less code
  • More declarative. You can create custom activities that replace today's code activities. It's easier to see what should happen by examining the workflow.
  • Activities become the central thing in workflows. Expressions, rules and other things used in today's WF will become activities.
  • Better performance. Microsoft is claiming 10-100x improvements.
  • Full control over persistence
  • Flow-in transactions
  • Support for partial trust
  • Rehosting improvements
  • Unified debugging with rest of Visual Studio

ASP.Net 4.0

Microsoft is rolling out an update to the ASP.Net platform.

Most of the changes are incremental:
  • Support for Model-View-Controller framework. (MVC) This is a significant development. MVC separates code from presentation. Many, if not most, web applications would benefit greatly if the authors had made this separation. Lately, test-driven development has been the force behind MVC.
  • Ajax improvements. While there are some new features, most of the changes are to improve performance. One of the keys has been to refactor the javascript that makes Ajax work to be smaller and more granular.
  • Dynamic Data. This is very interesting stuff, but I'm not sure I'll be using it. This pushes more functionality from the server to the client. Personally, I like having the server in charge of all data. Lots of smart people think having the client do more is a good thing, though.
  • Web Forms. Client IDs are now configurable. Currently, you get system-generated IDs which makes writing javascript much harder.

You can get most of this today from Codeplex (http://www.codeplex.com/aspnet

Monday, October 27, 2008

Microsoft Azure


Today Microsoft announced a new initiative called Azure. I'm still getting my head around this, but in the meantime, here's what I've figured out so far. Azure is a new operating environment or perhaps a meta-operating system. Azure is hosted by Microsoft.

When its available, you'll pay to host your applications on Azure.

You might think of Azure as a managed services environment with on-demand capacity. In Microsoft's words, its a "Scalable hosting platform." It's an extension of the "software as a service" idea that Oracle and others have been promoting for some time now. The extension being that instead of leasing an application, or a VMware server, you lease the services of an operating system.

I called it a meta operating system because an operating environment for managing hundreds of thousands of applications running on tens of thousands of computers. Virtualization will be heavily used. Load balancing, replication, redundancy and high availability are built-in.

At the keynote, a sample application: http://bluehoo.com/ was shown. This bluetooth-enable application runs on your mobile device and finds people near you with similar interests.

Your write an application and deploy it to Azure using Visual Studio. You can use your own domain or get one automatically assigned on http://cloudapp.net/. After deployment, you can monitor use and scale your application by adding instances. Applications make use of models to structure the services. A model might include a web service for the front end, a business layer in the middle and a data service on the back end.

You can connect your existing on-premises infrastructure to Azure, effectively adding your computers to the virtual computers in the Azure cloud.

For now, this is a Community Technology Preview (CTP).

What's this all mean?

My immediate reaction is that Azure is aimed at getting more advanced Windows platforms in the hands of smaller companies. It would allow a smaller company with a small IT staff to access features that would otherwise require a huge investment in IT infrastructure.

My second reaction is that it represents a threat to hosting providers and managed services companies.

This represents an alternative to virtualization technology such as VMware. Instead of actually buying a bunch of computers, installing VMware, training your IT staff how to manage the system and keeping everything running, you can just lease all this from Microsoft.


Sunday, October 19, 2008

Best and Worst Presidents

For obvious reasons, I've been thinking about this lately:

If you had to pick the 4 best and 4 worst presidents in history, who would you pick?

The bottom 4 is harder than the top 4. This sort of judgement has to include political values. Its not a consensus sort of thing. I was looking for presidents that really changed the course of history for better or worse.

In no particular order, here's the list :

Best
  • George Washington - An obvious choice
  • Theodore Roosevelt - National parks and fighting monopolies
  • Abraham Lincoln - Management of the Civil War and ending slavery
  • Franklin Roosevelt - Recovery from the depression and management of World War II

Worst

  • Calvin Coolidge - Laissez-faire policies gave us the Great Depression
  • James Buchanan - Policies that led to the Civil War
  • Andrew Johnson - Undid or stopped progress on reconstruction.
  • George W Bush - Unnecessary war in Iraq, mismanagement of hurricane Katrina, financial crisis, gigantic deficits.

The "worst list" is harder for a lot of reasons. The first is I'm not a historian, so I know less than I probably should about presidents from a long time ago. An interesting article on the presidential rankings from Wikipedia helped out a lot on this.

This survey-of-surveys has a couple of names that I omitted. The first is Warren Harding, who managed to create the Teapot Dome scandal, general corruption charges and rumors of infidelity in just 2 years. He didn't make my list because, while he may have been corrupt, his short term in office limited damage to the nation's future.

Another possibility was Franklin Pierce, who was the president immediately before James Buchanan and his policies about slavery were similar. In the end, I decided to pin the civil war on his successor, James Buchanan.

I put Calvin Coolidge on my list because I think we should pin the depression on him, not his successor Herbert Hoover. It was his administration that gave us the roaring '20s followed by the depression. It was his opinion that the government either couldn't or shouldn't attempt to manage the economy. For me, this has ominous echos in current events.

Finally, I put George W Bush on my list because I think his presidency will be seen as very bad for the future of the country. The passage of time and a little perspective might change things, but it seems very unlikely to me.

Thursday, October 16, 2008

Greed


Our greed has finally caught us.

First on my list are greedy bankers. Greedy bankers have been doing it to us for at least 2000 years. By now, we should have learned to keep an eye on them.

That's not the end of the list by any means. Your on it if:


  1. You bought a house you really couldn't afford and took on more debt than you can pay back. (I don't care if the banker said it was OK. You signed the papers and that makes you responsible).

  2. You sold mortgages that you knew your clients couldn't pay; especially if the mortgage company paid you obscene commissions.

  3. You repackaged mortgages, hiding the bad ones in with the good ones and unloading them into an unregulated market without telling anyone you did that.

  4. You bought mortgage backed securities without asking why the rates were so much better than the rest of the market. (Greedy of you, wasn't it?)

  5. You sold pseudo-insurance on mortgage backed securities (something called a default credit swap http://en.wikipedia.org/wiki/Credit_default_swap). These were garbage and you knew it.

  6. You've been spending more money than you make and financing it with a second mortgage. How long did you think that trick would work?

  7. You work for a financial regulatory agency and helped engineer deregulation. You didn't live up to your duty to protect us. I really don't want to hear the excuses. Your failed us.

  8. You worked for an investment bank and helped engineer the unregulated, uninsured shadow financial system that's really at the root of this. Because you did this, we're no better off than we were going into the Great Depression. (http://en.wikipedia.org/wiki/Shadow_banking_system)

  9. You've been living beyond your means by getting credit cards and using them without any real idea how you were going to pay for it all. (Again, I don't care if the bank gave you the card, you did it, not the bank).

Did I forget anyone?


Monday, October 13, 2008

Error 403 on Custom SharePoint Page

If you have created a custom SharePoint application page and it uses Ajax, users may encounter an HTTP Error 403 when accessing the page. After quite some time, I found the answer on another blog and I'm re-posting it here in hopes that it will speed up somebody else's search.

As best I can figure, here's the scenario that leads to the error.
1) At 3am every day, application pool which drives SharePoint is restarted.
2) If the first person to access the Ajax-enable page is NOT and administrator, that person gets an HTTP 403 instead of the page. If the first person has machine administrator rights, the page displays normally and the page works for all subsequent users, regardless of their rights.
3) This works until the application pool is restarted.

The fix: Put the ajax assemblies in the GAC. In my case, we use Telerik RAD controls which are AJAX enabled and the Telerik controls also had to be "Gac'd".

Weird, but true.

Here's a link to the other blogger that was the key to solving the problem:

http://www.sharepointblogs.com/abdrasin/archive/2008/06/06/sharepoint-ajaxcontroltoolkit-403.aspx

Changing passwords on SharePoint

If you use domain accounts for the various services in SharePoint and you need to change their passwords, you'll need to follow some specific steps. Here are a couple of links that worked for me.

http://technet.microsoft.com/en-us/library/cc263409.aspx
http://technet.microsoft.com/en-us/library/cc262502.aspx