Wednesday, 3 September 2008

Inside Google Chrome - Google's Intent to Crush IE

So, practically everyone on the internet is talking about Google Chrome right now, and I'm writing this article using it.

My findings are that it's really fast to use, the interface although slightly weird in the blue hue makes sense with it's simplicity and tabs being above the address bar, and the install was a dream. Also, simply count how long it takes to load - faster than Firefox, faster than IE (which is preloaded in part by Windows) - it's lighting fast!

Reading the comic Google published I really liked the approach to design, the V8 compiled javascript VM and the process seperated tabs and enhanced security model.

One thing I found really interesting was this article from wired:


What's really cool about this article is that it gives you an inside story on the development of Chrome, who the developers are and why it was built.

Whether you like Chrome or not, it can only be good news for the browser market. Yes, as a web developer I now have another browser to worry about (although it is based on WebKit like Safari, so perhaps minor differences?), but having such a major player hit the market with a browser offering will force all others to raise their game.

Unlike the introduction of IE8, Chrome is now my current default browser.

Friday, 29 August 2008

Internet Explorer 8 beta 2 Released


Internet Explorer 8 beta 2 has just been released, you can get it from here:

http://www.microsoft.com/windows/internet-explorer/beta/default.aspx

This beta is being reccomended not just for developers, but regular web users too.

Some new features include:

Accelerators
Accelerators let you complete your everyday browsing activities more quickly and even discover new services. Start mapping, translating, emailing, and more in just a few mouse clicks.

Compatibility View
Internet Explorer 8's built-in Compatibility View button enables you to display websites that were designed for older browsers. Simply press the Compatibility View button if you see display problems on a website like misaligned text, images, or text boxes. It's located next to the Refresh button on the Address Bar.

Search Suggestions
Search smarter with detailed suggestions from your favorite search providers and browsing history. See visual previews and get suggested content topics while you type in the enhanced Instant Search Box.

Web Slices
Keep up with changes to the sites you care about most. Add a Web Slice and you won't have to go back to the same website again and again for updates on news, stock quotes, online auctions, weather, or even sports scores.

Smartscreen Filter
New security features help to protect you against deceptive and malicious websites which can compromise your data, privacy, and identity.

InPrivate Browsing
Keep Internet Explorer 8 from adding any sites you visit to Browsing History with InPrivate Browsing. Now you can shop for that special gift with confidence knowing your family won't accidentally find out.

I'll let you know if it replaces Firefox 3 as my private browser, but I wouldn't hold your breath :)

Monday, 11 August 2008

.NET 3.5 SP1 Released


Today .NET 3.5 Service Pack 1 was released by Microsoft.



Download links:

This is a significant Service Pack - it includes Dynamic Data which I'm personally very excited about and currently in development with (No more Virtual Machine development environment :) ) It also includes Data Services (codenamed Astoria) and the Entity Framework.

The overview page is here. - Check it out for a run down of the new exciting features - this isn't simply a bug fix rollup.

Details from Microsoft:

.NET Framework version 3.5 Service Pack 1 provides the following new features and improvements:
  • ASP.NET Dynamic Data, which provides a rich scaffolding framework that enables rapid data driven development without writing code, and a new addition to ASP.NET AJAX that provides support for managing browser history (back button support). For more information, see What’s New in ASP.NET and Web Development.
  • Core improvements to the CLR (common language runtime) that include better layout of .NET Framework native images, opting out of strong-name verification for fully trusted assemblies, improved application startup performance, better generated code that improves end-to-end application execution time, and opting managed code to run in ASLR (Address Space Layout Randomization) mode if supported by the operating system. Additionally, managed applications that are opened from network shares have the same behavior as native applications by running with full trust.
  • Performance improvements to WPF (Windows Presentation Foundation), including a faster startup time and improved performance for Bitmap effects. Additional functionality for WPF includes better support for line of business applications, native splash screen support, DirectX pixel shader support, and the new WebBrowser control.
  • ClickOnce application publishers can decide to opt out of signing and hashing as appropriate for their scenarios, developers can programmatically install ClickOnce applications that display a customized branding, and ClickOnce error dialog boxes support links to application-specific support sites on the Web.
  • The Entity Framework is an evolution of the existing suite of ADO.NET data access technologies. The Entity Framework enables developers to program against relational databases in according to application-specific domain models instead of the underlying database models. For more information, see Getting Started with the Entity Framework. The Entity Framework introduces some additional features, including support for new SQL Server 2008 types, default graph serialization of Entities, and the Entity Data Source. This release of the Entity Framework supports the new date and file stream capabilities in SQL Server 2008. The graph serialization work helps developers who want to build Windows Communication Foundation (WCF) services that model full graphs as data contracts. The Entity Data Source provides a traditional data source experience for ASP.NET Web application builders who want to work with the Entity Framework.
  • LINQ to SQL includes new support for the new date and file stream capabilities in SQL Server 2008.
  • The ADO.NET Data Services Framework consists of a combination of patterns and libraries, which enable data to be exposed as a flexible REST (Representational State Transfer)-based data service that can be consumed by Web clients in a corporate network or across the Internet. The ADO.NET Data Services Framework makes data service creation over any data source. A conceptual view model of the underlying storage schema can easily be exposed through rich integration with the ADO.NET Entity Framework. Services created by using the ADO.NET Data Services Framework, and also compatible Windows Live (dev.live.com) services, can be easily accessed from any platform. For client applications that are running on Microsoft platforms, a set of client libraries are provided to make interaction with data services simple. For example, .NET Framework-based clients can use LINQ to query data services and a simple .NET Framework object layer to update data in the service.
  • Windows Communication Foundation now makes the DataContract Serializer easier to use by providing improved interoperability support, enhancing the debugging experience in partial trust scenarios, and extending syndication protocol support for wider usage in Web 2.0 applications.
  • The .NET Framework Data Provider for SQL Server (SqlClient) adds new support for file stream and sparse column capabilities in SQL Server 2008.

Wednesday, 18 June 2008

ASP.NET Dynamic Data - New Feature in ASP.NET 3.5 SP1


After attending NxtGenUG Fest 08 last week in my old office at Microsoft UK HQ, Thames Valley Park, I was particularly excited to hit the ground running with a topic presented by Dave Sussman, ASP.NET Dynamic Data.

This is a new feature in the yet to be released SP1 for .NET 3.5. (A beta is available here - this is pre-release so use on a VM or spare machine)

Dynamic Data is a scaffolding framework - what does this mean? Well this is how Scott Guthrie describes it:

.NET 3.5 SP1 adds support for a rich ASP.NET data "scaffolding" framework that enables you to quickly build functional data-driven web application. With the ASP.NET Dynamic Data feature you can automatically build web UI (with full CRUD - create, read, update, delete - support) against a variety of data object models (including LINQ to SQL, LINQ to Entities, REST Services, and any other ORM or object model with a dynamic data provider).

SP1 adds this new functionality to the existing GridView, ListView, DetailsView and FormView controls in ASP.NET, and enables smart validation and flexible data templating options. It also delivers new smart filtering server controls, as well as adds support for automatically traversing primary-key/foreign-key relationships and displaying friendly foreign key names - all of which saves you from having to write a ton of code.


I think of this scaffolding framework as DataBinding 2.0 - to get a good idea of what Dynamic Data is, I recommend watching this video from David Ebbo.

Now, the awesome thing about Dynamic Data is that it doesn't have to work on just a Data Model generated from a database or LINQ datasource. It can work against a business object using the ObjectDataSource approach - this is an amazing ability to save time getting features such as validation, column typing, display names and descriptions etc piped into your application for free.

For an integration project I have been working on where I generate business objects using an ASP.NET build provider, and then databind them against custom controls, I can now get rid of the following things:
  • A proprietary ValidationFramework
  • Custom column type mappings
  • Custom attributes on my business objects
  • Custom BoundFields
  • Custom DetailsView and GridView controls (which use the mappings and custom BoundFields)
...and instead I simply modify the build provider to decorate my class with the expected Dynamic Data attributes, and use the "DynamicObjectDataSource" from the latest samples pack.

Example business object:


public class NewData {
  [RegularExpression(@"[A-Z].*", ErrorMessage="The name must start with an upper case character")]
  [Required]
  [DisplayName("The name")]
  public string Name { get; set; }

  [Range(0, 1000)]
  [UIHint("IntegerSlider")]
  [DefaultValue(345)]
  public int Number { get; set; }

  [DataType(DataType.Date)]
  [UIHint("DateAjaxCalendar")]
  [Required]
  public DateTime Date { get; set; }
}


Here is the ASPX declaration:

<asp:ValidationSummary ID="ValidationSummary1"
  runat="server"
  EnableClientScript="true"
  HeaderText="List of validation errors" />

<asp:dynamicvalidator runat="server"
  id="DetailsViewValidator"
  controltovalidate="DetailsView1"
  display="None">

<asp:DetailsView ID="DetailsView1"
  runat="server"
  AllowPaging="True"
  AutoGenerateInsertButton="True"
  DataSourceID="ObjectDataSource1"
  EnableModelValidation="true">
</asp:DetailsView>

<asp:DynamicObjectDataSource ID="ObjectDataSource1"
  runat="server"   DataObjectTypeName="DynamicDataExtensionsSample.NewData"
  InsertMethod="Insert"
  SelectMethod="Select"
  TypeName="DynamicDataExtensionsSample.AggregateData">
</asp:DynamicObjectDataSource>


...from that, a DetailsView control loads showing the correct data, using the correct client side controls (which can be completely customised) based on the data type, with enforced validation using automatically generated validators.

Now for some handy links:

Dynamic Data Website
Dynamic Data Forum
MSDN Documentation


This really is an awesome new technology. Expect to see more about this on my blog soon.

Many thanks to David Ebbo from the ASP.NET team for helping me out with Dynamic Data.

Tuesday, 10 June 2008

What Do We Think of iPhone 3G?

iLounge have added a useful article on the new iPhone 3G.

I will be upgrading simply because I'm unable to say no to shiny new gadgets, especially when they combine: Apple, Internet, Email, Development Opportunities & Phone! - It's simply impossible for me to not buy this device! Yes - I know, I'm reminded how geeky this is by Mrs Meineck often!



Image: Courtesy of Apple

Looking at it with a more balanced head, in terms of new features iPhone 3G is an evolution not a revolution - but this evolution will IMHO help it transform from being the shiny gadget of a few lucky and cash-happy geeks to a device that will permeate through the enterprise and be very popular on the street.

Despite this, there are some embarrassing areas of lacking:
  • Proper Bluetooth implementation - why cant we send and receive pictures with each other? Yes e-mail allows sharing of photos but a large number of my friends don't have e-mail configured on their phones, and often we like to share photos down the pub, bar etc.
  • Why doesn't it support stereo Bluetooth - this is such an obvious feature for the latest iPod device.
  • Better camera - from the keynote it was obvious that the sample images they used must have been taken on some fantasy uber iPhone because with the current camera there is no way you could get that sort of quality. 2MP was good 10 years ago, but the camera is shocking compared to even 2005's standards of auto focus low light sensitive camera phones.
  • MMS - Sure MMS is a costly technology compared to sending an email with attachments - but why cant I at least receive MMS messages natively without having to log in to a cumbersome website, not even optimised for the smaller screen? Lots of my friends send MMS because their phones aren't setup for e-mail, and MMS works well for them.
  • Storage - 8GB and 16GB were a bit disappointing - but only because this isn't an improvement on the previous models.

Also amusing/depressing to note that BBC NewsBeat this morning reported the iPhone 3G as thinner, because in the keynote it was reported as “thinner at the edges”, when actually it is thicker overall but has tapered edges which are thinner. They also reported that it comes with Sat Nav - when actually it only comes with GPS enabled Google maps, which although supporting directions isn't exactly the sophisticated Sat Nav like TomTom. (I don’t expect this out of the box, and know it's on the cards from third parties as additional premium software, just annoyed to hear the BBC report so shabbily).

Oh well, you will still see me in the queue on July 11th!

read more | digg story

Wednesday, 23 April 2008

Windows XP continues to run once HDD removed

What happens when you remove the boot volume and re-insert? - Nothing :) - Windows continues to run right through until the HDD is put back in.

My colleague Dave Cromar was asking me how to remove the hard disk from his laptop (HDD due to be replaced today) so I went round to show him. He had already removed the screws, so I just slid it out of the chassis of the laptop - it was that point where I realised his machine was still switched on =D

We put it back in, and to our great surprise Windows XP continued to function - so we did it again but this time with the camcorder!

He has continued to use it all day without a reboot, and no problems. Check the link for the video on youtube.



read more | digg story

Monday, 21 April 2008

Cutting your Losses

Just read Peter Bright's article on a Windows user converting to Mac, but from a very well balanced and unique developer perspective.

I have to say that placing myself in mainly the .NET Framework, my experience of Windows behind the scenes isn't as tarnished with bad experience, but from my general usage of Windows I can really see where Peter is coming from.

It seems like Microsoft's unwillingness to make major breaking changes in their API (and therefore break many high value enterprise apps) is a major contributor to the general poor quality of Windows today. Apple on the other hand cut their losses, deprecating functionality and introduced a new OS from NeXT enabling them to write modern powerful APIs such as Cocoa. This allowed them a platform to support several high quality industry standard apps such as Final Cut Pro, Aperture etc.

