Frontpage

first-post

After being hacked because i apparently had an old MoinMoin installation i have now switched to statically generated pages using my own hand-coded python script.

Sony-Ericsson-Mini-Pro-Android-Phone-2011-10-11

  1. published 2011-10-11

My G502 finally gave up so i had to find a new phone (apparently life without a phone is impossible). I went with Sony Ericsson for the second time, a Mini Pro with Android 2.3.

The best thing is definitely the keyboard, i never got the hang of T9, now i can type at a pretty good speed and i do not dread writing text messages, i have tried both the Android virtual keyboard and the iPhone keyboard on friend's phones and i hate both. I am actually writing this on the phone right now.

{{{#!quote
I use Emacs! I want tactile feedback!
}}}

The phone is a bit big and heavy, and the battery drains too fast. But that seems to be a problem with all modern phones, they all suffer from iPhone envy.

The worst thing is all the crap-ware that Ericsson puts on the phone. Mcafee virus scanner, UEFA.com PopCon games to name just a few. All in trial versions of course.

If you could just remove this stuff i could accept it, but much of it is "burned in" and not removeable without root'ing your device. Actually the PopCon games thingy has a service running in the background on the phone at all times - no way to know what it is doing and what kind of data is is stealing.

I think this is a scary scenario, if our phones will now be as bloated as a windows pc when we buy them. And since there is no explanation about what the different programs do, it is impossible to know what they do unless you accept their license agreement thingy, and sometimes it is not even apparent after that. I am a fairly technical guy who should be capable of coping, but i can not imagine how "normal people" will feel when there are all sorts of crap-ware installed on the phone.

I would also like to see some ball-part-figure about how much money the companies are paying Sony Ericsson to put it on the phones, they have to decide whether to provide an inferior user experience and risk loosing future customers, or if they want to line their pockets right now.

But the keyboard is nice ;)


[Error: Macro 'Comments' doesn't exist]

[Error: Macro 'AddComment' doesn't exist]


CategoryBlog CategoryReview

Unlocalize-and-survive

  1. published 2010-12-03 10:15:36

Just a quick post to let you know about a new site i stumbled upon recently when i had to search the web for an exception message i got from a customer:

{{{#!quote
Ugyldigt højt erstatningstegn (0xDC48). Et højt erstatningstegn skal have en værdi fra området (0xD800 - 0xDBFF).
}}}

http://halfdans.net/images/blog/2010/Cheap ass hosting_thumb.JPG

If you do not understand danish you should still pay attention, because it might be you who have a danish customer who reports that the listed exception was thrown.

If you do understand danish you can try to decode the translated string (which is really hard), if you do not understand danish you are pretty much fucked.

This has been the state of affairs for many years on microsoft's platform, despite all their developers, developers, developers talk. I mean, how do you search for such a string?

Until now you were fucked, but i just found http://unlocalize.com which will translate your useless localised error message to the english equivalent, and now you can google for it!

It looks like it is completely machine generated, but who cares, it does exactly what it says.


CategoryBlog

Sharp-wishes-nameof

  1. published 2010-05-04

Sharp wishes: `nameof`

Hi again, after over half a year of silence i think i am finally ready to write something again. The thing is: i have been writing a lot of C# lately as part of my job.

When you work some years with a language you start to envision certain improvements to the langauge which would make your life much easier. I plan to write these findings here as i find the time to do so.

The first thing i wish to tackle is the "lack of" a nameof operator, this is actually something which is lacking in Java and C++ too, but i find that it is more needed in C# because you deal with a lot of strings there, not to say that it would not be a huge boon in any language.

What this new operator tries to tackle is a problem most C# developers have faced: you have a class with a number of properties, these properties can be updated which, in turn, makes the object instance emit a PropertyChanged event for that particular property.

The problem comes when you want to write code which reacts to this property change for a particular property:

{{{#!highlight csharp
...
private void object_PropertyChanged ( object sender, PropertyChangedEventArgs args )
{
if ( args.PropertyName == "NumberOfSamples" )
{
// Do stuff
}
}
...
}}}

This works ok at the beginning, but you are actually introducing dynamic/runtime programming into your statically compiled program. What happens if NumberOfSamples changes name to NumberOfActualSamples ? Your code will be broken but you will not see it on compile time, only on runtime.

Sometimes people, including myself, handle this by introducing an inner public class called Properties which contain several public const strings with the property names:

{{{#!highlight csharp
public class MyClass
{
public class Properties
{
public const string NumberOfSamples = "NumberOfActualSamples";
}
}}}

{{{#!highlight csharp
private int m_numberOfSamples;
public int NumberOfSamples
{
get
{
return m_numberOfSamples;
}
set
{
if ( m_numberOfSamples != value )
{
m_numberOfSamples = value;
}}}

{{{#!highlight csharp
OnPropertyChanged ( Properties.NumberOfSamples );
}
}
}
}
}}}

This is actually quite a nice way to write code, you even get the added benefit of being able to search your code for places where a particular property is used from inside visual studio by using the built-in "Find all references" command.

But please notice that this is a violation of the DRY (Don't Repeayt Yourself) principle, that all hackers hold so dear.

A further complication is that this does not work for interfaces where inner classes are not allowed.

So what to do?

My proposal is to add a "nameof" operator, which takes the name of an identifier and returns it's name as a string. The "OnPropertyChanged" part of the code above would then look like:

{{{#!highlight csharp
:::csharp
...
OnPropertyChanged ( nameof(NumberOfSamples) );
...
}}}

This syntax looks pretty easy to me, nameof works pretty much the same as typeof.

Of course you would have to make a few adjustments to be able to do things like:

I am sure you can think of more.

This is just a proposal, please report back with comments.


CategoryBlog CategorySharpWishes

Vaca-announcement

  1. published 2009-09-13

http://halfdans.net/images/vaca/update_in_progress.png

For a long time my primary animosity against windows has been the lack of a standard packaging system like on Linux, where keeping your system up to date is a simple process that does not require you to run 10 different programs with 10 different interfaces and rebooting 10 times.

In the past this has made my blood boil several times, two years ago it even got so bad i had to blog about it

Several months ago i created a program that will hopefully make this less painful in the future, and now i think it is time to tell the world.

You might have noticed the Vaca link on the top of this page which has been here for some months now too, it will lead you to my "repository" of Vaca sources.

Ok, let's back down a bit, what exactly is Vaca?

Well it is a simple "download and install program" which uses rss feeds to query when programs come in new versions. It simply downloads the newest version of a program's installer and executes it with the proper parameters to install without bothering you with the "next,next,next,next,finish" nonsense.

The reason for using Vaca is "obviously" to make it even easier for projects and bloggers to publish new versions of their software, they simple slap a vaca tag in their rss feed and Vaca will eat it all up.

Now, back to the Vaca link at the top of this page. It will lead you to a repository i keep of Vaca rss feeds (called sources). This is more a proof of concept than anything else, if Vaca takes off i know that i wont be happy with maintaining a list of thousands of software up-to-date. I don't scale well :)

I think that is enough talk, give it a whirl and tell me what you think. And if you start publishing any Vaca sources, incorporate Vaca in your product (please do!) or some other cool thing, please let me know!

If this gets enough leverage i will have to set up a bigger Vaca source site somewhere where admins will be able to edit the site without me having to be the weak link.

Happy Hacking!


CategoryBlog

WinNotify

  1. published 2009-04-13

http://halfdans.net/images/winnotify/winnotify.png
Today i found the time to create a small utility i have been needing for some time.

I use emacs's rcirc client to talk on irc and on Debian i use the libnotify library's notify-send command to notify me when someone talks to me, as described here.

So now i have created a windows utility to do this: WinNotify which is just a simple command line utility to make windows popup one of those balloon notification dealies.

I am sure it can be applied to other things - please do!


CategoryBlog