const correctness in C# (CSharp)

•28.February 2010 • Leave a Comment

One of the first things, what a C++ programmer is missing is the ability of passing objects as const. In good old C++ we used it most of the time to be sure that no one is going to change the passed object.

But what happened in C#? There is no built-in functionality, allowing us to do the same thing.
Anyway, we can use some tricks as a good workaround to reach the C++ feature.

Collections:
Passing of any collection instances can be protected by creating an own proxy for the desired collection type. For this purpose you have to define an interface, which contains only public getters and private setters.
This is an easy way of protecting the passed collection. But this is just the one side of the coin.

“Why?”

This modification protects just the collection but not it’s content. This means: First protect the collection and second protect the object inside the collection.

But how?

Class:
Instead of using the own class directly, define an interface and use this interface in your collection. Like above, the interface must have properties with private setters.

If you need some examples I would recommend you the article of Glenn Dawson.

Why you shouldn’t buy a Pioneer AVIC HD3 navigation…

•05.October 2009 • 2 Comments

I am a “lucky” owner of the navigation system AVIC-HD3 produced by the vendor Pioneer.

First of all, when I bought the device it was in its original package. That means: brand new, no damages, nothing to criticize. At first sight the device suggests quality, stability and a good  developed software, but after using it for a while I felt myself in a trap.

The only thing the device is good at is “good looking”. This good looking and animated user interface is the trap for the customer. Today, when I would have the opportunity to buy a new navigation system my one and only answer would be “TomTom”. Nothing else! But this is another topic,….

Well, back to the nice device AVIC-HD3. What is the reason to not buy any navigation system of the vendor Pioneer?

This device:

  • is not able to sync correctly
    • The minimum amount of time it needs for synchronizing is about  5-10 min. The worst case was: I reached my destination and it still tried to sync. And yes, the GPS signal quality was well!
    • The synchronizing algorithm the developers used makes me sometimes giggling, while driving to work. Instead of using the incoming GPS data for jumping to the correct location, the device “guesses” and “corrects” to the next possible street in the map. That’s a  kind of “trial and error” syncing 🙂
  • cannot store radio stations permanently
    • Hell yeah, the device can show me the current title of a song, playing on the radio. I am able to store that title, pressing 5 sec a button, but why can I not store the frequency of the radio station instead? Any cheap 10 years old radio can do that. But not such an expensive device? Why?
  • is not able to learn routes
    • In the configuration menu a setting called “learn route” exists. I wanted to be sure and read the manual. Yes, it was what I assumed. Before starting to drive I turned the feature on and before I drove back I turned it off. Normally it should prefer the new learned route for the way back home. I was not surprised, when I saw it preferring me the old, stupid way. I thought: “hmm, maybe it needs to learn every direction separately”. Stupid idea, but why not. I tried it with the same result. My conclusion is: It seems to be a dummy button, just for pressing and hoping.
  • has a really bad menu structure
    • Even an IT guy like me has problems while browsing the settings. Many important settings are hidden under sub-sub-sub-sub menus and are located not logically. Normally a well developed interface must provide an intuitive and simple usage.
  • cannot transfer MP3 files directly
    • The device can play MP3 files from CD but when you think about transferring them to the internal HDD. Good idea but no way! You have to burn your MP3 files as an AUDIO-CD and let the device rip it again into the internal HDD.
  • is too expensive for the less (not working) features it provides
  • cannot calculate an alternative route without using motorways
  • needs a Bug-fix, which is still not available

Finally, why should someone pay so much money for such a device? I made a mistake don’t do the same!

Maybe there are other AVIC-HD3 owners out there. You’re welcome to add your opinion regarding this device.

    Tired of having multiple bookmark collections?

    •26.September 2009 • Leave a Comment

    Many people out there have “multiple bookmark collections on multiple locations”.
    This can be annoying.

    While working at home you store your favorite bookmarks about news, computer stuff, politics or whatever on your home computer. At work you have a different collection with bookmarks, which may contain just work dependent stuff. Maybe you added a new bookmark at work about an article with interesting content but you had no time to read it. Now you want to access your new bookmark from anywhere, at any time you want.

    It’s rarely possible, not everybody has access to his data at work.

    But why would I write an article,
    when there is not a solution for that kind of problem 😉

    There is an interesting way out called “Xmarks”, formerly known as “Foxmarks”. You are able to use Xmarks on Windows, Linux or Mac OS with the well known web browsers like Firefox, Internet Explorer or Safari.

    After installing Xmarks you need to create a user account, to store your data on Xmarks data store.

    Now, some of you’ll say:
    “Oh no, I don’t want to share my private data” or
    “Hey this is a dumb idea. I don’t want to belong to the transparent society”.

    No problem!
    The solution is: Use your own data store.
    With Xmarks you are able to use an own FTP or WebDav server to store your bookmarks. On the figure below (german version), you can see the available settings to set an own server.

    Xmark alternative server settings

    Xmark alternative server settings

    Example solution:

    Let’s take the router FritzBox 7170, which is able to share mass storage devices over the network. Here I would prefer to use a 4GB USB flash drive, enable the access from outside and don’t forget to set the credential-settings. To make the access easier, I would prefer to use dynamic dns e.g. dyndns.com.

    Et voila, our problem is solved!
    Now you can access and update your bookmarks from anywhere and anytime you want.

    Sources:
    Xmarks