Archive for July, 2008

Mono? Thank you, not anytime soon…

Thursday, July 24th, 2008

Today, I was playing a little with .NET implementation Mono on OS X. Respectively, I was playing with Monodevelop IDE because as I do now something in Visual Basic.net at work, I was curious how can this compare to the real Visual Basic 2005. I was hoping at least to get running some parts that interact just with command line. And, well, my expectations were way too high. I didn’t do anything. I was not even able to open the files properly. The editor was not apparently able to accept the windows line encoding. Compiler threw some strange errors on things that even didn’t look they are in our code. What else to say? Do not waste people’s time with releasing software that is your toy, and actually doesn’t work. It’s not worth. You waste time of the others, and your name doesn’t gain anything.


The Visual Basic editor when I tried to open a normal VB file

JavaScript absolute position of element

Wednesday, July 23rd, 2008

There is always a problem how to get an absolute position of HTML element in the web page. There is no direct property how to compute the X and Y coordinations of the top left corner of the element  to the top left corner of the web page. You must use a function like the next one.

function getAbsoluteLeftOffset(el)
{
  var ret = 0;
  while(el.offsetParent) {
    ret += el.offsetLeft;
    el = el.offsetParent;
  }

  return ret;
}

This code uses the offsetParent property of the HTML element, which returns the parent from which the current element differs in the X and Y coordinations. This is not necessarily the parent element, you might skip some of them. Hope it helps.

I hate End key on Macs

Wednesday, July 9th, 2008

I have a big problem with end key on Mac. In every application it behaves differently. Why is the situation like that? I don’t know. Some applications scroll to the end of document, some text editors move the caret to the very last position of the editor, some text editors move the caret to the end of line. Who should know what the current application does? But this is only a part of the problem.

The Apple Human Interface Guidelines document mentions that the end key should scroll to the end of document. This sounds ok as long as you don’t mention text editors. In such a case I am not in favour of this at all. I would like to change it to move to the end of line. Reason? How many times do you want to scroll to the end of file, and how many times do you want to move the caret to the end of line? My rate would be something like 0:100. Yes, no need to scroll somewhere to the end of the document at all! If I need to do something at the end of the document, I would use Cmd+Page Down to move the caret there.

This end key behaviour is very hostile to all people who work with text a lot (read developers). And it’s not only the End key, but also Home key, Page Up, Page Down. We need to move around very quick, and we don’t want to touch mouse when we need to change something somewhere! This idea of just scrolling is nice as long as the control doesn’t contain any selection or caret. In such a situation, it’s unusable.

Another example are lists. You can think as an example Adium’s contact list. I have many contacts there. 4 screens in my case. When I would like to write some my friend, I need to either type his name, or I can scroll around with Page Down/Up, and then select him by mouse, and then start writing. I would like to keep my hands on the keyboard, and not to lift them to the mouse. Again moving with the selection would be so much better.

So what to say at the end? This time Mac is the looser, because sadly Windows is better in this case.

Why is xml schema so restrictive?

Friday, July 4th, 2008

In one of our recent projects we have to deal with xml files that are not 100% correct. We process train tracks schematic plans that are defined in xml. The xml is generated from a database, and the database data are not clean. So don’t always get correct XML. I mean the structure is ok, but the data are not always valid. For example you can have turnout with reference to an invalid track. Also the turnout can have an invalid string or an empty string as a track number.

What bothers me the most is the second case when there is invalid input. Good structure, but instead of number, there is some random text. I validate such things in the xml manually in the code, but it is not nice at all. I also created the xml schema validator, but it doesn’t help much. The xml schemas work in the way everything correct or nothing is correct.

This approach doesn’t make people happy every time. I would like to have some controlled way of reporting warnings and errors, and failing only on error. Have you ever seen anything like that? Some xml validator that is less than strict, that produces warnings. Something that produces a warning on the next fragment:

<track id="11" length="" />

which should be this:

<track id="11" length="25" />

this would produce an error, or a warning, so we know that some part does not have valid data, but continues processing the xml file. That would help a lot with XML processing.

Really the first one

Tuesday, July 1st, 2008

Have you ever have an idea to do something new? Something what you don’t do often. Just at a special occasion. Something, something like start a new blog. Well, to be honest, this is not a really new blog, but rather a reset. The reset was not caused by me, but let’s explain it a little closer what happened with my old blog, and why did I do a complete reset.

So start at the beginning. I hate DNS registrars. I explain why in a minute. Some three years ago I got a birthday present from a friend - Brendon. My own domain. Such a great idea! I wouldn’t thought up something like that. I am still thankful what he did. But as usually, not everything was thought up to the detail. The domain was registered by Brendon, and thus he was the owner of the domain. The domain was register at some anonymous provider on internet. Price was apparently the main reason of choice, why not. During the years we tried several times to ask them to provide some way to migrate the domain to my DNS registrar (www.domena.cz) on my person. But all these attempts failed. Reason one was the inability of the original registrar to answer our emails. Also there was no AUTH-ID record available for us for the domain transfer. Maybe some other things were involved like our laziness to care about the things that do not matter that much, and also by the common property of everyone of us that we normally keep the things up to the last moment. Anyway, it happened, and now there is a new beginning.

So at the end I decided to expire the domain, and then perhaps claim it again. Wish me good luck that the registrar is not such an asshole, so he keeps the domain, and no other bad people won’t get the old domain. I know that after this reset it is useless, but to me it is like part of my personality which I wouldn’t like to loose.

Now about the reset. I thought it would be a good new start to make something new from the scratch. Like a new beginning. I think that the content should be lost, there was not much of great importance, and I hope that there would be some more.

Anyway, I have one more photoblog at address http://www.martinnovak.eu - Martin is not in Madrid where I put randomly pictures I shoot.

And one more thing at the end - what this will be all about? Programming and technology. Dot.