and has 0 comments
This is mostly a rant, but also it should help people trying to do this as well to stop trying until there is some sort of solution from the VLC side.

I was trying to see how a web cam can be streamed over the web using VLC, a software that otherwise am very satisfied with as a video player. Recently they did a 1.0.0 version, which is quite something for free software that comes from the Linux world; usually they are 0.8 something and with a lot of alpha-beta-zeta afterward. So, as I was saying, recently VLC jumped from the 0.9.x version to 1.0.0, with a much more user friendly user interface and (at least so it seems to me) less adaptability than before. What I mean is that, in extreme cases, it throws errors that previous versions were able to circumvent, like when using partial or damaged video files. Also, it crashes on some older videos as well and I am forced to use the ancient (but sturdy) mplayer.

Back to business, I read the comprehensive command line help file that is almost 250k long, found what I was looking for, then tried. No success. I really felt like an idiot, as it wouldn't work whatever I did. In the end I just gave up and tried to start the streaming from the GUI, not from the command line. IT WORKED! Copying the exact command line parameters that the GUI would generate did not work. Saving the WORKING streaming to a playlist and then loading the playlist DID NOT WORK.

Here I have to say two things: when I say that it worked, it means that I had to fight it to be able to stream what I wanted and not HOW I wanted. Basically, the streaming will not work AT ALL if transcoding is not activated, which I personally think it makes it unusable anyway.

So, bottom line is that if you are trying to use VLC 1.0 from the command line, you are pretty much screwed. At least the flag that I was interested in (--dshow-vdev) would not select my web cam if its life depended on it. And it sort of did. Not likely I will use VLC in my business application.

I've even tried to go to one of those old style PHP forums that they have on the Videolan site. I waited for half an hour to receive the registration email and at that time I had given up completely. They had like 60.000 messages on the forums anyway and I doubt I would have gotten a reply any more intelligent than the usual RTFM. Yeah, I know, I sound very Linux unfriendly, but actually I am not, I've worked on Linux quite some time. What I am not friendly towards are the borderline psychotic assholes that only answer when they have nothing to actually say to help.

I believe this is something that any decent WPF programmer will laugh about, but there it is: I had this control derived from ContentControl and, of course, somewhere in the template I had a ContentPresenter. It all worked very well until I added a resizable option. I had two of these controls on the page, the first would contain a Grid, the other an ItemsControl. When I resized vertically the control, the ItemsControl would remain unchanged whether I made the height bigger or smaller. The Grid, though, would remain the same if enlarging the container and then squash when the size of the container got smaller than its auto size.

I have to say that I think my solution is really silly, but since it works: I've put a ScrollViewer control around the ContentPresenter in the my control template and then set its VerticalScrollBarVisibility to Hidden. This more or less is the same thing as setting overflow:hidden on the web.

Short (but true) story: I was compiling this solution with a lot of projects in it. And one of these projects had some post-build events set to run which copied the resulting dll in an Assemblies folder. Only it failed.

On building the project I was getting an error: The command "[Complete command]" exited with code 1.

What was weird about it is that if I copied the command in a batch file and ran it, it would work perfectly. After trying a zillion things I've stumbled upon the condition of build events Run the post-build event: which was set to On successful build. I set it to Always and voila, it worked.

But I still needed to know what was going on, especially since it would make no sense to run the copy command if the build has failed. So I switched it back to On successful build. Surprize! It also worked.

Therefore, the silly solution for a problem that doesn't make much sense is to switch to always run the build events, build successfully, then switch back and build again. Fun!

and has 0 comments

The fourth book by Alastair Reynolds that I've read recently, also set in the Revelation Space world, Absolution Gap follows the adventures of the ship Nostalgia for Infinity as it flees the "culling" of the Delta Pavonis star system by the swarm like machines called the Inhibitors. There is no purpose in reading the book without the others, as the story starts where it had left and continues to a more or less open ending.

This felt like the best book so far, however the enjoyment that I got from it had its very brutal ups and downs. While the beginning starts with full force and made me want to not let go of the book until I finish it, there was a side story that seemed not to have any connection with the main arc. When they finally met, they left me with that "What the fuck?" feeling. The ending was a jiggly up and down ranging from very cool and completely dumb. Not that the writing style faltered, but the behaviour of some of the characters really annoyed the crap out of me.

I would have to say that the ending was the most anticlimactic of all the books in the series, but the book is definitely the best yet.

Usually this happends in IE, but it may happen in a various other situations, given that Internet Explorer is famously bad, but also has to fight with all the backward compatibility and that new "innovative" browsers are on the way.

