and has 0 comments
I had this English teacher in high school. She was very nice, and I also enjoyed her classes, mainly because I already knew English and because she did the unthinkable, she said she would pass anyone who didn't want to learn English, provided they didn't come to disturb the class. She was a good teacher.

Anyway, one day she started talking about the place where she is alone with her thoughts and she can feel calm. I, being even less tactful than I am today, replied "Oh, the toilet!". She felt offended, because she was talking about church. But the scene stuck with me. And sometimes, on the toilet, alone with my thoughts (and my cat - so not quite alone) I recall her reaction and my own. You see, I understood why she felt offended, it was because I compared a place she considered clean with a place she considered dirty, but I also thought about why a woman that believes in a deity that made us all considers dirty something like we do by design and clean something we do inside a building with trainers and specific rituals that are not by design.

And that got me thinking (hmm, is my blog the best thing since toilets?) about the general situation where we put so much value on an external thing, while the value itself is internal. And I am not talking here only about religion (which by now you know I consider stupid) but also about everything else. Fashion, for example. It's the human equivalent of monkey see monkey do. It's putting value on a thing, person or trend simply because you feel like it. So it's something that has internal value, you gave it importance, but you attached it to something external.

Take another example: the things we get attached to, apparently by brain design. A child is being told that his favourite toy has been cloned into a perfect copy. And he is given "the clone", which is actually the same object. And the kid wants his toy back, not the copy. And the examples are infinite.

I think it's because in our brains, things are not things, but intersections of meanings. A red pill is the intersection between "pill" and "red", themselves intersections of other concepts. The church is nothing but a silly building, but it has meaning, for it gives peace and solitude for a while. So does a bathroom. So does this blog. But there comes a time when we realise that the intersections don't add up. It's called thinking, and it's the equivalent of Bonzai trimming of one's thoughts. We start cutting away the lines that don't make sense or that hurt us, while we strenghten the ones that give us sense and pleasure. We start with a thin scaffolding of chaotic wires and we bring it to a sturdy iron bar cage where our thoughts are stable and protected. That is the real place where we are alone with our thoughts, and we are alone because we don't allow anybody or anything in.

So trim carefully, some thin wires are good while some iron bars are bad.

and has 0 comments
VB has a feature that it missing in C#, that is indexed properties. There are various methods to emulate this behaviour in C# and here is a small article about it:
Three C# Tips: Indexed properties, property delegates, and read-only subproperties.

However, a problem arises. What happens if you have a library written in VB and having indexed properties and you try to use it in a C# project? Well, it works, and the generated code is something like:
 public override bool get_PropertyName(string index)
{
}
public override bool set_PropertyName(string index)
{
}


Somehow, this compiles :) Anyway, the problem now is that you can't use the VB code that used to use the VB library if you convert it to C# like this. I haven't found any way to do this:
VBLib(with indexed properties)+VBApplication(inheriting or overriding indexed properties) -> C#Lib(translated)+VBApplication(unchanged).

and has 0 comments
I was too tired to work this morning, so I got on Digg to read what people were reading.

And I've seen some interesting articles, like for instance one about Starbucks. They started this campaign in which people write stuff and the company writes it on coffee cups. One man dared to question praying in God, based on the assumption that people are rational beings with a strong will. Obviously that assumption was wrong, as some chick got 'offended' and started bitching about the text. It got me thinking, you know, of why nobody cares if I am offended by all the God crap I hear everywhere. Some guy said on TV a few days ago that in Romania 99.8% of the population are believers. Yeah, right! Like, they are not full time declarative atheists. How easy it is to spin things.

Anyway, back to interesting topics. There was one about how lawyers are behind the times. They write these 'cease and desist' letters, with a threatening language that no one can ever sympathize with, but nowadays these documents get on the Internet, for everyone to read. And hate. So they cause public relation troubles for the companies they were trying to protect. I don't really see a problem, though, as there are a lot more lawyers ready to sue these lawyers so there you go.

But even religious and legal idiocy fades compared to the total mind numbing dumbness of these two Vegan parents. Apparently, they've decided to make their 6 week old infant a Vegan from birth. They fed it soy milk and apple juice. The baby died.

How gullible are we?! How can we believe in all these stupid things and advertise them as indie revolt against 'the system' or 'healthy' lifestyle against the food corporations and so on? Is it so hard to mind your own business and let other people think and decide for themselves?

Apparently, the summer has brought all kind of nasty insects. A fly has gotten loose on my blog! It's a bfly! Until it finds something useful to do (like allowing people to search stuff or going to the interesting bits or acting as a friendly button) and until it will find friends to join it, it will just annoy us. Alas! It is an unswatabble fly.

