C# 4.0: Covariance and Contravariance

April 13th, 2009

In this article I’ll try to cover one of the C# 4.0 innovations. One of the new features is covariance and contravariance on type parameters that is now supported by generic delegates and generic interfaces. First let’s see what does these words mean :)

Generally if we have some entity (interface or delegate) that is generic on type T – some Entity<T>, and two concrete entities Entity<A> and Entity<B> where B inherits from A, then there are no inheritance relationships between Entity<A> and Entity<B>. Covariance (and contravariance) adds such relationships:

Read more…

.NET , , ,

Top 25 Programming Errors

January 18th, 2009

Have just reached a list of top 25 most dangerous programming errors that was released by cyber security experts a week ago. An important one, I think :) And with this list are provided resources and solutions to be used to eliminate these errors if they’re present. Also seems like this list is to be used for code certifications and for software testing tools. But first of all it should be used by us, developers :)

Here is the list: http://www.sans.org/top25errors

I hope, in 2020 all these errors will be studied only at programming history lessons :)

Misc ,

Parse Date from RSS to NSDate

December 26th, 2008

Today I’ll show how to parse date from RSS feed to NSDate in iPhone application.

When processing several RSS feeds, it is usual task to arrange and sort them by date. Therefore text representation of date need to be transformed to NSDate.

My googling of solutions for this issue resulted in use of [NSCalendarDate dateWithNaturalLanguageString:string] function. As I wrote before, NSCalendarDate is not supported under iPhone OS, so this way lacks.

Another way is to parse date via NSDateFormatter, but I didn’t find any full solution. So let’s write it :)

Read more…

iPhone , ,

Apple Mac Tini

December 26th, 2008

Funny joke about Apple products :)

Misc , ,

iPhone Simulator Looks Confusing

December 24th, 2008

A week ago I found some annoying thing about iPhone OS and iPhone simulator. As a result you cannot be really sure that application that works great on simulator whould even be compiled for device.

Unpretty thing that I found is that NSCalendarDate and NSURLDownload classes are not supported on iPhone OS. But they are do supported on simulator! Code is not compiled in device mode with error that class is unknown. Seems to be a simulator bug :(

Please, be careful, and do not use NSCalendarDate and NSURLDownload. Also test your application on a device regularly. If you do not have a device, just build your app (Cmd-B) in device mode, to be sure it is successfully compiled.

iPhone , , ,

Cocoa Memory Management – Simple Rules

December 23rd, 2008

Few month ago I started to develop iPhone application for a new customer. Having a lot of .NET experience before (and no Objective-C experience), I was discouraged with absence of garbage collector. Yep, garbage collection is unfortunately not supported under iPhone OS, it is supported only under Mac OS X. Dealing with manual memory allocation/deallocation, releasing/retaining/autoreleasing took time in researches until I’ve reached a good article at stepwise.com. In a bit of information are described common memory management rules and common mistakes. Here it is:

Very simple rules for memory management in Cocoa

For more information please use Apple document Memory Management Programming Guide for Cocoa.

iPhone , , ,

Hello! :)

December 22nd, 2008

Hi, everybody!

I decided to start my own blog :) The reason why is because on my latest project I was need to search answers to my questions over the internet, and many answers were found in blogs. So, I thought, it is a goog idea to share my own knowledge and experience with whole world IT community.

So let’s start and I hope somebody finds my posts helpful :)

Misc ,