LessThanDot Site Logo

LessThanDot

A decade of helpful technical content

This is an archive of the posts published to LessThanDot from 2008 to 2018, over a decade of useful content. While we're no longer adding new content, we still receive a lot of visitors and wanted to make sure the content didn't disappear forever.

A quick look at Windows Phone 7 development

Today I decided to take a look at Windows Phone 7 development. The first thing I did was download the Windows Phone Developer Tools, you can download it here: http://www.microsoft.com/express/phone/ Windows Phone Developer Tools includes: Visual Studio 2010 Express for Windows Phone Windows Phone Emulator Silverlight for Windows Phone XNA Game Studio 4.0 CTP The download was 228 MB for me, I already had Visual Studio 2008 and Visual Studio 2010 RC on my machine, if you don’t have those, the download might be bigger.

Read More...

Silverlight Spinner

Introduction

Every week in my shop we do cross training. Someone brings in something they are working on, some system that people are unfamiliar with, some new technology, basically anything related to any of our jobs as developers and maintainers of applications. Often enough I do presentations on Silverlight and Blend, introducing my coworkers to different tools and options that we have available to us. This blog is a write up of one such training presentation. I give you, the Silverlight Spinner.

Read More...

IT: Beyond the 'Right Now' Problem

In an IT department there is a tendency to classify operations as being reactive or proactive and, often, pressure to have more of the latter and less of the former. Pressure, that is, until a PC breaks down, a network connection drops, a data record goes missing, or any of a dozen other issues which will ultimately receive more attention than disaster recovery, employee development, business analysis, strategic planning and the rest of a long list of proactive tasks.

Read More...

Phone Number Primitive

I don’t know how many times I’ve put together the same slow regexp to check if the user input is a valid phone number. I decided that this cannot go on and developed a simple phone number primitive. Now our main concern here is the performance of TryParse since it will be used the most. After running some performance tests the median timing was 400ns on a 3Ghz machine. [Serializable] public struct PhoneNumber : IEquatable<PhoneNumber> { private const int AreaCodeShift = 54; private const int CentralOfficeCodeShift = 44; private const int SubscriberNumberShift = 30; private const int CentralOfficeCodeMask = 0x000003FF; private const int SubscriberNumberMask = 0x00003FFF; private const int ExtensionMask = 0x3FFFFFFF; private readonly ulong value; public int AreaCode { get { return UnmaskAreaCode(value); } } public int CentralOfficeCode { get { return UnmaskCentralOfficeCode(value); } } public int SubscriberNumber { get { return UnmaskSubscriberNumber(value); } } public int Extension { get { return UnmaskExtension(value); } } public PhoneNumber(ulong value) : this(UnmaskAreaCode(value), UnmaskCentralOfficeCode(value), UnmaskSubscriberNumber(value), UnmaskExtension(value), true) { } public PhoneNumber(int areaCode, int centralOfficeCode, int subscriberNumber) : this(areaCode, centralOfficeCode, subscriberNumber, 0, true) { } public PhoneNumber(int areaCode, int centralOfficeCode, int subscriberNumber, int extension) : this(areaCode, centralOfficeCode, subscriberNumber, extension, true) { } private PhoneNumber(int areaCode, int centralOfficeCode, int subscriberNumber, int extension, bool throwException) { value = 0; if (areaCode < 200 || areaCode > 989) { if (!

Read More...

Internet Explorer 9 available for a test drive

Internet Explorer 9 is available for a test drive Microsoft detailed its support for a number of HTML5 specifications, including CSS3, Scalable Vector Graphics (SVG), XHTML parsing, and the video and audio tags using industry-standard (H.264/MPEG4 and MP3/AAC) codecs, among others. In addition, Microsoft demonstrated a new JavaScript engine that uses the multiple cores of today’s modern chips to effectively manage computing resources and improve Web performance. By combining increased interoperability with a new JavaScript engine and Direct 2D technology, Internet Explorer 9 enables Web developers to provide users with richer experiences that render more quickly and consistently.

Read More...

Use the right collection part 2

Yesterday I made a post about using a queue instead of a list because the code was so much cleaner. I think it is very important that code is clean and easier to read. But then Denis asked about the performance differences between the 2 methods. I hadn’t worried about the performance, because in my case the performance was good in both cases. But I aim to please my fellow LTDers, so I did a little performance test.

Read More...

Use the right collection

I was doing this in my code. vbnet Private _Lines As New Collections.Specialized.StringCollection Private Const _MaxLines As Int16 = 30 Private Sub SetMessages(ByVal message As String) If _Lines.Count &gt; _MaxLines Then _Lines.RemoveAt(_MaxLines - 1) End If _Lines.Add(DateTime.Now.ToString("HH:mm:ss") & " - " & message & Environment.NewLine) Dim text As New System.Text.StringBuilder For _temp As Integer = _Lines.Count - 1 To 0 Step -1 text.Append(_Lines(_temp)) Next Me.txtMessages.Text = text.ToString End Sub Look Mama, I made a queue.

Read More...

Visual Studio 2010 Concurrency Profiling And Parallel Programming

Visual Studio 2010 and .NET 4.0 are almost released, one of the new things that ship with this release is Parallel Programming. Since you can’t buy a machine anymore with just one core it is time that we developers get intimate with concurrent programming. I decided to play around with this a little today, this is not a real technical post, I mostly show you how you can get started and what new tools are available.

Read More...

Lazy Coding?

Are you waiting for .NET 4.0 to take advantage of lazy initialization? Now you don’t have to. The question you need to ask yourself is why haven’t I already made this myself? Aren’t we all a little lazy? /// <summary> /// Provides support for lazy initialization. /// </summary> /// <typeparam name="T">Specifies the type of object that is being lazily initialized.</typeparam> public sealed class Lazy<T> { private readonly Func<T> createValue; private volatile bool isValueCreated; private T value; /// <summary> /// Gets the lazily initialized value of the current Lazy{T} instance.

Read More...

ASP.NET MVC 2 RTM for Visual Studio 2008 SP1 Released

Microsoft has released ASP.NET MVC 2 RTM for Visual Studio 2008 SP1. Note Because Visual Studio 2008 and Visual Studio 2010 RC share a component of ASP.NET MVC 2, installing the ASP.NET MVC 2 RTM release on a computer where Visual Studio 2010 RC is also installed is not supported. New Features in ASP.NET MVC 2 RTM The following features are new since the RC release of ASP.NET MVC 2.

Read More...