and has 0 comments
"How can you say that, Siderite, since all your rants are typical intellectual rants and you are obviously one?" writes a loyal blog reader.

Well, loyal reader, only reader and also writer of this blog, I also suck! Yes. Writing a blog that basically helps no one except for the programming tips, for the main purpose of being read by anyone, shows that I suck big time. And I am not the only one. Forums and blogs are sprouting all over the net, an infestation marketed as Web 2.0, basically saying absolutely nothing useful. The writers usually start blogging for the same reason that young girls write diaries, then "accidentally" leave them so anyone can read them. The opinion of people we don't care about and that normally should not care about us should be irrelevant, but the human need for self affirmation seems to counteract this obvious logic.

And I've realised this (well, finally at a conscious level) by reading these small magazines that are free and left to be read in bars and restaurants. They contain a few articles, targeting medium or high income young adults, as most of the clientele of this places is, and written by intellectuals. The rest of the pages are filled, of course, with commercials and ads. I first got interested, because the things that these guys said resonated with my own thoughts. Then I realized that they only did so with negative thoughts, talking about how the world is and shouldn't be and the adjacent sarcasm and intelligent irony. They didn't really provide useful solutions; and the more I read them, the more they sounded like whining.

So it hit me! These people have no reason to write anything to others. They only express their own impotence as members of the most elitist and minority group: intellectuals. They are intelligent, they read a lot, know a lot, and can't do anything about it. They are surrounded by idiots and the world these idiots create and the only possible thing to do about it is BLOG! (as in rant, using any media they can access). And because their opinion is nothing more than a sad whine, with no effect whatsoever, they suck. And so do I!

and has 0 comments
Why Windows takes so long to shut down.

Now this is a nice article that just touches my soul. How many of us, computer geeks have been at the mercy of the Windows shutdown? How many minutes wasted staring blindly into the monitor for that simple but elusive power off?

I have installed the Hive Cleanup Service and it mostly works. However, I can't say that it provides with the instant shutdown that I was looking for and I have no idea if the fact that my computer shuts down regularily now is due to this software, but it certainyl didn't hurt my computer in any way.

and has 0 comments
Profile of the Sociopath

This link is a short summary of the psychological profile of a sociopath. Having dealt with at least two in my life, and with one when I was least prepared for it (Grrr!), I kinda stumbled over this. As a paranthesis, search on Google for cult leaders and their psychological profile. Some weird event from your adolescence or the strange behaviour of your child can be sometimes explained by the influence of sociopathy and cultism.

If you read carefully the link above, a pattern forms and a profile of a sociopath emerges. Are they many in society today? And asking myself that I noticed that this profile fits a lot of women almost like a glove. Don't believe me? Read it for yourself. Of course, it doesn't ALL fit, else we would be in big trouble, but I started wondering, as the defining characteristic of psychopats is the incapacity for love and shallow emotions, how do women feel? Could that be an explanation for the way we can't understand the opposite sex, while they understand us perfectly? Could it also explain while we get mad rather rarely, but intensely, while they seem to get enraged after all kind of stupid things, then quickly get over it? Do they really love? These are questions that stuck with me for days.

Of course, a general and simple answer doesn't exist. If I look closely, a lot of those traits fit me as well. Does it mean I am a sociopath, coolly manipulating my blog readers? I just might :D

I somehow managed to add to one of my Visual Studio 2005 Web Projects a webservice that had the code written "inline" meaning the <%@ WebService Language="C#" Class="WService"%> tag, followed by the C# code. While Visual Studio has a decent Intellisense functionality in asmx files, ReSharper doesn't. So I felt the need to move the code into a codebehind file. You would think that adding the Codebehind="WService.amsx.cs" would be enough. No, it isn't! As the codebehind model for VS is to have the codebehind in a compiled dll, an error like "Cannot create type WService" will annoy the hell out of you. The solution is to add the cs file into the App_Code directory.
<%@ WebService Language="C#" Class="WService" Codebehind="~/App_Code/WService.asmx.cs"%>

I've tried compiling and using a dll from the net for a Pocket PC and, even if the compilation of the source worked, when trying to add it as a reference, I got an error and the dll would not show in the references. However, a lot of other errors occurred later on, as if the dll was still referenced. Reading the csdproj file directly, I noticed that the reference to the dll was there, but that every time the project was loaded, the same error occurred and the reference did not show. The only solution is to remove with a text editor the XML entry from the csdproj file.

Also, VS2003 hangs periodically after a few debug-deploy cycles, usually when trying to stop debugging, using 100% CPU and freezing. This might also be related with version 2.0 of ReSharper which I have installed, but somehow I doubt it, cause I love the guys at JetBrains! :) The only solution is to kill the process, which will close VS2003, then restart it and reload the project.

Another issue is with the file on the Palm being in use while you try to deploy. The solution is to get to the Palm Control Panel, go to Memory, select the Running Programs, kill any program that has the same name as the program you want to deploy and anything that looks like "Client".

There are other issues, but I don't care to remember them all B-)

How to: Reference ASP.NET Master Page Content:
You must use a MasterType tag in each page to define the exact master page used. After that, all public members and properties in the MasterPage will be available in code as
Master.PropertyOrMember="RightHand";

Loading a Web User Control dynamically is rather easy: MyUserControl muc=(MyUserControl)Page.LoadControl("MyUserControl.ascx"); As a side note, I use this with AJAX, to load a user control, extract the rendered HTML and return it to be added javascriptmagically in a panel on the page.
However, when trying the same piece of code on Visual Studio 2005 with NET 2.0, I got numerous errors that MyUserControl was not found (The name 'MyUserControl' does not exist in the current context). Look, you moron, it's in the solution!! Anyway, I searched the web and discovered that even if I do load the web user control dynamically, I should also add a <@ register..> tag to the aspx, as if I would have the user control on the page.
Easiest way is to move the user control on the page, copy the register tag to the clipboard, undo the user control insertion, paste the register tag back.

Yesterday I had this problem where I needed to access the Session object from a webcontrol. I used HttpContext.Current.Session, after checking is HttpContext.Current was null. Then I've encountered a problem where HttpContext.Current was NOT null, neither were the Application, Response, Request and Server child objects, but Session was null.

After half an hour of searching on the web, I've decided to drill down on the problem and see what were the conditions under which it appeared. It seems someone had used the control in a UserControl that was loaded in the member declaration of the page. In other words, my WebControl was trying to access the Session object inside the constructor of a page. Apparently, the Session object is null in the constructor. Don't use private MyObject obj=new MyObject() anyway, since it breaks the separation of declaration and code, and don't try to access the Session object in the page Ctor.

My solution, after changing the offending piece of code, was to also change the WebControl to check if Session was null and if so, work without it. I also added a Debug.WriteLine('you are an idiot') message, for anyone encountering the same problem.

What can be better than a rant on IT matters? Yes, ladies and gentlemen, VS2005 sucks! Compiling anything takes twice the time it took before, loading it takes 3 times as long as VS2003, resources used are also doubled.
This is not something unexpected from Microsoft, just check out the evolution of the Windows operating system, doubling in size like following a sick Moore law, but this is a developer tool, it is supposed to enhance productivity. I don't even know what I would do without ReSharper.
They also had this idea, which I think it's not bad, of trying to make VS an universal platform for any developer tool. This makes sense if you consider it all started from Visual InterDev. However, if this is not done with the limited resources of developers in mind, it will only annoy people. Who cares Visual Studio 2005 can integrate the team manager stuff, the code, the html, the css, the sql, if I only want to make a small console application and I have to wait 5 minutes for my handy tool to start? It sounds a lot like Weird Al Yankovic's It's All About the Pentiums.

and has 0 comments
Yeah, baby, the World Sucks series is back with a new season. This episode is about smokers and, yes, they suck. And this goes beyond their obsessive need to put something long and slim in their mouth and suck on it.
Smokers suck for only one true reason: they don't care. Everyday I am exposed to tobacco smoke and none of the people that are actually smoking seem to care that other people have to breathe that foul smelling odor. When I go to work on my way to the subway, when I get back home, on the subway stairways (yes, don't wait another 20 seconds you fucking junkies, light the cigarette right in front of me on the conveyor stairs!), in my own home when I open the window and some neighbour decided to smoke the very next window.
I admit, smoking inside your own house should be ok and if the wind brings the smoke into my home, well, it happends. But it's just the last drop in the bucket, is there no safe place? I now understand the glue sniffing beggars that retreated in the subway to live an underground life; it's the only safe haven.
So there you have it: smokers suck, and it is so obvious to me that I don't even feel angry anymore. The only thing I can associate smoking with is farting. Someone farts, the others have to smell it. But who in the world sympathizes with a person that enjoys the smell of their own farts?

Getting back to programming, I am starting a small, but premiere project for Palm. These devices seem to be the work of the devil. The particular model I am programming for is something with a resolution of 240x320, with 64MB storage AND memory and with a 300Mhz processor.

Why?! When all computer screens are rectangular, with the width larger than the height, they make a device that is exactly the oposite. I mean, I understand they are meant to be hand held and all hand held devices are longer than they are wide, but it's still annoying.

Also, if I try to find a PC memory that is less than 256MB I would probably be forced to buy it second hand, yet they make a 64MB model? This also applies to the processor. Are they spending more money to make slower processors or is it just me seing things wrong?

Anyway, I found that working with DataSets in this environment is just awful. I started with a simple test project, 20000 rows in a 3.5MB XML file, loaded into a DataSet then displayed in a datagrid. First, the whole thing went out of memory and froze, then, when I fixed the memory problem by creating my own binary format and loading the file my way (oh yeah, I can see the roots of a XML sucks rant) the datagrid was very unwieldy.

Therefore I devised a ClusterGrid, something that shows clusters of rows in a datagrid and you just drill down and up on it. On my data, finding a customer in a 20000 rows table is 4 clicks away. First it shows 10 rows, representing clusters of 2000 people ordered alphabetically (ex: first cluster, from Alice to DeeDee). You click (or press with the finger, I have no idea how an actual Palm functions, I am using the emulator in Visual Studio 2003) on a cluster, you get another 10 clusters, with 200 people each. Then 20, then 2. Four clicks. Works like a charm. It seems a better deal than the scroll of the datagrid and I wonder why I haven't seen this before.

A small tip regarding the Palm Emulator. The default configuration is set on 32MB of memory+storage. If you want to at least have a functional program, increase it in the VS options, in the Mobile Devices tab. I couldn't make it larger than 64MB for whatever reason, but I never needed more and 32 is way too low.

and has 0 comments
Rant alert! This time I am not sure what or who sucks, so I'll just ask the questions and let you figure out the answers.

Today, in Bucharest, a gay parade was kept to celebrate the removal of article 200 from the Constitution, an article that made homosexuality illegal. Of course, right wing, religious, or just plain conservative people held their own demonstration and todays gay parade was attacked and ended in violence.

That made me think of this gay thing. It never occured to me that it was an issue. Lately, though, I am seeing it everywhere, from movies like Brokeback Mountain and New York style films to scientific reports that say 1 in 10 people is gay. That means that somewhere in my highschool class there were three gay people, for example, and I know of none.

I have no gay thoughts and I might just as well admit a little homophobia. But would I mind seeing people expressing their homosexuality in public, for example? I am sure some instinctual disgust would appear, but I am human, I should be able to get above my instincts. Besides, homophobic feelings, as strong as they may be, they can't be stronger than a persons sexual orientation, can they? Why should these people be forced to fight their own emotions?

On the other hand, another part of me protests violently. I don't want to see men French kissing on the street, touching their bottoms with their hands. I want things to be as they were, I like them like this. Yet, things were not very different for kissing boys and girls a few years ago. Romania being a conservative orthodox society, with a lot of people outrooted by communists from their homes in the country to come to the big industrial cities, young boys and girls showing physical affection for each other were frowned upon. I can remember how mad that made me feel.

Where do we draw the line? It is a weird line, I can tell you that. A lot of things can be seen in public in Romania. Dirty smelly beggars for example, roaming the transport system (for free I might add, while we pay the fare); loud music in the night from people listening to it on their powerful car stereos; extremely annoying comercials, people with flyers or cars that play very loudly some radio music to make you pay attention to the slogans on their sides. So why not gay people? I would certainly like to be in a bus full of kissing men than in a bus of smelly sick beggars.

A few minutes ago an idea came to my mind. Maybe people aren't against homosexuals, maybe it all started from a misunderstood word. You know when you're all lonely and depressed and you see people being happy and together and you feel a strong feeling of anger and annoyance? I think that in all countries people are mostly unhappy. Therefore, as democracy has it, in the early history they forbid gayness. People were not allowed to be gay in public, it made depressed people even more depressed. Then homosexuals chose the word to represent them and it all got mixed up.

So, my conclusion is that to be gay means nothing to me. I can live with the level of annoyance gay people might produce in me and I think they should do whatever they want and be able to express themselves. But then again, I think the same thing about right wing activists, fascists, communists and arab terrorists. Free speech should be truly free, and I would extend this to free expression.

I got it! Laws against freedom of expression suck! They might be gay, also :)

This is a nice link about how to convert a UserControl to a WebControl.
Convert a Usercontrol to a WebControl - The Code Project - ASP.NET

Of course, afterwards it is best to take the time to really think the WebControl through, but for quick conversions like "I want a web control that has a datatable and a graph and another that is a textbox and a validator" it is perfect. Haven't really tested the result on real life user controls.

I don't count myself as a web developer. Maybe what I'm saying here is really basic, but here it goes.

1. CSS Style Sheets are good. Because you can change a lot from the file without changing the site. One could even imagine a complete site makeover only from the style. Remember that style can have color, font size, div position, borders, anything one can think of and it's not in Javascript :)

2. As a corolary to the first rule, style tags and color attributes and stuff like that inside the html file are NOT good. A colleague of mine has submited the idea that there are exceptions to this, like horizontal alignment in table columns and similar basic things. But I say NO! :) If there was a requirement for a certain column to be aligned differently, then it belongs to another style class, even if it's only one column in a thousand columns with the same alignment. I do admit that it's difficult and annoying to copy all the attributes of a class to another just to change something as trivial as the text color. Which brings me to point 3.

3. You can't nest or inherit CSS classes, which is really dumb. I mean, I want a base class to contain text font and color and everything and I want to create another class that says "I am like class1, but with bold font". You can't do that as far as I know, but you can combine classes. An element can have a class="redFont blueBoldFont" which will combine the two CSS classes, and they will overwrite each other. In this case the font will be blue and bold, as the blue color will override the red.

4. CSS classes can be selective. For example .redFont td { color:red; } will apply only to table cells within elements with the redFont class. That is different from the td.redFont notation, which tells what will happen with table cells that have the redFont class. I would suggest avoiding this type of notation if possible. Also, one can somewhat separate the behaviour of a class inside another class: .redFont .blueBoldFont { color:magenta; } in a css file or within a style tag will signify that the blueBoldFont class within the redFont class will have magenta color. Everything else being a combination of the two mentioned classes. This is a little akward, but it works. Warning! the notation .class1.class2 works in Internet Explorer only. The proper notation is the classes names preceded by a dot and separated by spaces.

5. One cannot configure custom html attributes or javascript events in style. That is a hinderance, but I don't know if adding it would have helped things. I mean, I do want to configure all the elements having a draggable class to have special mousedown and mouseup events, but this can also be done from javascript.

What does this mean? It means that a well designed site will have ALL the styling, even the position and size of movable elements, in a CSS file, as it will have all the Javascript in a JS file. This kind of file separation insures that the styling can be changed independently from the Javascript code and the HTML source. It also means that when designing a Web Control, creating a complicated style system for all its elements is not necessary. Just give a default class to each pertinent html element and then give the entire control a single configurable CSS class. Then combine classes to style each element.

Use this in a Javascript event handler to stop the event from continuing. Some events cannot be stopped, but the ones that can will be stopped by this in any browser.

function murderEvent(evt) {
evt.cancel=true;
evt.returnValue=false;
evt.cancelBubble=true;
if (evt.stopPropagation) evt.stopPropagation();
if (evt.preventDefault) evt.preventDefault();
return false;
}