Skip to content

Instantly share code, notes, and snippets.

// So the question is - how would I configure OpenRasta to enable the below, where a real-world URI might look like (and any number of FooId
// arguments may be supplied):
// /queries/FooReportResource?LastReportDate=2010-05-23Z&ApplicableFoos=FooId1,FooId2,FooId3,FooId4
public class Configuration : IConfigurationSource
{
public void Configure()
{
using (OpenRastaConfiguration.Manual)
{
public interface IHandleCommands<TCommand> where TCommand : IAmACommand
{
void Handle(TCommand command);
}
public interface IAmACommand
{
Guid AggregateId { get; }
}
Type actual = Given.AType("Foo", With.A.Constructor(
With.A.Parameter("bar", Of.AType("Bar", With.A.DefaultConstructor))
, With.A.Parameter("baz", Of.AType("Baz",
With.A.Constructor(With.A.Parameter("fizz", Of.AType("Fizz", With.A.DefaultConstructor)))))
, With.A.Parameter("buzz", Of.AnExistingType<int>())));
// Worth noting that restrictions prevented me from accessing libraries like the Apache Commons Guid and others
// Also, not production code - needs some TLC & refactoring love
// If I get time will be moved to a proper home in GitHub
package semeosis.eventsourcing.infrastructure;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
{
"_id": "_design/eventsource",
"_rev": "10-6871125abf6ffb2c2b34a43e08c9909c",
"language": "javascript",
"views": {
"allEvents": {
"map": "function(doc) { if (doc.Events) {doc.Events.forEach(function(e) { if (e.Event.Detail.AggregateId) { emit(e.Event.Detail.AggregateId, e.Event); }}); }}"
}
},
"filters": {
System.Windows.Markup.XamlParseException occurred
Message=Provide value on 'System.Windows.Data.Binding' threw an exception. [Line: 108 Position: 106]
LineNumber=108
LinePosition=106
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Foo.UI.Silverlight.Pages.ExcelExtract.Detail.View.CreateFileExtract.InitializeComponent()
at Foo.UI.Silverlight.Pages.ExcelExtract.Detail.View.CreateFileExtract..ctor()
InnerException: System.ArgumentException
Message=DependencyProperty System.Windows.Controls.TabControl. CurrentTabItemByTagName cannot be set on an object of type Foo.UI.Silverlight.Controls.Common.Tab.Behaviors.InteractWithIndexThroughTagNamesBehaviour.
public class BasicHeader
{
private readonly string _username;
private readonly string _password;
public BasicHeader(string username, string password)
{
_username = username;
_password = password;
}
// version 1.0.3.0 -- Don't ask, I know... :(
// I want to pass in an array of enum values to a constructor of a type.
// The code in my config looks like the below
// The error I get now is
// ArgumentException "An item with the same key has already been added."
// Stack trace (cleaned) is:
// at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
@NeilRobbins
NeilRobbins / UTF8Encoding & BOM is broken
Created November 19, 2010 13:44
The System.Text.UTF8Encoding class provides a constructor which allows the client to specify whether a BOM mark should be included. It doesn't seem to work.
-- Keep in mind the documentation for this constructor which says "A parameter specifies whether to provide a Unicode byte order mark" & "true to specify that a Unicode byte order mark is provided; otherwise, false."
-- Whilst the standard allows (but does not recommend) for the optional BOM mark to be included, Excel 2003 seems to require it when reading a UTF-8 encoded csv.
> let encoderWithBOM = new UTF8Encoding(true);;
val encoderWithBOM : UTF8Encoding
> let encodedText = encoderWithBOM.GetBytes("Some Text");;
val encodedText : byte [] =