Arjans blog

Arjan: Technical Learnings of Programmings for Make Benefit Glorious Framework of .NET

You'll find more and newer content by me at my github pages.

-Arjan Einbu

Custom ASP.NET DataSource parameters

February 2010

With ASP.NETs DataSource controls you can parameterize your query and have those parameters automatically fetched from one of a few standard sources. Those include getting a parameter value from the querystring, a form parameter, a control or from a users session variables, profile or cookies.

These parameter types enables us to build a lot of functionality without leaving ASP.NET markup. Still, they don't cover every imaginable scenario. So when someone asked how to get the username as a parameter in this question on Stackoverflow, it inspired me to write this article.

Continue reading

Diving deeper into Windows Azure table storage

September 2009

In a previous post about Windows Azure Table Storage, I relied on the StorageClient project in the Azure SDK samples. This feels a bit strange, and raises the question: Am I expected to include references to sample projects and be using Microsoft.Samples.whatever namespaces in my future projects?

This raises a couple of questions about license, copyright, support and more. Instead of digging into those questions, I came up with some alternate questions:

  • What does this sample project give us?
  • How does it work?
  • Can we do these things ourselves?

A lot of the searching was done in the sample code, since most of the other articles about accessing Windows Azure Table Storage depend on the same sample files. I was disappointed to see that even the Windows Azure SDK help file shows some partial code calling into the sample project. Little help there…

Continue reading

What is the fascination with Twitter?

August 2009

Ok, I know this isn't exactly breaking news. Twitter has been out there for a couple of years, but still many people don't know what Twitter is.

If you're one of them, have a look at this short video explaining Twitter. (Link in the article)

And even knowing what Twitter is, fewer understand the fascination with it. I think Twitter with its simplicity has several interresting aspects, and they are different for all of us.

Continue reading

Authenticating against Azure Table Storage

August 2009

When searching for articles/blogs/samples about using Azure Table Storage from .NET, it seems most of them (if not all) depend on the StorageClient sample in the Azure SDK. I read about authentication with SharedKey or SharedKeyLite, and I always found the magic of these authentication schemes were wrapped up into several layers of abstractions in this SDK sample.

Hoping that I could get at my data without it (the sample), I needed to research how to authenticate against Azure Table Storage. So how does it all work?

Continue reading

How to use Windows Azure table storage

August 2009

I found several great articles showing how to work with Windows Azure Table Storage:

  • Rob Bagby's Azure Application Part 2: Access Azure Table Storage
  • Jim Nakashima's Windows AzureWalkthrough: Table Storage
  • Video tutorials on Microsofts Azure developer portal

All these, however, assume that the table storage will be used from an Azure web or worker role. I wanted to see if the Windows Azure Table Store could be used with applications running elsewhere, like on your computer. I'm creating a console application here, but the code can be easily adapted to a WPF, Windows Forms or even an ASP.NET application too.

Continue reading

Traverse a hierarchical structure with LINQ-to-Hierarchical

July 2009

RecentIy I needed to find a specific TreeNode in a TreeView control.

I expected that would be easy with LINQ, but quickly realized that there is no method in the .NET framework that will let me traverse all nodes of a hierarchy.

I decided to create one myself.

Continue reading

Mythbusters: Unit-testing

July 2009

While I believe most or many developers have heard of JUnit/NUnit/<your testing framework here>, fewer know how to write a test and running it using such a framework. And from those, even fewer have a good understanding of how to make unit testing a part of the development workflow.

I've known about unit testing and unit test frameworks for maybe 7-8 years. I first tried using it in a small project 5-6 years ago, but it is only in the last few years that I've learned how to do it right. (ie. found a way that works for me and my team…)

For me some of the things learned were:

Continue reading

The trouble with delimited

June 2009

In this previous article articles about parsing files, I took a very simplistic approach to reading a delimited file. I used string.Split, which doesn't handle the use of quotes and usage of the delimiter character inside quotes.

Well, it turns out theres more to reading a delimited file than splitting at the delimiter…

Continue reading

More parsing textfiles with LINQ

March 2009

In a previous article, I described how to use LINQ when parsing a textfile.

Following that train of thoughts further, I found a more elegant way of splitting the lines from the file into columns.

Creating extension methods on top of IEnumerable<string> seems like a good idea! Something that could be used like this for a comma-separated file:

from columns in reader.AsEnumerable().AsDelimited(delimiter)
select ...

Continue reading

Parsing textfiles with LINQ (or LINQ-to-TextReader)

March 2009

Reading and parsing files is really no difficult task with the .NET framework. The System.IO namespace has several good classes to aid that task.

Continue reading