I wanted to create this Javascript fly that would... well... fly on the screen. So the first thing I did is create an empty html, put a script tag in it, add some init function to the body and then write the code.
First problem: how to get maximum height and width of the page in both IE and Mozilla. I found a way, then I added a more complex html code, like a DOCTYPE. Well, amazingly (duh!) it didn't work. Finally, after trying several options, I found this code to be working in both browsers and in both doctypes (or lack of). Please report any issues with it, so I can fix it. Thank you.

function maxHeight() {
var h=0;
if (window.document.innerHeight>h)
h=window.document.innerHeight;
if (window.document.documentElement.clientHeight>h)
h=window.document.documentElement.clientHeight;
if (window.document.body.clientHeight>h)
h=window.document.body.clientHeight;
return h;
}
function maxWidth() {
var w=0;
if (window.document.innerWidth>w)
w=window.document.innerWidth;
if (window.document.documentElement.clientWidth>w)
w=window.document.documentElement.clientWidth;
if (window.document.body.clientWidth>w)
w=window.document.body.clientWidth;
return w;
}

and has 0 comments
You want to create a report with Crystal Reports and you create that weird ADO.Net DataSet, then you add a Crystal Report, you select the tables you want from the created DataSet, then you drag the Id references to create the table links, you go through all that weird Report Expert, you add a Crystal ReportViewer to a Windows Form and you press F5! And you get "Query Engine Error".

Well, two main reasons for this are explained in this nice article: "Query Engine Error" With Crystal Reports .NET, but you just created the report, there is no way you changed the XSD or the name of the tables.

I tried a lot of things until I found out what was going on. You see, I had this tables that had an "Id" column and a many-to-many table that had "UserId" and "MenuId" columns. In order to link them, I did what I also did in the XSD, I dragged the Id (primary key of each table) to the UserId and MenuId columns. That was the problem! You have to do it the other way around, drag the Foreign Key columns to the Primary Key columns.

Hopefully, you would have read this article before wasting hours to find out what the hell is that error and where it comes from... It happened to me with Crystal Reports 9.0 and Visual Studio 2003.

Oh! And don't bother to link the tables in the DataSet XSD, since Crystal Reports seems oblivious to that.

I am working on this windows app that uses Crystal Reports. I've never used it before and I thought "Hey! I could learn something new". So I opened this .rpt file in Visual Studio 2003 and I got the most incomprehensible interface ever. I mean, I will have to invest some hours just to understand what the report interface is all about.

But anyway, I thought I would take an existing report and then just change something, like adding a new field. I went with the mouse on an empty space, right click, context menu, Insert... I could insert text. I could insert Special Fields (report data like number of the page, creation date and so on). I could insert Fields. Only that option was disabled! I've tried every option in the context menu, no avail.

Finally I've decided I am to dumb to figure it out, I went to man's best friend: Google! The answer found in an obscure forum was:
- Go to View (in Visual Studio 2003)
- click Other Windows
- click Document Outline

Now a Field Explorer window is open and I can see all fields and drag them to the report. That was it! :-/

and has 2 comments
When one wants to replace a text, say, case insensitive, one uses the .NET Regex class. In order to make sure the text to be replaced is not interpreted as a Regex pattern, the Regex.Escape method is used. But what about the replacement string? What if you want to replace the text with "${0}", which in Regexian means "the entire matched string" ? You need to somehow escape the replace pattern.

I have no idea where to find this information on MSDN, although I am sure it is hidden somewhere in all that Regex labyrinth. Here is the link on MSDN: Substitutions

So here is the info: You only need escaping the dollar sign, so the code would look like this:

Regex reg=new Regex("Text to replace",RegexOptions.CaseInsensitive);

string s="here is the text to replace";

s=Regex.Replace(s,"$${0}");

Now the value of s is "here is the ${0}".

and has 0 comments
Yes, we went to the Mitsubishi dealership. It was nice to actually have someone talk to us and give us all the details, thing that did NOT happen to us at any showroom except the Seat part of the Skoda showroom.

As a side note, I tried entering the Pajero, the Mitsubishi SUV and... I couldn't fit. Not even a tortured position. The front seat moves electrically (yes, some people are so lazy that moving their own seat takes too much. My foot was turned at 90 degrees, my leg could not find a proper position and it wouldn't pass past the steering. It was horrible. But then it dawned on me: tall people don't buy SUVs! The usual suspects when we're talking SUV drivers are fancy women and small, fat people. You don't buy an SUV because you need it, but because it compensates for some shortcomings (pun intended).

Now, back to the car we preordered!! The Mitsubishi Colt is a normal droplet shaped hatchback. But I could fit in! A little effort was required on the driver's seat, but it was ok. More than that, I am sure the rails of the seat can be lengthened or at least moved a little back. The back seats also move back! You can also collapse them or even remove them entirely, giving a huge space in the back if there are only one or two people in the car. It also has automatic gear shifter, which is terribly difficult to find in small cars (or any cars for that matter) in Romania; yet, unfortunately, only the gasoline car models. No matter. I was looking for a gasoline car anyway. The color choice was rather poor, I had to choose between white, black, gray and red nuances.

So, we preordered the car! A carmine Mitsubishi Colt Hatchback, 1.3 Gasoline, Automatic/manual gearbox (that means you can switch between them whenever you like).

Now, all we have to do is get the money (from a bank!) and pay a lot of money every month for 5 years. Wish us luck!

and has 0 comments

Without further ado, The Sounds! with their song "Seven Days a Week". Of course I chose this one because the blond looks cute :)



Links: Official site, MySpace site, Wikipedia entry, YouTube search.

and has 0 comments
No, I am not talking about Dark Water, either. I am talking about water. Penn and Teller went to a rally of some sort and asked people to ban dihydrogen monoxide; water, that is...



So, if you are reading this, dear environmentalists and conspiracy theorists... don't listen to everything that sounds good, because most of it is not, even if it seems to enter the same agenda as yours...

and has 0 comments
A while ago I wrote this entry about an innovation in sound technology that will probably change the way we think of sound.

Today I am presenting a video technology I witnessed at the mall! Yes, the mall, that dreaded place of overpriced junk and overdressed bimbos. Overpriced, too! :) Anyway, I was watching this Pepsi commercial on a big TV like device, where a can of Pepsi was rotating showing its full cylindrical glory. Only that it felt out of focus. My eyes were kind of sore watching it. Immediately the image changed to a ball that came towards the screen and then... went through the screen!

It worked from almost every angle, without being a holographic thing in the middle of the air, but more of an optical illusion. Thinking of the faithful thousands of people reading this blog every day, I remembered the little link on the side of the device: www.x3d.com, with their device called MultiView.

The image is not as clear as one would want. It's like continuously vibrating or something like that, but the optical illusion is great! I saw people passing by the device and trying to put their hand through the "flying" objects.

Here are a few links from Wikipedia about the subject:
Volumetric Display
Autostereoscopic

I found this little page while searching for a DataGridDropDownListColumn for NET 1.1 Windows Forms. It works and seems elegant enough.

To bind the column values, use column.myComboBox.DataSource, DisplayMember and ValueMember.

and has 0 comments

Update: I've heard that Fado has now been closed. It was nice while it lasted. Too bad I didn't have the chance to go again a few times before it went away.

Today we went with my parents at a Portuguese restaurant called Fado. I have to say I was pleasantly surprised by the cuteness of the place and the service was not bad. The food was bravely innovative, too, and tasty. Actually, it was more on my own taste than most of the restaurants I've been to, including Chinese. Well, I like Chinese more, but I can't cook Chinese, that's what I meant :-P

Anyway, if you happen to search for an intimate restaurant in Bucharest, with interesting food and a waiter that knows suspiciously much about the food, up to the point where he recommends you what is better than your original idea, then Fado is the place for you.

This is a link, in Romanian, with more details: Restaurant Fado

If you look for solutions to get rid of huge ViewStates from your pages you will get a lot of people telling you to override SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium in your pages and do complicated stuff like keeping the ViewState in the Cache or in a database, calculating strange keys, etc.

No more! Net 2.0 has something called a PageStatePersister. It is an abstract class and every Page has one. In case no override occurs, the default is a HiddenFieldPageStatePersister, but you can also use the provided SessionPageStatePersister like this:
protected override PageStatePersister PageStatePersister
{
get
{
return new SessionPageStatePersister(this);
}
}


And that's it! It works with Ajax and UpdatePanel, too.

However, this is no "Silver Bullet", as the SessionPageStatePersister will have issues with multiple windows open with the same session (like pop up windows) as exampled in this nice article. Also check out this situation when, during Ajax callbacks, a full ViewState is returned due to the ever troublesome ImageButtons.

There is no reason not to create your own PageStatePersister, though. The abstract class is public (not internal and sealed as Microsoft likes their most useful classes) and you can inherit it. You can even store the state in the Cache! :)

A very comprehensive article on ViewState is here.