Blog

Subscribe to RSS feed here

Wow, oracle really hates java
Published 76 days, 11:06:17.041686 ago by RasmusToftdahlOlesen.

Just updated Java on a build server (we run Jenkins) and was greeted by this. Please note that the "Install" box is checked by default.

JavaUpdate.png

Does Larry Ellison from Oracle really hate Java that much that he want windows users to start thinking of Java the same way they think about Adobe Acrobat and QuickTime ?

Starting to use MoinMoin instead
Published 80 days, 11:06:17.041686 ago by RasmusToftdahlOlesen.

Hi!

I have just converted my page to use MoinMoin instead of my own system, i am sure that there is many things which have not been converted properly, but it works pretty much.

The reasons for choosing MoinMoin are many:

  • Best wiki-engine i have found so far
  • Expanding the list of developers to more people than just myself, developing blogging and wiki software does not really get my blood boiling.
  • I do not wish to reinvent the wheel, re-inventing the wheel is fun but not very productive.
  • The MoinMoin guys have a lot of plugins for different things.

  • Actively developed.
  • Powered by Python

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.

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 ;)

Unlocalize-and-survive
Published 533 days, 0:50:41.041686 ago by RasmusToftdahlOlesen.

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:

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.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.

Sharp-wishes-nameof
Published 746 days, 11:06:17.041686 ago by RasmusToftdahlOlesen.

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:

   1       ...
   2       private void object_PropertyChanged ( object sender, PropertyChangedEventArgs args )
   3       {
   4          if ( args.PropertyName == "NumberOfSamples" )
   5          {
   6             // Do stuff
   7          }
   8       }
   9       ...

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:

   1     public class MyClass
   2     {
   3        public class Properties
   4        {
   5           public const string NumberOfSamples = "NumberOfActualSamples";
   6        }

   1        private int m_numberOfSamples;
   2        public int NumberOfSamples
   3        {
   4           get
   5           {
   6              return m_numberOfSamples;
   7           }
   8           set
   9           {
  10              if ( m_numberOfSamples != value )
  11              {
  12                 m_numberOfSamples = value;

   1                 OnPropertyChanged ( Properties.NumberOfSamples );
   2              }
   3           }
   4        }
   5     }

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:

   1     :::csharp
   2     ...
   3     OnPropertyChanged ( nameof(NumberOfSamples) );
   4     ...

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:

  • Getting the complete name of an identifier (MyClass.NumberOfSamples), maybe something like fullnameof(...) could be introduced.

  • Complete name including namespace, not sure what this operator should be called, suggestions?

I am sure you can think of more.

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


Blog (last edited 2012-03-08 13:28:37 by RasmusToftdahlOlesen)