SQL
Tech·Ed Africa 2010: Want to go for free?
Win 1 of 4 Tickets to Microsoft Tech·Ed Africa 2010 worth R6 150 each!!!
Venue: ICC Durban
Date: 17th - 20th October 2010
All you need to do is take a photo of a Microsoft Tag in a really cool/funny/practical place and upload the picture to the Facebook competition page.
More details in the competition animated video here.
Full Competition Rules on our Facebook page.
Dates for Submissions & Announcements of Winners:
- 25 Aug 2010 - Last Date For Submissions (week 1) (5pm)
- 27 Aug 2010 - Week 1 Winner Announced
- 01 Sep 2010 - Last Date For Submissions (week 2) (5pm)
- 03 Sep 2010 - Week 2 Winner Announced
- 08 Sep 2010 - Last Date For Submissions (week 3) (5pm)
- 10 Sep 2010 - Week 3 Winner Announced
- 15 Sep 2010 - Last Date For Submissions (week 4) (5pm)
- 17 Sep 2010 - Week 4 Winner Announced
Submissions & Announcements of Winners:
- A new winner will be selected weekly.
- Last date for submissions for a particular week is 5pm Wednesday of that week.
- Winner for that week will be announced on the Friday.
- Submissions after 5pm will count towards the following week.
- Submissions which did not win in a previous week will still be considered in following weeks and need not be re-submitted.
- A person can only win once, thereafter all his other submissions will be ignored.
- You cannot submit on behalf of another person.
- Submissions are done by posting a photo to the Facebook page wall.
Terms and Conditions apply:
This competition is limited to Tech·Ed Africa 2010 entrance and does not include Travel, hotel or any other expenses. You will be required to help out at the Developers Community Lounge at Tech·Ed Africa 2010 for 3 hours a day if you do win. For Full list of rules please consult the Facebook page.
It's Dev4Dev's time again!
My favourite gathering of developers happens 2 or 3 times a year, it’s called Dev4Devs. This is a free event which Microsoft runs, where ANYONE can present a topic but they only have 20min! This means that in a morning you see 7 topics and rather than getting swamped in all the details you dive directly to the really important parts.
The topic list is below, and there is some exciting topics there and even some non-MS technology is covered too!
I am also really glad that the entire ATC team at BB&D, which is the team I work in, is presenting – they are highlighted in the list below!
The next one comes on the 4th September 2010 and it occurs at Microsoft’s offices in Johannesburg and you can register at https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032456806&Culture=en-ZA
Session List for Dev4Devs
Windows Phone 7 - Getting Started
A high level introduction to getting started with Windows Phone 7 development including: where to begin, options for developers, thinking about design and a demonstration application.
Presenter: Johannes van Schalkwyk
Making MVVM easy
Starting with WPF, Silverlight or WP7? Heard of MVVM but think it’s WAY too complex for your simple application? Join me for a crash course using the easiest MVVM framework available… Caliburn.Micro!
Presenter: Rudi Grobler (ATC Team Member)
Why you should care about Google Closure
Closure is a modularised set of JavaScript libraries that can assist you in building rich internet applications.
It's been battle-tested by Google on sites like: Gmail, Google Docs and Google Maps.
Attend this short intro to get an understanding of how important these libraries are and why you should consider using them in your next big internet app.
Presenter: Simon Stewart
Introducing NHibernate 3
The daddy of .NET ORM is back with a new release, in this session you'll see a few of the newest features - such as a full IQueryable LINQ provider - that makes NHibernate 3 the best release yet!
Presenter: Kevin McKelvin
Branding SharePoint 2010 with MasterPages, Layouts and CSS
One of the largest limitations of WSS3.0 and MOSS2007 is the ability to brand SharePoint without intricate knowledge of the platform and in some cases breaking a few rules and modifying out of the box system files to get the desired look and feel. Come and see how the theming engine in SharePoint 2010 together with CSS, Master Pages and Layouts can be used to brand your SharePoint site using the amazing new SharePoint Designer 2010.
Presenter: Brent Samodien
Unit Testing - Code Coverage & Mocking
In this presentation William will demonstrate how code coverage tools help measure the effectiveness of your unit tests. He will also show how Mocking tools can help to add value to your unit tests and ensure that all edge-case logic is properly checked.
Presenter: William Brander (ATC Team Member)
Getting ready for Windows Azure development
Heard about the cloud? Excited about the possibilities? In this session we have a 1000-mile introduction to Microsoft’s operating system for the cloud, Windows Azure, how it compares to the other cloud offerings that are out there and how to get your hands dirty with the skill-up process. Endless possibilities + new tech = fun stuff.
Presenter: Ryno Rijnsburger
An introduction to Mercurial Source Control
Want a quick introduction into a Distributed Version Control System (DVCS)? Meet Mercurial it is a cross-platform, fast, lightweight source control management system designed for easy and efficient handling of distributed projects.
Presenter: Zayd Kara (ATC Team Member)
Making money with Coded UI
Coded UI is a brand new feature of Visual Studio 2010 which enables you to quickly build automated user interface tests for your application and run them as if they were unit tests. In the talk we will look at how Coded UI can change your life, one UI at a time!
Presenter: ME! (ATC Team Member)
Hack .Net in 10 Seconds - Why obfuscation is critical
Hacking 101 – I demonstrate how to bypass basic copy protection in an unobfusctaed .Net application through reverse engineering and show how obfuscation adds a layer of protection. I also demonstrate additional techniques for protecting your applications from hacking once they are released in the wild.
Presenter: Mark Pearl
Composite Applications with PRISM
In this session Stephan will demonstrate how to leverage the Composite Application Libraries to create modularized applications for WPF and Silverlight. He will also show you how to do multi-targeted development by sharing lots of code between the web and desktop applications.
Presenter: Stephan Johnson
An Introduction to Pex and Moles
An introduction into Pex and Moles, covering the basics of Mole Types and Mole Stubs and Parameterised Testing.
Presenter: Dave Russell
ASP.NET Dynamic Data
I will briefly introduce ASP.NET Dynamic Data by showing how to build a complete data maintenance web application with almost zero code.
Moving on, I will demonstrate some standard ways of customising a Dynamic Data application, and some more advanced non-standard customisation techniques. I will finish off by illustrating how Dynamic Data libraries and controls can be leveraged in other applications that don't normally use dynamic data.
Presenter: Brady Kelly
ASP.NET MVC 3
As you probably already surmised, ASP.NET MVC 3 is the next major release of ASP.NET MVC. Join us as we highlight the upcoming features and modifications to this popular framework.
Presenters: Jaco Pretorius and Kobus Brummer
Pulled Apart - Part V: You are a DB server with SQLite
Note: This is part of a series, you can find the rest of the parts in the series index.
One of the design decisions for Pull, is that it should just run without the need for an install. This requirement means that everything it needs to run should be available all the time and this brought an interesting problem to my design. The issue was that I needed a database to store all the info Pull uses (podcasts, episodes etc…) but I couldn’t require people to install SQL Server Express or PostgreSQL.
The solution was to use a file based database called SQLite, which requires just a few dll files to provide all the database functionality I would expect to my application to use but without the need for a database server. As this is a .NET application I used one of the wrappers for .NET called System.Data.SQLite. Usage with System.Data.SQLite can be via ADO.NET like code or via the Entity Framework.
I initially used EF for my development, but I found a mass of issues due to the assumptions that EF makes about when to open/close connections. These assumptions make sense when I have a DB server, but when I have a file which will be called from multiple threads those assumptions come back to bite and caused me no end of pain.
What I ended up doing to solve it was to build my own ORM which made use of reflection to handle mapping to classes, ala EF, but used a static instance and was very eager to close the connection to the file. These changes solved major issues with stability caused by EF while still providing a decent developer experience.
Mapping
Mapping of my classes to the database is done using a simple attribute which has a name and primary key indicator. For example the log class looks like the following. Note that I use the same attribute for columns and tables as I assume Class=Table and Property=Column. In the following all the properties names match the DB column names, but this is not a requirement.
[DataStore(Name = "Log")]
internal class Log
{
[DataStore(Name = "PK", PrimaryKey = true)]
public Guid PK { get; set; }
[DataStore(Name = "Source")]
public string Source { get; set; }
[DataStore(Name = "Occured")]
public DateTime Occured { get; set; }
[DataStore(Name = "StackTrace")]
public string StackTrace { get; set; }
[DataStore(Name = "Message")]
public string Message { get; set; }
}
Using that information, I can take a object and using reflection build up the SQL needed. An example of this is how I create the update command:
private static SQLiteCommand ConvertToUpdateCommand<T>(T item)
{
SQLiteCommand command = new SQLiteCommand();
string insertCommandText = string.Format(CultureInfo.CurrentCulture, "UPDATE [{0}] SET ", ((DataStoreAttribute)typeof(T).GetCustomAttributes(typeof(DataStoreAttribute), false)[0]).Name);
int parameterCounter = 0;
object PKValue = null;
string PKColumn = string.Empty;
GetAttributedProperties(typeof(T), (property, attribute) =>
{
if (!attribute.PrimaryKey)
{
insertCommandText += string.Format(CultureInfo.CurrentCulture, "[{0}]=@A{1}, ", attribute.Name, parameterCounter);
command.Parameters.AddWithValue(string.Format(CultureInfo.CurrentCulture, "A{0}", parameterCounter), property.GetValue(item, null));
parameterCounter++;
}
else
{
PKValue = property.GetValue(item, null);
PKColumn = attribute.Name;
}
});
insertCommandText = insertCommandText.Remove(insertCommandText.Length - 2);
insertCommandText += string.Format(CultureInfo.CurrentCulture, " WHERE [{0}]=@PK", PKColumn);
command.Parameters.AddWithValue("PK", PKValue);
command.CommandText = insertCommandText;
return command;
}
Final Thoughts
I have been very happy with SQLite as a database, but the learning curve has been tough for someone coming from a database server history. Once I understood the limitations and differences to DB servers it has been a great experience with SQLite.
I’ve been very happy with my ORM as it has made the development very easy working with proper objects and really hiding all the DB functionality away. There are some performance issues in the ORM which I have not solved and I am not feeling a major rush to solve either because the sizes of data in Pull are fairly light to start with. Examples of those performance issues is
- I have no way to batch commands in one transaction. So for inserting podcast episodes, for each episode I create a new command, a new transaction, open the DB, run command, close DB and transaction. What I should have is a way to create a bunch of commands and then run them all using one transaction and one open/close of the DB.
- Updating updates every field in the object, regardless if it has changed. This is because I have no object tracking implemented to figure this out.
Despite these the system still runs really well and overall I am happy with the choice of DB.
Pulled Apart - Series Index
This post provides a way for you to find more posts in this series. If there is a component in Pull which is not covered, and you would like it to be covered, please contact me.
- Part I – Introduction
- Part II – What? You’re not using TFS!
- Part III – Get on the bus!
- Part IV – Talking to myself, using memory mapped files for communication.
- Part V – You are a DB server with SQLite
- Part VI – A simple download manager
- Part VII – PLINQ, not as easy as first assumed
- Part VIII – Protocol handlers
- Part IX – Windows User Account Control
- Part X – Visual Studio Rulesets
- Part XI – Talking to yourself is ok, answering back is a problem. Why IMPF destroyed CPUS?
- Part XII - Parsing feeds (ATOM & RSS) in .NET
Presentation Dump - Mid 2010: VS2010, NDepend, RESTful Design, SSIS, EntLib 5, .NET Reflection, AppFabric, BDD, Sikuli & Redmine
The past 6 months have been hectic from a presentation perspective for me, with 20 presentations and classes given this year so far. So instead of a single dump of presentations at the end of the year, as I did last year, I am doing a mid-year dump.
What is new in Visual Studio 2010
This presentation is the one I have given many times this year. It originally started as 10 on 10, which looked at 10 features in 20min for Dev4Dev’s last year. It then evolved into 12 on 10, which added two more features, still in 20min. It then evolved into ?? on 10 for 6 degrees of code where it became an hour and half presentation. It is demo heavy and really the slides are the very basics – the important is hidden slides and notes for the demos.
NDepend
The tool that keeps on giving! For people working with taking over customer sites, reviewing code or anything else where you need to deal with other peoples code this tool is a must. This presentation was given to the architecture team at BB&D.
RESTful Design
RESTful design is an evolution of an earlier presentation I did, REST & JSON, which drops the JSON stuff completely and also drops the heavy compare with SOAP/WS* parts which seemed to cause confusion. This revised presentation covers just REST and looks at it much more practically by covering the required HTTP knowledge and patterns for designing RESTful services.
SQL Server Integration Services
Another upgrade in 2010 of an earlier presentation which not only cleans up some aspects but also goes into a lot more detail.
Enterprise Library
“The presentation that never was”, often I will spend time researching a technology or trend and preparing the presentation to come to the conclusion that it is just not worth the time of the attendee’s. Enterprise Library 5 is one of those, as the presentation covered what is new in it, and that is not very much.
.NET Reflection
This one is actually one from last year, but I had problems getting it onto SlideShare so it is only showing up now.
Windows Server AppFabric
AppFabric, the local one – not the Azure one, was a great presentation I did for the BB&D architecture team. This is not the original presentation – it has been edited to remove customer info as a lot of analogies between a project BB&D did and AppFabric was in it (cause who hasn’t built a system similar to AppFabric).
BDD
One of the presentations I spent the most time on this year, and one of the most exciting presentations. It really is a great methodology and I would love to see it used more.
Sikuli
Another presentation which did not make the cut to actually be presented. It is an interesting project, but of limited scope and when compared to the Coded UI from Visual Studio 2010 it is really far behind.
Redmine
Redmine is a bug tracking system, and being it’s not TFS may surprise you that an ALM MVP would do training on it. However for me to do training meant I head to learn it, which means I know the ALM landscape better and can point out which is better or not without uneducated bias (btw it still is TFS :)). This training was aimed not at developers but at call centre/power user people who would log initial bugs to then be managed in the system – so it was more of a ticketing system than a bug system in the end.
My Presentation @ Dev4Devs
If you are attending Dev4Devs on Saturday (or are here after the event) and you are looking for a copy of the slides and code you can get them below! If are looking for the ADO.NET Data Services cheat sheet I mentioned then you need to go here.
Code
The code here is also different from what I presented in the following ways:
- There is a timer control in it - so if you add items to the DB while on the site, it updates and shows those changes within 5 seconds.
- The layout is slightly bigger (bigger header) and has buttons (to make it look like an email client) - these were removed because it doesn’t work at 1024x768 (aka the projector resolution). So they back in their graphical beauty.
- There is a feed button which links to a ATOM feed for the last 10 emails - something I mentioned you could do, well now you can see it.
- There is a database creation script, but no data. You need to create your own data.
Slide Show
ADO.NET Data Services - Weird Error
Working on a project which uses ADO.NET data services for a small part of it. I put the ADO.NET Data Services portion together (add the files, put the EF data model together, link it up etc…) on my machine (Windows 2008 Server, SQL 2008, VS 2008) and it all worked great! Checked into source control and then went about doing something else, ignorant of the coming problem.
SQL BI Boot Camp - Day 2
Ah, day 2 has arrived so I got up at 6 to get ready and watch the email trickle down (Emerald Casino appears to only have GPRS for Vodacom) which didn’t finish in the end.




I am a community lead in this group.