Let me make this easy: if it's a weird sixteen pixels difference (or somewhere around 16) then you probably are in one of these situations:
  • scrollbars - that you may not see, but they are there. I've just met this issue with a table of 100 percent width placed in a div of 100 percent width and it happened in IE8!
  • line-height - this is usually with Internet Explorer 6 or less, divs that are 16px in height when they have no content and have a specified lower height
  • font-size - also something from the older browsers

and has 0 comments
Nothing interesting to say myself, so I am linking to random blog posts :) Here is one that describes 31 types of refactoring, with examples and everything:

31 Days of Refactoring.

and has 0 comments
Count Zero is the middle volume of the Sprawl trilogy written by William Gibson, which includes Neuromancer, Count Zero, and Mona Lisa Overdrive, all of them very good books and set in the same universe as the short stories Johnny Mnemonic, New Rose Hotel and Burning Chrome.

I had read this book when I was a child and I loved it a lot. Circumstances moved me towards reading it again and I am glad they did. In my youth I had barely understood it and I can't say I did a lot better now either; that's because Gibson is one of the mature writers, writing for the mind and heart of adults.

Count Zero in particular, it felt like something one must feel through bones, must sip the content like a good coffee and digest the content with one's soul. Alas, I am not that kind of a guy, so I read it fast in the subway while going to work, in big gulps, like the glutton I am. I highly recommend the former approach ;)

The plot itself is like a high tech detective story, but it is almost irrelevant. Gibson has such a clear and powerful vision of the future, that it subjugates all of its characters to it and makes it, the future, the main character. Many things are not said, but left to be understood, like the reasons while the world is the way it is and why people act the way they do. Read Count Zero, even if you are not a sci-fi reader, because beyond the storyline there are layers upon layers of worldliness and it is a great book.

I had this expand/collapse div on which I was using slideToggle to make it look good. However, in quirks mode (HTML Transitional 4.01 DocType) and on IE7 the div would briefly pop up after collapsing, showing an annoying flicker. It seems that Internet Explorer has a problem rendering stuff with height 0px.

The solution I found: replace target.slideUp(speed,callBack) with
var h = target.height();
var cssHeight=target.css('height');
target.animate(
{ height: '1px' }, speed, function() {
target.hide();
target.height(h);
target.css('height',cssHeight);
callBack();
}
);
I have also created a jQuery ticket to suggest they use the same method in the library itself.

Update 1 Sep 2009: I have added the cssHeight variable to restore the actual css height settings, not just the height.

Update 21 May 2011: commenter Mads shared a more elegant solution in the form of this script:
(function(){
// Define overriding method.
jQuery.fx.prototype.hide = function(){

// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;

// Begin the animation
this.custom(this.cur(), 1);
}
})();
used anywhere after the jQuery include. Thanks, man!

and has 0 comments

It wasn't a very memorable trip, but I had to write this because of the Bohemi hotel in Arbanasi, which must most certainly be avoided. And it was, overall, a nice holiday. But let me take it from the beginning.

We took the car starting up from Bucharest and went towards Veliko Tarnovo. We passed through Basarbovo, to visit the rock monastery there. Very nice place, if you like churches. They have these small rock dug rooms where priests used to live and pray and then the monastery which was in renovation when we came there, but had a very lovely garden.

We then moved towards Cherven, where we visited the castle dig which is archaeologically active. It is a large XIV century Christian fortress, where one can see how people lived in the day: small one room living quarters and then a gazillion churches, large and small, then some administrative buildings and some defence walls and watch towers. There are about 200 stair steps to reach the castle from where the car road ends.

Next was Ivanovo. Some other rock monasteries, but everything set inside a natural reserve, a very beautiful place.

Then we went towards Arbanasi, a touristic area where there are a lot of hotels and where we arranged for accomodations. The hotel we chose was a three star hotel called Bohemi, boasting internet, minibars, outdoor oven, breakfast, etc, depending on the tourist site you search for it. Let me tell you how it really is: it's a two star hotel with smelly rooms, no parking, invaded by insects and spiders (and a scorpion which scared the craop out of my wife), no internet, no minibars, with a breakfast as the ones from the communist era: some bread and butter and jam and some salami/cheese slices. The hotel itself is one of many owned by the same people, so the person serving there is only an employee, put there to mind the place. In the room, after we got used with the stale odor of moist walls, we noticed that we has not enough sheets and two out of four light bulbs were not functioning. Really, I can't stress enough: 35 euros per night?! In times of economic crisis and with this kind of service? Avoid!

Arbanasi itself is not a bad place to stay, eat, sleep, and then back again. It would have killed me with boredom if I didn't have a car. They have a monastery there, but by then I got tired of any type of religious building. The restaurants where very nice, but service was consistently bad. I haven't seen dumber waiters in quite a while.

Veliko Tarnovo is a large city, once the capital of the second Bulgarian empire.

