Database Source Control : Map those changes

August 9, 2010 17:00 by tim

Following on from my previous article on git source control, I’ll now take a look at a few solutions for the other side of development : Database structure

There are 2 sides to most development projects.  The code, be that business logic, UI or reports is easily  via a variety of solutions (
SVN, CVS, git, VSS, etc)

The other side of the coin is that of the database.  Most applications will consume some form of data in their operation.  While some may rely on external services to provide this, most will have some form of local storage to store all the elements necessary for it to function.  Many site will have space for user logins, product information, shopping baskets, news, events, documentation, the list is endless

In the same vein as development, the data stores usually starts as a small collection of tables.  As functionality in the codebase grows, so does the number of tables needed to store all the different types of data that are being coded for.  So, as developers make changes to their sections of code and can commit their changes to a repository, what is there on the database side?  How does one track changes and additions to tables and stored procedures?

It’s definitely something that is becoming more of a necessity in these days of incremental release.  Traditionally, a new database would have to be created in it’s entirety. Not really a problem for development database that are used prior to release.  The development code can be expected to be quite fluid and changes are expected to occur frequently.  Once that database has been released to production, this becomes impossible.  Customers are very reluctant to lose historic data, user tracking relies upon it.  In this case, changes can be made piecemeal and scripts generated to map the single changes to other instances of the database

Fine if you’re using the DEV>UAT>Production strategy.  A single setup coordinator can orchestrate the script from a developer and apply that to the UAT database.  When the QA team are happy that the changes are working, this same script can then be applied to the production database, preserving existing data

However, when development becomes more distributed that a single developer and single production database, things start getting a little trickier to manage.  Sending scripts around becomes impossible.  People might not have the very latest build so scripts that rely on a series of changes will fail

This is where a central source control solution come in.  There are tools for applying these single change in order so that dependencies can be tracked.  Red gate have a fantastic tool which integrates natively with SVN so map changes, and there are some other really usable open-source tools available which can target more databases, but with more of an onus on developer collaboration to make the changes in sequence

Red gate's tool integrates only with SqlServer but is a valuable addition to their Sql toolbelt set of tools.  I’ve been using them for years and can’t fault them for mapping changes to production databases.  Their latest tool is no exception.  It works as an addition to the Sql Management Studio which ships with SqlServer.  Extra tool menus allow you to attach a database to an SVN repository.  Once linked, the tool will make an initial snapshot of it’s structure.  Then each change is managed within the tool, allowing the developer to commit them one by one as they are made.  When another developer needs to get a copy of the development database, they only have to make an empty database, link that to the central repository and the tool then maps the tables and stored procedures across, including any dependencies that are found.  The new developer can also make changes to their database, commit these one by one and the original developer will see these as updates and can apply them to their database.  The process can be scaled up in much the same way as regular development source control  solutions.  Distributed developers are given access to the repository and off they go

The open source solution I’ve looked at closely is deltaSql.  This employs a custom server for mapping changes which runs on
Apache, making it cross platform compatible with Windows or Linux.  It uses a similar commit and update strategy but pulling the individual scripts from it’s central server instead of SVN.  This solution also allows for more databases to be catalogued, including mySQL and postgreSQL and Oracle.  Lit integrates into the Eclipse IDE via asset of open source windows so is totally free to use


Both solutions provide a lightweight method of mapping changes from a distributed set of users to a central location over multiple database solutions.  Source control is essential for most projects and databases should be no different.  They are, in some cases, more complex than the code that drives them, so being able to sync the change with your peers is an absolute necessity.  Throw in a few QA houses, production databases and data warehousing solutions and the "Drop and Reload" method is not going to work out.  Both offering provide a less painful way to make structure changes in a controlled manner and provide a means to roll these changes back and start again should testing prove unsuccessful.  Very powerful!


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Stand aside SVN : Git is here

July 9, 2010 17:12 by tim
SVN’s time at the forefront of source control may be coming to an end.  There’s a newer, quicker, lighter and more flexible solution : GIT

From the worlds most famous open source developer, Linus Torvalds, it’s the latest and greatest way of working with collaborative projects alongside developer from all corners of the globe.  Linus is the developer who started work on the Linux kernel way back in 1991. He inspired the world with his ‘hobby operating system’ and changed the way software of this type can be developed. Collaboration between disparate developers flourished and, as the project gained steam, more and more developers from around the world were chipping in and sharing code with each other via SVN.

SVN (short for Subversion) holds a distinct image of code files at certain intervals called revisions.  Every time a change is made, a new revision is created and the old image is archived.  Archiving is required so that any changes which are made that are found to be incomplete or flawed cam be rolled back and started again.

This does happen quite frequently in open source projects.  While the amount of code generated in open source projects can be voluminous, the quality of it is assessed be public committee which may or may not agree with the developers logic and/or coding style.  So, changes are frequently rejected or submitted for further revision before being appied to the main development files which would then be compiled into the next release

However, consider the facts.  The Linux kernel currently consists of 13,320,934 lines of code split out over many thousands of files.  In order for these to be compiled, a version for each one of those files is held in many hundreds of thousands of states. A developer might only changes one word in one line of a file, but the whole file is taken as a revision and stored in the archive, ready to be rolled back at a moments notice. SVN was becoming cumbersome by design

So, Linus himself developed a new way of mapping just the changes to a file, rather then the entire file.  This makes for much smaller databases which can be updated in a much smaller timeframe than is possible with SVN.  GIT still has the concept of a central location for the main files, called a repository.  Developers can be given access to the files over the web and the files can be downloaded in their entirety.  This is where the similarity to SVN ends though.  The act of downloading the files creates another mini-repository local to the developer.  Changes made to any of the files are made and can be compared to his or her local repository, which allows for local rollbacks and updates before being uploaded back to the central repository. 

The uploading is magical. The files are tracked by the developer’s local repository and small sets of “deltas” are created, mapping out the lines of code which have been added/edited/deleted so these deltas can be applied to the central repository, without the need to upload the whole file, which can be many thousands of lines long.  The beauty of GIT is in it’s delta and merging capabilities.  It’s internal merger is of such great quality that manual merging of files (comparing them side-by-side and manually selecting the lines from each file that should be kept) are, almost, a thing of the past. 

The repository itself has some great features for developers to peer review between themselves before submitting them for a central review.  Paired programming can be of great benefit in stopping those nasty bugs getting in and ruining a good commit. 

The learning curve for GIT can be a bit overwhelming when coming from an SVN background, but you wouldn’t expect anything else from the world leader in geekonomics.  The commands are all written in the shell rather than using any form of drag & drop based system utilised in windows, makes perfect sense though since 99.999% of Linux programming is done in the terminal with no icons or windows in sight!!

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Studio Night Out : Doubles Snooker

May 24, 2010 16:06 by tim

In our designer vs developer nights out, we took a trip to Riley’s Snooker hall in Reading for a bit of doubles snooker. The teams were made up from the Technical and Design teams and our new ‘New Business’ Guru Rob Jennings

Being used to Pool, we found Snooker quite a challenge to start with being that the tables are four times the size!! After a few pints the balls were flowing on (and off) the table. Not top class by any means however. A highest break of 14 throughout the whole night but it’s a tough game to play

Attendees were

  • Dax
  • Simon
  • Craig
  • Rob de la Jennings
  • Nat
  • Binu
  • Tun
  • Tim


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: Technical
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Microsoft Tech Days: London April 12 – 16, 2010

April 29, 2010 12:34 by tim

You wait all year for something to happen then three things happen at once!!!!

To kick off the release of Visual Studio 2010, .net framework 4 and Silverlight 4, Microsoft hosted an array of global events inviting developers and technical professionals. Some of the world’s finest speakers showed off the new products, with Microsoft programmers highlighting new features and tools.

Visual Studio 2010 is the latest tool from Microsoft to aid programmers in the creation of Windows Applications, data services, web sites, Silverlight applications and windows phone 7 applications.  The productivity tool has caught up with modern technology to offer multi-monitor support. There is now enhanced integration with existing Microsoft Office products, intellisense, for the jQuery library, and other open-source products. It also offers the ability to target .net framework 4 as well as previous versions of the framework. It even colour codes the oldest of ASP scripts for you die-hard VBScript heads!!

.Net framework 4 is the new framework for developing on the Windows platform.  The installer itself offers many more templates for creating your programs, including one which targets the yet-to-be-released Windows 7 Phone. One of these phones was on display during the event and the speaker made a simple program for organising contacts, calling into the Outlook program in the office suite, getting the user’s contact list and offering filters to re-organise the emails, phones numbers and other data items in the account. The framework is all about rapid development and .net 4 certainly seemed to deliver in the demos.

Silverlight 4 is the next generation of the fledgling RIA (Rich Internet Application) framework from Microsoft.  Building on Microsoft’s proven track record of solid data layer and fantastic base tools, Silverlight itself was intended as a business-class framework to compete with flash in the RIA space.  What had let it down in the past was highly restricted security stopping the development of business application.  Silverlight 4 overcomes this with a new security layer allowing a user to opt-in to certain security-restricted features such as printer support and webcam and microphone.

 The framework is merging more and more with Microsoft’s other rich application framework, WPF, so the lines between internet application and desktop application are becoming blurred. Indeed, a Silverlight 4 application can be downloaded from a website, installed to a desktop application and run as if it was a fully trusted application with access to your local files and network services.  Sounds scary? Well there are a fair few hoops to jump through to get this working but it only speaks volumes for Microsoft’s security-conscious values and not wanting to cause headache for even the least savvy of users.

There were plenty of other cool demonstrations of products like Blend 4, Windows Azure and Bing Maps, more to follow next time...


Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Virtual Earth meets Silverlight

April 15, 2009 09:46 by tim

I went to a Virtual Earth developer day at TVP the other day and one of the big releases that they demonstrated is the new Virtual Earth Silverlight control

Currently in a Community Technology Preview status, the control builds on the fluidity of DeepZoom to provide mapping over a really slick looking canvas.  Being that it's silverlight based, the canvas is really responsive compared to the AJAX implementation that is the current fashionable flavour

The controls can be downloaded from the Microsrof Connect website.  This MSDN blog really isn't lying when it says you only need to type 2 lines of code to get a basic looking map out of it :  http://blogs.msdn.com/virtualearth/archive/2009/03/18/introducing-the-virtual-earth-silverlight-map-control.aspx

Just add the references and make a simple Map Tag and you're away.  Making overlays is really simple and this guy has plotted the course and speec of the top 4 marathon runners in the New York Marathon, however i can only see 3 points : http://conceptdevelopment.net/Silverlight/VEMap01/default.html

He's actually plotted a few of the recent marathons in a few cities around the world.  The map pans to follow the runners

I have a demo that i created to highlight how easy it is to implement.  The app took around 10 minutes to create, including downloading the control from Microsoft Connect!!  http://silverlight.creative-jar.com/maps/default.html


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

asp.net Pager TemplatePagerField

March 12, 2009 17:42 by tim

Been working with the new ASP.net pager control and i must say I'm impressed

when it was all .net framework 2.0, we'd been working with a nice little usercontrol which handled all it's postback internally and we had pretty good control over the markup.  Then .net 3.5 comes on the scene with it's listview and pager, so we thought we should give them a go

It was a partially good experience but the lack of mark-up control was pretty limiting.  I'm not much of a front-end guy so i just plumped for the standard layout and went with that.  However, as our front-end guys show much more attention to look & feel than I do, they demanded better markup, nicer buttons, parameterised visibility, the lot basically

We saw there was a TemplatePagerField node for the datapage and http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.templatepagerfield.aspx showed us we could literally spoon any kind of controls and mark-up into it.  The server side functinalty opened my eyes to some new counters i didn't even know existed.  I was used to the listitem having a container, kind of like a row in a database, but the pagers container is actually the entire collection of rows.  Kind of obvious when i think about it as i was only ever throwing it the whole set and it did it's thang and paged the data as required.

Also, you can have any combination of fields so you can still use the standard pager ones.  i particularly like the page buttons one which gives you a link to each page so the users are not forced to keep pressing next and previous to get to the products 

