Setting values by using reflection

Posted by Filip Ekberg on 10 Oct 2011

In all my latest posts regarding reflection all I've done is getting values and invoking methods and this can confuse you into thinking that when using reflection stuff is read only, but it's not. Just as we have GetValue we also have SetValue. [...]

Using reflection to get information about attributes on your class and properties

Posted by Filip Ekberg on 09 Oct 2011

In the previous post I focused on getting values from an instance and getting information about the class itself. In this post I want to focus on getting even more information about the class and the properties in it, I want to get information about the attributes that I using!

To get information about attributes either on a class or on a property you do this by invoking methods on the Attribute class, these methods are static so you won't need an instance of the Attribute class. [...]

What is reflection and why is it useful?

Posted by Filip Ekberg on 09 Oct 2011

Lately you've seen me use something called reflection, but what is reflection? If we look it up on MSDN we get a quite good answer, but to the untrained eye it might be a bit cryptic [...]

Exploring reflection - Finding a value in any of the objects properties

Posted by Filip Ekberg on 08 Oct 2011

I want to explore reflection by playing with both reflection, anonymous types and dynamically typed things all at once! My goal is not to be confusing or anything, but it is to leave out the parts that are redundant. [...]

Playing with anonymous types in C#

Posted by Filip Ekberg on 06 Oct 2011

In C# 3.0 something called anonymous types was introduced, this means that a certain context can have a type that is not defined anywhere except in that context. This has been seen a lot in LINQ-queries over the years. Here's an example of an anonymous type:

var person = new { Name = "Filip" };

[...]

Making code more readable with anonymous functions

Posted by Filip Ekberg on 05 Oct 2011

If you come from a world filled with JavaScript you might be used to seeing the click handler logic defined at the same place as where you defined the click handler itself. For instance, look at this code:

$("#submit").click(function(){
    performPostAndRedirect();
});

I think it's safe to say that this kind of code is very usual and that it's nothing wrong with it, in fact, it's easy to read and easy to understand and for me readability is something that is very important. [...]

Using dynamic in the real world with IronPython

Posted by Filip Ekberg on 04 Oct 2011

My last posts have been a lot about what you can do to explore the dynamic world in .NET and what it might be good for. But I think it's time for some real fun with dynamic!

So go ahead and fire up Visual Studio, see to it that you got NuGet installed, now let's get rocking! [...]

Invoke a dynamic object as if it were a method

Posted by Filip Ekberg on 03 Oct 2011

In my previous post I talked about how you can extend the DynamicObject so that you can override TryInvokeMember and TryGetMember. However, these are not the only methods that you can override. I wanted to take a brief moment and talk about one of the other methods that you can override as well, this being TryInvoke. [...]

Extend your objects with DynamicObject to get a dynamic experience

Posted by Filip Ekberg on 02 Oct 2011

If you have ever programmed in a dynamic programming language you know that you can pretty much ask for anything on any object, consider this code in any dynamic programming language: [...]

Adding properties and methods to an ExpandoObject, dynamically!

Posted by Filip Ekberg on 02 Oct 2011

Meanwhile I am planning and writing manuscript and code samples for my upcoming video series that will cover "Programming fundamentals using C#", I thought it was time for a short post on some dynamic programming in C#! [...]

Visual Studio 11 and Visual Studio 2010 Side by Side

Posted by Filip Ekberg on 19 Sep 2011

For those that don't want to install the Windows 8 Developer Preview on their workstation just to try out and develop applications in Visual Studio 11, I can happily say that Visual Studio 11 runs perfectly fine side by side Visual Studio 2010 on Windows 7! [...]

Generic Programming in C#

Posted by Filip Ekberg on 25 Jul 2011

This is my fourth screencast, talking about generic programming in C#. In this session I talk about how life was before we had Generics and then I talk about what generics solves for us. [...]

C# 4.0 Using the Dynamic Keyword

Posted by Filip Ekberg on 21 Jul 2011

This is my third screencast, talking about the dynamic keyword in C# 4.0. In this session I talk briefly about the dynamic keyword, where you might have seen it before and give some examples on how you can use it. I won't go in to depth on the DRL, ExpandoObject or when/when not to use the Dynamic Keyword, that's a whole other video. [...]

More C# screencasts on the way!

Posted by Filip Ekberg on 11 Jul 2011

It seems like the videos on C# 5 and the Async CTP were appreciated so I am working on some more screencasts. They will be a bit different than the Async CTP videos though. [...]

WPF vs WinForms - Which is easier to learn?

Posted by Filip Ekberg on 10 Jul 2011

This question originates from StackOverflow, but as I see there are a lot of beginners that ask this question, I wanted to share the answer on my blog as well. So, WPF vs WinForms - Which is easier to learn? [...]

C# 5 Async CTP - Old VS New - Video screencast

Posted by Filip Ekberg on 20 Jun 2011

This is my second screencast, talking about the C# 5 async ctp. In this session I show how you can refactor old code that is using the task parallel library or a background worker to run time consuming operations asynchronously.

I also touch the surface on what continuation is and how it has been acheived using TPL and how it makes life easier when using async and await. [...]

C# 5 Async CTP - Async in Action - Video screencast

Posted by Filip Ekberg on 11 Jun 2011

I recently recorded a screencast talking about the C# 5 Async CTP, keep in mind that this is my first screencast ever, so please give me your constructive comments. [...]

Over-engineering trivial tasks can be challenging and educating

Posted by Filip Ekberg on 01 Jun 2011

It's been almost six months since my last blog post here, it's not like I don't have anything to write, but the time I have over at the end of the day just doesn't end up so that I have time to write here. I'll try to get some more time to write here since I really do have a lot of interesting things that I want to share! [...]

Will rewriting my code to the newest hottest framework version be a productive step?

Posted by Filip Ekberg on 05 Dec 2010

This is by far the most asked question I've seen around the net besides the obvious questions like "How do you do X and why doesn't Y work?". There is a simple answer: If the code works and is patchable, we don't need to rewrite.

I've heard that line countless of times from both customers and PM:s when arguing about rewriting old systems and to be fair, it's not an invalid statement. Why should be re-build something when it is properly working? In my opinion there are a couple of reasons why you would need to consider rewriting code that is working. [...]

Displaying a loading indicator for UIWebView using UIActivityIndicatorView

Posted by Filip Ekberg on 01 Dec 2010

More and more apps today uses only the native application as a shell around their web-based application to get their app into App Store. A drawback with doing this is that you might get really annoying load times and you have to decide where to put the "wait for the data"-scene. [...]

A work around to the memory leaks in NSXMLParser

Posted by Filip Ekberg on 30 Nov 2010

Lately I've experimenting a bit with parsing XML in Objective-C and discovered something that I'd like to share with you all.

First of all, consider the following "standard" way of downloading an XML and parsing it [...]

Use Test Driven Development to verify that the code will Always work!

Posted by Filip Ekberg on 23 Apr 2010

After attending Scandinavian Developer Conference in Sweden 2010 and attending the talk from Roy Osherove ( http://osherove.com/ ) Test Driven Development ( TDD ) has been something that I have tried to focus a bit more on. [...]

Using Parallel Extensions in LINQ

Posted by Filip Ekberg on 25 Mar 2010

Once again, there was a little mistake in the last post I posted here which clearly didn't effect the result that much. But it is still worth mentioning again. The ^ was not meant to be XOR, I was clearly thinking of Math.Pow. [...]

Using the Parallel Extensions in .NET 4.0 with C#

Posted by Filip Ekberg on 24 Mar 2010

As .NET 4.0 will be released in a couple of weeks and the RC has been out for a while. It's about time that I write something about the new helpful features of .NET 4.0. One of these helpful things are the Parallel Extensions and Parallel helpers that allowes you to do parallel programming. [...]

Function pointers in C and Python and their possible usage

Posted by Filip Ekberg on 30 Nov 2009

Function pointers? you might ask yourself, well this little trick gets handy sometimes, I will provide an example of a practical use in a later post on the next euler solution. Might actually do it in C too just to prove that C is still neat. [...]

Solving the first euler problem

Posted by Filip Ekberg on 30 Nov 2009

So I've decided to start a new project, to solve as many euler problems as possible from http://projecteuler.net/, in Python! The task in hand is not only to solve them but to think outside the box and add new features to the code which might become suitable in the future, who knows. [...]

Communication issues when adapting outsourcing

Posted by Filip Ekberg on 14 Dec 2008

Background of Outsourcing

A first view

Let’s assume that you run a company, no matter if the company is big or small. Just imagine having to build a project where you know that your current staff either doesn’t have the right knowledge to solve this problem or the number of staff members is not sufficient. This is where your company will face a problem, either you hire some new personnel or you consider Outsourcing your project. In this text, we will talk only about outsourcing when it comes to information technology projects not any other work fields such as call centers etc. [...]

Polymorphism – A Practical Example

Posted by Filip Ekberg on 13 Nov 2008

Classes, inheritance and polymorphism can sometimes be somewhat hard to understand. So a practial example suits many well. Therefore this will be a tutorial where i will touch the areas of classes, pointers, inheritance and polymorphism.

[...]

Pointers & Double Pointers

Posted by Filip Ekberg on 11 Nov 2008

Definitions

First off, we need to clearify what a some of the expressions i will use mean. These are the following expressions:

Stack

Assuming that you know about a computer having RAM ( Random Access Memory ) which allows you to store information and have this accessable faster than you would on a secondary memory like a harddrive and/or cd-rom.

When a program is executed there is a part in the memory reserved for this application to use, this "space" is called the Stack; The stack is always the same size and it's not possible to change it's size on any way.

Heap

The Heap is also a "space" on your memory, actually it's all the memory not allocated as a stack. So when your stack is defined, everything else can be expressed as the Heap. [...]

Importance of good Architecture, Structure and Patterns

Posted by Filip Ekberg on 22 Aug 2008

Often when developing software such as websites, windows ( or any other operative system for that matter ) programs, the begining of the progress is quite simple; you have your ideas and may have some thoughts about how to implement everything. But what often is forgot when developing software is the importance of thinking ahead, thus, planning for a larger software that you have in mind. [...]