The stronghold there is a very nice place, where they don't allow sale people and where people can see theater and sound/light shows in the evening. Very large, beautiful and accomodating. Then there are some monuments and some nice streets.
The city itself is pretty cool. Lots of churches, of course :) I am sure that, being with my parents, I missed a lot of the hidden beauty of the town, but it was nice nonetheless.





That was about it. Take the links to get more information. My general opinion of Bulgaria is that it is a nice country, beatiful and wild, but rather poor. All the small towns and villages we passed through looked half abandoned, with many disaffected buildings and very few people. The economic crisis must have hit them pretty hard, too.

and has 0 comments
As I was saying in the last posts about the Revelation Space books by Alastair Reynolds, the guy has a problem with his own personality bleeding into the one of his characters. However, as the second book was better than the first, so the third one, Redemption Ark, seemed to be better than the second. It may be because now the main focus is on the Conjoiners, the fabled human faction that gave the star drives, facing the threat of the Inhibitors. Also, a very promising explanation of where they got the idea from in the first place.

We are seeing a lot of old characters from the previous books in this third installment, which bothered me a little because they weren't really needed, but it's not too annoying. Also, some of the awesome technological feats in the book are only partially explained and sometimes even completely ignored and left to a vague description, like "distant lights" when referring to a Hell weapons vs Inhibitors battle. But the focus, as always, was more on the human interaction than on the technical part, although there was blessingly more tech than in the first two books.

Since I've finished the book while away from home, I started reading another book, not the fourth in the series, so you will probably have to wait a while longer before I review that, but rest assured, I fully intend to read the entire saga.

The problem: you create an abstract class that inherits from something that can be designed in Visual Studio, like Form. Then you inherit another class from this abstract one. And when you get into the Visual Studio designer you see a nice colorful error message: The designer must create an instance of type 'bla bla bla' but it cannot because the type is declared as abstract.

The solution is detailed in a post of Brian Pepin: use the TypeDescriptionProviderAttribute decoration on the abstract class in order to tell .Net (thus to Visual Studio) what concrete type to declare and instantiate should the need arise.

Update: Brian's article is no longer available. I will update the link as soon as possible. Meanwhile, try this article from Microsoft.

Update: I have found the original article somewhere else and relinked it. Also, check out the fourth comment on this entry, where TrevDev links to a Microsoft Connect bug on the TypeDescriptorAttribute which suggests the attribute is not used correctly. That probably explains why people on VS2008 have problems, while the solution works on VS2005.

Now, all you have to do is read the post in question, with one reserve. The blog entry (and some other pages I have found on the net) say that this only works for Whidbey (VS2005), but I am using VS2008 and it worked just as well. However, for a second opinion try this CodeProject article that uses a little conditional compiling trick to switch from abstract classes with abstract methods and properties to normal classes with not implemented classes and methods based on debug/release modes. I kind of dislike the approach, mostly because it needs more effort to implement it, but it could help people that have this problem and maybe use some other IDE other than VS2005 or VS2008.

and has 2 comments
Avatar is one of those animation series that you read about and think they're crap. I mean, first of all they are not Japanese :), they are actually US. And then they are shown on Nickelodeon and then they are about and for kids. I must be honest when I tell you that I accidentally heard about the series and I had no great hopes for it. However, as it turned out, it is a great show, one to be watched and enjoyed.

The show is mostly inspired from Chinese mythology, with Western and Indian bits thrown in when required. The world is separated into four nations. The people of each nation can control in various degrees a specific element magic: air, water, earth or fire. Unlike say, Naruto, there are no people that can control or mix more than one magic type, except a special and unique person, the Avatar. The Avatar has the job of protecting the world and, if killed, reincarnates into another person. The last Avatar, though, dissapeared a century before the show starts and no one has heard of him or any of its reincarnations. Meanwhile, the evil Fire Lord has started a war to conquer the world and he is about to succeed.

Well, you can see where this is going, right? The Avatar comes back, he is a goofy kid, and in the end he saves the world together with his friends. However, the animation, the stories and the teachings in this show are all high value and, for once, something a kid can see, enjoy, understand and USE in the real world. Well, all except the magic part :)

What is also great about the series is that it is not a work in progress. It did not end because the ratings went down or the economic crisis hit or whatever and it has very few filler episodes. It was a long consistent script that span three seasons of 20 episodes each and then ended with no significant loose ends.

In other words, this is one of those rare American shows that can rival the best Japanese anime series. Even my wife enjoyed watching it (well, most of the time).

