Geeks With Blogs
Mark Pearl February 2010 Entries
F# Immutability
I was reading a blog post by Chris Smith on F#. Firstly, a really good blog post and well worth a read if you are interested in learning the basics of F# as I am. The first thing that struck me about F# and Chris’s blog was his explanation that in F# there typically wasn’t such a thing as a variable – because of the immutability of the “value” holders. That doesn’t mean that we don’t get mutable value holders – they are available, but they need to be explicitly declared. Have a look at the F# code ......

Posted On Saturday, February 20, 2010 7:27 PM

C++ Visual Studio “Hello World”
Okay… so I know this is really simple stuff – but sometimes you just need a sample hello world. Here is the c++ version for VS2008. #include <iostream> using namespace std; int main() { cout << "Hello World" << endl; system("PAUSE"); return(0); } ......

Posted On Saturday, February 20, 2010 2:48 PM

Stacks in C++
A stack is a LIFO (last in first out) data structure. A stack has at least two basic method calls – push & pop. Push, “pushes” an item on the top of the stack. Pop, removes the top most item off the stack. Implementation of Stacks as Arrays Because all elements on a stack are of the same type, one can use an array to implement a stack. The first element in a stack would be the first element in the array, the second on the stack would be the second on the array, etc. Linked Implementation of Stacks ......

Posted On Saturday, February 20, 2010 2:41 PM

Recursion in C++
The process of solving a problem by reducing it into smaller versions of itself is called recursion. This problem solving technique can be a very powerful way to solve certain types of problems that would be very verbose and lengthy using other techniques such as an iterative approach. When implementing a recursive solution one usually has at least two cases: Base Case General Case For a function/method to be called recursive, it usually has a call to itself within its code in the general case, with ......

Posted On Saturday, February 20, 2010 1:19 PM

.Net Snippet Compiler
If you want to check some c# code on the fly without using VS So I was listening to Hanselminutes podcast show number 200 with Jon Skeet, and Job was speaking about how he answers most of his Stackoverflow questions in notepad. Scott said that he did something similar to Jon but that he used a program called SnippetCompiler that worked much like notepad, but with a compile button added to it so that he didn’t have to use the command line stuff. I tried it and it is really cool… so if you are looking ......

Posted On Saturday, February 20, 2010 11:18 AM

Linked Lists in C++
General Basically, a linked list is a collection of nodes. Each node in the list has two components – a components to store information about that node (i.e. data) and a component to store the next “linked” node. The last node in a linked list indicates that it does not have a “linked” node – usually by a null reference. The address of the first node is stored in a separate location, called the head or first. The code snippet below shows a basic structure of a node declaration in c++. struct nodeType ......

Posted On Saturday, February 20, 2010 11:02 AM

Pointers in C++
This is a basic review of Pointers in c++ There are 3 main categories of data types in c++, Simple Structured Pointer A one liner to describe a pointer is a variable whose content is a memory address - thus its name “pointer”. In essence a pointer “points” to another location in memory. Declaring a Pointer (Specifying Variable Name & Size) In the most simple case, a pointer “points” to where another variable value is stored in memory. In programming terms, if you were to think about memory as ......

Posted On Monday, February 15, 2010 9:37 PM

Would you pay for Microsoft Dev Days?
Since I got back into programming, I have really been a Microsoft fan boy - our company develops applications solely on the Microsoft stack and we have always felt “well” treated when attending Microsoft sponsored events. In 2008, I and a fellow employee attended our first TechEd, we were blown away with what we saw – we had no idea how behind we were – and since then we have been hooked at attending Microsoft events. So when at the end of 2009 Microsoft announced that for the first time it was planning ......

Posted On Tuesday, February 9, 2010 2:04 PM

Formatting Bound Data in WPF
It suddenly got a whole lot easier in 3.5 SP1 So, you are using WPF and getting all the goodness of binding to objects. You may have a decimal that you want to be displayed as a formatted currency, or a DateTime property that you want in a specific date format. Up to now, there were really two methods for achieving this. 1) Format the data in code as a string and instead of binding to the data, bind to the formatted string data. 2) Create a ValueConverter. So up to now I have always opted for method ......

Posted On Saturday, February 6, 2010 5:26 PM

Cause a breakpoint in VS2008 in Code


So I found an interesting code snippet for debugging. If you put the following code in your project, the compiler causes a breakpoint when it executes the line of code.


Posted On Saturday, February 6, 2010 4:22 PM

Great Little Tasks Tool on Steroids
Project Managers, To Do Lists Fans, this is something you got to look at! So I saw one of my clients using this really useful tool called ToDoList done by AbstractSpoon. I have been using it just for a day now and already I am impressed by how easy it is to configure. It allows you to have a hierarchal order of tasks, assigns costs per item, assign specific people to tasks, etc. All this in a simple but really easy to use interface. What’s even better is that it is free ......

Posted On Friday, February 5, 2010 4:09 AM

F# Hello World
An interesting paradigm So today I got to play around with F# for the very first time. I must admit, it was very different to what I am used to, but I am keen to learn more. Because I was using VS2008, before I could do anything in F# I needed to download and install the SDK. Once installed it was pretty easy getting started. I tried the following Hello World example. My thoughts on F# right now are not well formed. I can see the benefit of having a functional language in the .NET framework, but ......

Posted On Wednesday, February 3, 2010 4:33 AM

Auto Mapper
No more left-right code I was listening to a legacy Polymorphic Podcast and heard about a really great time saver called AutoMapper. AutoMapper uses a convention-based matching algorithm to match up source to destination values. It is extremely useful when you have a lot of “left-right code” and want to automate the passing of the values. For instance, assume you had two objects (e.g. of type stClient & Client), and you wanted to mass copy the values from the stClient object to the Client object. ......

Posted On Wednesday, February 3, 2010 3:08 AM

Copyright © MarkPearl | Powered by: