Jan
27
2012
Lambda Expressions are very powerful when it comes to filtering sets. There are built in methods such as Where() or FindAll() available for most collections in C#. These methods use Lambda Expressions for filtering. I have listed a few examples below.
Find evens in a list of positive integers
List numbers = Enumerable.Range(1, 100).ToList();
var evens = numbers.FindAll(n => n % 2 == 0);
Find primes in a list of positive integers
List numbers = Enumerable.Range(1, 100).ToList();
for (int i = 2; i < 8; i++) {
numbers = numbers.Where( n => (n > 1) && ( (n == i) || (n % i > 0) ) ).ToList();
}
Although, it is probably not necessary to explain the expression above; prime numbers cannot be devided by 2, 3, 5, 7 and not equal to 1. Why doesn’t it matter that 4 and 6 are in the loop too? It is because 4 is a multiple of 2 and 6 is a multiple of 3. If a number is devisible by the multiple of a prime number then it must be devisible by the base prime too. Therefore anything that is devisible by 4 or 6 cannot be a prime.
Lambda Expressions can use Generic Delegates to ensure that the input, output is matching a given type. For instance, the expression below will return a compiler error because the inferred type is a double.
Func<double,double> giveMeDouble = (x) => x / 2;
int MyInt = giveMeDouble(1);
This short introduction is not even scratching the surface of what Expressions can do. If you want more information about Expressions check out ExpressionTrees on MSDN.
Related reading:
 | The Coding Manual for Qualitative Researchers Suitable for beginners and advanced researchers, The Coding Manual for Qualitative Researchers is unique in providing, in one volume, an in-depth guide to each of the multiple approaches available for coding qualitative data…. |
no comments | tags: coding | posted in Developer Help
Jun
21
2011
I have come across this eye opening article that sheds some light on the algorithm changes committed by Google over the years. It has encouraged me do a little research and think about the effects it might have on sites in the future. The article shows plausible evidence that Google is not reluctant to make fundamental changes to the way they are indexing documents on the web nor anxious about what this means to e-commerce companies in the world. Google has set a goal to serve their customers (the users) primarily with less regards to corporate entities whose role also is, or supposed to be, to serve them. The SEO community is divided about their methods, but we are all used to that being futile anyway…I mean having an opinion about it. Continue reading
Related reading:
no comments | tags: Google, SEO | posted in Developer Help
Apr
1
2011
“Then indecision brings its own delays, And days are lost lamenting o’er lost days. Are you in earnest? Seize this very minute; What you can do, or dream you can, begin it; Boldness has genius, power and magic in it.” – Johann Wolfgang von Goethe
I have been in this industry for nearly two decades now and I believe that I could tell a few stories about success and fall. There are many occurrences of both between endeavours of clients, employers, people I know and admittedly also some of my own. Looking back for a cause behind the imaginary scale leaning towards either side is somewhat simple if you don’t overdramatise the events leading up to the point of examination. Continue reading
Related reading:
no comments | tags: business, success | posted in worklife
Feb
2
2011
Beginner developers often get confused about which types should they use when they create tables or what difference it makes.
Well, there is a good reason for the existence of all types – or at least there was when they were invented. I will soon publish a new series of posts about SQL data types, however, in this post I will talk about the most commonly misunderstood types and what troubles they likely to cause.
I found string types to be the most troublesome, especially Char. First and foremost Char is a fixed length type, which means that the space for the length of the characters is reserved. Opposed to this VarChar (acronym for variable character) is a variable length type which could save a considerable amount of space in large databases in exchange for some speed*. Continue reading
Related reading:
no comments | tags: Data types, SQL Server | posted in Developer Help
Jan
11
2011
For me the New Year is always exciting - not only because for a short while I get to believe that I will actually keep my new years resolutions… Making new plans has the excitement of starting a new life, but more than that. In this case all the experience we collected in the previous years now become clear markers alongside the path we should walk in the new one.
Most of us are facing appraisals in January and on contrary to the common belief it is not primarily an opportunity for asking for a raise. I thing it is rather a good chance to think about subjects that we could brush up on and find new ones that we could learn over the coming year. But first and foremost learn about ourselves and think how we could become better people and more knowledgeable professionals. After all, what we worth not only depends on what we know but also how we think about ourselves and whether our colleagues, managers concur or oppose our views in the matter. Continue reading
Related reading:
no comments | tags: appraisals, wage negotiation | posted in worklife