Scottish Developers Events Newsletter

I mentioned in my last newsletter that time just seems to get faster. Technology is pulling forward at a relentless pace. Windows 1.0 had an API of just 450 functions. That is an achievable amount to remember for many developers. .NET 3.5 has well over a quarter million members on over 11000 types (classes, structs, enums, etc.). Then there all the third party components and open source frameworks that are available. The key to managing all this without filling your head to the point it explodes is to know where to find the information when it is needed. Just as well that in March we have an evening of Grok talks to give you pointers towards all this information.

But before that we have an event from TechEd and DevWeek speaker Oliver Sturm. He is talking about what WPF can give to business applications. That is something that has always intrigued me. When I first saw WPF I thought it was wonderful and fantastic and colourful and flashy, but what use would it be to me when I write business applications for an insurance company all day? It seems there is a use and Oliver will be explaining it.

Now, I was doing a little checking the other day and I worked out that to see a speaker like Oliver at TechEd it would cost somewhere in the region of €80 for a single presentation (well, that’s the cost if you could see TechEd in such bite sized chunks, but it is an all or nothing proposition and I don’t have a spare €2000 + tax + flights and accommodation). Oliver’s session is a double length presentation (don’t worry there is a comfort break in the middle) so that is €160 worth of information. And how much are we charging for this? Well, at the moment we are charging £25 if you go on to our website, which you have to admit is excellent value for money. But we are running a promotion so you can see this for as little as £10!

 

Business Applications with WPF – The Full Monty

Edinburgh, 5th March 2008 @ 127 George Street (Microsoft’s Office)

Lots of demonstrations of WPF show flashy User Interfaces with animations and videos and trickery worthy of a Hollywood production worked over by ILM. Is that what your next business app is going to look like? Probably not. Nevertheless, WPF can do a lot for you, because it’s the most powerful and most productive UI platform out there. Full stop. This double session walks you through the whole process of creating a business application with WPF, focusing on how it saves you development time.

Biography

Oliver Sturm is an experienced software architect, developer, trainer and author, with a strong background in various different fields including system and framework architecture and design, process modeling and user interface design. He is a C# MVP and he works for Developer Express as a Technical Evangelist and Lead Program Manager for the Frameworks Division.

http://www.sturmnet.org/blog

Cost: £25 before March 1st or £30 thereafter or if turning up on the day.

Promotion rate: You can get the promotional rate of £10 if you quote promotion code “SDGW82” when registering for the event. The promotion rate is valid until 23:59 on Friday 29th February.

For more details visit: http://www.scottishdevelopers.com/modules/extcal/event.php?event=40

 

The Grok Talks

Glasgow, 11th March 2008 @ CPD Centre, Glasgow Caledonian University.

A Grok Talk is a short 5 to 15 minute presentation on a specific subject aimed at giving a broad overview to the audience. Or it may be a way to explain a smaller concept that does not require a full length presentation.

For the audience it acts as a taster allowing you get to know a little about a subject you may not already have known much about.

For the speaker it gives a chance to folks who may not have had the opportunity to speak before, or for those that would like to speak but are unsure about it. (If you would like to speak then please get in touch by emailing me at colin@scottishdevelopers.com)

The evening will be a smorgasbord of subjects packaged in to short 5 to 15 minutes talks with lots of interaction as well. The subject area of software development is too large for everyone to know everything, so this is a fantastic taster for learning a little bit about stuff you don’t know much about already.

For more detail (and an update on the topics that are going to be covered) please visit:

http://www.scottishdevelopers.com/modules/extcal/event.php?event=47

 

Visual Studio 2008 Community Launch

Glasgow, 8th April 2008 @ CPD Centre, Glasgow Caledonian University

The world wide launch of Visual Studio 2008, Windows Server 2008 and SQL Server 2008 will happen on 27th February. On the 19th of March in Birmingham the UK launch will take place. And on the 8th April Scottish Developers will be doing its own launch event.

For more details visit: http://www.scottishdevelopers.com/modules/extcal/event.php?event=48

 

Developer Day Scotland

Glasgow 10th May 2008 @ CPD Centre, Glasgow Caledonian University

The session voting is currently open. Please register on the website and help shape the day if you have not already done so. The voting will close on the 8th March. The delegate registration will open sometime on the week commencing 10th March.

For more details: http://developerdayscotland.com/main/Default.aspx

 

Mixins in C# 3.0

This is something I’ve been mulling around in my head for a few days now. “Out of the box” C# 3.0 does not support mixins, but I think you can get some of the abilities of a mixin with what is there already.

Firstly I should probably explain what a mixin is. A mixin is a class that provides some specific functionality that is to be inherited by a derived class, but it does not have a specialisation (kind-of) relationship with the derived class.

The example that I have is of a class hierarchy representing different types of animal.The base class is Animal, derived from that is Avian and Mammal. Derived from Avian is Parrot, Penguin and Chicken. Derived from Mammal is Dog, Cat, Whale and Bat.

Class-Diagram-1

These animals all have various methods of locomotion. Some can swim, some can run and others can fly. However, as you can see there is no obvious relationship through the base class. It might seem at first glance while designing the class hierarchy that an avian should be able to fly. It is, after all, the first thing that springs to mind when thinking about how birds get from one place to another. But what about flightless birds such as the Dodo? Similarly, don’t all mammals run? No, there are many that live in the sea.

As you can see, adding methods for flight on the Avian base class or running on the Mammal base class don’t work in all cases. This is where mixins come into play.

Mixins can, in this example, provide the functionality for flight, running or swimming, or any other form of locomotion by having the appropriate class inherit the functionality. However, C# does not permit multiple inheritance. You can inherit from one base class only in C#.

But, you can implement multiple interfaces. At this point you are probably thinking “Ah-hah! But interfaces don’t have any functionality”. True, you won’t get too far if you just use some interfaces on the classes. But it is the first step.

Class-Diagram-2

With C# 3.0 came the introduction of Extension Methods and they can be applied, not only to classes but, also, to interfaces. Extension Methods provide additional functionality on an existing class without modifying the class. (You can read more about Extension Methods here). It then becomes possible to create a static helper class for specific functionality that defines the extension methods. Because the classes implement the interface (even if the actual interface doesn’t contain any methods or properties to implement) it will pick up all the extension methods also.

public  static  class SwimMixin
{
    public static void Swim(this ISwim target)
    {
        // Perform Swim functionality on the target
    }
}

This provides very limited mixin functionality. The imitation mixin cannot hold any data of its own which means that so long as the imitation mixin can get away without adding attribute information of its own then it is still useful.

If you need to have the mixin hold its own data then I can, at present, see a number of potential solutions to this problem. Unfortunately no solution is terribly elegant, nor are they problem free.

The first is to use a lookup keyed on weak references to the actual instantiated class with the result of the lookup returning the data needed for the Mixin. The reason for the weak reference is to ensure that the instances of the class get cleared out and are not retained by the imitation mixin. Remember the imitation mixin is built out of a static class so it won’t go out of scope and get cleared up by the garbage collector and everything it holds will stay around as long as the application is running. The main problem with this approach is that as the number of actual instantiated classes increases the lookups get larger and will naturally slow down. Also, some mechanism for clearing out the keys and data that are no longer required has to be implemented as the actual objects are garbage collected.

The second is to use the interface that the extension method is using to provide a method that can be used by the imitation mixin to access its data. This would mean that the actual  instance of the class would have to hold onto some additional data on behalf of the imitation mixin, which negates part of its usefulness.

The third is to create a base class for that all classes that may wish to use a mixin inherit from. This base class can contain “instance” data, in a hashtable keyed on the mixin type (for instance) on behalf of the mixin itself. This would, unfortunately, mean that the data is exposed and render encapsulation useless. It also causes a small hit each time a mixin method needs access to its “instance” data. Naturally, if you are inheriting from an existing framework class you won’t have the option of putting in a base class to hold the mixin data.

Class-Diagram-3

It isn’t too hard to see that it may be possible in the future to have mixin behaviour built directly into the language as we are already part of the way there. In the meantime some limited functionality is available which can be extended to include instance data for the mixin itself with some extra work, but it isn’t without its problems.

How does the voting work for Developer Day Scotland

Developer Day Scotland is a BY the community FOR the community conference based on the Developer Developer Developer! community conference. We accept sessions from the community on any aspect of software development. When the call for speakers closes we go in to a voting phase. At the end of the voting phase we tally the votes and work out which speakers we need to contact to ask to speak, and which we need to contact to say sorry.

I’ve been asked by a few questions how we will be going about our voting process.

When the voting closes all the sessions will be ranked from most popular to least popular. The simplest thing to do at this point would be just to pick the top sessions. However, we want to ensure that a broad range of subjects are covered and that we get a diverse set of speakers.

If an individual speaker gets more than one session into the top set of sessions we will ask the speaker to hold the second session in reserve in order to give another speaker a shot at speaking. This may sounds like a strange thing to do, but we want to avoid “The Joe Bloggs Show” from emerging because a particular speaker has submitted a large number of sessions that are all quite popular. Also, if we have one speaker taking too many session slots we run the risk of having a big hole in our schedule if they were to be ill or have some other emergency on the day which prevented them from speaking. By the time the process is complete we would be looking at getting as close to as many separate speakers as there are session slots – one for each available session slot.

However, if two sessions that are broadly similar make it into the top list then the duplicates will be removed. We will try to be as fair as possible with this. If one of the speakers has another session that made it into the top list then their duplicate will be removed to give a chance to a speaker that may not have the opportunity to otherwise present.

Naturally, some speakers will have just missed the cut and others will have sessions dropped because of some kind of duplication. These speakers will be asked to come along anyway with their session up their sleeve just in case one of the other speakers has to drop out at the last moment.

At the end of the day we are aiming to get as much community involvement as possible. The process is part science in that the voting shows what people want to see and part jiggery-pokery in that we have to schedule all this into a day that works.

We have almost 30 speakers who have submitted sessions with over 50 session proposals in total. Inevitably there will be some disappointment for the speakers who didn’t get picked and we are very sorry that we have to reject any of the speakers as we have so many excellent sessions.

In the meantime the session voting is open, so vote for what you want to see.

 

 

Different ways to add point data in SQL Server 2008

 

The spatial data can be added to a table by specifying the column type of geometry or geography. The exact detail of what is in the column can be varied as a spatial column can represent a point, line string, and polygon and so on. For example, to create a table that represents the venues of developer events that I’ve been to might look like this:

CREATE TABLE Venue
(
    Id INT IDENTITY(1,1) NOT NULL,
    Name NVARCHAR(256),
    Location geography
)

There are a number of different ways to insert data. Points, have the most varied set of options.

First of all there is the standard STGeomFromText:

INSERT INTO Venue
VALUES(
    'HBOS',
    geography::STGeomFromText(
        'POINT(55.9271035250276 -3.29431266523898)',4326));

The function takes two parameters; the first is the Well Known Text (WKT) representation of the geometry, in this case a point, and the second is the SRID. The example above shows the location of the SQL Server UG events held in one of the conference rooms at HBOS’s offices in Sighthill, Edinburgh.

Next is the extended method Parse. I should mention that there are two types of methods with regards to standards. There are a group of methods that comply with the OGC standards (these are all prefixed with ST). Then there are “extended methods”. These are not standards compliant and have added, I’m guessing, in order to improve the capabilities to some extent over the standards.

An example of the Parse method:

INSERT INTO Venue
VALUES(
    'Glasgow Caledonian University',
    geography::Parse(
        'POINT(55.8659449685365 -4.25072511658072)'));

The function takes only one parameter, which is the WKT. There is no SRID, but it is set to 4326 (WGS84). The example above shows the location of the Scottish Developers events held in the Continuing Professional Development Centre in Glasgow Caledonian University.

The next method is to use Well Known Binary (WKB). I won’t, however, be detailing the format of the binary. At present I would simply like to demonstrate that it can be done.

An example of WKB:

INSERT INTO Venue
VALUES(
    'Dundee University',
    geography::STGeomFromWKB(0x01010000000700ECFAD03A4C4001008000B5DF07C0, 4326));

The function, like its WKT counterpart, takes two parameters. The first is the binary representation of the spatial data, while the second is the SRID. The example above is the location of the North East Scotland .NET User Group who meet at Dundee University.

Next is another extended method, Point. For example:

INSERT INTO Venue
VALUES(
    'Microsoft Campus, TVP',
    geography::Point(51.4618933852762, -0.926690306514502, 4326));

The function takes three parameters, the latitude, the longitude and the SRID. The above example is the location of the Microsoft Campus at Thames Valley Park in Reading where events like DDD are held.

Finally, the standard function, STPointFromText, is used. For example:

INSERT INTO Venue
VALUES(
    'Microsoft Edinburgh Office',
    geography::STPointFromText('POINT(55.9523783996701 -3.2051030639559)', 4326));

The function takes WKT as did Parse and STGeomFromText, however, it is constrained to only WKT that represent points. If the WKT represents something else the method will fail. If, say, a linestring was supplied then an error message would be generated such as “Expected POINT at position 1. The input has LINES.” The example above shows the location of Microsoft’s Edinburgh office.

The result of adding all this information will produce a table with the following data:

Id Name Location
1 HBOS POINT (55.9271035250276 -3.29431266523898)
2 Glasgow Caledonian University POINT (55.8659449685365 -4.25072511658072)
3 Dundee University POINT (56.4595025684685 -2.98423195257783)
4 Microsoft Campus, TVP POINT (51.4618933852762 -0.926690306514502)
5 Microsoft Edinburgh Office POINT (55.9523783996701 -3.2051030639559)

 

 

 

Spatial References in SQL Server 2008

In SQL Server 2008, each piece of spatial data must be tagged with an SRID (Spatial Reference Identifier). Geometry types can have a SRID of 0 (which means undefined) but geographies must have a defined SRID. By default geography types use an SRID of 4326 which equates to WGS84. Spatial operations can only occur between spatial types with the same SRID. The result of spatial operations between two pieces of data with different SRIDs is null.

The geography needs an SRID applied to it because, in order to perform calculations, it needs to know the details of the ellipsoid in use. That information is not required to perform calculations on a geometry type.

Although SRIDs are not required on geometry objects it may be useful to apply them if data using different projections is to coexist in the same database. It will provide the safety net of returning null if spatial operations are attempted between two geometries in different projections.

It is possible to find out the available SRIDs in the database by querying the system view sys.spatial_reference_systems. The view will detail the SRID (spatial_reference_id) and its attributes.

Currently, all SRIDs in the system are defined by the European Petroleum Survey Group, hence the value of the Authority (authority_name) column is “EPSG”. The WKT (well_known_text) describes the datum, ellipsoid and units of the geographic coordinate system. The Units (unit_of_measure) column describes in English the units of the projected coordinate system. Finally, the Factor (unit_conversion_factor) is the conversion factor between the units in the projected coordinate system to SI units.

For example:

SRID Authority WKT Units Factor
4157 EPSG GEOGCS[“Mount Dillon”, DATUM[“Mount Dillon”, ELLIPSOID[“Clarke 1858”, 6378293.64520876, 294.260676369261]], PRIMEM[“Greenwich”, 0], UNIT[“Degree”, 0.0174532925199433]] Clarke’s Foot 0.304797265
4243 EPSG GEOGCS[“Kalianpur 1880”, DATUM[“Kalianpur 1880”, ELLIPSOID[“Everest (1830 Definition)”, 6377299.36559538, 300.8017]], PRIMEM[“Greenwich”, 0], UNIT[“Degree”, 0.0174532925199433]] Indian Foot 0.304799518
4268 EPSG GEOGCS[“NAD27 Michigan”, DATUM[“NAD Michigan”, ELLIPSOID[“Clarke 1866 Michigan”, 6378450.0475489, 294.978697164674]], PRIMEM[“Greenwich”, 0], UNIT[“Degree”, 0.0174532925199433]] US Survey Foot 0.30480061
4277 EPSG GEOGCS[“OSGB 1936”, DATUM[“OSGB 1936”, ELLIPSOID[“Airy 1830”, 6377563.396, 299.3249646]], PRIMEM[“Greenwich”, 0], UNIT[“Degree”, 0.0174532925199433]] metre 1
4293 EPSG GEOGCS[“Schwarzeck”, DATUM[“Schwarzeck”, ELLIPSOID[“Bessel Namibia (GLM)”, 6377483.86528042, 299.1528128]], PRIMEM[“Greenwich”, 0], UNIT[“Degree”, 0.0174532925199433]] German legal metre 1.000013597
4326 EPSG GEOGCS[“WGS 84”, DATUM[“World Geodetic System 1984”, ELLIPSOID[“WGS 84”, 6378137, 298.257223563]], PRIMEM[“Greenwich”, 0], UNIT[“Degree”, 0.0174532925199433]] metre 1
4748 EPSG GEOGCS[“Vanua Levu 1915”, DATUM[“Vanua Levu 1915”, ELLIPSOID[“Clarke 1880 (international foot)”, 6378306.3696, 293.46630765563]], PRIMEM[“Greenwich”, 0], UNIT[“Degree”, 0.0174532925199433]] foot 0.3048

 

For more information about WKT, Wikipedia has a good overview and acts as a jumping off point to more information.

 

Scottish Developers Events newsletter

We’re in to February already! Time seems to get faster, and so does the pace at which technology changes. But never fear because we have some excellent events coming to help you keep up.

In just over a week Richard Fennell will be talking about continuous integration with Team Foundation Server in Glasgow. The very next day I’ll be talking about Spatial Queries in SQL Server 2008 in Edinburgh, and if you can’t make it then I’ll be repeating it in Dundee later in the month. Early in March we have Oliver Sturm taking an entire afternoon to tell you about writing business applications with WPF. April brings us back to SQL Server again, and in May we have Developer Day Scotland – our first conference.

Continuous Integration with Team Foundation Server

Glasgow: 12-Feb-2008

Speaker: Richard Fennell

URL: http://www.scottishdevelopers.com/modules/extcal/event.php?event=39

How many times have you heard the developer say ‘but it works on my PC ’? How much time have you wasted trying to get a complex solution to build on a new PC? In this session I will show how continuous integration, the automated building and testing of projects whenever files are checked in, can be used to improve the quality of any software development project. Helping to catch and resolve problems as soon as possible in the development cycle; not waiting until to delivery phase of a project to find there are integration problems. The session will include demos of continuous integration using Visual Studio Team Server, as well as discussions of integration with other system such as MSTest and Virtual Server.

Richard Fennell is a founding Director of Black Marble, a Microsoft Gold partner based in Yorkshire. He is a regular speaker at community events, speaking at SQLBits, DDD3, 4, 5 & 6 as well as variety of user groups and free events run by his company. He has a degree in Computer Science, is a Member of the BCS, a Chartered IT professional and Chartered Engineer as well as holding MCSD.NET and MCAD accreditations.

Venue: The venue is Glasgow Caledonian University’s Continuing Professional Development Centre. For directions to the university see Google Maps and the campus map (We’re in building 2 on the map, marked CPD Centre)

JetBrains ReSharper

JetBrains have kindly given us a license for ReSharper (worth $199) to give away at this event.

Registration:

The event is FREE. If you want to attend please just turn up and feel free to bring a guest. The doors open at 18:30 for a 19:00 start.

 

SQL Server User Group Meeting

Edinburgh: 13-Feb-2008

Speakers: Colin Angus Mackay and Martin Bell

URL: http://www.sqlserverfaq.com/?eid=104

Colin Angus Mackay: Where’s my data? An introduction to Spatial Queries in SQL Server 2008

Colin Angus Mackay is a software developer specialising in Microsoft technologies located in Glasgow, Scotland. He is a Member of the British Computer Society, a Microsoft MVP (C#), a Microsoft Certified Solutions Developer, a Core Member of Scottish Developers, Code Project MVP for three years running and while not involved in software related pursuits is an amateur photographer, cyclist, map maker and is also the Vice President of Education for South Side Speakers, the Glasgow South Side Branch of Toastmasters International. And if all that wasn’t enough he is also organising Developer Day Scotland

It is reckoned that 80-90% of data has a spatial component to it. But what do we do with it now? At best, we constrain it to postcodes. Well, that would be great if we were delivering letters, but the majority of us aren’t. In this session we look at Spatial Queries in SQL Server to see how it works and what can be done with it.

Martin Bell: SELECT TOP(@x) Name FROM MyFavouriteDMVs ORDER BY MyRanking

Martin has been a freelance computer consultant in the UK for over 23 years. He has worked on many relational database systems and since the 1998 has specialized in SQL Server. He was first awarded Microsoft MVP (SQL Server) status in June 2003. Currently he organises the Scottish Area Meetings and is a founding organizer of the SQLBits Community Conferences.

Dynamic Management views were introduced in SQL Server 2005 and have made management and troubleshooting of SQL Server significantly easier than in previous versions. Even if you do not write your own queries against these DMVs you may be using them in Performance Dashboard Reports or other performance reporting applications. In this talk I will go through my TOP favorite DMVs and show how and when they can be used and why I like them!

This event will be held at the HBOS’s Sighthill office. For security reasons we need to submit a list of delegates in advance. If you wish to attend you MUST email Martin Bell before 12:00 on 11/12.

The event will start at 18:30 and go on till 21:00. Sandwiches and refreshments will be provided for attendees.

 

Where’s My Data? An introduction to Spatial Queries in SQL Server 2008

Dundee: 20-Feb-2008

Speaker: Colin Angus Mackay

URL: http://www.scottishdevelopers.com/modules/extcal/event.php?event=45

It is reckoned that 80-90% of data has a spatial component to it. But what do we do with it now? At best, we constrain it to postcodes. Well, that would be great if we were delivering letters, but the majority of us aren’t. In this session we look at Spatial Queries in SQL Server to see how it works and what can be done with it.

This event will be held in the Queen Mother building at Dundee University from 19:00.

 

SQLBits II

Birmingham: 1-Mar-2008

URL: http://www.sqlbits.com/

Registration is now open for this community conference dedicated to SQL Server.

20 technical Sessions broken up into 4 tracks covering all areas a SQL Pro is interested in and on top of that a recruitment panel and new product demonstrations – something for everybody – Development, DBA, Business Intelligence and of course SQL Server 2008.

Technical Sessions end at 5pm but the day continues first with a Recruitment panel and New production demos and then into an informal networking and social evening at our Group By drinks reception – a great opportunity to relax and chat about our holidays, hobbies, ok – get real – more SQL!

Register quickly; we ran out of places in 8 days at the October 2007 event.

 

Business Applications with WPF – the Full Monty

Edinburgh: 5-Mar-2008

Speaker: Oliver Sturm

URL: http://www.scottishdevelopers.com/modules/extcal/event.php?event=40

Lots of demos of WPF show flashy UIs with animations and videos and trickery worthy of a Hollywood production worked over by ILM. Is that what your next business app is going to look like? Probably not. Nevertheless, WPF can do a lot for you, because it’s the most powerful and most productive UI platform out there. Full stop. This double session walks you through the whole process of creating a business application with WPF, focusing on how it saves you development time.

Oliver Sturm is an experienced software architect, developer, trainer and author, with a strong background in various different fields including system and framework architecture and design, process modeling
and user interface design. He is a C# MVP and he works for Developer Express as a Technical Evangelist and Lead Program Manager for the Frameworks Division.

http://www.sturmnet.org/blog

This event requires a modest payment of just £10, with the early bird discount, to attend.

 

Developer Day Scotland

Glasgow: 10-May-2008

URL: http://developerdayscotland.com/main/Default.aspx

Developer Day Scotland (DDS) is a community event, run by community for community, which is based upon the highly successful Developer! Developer! Developer! (DDD) community conference events.

 

[This is a copy of the Scottish Developers events newsletter that I just sent out]

 

 

Developer Day Scotland - BY the community FOR the community - 10th May 2008 in Glasgow