|
|
-
The final piece of the 2008 Launch, SQL Server 2008 (formerly known as Katmai), has finally gone Gold. For those with an MSDN subscription, you can download the bits now on subscriber downloads. I'm not the person to ask for a full-blown tour of Katmai, but some of the features that have had my radar pinging include: Spatial Data : With native support for geographic data, SQL 2008 provides a powerful platform for storing and retrieving your data based on location. Separate Date and Time Data Types : If you're only concerned about a date, you no longer have to store it as August 6, 2008 12:00:00.00 AM. Likewise if you're only concerned about a given time (for instance if you want a recurring appointment to happen every day at 10:00 AM), you no longer are burdened with specifying a date in addition. Table Value Parameters : Table value parameters allow you to pass a table of data into a stored procedure. While you could emulate the same effect using XML in SQL Server 2005, native support Read More...
|
-
So in part 1 we created our own constraint and want some of that syntax sugar, the Is helper class uses static (shared) methods to create the constraints so we either hack the NUnit source or try something else. What I ended up doing may not be ideal as it really plays with the syntax but it was fun all the same :) I created a new class called This and did the following. Imports System.Collections Imports NUnit.Framework.Constraints Imports NUnit.Framework.SyntaxHelpers Public Class This Inherits SyntaxHelper Public Shared ReadOnly Property [Is]() As This Get Return New This() End Get End Property Public Function AssignableFrom(ByVal expectedType As Type) As Constraint Return New AssignableFromConstraint(expectedType) End Function Public Function AtLeast(ByVal expected As IComparable) As Constraint Return GreaterThanOrEqualTo(expected) End Function Public Function AtMost(ByVal expected As IComparable) As Constraint Return LessThanOrEqualTo(expected) End Function Public Function EqualTo(ByVal Read More...
|
-
Je dois reconnaitre que j'ai découvert très récemment cette collection mais elle semble être bien pratique. En effet, la CompositeCollection vous permet de mélanger plusieurs collections et éléments de façon à ce qu'ils soient affichés comme une seul... Read More...
|
-
A couple of years ago, Richard Rutter wrote Compose to a Vertical Rhythm, which described how web developers could use CSS to maintain proper vertical typographic rhythm when designing pages. The technique is fairly straightforward, requiring some basic math to ensure consistent margins and leading across all page elements.
One issue that many people face with [...] Read More...
|
-
NUnit constraints offer a different style to crafting your unit tests, rather than write. Assert.IsEqual( expected,actual ) you could write Assert.That( expected , Is.EqualTo( actual )) Or in VB as Is is a reserved keyword - Assert.That( expected , [Is].EqualTo( actual )) 'Is' is one of the syntax helpers within NUnit.Framework.SyntaxHelpers to add a little syntax sugar, the above could be written as Assert,That(expected, new EqualConstraint( actual )) Where EqualConstraint lives in NUnit.Framework.Constraints but the syntax sugar is so much nicer. The That assert takes a IConstraint interface and if you want to craft your own constraints you can do so by using NUnit's own Constraint class. For our own purposes let's create a custom constraint that tests the cast of null (nothing) to a datetime value. Imports NUnit.Framework Imports NUnit.Framework.Constraints Public Class DateFormatConstraint Inherits Constraint Private testDate As Date Public Sub New() Me.testDate = CType(Nothing, Date) Read More...
|
-
After writing some NUnit tests with the Assert.That constriant syntax my code file was looking a bit messy so I ran R# 'cleanup' and it threw "JetBrains.Util.LoggerException: Cannot create IReferenceExpresion for 'Is' ". After that right click was kept throwing this error and to get around it I had to unload and reload the R# plugin. Not sure if it's VB and the need the escape Is as a reserved keyword but R# was struggling. Read More...
|
-
Je viens de voir passer ce post, sur le blog de Stefan Dobrev, qui devrait faire plaisir à plus d'une personne En effet, il a développé un petit addin à Expression Blend qui lui permet d'avoir... l'Intellisense: Le téléchargement et la procédure... Read More...
|
-
We weren't quite sure what to expect. We were familiar with the 200-seat Tusten Theatre in Narrowsburg, and we were pretty sure that it couldn't really accomodate an opera. The stage is quite small and there isn't even an orchestra pit. What's more, the tickets for the Delaware Valley Opera 's production of Mozart's Don Giovanni — a tragicomical chronicle of the last few days of archetypal sexual compulsive Don Juan — were only $25 a seat, which seemed frighteningly low for a three-hour opera with eight solo roles, chorus, and orchestra. Yesterday afternoon we discovered how it's done: The small Delaware Valley Chamber Orchestra — two violins, viola, cello, bass, French horn, bassoon, clarinet, oboe, flute, and timpani — occupied the space between the stage and the first row of center seats. DVO Director Jim Blanton conducted from behind a synthesizer set to a harpsichord program for the recitativi. The sets were minimal but otherwise it was complete authentic Read More...
|
-
Il peut-être intéressant, dans certains scénarios, de savoir si l'on peut se binder sur une propriété particulière ou de savoir si le mode de binding par défaut de cette propriété est TwoWay. Bien sur, la première solution sera de faire le test et d'... Read More...
|
-
I'll be giving a talk on MbUnit at the next ThoughtWorks geek night here in Manchester, UK on the 27th of August . The night will be a double bill, right after me Chris Morris will be leading a workshop designed to find out what you believe quality means in the software you develop. The talk I will give will be a version of the one I gave last year at AgileNorth only updated for the MbUnit v3. The next time I will give this talk will be hopefully DDD towards the end of year , so either vote for me when the time comes or if you can't wait then get your self down to Manchester. Read More...
|
-
I recently worked on a project that included code to calculate the bounding box of a collection of rectangles. The code did more or less what you might expect – it iterated over the collection, and any time a new rectangle wasn’t contained by the current bounds, it enlarged the bounds to fit. There was nothing wrong with this, but I knew of a cute trick that could do the job with a fraction of the code. I wasn’t being paid to replace working code with cute tricks, so I left it as it was – when it comes to production code I’m not a fan of the “If it ain’t broke, let me take a crack at it” school of coding. So I thought I’d illustrate the idea here instead. Here’s a one-line implementation of the same logic, using the System.Windows.Rect type in WPF. (Note that this is a very simple value type, not a full UI element. It’s just 4 numbers.) public static Rect GetBounds( IEnumerable < Rect > rects) { return rects.Aggregate((currBounds, nextRect) => Rect .Union(currBounds, nextRect)); Read More...
|
-
Il est très fréquent que l'on ait besoin, dans son programme, d'ajouter un élément à un ItemsControl (ListBox, ComboBox, etc...). Cela se passe très bien si vous avez indiqué les différents éléments du contrôle mais si vous êtes passé par la propriété... Read More...
|
-
Bill Kempf , a fellow WPF Disciple , was lamenting the fact that by default a CommandBinding can only refer to a handler defined in the code behind of the Window/Page/UserControl in which it's defined. He wished that a syntax similar to the following was possible < Window > < Window.CommandBindings > < CommandBinding Command ="foo:MyCommands.FooCommand" Executed ="{Event Target={StaticResource MyPresenter}, Handler=OnFooCommand}" /> </ Window.CommandBindings > </ Window > I took that scenario as my starting point. The first issue I saw was that I needed a markup extension that let's you specify a Target Object and the name of a handler on that Target returning a ExecutedRoutedEventHandler. So I made one. The Markup Extension exposes two properties: Target (of type object) and Handler of Type String. The ProvideValue override (shown below) uses reflection to get a handle on the function and creates a lambda that invokes it for the result. Read More...
|
-
-
Josh Smith just published a great article about his solution to using RoutedCommands in WPF. The problem he solves, has been solved by others before, however, I think this is a very lightweight succinct way of doing it. Basically, when you set a command to a button, you will have to handle that logic (canExecute and Execute) in the codebehind of the view. Since you are (hopefully) using a MVC, MVP or MVVM approach, you would rather not go through the codebehind of the view, but directly route the commands to the appropriate viewmodel/controller. He creates a relaying object that does just that. This results in a completely empty codebehind for the view, which is exactly what I like! Good job Josh! Read More...
|
|
|
|