Skip to content

Instantly share code, notes, and snippets.

private void Initialize()
{
container = new Container();
container.Register<IEventAggregator>(new EventAggregator());
container.Register<IDatabase>(new Database());
container.Register<MainViewModel>(c => new MainViewModel(
c.Resolve<IEventAggregator>(),
c.Resolve<IDatabase>()));
private void Initialize()
{
// Create the IoC container.
container = new Container();
// Initialize the ViewModelFactory with the Funq ViewModelResolver.
ViewModelFactory.InitializeResolver(new FunqViewModelResolver(container));
// Register the dependency composition.
container.Register<IEventAggregator>(new EventAggregator());
<phone:PhoneApplicationPage
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:kellafeed.ViewModels">
<phone:PhoneApplicationPage.Resources>
<vm:MainViewModelFactory x:Key="MainViewModelFactgoryDataSource"
d:IsDataSource="True"/>
@kellabyte
kellabyte / twitter_datamining.cs
Created January 7, 2012 20:29
Data mining from the Twitter public stream and storing the JSON into Cassandra
#
# Commands executed in Cassandra
#
/*
connect 127.0.0.1/9160;
create keyspace twitter;
use twitter;
# Create a column family to contain the rowcount of how many tweets I have.
CREATE COLUMN FAMILY rowcounts
using System;
using System.Diagnostics;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
namespace TweetStreamTest
{
public class FastLoopTest
{
@kellabyte
kellabyte / MassTransitSubscriberTest.cs
Created February 6, 2012 20:26
Reproducing MassTransit subscription timing bug
/* BUG SUMMARY
*
* Initializing 2 endpoints at the same time and immediately
* publishing a message doesn't always arrive to the subscriber.
*
* In this sample the expected output is:
*
* Initializing CommandHandler...
* Done
* Initializing Client...
using System;
using FluentCassandra;
using FluentCassandra.Types;
namespace CassandraGettingStartedSample
{
class FluentCassandraSample
{
public static void GetPosts()
{
using System;
using System.Collections.Generic;
using System.Linq;
using Cassandraemon;
namespace CassandraGettingStartedSample
{
public class Post
{
public string user { get; set; }
@kellabyte
kellabyte / app.config
Created March 1, 2012 18:27
MassTransit RuntimeService App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<!-- <property name="connection.driver_class">NHibernate.Driver.SqlServerCeDriver</property>-->
@kellabyte
kellabyte / CQS_and_CQRS.cs
Created March 3, 2012 03:19
CQS_and_CQRS
// CQS (Command-Query Separation)
// Bertrand Meyer devised the CQS principle
// It states that every method should either be a command that performs an action, or a
// query that returns data to the caller, but not both. In other words, asking a question
// should not change the answer. More formally, methods should return a value only if they
// are referentially transparent and hence possess no side effects.
//
// Example:
public class CustomerService