Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 5,953 | Comments: 44,409

filter by tags archive

NHProf.com downtime, and using windows as a server system


Yesterday nhprof.com was down, there was a YSOD and when I logged into the server to try to figure out what the problem was, I got this:

image

The server has been running with no issues for over a year, so it is not an issue with not activating after installation. This is a Windows 2008 Server, and I find it incovievable that a server would go down because of activation. To spread more salt on the wound, it wasn’t a problem that could be fixed remotely, I had to call my host and ask them to fix that (they did in a remarkably short time).

Annoying!

Can you hack this out? Hint #1


Here is another challenge, smaller, this time, which can lead you the right path.  And yes, it is a screwy one.

All you have to do is make the following assertion fail.

public class Program
{
private static void Main(string[] args)
{
CanThisHappen<MyFunnyType>();
}

public static void CanThisHappen<T>() where T : class, new()
{
var instnace = new T();
Debug.Assert(instnace != null,"How did we break the CLR?");
}
}

The rules are simple, you are not allowed to do anything outside the current process. That means that profiling API, post compilation assembly rewrite, etc are forbidden. Anything else is a fair game.

I will let you know that I can make the assertion fail in 4 lines of code :-)

Can you hack this out? Revised


It appears that I made this challenge a bit too hard, I wrote it in haste and didn’t check that it all works. Here is the new code, it is almost the same as the first, but now it doesn’t check the typeof(T) (for which there is no interception path), but the provided runnerType instead.

internal interface IRunner
{
void Execute();
}

public sealed class AssemblyRunner : IRunner
{
void IRunner.Execute()
{
Console.WriteLine("executing");
}
}

public class CompositeRunner
{
private readonly Type runnerType;

public CompositeRunner(Type runnerType)
{
this.runnerType = runnerType;
}

public void Execute()
{
if (!typeof(IRunner).IsAssignableFrom(runnerType))
throw new InvalidOperationException("invalid type");
var runner = (IRunner)Activator.CreateInstance(runnerType);
Console.WriteLine("starting");
runner.Execute();
Console.WriteLine("done");
}
}

Sorry about that image

Look at the future posts for hints for that.

How would you learn a new platform?


Here is an interesting problem that I am facing. I have a pretty good working knowledge of computing, and while I can usually manage to get the gist of a new technology in a short amount of time, that is only useful for talking about it, not actually applying that. I am currently trying to figure out the parts where I am missing, and plug the holes. And I am running into a bit of a problem here.

A case in point, I can read Java, and I can probably write C# code in Java, but I can’t write a Java application. Not for lack of technical skills, but just because I lack the practical knowledge on how to do so.  The problem is that it is going to take too long for me to slog through everything myself, especially since my main problems are in things like IDEs and usage patterns, which aren’t really stuff that you learn from reading about it.

I am thinking on taking a Java course, not so much for the content of the course, as the ability to actually build Java apps in an environment where I can ask questions. On the other hand, picking the right course is problematic, I am not going to sit through “this is a for loop", but I don’t want to be the guy with the blank stare.

The wave experience


I had the chance to take part of a multi people conversation on Google Wave.

Overall, I have to say that it was an interesting chat experience, but it lacks some very important things. Chief among them, if you are going to allow multiple people to edit at the same time and expect to give a real time experience, you have to provide good experience when people are editing “beyond the fold” (the areas of the documents that I am not currently viewing.

Replaying stuff is nice, but it isn’t working for the real time edit portion, which is the most interesting bit.

Overall, I have to say that I found it to be somewhat like IRC, and I dropped out of that years ago, because it had a real time requirements that I could not justify. I much rather use something that is by nature async, with a sync-like experience, like email or twitter.

Uber Prof analysis pipeline


In most situations, I like to think about my apps as a set of composite Lego blocks. Ignoring the infrastructure bits, here is how Uber Prof is structured internally:

image

I have a set of message processors, which work of low level event messages, detect patterns in those messages and turn them into high level events. Next, I have the Model Building part, which takes the high level information and handle correlation between the different events. I then have analyzers, which are branched out of the model building processor to perform the various analysis actions that I need.

The idea is to try, as much as possible, to build the system out of identical parts, and when I need additional functionality in a given location, I create another extension point and plug in more single use classes at that place.

All of this is being orchestrated by a container that can provide those dependencies, so the act of creating a new class is also the sole act required to add the new feature to the system.

Does history matters?


In Gmail, right now, I have 65,290 (non spam) messages, stretching back over 3 years. I routinely (once a week or so) need to refer to something that is at least six months old. I just had to dug in old backups to find an instant message log from 2006, because I had some information there that could not be found anywhere else.

My take on that is that yes, history matters, a lot. Moreover, being able to get to that history matters as well.

Today, I cannot imagine how I would try to manage myself without Gmail there to help me, being able to efficiently & easily search my entire history is the number one reason I love it so much.

Oh, and also important, make sure you have the backups :-) That IM log that I was talking about survived about 4 different computer transfers.

Can you hack this out?


I recently had to take a really deep look into how to cheat the CLR, that brought about some interesting discoveries, including the fact that it is, surprisingly, possible to do so.

Let us say that you have this code in some 3rd party assembly that you cannot modify:

internal interface IRunner
{
void Execute();
}

public sealed class AssemblyRunner : IRunner
{
void IRunner.Execute()
{
Console.WriteLine("executing");
}
}

public class CompositeRunner<T> where T : new()
{
public void Execute()
{
if(!typeof(IRunner).IsAssignableFrom(typeof(T)))
throw new InvalidOperationException("invalid type");
var runner = (IRunner)new T();
Console.WriteLine("starting");
runner.Execute();
Console.WriteLine("done");
}
}

Can you get the CompositeRunner to output:

    • starting
    • before executing
    • executing
    • after executing
    • done

The real problem was a bit harder, but this is a good start.

FUTURE POSTS

No future posts left, oh my!

RECENT SERIES

  1. The RavenDB Comic Strip (3):
    28 May 2015 - Part III – High availability & sleeping soundly
  2. Special Offer (2):
    27 May 2015 - 29% discount for all our products
  3. RavenDB Sharding (3):
    22 May 2015 - Adding a new shard to an existing cluster, splitting the shard
  4. Challenge (45):
    28 Apr 2015 - What is the meaning of this change?
  5. Interview question (2):
    30 Mar 2015 - fix the index
View all series

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats