Sunday, 18 January 2015

SQL - Find Duplicate Data Column Values

Here is a quick snippet on how to find duplicate columns within your tables

Code Snippet
  1. select col1, col2, count(*)
  2. from TABLE
  3. group by col1, col2
  4. having count(*) > 1
End of Code Snippet

Tuesday, 13 January 2015

Free DNS Tools: Ping, Lookup, Trace, Whois, DNS Records, Spam Blacklist Check, Network Lookup and more! is a great website that allows you to perform an array of network and troubleshooting steps on any domain or IP address. I use it a lot when troubleshooting domain nameservers and other things that domain registrars should get right, but fail to do so!

Some of the sample operations that can be performed on a domain:
Whois (IDN Conversion Tool)
DNS Records (Advanced Tool)
Network Lookup
Spam Blacklist Check
URL Decode
URL Encode
HTTP Headers with optional SSL
Email Tests

Check it out!

Sunday, 11 January 2015

Binding a DataGridView to a Collection - Notify Grid When Properties are Changed (BindingList and INotifyPropertyChanged)

When utilising a DataGridView or similar control within your windows and web applications, you may wish to bind to a collection (List, ArrayList etc). Binding is always great as you can maintain and manage your custom objects very easily. What can be tough to manage is when you may wish to edit the controls data (A cells contents within a DataGridView for example), so you have to edit the data within your data source (I.e. List of custom objects), then re-bind to reflect the new changes.

The method above would work, but utilising a more Observer Pattern approach to our programming, we can automatically notify the grid when we update any of our properties within our custom collection. You simply need to inherit from INotifyPropertyChanged within your custom object and bind to a DataGridView with a BindingList collection (Very similar to a List). Within the set properties for your custom object, simply raise an event.

A full example can be found here:

Free DataGrid / DataGridView for WinForms and ASP.NET MVC (SourceGrid)

SourceGrid is a .NET Windows Forms grid control written entirely in C# with managed code. SourceGrid can be used to visualize or to change data in a table format.

- three sub-components, Grid, DataGrid, ArrayGrid
- Multi selection mode, Row Selection, Column selection, Free selection
- Cell and Row spanning
- MVC support
- Full feature list

Code Project: