Yes, you've read right. You can debug Javascript with Visual Studio. Here is a blog entry that blew my mind when I've read it: JavaScript Debugging.

Basically, what needs to be done is first go to Internet Explorer Options and disable Disable Script Debugging (Internet Explorer) (No, I didn't mistype, there is a checkbox that needs disabling and it's called Disable...) in the Advanced section. Be careful not to disable the other script debugging box, only the Internet Explorer one. Then, when an error occurs, the system asks you what debugger to use. You can choose Visual Studio 2003 or 2005 from the list (provided you have them installed :) ), trace, put breakpoints, etc.

There is also the javascript debugger keyword, which fires a debugging window at the specific location, so it's like a breakpoint.

Googling the net I've found that there are both free and commercial Javascript debuggers. There is even a free one provided by Microsoft: Script Debugger for Windows. One, unfortunately shareware, product that I saw recommended on the forums is 1st JavaScript Editor.

The only disadvantage to this, that I've seen, is that any javascript error will result in opening the debuggers window, without the ability to check "ignore errors on this page" or anything like that. It could be annoying while browsing. Yet I am surprised that I've heard of this method of Javascript debugging only now.

Update:

If it seems the list of debuggers does not appear anymore (or never did), go to Visual Studio Tools -> Options -> Debugging -> Just-In-Time and check the "Script" checkbox.

If it seems Visual Studio doesn't correctly find the right Javascript line to debug when entering debug mode, start the web site without debugging and then choose Microsoft Script Debugger. It gets the current line right, but has a difficult to use interface (Hint: use the Command Window). Of course, you have to download and install it first :).

CSS Friendly ASP.NET 2.0 Control Adapters is a little project run by Brian Goldfarb and what it does is use the power of the ControlAdapter object to change the way ASP.NET controls get rendered. They use CSS layout to control the way things look and try to remove the old table based format.

While this could be a good thing in some situations, it could be harmful in others like low resources or weird changes in the CSS laws. I let you decide for yourselves. And while the ControlAdapter approach is very elegant, I've used this concept in creating my own controls when needed by overriding ASP.NET classes and using simpler code. Also, these Control Adapters are in Beta 2 stage. Major changes are still in the works.

So don't trust it blindly, but do check it out, as it is a worthy and honorable quest :)

and has 0 comments
http://labs.oreilly.com/code/

The above link is the O'Reilly code searcher. You can find any code that was ever published in O'Reilly books.

update:

also check http://www.koders.com, which is a global search engine for code!

and has 0 comments
I am used to commenting on the things I see in life. I do the comments on movies on IMDb, but I haven't made an account on iblist, since I read so ridiculously few books that are not technical and IbList doesn't seem to be so complete and organised as IMDb.
So I will blog about books until the time when I see myself worthy of an iblist account.

Spurred on by a need for fantasy I've just finished Lord Foul's Bane, by Stephen R. Donaldson. Remarcably well written, it is obviously inspired by Tolkien's Lord of the Rings. There are lords, there are rings and there are brave and honorable quests. At times this becomes annoying, when characters feel compelled to sing songs (and the author actually wrote the lyrics in the book) or sacrifice themselves in rather ridiculous ways. I didn't like the way Lord of the Rings was written because of all the useless details in it. Lord Foul's Bane, the first in the Covenant series, is a bit like that, but not as bad. The main character, Thomas Covenant, is also most interesting than Frodo, having come from our world and being full of pain. Unfortunately, in the most important parts of the book, Covenant does things as moved by a puppeteer rather than by his own logic and good sense. This makes the plot seem a bit too unreal. The fantasy world, though, is pretty well done, with sensible magic and purposely made to look like a mirror image of our own, with all the bad things in our world not present and (I would say) all the good things being bad there. Like stopping from your journey and starting singing songs that are sometimes labeled as gay in the book.

I've also finished the first two volumes of The Spook series (The Spook's Apprentice and The Spook's Curse), by Joseph Delaney, which is interesting and well written. In this one, a feudal world is plagued by evil witches, ghosts and banes. The man that takes care of this, like a Dark Ages ghostbuster, is a spook. He does the job that no one wants to do, everyone needs him, yet everyone hates and fears him, including and especially the Church, which in this series are portrayed as a bunch of corrupt and amateurish incompetents. The main character is a young child who, under the guidance of his more than ordinary mother, becomes a spook's aprentice. There are twists in the plot and the magical domain is well conceived. Unfortunately, the plot is rather straightforward, with young useless brat finding out he has unsuspected power. But they don't call it heroic fantasy for nothing, so , there it goes. I liked the series and I expect to read the third book (The Spook's Secret), released this year, as soon as I find it.

