Database

Archived Posts from this Category

The Morning Brew #1355

Posted by Chris Alcock on 14 May 2013 | Tagged as: .NET, Database, Development, Morning Brew, SysAdmin

Update: A missing quote on one of todays links merged Ron Conery and Jeremy Miller’s links - corrected now, and thanks to Alistair and Daniel for letting me know.

Software

  • SignalR/ReleaseNotes - The SignalR Team announce the release of SignalR 1.1, a release which includes significant improvements to the scale-out story, along with a healthy number of other bugfixes and improvements.
  • Introducing Backbone.js StarterKit - Kazi Manzur Rashid shares three NuGet packages which provide a basis for Knockout based Single Page Applications, with code written in JavaScript, CoffeeScript or TypeScript.

Information

  • Applying Conway’s Law - Phil Haack discusses Conway’s Law on software reflecting the organisational structure which created it, discussing his experiences at Microsoft and also how GitHub organise themselves.
  • Spot the defect: rounding - Eric Lippert shares a seemingly very simple piece of code, with a subtle but significant bug, and challenges his readers to find the bug - the answer is in the comments, and will be the focus of a later blog post too.
  • Troy Hunt: Clickjack attack - the hidden threat right in front of you - Troy Hunt discusses in detail the anatomy and security risks exposed by Clickjacking exploits, and looking at what you can do to protect your ASP.NET applications from such attacks.
  • SQL Server Performance Crib Sheet - Grant Fritchey has an updated version of his SQL Server Performance Crib Sheet, detailing a goodly number of things that are well worth knowing if you have to manage SQL Server at any level.
  • Knowing More Programming Languages Will Make You Smarter - Rob Conery discusses the benefits with learning new languages, both spoken and more specifically programming.
  • Would I use RavenDb again? - Jeremy D Miller shares his thoughts and experiences of using RavenDB as a backend database for an application, discussing some of the benefits and some of the limitations that his team ran into during implementation
  • New Contributor? Jump In! - Nik Molnar shares thoughts on Open source projects having a ‘Jump In’ list of easier issues ideal for someone looking to get involved with an Open Source project but unsure of what to start work with - a great idea, and certainly well worth maintaining from a project lead point of view - the OSS world can only be better off from more contributors.

The Morning Brew #1195

Posted by Chris Alcock on 24 Sep 2012 | Tagged as: .NET, ASP.NET, C#, COM Interop, Database, Development, Links, Morning Brew, SysAdmin

Software

  • jQuery 1.8.2 Released - The jQuery Team announce the release of jQuery 1.8.2, a bugfix and performance regression fix release. As usual the files are available from the jQuery site, and should be making their way to the various content delivery networks.
  • IE 9.0.10 Available via Windows Update - The Internet Explorer Team have released a high importance security patch for Internet Explorer 9 to address recently reported security issues. Additionally there is an update for Internet Explorer 10 to address a Adobe Flash issue.

Information

Afternoon Tea - Sunday 10th June 2012

Posted by Chris Alcock on 10 Jun 2012 | Tagged as: .NET, ASP.NET, Afternoon Tea, C#, COM Interop, Community, Database, Development, Links, Morning Brew, SysAdmin, Talks / Presentations

It’s been quite a while since the last ‘Afternoon Tea’ post, and there have been quite a lot of significant announcements in the past few weeks, coupled with my being busy at work which has resulted in me building up quite a backlog of links which I really wanted to include in a Morning Brew. This post is my attempt to ‘clear the decks’ and get caught up again, and also provides the perfect excuse to do a link roundup of DDD South West which I had the pleasure of presenting at at the end of last month.

Software

  • Introducing jQuery++ - Justin B Meyer and the folsk over at Bitovi announce the release of jQuery++, a collection of DOM helpers which complement and extend jQuery
  • Bundler.NET - Bundler.NET brings the CSS and JavaScript minification and combining features of .NET 4.5 to earlier versions of .NET. The installation is simple via a NuGet package and the API reflects the .NET 4.5 implementation.
  • bddify is moved to GitHub and is renamed to TestStack.BDDfy - Mehdi Khalili gives an update on TestStack.BDDfy, the project formerly known as bddify, discussing the name change, and change to the projects hosting, along with looking at the structure of the NuGet packages which amke up TestStack.BDDfy.
  • #mvvmlight V4 for Windows 8 RP is available - Laurent Bugnion announces the release of version 4 of his MVVMLight framework for Windows 8 Release Preview
  • Get latest CSS 3 support in Visual Studio 2010 - Mads Kristensen discusses how you can get the latest version of the CSS3 support into your Visual Studio 2010 installation providing a link to the schema files required and giving instructions on getting it setup and installed in Visual Studio 2010
  • Tree Surgeon - Alive and Kicking or Dead and Buried? - Bil Simser gives an update on an old tool that I used to make considerable use of in the past. Tree Surgeon was a tool to create a standardized format of Development Source Tree structure. In this post Bil discusses how the landscape of .NET development has changed in the 4 years since its last release with improvements in T4 Templating and NuGet, and questions if there is a future for the project.
  • Introducing RabbitBus - Derek Greer introduces RabbitBus, a .NET client API implementation for working with RabbitMQ, aiming to provide constructs which are not provided in the standard RabbitMQ .NET client. The library is open source with code available on GitHub, and the installation is available in NuGet package format.

Information

DeveloperDeveloperDeveloper South-West 4.0

The Morning Brew #706

Posted by Chris Alcock on 13 Oct 2010 | Tagged as: .NET, Database, Development, Links, Morning Brew, SysAdmin

Software

Information

  • Running Open Source In A Distributed World - Phil Haack discusses distributed Open Source projects, drawing on the wisdom of Karl Fogel’s book ‘Producing Open Source Software - How to Run a Successful Free Software Project’ and discussing the processes to become a core committer on a project, illustrating with the NuPack Project
  • Adopt an Open Source Project - Rob Conery attempts to convince Microsoft (and other large .NET Dependent organisations) to allow their Developer Platform Evangelists to work part time on Open Source Projects
  • All-In-One Code Framework Coding Standards - Sasha Goldshtein highlights the All-In-One Code Framework project’s Coding Standards document - an 80+ page guide to writing code to their standards in C#, C++ and VB.NET written in ‘Framework Design Guidelines’ format (Do / Do not)
  • Caliburn.Micro Soup to Nuts Part 6b - Simple Navigation with Conductors - Rob Eisenberg continues his series of posts on using Caliburn.Micro looking at the use of Conductors for navigation between screens, illustrating with a simple sample of them in use
  • .NET Formatting Reference Sheet - Richard Carr of BlackWasp Software shares a Reference Sheet for the multitude of string format specifiers, showing each with a description and a sample of its output.
  • Dependency Injection for Filters in MVC3 - Javier G. Lozano looks at using the improvements in ASP.NET MVC 3 for Dependency Injection, and how this helps make using Dependency Injection with Filter Attributes much easier.
  • A Simple Wrapper To Make Things More Fluent - John Sonmez continues looking at using wrapping methods with logging (or other cross cutting concerns) and explores creating a fluent-like interface for adding this functionality.
  • When Intel’s Hyper Threading goes bad - Paulo Reichert discusses an instance where having a Hyper-threaded CPU may not make as much difference to your performance as you might thing, looking at what hyper-threading actually means, and how it trick the operating system into running more threads than might be optimal.
  • 7 Freely available E-Books/Guides I found essential for .NET Programmers and Architects - ‘nikosangr’ shares links to 7 really good resources for .NET Developers. I think all of these have been mentioned here before, however all are so good they deserve at least another mention.
    UPDATE: Turns out this link was to a complete copy of another bloggers article. The original (which was included in The Morning Brew previously) can be found here

Community

  • PDC UK - do you fancy a night in with the Microsoft evangelists? - Rachel Collier highlights an event with a difference to be held at Microsoft’s Reading Offices during PDC. On the evening of the 28th and 29th of October you can gather at Microsoft’s Reading HQ to join UK Evangelists to watch live streams of the PDC sessions. Registration is required
  • PDC10 at a university near you. - Phil Cross highlights a similar opportunity for UK Students at a number of Universities around the UK where you can see the Keynotes live, and participate in local Q&A

The Morning Brew #446

Posted by Chris Alcock on 02 Oct 2009 | Tagged as: .NET, Database, Development, Links, Morning Brew, SysAdmin

