Saturday, 18 February 2012

TryExecute with timeout and maxAttempts

A nice piece of code for calling services with a timeout and maximum attempts, in case the service should cause an exception.

It follows the standard practise for "Try" in .Net, like TryParse, of returning a boolean to indicate success and the result as an out parameter. Should you wish to find out the exception that may have occurred this is also passed as an out parameter.

I've also included an Execute mthod that will raise an exception should the service request timeout or fail more than the maximum number of attempts,

The source code solution includes unit tests in MBUnit, NUnit, xUnit and MSTest:

http://stevenhollidge.com/blog-source-code/TryExecute.zip

Friday, 17 February 2012

Rx Event Example

When subscribing to events Reactive Extensions (Rx) is a powerful way to filter, throttle and compose your .Net code. 

With this example I have a WPF application that listens to a FxRate pricing service, that’s pumping out 100 new prices a second via an event.

I’m going to make available the code to show how to hook up the front end Metro style application using MVVM with:

  • old skool event handlers
  • and then using Reactive Extensions (Rx)

Finally we update the Rx example to filter on just one of the exchange rates and also throttle back the rate of FxRates being received to one per second.

stockmarket-demo

The event signature

Old skool event handlers

Using MVVM, here we have my view model code stripped back just to show we have:

  • A pricing service
  • A subscribed command (data bound to the subscribed button on the UI) which toggles the subscribed property
  • A delegate (PriceUpdate) that handles the event when the subscribed button is clicked.  Click the button a second time to unsubscribe and remove the delegate from handling the event

Lines 25 and 30 show the adding and removal of the event handler, dependent on whether the user has clicked the subscribe button.

Rx Subscriptions

To do the same thing with Rx takes two lines of code (lines 18/19 and 21)

Filtering with Rx

Simply update our subscription to include a where filter that accepts the event coming in (e) and sets the predicate to Ccy (Currency) for the exchange to Euro to GBP.

Throttling with Rx

NOTE:  The code below was a workaround, please use Sample as shown here.

So we have filtered the events to only give us the Euro to GBP prices. Now let's enhance the solution just to give us the latest Euro to GBP price every two seconds.

Source code

Event handlers:  http://stevenhollidge.com/blog-source-code/standard-event-handler-wpf-metro-mvvm-stockmarket-pricing-app.zip

Reactive Extensions:  http://stevenhollidge.com/blog-source-code/Rx-wpf-metro-mvvm-stockmarket-pricing-app.zip

Wednesday, 15 February 2012

WPF Metro MVVM Application

This project is designed to get developers up and running on their WPF Metro MVVM projects.

Screenshots

image

 ScreenShot1 ScreenShot2 ScreenShot3 ScreenShot4

Frameworks

This project combines two excellent existing frameworks within the community:

Name Developer Link Comments
MahApps.Metro Paul Jenkins

http://www.theleagueofpaul.com/metro

Metro style and themes
MVVM Light Toolkit Laurent Bugnion http://mvvmlight.codeplex.com/ Originally based on ideas and source code from Microsoft PRISM

Concepts

The application contains working examples of the following:

  • MVVM with INPC (INotifyPropertyChanged), Messenger with messages (for event notifications), RelayCommands are available to use
  • Metro layout, styles and theming, easing and sliding from “outside” the visual area – all thanks to MapApps, great library!
  • Two way data binding for a combo box to a Enum list

image

ViewModel Example

Source code 

http://stevenhollidge.com/blog-source-code/wpf-metro-mvvm-app-stockmarket.zip

Tuesday, 14 February 2012

Reactive Extensions (Rx)

Overview

MSDN Definition

“Rx is a library to compose asynchronous and event-based programs using observable collections and LINQ-style query operators.”

Rx provides extension methods on top of Linq to enable developers to implement the observer pattern on query results (IEnumerables e.g. a collection or sequence).

The benefits of Rx are in it’s enabling of concurrency and it’s composability.  It allows for easy concurrent processing over a collection along with simple declarative call backs on completion and exceptions.  This programming model allows for simple orchestration of async operations.

