Tech Tock

Time is of the essence.

@ Lab

A Walk Down Compiler Lane

May is compiler month for our technical lecture series.  Kalani Thielen kicked off the topic with a presentation on his lambda calculus compiler written in Haskell. From the language definition all the way down to machine code generation and register allocation in only an hour.

Some of us got a little lost in the language definitions, but I was drawn back in when we got to assembler – so there was something for everyone.

Dow Drops 1000 points – No Fair — Do over.

Intraday Chart

The Dow dropped 1000 points out of nowhere then snapped back.  Later the trades were canceled.  It was a very strange afternoon.  One Lab49er saw his portfolio fall 30%, then snap back.  He was going to make some orders, but the whole episode was over in a flash and financial websites were overwhelmed and sluggish at best.  Yahoo and Google finance slowed to a crawl, but MoneyCentral seemed to keep going.

The End (of the Netbook Era) is Nigh

This article says netbooks are on the way out.  Or not…

Linq For JavaScript

Hopefully I don’t get deep enough into JavaScript to need jslinq,but its nice knowing its there.  If only I could get intellisense for that…   Ahhh, Intellisense.

Capital Markets Course In Session

It slipped my mind until one of the Lab49 new hires mentioned it, but the Capital Markets course is run about twice a year and people are taking it right now.  Good luck guys, its worth it.  Hopefully you got the same inspiring speech my class did.

Google Code University – Hacking 101

Google will teach you how to hack with this cheesy app.

Four Stages of Good Grief

imageThose of us who sit near the recruiting team have a front row seat to the multiple choice tech testing which leads me to constantly wonder about the questions:

Do I know that?

Was I supposed to know that?

Don’t I know that?

What the heck is that?

Wait a minute – what language are they testing?

Lately the answer is Flex.  The questions sound like stuff I know but I can never pick an answer.

Twins? Separated At Birth?

image image

image image

May 8, 2010 Posted by | Uncategorized | , , | Leave a comment

Linq.Debug.Print

Here’s a great explanation of System.Interactive.

I really liked this part about being able to do debug.print within a multipart Linq Statement:

var res = GetRandomNumbers(100)
.Take(10) .Do(x => Console.WriteLine(“Source -> {0}”, x))
.Where(x => x % 2 == 0)
.Do(x => Console.WriteLine(“Where -> {0}”, x))
.OrderBy(x => x)
.Do(x => Console.WriteLine(“OrderBy -> {0}”, x))
.Select(x => x + 1)
.Do(x => Console.WriteLine(“Select -> {0}”, x));

The below shows what’s triggered by the call to Run:

Source  -> 96
Where   -> 96
Source  -> 25
Source  -> 8
Where   -> 8
Source  -> 79
Source  -> 25
Source  -> 3
Source  -> 36
Where   -> 36
Source  -> 51
Source  -> 53
Source  -> 81
OrderBy -> 8
Select  -> 9
9
OrderBy -> 36
Select  -> 37
37
OrderBy -> 96
Select  -> 97
97

January 12, 2010 Posted by | Uncategorized | , , | 1 Comment

LINQ Group By With Multiple Aggregates

It appears that LINQ does not support a query that outputs multiple group by aggregate fields.  For example, there’s Min() and a Max() functions, so to get both min & max from a list, you seem to need to make 2 LINQ queries:

 var min = (from d in data select d).Min();
 var max = (from d in data select d).Max();

In SQL, the 2 values would pop out easily from a single query:

 Select min(d), max(d) from data

LINQ has all the power of SQL and works similarly, just the syntax is different.  To achieve this result we have to use a group by.  But we’ll be grouping by nothing, including all items in the set in a single bucket. I usually group by “1”, which makes a single grouping of all the elements (grouping by any single object will do the same):

 var minMax = from d in values
    group d by 1 into g
    select new { Min = g.Min(x => x),
     Max = g.Max(x => x) };

 

minMax.First() now contains the min and max for the set of values.

November 18, 2009 Posted by | Uncategorized | , , , , , , , , , | 7 Comments

LINQ To C# – Drop Dead

What’s up with no edit & continue support for methods with Lambda Expressions(mostly from LINQ queries).

Error    7    Modifying a ‘method’ which contains a lambda expression will prevent the debug session from continuing while Edit and Continue is enabled.

Originally this post was going to be “LINQ Vs. Edit and Continue”, but then I found this article on MSDN saying how it works just fine in Visual Basic.  Visual Basic!  WTF!!!

The details for VB are a little cagey though:

You can add or remove code before the LINQ statement…. Your Visual Basic debugging experience for non-LINQ code remains the same as it was before LINQ was introduced.

Does this mean if you add or remove code after a LINQ statement it stops edit and continue, or does this mean MSDN needs a better editorial staff?  The “before” seems to cast doubt on the statement that “debugging experience for non-LINQ code remains the same ”  Not that I really care since I like my languages with curly brackets.

If you want to know what you can’t do in C# edit and continue, read this article.  I personally have no interest in what I can’t do. I only want to know when I’ll be able to do it and I couldn’t find any articles on that.  I heard from a friend that its not fixed in C# 4.0.   😦

LINQ is too good to give up, but this is really getting annoying.

I’m almost (getting this close) ready to make my own solution, or horrors, switching to VB.

November 18, 2009 Posted by | Uncategorized | , , , , , , , , , , , | Leave a comment

In Memory of Linq2SQL – 2006 – 2008 – RIP

I was doing a lot of Linq2SQL recently and it was easy and convenient – I’d highly recommend it. Except for the fact that its now obsolete. Linq2SQL is being tossed aside in favor of Entity Framework, which is not as lightweight or simple :(. I would look into NHibernate from what I’ve read of Entity Framework.

In another version or two Entity Framework may get more of Linq2SQL’s simplicity and ease of use. Oh joy.

November 16, 2009 Posted by | Uncategorized | , , , , , | 4 Comments