sedanwer

Stories kicked by sedanwer

Having fun with ImpressJs and WebSockets, creating real-time presentat(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 24 days, 16 hours ago

So a friend of mine showed me ImpressJs today. He was going to have notes on another screen (well actually on an iPad) and I thought it would be cool if the presentation could be synced with notes on another screen as well. Fired up Visual Studio and put together a small socket server as well as a simple java script client and created a Presenter-Attendee solution with ImpressJs and WebSockets. read more...

1 comment |category: |Views: 156

tags: another

Some XSockets and SisoDb fun – Part 2 of 2(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 month, 17 days ago

This is a continuation of Some XSockets and SisoDb fun. This post is about putting SisoDb to use and we will look how to implement Insert, Gets, Updates, Queries and Deletes in JavaScript against a socket handler. read more...

add a comment |category: |Views: 42

tags: another

C#, Parallel deserialization of JSON stored in database(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 4 months, 16 days ago

A while back ago I had to yield entities constructed by deserializing JSON stored in a database. The first solution just opened a simple single result, sequential reader against the database returning a one column result set containing JSON. This was just yield returned after deserialized to the desired entity. Trying to tweak this I turned to the task parallel library. The idea was to in a separate task, read from the datareade... read more...

add a comment |category: |Views: 9

tags: another

C#, Visual Studio 2010, No more Client profile in 5minutes.(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 4 months, 19 days ago

C#, Visual Studio 2010, No more Client profile in 5minutes. I guess I’m not alone being tired of running into the “Client profile” framework version used when creating a Console application in Visual Studio 2010. Don’t know how life is going to be in coming version of Visual Studio, but until then, lets show you a solution that takes no more than 5 minutes. read more...

add a comment |category: |Views: 3

tags: another

C#, Generic factory with support for private constructors(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 4 months, 28 days ago

Shows how-to create a generic factory allowing creation of generic classes having a private constructor using compiled lambdas to get better performance. read more...

3 comments |category: |Views: 289

tags: another

NHibernate – Custom Id-generator(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 2 months ago

Recently I had a case where I needed to switch from the Identity generator to the HiLo generator in an existing project with existing data. Why? Well for one thing it gives better performance since identities brakes the ability to use batch inserts, since the generated Id needs to be returned (selected) after each insert. I didn’t want to go through and configure params for each entity, hence I created a custom implementation of an Id-generator and added some conventionbased configuration in that class ... read more...

add a comment |category: |Views: 20

tags: another

Json.Net vs ServiceStack.Text(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 3 months ago

This is going to be a verry short comparision of the two Json-serialization frameworks: >Json.Net – http://json.codeplex.com >ServiceStack.Text – https://github.com/mythz/ServiceStack.Text I have always used Json.Net when dealing with serialization of entities back and forth to Json, but then I stumbled upon this: “Fastest JSON Serializer for .NET released” – http://www.servicestack.net/mythz_blog/?p=344 Man was I excited, since I need the “best” performance I can get for this in SisoDb.Com ... read more...

add a comment |category: |Views: 62

tags: another

C#, Clean up your Linq-queries and lambda expressions(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 3 months ago

Last week something caught my eyes. How scattered business logic can become if you let your binary expressions be used “here and there” when matching entities against certain rules. Logic for a single entity, e.g Customer can be used all over your codebase. This article will show you a way to get around this and to get a central repository of rules/predicates that can be applied to entities and makes your daily unit test writing easier. I will use simple operator overloading for accomplishing this. read more...

add a comment |category: |Views: 17

tags: another

C# – Custom datareader for SqlBulkCopy(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 6 months ago

When prototyping SisoDb I used datatables under the covers when consuming the SqlBulkCopy class to insert data. This lead to that I had the source entities in memory as well as the datatables. Since the SqlBulkCopy class can work with readers I created a very simple datareader implementation over my entities instead. I gained a little performance boost and got rid of unnecessary creation of in-memory datatables. At first the API of a datareader seems kind of tedious to implement, but in the context of using it in conjunction with the SqlBulkCopy-class, there really isn’t that many methods that need to be implemented... read more...

add a comment |category: |Views: 52

tags: another

Json.Net – private setters(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 6 months ago

This post is a simple on explaining how you can make Json.Net handle private setters. I will show you three solutions but only one fulfills my requirements: - No attributes should be required - No fields should be serialized/deserialized only properties The solution is to extend the DefaultContractResolver..... read more...

add a comment |category: |Views: 2

tags: another

C# – Batch identity inserts(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 7 months ago

I’m currently building support for identity inserts in SisoDb where I need to let the database generate the ids and then assign them to the entities. To get better performance I want to batch up the inserts and sending them in a large chunk to the Sql-server and I want to make use of parameters to be protected from sql-injection attacks. You can of course use SqlBulkCopy but it will not let you get the generated identities so that you can assign them to your entities. read more...

add a comment |category: |Views: 6

tags: another

Use sequential guids in c#(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 7 months ago

Shows you how you could use sequential guids in C# by letting Sql-server generate them. read more...

6 comments |category: |Views: 28

tags: another

SisoDb, an early prototype of a NoSQL provider for SQL-server(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 7 months ago

Writings about an early NoSQL provider for SQL-server. read more...

add a comment |category: |Views: 31

tags: another

Let business scenarios be reflected in your code(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 9 months ago

I’m working with a project where I use something I call “scenarios”. The idea is that each scenario in the businessmodel is represented by three classes: - Command - Result - Scenario The reason for why I wan’t this is that I want each scenario easily detected in my coding-model....... read more...

add a comment |category: |Views: 7

tags: another

Tip – When writing custom assertion methods – Keep your assertion stac(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 1 year, 11 months ago

I have bumped in to a couple of custom assertion methods which lets the assertion stack trace contain the assertion method itself. Hence, if I use, e.g. Testdriven.Net, I might double-click on the wrong line and end up in the assertion method instead of the test. It’s really easy to prevent this, just add... read more...

add a comment |category: |Views: 4

tags: another

Entity framework 4 – CTP3 – Complex type mapping(daniel.wertheim.se)

submitted by sedanwersedanwer(216) 2 years ago

Shows you how-to deal with Complex-type mapping in my EF4, Code first, implementation. read more...

add a comment |category: |Views: 36

tags: another