Thursday, December 20, 2007

SQL, Joins, Unions and more .. continued II

Last night I decided to let MySQL think about that query ... It seemed to have completed calculations in the morning. Not surprisingly it has returned the very same data like did the MS SQL - The multiplication of the results. But it has taken 6604156 milliseconds (~6604 seconds) to obtain the result. The same result that MS SQL EXPRESS returned in 274709 milliseconds (~275 seconds).

No further comments.
Case closed.

Wednesday, December 19, 2007

SQL, Joins, Unions and more .. continued

Hi again.

Today I made a test - transferred the data into MS SQL Server 2005 Express SP 2.0.

Guess What ? :)

The situation is almost the same ! Wondering why the result was messed, the execution time was arround '274709' - I guess this is the "ms" - "duration" column in the MS SQL Server Profiler. Which is arround 5 minutes.
The mess I am talking about is the following:
The situation is that in of the tables I have about 120k records, which should be displayed, on the other one I have about 5k records. Insted of showing "120000" for "di_count", and "5000" for "ei_count", in the result I got '594163480' (which is the number of rows in one of the left joined tables multiplied by the number of rows in the other one) for each of them - the same figure for the two columns. What is that ?

I just want to make a select from one table, than join second table, then join third table to the FIRST one, then join the last table AGAIN to THE FIRST one. Why is it joining the result alltogether?

Anyway .. using UNION, VIEW and work with the VIEW solves the problem, but I was just wondering why this happens ...

I j ust can't help showing you these two screens:

For the MSSQL Profiler:


And for the MySQL (note: the execution is still not finished!):


I have no comment!

Tuesday, December 18, 2007

SQL, Joins, Unions and more

Ok, this is will be about MySQL once again.

I had that problem. Let's assume we have 3 tables:
1. smetki
2. di_invoices
3. dk_invoices
4. ei_invoices

Each of the XX_invoices has a "foreign_key" to PK of "smetki". I am using MyISAM.
If I perform the following 3 queries separately:
s.smetka_id, s.created_on,
count(di.invoice_id) as di_count
smetki as s
left outer join di_invoices as di on (s.smetka_id = di.smetka_id)
s.created_on between '2007-12-10' and '2007-12-15'
group by

s.smetka_id, s.created_on,
count(dk.invoice_id) as dk_count
smetki as s
left outer join dk_invoices as dk on (s.smetka_id = dk.smetka_id)
s.created_on between '2007-12-10' and '2007-12-15'
group by

s.smetka_id, s.created_on,
count(ei.invoice_id) as ei_count
smetki as s
left outer join ei_invoices as ei on (s.smetka_id = ei.smetki_id)
s.created_on between '2007-12-10' and '2007-12-15'
group by
I have no problem, I have proper indexes and I got the results for less then 200 ms from each query.
But I need the 3 results into 1 single resultset so I decided to make a join like that:
s.smetka_id, s.created_on,
count(di.invoice_id) as di_count,
count(dk.invoice_id) as dk_count,
count(ei.invoice_id) as ei_count
smetki as s
left outer join di_invoices as di on (s.smetka_id = di.smetka_id)
left outer join dk_cor_invoices as dk on (s.smetka_id = dk.smetka_id)
left outer join ei_invoices as ei on (s.smetka_id = ei.smetki_id)
s.created_on between '2007-12-10' and '2007-12-15'
group by

Now I have query which executes more than 15 minutes !! I couldn't wait to the end and killed it. There must be something wrong somewhere?
I sould notice that for the given period there are only 6 rows in the "smetki" table, and different number of rows in each xx_invoices table that correspond to the whole resultset from "smetki". I have to mention that there is one intersection between two of the XX_invoices tables where there are about 120k rows for one "smetka_id", and for the same "smetka_id" there are about 5k rows in the other.
Also - there are no other queries running by the time of measuring the performance.

What could be the solution. A friend of mines helped me. Make a UNION he said. So I did it like that:

s.smetka_id, s.created_on,
count(di.invoice_id) as di_count, 0 as dk_count, 0 as ei_count
smetki as s
left outer join di_invoices as di on (s.smetka_id = di.smetka_id)
s.created_on between '2007-12-10' and '2007-12-15'
group by
s.smetka_id, s.created_on,
0 as di_count, count(dk.invoice_id) as dk_count, 0 as ei_count
smetki as s
left outer join dk_invoices as dk on (s.smetka_id = dk.smetka_id)
s.created_on between '2007-12-10' and '2007-12-15'
group by
s.smetka_id, s.created_on, 0 as di_count, 0 as ei_count,
count(ei.invoice_id) as ei_count
smetki as s
left outer join ei_invoices as ei on (s.smetka_id = ei.smetki_id)
s.created_on between '2007-12-10' and '2007-12-15'
group by
s.smetka_id )

OK, but now I have 3 rows for each single "smetka_id" - one row for the results from each table. And then we decided to make a VIEW over that UNION.

Gues what. Now I have the simple query:

select smetka_id, sum(di_count), sum(dk_count), sum(ei_count) from v_test group by smetka_id

Which returns me the desired result for less than a second !

I hope this would help your daily work with MySQL and SQL in general.

Wednesday, October 31, 2007

An Inconvenient Truth

Lot friends of mines were telling me that I should watch that movie (also in wikipedia). I recently had the chance! And it really worth!

It's a documentary film about climate change, specifically global warming, presented by former United States Vice President Al Gore. There are lots of numbers and facts that can make you reconsider some aspects of your living.

So I urge you to watch this movie!


Hello again ;)
I ran into a tricky situation last couple of days. I have some big tables with varchar fields where I have to JOIN ON varchar fields. The problem does not concern only the JOIN - it is a general problem using varchar / text fields used to be searched one way or another.

So - the situation: We have one table with about 1M rows (relatively small amount data for each row ~90 bytes) on one hand. And another table with records to be matched - about 100k rows (relatively medium amount of data for each row ~ 500 bytes). We do a SELECT which JOINs the two tables based on VARCHAR columns. Do not ask "why?" - This is the business logic; it cannot be otherwise (at least in the beginning). If we index the columns we will got the results fast! What is fast? Less than 50 ms to get around 200 joined rows. Well, OK, you got me - it depends strongly on the hardware configuration and MySQL settings. Let's assume this is our limit. I was very happy to discover that it works that fast. The speed is critical, because we will need to join around 100k rows.

Where is the problem then? Well, it happened that the first table is populated with another several hundred thousand records and it became with about 1.9M rows. And? And, it appeared that the MySQL should copy the temp table on the hard drive. As you can guess - the result is: 204 joined rows (not 204k, but only two hundred and four) for ..... 417 seconds. What about 100k rows? Killing me.

What can we do about that? Well, I know (the business logic predicts) that the first table - that with about 2M rows would never have more than 4 million rows. I also noticed that partitioning is only partially supported in the beta (RC yet) of MySQL 5.1.x, but the recommended for production environment is 5.0.x which does not support partitioning. So, I discovered the great options MAX_ROWS and AVG_ROW_LENGTH. Which does what - it says to the MySQL engine, that this table would never have more than MAX_ROWS tows, and the average row length would be AVG_ROW_LENGTH. You can find the average row length by executing the command SHOW TABLE STATUS FROM [DB_NAME] LIKE 'TBL_NAME'. So, if you know, if your business logic predicts that you will have a large table, BUT this table will have relatively known content (like it will have not more than 4M rows), and you know the average row length, you can set the MAX_ROWS and AVG_ROW_LENGTH for that table. The AVG_ROW_LENGTH is required if you have blob/text/varchar fields.

That will cause the MySQL engine to optimize the space required for that table, also optimizing the myisam_data_pointer_size, which sets the number of bytes used for internal row pointers. Yes - it works only with MyISAM tables. But you will be surprised. After I set the MAX_ROWS and AVG_ROW_LENGTH on that table with the 2M records - I got a surprising results - 90k joined rows for ..... 47 seconds !!

I think I will use these options often in the future, what about you?

Friday, September 14, 2007

Skype is sniffing ? You must be kidding me!

Guess what! The little tricks of skype does not have an end ... The Linux users of Skype recently discovered that it is reading the /etc/passwd and firefox profile files. COME ON? Do you continue using Skype?

The original post is here:
And some explanations can be found here:

But I seriously consider using Skype ...

Do you?

Tuesday, September 11, 2007

FileSystemWatcher problem

Did you have a task for monitoring files?
The FileSystemWatcher class has a great features, but also some outages. The problem is that creating/copying/moving files arround is hard taks and the watcher raises couple of events.
The most important events in my case were "created" and "changed". The problem is that the "Created" event is fired when the file is started being created, not when finished being created. After the created, there would several "changed" events depending on the file size. So how could we possibly know when the file is realy created, full and ready to work with it?

There are several posts and examples arround the net like:

What is my approach?
After catching any event - you just stop monitoring for FSWEvents and start a timer. On every tick you try to open the file for reading. If you cannot - increase the timer interval. You can also add a code to monitor the total time elapsed since the first try to open the file, but the provided code does not do that.

So here it is - one of the approached to more correctly monitor for files:


using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Security;
using System.Timers;

namespace MonitorTest
    public class Program
        private FileSystemWatcher _watch;
        private string _watchPath = @"d:\temp\";
        private string _watchFile = "SomeFile.txt"
        private Timer _timer;
        private DateTime _started;
        private TimeSpan _totalTime;
        private void StartTrying()
            _started = DateTime.Now;
            _totalTime = TimeSpan.Zero; 
            _timer = new Timer();
            _timer.Interval = 1000;
            _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
            _timer.Enabled = true;
        void _timer_Elapsed(object sender, ElapsedEventArgs e)
            string FullPath = string.Format("{0}{1}", _watchPath, _watchFile);
            FileInfo fi = new FileInfo(FullPath);
            StreamReader r = null;
            _totalTime = DateTime.Now - _started; 
            Console.WriteLine("Trying? {0}", _totalTime);
                r = fi.OpenText();
                _timer.Enabled = false;
                Console.WriteLine("File is free for reading after: {0} timespan?",_totalTime);
            catch (IOException ioex)
                Console.WriteLine("Cannot open ? {0}", ioex.Message);
                _timer.Enabled = true;
                _timer.Interval += 1000;
                if (r != null)
        private void OnChanged(object source, FileSystemEventArgs e)
            // Specify what is done when a file is changed, created, or eleted.
            FileSystemWatcher wo = source as FileSystemWatcher;
            FileInfo fi = new FileInfo(e.FullPath); 
            if (wo != null)
                switch (e.ChangeType)
                    case WatcherChangeTypes.Changed:
                        Console.WriteLine("File {0}{1} was changed? {2} 3}", _watchPath, _watchFile, fi.LastAccessTime ,wo.NotifyFilter);
                        _watch.EnableRaisingEvents = false;
                    case WatcherChangeTypes.Renamed:
                        Console.WriteLine("File {0}{1} was renamed? {2}",
_watchPath, _watchFile, source);
                        _watch.EnableRaisingEvents = false;
                    case WatcherChangeTypes.Deleted:
                        Console.WriteLine("File {0}{1} was deleted? {2}",
_watchPath, _watchFile, source);
                        _watch.EnableRaisingEvents = false;
                    case WatcherChangeTypes.Created:
                        Console.WriteLine("File {0}{1} was created? {2}", _watchPath, _watchFile, source);
                        _watch.EnableRaisingEvents = false;
        public Program()
            _watch = new FileSystemWatcher(_watchPath);
            _watch.Filter = _watchFile;
            _watch.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
            _watch.Changed += new FileSystemEventHandler(OnChanged);
            _watch.Created += new FileSystemEventHandler(OnChanged);
            _watch.Deleted += new FileSystemEventHandler(OnChanged);
            _watch.EnableRaisingEvents = true; 
        static void Main(string[] args)
            Program p = new Program();

Wednesday, September 5, 2007

Another SKYPE issue ...

Do you know the Debug View ?
It is a very usefull application by Microsoft. You can watch for all debug info sent to the "Debug output".

So, I was looking for debug output from some of my projects and I noticed some strange "PING/PONG" messages. The next thing I saw was some names from my Skype's contact list. Amazing ...

Shouldn't they build Skype end product in "Release" configuration and suppress all these debug output messages ?


Saturday, August 11, 2007

ActionScript 3.0 / Flash 9

Great surprise for all of us who in the years got used with ActionScript 2.0. First of all - we cannot apply actions directly to the movie clip (so forget about the really simple on(release){...} ).

If you click on a movie clip and you have the "Actions" window opened you will notice "Current selection cannot have actions applied to it"! At first it is irritating, but it seems to be a good point.

So how to make a "RollOver", "RollOut" etc. effects in AS3 ?

The first what we do - we have to import the Events package:


Now lets assume we have the movie clip on the stage and we named it "mymc". What we have to to is to add event handlers to it to listen for events:

mymc.addEventListener(MouseEvent.ROLL_OVER, RollOverHandler);
mymc.addEventListener(MouseEvent.CLICK, ClickHandler);
mymc.addEventListener(MouseEvent.MOUSE_OUT, RollOutHandler);

There is a set of predefined constants in the MouseEvent object, which we can use.

The next step is to implement the event handlers. Here is the simplest implementation of an event handler:

function RollOverHandler(me:MouseEvent):void { = 1.0

I would rather call the type of "me" MouseEventArgs, but it's another story. What do we have in the MouseEvent variable is the "target". The "target" is the object that has escalated the event. Now we can say to that target what to do. We can say for example:, or;

OK, that's it so far. Hope to have more to write soon ;)

Friday, August 10, 2007

Thursday, August 9, 2007

Flash 9 fullscreen mode and transparent movie

A long time not writing, hyh ...
Tough times ;)

Anyway, the last couple of hours I struggled with the problem: "allowFullScreen"=>"true" to enable full screen video playing in one of the latest projects I had. When I use the original generated code from the "Publish" in flash I have no problems. But when I tried with SWFObject I ran into trouble.

The full screen mode did not work... at all ... I examined the generated code (using FireBug and IE DevToolBar - developer's right hand tools) and it seemed quite OK! The parameter was there. But the flash player did not want to go full-screen.

After having a short break and coming back to the problem I noticed that I am also using the "wmode"=>"transparent" for the target movie. Commented it - just to try. Guess what - hola! The movie is again working as expected.

The problem - FullScreenMode is INCOPATABLE with TRANSPARENT movie - what the ?

Looking over this post, it seemed that: Adobe says: "...Full-screen mode was not originally supported if the wmode is opaque or transparent windowless, but it is now supported starting with the latest Flash Player 9 Update...", but I have the 9.0.45 and it still got the problem ...

A friend of mine told me "why would you need transparent along with full screen?". Well, another "great feature" of the FLASH object is that it keeps itself ALWAYS ON TOP of the page, regardless the "z-index" of your other objects. Unless it is set to "transparent".

Sunday, June 17, 2007

Windows Live Writer ?

I just noticed the BETA of Windows Live Writer and downloaded it. IT offers a WPF UI to your blogger aacount, actually it can post to bunc of BLOGS like WordPress, Blogger, Community Server and, of course Live Spaces (

I find it usefule, you can try it also ;)

Saturday, June 16, 2007

More Silverlight

You can view the working example of Hello World with MouseEventHandler here:
The XAML file is here:
(But I think you will have problems to open it with IE, so just try with Mozilla)
What I like is, that you do not any special hosting to publish silverlight app ;) (well, the Hello World one ;) )
Also, good to mention - if you seek for design time support of silverlight app you must go for Microsoft Expression Blend 2 May 2007 Preview - the only one so-far IDE which supports design-time editing for SilverLight.
Looking forward to see you again!

User Interaction with Silverlight

Let's do a simple user interaction with silverlight.

I will take the example code from the previous post and add some extra attributes to the TextBlock Elements:

I have added the "x:Name" attribute, which will identify the textBlock in the code-behind file.

And also I have set the style of the cursor. I personally think that when there is some interaction with user, one should be reminded for that!

The next is simple MouseEventHandler in the code-behind file:

A simple "state" remembering variable and we are changing the text of the text block every time the user clicks on it.

Hello World with Silverlight

OK, let's begin with the hello world! :)
All we need to do (after installing the Silverlight tools for Orcas and Silverlight 1.1 Alpha) is to create a new project "C# -> Silverlight project".
The project template will create for us several files:

1. Page.xaml
1.1. Page.xaml.cs
2. Silverlight.js
3. TestPage.html
3.1. TestPage.html.js

The first one - Silverlight.js is Javascript required for the silverlight client.
Page.xaml is the Silverlight canvas itself - the project that we will work with.
TestPage.html is the HTML client page that will host our Silverlight control.

Let's go deep into it.
The Page.xaml. XAML stands for eXtensible Application Markup Language, and is pronounced "Zammel", was introduced with Microsoft.NET Framework 3.0 as the User Interface definition language for the next generation of applications. It is a normal XML file, and can be edited with any text-editing tool (we will use better than text editing). The empty project file will look like this:

That's right - we have Page.xaml.cs and this is the "code-behind" file.

Well, we can simply add one TextBlock element to this canvas:

^textblock color="#cc0000">Text="Hello World" FontSize="15" FontWeight="Bold" />

So at finally we have the following XAML code:

See you later on.

Getting Started with Silverlight

There is an old Chinese curse saying "May you live in interesting times" (if you are interested go here). I think the are of Internet is really interesting time ... what will happen next ?
Silverlight the new product of Microsoft, that I think will blow away the FLASH, but it will take some time, of course.
In order to be fully equipped for creating silverlight projects you must have the VS Codename Orcas Beta 1, Silverlight 1.1 Alpha, and Microsoft Silverlight Tools Alpha for Visual Studio codename “Orcas” Beta 1.
At first I tried witht he tools, but had only the Silverlight 1.0 Beta ;) No success ;)
After some puzzling I finally understood that I must install the 1.1 Alpha in order to begin develop Silverlight applications with VS Codename Orcas.
Well, there is also a way to develop Silverlight application with VS 2005 and you can find more info here.
I hope to begin a series of SilverLight articles.
Looking forward for the next ;)

Monday, June 11, 2007

Kalteswasser Multimedia

I did not believe an IT Company with German origins should fail to pay its dues to sub-contractor... until now!
I used to be an outsourced IT Consultant, Software architecture designer and developer for "Kalteswasser Multimedia" office in Sofia, Bulgaria. After almost an year of cooperation, always delayed payments, problems with project management, they finally failed to pay more than 40% of a delivered, fully functional and LIVE module.
It seems that having Bulgarian office has influenced too much on professional attitude and business relations of that German company.

Tuesday, May 22, 2007

URL ReWriting with ASP.NET

Recently I got onto a nice article I want to share with you. It is about URL ReWriting with ASP.NET.
I am sure the Open Source manics of you know pretty good the "mod_rewrite" for Apache Web Server. But for those of you who are .NET maniacs, this article will be a good start:

Enjoy it!

Saturday, May 19, 2007

MSXML6 as Prerequisite for most of installations

I hate MSXML 6 !
When I run setup of some "Visual Studio 2005" family softwares I got the error "MSXML6 could not be install, setup cannot continue". Then, when I go to Control panel I see "MSXML6 Parser". If I try to UNINSTALL it says "This action can be ... only for installed components" ... What the ?
Then a veeeryyyy useful post comes to be the only one that helped:
Aaron Stebner's WebLog.
For fast issue - first try: setup.exe /NO_BSLN_CHECK
It works on almost every Visual Studio family products, but unfortunately it does not work on SQL Server family products ...
So another workaround should be found for the SQL Family.

Tuesday, May 8, 2007

More Object Datasource

Ever encounter "Exception Details: System.InvalidOperationException: ObjectDataSource 'ods' could not find a non-generic method 'Update' that has parameters: ...." ? No kidding ?
I will not show you the hot water, people have already found it : (the short version)
and (the long story)
Just a hint - do not use "Use Optimistic Concurrency" !!!
And then you Should slightly modify the Auto-generated code for the ODS.
Well, it's not a good idea at all to mess with auto-generated code, but what else can we do?
Luckily, Microsoft has promised that this BUG is fixed for the next release of Visual Studio.
I wander how many additional bugs are there waiting to crash developer's work ;)

Friday, May 4, 2007

ObjectDataSource ?

I want to give you a hint of something that bothered me the last hours:
The type specified in the TypeName property of ObjectDataSource '' could not be found.
This is the Error I was getting the last half an hour and that drove me crazy.
A simple definition lays behind in the code:

ObjectDataSource odsP = new ObjectDataSource();
odsP.TypeName = "OrderDoc";
odsP.SelectMethod = "GetPriceDetails";

Why then the message is with EMPTY TypeName ?
Well, if you have the definition of the OrderDoc in the scope (namespace) of your current project that is executing the code - there is no problem at all.
The problem comes out when you place your business logic in a business logic layer. And there is no matter how you add the reference to the BL project. You would never succeed.
The answer lays behind the mechanisim the ObjectDataSource is searching for the given TypeName. Well, it uses Reflection, so you must provide a fully-qualified name of the Type including the assembly / namespace. For example:
So the lines in the example will turn onto:

ObjectDataSource odsP = new ObjectDataSource();
odsP.TypeName = "MyBusinessLogic.OrdersLogic.OrderDoc";
odsP.SelectMethod = "GetPriceDetails";


Saturday, April 21, 2007

Nested DIVs in Mozilla

Recently I got into something strange.
Let's assume we have several nested DIV elements.
Also, assume we have one enclosing DIV, but inside DIVs are with style FLOATING.

<div style="clear: both; display: block; background-color: blue;">
<div style="clear: none; float: left;">some block</div>
<div style="clear: none; float: left;">some block</div>
<div style="clear: none; float: left;">some block</div>

What attracted my attention is that in IE everything works just fine (all nested DIVs have the background from its parent).
But when I opened the result in Mozilla Firefox I noted that the enclosing DIV is like for itself and no inner content.
The problem is that floated elements are taken out of the doument flow and hence do not
contribute to the height of their parent. So generally the enclosing div does not understand it has a content inside.
The solution: put an element (DIV) with style set to CLEAR: BOTH, after all the floating elements.

<div style="clear: both; display: block; background-color: blue;">
<div style="clear: none; float: left;">some block</div>
<div style="clear: none; float: left;">some block</div>
<div style="clear: none; float: left;">some block</div>
<div style="clear: both;"></div>

Interesting times for the Browser understanding of CSS ...

Monday, March 26, 2007

Spyware ?

I got an interesting situation recently:
I tried to start-up the default site on the IIS and it exited with error - another process is listening on that port (or something like that). The point is that some program was already listening on port 80 before I start-up the IIS.
A very surprising for me, because the Apache is running on another linux machine and has nothing to do with the IIS.
Fortunately there is a very very useful program called TcpView which actually does exactly the same as the command line: netstat -anb but in graphical interface.
So, what is the surprice:

Somebody, pleas tell me what does the SKYPE needs a port 80 and 443 for ???

Friday, March 23, 2007

New to development ?

Just want to share with you a great resources for newbies:


Recently I was asked by a friend of mines whether I know a free WYSIWYG editor .NET component.
By that time I did not.
Just a quick googling offered me few choices that I think are quire good examples:

Hope you like it!

Tuesday, March 6, 2007

Flash objects and z-index

Recently I was working on a rich-media project and I got some issues.
I had problem when I was trying to combine DHTML, layers, LightBox library and FLASH object on a single page.
The problem is that the FLASH object always stays on the top of all layers, regardless the stacking (z-index). This problem is also described in Adobe (former Mactomedia) tech-note.
The only solution (described in the same tech-note) is to use the "WMODE" parameter for the flash EMBED / OBJECT and make the FLASH movie transparent. Well, if the flash movie is not designed to be transparent, it will not be. But now, when we have successfully set the wmode = "transparent" the stacking of the layers works just fine.
OK, good. Now it comes another issue: what happens if the FLASH object is automatically generated Banner that comes from a banner rotating system ? Luckily I am using the phpAdsNew, and they provide option at the banner properties to make the Flash banner transparent.
Thanks goes for

Wednesday, February 7, 2007

Windows Media Player Plug-in

Have you had the problem win Mozilla FireFox 2.0 - "Install missing plugin", regarding the Windows Media Player?
Well, this link will solve your problems.
It is a stand-alone Media Player plug-in for Mozilla Browsers (NetScape, FireFox)

Monday, February 5, 2007

Command-line tips & tricks

Ever wander how to automate specific services starting and stopping ?
Well, at first the easiest part:
How to start or stop windows service from command-line ?use the tool "net" provided by windows:
net start [name of the service]
for example:
net start "SQL Server (MSSQLSERVER)"
We can also, stop the service with this tool:
net stop "SQL Server (MSSQLSERVER)"

Now the tricky part - how to START / STOP IIS site using command-line?
(Tested against IIS 6.0)
Microsoft provides some useful scripts that automate this work, and we can use them with the command-line tool cscript.exe. Let's assume we have the "Default Web Site" configure on the IIS and we want to start / stop it. Then open a command prompt and write down:

cscript /nologo %SystemRoot%\System32\IIsWeb.vbs /start "Default Web Site"
to start the site
cscript /nologo %SystemRoot%\System32\IIsWeb.vbs /stop "Default Web Site"
to stop the site.

You will find a number of other useful scripts and manual here.

All this helped me to make a batch files (.bat), which I use to start / stop services on my machine (I do not always need the services running and consuming memory and resources).

Wednesday, January 31, 2007

Windows SharePoint Services problem

Did you know that Windows 2003 Enterprise R2 is shipped along with Windows SharePoint Services 2.0? Well, it is. The SharePoint services components is located on the CD2 of that windows distribution, and is accessible to add/remove from “Add/Remove programs -> Windows components”.
What I want to share with you is another wired and strange problem I had with it. So, I installed the WSS 2.0 on my machine. It made several virtual directories on my IIS and apparently changed a lot of other things.
What happened?
First, it was installed on the default web site of the IIS. Then all virtual directories I had on this site stopped working. It was just saying “Error 404 Not Found”, although the virtual paths were there – at the IIS administrative console. I said “OK”, and I made another website on the IIS and moved the virtual paths there – they were working just fine. Until …
Until I found that the “Forms Authentication” is not working anymore. I had the “”, I had the required “” in my web.config for the applications under the virtual folders, but none of them worked. The authorization was not working anymore! You could open every page you want without being authorized. I looked in the machine.config, I looked in the web.config under Microsoft.Net folder in windows root folder, but I did not find anything wrong. After wasting a couple of hours I decided to remove the WSS 2.0 from my PC. Guess what – everything was working fine again. Really wired (at least for me) …

Thursday, January 25, 2007

SQL Server 2005 and Office Web Componenets 11 (OWC11)

Recently I tried to install MS SQL Server 2005 Developer Edition (well, the same problem came with Standard Edition, too) and I got strange problem. At some point the install wizard came up with an error “Could not install OWC11” (OWC11 - Office Web Components 11). After that another error came – “Could not install Database services”, and at the end I had only Client components installed, not even the management studio.
I began to wander what the problem might be. I tried several different ways and options in the install wizard, but the same problem was appearing again and again. Then I put a fresh copy of Windows XP SP2 on a MS Virtual PC and run the SQL Server installation there – everything was fine, as expected. So I came back to the host and looked over the installed software I had. It appeared that I already have had the Microsoft Office Web Components installed, which surprised me even more – why the SQL Server does not check for it before trying to install it. What I did is remove the OWC from Add/Remove Programs and run the SQL Server setup once more. Guess what – success! Wired …

Monday, January 22, 2007

My First Post

Hi there,
here I would like to start posting interesting things from the world around us. Mostly from the programmers point of view ;)