Friday, 18 May 2012

Windows Forms XML File Reader

I am working on a Windows desktop app that will allow the user to do the following:
1. Select an XML file
2. Select an Element from the XML
3. Display the child elements and the associated values
4. Select a specific value of a child element and display all occurrences of that value

All of this will displayed in a Windows Forms DataGridView Control.

So I have wanted to learn some more Linq for a while so I decided to do use Linq for querying the XML data instead of using XPath.

This post is the first post of what will likely be a few posts in this series as there are some other items I will cover. I will want to have two panels in this application, one that contain the XML structure(so the user can select which Elements they want to view) and the other panel will show the results. I might also have a 3rd panel that shows the source xml. I am going to try and do some drag and drop to allow the user drag values, we'll see how I get on with that (easy in the web world so am hoping it's not too clunky in the winforms world).

Part 1: Display Linq to XML Query Results in Windows Forms DataGridView

Sunday, 6 May 2012

Sliabh Anierin Mountain Walking

It was a lovely day in Drumshanbo, Co. Letirm for short hike up the Sliabh Anierin Mountain. Myself and the boy set out to go an do a little bit of exploring. We headed out the Dowra Road (R207) and took the first turn to the right at the L7305. You come to a crossroads which is marked as the Leitrim Way to the left and right. You don't take the left or the right but instead you go straight through the cross roads. You follow this road and you are driving up the mountain. You keep going up this road until you can't go any further. I met a farmer up there who said that I was more than welcome to park my car at his shed and continue walking up the mountain.

Saturday, 5 May 2012

MS SQL Correlated Subqueries


Well you can learn something new every day so I am finished up for the day and thought I would write about it.

I was writing a report for a customer and they wanted a count of values in a column. Simple stuff right, you just do a quick:

SELECT column1, COUNT(column3) FROM table1 GROUP BY column1

You end up with something like:
Value1  100
Value2  50
Value3  75

The problem here is what to do when you want to count the occurrences of the unique values in the column and have these counts output as individual columns in your report. Let’s say you have a data import job and the status of the each row you import is either going to be Pending, Completed or Failed.

Thursday, 26 April 2012

Microsoft Reactive Extensions Rx Observer Pattern Kata

Overview

NOTE: So this is not a discussion about Reactive Extensions by Microsoft in relation to what they are and why they should be used. This has already been coverved extensively on Microsoft's website HERE


The point of this post is to provide details of a Kata that can be practiced. The design pattern implemented here is the Observer pattern. Instead of implementing this pattern using Events, I am implementing this using Observables.

Tuesday, 3 April 2012

Observer Pattern and MSFT Reactive Extensions

So I was practicing my observer pattern programming kata and came across the MSFT Reactive Extensions. I am going to put up a post this week with a new kata that implements observer pattern using the Reactive Extension (Rx) --> http://msdn.microsoft.com/en-us/data/gg577609

Susbribe to this blog now to be notified when this kata is available.



Friday, 23 March 2012

Display Flickr photos on .Net MVC web page

Functional Brief
I am working on a website for the Drumshanbo An Tostal Festival and one of the requirements was to show photos on the web site that the festival committee has stored on Flickr. I didn't want to just copy and paste a bunch of HTML onto the web page. I found that the existing web site they had was slow to load all of the Flickr images. What I really wanted to do was show a few photos and then provide a link to the full library of photos on Flickr.

Flickr allows you to add a set of photos as a PhotoSet. I wanted to get the last 5 PhotoSets from Flickr and display 7 photos from each set on the web page. The reason why I wanted 5 PhotoSets and 7 photos as that amount of photos fit in well with the size of the page space I wanted to fill.

Thursday, 22 March 2012

C# Ternary Operator

Well I read about ternary operators the other day and wondered when I was going to get to use them.

The c# ternary operators replace the need for the if else statement. It's doing the same thing but it's certainly less typing involved and more condensed to look at.