check it out though.  Saved us loads of time recently :¬)


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

jQuery XML and MIME types

February 16, 2009 08:49 by tim

We're really getting into jQuery these days.  Since it's adoption by the .net framework team, we're seeing more and more AJAX UI with data read in via jQuery to make some really cool looking sites

However, there was a problem we had recently with MIME types. We host all our stuff on IIS and this comes pretty much ready-rolled with most of the MIME types set up.  For those of you that don't know what a MIME type is; It's a rule which the web server uses to process certain files based on their extension. JPG, for example, is pretty much going to be a picture so the server allows these as binary downloads, whereae ASPX is a server-side page so the MIME type for ASPX runs through an extra process to translate the code into a working web page

Browsers also use the MIME type to decide how to display the pages, or images, and set them up correctly in the browser. application/rss+xml signifies that there is an RSS feed somewhere nearby and the browser will then highlight the Feed button so the user know where to get the feed from and set it up in their favourites

Which brings me nicely on the the problem that this post is meant to remedy.  We were using the jQuery $(document).ready(function(){$.ajax({type: "GET",url: "tim.xml",dataType: "xml", success: function(xml) { stuff to retrieve the xml and the process the node we were interested in.  Worked fine locally using IIS on any browser we threw at it.  However, we had to upload this to a 3rd party server and the "text/xml" MIME type hadn't been set up.  FireFox didn't seem to mind, but IE was throwing it's toy out of the pram and just not playing ball whatsoever.

After much blog and forum digging, we cam across the explanation on the jQuery site : http://docs.jquery.com/API/1.1.1/Ajax

So there you have it; if somethings not behaving as it should, before you change the code, be sure to verify your MIME types are set up as they should be. I initially thought this was an issue with $(document).ready but amending this didn't fix my issue!!

 

 


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

NxtGenUg Session : Designer - Developer workflow

January 20, 2009 09:16 by tim

Have just returned from Coventry after doing a Designer-Developer workflow seminar for NxtGenUg. 

Really good crowd last night I thought.  We had a few issues with controls not rendering and events not firing on our Mix07 application, as is the way with a live demo I suppose, since you don't have time to iron out the imperfections and all that.  We even had a bit of time to demo a pet application of mine, DynamiChazm, which allows for dynamically updatable and taggable DeepZoom images.  More to follow in a future blog :¬)

Thanks to Richard Costall for hosting it and allowing us to present out 'thang'.  Simon and I had a great time


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Silverlight : Grow your own controls

January 13, 2009 17:50 by tim

We had an issue on an early version of a silverlight app we wrote.  the whole thing was a banner which was fed data from a SharePoint list.  The site itself was multi-lingual so the same sentence coudl be one and half times as long in, say, the German version as it was in the English version

Being a data-binding kind of person (?), I opted to use Silverlights inherently powerful DataBinding features and have it fill the text from a custom object I got from the list.  However, since th controls were coded into the xaml, the size of the box was causing truncation in some instances, forcing us to set it to be the width of the logest piece of text we would ever encounter, not a very clever solution but good enough for the dev site

Re-visiting the code for live, I had a brain-wave.  I knew that silverlight could handle the dynamic sizing, Blend was all over it and the area was expanding and contracting as needed.  So, i broke it out of the xaml, turned it into a usercontrol, and then added it to the canvas at run time, after i'd set the text from the data.  Then, when the control renders, it's the correct size for the text it contains :¬)

Job done :¬)


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Wrong User Agent?

January 12, 2009 17:43 by tim

Ever been to a site and been accused of having an old browser?  Like it warns you to upgrade you Internet Explorer version from 6 to 7 before it will show you stuff?

Seems there's a few Windows machines out there with some dodgy Registry settings.  There is a key in there which hard-codes your user-agent, rather than letting the broswer do the talking

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings\User Agent\Post Platform]

This should be empty in order to post the corerect version. There are some facebook users who are getting the IE6 version and messages because this key is hard-coded to IE6  

WARNING : EDIT YOUR REGISTRY WITH EXTREME CAUTION!!


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Calendar

September 2010
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Tags