and has 0 comments
Chasm City is the second book from the Revelation Space series written by Alastair Reynolds. It is set in the same universe, give a few hundred years, and it felt to me as a better, more mature book than Revelation Space. However, truth be told, the ending had the same flaw: the personality of the author bled through all the characters, transforming them into a do-good Scooby Doo gang, eager to solve mysteries and help people. Sorry, Mr. Reynolds, you're just too nice of a person! :)

Anyway, this time the plot revolves around issues of personal goals and identity, the very definition of a persona and of quality of life. While the story is intricate enough to make it a great book, I thought many of the concepts in it were very interesting, but insufficiently explored. Then again, explore any concept long enough and you never get to the other end, so at least having a complete coherent story that spans the entire plot is a big plus.

I just started Redemption Ark, the third book, which (finally! :) ) deals with the Conjoiners and a technologically advanced alien race. Or at least it starts that way. Happy reading!

I have this very precise requirement I am working on: a collapsable panel that has rounded corners of fixed size and a background image or a gradient, both needed to stretch with the panel, which would be vertically resizable by javascript. Also, the HTML 4.01 Transitional DocType will be used on pages. The only respite given is that the solution should work only on Internet Explorer.

I have first tried some jQuery alternatives, but I am not happy with them. Even if the rounded corners would have been what I was looking for (and they were not), the background stretching is a difficult feat to master in HTML. Even so I have cropped up something that takes the entire content of the panel and relatively positions it over an absolutely positioned image that is then stretched by javascript to its needed dimensions. However, all this relative and absolute positioning requires a lot of event driven javascript (when the events themselves are not really there, so I must also create new browser events!) and it has been shown to break either layout or functionality like the one for collapse.

Enter VML, an obscure web technology from Microsoft that has a RoundRect object that can have a fill of an image OR a gradient, stretched to the full size of the element. Can you see it? I was already planning the blog entry, detailing the masterful ASP.Net control that would change the world of web development forever.

Back to real life now. First of all, the RoundRect element does have an arcSize property that determines the percentual size of the rounded rectangle. By percentual, I mean that resizing the element would lead to larger corners. I don't need that. Another nice surprize was that I can't either read or write the arcSize property from Javascript, it throws an error. People have complained about it before and their solution was to disconnect the element from the DOM, change the arcSize, then add it back into the DOM. It didn't work for me.

After wasting about half a day with this, I concluded that the RoundRect was a lost cause. Enter Shape! A Shape is a VML element that can take any shape determined by a path. The path has interesting primitives like qx and qy which mean "draw an arc to this position". It appears that a Shape can easily take the place of the RoundRect. What was even nicer, the path attribute could be changed at will by javascript.
<v:shape strokecolor="blue" strokeweight="1" coordorigin="0 0" coordsize="203 103" style="width:200px;height:100px"
path="m 2,0 l 198,0 qx 200,2 l 200,98 qy 198,100 l 2,100 qx 0,98 l 0,2 qy 2,0 e"></v:shape>
The code above is a 2 pixel rounded corner rectangle of size 200 by 100. To add a stretched background image or gradient, a v:fill element must be added as a child of the shape and you are done!

I was extatic, finally having solved the problem that had haunted me for days, until I noticed that, unless I specify the width in pixels, the shape would behave really strange. I was commited not only to a panel that needed to be defined as percentual or expanding with the content, but also to HTML 4.01 Transitional DOCTYPE. In this particular situation, placing two shapes in a table, let's say, even if the table size was specified or, indeed, the sizes of the TD elements, in percentages or pixels, the shape would just expand to its maximum possible width.

I got stuck here. The control worked perfectly when the width was specified in pixels. Anything else just throws a big wrench into the works and makes it wanna go boom. In a fit of anger, I just replaced the obsolete doctype with the modern XHTML 1.1 one. And it worked, but only on Internet Explorer 8, not any of the previous versions of the browser.

Therefore my only option now is to either abandon the technology completely or to convince people to change the DocType for all their legacy pages. How fun is that?!

And before you write the usual crappy "Microsoft sucks! Internet Explorer sucks!", try giving me a solution for my request that would at least work in another browser. Was it so difficult to recognize the need for a stretched background image and custom shaped containers ?!

and has 1 comment
I've had the priviledge recently to be able to watch two batches of horror movies from start to end without interruption, what I lovingly like to call FrightFest@Home. All my movie comments can be found here as well as another list, ordered by my vote here. The permanent links are in the top right of the blog as well.

However, after this, I felt compelled to also write a blog entry about them, since, as the horror genre goes (and, why not, the entire movie class), most of the films I have seen were rubbish.

So, these are the movies I have watched. I will cross out all the movies that are not worth seeing and bold out the ones that I felt need to be seen. I reiterate: all the movies in the list are horror (or at least marked as such on imDb). I would like to add a special thanks to M'hael from The Horror Club blog who recommended many of the films in the list. Here is goes:

Have fun!