From the article:
"Microsoft has never done anything so bold as Apple's OS X transition. It developed a new, modern OS, but did so in the early 1990s: Windows NT. And although Windows NT ticked the right boxes at the time—protected memory, preemptive multitasking, multiprocessor, written in platform-independent C—in places it was never even close to modern. Its APIs were based on the Win16 API from 16-bit Windows. This was a deliberate decision, as it made it easier to migrate 16-bit apps to the new 32-bit platform, and at the time it probably made sense. But it means that nowadays the 64-bit API (Win64) still reflects decisions made 20 years ago."

I can understand the predicament - but in software my humble opinion is that the quicker you cut your losses the better - code the right way from the beginning and re-factor as much as possible.

Perhaps my opinion is blinkered, blindly ignorant, who knows - you can always post a comment :)

Wednesday, 2 April 2008

WCF: Hosting multiple WCF services as one single service

On Monday I needed to split up a WCF service I had written for SharePoint into multiple services, one for Document Libraries, one for Lists, and another 'Common' service which has some standard methods like Ping() and GetVersion().

It didn't make sense to me to have all this functionality for lists, document libraries and common stuff all in one service, yet I didn't want to have to host 3 separate services on different WCF endpoints and port numbers.

I couldn't find anything about this on the web or in the excellent WCF book "Learning WCF" by Michele Leroux Bustamante. Luckily me and my colleague Dave Cromar worked out how to achieve this!

We have our 3 seperate Interface contracts:

[ServiceContract(Name = "Utility", Namespace = Constants.COMMON_SERVICE_NAMESPACE)]
public interface IService

[ServiceContract(Name="Documents", Namespace = Constants.DOCUMENTS_SERVICE_NAMESPACE)]
public interface IDocumentService

[ServiceContract(Name = "Lists", Namespace = Constants.LISTS_SERVICE_NAMESPACE)]
public interface IListService


...each one has the various methods defined in the interface and decorated with the WCF attributes such as OperationContract and FaultContract, as per normal.

Now, in our concrete implementations of these interfaces, instead of having 3 seperate classes, we have one class, but defined as a partial class, split up into 3 seperate CS files, each class definition implementing it's corresponding interface, IService, IDocumentService and IListService.

So it looks like this:

Service.cs:

[ServiceBehavior(Name="SharePoint")]
public partial class Service : IService
{
#region IService Members

// Common Service, ping, getVersion etc.

// Implementation of Service class goes here
...
#endregion
}


DocumentService.cs:

public partial class Service : IDocumentService
{
#region IDocumentService Members

// Implementation of DocumentService interface goes here
...

#endregion
}


ListService.cs:

public partial class Service : IListService
{
#region IListService Members

// Implementation of ListService interface goes here
...

#endregion
}


This all compiles nicely - note that the 3 class definitions have to be in the same namespace because they are all the same class (partial).

One last thing - the WCF app.config configuration:

Basically, the configuration is exactly as per a normal configuration with a single service node defined, but with three separate endpoints:


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="MyNamespace.Service"
behaviorConfiguration="MyNamespace.ServiceBehavior">
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="Common"
binding="netTcpBinding"
bindingConfiguration="netTcpStreaming"
contract="MyNamespace.Common.Contract.IService" />
<endpoint address="Documents"
binding="netTcpBinding"
bindingConfiguration="netTcpStreaming"
contract="MyNamespace.Documents.Contract.IDocumentService" />
<endpoint address="Lists"
binding="netTcpBinding"
bindingConfiguration="netTcpStreaming"
contract="MyNamespace.Lists.Contract.IListService" />
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000" />
<add baseAddress="net.tcp://localhost:9000" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyNamespace.ServiceBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<!-- Max file size 4GB, max message size 64KB, timeout 1 hour -->
<binding name="netTcpStreaming" transferMode="Streamed" maxReceivedMessageSize="4294967296" maxBufferSize="65536" sendTimeout="01:00:00" />
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>


Notice the three endpoints defined with the different address values - these get appended onto the base address defined, so that when a client discovers the service, the app.config created will have three seperate bindings (one for each service interface), and three seperate endpoints. Each endpoint will have different addresses, but crucially, the same base address:


<endpoint address="net.tcp://localhost:9000/Common" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_Utility" contract="Service.Utility"
name="NetTcpBinding_Utility">
<identity>
<servicePrincipalName value="host/localhost.domain" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:9000/Documents"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Documents"
contract="Service.Documents" name="NetTcpBinding_Documents">
<identity>
<servicePrincipalName value="host/localhost.domain" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:9000/Lists" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_Lists" contract="Service.Lists"
name="NetTcpBinding_Lists">
<identity>
<servicePrincipalName value="host/localhost.domain" />
</identity>
</endpoint>


This allows us to split out our service into seperate logical entities, but still expose it in one single place - job done!

Any questions - please use the comments.