and has 0 comments

This is an image from the BBC web site and the title of the BBC article is Rice launches Korea crisis tour and the caption is Japan and the US pledge to work on implementing sanctions on North Korea, the US Secretary of State says.
I knew politicians are assholes, but how can you smile like that while deciding pledging to impose sanctions on some other nation? Look at her! You'd say she's hugging her daughter while petting the cutest cat ever. And she's imposing sanctions! And the title sounds like she has just opened a tourist resort. That whole picture is wrong. Geez!

    I have found three basic methods:
  1. Use an online type of viewer.
    You select the resolution, type in the URL of your site, then sit back and relax.
      I see a lot of problems for this method:
    • you don't want everybody to know you are working on a site

    • you don't want the site to be open to the public while you work on it

    • you need an internet connection


  2. Use an external program.
    BrowserSizer is as good as any. It's free and easy to use. You select the resolution and it resizes your IE window accordingly.
    The only problem I see is that you need the program. You install it, it messes with your browser settings, etc.

  3. Use a javascript script in the IE addressbar:
    javascript:db=document.body;bst=db.style.zoom=1;rd=prompt("Width:",800);
    db.style.zoom=db.offsetWidth/rd;void('')

    Unfortunately, the zoom messes up quite a few things, including fixed table headers or custom javascript controls. However, I do believe it is the best solution for most situations.

You may experience unexpected results when you open a Web page that is in an ASP.NET 2.0-based application in Mozilla Firefox and the DefaultButton property is assigned to a LinkButton control or an ImageButton control

Just a reminder of a bug I am likely to encounter. The obvious solution is to use ControlAdapters or inheritance to create LinkButtons and ImageButtons that are rendered as buttons.

and has 0 comments
I've accidentally stumbled upon FxCop, a Microsoft free tool that analyses the generated NET code (.exe or .dll) for bad design practices.
While many of the errors and warnings I got were related to casing, a lot of them were not and they had come with links, extended information and solutions. The rules that FxCop has help you to make members static if none of the instantiated object's properties or members are used in it, use case insensitive String.Compare instead of comparing two ToLower strings, or StringBuilder in loops, use NET 2.0 constructs instead of 1.1 ones, etc.
I find it at least interesting and I intend to use it in my future software projects.

and has 0 comments
I've recently changed my email address, added spam filters both on the server and on the client and moved all known addresses into a special folder, leaving any unknown source (thus mostly spam) emails alone in the inbox folder. This resulted in me not receiving spam email for at least a week. Now I kind of miss it. I mean, I feel something is wrong, like some essential part of my life is gone. How weird is that?
And apparently, I am not alone. 231 pages in Google have "I miss spam" in them.

ASP.NET 2.0 has this nice feature called Virtual Path Providers. What it
actually does is enable you to get your site files from anywhere using an
override of the VirtualPathProvider class.

Virtualizing Access to Content: Serving Your Web Site from a ZIP File
This is a very nice article where a Microsoft guy shows how to run a
complete ASP.NET site from a ZIP arhive. Just two lines of code in
global.asax , a standard web config file and a ZIP arhive.

This opens up a lot of possibilities, like reading the ASPX or CS files from
a class that creates them dynamically, or reading the files from multiple
sources at once. Yummy!

and has 0 comments
I vaguely remember reading of nullable types in the C# 2.0 "what's new" documentation, but somehow it slipped by me. Now I've stumbled over this useful new feature and I can explain it for a bit.
Here is the Microsoft explanation.

Basically you can declare any value type as nullable by using the syntax <type>?.
Example: int? x=null;
There is even a nice operator ?? that acts like the SQL isnull function.
Example: int y=x ?? 0;
The two above examples are the short for the following:
System.Nullable x=null;
int y=x==null?0:x.Value; int y=x.HasValue?x.Value:0; OR int y=x.GetValueOrDefault(0)

    The Nullable type has some nice methods:
  • GetValueOrDefault([value]) - gets the default value or the specified value when the nullable type is null

  • HasValue() - something like is not null



There is no IsNull method to the Nullable type. Also, x=null makes x==null true, as opposed to, let's say, the SqlInt32 type.

and has 0 comments
I've just finished The Runes of the Earth, the first in the last series of the Thomas Covenant saga. I must say that the style and content changed significantly from the first books, therefore I felt the need to review the whole saga as I see it now.
I liked that in each book new ideas were introduced, they weren't just reprints of the same story. The moral basically stays the same, but everything else, sometimes even the lead character, changes.
From the second series, a new model of writing was used, thus all the books in one series make out a story rather than one book per story. I didn't like that, especially now, when I have to wait for the next books to be published in order to see what is going on. What I also minded was the need of the characters to shed tears over all kind of stuff. I think the author overdid the misty eyes scenes. A lot of the creatures and the culture from the first series was completely obliterated in the second, but it seems to be making a come back now.
The good thing about it, though, is that the writing gets better with each book. In hindsight, the first book seems amateurish compared with the rest. No more singing, more story, less descriptions. It is interesting that the last series of the Chronicles of Thomas Covenant the Unbeliever was published 20 years from the end of the second. Donaldson justified this as taking time to become a better writer before ending the story.
Let's see how it goes.

and has 0 comments
For as long as I can remember, the MSN messenger changed my picture in a random fashion. I was setting it, then at the next restart, another was there. The last version I am using is 7.5.
Today, I finally found out what caused it: Tools → Options → Security → "This is a shared computer, so don't store my address book, display picture or background on it".
It is nice to know that if I want to keep the same picture on the messenger I have to also store my address book on the computer. Microsoft seems to think they are of similar importance :-/

and has 0 comments

Do you want to update the updater?


Already annoyed by the Adobe Flash Player 9.0 which practically breaks my favourite online game Robostrike and forces me to run it in Mozilla, I found this article hilarious enough to sustain my "Adobe sucks!" statement.

Update: (yet, pun intended) After five years I was working for Adobe Romania and it was awesome! Best development environment I've seen yet. I am pretty sure this is owed more to the people there than the Adobe corporation as a whole and it was still 2011 after all, but I felt I had to rectify the statement above.

and has 0 comments
Spurred by two TV shows about two famous people, I came to the conclusion that Osama bin Laden's history has a lot in common with the one of Hannibal Barca, the Carthaginian general, just as the history and technological development of the US has a lot in common with the Roman Empire.
Think about it!
Hannibal was born in Carthage, but he left it when he was nine years old. He hated the Romans with all his being and when he attacked their empire (which then span the Italian peninsula) he did it by hitting targets deep within their teritory. Using innovative strategy, he defeated the strong Roman army by using its flaws: size, but no coordination; force, but not precision. With a small mercenary army that also used elephants, he surrounded the huge Roman army and destroyed it. He then demanded support from Carthage, in order to siege and capture Rome, but the politicians of that state decided that it would be safer to not antagonize the Roman Empire and didn't sent support. Powerless to set siege to Rome, Hannibal could do nothing but watch how the Romans build another army which will then defeat him. In order to avoid capture, after years of exile, he commited suicide.
Osama didn't leave Saudi Arabia from childhood, but he was exposed to the teachings of returned exiled teachers, who brought different ideas. He came to hate the Americans and when he attacked them, he struck deep within their teritory. Using innovative strategy he defeated the US antiterrorism machine by using their flaws: size, but no coordination; force, but bureaucracy. With the smallest of terrorist groups that also used air elephants (heh, I stretched it out a bit, but it holds), he struck a major blow to the confidence of the US. He then demanded support from the Arabic nations, which decided to not antagonize the American Empire. We all know what happened to the ones that did. Powerless to continue his campaign, Osama watched as the US machine learned from its mistakes, rebuilt it's antiterror army and then defeated him. After years of exile, he dies, avoiding capture through death.
Now, what it even more interesting is that Hannibal's actions led to the expansion of the Roman Empire into Iberia and Carthage and the refining of their army and war strategy. This eventually led to the Roman Empire conquering so much and becomnig the most famous and technologically advanced civilisation of its time. Carthage was completely raised from the surface of earth, destroyed by Romans and plowed clean. If we were to continue these parallels, the American Empire should now have a more powerful and precise war machine, it should conquer or at least neutralize any threat from the Arab nations, then proceed on conquering the world. Some poor country should take the blame, as Carthage did for Hannibal, and be completely ravaged by war. Does it sound familiar? Brrrr...

Other related links from people that had similar ideas:

There are even more links, in total Google showed 573 links that contained Osama bin Laden, Hannibal and not L*ecter. But since people spell Osama differently, others make it clear that it's not the guy from the movie, thus causing false positives and there are a lot of sites that just enumerate famous people, the count cound be completely different.
Happy thinking!

and has 0 comments
It was one of those moments when you think of nothing and suddenly something distillates into conscience. It sounded too good and too important not to find it on the net so I googled for "God is a brand" and I found 17 entries out of 98.200 (yes, Google is getting weirder and weirder).
Now, when it hit me, it seemed like something really smart, but now I understand it is just obvious; I was the dumb one for not getting it sooner. People don't have holly wars on Linux vs Microsoft, they are having brand wars on Jesus vs Mohamed.

What started me is looking for furniture for my new rented apartment (expect a huge blog in a few days) and I found the same models in two different places, but with two different prices. My wife said that it was because the more expensive ones were better made, but they really weren't.
Then I realised that most commerce is run on brands, it's nothing new, it goes on from the beginning of trade. You buy from where you know it's good, or from where stuff makes you look or feel good. People are attached to the spirit of the thing, not the thing itself (well, most people). The Stradivarius violin can be made better and cheaper using modern computer modelling and automated manufacturing, but people care about the original Stradivarius, made by a human, a human that represents something. The enormous price of Stradivarius violins is not due to their utility, but the faith of the people in the original builder, the artist. Ring a bell? Original artist? The Creator? Yes! God!
The epiphany came when I explored the idea in my mind. People doing idiotic things because of their faith, the experiment where people were given to wear a t-shirt for 10$ and refused to do it when they heard it belonged to a serial killer or the one with the children that were given a "perfect replica" of an object that they loved and they prefered the original or the simple superstitions like avoiding number 13. Movies, as well, usually portray clones as imprefect, evil, empty of true purpose or life. People remain married for decades, respecting and even loving the other person, when all rational motives to stay together have withered in time. Of course, this is also linked to the way human instincts work, but nevertheless, there are people who do it and people who don't.
Somehow, the intricate mechanism of the brain puts values on associations rather that on the objects. I think this is important. It is obvious that people have inner representations of different things and people, but I've always assumed that the inner value is put on the thing not on the associations. I now believe to have been wrong. It makes sense: there is no absolute value, only when you put something into context it reveals its value.

Therefore, returning to the God is a brand issue, it seems to me that the branding is made on oneself. You don't buy the product, you become the product. You brand yourself with a god, then act in accordance with its meaning. Then losing one's faith would be like becoming an clone of yourself, empty of meaning. It could explain the feeling of loss of a person, when "there are other fish in the sea". It makes old people be grumpy, since no one truly understand the different deep meanings that they've attached to objects and people and behaviours.

I can't even ask myself "Do brands suck?". It would attack a defining feature of humans AND animals alike. This warrants a look into the idea of religious feeling in animals. It is not possible for everything to suck. Religion sucks, though.

I was stunned today to see that a site that I was working on was not starting because of this idiotic error:
ASP.NET 2.0 Parser Error Message: Access to the path '[something.cs]' is denied.
And further down:
No relevant source lines

The only thing I remembered doing was close the project in Visual Studio and work on another. I tried starting the site with the URL, without loading it into Visual Studio and the error occured. If you search on the net this error, you will see that there are a lot of articles that talk about the ind*exing ser*vice, but I stopped it a long time ago. So what was going on?

  • The file was accessible

  • The file was not opened by another application

  • I could freely delete/remove/modify the file



In desperation I compared the Security settings for this file with other files in the directory. To my surprise, there was a major difference. The files that were accessible had a lot of users with access rights to them, the file that gave the error had around three.

I have no idea what caused this. I just copied the same rights from the other files to the problematic one and it worked. I am using Visual Studio 2005, Resharper and SourceSafe. Do you also hear the Twilight Zone soundtrack?

It's is done in two different ways: the IE way and the DOM way.
IE way) really simple, use element.fireEvent(eventName,[eventObject]), where element is a HTML element and eventName is something like "onclick";
DOM way) really complicated. A short example:

function simulateClick() {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
var cb = document.getElementById("checkbox");
var canceled = !cb.dispatchEvent(evt);
if(canceled) {
// A handler called preventDefault
alert("canceled");
} else {
// None of the handlers called preventDefault
alert("not canceled");
}
}

As you can see, you need to create the event, then initialize it, then dispatch it.

    Things you need to take care with:
  • in the DOM model the event name is not prefixed with "on". In the IE way, the event is prefixed with "on". ex: DOM:click IE:onclick.

  • in the DOM model the event triggering does everything the event would have done, like setting a value, in IE it does not. ex: triggering onclick in the above example would check or uncheck the box. In IE you need to change the value yourself.



This is code I did to programatically click a checkbox and also trigger the onclick event:

if (box.onclick)
{
if (box.dispatchEvent) {
var clickevent=document.createEvent("MouseEvents")
clickevent.initEvent("click", true, true)
box.dispatchEvent(clickevent)
} else
if (box.fireEvent) {
box.checked=!box.checked;
box.fireEvent('onclick');
} else
box.onclick();
} else box.checked=!box.checked;

and has 0 comments
Microsoft has now released Orcas into the wild with a Community Technology Preview download. Links: Orcas CTP download, Orcas CTP - Development Tools for WinFX.

A quick intro interview with Sam Guckenheimer, Lead Product Planner for Orcas:
Orcas and the Future of Visual Studio