New Force Directed Particle Control in the Works

by mheydt 30. October 2009 22:42 >

I've been working on a new particle network control. Here's an example:


What's going on here? Well, I have two particles fixed in place (the blue and green particles). Those two particles are joined by 10 light blue particles, and therefore space themselves between the two fixed particles.  There are then five red particles just connected to the blue particle, and 15 yellow particles connected to the green particle.

If you press the 'scramble' button, the particles will be randomized and layout will begin after 3 seconds.

What's new about this control and the others that I have posted before? Well:

  • WPF and Silveright compatibility
  • NET 4.0 and Silverlight 3
  • A completely rewritten physics / particle engine
  • The particle engine is completely separate from the rendering engine
  • The rendering engine supports animation of new elements and lines, elements and lines being removed
  • Roamer functionality is implemented as a part of the control in the concept of a display virtualizer
  • The virtualizer is replaceable with your own
  • Heck, the particle engine can be replaced too
  • Nodes and lines can be any framework element you desire

It's still rough, but I'll publish it for sharing soon I hope.

Tags:

Enumerable.Range Pattern in C#

by mheydt 30. October 2009 14:25 >
I'm a big fan of Linq to objects.  I really like the way that you can write much more concise code with it for every day things, not just things that you would think that you normally do with Linq.

One of the things that I almost always do now is use the Linq ForEach instead of the C# foreach statement.  This gives you a nominal amount of code compression.  But the thing I want to write about is using Linq instead of the C# 'for' statement, which I think leads to a lot nicer code. 

I came across this the other day as I actually needed to write a 'for' statement to add a specific amount of nodes to a graph.  Upon writing it, I was like 'gee, there must be a more concise way of doing this', such as where I don't need to do 'for', an initializer, comparison, and incrementation sub-statements.  I mean, I just need to iterate across the integers 0 to 10 and apply a function to each.

The basic model that think of for doing this is provided in Ruby with sequences / ranges.  As an example, here is some ruby that generates the integers 1 to 10 and prints each to the console:



I'm not going to explain ruby in detail, but the (1..10) generates the integers 1 to 10, the '.each' says for each item in the sequence apply the code block that follows.  The code block is essentially a delegage with 'i' as a parameter and which prints 'i' to the console.

So how can this be done in C#?  Well, it requires a couple of steps.  First, System.Linq provides extensions to the Enumerable class, notably the 'Range' method which generates the values between two parameters:



This works fine, but I have an issue with it.  Enumerable.Range (and most things in Linq) returns an IEnumerable.  To iterate across those, you need to use the foreach statement (or a for, or while, that uses the IEnumerable methods), which is not really better than having to use the for loop.  What I'd like is something still more concise.

One thing that can be done is to convert the enumerable to a list using the ToList() Linq extension method:



This works great, but I really don't like having to convert the result of .Range() to a list just so I can apply the .ForEach() method to the result.  Why the Linq extensions don't have a .ForEach() on IEnumerable I don't know; it sure would be handy.  But, we can write our own:



Now that we have this, we can rewrite the code to the following, which is what I've been looking for the whole time:





Perfect, concise, and also using a fluent interface that I really like.


Tags:

C# | LInQ

StreamInsight

by mheydt 27. October 2009 12:18 >

Something I've been following for a few years is the evolution of CEP, Complex Event Processing.  CEP in a nutshell is a process for identifying patterns in data in a real time manner (as opposed to more like mining that is on long term trends).  A classic example that comes up in my circles often is with fraud detection in financial systems such as identifying someone trying to hack your financial web site.  A CEP system would be able to identify the patterns of failed login attempts and then be able notify the appropriate parties of the issue.

Microsoft has released a CTP of their CEP tool, which they are calling StreamInsight.  I haven't worked with it yet, but thought for now I'd drop links to various resources on it.  I'll also check out the sessions at the PDC in a few weeks and blog what I see.

http://blogs.msdn.com/streaminsight/

http://www.microsoft.com/global/sqlserver/2008/en/us/PublishingImages/CEP-Runtime.jpg

http://www.microsoft.com/downloads/details.aspx?FamilyID=a3faa562-b6dc-4702-90c6-bf8e08df3b8b&displaylang=en

http://www.dotnetrocks.com/default.aspx?showNum=465

 

Tags:

StreamInsight

Delta Entertainment System Reboots

by mheydt 19. October 2009 03:15 >

I was watching TV on a Delta flight the other day, which was quite cool as it was live Dish network and I got to watch live college football, but the system did reboot once.  Turns out the system is Linux...

 

Tags:

Curious

MCA, Again

by mheydt 13. October 2009 21:07 >
Well, I decided again today to start working on my Microsoft Certified Architect credential.  It's been over a year already getting going on this, so I guess better late than never ;-)

This is prompted by some work I'm doing right now helping a client convert from J2EE to .NET, combined with some composite application work that I've been doing for another client.  So, I've been looking to get a framework together that can be used to articulate decisions that I make.

Like a lot of other things, there isn't a lot of documentation on this, so I figure I'll try to work on a template and that I should write about it here. 

But how to start?  Well, I've decided that I'm going to re-read the Application Architecture Guide 2.0 from MS Patterns and Practices.  It's a great reference for just this type of communication, and it sets out a lot of the things you need to think about as a software architect.

To start, I decided to recreate the diagram that is in the introduction that is used to describe the outline of the guide.  It is also a good diagram for showing various architectural components required in a system:


My posts over the next days, months (hopefully not years) will focus on explaining the parts of this diagram, as well as I'm sure extending the diagram as I see needed by applying it to several real world applications.  Anyway, I find that one of the best ways for me to remember things is to write them down (hence blogging), and I hope it is also useful for you.

Tags:

MCA

about the author

I'm a .NET, XAML, and iOS polyglot that loves playing with new things and making cool and innovative stuff.  I am also a Mac junkie.

I am Principal Technologist for SunGard Global Services in NYC, in their Advanced Technologies practice, and I work extensively with SunGard's energy and financial customers.

Note the the posting on this blog are my own and do not represent the position, strategies or opinions of SGS.

twitter

I can't stop thinking big!
Sunday 1:08AM via WindowsLive
Just watched Moneyball. That's my pick for best movie this year.
Saturday 3:51PM via WindowsLive
@vincebelpiede: Report: Skype For Windows Phone Beta Imminent http://t.co/KYNjgg1L#mhtnd
Wednesday 8:39AM via Twitter for Mac
@mashable: Kinect Fusion Will Turn Gaming (and More) Into a 3D Fun House - http://t.co/Ihrq2fY2#mhtnd
Wednesday 8:39AM via Twitter for Mac
New Kinect SDK: http://t.co/57MvA5L5 #mhtnd
Wednesday 8:39AM via Twitter for Mac
Follow me on Twitter

recent comments

None

month list