Software

  • ASP.NET MVC 2 Preview 2 - Phil Haack announces the release of ASP.NET MVC 2 Preview 2. New additions in this preview release include jQuery Validation support for client side validation, Areas allowing you to divide up your project more easily, model validation providers and metadata providers allowing you to support validation and metadata based on something other than the default of Data Annotations. This release is for VS2008 / .NET 3.5 Sp1 only.
  • CruiseControl.NET 1.5.0 CTP Released - CruiseControl.NET - Confluence - The Cruise Control Team announce the release of the Cruise Control 1.5 CTP. This release contains a number of bug fixes, a new range of security settings to allow you to lock down control of the build server, support for a number of new source code control tools such as Git, Mercurial, etc and a number of new tasks.publishers. Looks good, but as its a CTP not recommended for production use

Information

  • New features in ASP.NET MVC 2 Preview - ‘Shaans’ explores a number of the new features of the latest preview release of ASP.NET MVC 2, including some sneak peeks at the VS2010 beta 2 version. UPDATE: This appears to be an extract from the MVC release notes available in full here in MSWord Format
  • Code Contracts Preview: PostConditions - Dino Esposito continues his series over at DotNetSlackers looking at the Code Contracts Functionality, and in this article looks at PostConditions, looking at how they are implemented and how they work, along with comparing them to the use of asserts
  • Why does char convert implicitly to ushort but not vice versa? - Eric Lippert dives back into the past to discover why it is that you can convert from a char to a ushort but not the other way round, explaining how and why such a decision was made
  • Lazy<T>: On Demand Construction in .NET 4.0 - Bill Wagner talks about one of the less publicised features of .NET 4, the ability to make object construction an on demand process by the use of Lazy<T>
  • An Engineer’s Guide to Bandwidth (Yahoo! Developer Network Blog) - Carlos Bueno, a software engineer on the Yahoo Mail project has written a good article looking at network bandwidth with a particular slant for developers. I always feel it is important to understand the process between your code and yor users, and this article seems to fill in a number of those gaps
  • Mike Chaliy: Code-generation DSL with T4 (Text Templates) - Mike Chaliy takes a look at T4 Template generation using a DSL and T4 Templates to easily build configuration section reading code. A nice short understandable example of these sometimes confusing concepts
  • Generically Constraining F# - Part III - Matthew Podwysocki continues his series of posts on Generic Constraints in F#. This part continues on from the previous looking at the remaining constraints that exists, including Constructor, Delegate and Reference constraints.
  • Perspective camera animation on a cube in WPF 3D - Razan Paul Blog - Razan Paul has a number of posts on interesting animations created in WPF with full sample code provided. This one is the spinning cube, and others include roll down, wheel and circle animations, so be sure to take a look at them too.
  • Strive for Functional Cohesion - Chris Eargle talks about Functional Cohesion, and the important decision developers are making all the time about where to place certain functionality in your object mode.

The Morning Brew #405

Posted by Chris Alcock on 05 Aug 2009 | Tagged as: .NET, Database, Development, Links, Morning Brew, SysAdmin

This will be the last of the late editions for a while, my summer break is over and its back to work for me tomorrow so The Morning Brew should be returning to its more usual 8-8:30am (UK) publishing time.

Software

  • Spec# and Boogie Released on CodePlex - Matthew Podwysocki highlights the release of Spec# and Boogie on CodePlex under the Microsoft Research Shared Source License Agreement (MSR-SSLA) and Microsoft Public License (MS-PL) respectivly.

Information

Community

  • Microsoft PDC09 - Microsoft PDC 2009 to be held in LA is now accepting registrations, and until 15th September will be offering a $500 discount

The Morning Brew #153

Posted by Chris Alcock on 07 Aug 2008 | Tagged as: .NET, Database, Development, Morning Brew

A longer than average post today due to SQL 2008 finally being RTM’d, although it seems that Visual Studio folks should hold off untill the 11th August when the RTM of Visual Studio 2008 SP1 will be made available.

Software

Information

Community

  • Bad News, Good News - stackoverflow - Stackoverflow, the new community from Jeff Atwood and Joel Spolsky has entered beta, and there is a form you can fill in to get onto the beta linked from this post.

AND/OR Searches for related records

Posted by Chris Alcock on 22 Oct 2007 | Tagged as: Database, Development, SQL

A common database problem I have to explain to people is creating search functionality which allows a user to find a master record based on it having some or all of a specified set of related records.  To illustrate this, consider a database which defines products, which can each have 0 or more features from a table of features assigned to them. 

ProductFeatureDiagram

The table Product contains the details of the product (in our case, just a name - its an example after all).  A list of features are supplied in the Feature table, and the relationship between a products and a feature is expressed by a record in the ProdFeatureLink table. 

In this example, we will have 3 products, each with a different combination of the three features:

  • Product 1 has Feature 1
  • Product 2 has features 1 and 2
  • Product 3 has features 1, 2 and 3

So, to summarise the data involved we can issue the following query:

select
    p.product_key, P.ProductName, F.FeatureName
from product p
    inner join prodfeaturelink pfl on p.product_key = pfl.product_fkey
    inner join Feature f on f.feature_key = pfl.feature_fkey

This gives the following results:

ProductFeatureSimpleSelectResult

In our first case we are interested in products which have ‘Feature 1′. To find these we can use the previous query with a filter for the feature required:

select P.* from
product p
    inner join ProdFeatureLink pfl on p.product_key = pfl.product_fkey
    inner join feature f on f.feature_key = pfl.feature_fkey
where
    f.featureNAme = 'Feature1'

This gives the following result set:

ProductFeatureOnlyFeature1

This query correctly returns Products 1,2 and 3.

In the next case, we are interested in products which have any or all of two features (Features 2 and 3). Again, this can be achieved by taking our original query and adding a where clause which filters for either of the features.  This filter can be performed using ‘featureName IN (X,Y)‘ or by ‘FeatureName = X OR FeatureNAme = Y‘.

select distinct p.*
from product p
    inner join prodfeaturelink pfl
        on pfl.product_fkey = p.product_key
    inner join feature f
        on f.feature_key = pfl.feature_fkey
where
    f.featureName in ('Feature2', 'Feature3')

And here is the result set:

ProductFeatureEitherOrBoth

In order that we only get one mention of the product record the query above uses the Distinct clause, otherwise we would get duplication of results.

The final case is to find products that have both Features 2 and 3. This isn’t as simple as it might seem - we can’t just use the AND operator in place of the or, as each individual row of our original query’s results cannot contain two feature values. In order to do this, we need some new tools - specifically Group By, Having and an aggregate function or two. 

Our previous query (Feature 2 AND/OR feature 3) provides the basis - we just need a way of finding only products which have both Feature 2 and 3. We can manage this by requiring that the count of the rows for each product is equal to the number of features we are searching for. 

select p.product_key, p.productName
from product p
    inner join ProdFeatureLink pfl on pfl.product_fkey = p.product_key
    inner join feature f on f.feature_key = pfl.feature_fkey
where featureName in ('Feature2', 'Feature3')
group by p.Product_key, p.ProductName
Having Count(product_key) = 2

giving the result set:

ProductFeatureBoth

The placement of the criteria in this query is important. We must use the where to remove any data we are not interested in - so the WHERE filters our data down to only those products which have either feature 2 and 3. We then use the GROUP BY to gather up each product, and finally the HAVING checks that each product has the required number of features.

We can actually merge both the AND and the OR cases of this query together, as the only difference is that for an AND query we must have as many features against the product as we have specified, where as the OR query must have 1 or more.

declare @type char(3)
Set @type='AND'
--Set @type='OR'
select p.product_key, p.productName
from product p
    inner join ProdFeatureLink pfl on pfl.product_fkey = p.product_key
    inner join feature f on f.feature_key = pfl.feature_fkey
where featureName in ('Feature2', 'Feature3', ..., 'Feature n')
group by p.Product_key, p.ProductName
Having Count(product_key)>= CASE WHEN @type='AND' THEN n ELSE1 END

This query does rely slightly on the structure of the data involved. We rely on the fact that each product may only be assigned one instance of a feature- if a product may be assigned more than one instance of each feature then things do become a bit more difficult - but I’m going to save that for a later date.

UPDATE: Here is a SQL script of the examples used in the article:

AND/OR Searches of related records - SQL Script containing examples in the article

Next Page »