I've also read the first two Eragon books. While the fantasy world is very complex and well written (especially taking into account the age of the writer) the magic "technology" is a bit hard to wield. I hope the author refines the way it works in ways that don't turn ridiculous. Christopher Paolini is a young American writer of Italian origins, born from a wealthy family of book editors. He started writing Eragon at 15 and finished it at 19. It should come to no surprise that the book became a huge hit; it is well written, but the marketing of the book was intense and privately funded by the author's family. There is an Eragon movie due to be released in 15 of december this year.

A quick mention of Christopher Stasheff, a rather prolific fantasy writer, who tries a combination of magic and space science-fiction. Unfortunately I couldn't finish his first book (Escape Velocity), the first of the Warlock of Gramarye series, as I found the writing style rather annoying. I've read good reviews about his latest books, though, and I plan on starting a bit further up, maybe with the Rogue Wizard series.

The end. :)

The GridView is nothing more than an oversized DataGrid. The internal concept is completely rewritten, as far as I see, though. For example, Columns are not called columns anymore, they are DataControlField. Well, I stumbled upon one situation where I needed to format the autogenerated columns in a GridView. Normally, you could take the Columns collection and change the DataFormatString property for each column, but autogenerated columns (or AutoGeneratedField) are not part of the Columns collection. More than that, AutoGeneratedFields are nothing more than BoundFields with lots of useless restrictions on it like being a sealed class and throwing errors when trying to change some properties (like DataFormatString).

The first step is getting hold of the autogenerated column. Luckily the GridView control has a virtual method called CreateAutoGeneratedColumn which returns a AutoGeneratedField. So create a control that inherits GridView, override this method, take the generated field in the base method, change DataFormatString. I couldn't find any way to do that except with reflection. I noticed that the value of the DataFormatString property was stored in the ViewState of the AutoGeneratedField, so I used reflection to get to it, then I changed the value.

This is the code:
protected override AutoGeneratedField CreateAutoGeneratedColumn(
AutoGeneratedFieldProperties fieldProperties)
{
AutoGeneratedField field =
base.CreateAutoGeneratedColumn(fieldProperties);
StateBag sb = (StateBag)field.GetType()
.InvokeMember("ViewState",
BindingFlags.GetProperty |
BindingFlags.NonPublic |
BindingFlags.Instance,
null, field, new object[] {});
sb["DataFormatString"] = "{0:N}"; //or the format string you prefer
field.HtmlEncode=false; //see update
return field;
}


Update:
The BoundField object formats values differently depending on html encoding. If the html encoding is enabled, then the value is transformed into a string, then the formatting is applied. That means that number formatting will NOT work when html encoding is true.
That is why I've added the field.HtmlEncode=false; line above. A more secure option would be to make the HtmlEncode property depend on the field.DataType.

Update2:
While this works, I don't recommend doing it like that. I am using it because I have custom user controls that inherit from the GridView and I need to cover the AutoGeneratedColumns=true case. It is much easier to generate your columns yourself from the DataSource using BoundField objects (Or any other DataControlField objects) that you add to the GridView.Columns collection.

and has 2 comments
Welcome to another lesson in suckology! Today's topic is Manic Street Sweepers from Hell (or Bucharest).
When the weather is good I go to the office by bike. Yeah, I am a hot shot biker. My bicycle is state of the art junk and I can ride it even through major Bucharest street holes. Ok, I am being a bit unfair, as they are rebuilding all the streets now... So let me rephrase it: I can ride it even through destroyed streets that are in the process of being rebuilt.
When I first bought my bike it had no wheel protectors and I quickly realised that driving through wet or muddy terrain tended to leave a long straight line of wet dirt from my trousers bottom to the top of my head. So I bought these metal things that protect my wheels and myself from things like that. Now I can even go through moderate puddles and I only wet the bottom of my pants legs. Which is ok, I am tech guy, I'm married, I don't really need to look good. You did sense the irony there, right?
So everything was set for riding my bike. I could even hear the Queen song while going to work. To my immediate surprise I found the streets were wet! Not only in the morning, when I go to work, but also in the evening when I return. The culprits seem to be [echo]Street Sweepers!

Ok, a small technical paranthesis. All this is done to protect the mighty citizen from dust. Or so they say, actually, this is more of a EU directive or standard and, as we Romanians love to brown our noses, the City Hall felt compelled to comply. Street sweeping, in theory, should be done to clean the street of debris (by using machines with brooms) which also employ some system to keep the dust from rising up while brooming. Most employ water, the most advanced use vacuum generation and filtration.

Well, Romanians decided to split this process into two separate parts: one machine wets the street, the other sweeps. Even better, while one wets one street, the other sweeps another. The result is dry sweeping that generates immense quantities of air borne dust and wet pavement. As you might not be familiar with Romanian technology, let me explain to you what these street wetters looks like: big water containers with sprinklers. And not your average street wetter sprinkler system with a row of small water sprays, but one big water pipe with holes in it!
What this does is create huge puddles of water in the crossroads, where the trucks stop, but the drivers are too lazy/stupid to also stop the sprinkler system. Also the roads are far from flat, so in all the little depressions in the asphalt other puddles occur.

Well, how does this affect me and why these abominations suck? Let's take them one at a time:

  • water makes my bike skid on the pavement. While this might be acceptable in other countries, with flat roads, maybe even with bicycle lanes, in Romania you have roads with waves, especially on the sides, no bicycle lanes (and the only one in Bucharest is used by old people to walk on) and the sewers are right in the pavement, they look like big square 5-10 cm deep holes. So, if on bicycle, you might want to break from time to time

  • water makes cars skid on the pavement. It's actually called hydroplaning, when the water goes between the car wheel and the road. Some drivers might want to control or at least stop their car when they wake up and see they're on a collision course with a bike.

  • new research shows that water on the pavement elevates the temperature comfort level, making it even easier to affect oh, let's say, people that drive on the said roads when the heat is up and don't have air conditioning in their car. Or a car.

  • there is no way to get around a street wetter with the bike. The only solution is to wait until all the cars go past it, then go all around the other side of the street to avoid getting sprinkled. Luckily, these dumb ugly beasts are slower than my bike.



My obvious conclusion is: Street sweepers suck!
I am citing from a random link: PM-10 / PM-2.5 class street sweepers are in a developmental stage. This type of sweeper will pick up dust particulate down to 10 micron is size. The city's Envirowhirl PM-10 street sweeper utilizes a combination of mechanical and air sweeper features to pick up debris. They also utilize an internal system of dry filters to retain all dust larger than 10 microns within the sweeper's hopper. No water is used for dust control.
I hope they bring something like this in Bucharest soon and that it doesn't suck. Much.

and has 0 comments
'Crocodile Hunter' Irwin killed

An incredible and sad news for me, Steve died from the sting of a stringray that (ironically) has venom with no lethal effect on humans. The barb on the end of the fish tail has up to 20 cm and it probably penetrated the heart or has hurt some other major organ in the chest area. Steve is the second man ever to die from a stingray in Australia, the previous death being in 1945. Ironic, stupid, sad.
It is amazing that his death affects me so much, when other big people's deaths have only made me a little sad. Maybe it's because he was young, in the middle of his life, having so much to look forward to. I've also admired his insane passion. I am rarely passionate about something and I admire any person that can shine a little, like Steve seemed to do 24 hours a day.
At least his memory will remain intact from the ravages of old age. My deepest condoleances to his wife and two children.

You know the annoying feeling when you want to find something on the net and you can't find the proper search keywords? It's like trying to find the Triple X movie rather than porn flicks. It happends a lot when you want to find something that you know is named in some way, but a new buzz word is emerging and you either don't find everything you need or you find a lot of unrelated stuff. Like trying to find people talking about computer programming, but you end up with all these TV programming sites. Now try to find how to turn your PC into a TV by programming :).

Anyway, searching on programming led me to wonder about the difference between programming and software development in describing my own job. As previously mentioned, there are other sorts of programming and development except computer ones and to top it all, people mean different things when using these concepts in the software context. Wikipedia, for example, takes "programming" and gives me the page for "computer programming". It then takes software development and takes me to software engineering (which in my mind are different things).

How does google see this? Let's search:
TermPage count
Software development175.000.000
Programming858.000.000
Computer programming19.700.000
Software engineering80.700.000
 
Software developer27.400.000
Programmer156.000.000
Computer programmer4.270.000
Software engineer22.500.000
Developer1.030.000.000

So it seems that there is a lot more programming and programmers than software development or software developers, but add "computer" in front and there is less. But that's because no one bothers to say "computer" in those cases.

And there is more. While software development/engineering start to go towards "designing programs", computer programming goes towards "typing code". I believe that is happening because in large software companies there are a lot of people writing code, but very few that actually have a say on how the program is to behave or what technology to use. I am watching Microsoft presentations and they are ridiculing the "old school" programmers that type their code while the new breed of software developers point, click, drag, drop and everything works in a few minutes. People that actually think through what algorithms to use and how it all works and optimize lines of code and try to think like a compiler from time to time are grunts to be enclosed in cubicles, while those who think how the general program should work, create UML diagrams of interacting business objects are the lords of their domain.
That makes no sense to me, especially since the drag and drop people use software delveloped by code typers. Or it does make sense in the way that software development has become a feudal industry, like most industries become shortly after they become mass consumed. They have an elite, a clique that behaves like aristocracy, while most members of that industry work their asses off in the employ of these people. This gives a whooole new meaning to the term software revolution :)

So what is this job that I am performing? Am I just a meta-computer? Something high level that understands what it must do and obeys blindly by using a computer? Why is it that I like to code? Is there a difference in my mind between software and a program, so that the term software developer scratches my ears while programmer boosts my ego? And why do most people feel the other way around?

These are questions that I will probably be asking for a long time. Meanwhile, take a look at this wikipedia page, which I found informative: Programming paradigm. Also, consider this little link: Javascript 3D where you can find the explanation on how to do a Wolfenstein like game in Javascript, with only 5 kilobytes of code. You might want to wait a bit until it loads completely or use Mozilla Firefox. I noticed it works faster. Can't believe it? Check it out! That's what programmers do!

and has 1 comment

I have just returned from a holiday in Balchik, Bulgaria, and this is my view on it.


You might have seen a commercial or heard a friend that Albena and Balchik are a great place to visit and spend your holidays. Even if they are separated by only 10 km the difference between them is the difference between heaven and hell.

Albena is the standard seaside commercial resort, with wide beaches occupied by a string of expensive hotels, with jerks attempting to speak to you in your native language while trying to sell you junk at high prices, a place invaded by tourists and with poor service at any shop, as they are owned by companies and operated by hired help. The useful things you can buy at Albena are of very little variety, meaning that almost every shop has everything you can buy, all drinks are either Pepsi or Coca Cola, etc. Albena is a franchise, and besides the natural reserve (which is a nice forest patch) and the Thracian treasure (that I didn't really go visit), there is nothing nice there.

Balchik, on the other hand, is a small piece of paradise. It is actually a town, a rather old one, with small houses (and villas) sprinkled onto an almost abrupt seawall. The beach is very small and private, while the shops in the area are operated by their owners, which are usually very nice people. The prices are almost half of anything you meet in Albena and the tourist numbers are small during the week and medium during the weekend. Another good thing about Balchik being a town is that you have both seaside hotels, small villas, large villas, apartments for rent or purchase, high profile restaurants, small cozy restaurants, cheap supermarkets, etc. So you have everything you need. The view is spectacular, with a tasteful combination of mountain and sea.

In conclusion, I highly recommend Balchik as a holiday destination or (as I fantasised during my stay there) a remote place where you can buy a house or apartment and write in the quiet atmosphere of the small town.



Now, for the detailed impressions from Balchik

Leaving Bucharest


Both me and my wife wanted a nice holiday where we get to experiment as much as possible, so we decided against an "all inclusive" package. So we arranged with people from Balchik to house us, while we took transportation separately. Searching on the web, we stumbled upon Balchik Holidays, a site owned by a young nice couple, Val and Marta, operating a small local tourism company with very decent prices. As you will see later on, they treated us fairly and nice and we recommend them if you need to make similar arrangements. We decided on Corali as a transportation company. Our opinion of them is poor to very poor. They are plagued by lack of proper organisation, delays in transport and drivers that don't know the cities they pass through. I will give them the benefit of the doubt, though. Maybe there are situations when they perform well, but this was not one of them. Unfortunately, I can't really imagine a Romanian company that would do a lot better, so don't expect too much from the trip to and from Balchik by bus. It could be a good idea to look for a company that goes to Albena, then get a 4 leva bus to Balchik.

The bus left Bucharest at 8:30 and, enough said, arrived in Balchik at 18:00. The bus started from somewhere in Transilvania, though, so there are people who spent a lot more in the bus than we did. Immediately it became apparent that the well organised passenger list contained 51 names. The bus itself had 50 seats. That meant that one lady got her money back and spent the entire road on a small chair with no back placed amidst the rows of seats. I also don't know who makes these buses. While they look nice and are air conditioned, I couldn't fit my legs properly the entire trip. Even if I am a rather tall guy, the length of the femur bone shouldn't be much bigger than the one of a smaller guy, the lucky guy the buses are designed on. I think the highest age at which I would have been comfortable in those seats would have been 14 years old.

Ok, enough with the seats. The bus starts from Bucharest, goes to Constanta, leaves the country through Vama Veche, then proceeds to Balchik. The highway to the sea is not yet finished, so there were delays there, then the customs, which must be "greased" to let us through. The customs officers reached a so high level of comfort that they took money while we all looked through the windows of the bus. We could have had cameras or something, but they didn't care.

Once we reached Balchik we were deposited in a parking lot placed in front of the road towards the Botanical Garden. If I am to continue my religious analogies of heaven and hell, that spot is purgatory. It is the most 'Albenised' place in Balchik. You have restaurants that boast their menus along with greetings in Romanian and waiters that try (annoyingly, I might add) to speak Romanian or whatever your native language happens to be. The prices there are medium to high, the service depends on the place.
For example I was terribly disappointed by the service at Taraleza, a small restaurant that was praised in a Romanian TV news story. The only Romanian they knew was in the greetings outside, the prices were high, the crab rolls they gave us make my wife sick, the tripe soup they gave us had very little tripe in it and (what bugs me most) I asked them for garlic and they brought me a small cup of a clear liquid. They refused to bring me sour cream, they said the soup had enough (as they would know). I poured the entire cup in the soup, only to find it a moment later uneatable. The 'garlic' sauce was garlic in vinegar.
The Sea Horse, the restaurant right in front of the parking lot, had the same tripe soup (even the amount and shape of the tripe bits were uncannily similar), but they brought dried red pepper bits and a sauce that contained yoghurt, as well as garlic and , of course, vinegar. That was more acceptable and I could even feel the garlic inside.
As a parenthesis, Tihia Kat, or at least this is how I remember the name, a serbian grill restaurant on the seaside, have a garlic sauce made from sour cream and very little garlic.
But back to the parking lot, except for their monetary exchange, you shouldn't really use anything there. Besides, when you will leave Balchik you will have extra levas (the Leva is the Bulgarian money) and you will have to wait for the bus (which will be late) so you will be forced to sit somewhere.

Balchik


When the bus entered the town, we got scared. There were communist style blocks of flats, really ugly ones, and dirty garbage filled road sides. But that's just on the outskirts. As you will see, Balchik is actually made of two distinct parts: the side near the sea, which is the old part of the city, with houses and queen Maria's summer residence, and the expansion zone, where you will have blocks of flats, schools, a large super market, etc.
Our two rooms apartment was 500 m from the beach, as advertised. What was left unsaid is that the road is a continuous hill at maybe a 30 degrees slope. That resulted in muscular pain for the first two days, but we quickly got used to it. What was unexpected was that the pain felt in the lower part of the leg, which is actually very little exercised. And I should know, I ride my bicycle to work.
This side of the city is a combination of modern construction techniques and old stone roads and walls. If you are a computer programmer and you build maps for 3D games, like shooters or, better yet, quests or MMORPGS, then you should definitely go to Balchik and your software company should pay for it. There is something to be said about stone stairs that are hidden from view by the fact the walls are made from the same exact material. If you stay more than a day or two, you will come to know not only the streets, but also these hidden stairs that you can find all over the place.
We also had TV cable in our rented apartment. Something was wrong with it, though, as only a few channels were clearly visible. And, even if I did want to relearn Bulgarian, I couldn't watch anything but National Geographic, Zone Reality and Viasat History. I even stumbled upon a show about a bus going down hill without breaks, entering the water, skidding 80 meters, then drowning most of the people in it. Nice show, huh?
Val and Marta were very nice, they took us for a dinner and they explained the main things we needed to know about the town, then they gave us the house keys and left us be. They weren't a bother in any way and hopefully, neither were we to them.

Holiday


There was sun there. And lots of it. If it weren't for my wife, I would have cowered in fear in the room, trying to fix the cable. Luckily, she rules my life, so I went down to the beach every morning, then we ate in a restaurant, then we had long walks through the city. If you are like me, you should not disconsider the power of the sun lotion. They seem to have different strengths marked by weird numbers. Just take the highest strength you can find and put it all over you. Else you get your skin burnt. And, if you are like me, you hate having oily things on you that smell like flowers and squeezed animals. Get over it. Not being able to touch anything or having any type of water except very cold one seem hot is not cool. (Pun not intended)
Balchik is truly beautiful. Formerly part of Romanian territory, it was chosen by queen Maria for her summer residence. That means a huge domain was filled with beautiful gardens and a few nice mansions were built. The buildings themselves are not interesting, the small trinkets that are linked to the queen or to her house are nothing more than money wasters, but now the domain was turned into a Botanical Garden. Even if less organised than the one in Bucharest, it is a lot more interesting. It combines slopes, plants of all kinds (including cactae), water falls, a high view of the open sea and the all present stone stairs and hidden passage ways.
The town itself looks a lot like a more crowded version of Maria's residence, with fisherman style houses sprouting amongst the stone roads and plants. This is something that the Romanian seaside lacks: plants. Even Albena had beautiful trees and forest patches near the sea. Romanians destroyed everything that wasn't cheap commercialism.
The prices were all in leva, which was more or less half a euro, and stotinki, hundredths of a leva. Energizer drink: 1 leva. Average restaurant meal: 7 leva per person. Taxi ride: 1-5 leva (for the same distance). Beach umbrella: 3 leva. Beach chaiselong: 3 leva. (as opposed to Albena where a chaise was 5 leva, a pillow was 3 leva, an umbrella 7 leva, etc.) Evening meal from the supermarket: 5 leva for two people. Restaurant bread slice: 20 stotinki.
I have no idea why every Balchik restaurant asked us for the exact number of bread slices we wanted. I asked smilingly for one bread and they brought me a slice. When I asked for ten slices all the waiters turned towards me like they have seen the devil. "Are you sure?".
The sand on the beach was very fine, as well as the sand beneath the water. There were two days after what we gathered was a storm in the open sea, when the shallow water was filled with algae fragments, but it wasn't terribly annoying. The entire Golden Sands-Albena-Balchik beach is in a golf, so there are no big waves and the beach is somewhat protected. The water was warm and pleasant.
People on the beach ranged from very fat people coming in families to skinny young girls. Not many girls, though. The ones that were acceptably attractive were more slim than sexy. There is no distinctive Bulgarian genome. People can look like Turks, Russians, Romanians or anywhere in between. Balchik has amazingly few gypsies.
Language: all Bulgarians know Bulgarian. Some of them understand English, some of them understand Romanian. I guess that some of them understand German, since all the menus were in Bulgarians, English and German, but I didn't try it out.
Music. I have been informed that a few months ago there was a rock festival in Balchik, White Snake and The Scorpions sang there. But I found that this was not a good enough explanation for the fact that almost every song in the town was an American 60-70's song. It wasn't annoying, but it was uncanny. I've even imagined Teal'c observing that the music technology of the planet seemed to be 30-40 years behind our own.

The Dark Side


Search for the supermarket Akvilon, on Hristo Botev street. It marks the start of the dark side of Balchik, the place of ugly grey blocks of flats. They do have regular cable and internet, though. Akvilon does provide for anything you need, as it is similar to Billa or MegaImage shops. The prices are lower than anything you get in the old part of the city, but not by much.

The End


We left on monday, the bus was supposed to pick us up at 18:30 from the parking lot, they were there, but only arrived in Balchik. We had to wait until 20:00 for them to go to the Golden Sands and Albena, leave their passengers, then return. We arrived in Bucharest at 2:00 in the morning.
What else can I say except thank you for sticking to the very boring end of my notes on Balchik. Maybe I will add more as I remember.

Special Notes



    • Cats - Balchik is a town of cats. Everywhere you go you meet a cat of any conceivable color except green. Most are accustomed to humans and grateful for any petting, playing or, of course, food

    • Bread - restaurants give you bread in slices. They ask for the exact number of slices. One bread means one slice.

    • Ayran - in Romania, ayran is a liquid yoghurt drink with salt. In Bulgarian, airan means yoghurt. So you will be able to see Danone Airan. They do have a sortiment of liquid salty yoghurt that is very tasty in rather unpleasant plastic 500ml or 250ml bottles. Ask for airan at Morsko Oko. They used this variety. Then you can buy it at a supermarket

    • Boza - there is a drink made (I guess) from sweetened wheat called Boza. I can't imagine any person except an insane child that could drink boza and like it.

    • Music - most places were tuned to Radio Edno (radio 1) and they played mostly songs from the 60's-70's.

    • Garlic - beware the garlic sauces. They are likely to contain less garlic and a lot of vinegar

    • Romanian speaking waiters - beware! Even if there are some exceptions, Bulgarians trying to communicate in Romanian usually want to sell you overpriced or under quality stuff

    • Taxi drivers - good luck trying to convince them to start their meters. Try not to give them 5 leva for a trip.

    • Botanical Garden/Maria's Castle - you may be intrigued by the ticketing system there. You need to buy a ticket of 10 leva to see a small garden, then advance to a ticketing booth to get another 10 leva ticket for the castle and the actual botanical garden. At the entrance to the castle you will be asked for both tickets. You can't buy them there, you need to go back 10 meters to the above mentioned ticketing booth

    • Muscular pain from climbing up and down Balchik streets - a massage helps, try pressing more on the painful parts. It doesn't help too much though. Walking another day is useful, also.

    • Bus rides - if you are taller than 1.80m, ask for special seating for your legs.

    • Car rides - the Balchik streets are at 30 or more degrees slope. Drive carefully.

    • Toilets - most of the bars and restaurants in the town have the annoying habit of charging for the use of their toilets

    • Albena - it sucks. If you want to go there, there are regular minibuses to Albena, Golden Sands or Varna

    • Recommended restaurants: The Blue Lion , Morsko Oko

    • To avoid: Taraleza, the Irish Rover, the cafeteria in front of the Irish Rover, the bar in Queen Maria's residence.

    • You might notice in Balchik a lot of printed A4 posters glued upon light poles, gates, bulletin boards, etc, representing dead people and when they died. It seems to be a local habit of commemorating the deceased.

GridView Export to Excel Problems

This guy researched why simple methods like export datagrid to Excel don't work with GridViews or other controls. I have also stumbled on this stupid error when trying to use RenderControl to get the output of a UserControl.

Apparently, the entire problem lies with the
Page.VerifyRenderingInServerForm Method
which throws an exception if the page is not currently in the render phase of page processing, and inside the <form runat=server> tags.

Luckily it can be overridden. Here is the bug posting at Microsoft and their suggested solutions. Microsoft removed the page, so I can't show it to you.

This is the actual code for the method in the Page control in NET 2.0. Just override the hell out of it.
public virtual void VerifyRenderingInServerForm(Control control)
{
if (this.Context == null || base.DesignMode) return;

if (control == null)
{
throw new ArgumentNullException("control");
}
if (!this._inOnFormRender && !this.IsCallback)
{
throw new HttpException(System.Web.SR.GetString("ControlRenderedOutsideServerForm", new object[] {
control.ClientID,
control.GetType().Name
}));
}
}

and has 0 comments
Business - Redefining How Software Works

REST (Representational state transfer)

Representational State Transfer

Probably what I am saying here is naive, as I hate XML and don't quite understand the full scope of things like REST, but from what I managed to gather, this system has a few possible advantages: good caching, good division of resources (both computational and data) which should allow for better user in multitask/multiprocessor systems, true native use of XML (or any other format :D), therefore saving a lot of time from serializing, instantiating, deserializing, etc.

If what the first article says is correct, this would prove to be a system both adaptable and scalable, something that programmers seek all the time. It can be spread out on more computers on a net or used on the same computer, with more efficiency and easy of programming than the dreaded web services or SOA.

Personally, I think I wouldn't particularly like programming in a REST way, but one never knows.

and has 0 comments
WinDirStat - Windows Directory Statistics

WinDirStat is a little useful program that creates a graphical representation of one's harddrive. It uses colored rectangles to represent directory structure, file size and file type. You can click on the rectangles and see what the file is, zoom in and out, etc. What's mostly useful for is seeing the big space wasters as large rectangles and being able to identify them. I am still not sure what Unknown space is, but I have 6.5Gb of it.

and has 0 comments
A good friend of mine was telling me when we were in highschool that people are made out of different personalities, each alive and fighting for control. He called them rather pompously infrapersonalities. They all define you in some way or another and the "you" is not a simple sum, but a warped weighted average.

Taking the reasoning further, I reached the conclusion that the way we perceive other people is also encapsulated in a hostage personality that describes that person. We don't relate to the actual people, but with our projection of them. Of course, that applies to everything, not just people, but it's besides the point I am trying to make.

What if you spend a lot of time defining such a person? Doesn't it mean the associated infrapersonality "gains weight"? It becomes more alive inside you. There is even a disorder when people switch from one dominant personality to another.

But what if you had feelings for that person? Could its infrapersonality remain alive, evolving separately inside you? Of course it could. And then, why can't you retain the feelings you had for that person if it is alive and so close to you?

I end my reasoning here. I completely pass the (important) point that even if you do love a living and existing person it is still a feeling related to an internal representation of that person. At least it gets updated. Can one projection of another person make you continue to be in love with it, in the absence of that person? I think it can. Worse, I think it is happening to me, and that makes me (even more than you possibly thought) in love with myself. Bummer, huh?

and has 0 comments
It just occurred to me that the biggest problem on Earth is not war, but the unending talks that come afterwards. Therefore, I propose a UN resolution that bans war. If any country starts a war without being sanctioned by the UN, it is to pay. And pay a lot. No, the answer is not military retaliation or anything, but money. Each unsanctioned war day is to cost between 10 and 100 million EUROs.

The solution is both simple and elegant. If you need to start a blitzkrieg, do it, just make sure to pay afterwards. You want to go to a country, bomb its infrastructure, steal its oil? No problem, just make sure you win more than you pay to the UN. You want to stall the peace talks? Ok, but do it on your own money. You don't agree to pay? Just forget about exporting or importing anything.

Of course, there is a catch. Lately, no conflict was called a war. Therefore a clear definition of it is also required. That would help mentally challenged leaders to use the right words, too. What's my definition of war? Any conflict outside your borders perpetrated by the national armed force.

What about Hezbollah? you will ask. They attack outside the Lebanon borders and are not the official national armed force. They should be off the hook. Yes, you heard me right. Israel wants retaliation, do it with a private force of people payed or otherwise motivated to do so. In other words: pay for it!

And if you don't want to pay, ask the UN, NATO, or any other legitimate international force to sanction your need for blood or solve your problems or whatever. We can't wait for politicians to solve a problem WHILE the problem exists. They move slow, they have no foresight and their hindsight is limited to what helps them look good. Use preemptive measures: any war costs. Don't forget that the military and the politicians are ruled by the same type of people that rules everybody today: suits! The modern name for aristocracy. And they only care about one thing: money!

Accessing Row based data in an efficient and maintainable manner - The Code Project - C# Database

This is a nice and simple article about accessing data from a lot of datarows. While using the string index will make the code more readable, using the integer index will make the code faster. The solution? Get the numeric indexes at the beginning of the loop, based on string indexes. Assert the indexes exist for better debugging. Very elegant. Also, check out the user comments, which are pretty good and to the point.

Code example:

int customerIDIndex = table.Columns.IndexOf("customerID");
int customerFirstNameIndex = table.Columns.IndexOf("firstName");
int customerLastNameIndex = table.Columns.IndexOf("lastName");

System.Diagnostics.Debug.Assert(customerIDIndex > -1,
"Database out of sync");
System.Diagnostics.Debug.Assert(customerFirstNameIndex > -1,
"Database out of sync");
System.Diagnostics.Debug.Assert(customerLastNameIndex > -1,
"Database out of sync");

foreach(DataRow row in table.Rows){
customer = new Customer();
customer.ID = (Int32)row[customerIDIndex];
customer.FirstName = row[customerFirstNameIndex].ToString();
customer.LastName = row[customerLastNameIndex].ToString();
}//end foreach