Fabrice's weblog

Tools and Source

News

My .NET Toolbox
An error occured. See the script errors signaled by your web browser.
No tools selected yet
.NET tools by SharpToolbox.com

Read sample chapters or buy LINQ in Action now!
Our LINQ book is also available on AMAZON

.NET jobs

Emplois .NET

Tuneo

ASP.NET Hosting transatlantys

Contact

Me

Others

Selected content

Archives

March 2010 - Posts

Announcing Sesame Data Browser

At the occasion of MIX10, which is currently taking place in Las Vegas, I'd like to announce Sesame Data Browser.
Sesame will be a suite of tools for dealing with data, and Sesame Data Browser will be the first tool from that suite.

Sesame Logo, Data, your way

Today, during the second MIX10 keynote, Microsoft demonstrated how they are pushing hard to get OData adopted. If you don't know about OData, you can visit the just revamped dedicated website: http://odata.org. There you'll find about the OData protocol, which allows you to publish and consume data on the web, the OData SDK (with client libraries for .NET, Java, Javascript, PHP, iPhone, and more), a list of OData producers, and a list of OData consumers.
This is where Sesame Data Browser comes into play. It's one of the tools you can use today to consume OData.

OData Browser

I'll let you have a look, but be aware that this is just a preview and many additional features are coming soon.
Sesame Data Browser is part of a bigger picture than just OData that will take shape over the coming months. Sesame is a project I've been working on for many months now, so what you see now is just a start :-)

I hope you'll enjoy what you see. Let me know what you think.

Hex Dump using LINQ (in 7 lines of code)

Eric White has posted an interesting LINQ query on his blog that shows how to create a Hex Dump in something like 7 lines of code.

Of course, this is not production grade code, but it's another good example that demonstrates the expressiveness of LINQ.

Here is the code:

byte[] ba = File.ReadAllBytes("test.xml");
int bytesPerLine = 16;
string hexDump = ba.Select((c, i) => new { Char = c, Chunk = i / bytesPerLine })
    .GroupBy(c => c.Chunk)
    .Select(g => g.Select(c => String.Format("{0:X2} ", c.Char))
        .Aggregate((s, i) => s + i))
    .Select((s, i) => String.Format("{0:d6}: {1}", i * bytesPerLine, s))
    .Aggregate("", (s, i) => s + i + Environment.NewLine);
Console.WriteLine(hexDump);

Here is a sample output:

000000: FF FE 3C 00 3F 00 78 00 6D 00 6C 00 20 00 76 00
000016: 65 00 72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00
000032: 31 00 2E 00 30 00 22 00 20 00 65 00 6E 00 63 00
000048: 6F 00 64 00 69 00 6E 00 67 00 3D 00 22 00 75 00
000064: 3E 00

Eric White reports that he typically notices that declarative code is only 20% as long as imperative code.


Cross-posted from http://linqinaction.net
More Posts