To get familiar with Rx, in the examples below we’ll look at simple enumerations of data to get a feel for the programming style.  We can then take a look at Rx for events, with events after all just being a sequence of data (found in the EventArgs).

How To Get Reactive Extensions

Use Nuget, search for Rx and bring in the Reactive.Main library (System.Reactive namespace).

rx-Nuget

Simple example

1.Convert the linq query into an observable (using the Rx extension method).

2. Write a delegate which will execute for:

  • Each item in the enumeration (OnNext method in the examples below)
  • When an error occurs (OnError method in the examples below)
  • When the enumeration completes (OnCompleted method in the examples below)

3. Subscribe to the query results.  This is whether you hook up each of your delegates and start the enumeration.

rx-Simple

“Finally” delegate

There is another delegate we can set, that runs after the processing has completed, regardless of whether the enumeration successfully got the end of the sequence or not e.g. An error occurred half way through processing so the completed delegate doesn’t run.  The Finally delegate will always run which might be useful for clean up.

rx-FinallyDelegate

How to Configure Threading

rx-HowToConfigureThreads

Notice how all the "getting" and "processing" are sequential and in keeping with the enumeration (within each group) even though the processing might be occurring on different threads.

Early Cancellation of Processing

You can cancel the processing of a collection, here is an example:

rx-EarlyCancellation

“Using” A Disposable Object

This example code disposes of an object after the completed delegate has run.

rx-UsingDisposableObjects

A real world example may look like this:

Demo Source Code

You can download the demo here:  http://stevenhollidge.com/blog-source-code/RxExtensionsDemo.zip

Monday, 23 January 2012

Concurrency Checker

Useful piece of code when checking for concurrency in your application.

using System;
using System.Threading;

namespace Utilities
{
public class ConcurrencyCheck : IDisposable
{
private static int _concurrencyCount = 0;

public ConcurrencyCheck()
{
var usage = 0;
if ((usage = Interlocked.Increment(ref _concurrencyCount)) != 1)
{
Console.WriteLine("{0} delegates are running concurrently", usage);
}
}

public void Dispose()
{
Interlocked.Decrement(ref _concurrencyCount);
}
}
}

T4 Example: Code Generation

This simple T4 example shows how to generate a C# enum class from an external resource, in this case a SQL database.

First of all, let’s create our database:

USE [master]
GO

CREATE DATABASE [T4Demo]
GO

USE [T4Demo]
GO

CREATE TABLE [dbo].[AssetClass](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Description] [varchar](50) NOT NULL,
CONSTRAINT [PK_AssetType] PRIMARY KEY CLUSTERED ( [Id] ASC )
)
GO

INSERT [AssetClass] VALUES ('Equity');
INSERT [AssetClass] VALUES ('Fixed Income');
INSERT [AssetClass] VALUES ('Cash');
GO

Next we’ll create a C# console application and add a T4 text template file:

<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ assembly name="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="System.IO" #>

public enum <#= Path.GetFileNameWithoutExtension(Host.TemplateFile) #>
{
<#
if(Validate())
{
BuildEnum();
}
#>
}

<#+

private bool Validate()
{
if(string.IsNullOrEmpty(Server)) { Error("No server was specified"); }
if(string.IsNullOrEmpty(Database)) { Error("No database was specified"); }
if(!IntegratedSecurity)
{
if(string.IsNullOrEmpty(User)) { Error("No user id was specified"); }
if(string.IsNullOrEmpty(Pwd)) { Error("No password was specified"); }
}

if(string.IsNullOrEmpty(Table)) { Error("No table was specified"); }
if(string.IsNullOrEmpty(ValueColumn)) { Error("The value column was specified"); }
if(string.IsNullOrEmpty(TextColumn)) { Error("The text column was specified"); }

return !this.Errors.HasErrors;
}

private void BuildEnum()
{
using (SqlConnection conn = new SqlConnection(BuildConnStr()))
{
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = string.Format(
"select {0}, {1} from {2}",
ValueColumn,
TextColumn,
Table);
cmd.CommandType = System.Data.CommandType.Text;

conn.Open();
SqlDataReader rdr = cmd.ExecuteReader();

PushIndent("\t");
while (rdr.Read())
{
string enm = string.Format("{0} = {1},",
CreateValidIdentifier(rdr[TextColumn].ToString()),
rdr[ValueColumn].ToString());
WriteLine(enm);
}

WriteLine("Unknown = 0");
PopIndent();
rdr.Close();
conn.Close();
}
}

// Strips spaces and full stops
private string CreateValidIdentifier(string input)
{
string pattern = @"[\.\[\]\s]";
Regex regex = new Regex(pattern, RegexOptions.None);
return regex.Replace(input, "");
}

private string BuildConnStr()
{
SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder();
csb.DataSource = Server;
csb.InitialCatalog = Database;
csb.IntegratedSecurity = IntegratedSecurity;

if(!IntegratedSecurity)
{
csb.UserID = User;
csb.Password = Pwd;
}

return csb.ConnectionString;
}

private string Server = ".";
private string Database = "T4Demo";
private bool IntegratedSecurity = true;
private string User = "";
private string Pwd = "";
private string Table = "dbo.AssetClass";
private string ValueColumn = "Id";
private string TextColumn = "Description";

#>

Now save the file and you'll have your own up-to-date enum class driven from your database:

public enum AssetClass
{
Equity = 1,
FixedIncome = 2,
Cash = 3,
Unknown = 0
}

You can also set up Visual Studio to always regenerate the file on each build if you prefer.


Source code:  http://stevenhollidge.com/blog-source-code/T4CodeGenerationEnums.zip

Wednesday, 18 January 2012

JavaScript MVVM: Knockout.js

Knockout.js is a rich JavaScript MVVM framework for data binding HTML elements to JavaScript view models, auto UI updates, dependency tracking and templating.

For a Silverlight or WPF developer this is just what we’ve wanted to be able to unit test our presentation layer (the View Model) outside of the UI.

MVVM

Overview

image

Example of an implementation of MVVM

MVVM_05

Knockout.js

Home page http://knockoutjs.com/
Source code: https://github.com/SteveSanderson/knockout
Resources: http://www.knockmeout.net/   
http://blog.stevesanderson.com
http://en.wikipedia.org/wiki/Model_View_ViewModel

 

A simple Knockout.js example

 image

Live demo:  http://c9.io/stevenh77/knockoutdemo/workspace/demo1.html

In this example we will be:

Diagram

Steps

image 1. Creating a view model in JavaScript called viewModel (see diagram).
2. Three of the properties will be ko.observables which enables data binding:
        firstName, familyName and fullNameVisible
3. firstname and familyName bound to textboxes.
4. Enforce the update of the viewModel properties after every key press by adding:
        valueUpdate: 'afterkeydown'  to the data-bind section of the textboxes
5. Binding the checked property of the checkbox to fullNameVisible along with the label.visible property.
6. Create a fourth dependentObservable property called fullName, which is dependent on firstName
and familyName and databound to “Hello {fullName}” label.

7. Bind the changeName function to the Change Name button, which updates firstName and familyName.

<!DOCTYPE html>
<html>
<head>
<script src="http://cloud.github.com/downloads/SteveSanderson/knockout/knockout-2.0.0rc.debug.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var viewModel = {
firstName: ko.observable("Bob"),
familyName: ko.observable("Smith"),
changeName: function () {
this.firstName("Joe");
this.familyName("Bloggs");
},
fullNameVisible: ko.observable(true),
};
viewModel.fullName = ko.dependentObservable(function() {
return this.firstName() + " " + this.familyName();
}, viewModel);
ko.applyBindings(viewModel);
});
</script>
</head>
<body>
<div>Stockbroker:
<input type="text" data-bind="value: firstName, valueUpdate: 'afterkeydown'" />
<input type="text" data-bind="value: familyName, valueUpdate: 'afterkeydown'" />
<input type="checkbox" data-bind="checked: fullNameVisible" />
<span>Hello </span><span data-bind="text: fullName, visible: fullNameVisible"></span>
<button data-bind="click: changeName">Change name</button>
</div>
</body>
</html>

Observable Arrays


Here is an example showing lists of data with validating input controls


Live demo:  http://c9.io/stevenh77/knockoutdemo/workspace/demo2.html


image

<!DOCTYPE html>
<html>
<head>
<script src="http://cloud.github.com/downloads/SteveSanderson/knockout/knockout-2.0.0rc.debug.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/jQuery.Validate/1.6/jQuery.Validate.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var TradeModel = function(trades) {
var self = this;
self.trades = ko.observableArray(trades);

self.addTrade = function() {
self.trades.push({
ticker: "",
price: ""
});
};

self.removeTrade = function(trade) {
self.trades.remove(trade);
};

self.save = function(form) {
alert("Could now transmit to server: " + ko.utils.stringifyJson(self.trades));
// To actually transmit to server as a regular form post, write this: ko.utils.postJson($("form")[0], self.gifts);
};
};

var viewModel = new TradeModel([
{ ticker: "MSFT", price: "39.95"},
{ ticker: "AAPL", price: "120.00"}
]);

ko.applyBindings(viewModel);

// Activate jQuery Validation
$("form").validate({ submitHandler: viewModel.save });
});
</script>
</head>
<body>
<form action='/someServerSideHandler'>
<p>You have entered <span data-bind='text: trades().length'>&nbsp;</span> trade(s)</p>
<table data-bind='visible: trades().length > 0'>
<thead>
<tr>
<th>Ticker</th>
<th>Price</th>
<th />
</tr>
</thead>
<tbody data-bind='foreach: trades'>
<tr>
<td><input placeholder='Ticker' class='required' data-bind='value: ticker, uniqueName: true' /></td>
<td><input placeholder='Price' class='required number' data-bind='value: price, uniqueName: true' /></td>
<td><a href='#' data-bind='click: $root.removeTrade'>Delete</a></td>
</tr>
</tbody>
</table>

<button data-bind='click: addTrade'>Add Trade</button>
<button data-bind='enable: trades().length > 0' type='submit'>Submit</button>
</form>
</body>
</html>

Bindings

Built in binding

These bindings come out of the box











Text and Appearancevisible, text, html, css, style, attr
FormsClick, Event, Submit, Enable, Disable, Value, Checked, Options/Selected options (for dropdown or multi select)
Control Flowif, ifnot, foreach, with
TemplateOld:  Traditional JavaScript template (<script>)
New:  Inline, template less, comment based syntax

Custom bindings


Sometimes it’s preferred to use custom bindings over the built in bindings as it can keep your code more reusable and succinct.

ko.bindingHandlers.yourBindingName = {
init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
// This will be called when the binding is first applied to an element
// Set up any initial state, event handlers, etc. here
},
update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
// This will be called once when the binding is first applied to an element,
// and again whenever the associated observable changes value.
// Update the DOM element based on the supplied values here.
}
};

KO Utilities


Knockout protected observable:  Allows you to commit or undo changes to your observable data item, sweet!


Data features


You can use the built in Knockout functions to convert to |JavaScript and JSON:  ko.ToJS() and ko.ToJSON()

var viewModel = {
firstName : ko.observable("Bert"),
lastName : ko.observable("Smith"),
pets : ko.observableArray(["Cat", "Dog", "Fish"]),
type : "Customer"
};
viewModel.hasALotOfPets = ko.computed(function() {
return this.pets().length > 2
}, viewModel)


var jsonData = ko.toJSON(viewModel);

// Result: jsonData is now a string equal to the following value
// '{"firstName":"Bert","lastName":"Smith","pets":["Cat","Dog","Fish"],"type":"Customer","hasALotOfPets":true}'


var plainJs = ko.toJS(viewModel);

// Result: plainJS is now a plain JavaScript object in which nothing is observable. It's just data.
// The object is equivalent to the following:
// {
// firstName: "Bert",
// lastName: "Smith",
// pets: ["Cat","Dog","Fish"],
// type: "Customer",
// hasALotOfPets: true
// }

Loading and Saving JSON Data

$.getJSON("/some/url", function(data) { 
// Now use this data to update your view models,
// and Knockout will update your UI automatically
})

var data = /* Your data in JSON format - see below */;
$.post("/some/url", data, function(returnedData) {
// This callback is executed if the post was successful
})

See the knockout documentation for examples on loading and saving JSON data.


http://knockoutjs.com/documentation/json-data.html

Wednesday, 14 December 2011

JavaScript Patterns

Being a client side language usually heavily tied to the UI, JavaScript code sometimes suffers from a lack of core programming concepts that can make the code hard to reuse and maintain. Here are a few patterns that can help:

Prototype

Benefits include:

  • Variables taken out of global namespace
  • Methods loaded once into memory and reused by each instance
  • Methods can be overridden by developers using your code

image

Module

Benefits include:

  • Variables taken out of global namespace
  • Public and private members

Cons:

  • Methods get loaded into memory for each instance
  • Not easy to override methods
  • Debugging can be trickier as private members can be hidden

image

And the winner is… Revealing Prototype

Benefits include:

  • Variables taken out of global namespace
  • Public and private members
  • Easy to override methods

image

Saturday, 10 December 2011

Silverlight 5 RTM

It took a while but Silverlight 5 is finally here: http://www.silverlight.net/downloads

 

New features

Building next-generation business applications

· PivotViewer -- now included in SDK. Adds support for dynamic client-based collections, XAML-based visuals, and customizability.

· ClickCount: Add support for multi-click to your application

· Listbox/ComboBox type-ahead text searching: Listboxes and ComboBoxes can now scroll based on text input

· Ancestor RelativeSource Binding: Bind to a property on a parent control

· Implicit DataTemplates: Allow DataTemplates to be defined implicitly

· DataContextChanged event

· Added PropertyChanged to the UpdateSourceTrigger enum

· Save File and Open File Dialog: Specify a default filename when you launch your SaveFileDialog and specify a default directory when you launch your OpenFileDialog

· Databinding Debugging: Set a breakpoint directly in XAML, examine locals, and debug your bindings

· Custom Markup Extensions: Execute custom code at XAML parse time

· Binding on Style Setters: You can now specify a binding within a style

Improved Text support

· Text Tracking & Leading: Exercise fine-grained control over the spacing between characters and lines in your text

· Linked Text Containers: Create linked RichTextBlocks that allow text to flow seamlessly from one to the next

· OpenType and Pixel Snapped Text : Improved text clarity

· Postscript vector printing: reduces the size of print jobs and improves rendering quality of text

· Performance improvements for Block Layout Engine.

Silverlight 5 performance improvements

· Parser Performance Improvements: Improved XAML parse times for UserControls & ResourceDictionaries

· Network Latency Improvements: Significant performance improvement in ClientHttpWebRequest scenarios

· H/W accelerated rendering in IE9 windowless mode: Silverlight now uses the new SurfacePresenter APIs for H/W accelerated rendering in IE9 windowless mode

· Multicore JIT: Shortens the start-up time for Silverlight apps

· 64-bit browser support

 

Graphics improvements

· Improved Graphics stack: The graphics stack has been re-architected to add features such as Independent Animations

· 3D: Use the XNA API on the Windows platform to gain low-level access to the GPU and draw vertex shaders and low-level 3D primitives. Includes Render targets, XNA built-in effects, surface composition settings for depth/stencil buffers and multi-sample anti-aliasing

 

Silverlight 5 extends features of the "Trusted Application" model

Silverlight 5 extends features of the ‘Trusted Application’ model to the browser for the first time. These features, when enabled via a group policy registry key and an application certificate, mean users won’t need to leave the browser to perform complex tasks:

· Multiple window support: Launch multiple top-level windows inside a SL OOB application

· Full-Trust in-browser: Using Group Policy, deploy signed in-browser applications that harness the full power of full-trust functionality

· In-browser HTML support: Host your WebOC within an in-browser SL application

· Unrestricted File System Access: Read from and write to any directory on your system, from a full-trust application

· P/Invoke support : Allows existing native code to be run directly from Silverlight

 

Tools improvements

  • Visual Studio Team Test support.

Improved media support

· Low Latency Audio Playback: Use the SoundEffect API to trigger low-latency sound

· Variable Speed Playback: allows video to be played at different speeds and supports fast-forward and rewind. At up to twice the speed, audio pitch correction allows users to watch videos while preserving a normal audio pitch.

· H/W Decode of H.264 media: Significant performance improvements with H.264 media decoding of unprotected content

· DRM Key Rotation/LiveTV Playback: Long-running live TV playback protected through the use of rotating licenses

· Application-Restricted Media: Prevents playback of protected content in unauthorized applications

Friday, 9 December 2011

Top 100 fonts

Based on a German website, these are the top 100 best fonts of all time.

33-best-fonts

Top 100 Best Fonts Of All Time

Below you will find the full list of the best 100 fonts along with the designer & the year in which they were designed.

1. Helvetica [1957 - Max Miedinger]

2. Garamond [1530 - Claude Garamond]

3. Frutiger [1977 - Adrian Frutiger]

4. Bodoni [1790 - Giambattista Bodoni]

5. Futura [1927 - Paul Renner]

6. Times [1931 - Stanley Morison]

7. Akzidenz Grotesk [1966 - G nter Gerhard Lange]

8. Officina [1990 - Erik Spiekermann]

9. Gill Sans [1930 - Eric Gill]

10. Univers [1954 - Adrian Frutiger]

11. Optima [1954 - Hermann Zapf]

12. Franklin Gothic [1903 - Morris Fuller Benton]

13. Bembo [1496 - Francesco Griffo]

14. Interstate [1993 - Tobias Frere-Jones]

15. Thesis [1994 - Lucas de Groot]

16. Rockwell [1934 - Frank H. Pierpont]

17. Walbaum [1800 - Justus Walbaum]

18. Meta [1991 - Erik Spiekermann]

19. Trinit [1982 - Bram De Does]

20. Din [1926 - Ludwig Goller]

21. Matrix [1986 - Zuzana Licko]

22. OCR [1965 - American Type Founders]

23. Avant Garde [1968 - Herb Lubalin]

24. Lucida [1985 - Chris Holmes / Charles Bigelow]

25. Sabon [1964 - Jan Tschichold]

26. Zapfino [1998 - Hermann Zapf]

27. Letter Gothic [1956 - Roger Roberson]

28. Stone [1987 - Summer Stone]

29. Arnhem [1998 - Fred Smeijers]

30. Minion [1990 - Robert Slimbach]

31. Myriad [1992 - Twombly & Slimbach]

32. Rotis [1988 - Olt Aicher]

33. Eurostile [1962 - Aldo Novarese]

34. Scala [1991 - Martin Majoor]

35. Syntax [1968 - Hans Eduard Meier]

36. Joanna [1930 - Eric Gill]

37. Fleishmann [1997 - Erhard Kaiser]

38. Palatino [1950 - Hermann Zapf]

39. Baskerville [1754 - John Baskerville]

40. Fedra [2002 - Peter Bil'ak]

41. Gotham [2000 - Tobias Frere-Jones]

42. Lexicon [1992 - Bram De Does]

43. Hands [1991 - Letterror]

44. Metro [1929 - W. A. Dwiggins]

45. Didot [1799 - Firmin Didot]

46. Formata [1984 - Bernd M llenst dt]

47. Caslon [1725 - William Caslon]

48. Cooper Black [1920 - Oswald B. Cooper]

49. Peignot [1937 - A. M. Cassandre]

50. Bell Gothic [1938 - Chauncey H. Griffith]

51. Antique Olive [1962 - Roger Excoffon]

52. Wilhelm Klngspor Gotisch [1926 - Rudolf Koch]

53. Info [1996 - Erik Spiekermann]

54. Dax [1995 - Hans Reichel]

55. Proforma [1988 - Petr van Blokland]

56. Today Sans [1988 - Volker K ster]

57. Prokyon [2002 - Erhard Kaiser]

58. Trade Gothic [1948 - Jackson Burke]

59. Swift [1987 - Gerald Unger]

60. Copperplate Gothic [1901 - Frederic W. Goudy]

61. Blur [1992 - Neville Brody]

62. Base [1995 - Zuzana Licko]

63. Bell Centennial [1978 - Matthew Carter]

64. News Gothic [1908 - Morris Fuller Benton]

65. Avenir [1988 - Adrian Frutiger]

66. Bernhard Modern [1937 - Lucian Bernhard]

67. Amplitude [2003 - Christian Schwartz]

68. Trixie [1991 - Erik van Blokland]

69. Quadraat [1992 - Fred Smeijers]

70. Neutraface [2002 - Christian Schwartz]

71. Nobel [1929 - Sjoerd de Roos]

72. Industria [1990 - Neville Brody]

73. Bickham Script [1997 - Richard Lipton]

74. Bank Gothic [1930 - Morris Fuller Benton]

75. Corporate ASE [1989 - Kurt Weidemann]

76. Fago [2000 - Ole Schafer]

77. Trajan [1989 - Carol Twombly]

78. Kabel [1927 - Rudolf Koch]

79. House Gothic 23 [1995 - Tal Leming]

80. Kosmik [1993 - Letterror]

81. Caecilia [1990 - Peter Matthias Noordzij]

82. Mrs Eaves [1996 - Zuzana Licko]

83. Corpid [1997 - Lucas de Groot]

84. Miller [1997 - Matthew Carter]

85. Souvenir [1914 - Morris Fuller Benton]

86. Instant Types [1992 - Just van Rossum]

87. Clarendon [1845 - Benjamin Fox]

88. Triplex [1989 - Zuzana Licko]

89. Benguiat [1989 - Ed Benguiat]

90. Zapf Renaissance [1984 - Hermann Zapf]

91. Filosofia [1996 - Zuzana Licko]

92. Chalet [1996 - House Industries]

93. Quay Sans [1990 - David Quay]

94. C zanne [1995 - Michael Want, James Grieshaber]

95. Reporter [1938 - Carlos Winkow]

96. Legacy [1992 - Ronald Arnholm]

97. Agenda [1993 - Greg Thompson]

98. Bello [2004 - Underware]

99. Dalliance [2000 - Frank Heine]

100. Mistral [1953 - Roger Excoffon]

Saturday, 12 November 2011

dat.GUI: JavaScript variable editor

image A lightweight graphical user interface for changing variables in JavaScript. 

Simply pass your variables into the dat.GUI framework and they’ll appear in an editable data grid in the top right hand corner.

A beautiful example here:  http://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage

My simple example:image

Get the code here:  http://code.google.com/p/dat-gui/

Monday, 7 November 2011

C# Object Pooling

The following code was taken from the RedGate blog for GC memory management:

Friday, 28 October 2011

TPL DataFlow C#

The new DataFlow library can build up pipelines for our data to flow through.

Perhaps you have a series of processes a file must go through in a defined sequence:

  1. Encrypt
  2. Compress
  3. FTP
  4. Archive

DataFlow allows for easy manipulation of concurrency, asynchronicity and build up of our data flow pipelines.

In this simple example a number is posted into the pipeline, to be transformed by doubling it.  It can then be passed to the ActionBlock for output to screen.

You can download the TPL DataFlow CTP from Microsoft:
http://msdn.microsoft.com/en-us/devlabs/gg585582