<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3502027233909073175</atom:id><lastBuildDate>Fri, 20 Sep 2024 12:03:12 +0000</lastBuildDate><category>Software Development</category><category>ASP.NET</category><category>General</category><category>.NET</category><category>C#</category><category>Java</category><category>.NET 3.5</category><category>AJAX</category><category>Algorithms</category><category>Basics</category><category>Books</category><category>Control Adapters</category><category>JavaScript</category><category>LINQ</category><category>LINQ to SQL</category><category>Performance</category><category>Tricks</category><category>WAI</category><category>Conferences</category><category>Cumputer Graphics</category><category>Events</category><category>Geometry</category><category>Interlingua</category><category>Linguistic</category><category>Machine Translation</category><category>Mobile</category><category>News</category><category>OCR</category><category>Performance Counters</category><category>Programming</category><category>SQL Server</category><category>ScriptManager</category><category>SourceSafe</category><category>Stereogram</category><category>T-SQL</category><category>Technical Talks</category><category>UpdatePanel</category><title>Vesko Kolev&#39;s Blog : IDeveloper</title><description></description><link>http://veskokolev.blogspot.com/</link><managingEditor>noreply@blogger.com (Veselin Kolev)</managingEditor><generator>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-6940479947087513276</guid><pubDate>Sun, 27 Apr 2014 12:40:00 +0000</pubDate><atom:updated>2014-04-27T05:42:46.480-07:00</atom:updated><title>veskokolev.com - Vesko&#39;s New Place!</title><description>&lt;p&gt;Hi guys,&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;It&#39;s been 5 years since my last blogpost here. Trough these years I&#39;ve managed to gather a lot of new knowledge and topics.&lt;/p&gt;&lt;br /&gt;

&lt;p&gt;Now I&#39;m happy to share with you that from now on you can follow my brand new blog on my brand new site &lt;a href=&quot;http://www.veskokolev.com/&quot;&gt;www.veskokolev.com&lt;/a&gt;. I hope that you will find there a lot of interesting information not only about software development, but also for leadership and business.&lt;/p&gt;&lt;br /&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;</description><link>http://veskokolev.blogspot.com/2014/04/hi-guysits-been-5-years-since-my-last.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-8488005200734485977</guid><pubDate>Wed, 25 Nov 2009 22:05:00 +0000</pubDate><atom:updated>2009-11-25T14:37:39.677-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Books</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">News</category><title>Introduction to Programming with C# - new book at the horizon!</title><description>A few days ago &lt;a href=&quot;http://www.nakov.com/blog/2009/11/21/new-book-introduction-to-programming-with-csharp/&quot;&gt;Svetlin Nakov&lt;/a&gt; announced that we are starting a new open-source project - writing an introductory book about programming in C# language. It will be based on the book, which we have written almost a year ago - &quot;Introduction to Programming with Java&quot;.&lt;br /&gt;&lt;br /&gt;The book will be based on Visual Studio 2010 and C# 3.0, but won&#39;t cover topics such as lambda expressions and extension methods. The main purpose of the book is to teach the readers to think logically. This includes basic knowledge of Algorithms, Complexity, Linear Data Structures, Graphs and Trees, Sets, Object Oriented Programming Concepts, etc.&lt;br /&gt;&lt;br /&gt;The book’s official Web site will be located at: &lt;a href=&quot;http://www.introprogramming.info&quot;&gt;http://www.introprogramming.info&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The developer’s Web site is located in Google Code: &lt;a href=&quot;http://code.google.com/p/introcsharpbook/&quot;&gt;http://code.google.com/p/introcsharpbook/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The SVN repository containing all project assets is located at: &lt;a href=&quot;http://introcsharpbook.googlecode.com/svn/trunk/&quot;&gt;http://introcsharpbook.googlecode.com/svn/trunk/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The developer’s mailing list (discussion group) is located at: &lt;a href=&quot;http://groups.google.com/group/introcsharpbook&quot;&gt;http://groups.google.com/group/introcsharpbook&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you want to take part in the project as author or editor, you are welcome to contact either me or Svetlin. &lt;br /&gt;&lt;br /&gt;P.S.&lt;br /&gt;I will lead this project, so wish me good luck!&lt;br /&gt;&lt;br /&gt;P.P.S.&lt;br /&gt;We are planning to translate the books (both Java and C# editions) in English. If there are eager people joining our next ambitious project, just rise a hand!</description><link>http://veskokolev.blogspot.com/2009/11/introduction-to-programming-with-c-new.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-3899484171276017918</guid><pubDate>Wed, 25 Nov 2009 21:38:00 +0000</pubDate><atom:updated>2009-11-25T14:03:16.663-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">OCR</category><category domain="http://www.blogger.com/atom/ns#">Technical Talks</category><title>Talk at Open Fest 2009 - &quot;Tesseract OCR Engine&quot;</title><description>Few weeks ago I had a technical talk along with my colleague &lt;a href=&quot;http://nakov.com/blog&quot;&gt;Svetlin Nakov&lt;/a&gt; about OCR (Optical Character Recognition) and more specifically - Tesseract OCR Engine. The lection was part of the Open Fest 2009, Sofia, Bulgaria and was widely attended.&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcwHr1MxKQGEF_W74856WJPufVQNec0ITHQEMZsaMxi6EWSX9Hd1Iz_dMOb9qyA4eFM35LTsc-0WVRp3LrJe1ky_Ue5zoxze5jEBHAVsXfWWrOSBgtR7HUf7TD2gUJI02OUfPlrnuBVXmV/s1600/openfest-logo.png&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 97px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcwHr1MxKQGEF_W74856WJPufVQNec0ITHQEMZsaMxi6EWSX9Hd1Iz_dMOb9qyA4eFM35LTsc-0WVRp3LrJe1ky_Ue5zoxze5jEBHAVsXfWWrOSBgtR7HUf7TD2gUJI02OUfPlrnuBVXmV/s400/openfest-logo.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5408164510991460354&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We shared our practical experience with the Tesseract and the OCR in general as we had just worked on a very complicated project just a few weeks ago. &lt;br /&gt;&lt;br /&gt;The presentation includes:&lt;br /&gt;- What is OCR?&lt;br /&gt;- Project Tesseract - history and versions.&lt;br /&gt;- Downloading and compiling Tesseract - live demo.&lt;br /&gt;- How Tesseract works? - an overview of the underlying algorithms.&lt;br /&gt;- Training Tesseract - live demo how to train the engine for custom languages/fonts.&lt;br /&gt;- Comparison with other OCR engines.&lt;br /&gt;- Tesseract&#39;s future. &lt;br /&gt;&lt;br /&gt;You can download the &lt;a href=&quot;http://nakov.com/blog/wp-content/uploads/2009/11/tesseract-ocr-engine-v101.ppt&quot;&gt;presentation&lt;/a&gt; and the &lt;a href=&quot;http://nakov.com/blog/wp-content/uploads/2009/11/tesseract-demonstrations-8-nov-2009.zip&quot;&gt;demos&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vesko Kolev&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P.S. &lt;/strong&gt; As the topic of OCR is really very interesting I am planning to have another post on it showing some further details about Tesseract as well as a sample OCR engine based on some AI algorithms. &lt;br /&gt;Stay tuned!</description><link>http://veskokolev.blogspot.com/2009/11/talk-at-open-fest-2009-tesseract-ocr.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcwHr1MxKQGEF_W74856WJPufVQNec0ITHQEMZsaMxi6EWSX9Hd1Iz_dMOb9qyA4eFM35LTsc-0WVRp3LrJe1ky_Ue5zoxze5jEBHAVsXfWWrOSBgtR7HUf7TD2gUJI02OUfPlrnuBVXmV/s72-c/openfest-logo.png" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-2024140775625213763</guid><pubDate>Mon, 31 Aug 2009 10:51:00 +0000</pubDate><atom:updated>2009-08-31T04:00:14.073-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conferences</category><category domain="http://www.blogger.com/atom/ns#">Events</category><category domain="http://www.blogger.com/atom/ns#">General</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><title>Java2Days - a brand new event in Eastern Europe!</title><description>Hi guys!&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://java2days.com&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 200px; height: 200px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9WKbz7fv7iAKW8jfB1sXOMQGDBA4cMPs0O1rYbq2oMKfg3V2bO1Pfg4mdZx8CGZUGoiZ7zWETBXipINbIEPzvWdVvNtb-ngeYnJorSLo1OhTqehXAcaJ8zdT726TemLqDRQ3imqrdzwkR/s400/6171_100455486637135_100000180518179_11841_4233085_n.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5376080518001950706&quot; /&gt;&lt;/a&gt;I am very much exited to share with you the news of a coming Java event which we are preparing these days at &lt;a href=&quot;http://en.nars.bg/&quot;&gt;NASD&lt;/a&gt; along with our partners from &lt;a href=&quot;http://insight-bg.net/&quot;&gt;Insight_technologies&lt;/a&gt; – Java2Days!&lt;br /&gt;&lt;br /&gt;Java2Days conference is a brand new event in Eastern Europe to present the latest trends in Java development. &lt;br /&gt;&lt;br /&gt;Java2Days will be held at the Inter Expo Center on 8-9 October in Sofia, Bulgaria. The conference is hosted by &lt;a href=&quot;http://insight-bg.net/&quot;&gt;Insight_technologies&lt;/a&gt; and the &lt;a href=&quot;http://en.nars.bg/&quot;&gt;Bulgarian National Academy for Software Development&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The conference is the first of its kind to be held in Eastern Europe, focused to highlight today’s cutting edge trends in building software applications with Java development tools.&lt;br /&gt;&lt;br /&gt;Over two days, more than 600 attendees will meet world famous lecturers, engaged all year round in such events as JavaOne, The ServerSide Java Symposium, Jazoon showcasing their latest knowledge in creating more reliable, scalable and secure solutions using Java technologies in more than 20 technical sessions. &lt;br /&gt;&lt;br /&gt;The major purpose of the event is to become a place for passionate Java developers to get in touch with the latest technologies, to become a significant part of the global Java community and to learn from the best. &lt;br /&gt;&lt;br /&gt;You can see everything about the conference at its &lt;a href=&quot;http://java2days.com&quot;&gt;official site&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;P. S.&lt;br /&gt;If you are going to attend at the Java2Days event, don’t hesitate to contact me – we can have a beer or two talking about everything which bothers you in your work as developers!</description><link>http://veskokolev.blogspot.com/2009/08/java2days-brand-new-event-in-eastern.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9WKbz7fv7iAKW8jfB1sXOMQGDBA4cMPs0O1rYbq2oMKfg3V2bO1Pfg4mdZx8CGZUGoiZ7zWETBXipINbIEPzvWdVvNtb-ngeYnJorSLo1OhTqehXAcaJ8zdT726TemLqDRQ3imqrdzwkR/s72-c/6171_100455486637135_100000180518179_11841_4233085_n.jpg" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-8587873898814618876</guid><pubDate>Fri, 24 Jul 2009 14:26:00 +0000</pubDate><atom:updated>2009-07-24T08:20:02.892-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">General</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Mobile</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><title>How to Send SMS under Windows Using Connected to the PC Phone with Datacable/Bluetooth/IrDA/PCCard/etc. in C#</title><description>&lt;strong&gt;Intro&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDS6kYq-dotj1YS5MIB2QXK27OjL7mW5xjPn2g66cInrTgpYUij6TgAlzHW4ikj4H1TYxvTX4A8gEylFAJINW-JctxWchFX2bz5VgqPNYVKnd8JHnYaUPcVY1JjsCM9d1_R2rgqA18bKXJ/s1600-h/SMSIcon.jpg&quot;&gt;&lt;img style=&quot;float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 163px; height: 189px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDS6kYq-dotj1YS5MIB2QXK27OjL7mW5xjPn2g66cInrTgpYUij6TgAlzHW4ikj4H1TYxvTX4A8gEylFAJINW-JctxWchFX2bz5VgqPNYVKnd8JHnYaUPcVY1JjsCM9d1_R2rgqA18bKXJ/s400/SMSIcon.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5362036587093053826&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Today I had to solve a very interesting task for one of our projects at &lt;a href=&quot;http://nars.bg&quot;&gt;NASD&lt;/a&gt; – sending SMSes trough .NET and C#. In the past I have used different kinds of services for sending SMSes – SOAP web services, Email2SMS services, etc. The usage of the above methods is very straightforward, doesn’t require any special knowledge and the task is practically a trivial. Our application required sending of very small number of SMSes, so we have thought of another approach – to connect in some way (Datacable/Bluetooth/IrDA/ PCCard/etc.) a physical device to the PC and to send messages trough it. &lt;br /&gt;In this post I will show you ready to use approach to send SMSes from a connected to a Windows PC GSM device that supports SMS sending.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Possibilities&lt;/strong&gt;&lt;br /&gt;In general there are two possible approaches for solving the task. The first one is by consuming some API or already written library trough C#/Java/etc. I started with the idea of using Java and J2ME for developing the application. However as a C# and .NET fan, I decided firstly to research if there is something .NETish which I could use. A lot of comercial COM libraries could be found on the market, which therefore can be consumed from almost every Windows based language/development platform.&lt;br /&gt;The other main possibility was to find some command line enabled tool, which could be wrapped by a C#/Java/etc.&lt;br /&gt;After a short research my conclusion was that non comercial library which works could hardly be found. So I started looking for the other possibility – a command line tool. But what happened?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br /&gt;I was very happy to find something called &lt;a href=&quot;http://www.microsoft.com/globaldev/outreach/dnloads/smsSender.mspx&quot;&gt;SMSSender&lt;/a&gt; provided by &lt;a href=&quot;http://www.microsoft.com&quot;&gt;Microsoft&lt;/a&gt;. SMSSender is an add-on for Microsoft Windows XP that will create and send SMS (short text messages) by using your GSM cellular phone. It also allows the use of all characters from international alphabets. SMSSender could be used under Windows Server 2003 and Windows Vista (with setting to run it in compatibility mode for Windows XP), too. The application has a very simple and userfriendly UI and can be used easily as a standalone application.&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhMv_6VGL8kKw67iE4mvoq5oribOVMNw29egwkz7zhuIFHzuDPTFIaU4XgtdSoiJBhIH2HMD4xlGSZ5gG_93WKDX2b4d65w8vPnRogQjwxMkj8dtv4CwbXAlpBFpMXPBe35GvenbOKwwFo/s1600-h/SMSSenderMainScreen.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 349px; height: 376px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhMv_6VGL8kKw67iE4mvoq5oribOVMNw29egwkz7zhuIFHzuDPTFIaU4XgtdSoiJBhIH2HMD4xlGSZ5gG_93WKDX2b4d65w8vPnRogQjwxMkj8dtv4CwbXAlpBFpMXPBe35GvenbOKwwFo/s400/SMSSenderMainScreen.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5362033808693366562&quot; /&gt;&lt;/a&gt;&lt;br /&gt;To send an SMS firstly you should select your already connected device from which you want to send the SMS. Then you need to input the destination number and of course the content of the message itself. When ready, you can click Send. If everything is OK, you will see the following message box:&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIG7HE8BtWQIrC9jc7hh00sOBfJ2KH-zk_leNPF-4a_ilRgMW35r_ia2ztv6dDpOA1mD9HjCn2NpPmF-HpoZPO5YZX8oFr3VeP0bXM3F-69o2avd3KfylcT_gnEevVhCyNZMMP7nAp9Jbp/s1600-h/SuccessfullSent.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 272px; height: 166px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIG7HE8BtWQIrC9jc7hh00sOBfJ2KH-zk_leNPF-4a_ilRgMW35r_ia2ztv6dDpOA1mD9HjCn2NpPmF-HpoZPO5YZX8oFr3VeP0bXM3F-69o2avd3KfylcT_gnEevVhCyNZMMP7nAp9Jbp/s400/SuccessfullSent.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5362034185155863394&quot; /&gt;&lt;/a&gt;&lt;br /&gt;On the other hand – if something fails you will see message box, simmilar to this one:&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKmm89VNeUTQKFQoXoYtmh5MNbQJvXUTJ4dTby10cT9Z-VP0O_X74jvRqbpt2meY8yzrDHN-gBI9Zfv7Nx0tNvkdJj6asV8myI-46-l7546XBg_-xXILWP_ZWbdapsUdZUalyVit7NOtnE/s1600-h/FailureSent.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 143px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKmm89VNeUTQKFQoXoYtmh5MNbQJvXUTJ4dTby10cT9Z-VP0O_X74jvRqbpt2meY8yzrDHN-gBI9Zfv7Nx0tNvkdJj6asV8myI-46-l7546XBg_-xXILWP_ZWbdapsUdZUalyVit7NOtnE/s400/FailureSent.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5362034313126205730&quot; /&gt;&lt;/a&gt;&lt;br /&gt;After a minute you will find why I am talking about this message boxes at all.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Command Arguments&lt;/strong&gt;&lt;br /&gt;As I said above, the SMSSender application is command argument enabled application. The arguments which we are interested in are the &lt;em&gt;/p:phone_number&lt;/em&gt; and &lt;em&gt;/m:”sms_body”&lt;/em&gt;. Here we should ask ourselves what happens with the third option – the device selection. Unfortunately the tool doesn’t have argument for device selection. If we don’t provide such the application argues that no device was selected. But how we could select this option? There are two ways possible was to do the default device selection – the first one is to set the registry key &lt;em&gt;HKEY_CURRENT_USER\Software\Microsoft\SMSSender&lt;/em&gt; and add new string value called DeviceName with data field equals to the name of your device (in my current case &lt;em&gt;LGE Mobile USB Modem&lt;/em&gt; or in other words the value from the dropdown above). The alternative way is just to enable logging (going to &lt;em&gt;Options&lt;/em&gt; and check the &lt;em&gt;Enable Logging&lt;/em&gt; checkbox).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The SendSMS Wrapper&lt;/strong&gt;&lt;br /&gt;OK we are ready to implement the wrapper. The task seems very straightforward – something like 10 to 15 minutes – start the process, hide its window, wait the process to end, etc. But is there something which could be a problem for us and make the writing of such application more challenging? If you remember, when clicking the &lt;em&gt;Send &lt;/em&gt;button (which is equivalent to start the application with the appropriate command arguments) there was a message box which waits one to click &lt;em&gt;OK&lt;/em&gt;(no matter successful or not). Yes.. I know such a behavior seems very developer unfriendly with this pup up messages. When looking for a setting/argument to disable these alerts, I wasn’t able to find such. So I had to put my past &lt;strong&gt;Win32 &lt;/strong&gt;experience in practice again and had to close this message box with code.&lt;br /&gt;I’ll explain this part of the code in short – after starting the process of the SMSSender, I start a thread, which polls for a window with a specific caption (using the native Win32 function &lt;em&gt;FindWindowEx&lt;/em&gt;) with a given delay.  After finding either the successful or the failed message box, it sends closing message to this window (again with a native Win32 function, this time &lt;em&gt;SendMessage&lt;/em&gt;) and prints to the console the whether the message was sent or not. After this the application ends.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Code&lt;/strong&gt;&lt;br /&gt;&lt;PRE&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.Linq;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.Text;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.Diagnostics;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.Windows.Forms;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.IO;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.Runtime.InteropServices;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;using&lt;/span&gt; System.Threading;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;namespace&lt;/span&gt; SendSMS&lt;br /&gt;{&lt;br /&gt;    &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;class&lt;/span&gt; Program&lt;br /&gt;    {&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;#region&lt;/span&gt; Win32 API Import&lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;int&lt;/span&gt; WM_COMMAND &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; 0x0112;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;int&lt;/span&gt; WM_CLOSE &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; 0xF060;&lt;br /&gt;&lt;br /&gt;        [DllImport(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;user32.dll&quot;&lt;/span&gt;)]&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;static&lt;/span&gt; extern IntPtr FindWindowEx(IntPtr hwndParent, &lt;br /&gt;            IntPtr hwndChildAfter, &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;string&lt;/span&gt; lpszClass, &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;string&lt;/span&gt; lpszWindow);&lt;br /&gt;        &lt;br /&gt;        [DllImport(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;user32.dll&quot;&lt;/span&gt;)]&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;static&lt;/span&gt; extern &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;int&lt;/span&gt; SendMessage(&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;int&lt;/span&gt; hWnd, uint Msg, &lt;br /&gt;            &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;int&lt;/span&gt; wParam, &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;int&lt;/span&gt; lParam);&lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;#endregion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;#region&lt;/span&gt; Methods&lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;void&lt;/span&gt; ShowHelp()&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;Vesko Kolev&#39;s SendSMS usage:&quot;&lt;/span&gt;);&lt;br /&gt;            Console.WriteLine(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;SendSMS phone_number \&quot;sms_body\&quot;&quot;&lt;/span&gt;);&lt;br /&gt;            Console.WriteLine(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;SendSMS 0812345678 \&quot;Test sms body!\&quot;&quot;&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;void&lt;/span&gt; CloseMessageBox()&lt;br /&gt;        {&lt;br /&gt;            IntPtr hwndMessageBox;&lt;br /&gt;            &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;true&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                hwndMessageBox &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; FindWindowEx(IntPtr.Zero, &lt;br /&gt;                    IntPtr.Zero, &lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;#32770&quot;&lt;/span&gt;, &lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;SMS Sender&quot;&lt;/span&gt;);&lt;br /&gt;                &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;if&lt;/span&gt; (hwndMessageBox !&lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; IntPtr.Zero)&lt;br /&gt;                {&lt;br /&gt;                    SendMessage(hwndMessageBox.ToInt32(), &lt;br /&gt;                        WM_COMMAND, WM_CLOSE, 0);&lt;br /&gt;                    Console.WriteLine(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;SMS sent successfully!&quot;&lt;/span&gt;);&lt;br /&gt;                    &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                hwndMessageBox &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; FindWindowEx(IntPtr.Zero, IntPtr.Zero, &lt;br /&gt;                    &lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;#32770&quot;&lt;/span&gt;, &lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;SMS Sender Error&quot;&lt;/span&gt;);&lt;br /&gt;                &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;if&lt;/span&gt; (hwndMessageBox !&lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; IntPtr.Zero)&lt;br /&gt;                {&lt;br /&gt;                    SendMessage(hwndMessageBox.ToInt32(), &lt;br /&gt;                        WM_COMMAND, WM_CLOSE, 0);&lt;br /&gt;                    Console.WriteLine(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;SMS sending failed!&quot;&lt;/span&gt;);&lt;br /&gt;                    &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                Thread.Sleep(500);&lt;br /&gt;            }&lt;br /&gt;        } &lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;void&lt;/span&gt; SendSMS(&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;string&lt;/span&gt; phoneNumber, &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;string&lt;/span&gt; smsBody)&lt;br /&gt;        {&lt;br /&gt;            Process process &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;new&lt;/span&gt; Process();&lt;br /&gt;            process.StartInfo.FileName &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; &lt;br /&gt;                Path.GetDirectoryName(Application.ExecutablePath) &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;+&lt;/span&gt; &lt;br /&gt;                &lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;@&quot;\MSSMSSender.exe&quot;&lt;/span&gt;;&lt;br /&gt;            process.StartInfo.Arguments &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; &lt;br /&gt;                &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;string&lt;/span&gt;.Format(&lt;span style=&quot;color: #666666; font-family: Courier New; font-size: 11px; background-color: #ededed&quot;&gt;&quot;/p:{0} /m:\&quot;{1}\&quot;&quot;&lt;/span&gt;, phoneNumber, smsBody);&lt;br /&gt;            process.StartInfo.UseShellExecute &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;            process.StartInfo.CreateNoWindow &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;            process.Start();&lt;br /&gt;            &lt;br /&gt;            Thread thread &lt;span style=&quot;color: Red; font-family: Courier New; font-size: 11px;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;new&lt;/span&gt; Thread(&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;new&lt;/span&gt; ThreadStart(CloseMessageBox));&lt;br /&gt;            thread.Start();&lt;br /&gt;&lt;br /&gt;            process.WaitForExit();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;void&lt;/span&gt; Main(&lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;string&lt;/span&gt;[] args)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;switch&lt;/span&gt; (args.Length)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;case&lt;/span&gt; 2:&lt;br /&gt;                    SendSMS(args[0], args[1]);&lt;br /&gt;                    &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;                &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;default&lt;/span&gt;:&lt;br /&gt;                    ShowHelp();&lt;br /&gt;                    &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style=&quot;color: Blue; font-family: Courier New; font-size: 11px;&quot;&gt;#endregion&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/PRE&gt;&lt;br /&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;In this article I have showed you a ready to use source code which sends SMSes from a connected to your PC GSM device. You can consume this app virtually from anywhere – just wrap the wrapper and forget about this task! &lt;br /&gt;&lt;br /&gt;I’ll be happy to hear your comments about everything related.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vesko Kolev</description><link>http://veskokolev.blogspot.com/2009/07/how-to-send-sms-under-windows-using.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDS6kYq-dotj1YS5MIB2QXK27OjL7mW5xjPn2g66cInrTgpYUij6TgAlzHW4ikj4H1TYxvTX4A8gEylFAJINW-JctxWchFX2bz5VgqPNYVKnd8JHnYaUPcVY1JjsCM9d1_R2rgqA18bKXJ/s72-c/SMSIcon.jpg" height="72" width="72"/><thr:total>27</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-3231147031703621263</guid><pubDate>Thu, 23 Jul 2009 11:06:00 +0000</pubDate><atom:updated>2009-07-23T04:30:36.656-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET 3.5</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">LINQ</category><category domain="http://www.blogger.com/atom/ns#">LINQ to SQL</category><category domain="http://www.blogger.com/atom/ns#">Performance</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">Tricks</category><title>Vesko on Performance – LINQ to SQL</title><description>&lt;strong&gt;Intro&lt;/strong&gt;&lt;br /&gt;In general some of the biggest performance problems of the applications seen nowadays are found in the database or the data access layer. This combined with ORM framework such as LINQ to SQL which is new for the development team, which encapsulates all of the queries made against the DB (and “of course” not profiled), which is not researched enough, could lead to very “sexy” results. Here I will try to show you a few common mistakes which I have seen through my everyday work with different developers from all over the world as well as the one that our students here at &lt;a href=&quot;http://nars.bg&quot;&gt;National Academy for Software Development&lt;/a&gt; make. At the end of this article you should know how to avoid such mistakes (not only the one that I’m showing here).  I will provide you with the toolset along with the practices which do the work for me every day, and will hopefully do the work for you, too!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Problems&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;1. &lt;em&gt;GetAll()&lt;/em&gt; and &lt;em&gt;GetCount()&lt;/em&gt; methods&lt;/strong&gt; – this is a classical pair of methods. As you know they can have different variation such as &lt;em&gt;GetAllBy[Something]()&lt;/em&gt; and respectively &lt;em&gt;GetCountBy[Something]()&lt;/em&gt;. I have found a lot of developers do the following:&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Ar68ZlUZW7klHcJ2OMEeZdfUTpcyw9_ogUr8IcpWJiRB81uYEEWU-om5MZRCuV-msLe0Vm_zMFlY0Weq-tXj5aIJuYfpwBa3e7qmEc6c4w63zjd-BwqJBh7rNJFotZ7x7fzA2_PnqxKK/s1600-h/LINQ-2-SQL-1.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Ar68ZlUZW7klHcJ2OMEeZdfUTpcyw9_ogUr8IcpWJiRB81uYEEWU-om5MZRCuV-msLe0Vm_zMFlY0Weq-tXj5aIJuYfpwBa3e7qmEc6c4w63zjd-BwqJBh7rNJFotZ7x7fzA2_PnqxKK/s400/LINQ-2-SQL-1.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5361610844984455522&quot; /&gt;&lt;/a&gt;&lt;br /&gt;But where is the performance problem? When somebody calls &lt;em&gt;GetAll()&lt;/em&gt;  the code just retrieves all the &lt;em&gt;SampleObjects&lt;/em&gt; from the DB. This seems to be OK and it actually is. But what about the &lt;em&gt;GetCount()&lt;/em&gt; method? It firstly fetches all of the &lt;em&gt;SampleObjects&lt;/em&gt; in memory and then counts them. As you know the expected way of solving this task is to use the COUNT function in T-SQL. Of course the idea behind this &lt;em&gt;GetCount()&lt;/em&gt; is simple – the developer tried to reuse the query defined in the &lt;em&gt;GetAll()&lt;/em&gt; method. One would say – &lt;em&gt;“Hm… I thought that LINQ to SQL executes everything possible in the SQL server. Why here it doesn’t do this?!?”&lt;/em&gt; The problem is that when you build the expression (assigned to the result variable) it returns value from &lt;em&gt;IQuerable&lt;T&gt;&lt;/em&gt;. Up to now this expression is just an expression – it doesn’t execute anything against the SQL server. However on the next line we have a call of the &lt;em&gt;ToList()&lt;/em&gt; method which idea is to return &lt;strong&gt;list of &lt;em&gt;SampleObjects&lt;/em&gt;&lt;/strong&gt;. Thus here on this line we have a DB query which fetches the requested list.&lt;br /&gt;Here we should solve two problems. The performance one is obvious – we fetch everything from the DB just to count it, which will impact the memory usage as well as the network traffic. The second problem is that we want to stick up to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Don&#39;t_repeat_yourself&quot;&gt;Don’t Repeat Yourself&lt;/a&gt; principle (DRY, also known as Single Point of Truth and Single Point of Maintenance) – we don’t want to have the query for the &lt;em&gt;GetAll()&lt;/em&gt; and the &lt;em&gt;GetCount()&lt;/em&gt; twice. In practice it will differ only by the &lt;em&gt;Count()&lt;/em&gt; method. Keep in mind that we could have more complex queries with filters, skips, orders, etc. so this could be very bad if we don’t obey the DRY principle here. The above snippet tried to solve this second note, but in a wrong way.&lt;br /&gt;The following code snippet shows sample solution for both of the mentioned problems:&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivWlERfhLQ-nkJs_elikREwBRFT6bsQ0q0Tg-oAEnXdNT5z9MIqsczWAV4LKWp-Ah1TTvM1vG4IfsPWSdTEe-afH6bMR3Zk-prlIQj5oYdYr1XIX8AXsG563hMtDq8yBY-OKadYPB4-Wns/s1600-h/LINQ-2-SQL-2.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 224px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivWlERfhLQ-nkJs_elikREwBRFT6bsQ0q0Tg-oAEnXdNT5z9MIqsczWAV4LKWp-Ah1TTvM1vG4IfsPWSdTEe-afH6bMR3Zk-prlIQj5oYdYr1XIX8AXsG563hMtDq8yBY-OKadYPB4-Wns/s400/LINQ-2-SQL-2.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5361612240336777362&quot; /&gt;&lt;/a&gt;&lt;br /&gt;It just uses third method, which is private for the class and returns the common part of the expression as &lt;em&gt;IQueriable&lt;T&gt;&lt;/em&gt;. The two public methods just appends the query with a &lt;em&gt;ToList()&lt;/em&gt; and &lt;em&gt;Count()&lt;/em&gt; calls.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. &lt;em&gt;SelectMethod(…)&lt;/em&gt; and &lt;em&gt;SelectCountMethod(…)&lt;/em&gt; for paging&lt;/strong&gt; – this sample is similar to the above, but again is very common mistake. &lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjduTrClRrGLmSA4-NUOPcEI6iGCjPJyyiyoX4HEoHTmhp3vMcfVer-3ViDwDQ0ob-7OdoxGPVY3a_5WU5qRBdrohdylGrGCo2urZdWcHRaxRLi9USfTTFMVDtCh5-zQ5rf3meFv0FsZ92R/s1600-h/LINQ-2-SQL-3.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 156px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjduTrClRrGLmSA4-NUOPcEI6iGCjPJyyiyoX4HEoHTmhp3vMcfVer-3ViDwDQ0ob-7OdoxGPVY3a_5WU5qRBdrohdylGrGCo2urZdWcHRaxRLi9USfTTFMVDtCh5-zQ5rf3meFv0FsZ92R/s400/LINQ-2-SQL-3.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5361612858546183090&quot; /&gt;&lt;/a&gt;&lt;br /&gt;This implementation totally breaks one of the main reasons of using paging – loading only a part of the whole content. You have enough knowledge from the point 1 both for finding the problem and for solving it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. The N+1 query problem&lt;/strong&gt; – a nightmare from the past. This is a very performance intensive problem which becomes a classical in the software development folklore.  The idea behind this problem is very straightforward – imagine that we have a list of &lt;em&gt;SampleObjects&lt;/em&gt; and for each list we want to get which is his owner – &lt;em&gt;SampleObjectOwner&lt;/em&gt;. Thus one could write one query for retrieving all of the &lt;em&gt;SampleObjects&lt;/em&gt; (let’s say that their count is N) and for each object, we ask which is its owner. This means that we will make 1 + N queries for retrieving the needed data.&lt;br /&gt;I will show you an even worst situation, in which we have to find the first object (if such exists) which have particular &lt;em&gt;SampleObjectOwner&lt;/em&gt; as an owner.&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoK63cB6-zyJT35aUjArCfkZJjJ76vzvYAMajqP0UuJkyvZu_dR2T7AbqWd3qEloTDv_I-geN4WTYCKVZZ8uweZqHxkZf1l69TPSObBhRMR_R3fe27H9_wIMCmI5rIEyxVXYCW9VLco-AZ/s1600-h/LINQ-2-SQL-4.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 201px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoK63cB6-zyJT35aUjArCfkZJjJ76vzvYAMajqP0UuJkyvZu_dR2T7AbqWd3qEloTDv_I-geN4WTYCKVZZ8uweZqHxkZf1l69TPSObBhRMR_R3fe27H9_wIMCmI5rIEyxVXYCW9VLco-AZ/s400/LINQ-2-SQL-4.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5361613728517581010&quot; /&gt;&lt;/a&gt;&lt;br /&gt;The mistake here is similar to the above two, but here it’s the &lt;strong&gt;worst situation&lt;/strong&gt; - the method &lt;em&gt;GetByOwner(…)&lt;/em&gt; needs as much quires as the number of the &lt;em&gt;sampleObjects&lt;/em&gt; + 1. This means that in the future, while your DB grows the performance will become worst and worst. The problem’s fix is so ironically easy – just compare…&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHzrVBPEH3c5A-zsDb3geTVKqtL-qReiRMdSE2a6QrSfIMM1HU9EMU4mK0QojoP-ieAcj9gmvVy9nH0wguAGfLmW_DOb24vtCHldQ4epCtSQVMha-MhYrni3BjnVFNooMGV8E0lZ_F9XgA/s1600-h/LINQ-2-SQL-5.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 108px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHzrVBPEH3c5A-zsDb3geTVKqtL-qReiRMdSE2a6QrSfIMM1HU9EMU4mK0QojoP-ieAcj9gmvVy9nH0wguAGfLmW_DOb24vtCHldQ4epCtSQVMha-MhYrni3BjnVFNooMGV8E0lZ_F9XgA/s400/LINQ-2-SQL-5.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5361614236801547330&quot; /&gt;&lt;/a&gt;&lt;br /&gt;The above code produces only a single query.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;General advice&lt;/strong&gt;&lt;br /&gt;We have seen some problems, which weren’t found during the development process. The question is how to prevent ourselves from such things? &lt;br /&gt;Firstly – one should definitely not use technology or framework in production without a good research. As we just have seen the problems have very straightforward and logical explanation. We should confess that not reading enough is a problem of many developers. &lt;br /&gt;Second – as I mentioned in my &lt;a href=&quot;http://veskokolev.blogspot.com/2009/07/vesko-on-performance-new-series-of.html&quot;&gt;previous post&lt;/a&gt; – use class like &lt;em&gt;DebuggerWritter&lt;/em&gt; for profiling every method. Normally such problems could be found very easily just with one testing. Yes – you will need to have at least a vague idea about what kind of SQL statement should be composed by LINQ to SQL but this is a normal requirement for each software developer. &lt;br /&gt;Third – stick up to the techniques shown in the solutions above. They represent a good pattern for writing DAL logic with LINQ to SQL.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;Hopefully, now you should know more about LINQ to SQL and how to avoid some of the problems, which are commonly seen in the developers’ code. It will be very helpful to add your comments to that topic showing problems that you have had/seen in your work. &lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Vesko Kolev</description><link>http://veskokolev.blogspot.com/2009/07/vesko-on-performance-linq-to-sql.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Ar68ZlUZW7klHcJ2OMEeZdfUTpcyw9_ogUr8IcpWJiRB81uYEEWU-om5MZRCuV-msLe0Vm_zMFlY0Weq-tXj5aIJuYfpwBa3e7qmEc6c4w63zjd-BwqJBh7rNJFotZ7x7fzA2_PnqxKK/s72-c/LINQ-2-SQL-1.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-2079343844387222319</guid><pubDate>Tue, 21 Jul 2009 11:38:00 +0000</pubDate><atom:updated>2009-07-21T05:08:34.654-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET 3.5</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">LINQ</category><category domain="http://www.blogger.com/atom/ns#">LINQ to SQL</category><category domain="http://www.blogger.com/atom/ns#">Performance</category><title>Vesko on Performance – New Series of Posts</title><description>&lt;strong&gt;Intro&lt;/strong&gt;&lt;br /&gt;These days I have been working on a very interesting project here at &lt;a href=&quot;http://nars.bg&quot;&gt;National Academy for Software Development&lt;/a&gt;. I had to make a performance audit of a project on which two or three development teams have been working on previously. &lt;br /&gt;&lt;br /&gt;The situation:&lt;br /&gt;- The used technologies were .NET Framework 3.5, C# 3.0, ASP.NET 3.5, SQL Server 2005, LINQ and LINQ to SQL.&lt;br /&gt;- 2-tier architecture.&lt;br /&gt;- The coding style – very different (different dev teams from different parts of the world). &lt;br /&gt;- The used practices – hard to find after so many patches.&lt;br /&gt;- The performance – poor.&lt;br /&gt;&lt;br /&gt;I’m preparing a short series of posts about the problems, which I could be found in this software as well as in many others. As you will see below not all of the problems could be fixed. However most of them could be and you can think of them as something which you should definitely avoid. I’ll provide you with some set of advices how to find/avoid such problems. They will include tools and practices which will help you to provide more robust and reliable software. I will be very happy to “hear” &lt;strong&gt;your comments &lt;/strong&gt;about the written as well as your personal experience with similar problems.&lt;br /&gt;&lt;br /&gt;Let’s start our performance journey with the first topic! &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQSZC-0eCcppbO2OMIQPH8pAS16NeTjcppybCAv9KYqbmDh3AhA33anAW7CoBI5Oc8AtycANPET7VGEcQH_nll_7Sn9I30fZ1O8nSrxlc9jkYEGobx7B339a5uG2-lgNzRYTWUBbb_B1Su/s1600-h/performance.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 112px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQSZC-0eCcppbO2OMIQPH8pAS16NeTjcppybCAv9KYqbmDh3AhA33anAW7CoBI5Oc8AtycANPET7VGEcQH_nll_7Sn9I30fZ1O8nSrxlc9jkYEGobx7B339a5uG2-lgNzRYTWUBbb_B1Su/s400/performance.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5360878456863419746&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Shit of the Day: DataPager Binds Twice&lt;/strong&gt;&lt;br /&gt;While I was observing the behavior of one of the pages which seems to have problems, I found something very “interesting”. Firstly, let me give you some necessary info about this particular situation. The page had a &lt;em&gt;ListView &lt;/em&gt;control, &lt;em&gt;DataPager &lt;/em&gt;associated with it and &lt;em&gt;ObjectDataSource &lt;/em&gt;against which the &lt;em&gt;ListView &lt;/em&gt;was bound. As you know, the &lt;em&gt;ObjectDataSource &lt;/em&gt;provides two properties – &lt;em&gt;SelectMethod &lt;/em&gt;and &lt;em&gt;SelectCountMethod &lt;/em&gt;which retrieve respectively the items with which the list will be bound as well as their count. Of course the data source should know also which class provides these methods, so there is also property called &lt;em&gt;TypeName&lt;/em&gt;.  You know that for the paging functionality we should be able to “ask” how many records are there as well as “give me the i-th page”. This in theory means that we should make two DB queries to “ask” these two questions. &lt;br /&gt;&lt;br /&gt;But what happened in practice? I found that the select method and the count method were called twice. My first suspicion was that the control was bound twice. I start inspecting the code line by line searching for such thing.  After a few minutes of debugging I convinced myself that the list was bound &lt;strong&gt;only once&lt;/strong&gt;. The next step was to review the DAL (Data Access Layer) logic for potential problems. Again - nothing which could cause this behavior… &lt;br /&gt;&lt;br /&gt;In such situation the only thing which could be done is googling. I searched for a while and found the following article from a Microsoft’s site – &lt;a href=&quot;http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=355348&quot;&gt;“DataPager double binds when paging using QueryStringField”&lt;/a&gt; which was confirmed to be a bug. I’ve quickly checked whether QueryStringField is used in my situation and voila – the problem was dissected.&lt;br /&gt;&lt;br /&gt;The short description about this bug is: &lt;em&gt;“When you use the QueryStringField with a DataPager it causes the ListView to bind twice; once as if it was on the first page, and a second time for whatever page is passed via the QueryString (even if it is also the first page). Naturally, this is very bad for performance and completely unnecessary.”&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Currently Microsoft hasn’t provided any workarounds for this problem. So just try to avoid using this particular combination in your projects.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;General advice &lt;/strong&gt;&lt;br /&gt;When you are developing particular page/control always check the queries which are made against your database both for loading and storing data. When using ORM frameworks such as LINQ to SQL it is very important to know exactly what queries are executed against your DB. You could use frameworks like &lt;a href=&quot;http://logging.apache.org/log4net/index.html&quot;&gt;Log4Net&lt;/a&gt;/&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/cc309506.aspx&quot;&gt;Microsoft Enterprise Library Logging Application Block&lt;/a&gt; along with &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.log.aspx&quot;&gt;DataContext.Log&lt;/a&gt;  property. You should definitely use (if not already) classes like &lt;a href=&quot;http://www.u2u.info/Blogs/Kris/Lists/Posts/Post.aspx?ID=11&quot;&gt;this&lt;/a&gt; for outputting LINQ to SQL queries to the debugger output. These very simple practices will save your live from similar shit of the day.&lt;br /&gt;&lt;br /&gt;Stay tuned and have fun!</description><link>http://veskokolev.blogspot.com/2009/07/vesko-on-performance-new-series-of.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQSZC-0eCcppbO2OMIQPH8pAS16NeTjcppybCAv9KYqbmDh3AhA33anAW7CoBI5Oc8AtycANPET7VGEcQH_nll_7Sn9I30fZ1O8nSrxlc9jkYEGobx7B339a5uG2-lgNzRYTWUBbb_B1Su/s72-c/performance.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-4080743921720668488</guid><pubDate>Sat, 28 Mar 2009 15:23:00 +0000</pubDate><atom:updated>2009-03-28T08:46:15.111-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">AJAX</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><category domain="http://www.blogger.com/atom/ns#">UpdatePanel</category><title>Inline Scripts in UpdatePanel – Doesn’t Work After Partial Postback</title><description>&lt;span style=&quot;font-weight:bold;&quot;&gt;Hello, guys!&lt;/span&gt;&lt;br /&gt;Last months I have worked on a very interesting project which uses latest .NET technologies as well as some other APIs like Microsoft Virtual Earth and Google Earth. My team and I had a lot of challenging problems to solve some of which I want share with you.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;The situation&lt;/span&gt;&lt;br /&gt;Imagine that we have a user control called &lt;span style=&quot;font-weight:bold;&quot;&gt;UserControlWithInlineScripts&lt;/span&gt; with the following code in it:&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJcdIQav_4O1lZT8G-e937fWX6gqTwN9t1KNVJqYRm-qLdMpAAMAIeOoM-pXaT8e5rI28WX2W-axD2TjjKa5yGlvBlFpgpeOghQeyWtUwOj8pAlSUMFWvyZcChIbAGVYonpqouOgFoiKC/s1600-h/Image1.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJcdIQav_4O1lZT8G-e937fWX6gqTwN9t1KNVJqYRm-qLdMpAAMAIeOoM-pXaT8e5rI28WX2W-axD2TjjKa5yGlvBlFpgpeOghQeyWtUwOj8pAlSUMFWvyZcChIbAGVYonpqouOgFoiKC/s400/Image1.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5318262323325109138&quot; /&gt;&lt;/a&gt;&lt;br /&gt;As you can see, the only thing which we have on the page is a button, which calls a JavaScript function &lt;span style=&quot;font-weight:bold;&quot;&gt;SayHelo()&lt;/span&gt; when clicked. The interesting thing here to note is that the function is declared inline in the &lt;span style=&quot;font-weight:bold;&quot;&gt;.ascx&lt;/span&gt; file (we will see later why this is so important).&lt;br /&gt;&lt;br /&gt;Now let’s put the control in a sample page like the following:&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTAvmb5ANdLj-dVqpRJ7OMROcaLYCqC83JgMIuOUOZvfJAKPlbGYGRq7PTEavLfAdU5Ev49EPAFDzq8yLl-Viv36H9ktC9Gpo2nj424y3LgIssHEH57pxjp9_KaTDl9yAvBYDICD_9yqbC/s1600-h/Image2.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 74px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTAvmb5ANdLj-dVqpRJ7OMROcaLYCqC83JgMIuOUOZvfJAKPlbGYGRq7PTEavLfAdU5Ev49EPAFDzq8yLl-Viv36H9ktC9Gpo2nj424y3LgIssHEH57pxjp9_KaTDl9yAvBYDICD_9yqbC/s400/Image2.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5318263045205592450&quot; /&gt;&lt;/a&gt;&lt;br /&gt;The &lt;span style=&quot;font-weight:bold;&quot;&gt;ButtonShowControl &lt;/span&gt;on the server side only sets the &lt;span style=&quot;font-weight:bold;&quot;&gt;Visible &lt;/span&gt;property of our user control to true. From first sight nothing strange – we have just a control which is showed dynamically by a button. If you test this code it will work perfectly well.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;But what is the actual problem? Just put a wrapping UpdatePanel…&lt;/span&gt;&lt;br /&gt;You will have problem if you try to put the content of the page in an &lt;span style=&quot;font-weight:bold;&quot;&gt;UpdatePanel&lt;/span&gt;. When you click the button to show the control – it will be shown (as we actually expect). But if you click the button which calls the inline script, the following JavaScript error appears: &lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXMNbTVxiqLIS5BtKfFEQs8qlUaPJbiTnjObUe4wgOqxP3e88jlv-DSsSCI9I8-y3G0A6_0Gj3MBm98mx1JlwcQ3qfri_c5n0wBZraDjl0uvdOZW4iGGRHRJl3ak5E1z8Bd7q7_f9YNx5Z/s1600-h/Image3.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 219px; height: 125px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXMNbTVxiqLIS5BtKfFEQs8qlUaPJbiTnjObUe4wgOqxP3e88jlv-DSsSCI9I8-y3G0A6_0Gj3MBm98mx1JlwcQ3qfri_c5n0wBZraDjl0uvdOZW4iGGRHRJl3ak5E1z8Bd7q7_f9YNx5Z/s400/Image3.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5318263576226280162&quot; /&gt;&lt;/a&gt;&lt;br /&gt;As you can see the browser cannot find the function which the button’s click calls. You know that everything with the function and its call should be OK as we have just tested it without the &lt;span style=&quot;font-weight:bold;&quot;&gt;UpdatePanel&lt;/span&gt;. Therefore problem obviously is in the panel, but where exactly?&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Explanation of the problem&lt;/span&gt;&lt;br /&gt;Why this happens? When you update the content inside an &lt;span style=&quot;font-weight:bold;&quot;&gt;UpdatePanel &lt;/span&gt;the old content of the panel is replaced by the new content trough the &lt;span style=&quot;font-weight:bold;&quot;&gt;innerHTML &lt;/span&gt;property. In general if you set the &lt;span style=&quot;font-weight:bold;&quot;&gt;innerHTML &lt;/span&gt;of a DOM element with markup which contains a script block inside it, this doesn’t cause the script to be registered as script in the DOM tree. In other words the browser looks at this new content as pure markup (text). If you want to say to the browser that some string is script (in other words inject a script block into the DOM) you can do this with the method &lt;span style=&quot;font-weight:bold;&quot;&gt;document.createElement(“script”)&lt;/span&gt;. Another way to evaluate and execute script, which you have as string is to use the &lt;span style=&quot;font-weight:bold;&quot;&gt;eval(string)&lt;/span&gt; function, which takes only one string argument – the script to be executed.&lt;br /&gt;&lt;br /&gt;There are some interesting static methods into the &lt;span style=&quot;font-weight:bold;&quot;&gt;ScriptManager &lt;/span&gt;class which gives you the ability to register startup script, script block, onsubmit statement, etc. They prevent us from this problem if we do not have our scripts as inline and register them trough this methods. &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Conclusion&lt;/span&gt;&lt;br /&gt;In general it is not a good practice to have your scripts as inline and is better to have them as an external .js files. But the problem with the inline one still exists. You can think of some workarounds of this problem and this is my challenge for you – just share your ideas!</description><link>http://veskokolev.blogspot.com/2009/03/inline-scripts-in-updatepanel-doesnt.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJcdIQav_4O1lZT8G-e937fWX6gqTwN9t1KNVJqYRm-qLdMpAAMAIeOoM-pXaT8e5rI28WX2W-axD2TjjKa5yGlvBlFpgpeOghQeyWtUwOj8pAlSUMFWvyZcChIbAGVYonpqouOgFoiKC/s72-c/Image1.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-1531235232847697752</guid><pubDate>Wed, 31 Dec 2008 09:12:00 +0000</pubDate><atom:updated>2008-12-31T02:25:01.447-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Algorithms</category><category domain="http://www.blogger.com/atom/ns#">Basics</category><category domain="http://www.blogger.com/atom/ns#">Books</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Programming</category><title>The Book “Introduction to Programming with Java” - Ready for Publishing!</title><description>&lt;span style=&quot;font-weight:bold;&quot;&gt;The book&lt;/span&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7ox6zi-fmYnwfMIklgtSIty0BqBu-O5qhsBRpMFuSjOKKoym6RVLpcjY6MP6T6_4jyOPGh-cjoQ-Gl1wbH3hY4Yhq31gNMC53Zw4_V0fZmEuNvCXTsuGX0xx5WZe1oZsT3FBjatkF4lZY/s1600-h/Introduction-to-Programming-with-Java-Cover.png&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 281px; height: 400px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7ox6zi-fmYnwfMIklgtSIty0BqBu-O5qhsBRpMFuSjOKKoym6RVLpcjY6MP6T6_4jyOPGh-cjoQ-Gl1wbH3hY4Yhq31gNMC53Zw4_V0fZmEuNvCXTsuGX0xx5WZe1oZsT3FBjatkF4lZY/s400/Introduction-to-Programming-with-Java-Cover.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5285894647480985074&quot; /&gt;&lt;/a&gt;I am very happy that my last post for this year is this one. I want to share with you the news that the book “Introduction to Programming with Java”, in which I have taken part as an author, is about to be published. &lt;br /&gt;&lt;br /&gt;As you probably remember from my previous post, it covers a lot of different topics on the fundamentals of computer programming. The book does not focus on the Java language – it just uses the Java language as a tool for writing the samples. That’s why we believe it will become one of the prime sources of knowledge for beginners in computer science short after it is on the market. There I have written a chapter about one of the most widely used advanced data structures – trees and graphs.&lt;br /&gt;Hopefully one will be able to buy a paper copy of the book in the first months of the New Year. Probably I haven&#39;t mentioned, but the book is free - you just buy the paper. It is 920-930 pages! For more information, you can look &lt;a href=&quot;http://www.nakov.com/blog/2008/12/26/the-book-introduction-to-programming-with-java-is-about-to-be-published/&quot;&gt;here&lt;/a&gt;. You can download a free copy of the book from &lt;a href=&quot;http://introjavabook.googlecode.com/files/Intro-Java-Book-26-December-2008.rar&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Instead of conclusion&lt;/span&gt;&lt;br /&gt;This year was very interesting and dynamic. A lot of things were changed. I hope the next year will be very productive and good for all of us! &lt;br /&gt;&lt;br /&gt;I wish you all the best, dear readers! I wish you having your dreams came true, but.. not all of them. Lets have some for the years coming, too!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Vesko Kolev</description><link>http://veskokolev.blogspot.com/2008/12/book-introduction-to-programming-with.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7ox6zi-fmYnwfMIklgtSIty0BqBu-O5qhsBRpMFuSjOKKoym6RVLpcjY6MP6T6_4jyOPGh-cjoQ-Gl1wbH3hY4Yhq31gNMC53Zw4_V0fZmEuNvCXTsuGX0xx5WZe1oZsT3FBjatkF4lZY/s72-c/Introduction-to-Programming-with-Java-Cover.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-1703251105128072294</guid><pubDate>Sat, 22 Nov 2008 18:23:00 +0000</pubDate><atom:updated>2008-11-22T10:56:33.964-08:00</atom:updated><title>Vesko Kolev - what happened with this guy?</title><description>&lt;strong&gt;Hello, folks!&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMYMhZ6eW1PKm4tNON0wvADZPecA6SmUs0gDRjG0_qhpVp9PdNQ8JnqmvOhPWkmZpIboB16ttBuPVkDVGuPKtpeg4OgmB4yowVtf3BdPRqbosGirqNinPj83WVKFuLWQGmHPSTI3JHbTdV/s1600-h/vesko_kolev.png&quot;&gt;&lt;img style=&quot;float:right; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 123px; height: 162px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMYMhZ6eW1PKm4tNON0wvADZPecA6SmUs0gDRjG0_qhpVp9PdNQ8JnqmvOhPWkmZpIboB16ttBuPVkDVGuPKtpeg4OgmB4yowVtf3BdPRqbosGirqNinPj83WVKFuLWQGmHPSTI3JHbTdV/s400/vesko_kolev.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5271554777018804290&quot; /&gt;&lt;/a&gt;I haven’t blogged for a long time. Do you remember me? Just to be sure that you haven&#39;t forgot my face - on the right side is a picture of me ;-). A lot of things happened, a lot of future topics came in my mind trough this period. For sure you will see soon what I am talking about. &lt;br /&gt;&lt;br /&gt;I have postponed this post for some time but think that the point at which to write it came.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What happened with me?&lt;/strong&gt;&lt;br /&gt;Firstly, I have left my previous company. I have been there for more than 2 years. I have worked on and led as a team leader a lot of different .NET projects and had the chance to work with a lot of great professionals from all over the world. My team and I have produced a lot of great functionality to our clients which was our first goal. However my decision to leave was based on some differences in thinking between me and my bosses – there were things, which I just cannot accept. The people, who know me well, will confirm that I am a very principled man. The good news is that this is an old story and is behind in the past. Now only the good memories will persist and of course the great amount of experience piled there.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Meanwhile…&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEPmdT6XvBF8Mgx0nj2UVUmoAuWqT19z0lLeS4unVCuG8EMNjte8TFS2toMd_PnNmk4M0C8wSlZX9Vo_Gx9DJfXOKyX_lTOkhLGnTLlr0h2akp8aUHOw5l_XPzZ-tVkI7-qeOMwJhsUxKQ/s1600-h/images.jpg&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 128px; height: 97px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEPmdT6XvBF8Mgx0nj2UVUmoAuWqT19z0lLeS4unVCuG8EMNjte8TFS2toMd_PnNmk4M0C8wSlZX9Vo_Gx9DJfXOKyX_lTOkhLGnTLlr0h2akp8aUHOw5l_XPzZ-tVkI7-qeOMwJhsUxKQ/s400/images.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5271551802158915314&quot; /&gt;&lt;/a&gt;Apart from that – I have joined a team, led by &lt;a href=&quot;http://nakov.com/blog&quot;&gt;Svetlin Nakov&lt;/a&gt;, which started (and soon will finish) writing a book on a software development topic called “Introduction to Programming with Java”. It covers a lot of different topics on the fundamentals of computer programming. The book does not focus on the Java language – it just uses the Java language as a tool for writing the samples. That’s why we believe it will become one of the prime sources of knowledge for beginners in computer science short after it is on the market. There I have written a chapter about one of the most widely used advanced data structures – trees and graphs. You can find more information about the book &lt;a href=&quot;http://www.nakov.com/blog/2008/07/25/open-source-book-introduction-to-programming-with-java/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In the same period I have started to work as a part time .NET trainer at National Academy for Software Development. There have led different courses in some of the cutting edge Microsoft technologies. In my previous company training the new members of the development teams was one of my responsibilities and I liked doing it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Where am I today?&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgMkZllblDAbMz1q3eTo7VXFzdovm7mdQoYu8X3NZz7k-8WIsdj-nQ8MyLoPsNVFWiBaamxlMU0QnhgFHOHqCE9qycDHFmGjS3j0fHHad36fGz8N3J5cBMe3dMl_L62Qv3mJDJWFScFvn3/s1600-h/dotnet.jpg&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 116px; height: 77px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgMkZllblDAbMz1q3eTo7VXFzdovm7mdQoYu8X3NZz7k-8WIsdj-nQ8MyLoPsNVFWiBaamxlMU0QnhgFHOHqCE9qycDHFmGjS3j0fHHad36fGz8N3J5cBMe3dMl_L62Qv3mJDJWFScFvn3/s400/dotnet.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5271552816365504882&quot; /&gt;&lt;/a&gt;Later I joined NASD .NET team as a full time employee. My responsibilities there include leading a team of very skilled .NET developers working on variety of different .NET projects using the latest technologies and best practices. Another major part of my job is to train people in advanced concepts of .NET programming. But still - why choosing NASD? I have refused some great offers of other good companies and chose this one, because there one can find one of the best and most popular software engineers in Bulgaria. It is a pleasure for me to work with such guys. Of course meeting new people almost every day at our courses is something which I also highly appreciate.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What you can expect?&lt;/strong&gt;&lt;br /&gt;You know me… Three months is a lot of time and in this period I have worked on and solved a lot of different problems. I will try to write more frequently sharing with you my everyday experience with the software engineering as a whole.  I will be happy to hear from you from time to time about your experience with the same or similar problems which you have.&lt;br /&gt;&lt;br /&gt;See you soon!</description><link>http://veskokolev.blogspot.com/2008/11/vesko-kolev-what-happened-with-this-guy.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMYMhZ6eW1PKm4tNON0wvADZPecA6SmUs0gDRjG0_qhpVp9PdNQ8JnqmvOhPWkmZpIboB16ttBuPVkDVGuPKtpeg4OgmB4yowVtf3BdPRqbosGirqNinPj83WVKFuLWQGmHPSTI3JHbTdV/s72-c/vesko_kolev.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-4438148513616496676</guid><pubDate>Tue, 12 Aug 2008 16:22:00 +0000</pubDate><atom:updated>2008-08-14T02:44:22.896-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Algorithms</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><title>Algorithms: A real world example</title><description>&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br /&gt;Hi guys!&lt;br /&gt;Today we are going to dive into a real world example of using algorithms + data structures. The task is not very hard, but I think it is very useful example how important is one to have an in-depth knowledge of algorithms and data structures.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the problem?&lt;/strong&gt;&lt;br /&gt;These days a friend of mine asked me the following question: “How can we retrieve the different files (in the terms of different names) from given two directories, including the subdirectory files?” In other words the question is how we can get the files from one directory(or in some of its subdirectories) which doesn&#39;t exist in the other and the opposite - the files which are in the second directory(or in some of its subdirectories) and does not exist in the first one.&lt;br /&gt;Yes… I know that you can solve this. You can do it even in 5 minutes using whatever data structure you want which has a contains method (or equivalent). But do you think that this approach is going to be the fastest one? Or a more scientific question – is your algorithmic complexity good enough for the needs of your enterprise application?&lt;br /&gt;In general there is uncountable number of algorithmic tasks out there and most of them have more than one good algorithmic solution. I am going to show you a problem with a possible solution.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The algorithm&lt;/strong&gt;&lt;br /&gt;The approach is based on one classical algorithm. This algorithm merges two given sorted sequences in a new sorted sequence, which contains the elements from both sequences in linear time. On the following picture, you will see two sorted input sequences. The algorithm to get the result sequence is the following:&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWmpXtGi9j_MLaNkykfcu335QL60H_Wf2IxIop6QVwMymHk8TCZftkJ1oRskVJChb-_FcX97LSHaG9y4ePfzHhwK5B9oxV2lRWI0FslVPETjq8f861nGANWkoPTU2CnirI-uqLWxgxszlG/s1600-h/Untitled.png&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5233667767203208546&quot; style=&quot;FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWmpXtGi9j_MLaNkykfcu335QL60H_Wf2IxIop6QVwMymHk8TCZftkJ1oRskVJChb-_FcX97LSHaG9y4ePfzHhwK5B9oxV2lRWI0FslVPETjq8f861nGANWkoPTU2CnirI-uqLWxgxszlG/s400/Untitled.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;1)While both sequences are not empty - get the minimum of the two top elements and put it at the end of the result sequence. Remove the element from the input.&lt;br /&gt;2)Now if there are any elements left in the input, they should be in only one of the input arrays. If there are some element left – add them at the end of the new sequence and remove them from the input.&lt;br /&gt;&lt;br /&gt;In our case we first have 0 and 1. 0 &lt; 1 therefore we put 0 in the new sequence. The first input sequence will be 3, 3, 15, 19, 76, 89, 99. We are doing this till the moment when the second sequence (which is shorter than the first one) is over. Than we just add the element 76, 89 and 99 to the end of the result sequence.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the modification?&lt;/strong&gt;&lt;br /&gt;You just need to get your both sequence of files in an ascending sorting manner. If the files on the top of the two sequences are equal, then just remove them. If the files are different, then take the one which is name is “less” in the terms of lexicographical order and put it at the end of the result sequence (Note: Here you should check whether the result sequence doesn’t already ends in this filename. Think of a situation in which this is required.). If one of the sequences is not empty, we get its entire elements and put them at the end of the result sequence again taking in mind the above note.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Which are the data structures?&lt;/strong&gt;&lt;br /&gt;As we saw, we access only the top elements in the input sequences. This is the major feature of the Stack data structure. The result sequence – we add elements at its end and need to peek the last added element. So we can use for example Queue or Linked List depending on the implementation which we are using.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;In this post I have tried to show you one problem which can be solved optimally with an elegant algorithm. I have tried not to be bounded to any programming language and not to be clear enough, because want you guys to think of the rest! This is the way in which I believe one should learn to program – with logical thinking and researching.&lt;br /&gt;&lt;br /&gt;Hope you learned something new!</description><link>http://veskokolev.blogspot.com/2008/08/algorithms-real-world-example.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWmpXtGi9j_MLaNkykfcu335QL60H_Wf2IxIop6QVwMymHk8TCZftkJ1oRskVJChb-_FcX97LSHaG9y4ePfzHhwK5B9oxV2lRWI0FslVPETjq8f861nGANWkoPTU2CnirI-uqLWxgxszlG/s72-c/Untitled.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-4299114899549118285</guid><pubDate>Fri, 18 Jul 2008 07:02:00 +0000</pubDate><atom:updated>2008-07-18T00:25:23.522-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">Tricks</category><title>Tricks: How to get N random rows from a table in T-SQL</title><description>Hi readers!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is this blog post for?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Today I am going to present you the first post of my second series - Tricks. As I said before I will show &lt;i&gt;&quot;Technology Specific Tricks - short posts about something, which I have researched and which I want to preserve and share with you all.&quot;&lt;/i&gt;&lt;br /&gt;The first one is about T-SQL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The problem - How to get N random rows from a table?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxsGwOgARsWWITFjzA5d03fIjMheoewNcIQ6W0BKq5jTmrZLiRuO9h1aiaixxwbmWXZJXDbqLa0vAQ5SRBs_r3pjPKGLaLXB__fO9_ynQLUuyXoQK79mFkOtViKVNQsae5Ds9Yc8D6yap3/s1600-h/How+to+get+N+random+rows+from+a+table+in+T-SQL.png&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5224247652773671826&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxsGwOgARsWWITFjzA5d03fIjMheoewNcIQ6W0BKq5jTmrZLiRuO9h1aiaixxwbmWXZJXDbqLa0vAQ5SRBs_r3pjPKGLaLXB__fO9_ynQLUuyXoQK79mFkOtViKVNQsae5Ds9Yc8D6yap3/s400/How+to+get+N+random+rows+from+a+table+in+T-SQL.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A little explanation - actually ORDER BY NEWID() sorts the rows in a random way. In our case we just take as much of the first as we need.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You just saw what you can expect from this type of posts. &lt;br /&gt;Hope this helps!</description><link>http://veskokolev.blogspot.com/2008/07/tricks-how-to-get-n-random-rows-from.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxsGwOgARsWWITFjzA5d03fIjMheoewNcIQ6W0BKq5jTmrZLiRuO9h1aiaixxwbmWXZJXDbqLa0vAQ5SRBs_r3pjPKGLaLXB__fO9_ynQLUuyXoQK79mFkOtViKVNQsae5Ds9Yc8D6yap3/s72-c/How+to+get+N+random+rows+from+a+table+in+T-SQL.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-5185459770244647200</guid><pubDate>Wed, 16 Jul 2008 20:03:00 +0000</pubDate><atom:updated>2008-07-25T00:07:30.182-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Basics</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">General</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><title>Basics: Why to use accessors and mutators?</title><description>&lt;b&gt;What is this blog post for?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This is the first post from my new series – Basics. In this series I will add things which are (in my opinion) really important and should be perfectly known by every Developer/Senior. I will add topics which I have been asked for or things which I have expected to be known by the mass, but it wasn’t that case. I will try to be as much platform independent as possible. Of course I will add some general knowledge about new things in C# 3.0. I will try to be as much detailed as possible but will appriciate any help/comments on making things broader. No matter – lets go back to basics!&lt;br /&gt;This post is for the so called accessors and mutators / getters and setters / get and set methods / properties in C# / etc. and why we need them at all?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The explanation&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;coloredcode&quot;&gt;&lt;span class=&quot;kwd&quot;&gt;public class&lt;/span&gt; Person&lt;br /&gt;{ &lt;br /&gt;    &lt;span class=&quot;kwd&quot;&gt;public int&lt;/span&gt; age;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwd&quot;&gt;public class&lt;/span&gt; Person&lt;br /&gt;{ &lt;br /&gt;    &lt;span class=&quot;kwd&quot;&gt;private int&lt;/span&gt; age; &lt;br /&gt;    &lt;span class=&quot;kwd&quot;&gt;public int&lt;/span&gt; getAge() &lt;br /&gt;    { &lt;br /&gt;        &lt;span class=&quot;kwd&quot;&gt;return&lt;/span&gt; age; &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;kwd&quot;&gt;public int&lt;/span&gt; setAge(&lt;span class=&quot;kwd&quot;&gt;int value&lt;/span&gt;) &lt;br /&gt;    {  &lt;br /&gt;        age = &lt;span class=&quot;kwd&quot;&gt;value&lt;/span&gt;; &lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Firstly, accessors and mutators are used mainly for encapsulating fields of a class (an example for different usage can be given for storing information in the Session or ViewState). It’s not good practice to expose public fields (or why it is better to use getters and setters), because:&lt;br /&gt;&lt;br /&gt;- If you use get and set method, you are able to control the access of the property. For example you can give public get and protected/private/etc. set.&lt;br /&gt;&lt;br /&gt;- You can put any kind of validation in the set method. If there is a need you can throw an exception.&lt;br /&gt;&lt;br /&gt;- The situation may need to set other dependant properties, too, when accessing/setting the current one.&lt;br /&gt;&lt;br /&gt;- When you access the get/set method you can rise an event (for example OnValueChanged)&lt;br /&gt;&lt;br /&gt;- You can convert the value which you return from the getter to more informationless data (for example you can have a value for a price and you want to return it with 2 digits after the decimal point, but in your calculations it should be as much digits as possible for more correct calculations).&lt;br /&gt;&lt;br /&gt;- It is easier to bind against proeprties.&lt;br /&gt;&lt;br /&gt;- If you expose public fields, later you cannot change them into properties without recompiling.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Still why?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;And yet again – why to use getters and setters when we have just a simple integer field which we do not think will need any special work now? Why should I “loose” my time writing additional code? Because in our everyday life almost every time the specification is changed and almost every time there is a situation which we didn’t take in mind at the time of writing the code. In general in my opinion a good developer is the one that can write as much extensible code as possible, as much reusable as possible and as easier to change as possible nomatter which platform is used. The practice of using getters and setters gives you the flexibility to be the winner in the battle between you and the changing specification. It gives you a very simple rule of a thumb which makes your code keeping tight encapsulation. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Something in addition for C# 3.0&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Yes – one of the greatest things in C# (compared to Java for example) is its properties. In Java you do not have such structure (as I have heard this is going to be changed in some of the future releases of Java. I will just ask - where are my get* and set* methods!?!?!). Most of the code one will see in an average Java program is a bunch of getters and setters (hopefully generated).&lt;br /&gt; In C# we have the chance to work with this more clear structure called property. However in C# 1.1 there was a little problem – there was no way in which you can say “I want to have a public getter and a private setter”. The only ability was to say whether you want to have get and/or set with an one and the same access modificator.&lt;br /&gt;In C# 2.0 we were given the access modification functionality for each of the two property parts. This was great. But there was still something which missed me all the time – I wanted to have a way to enforce everybody to use the property and not the field (in general this has sense if you think about the access of the field in the class in which it is defined). Here the C# 3.0 come one day and say “I can fix this!” The magic is called Automatic properties. See the following example which shows an automatic property:&lt;br /&gt;&lt;pre class=&#39;coloredcode&#39;&gt;&lt;span class=&#39;kwd&#39;&gt;int&lt;/span&gt; Age&lt;br /&gt;{&lt;br /&gt;    &lt;span class=&#39;kwd&#39;&gt;get&lt;/span&gt;;&lt;br /&gt;    &lt;span class=&#39;kwd&#39;&gt;set&lt;/span&gt;;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;As you can see we do not need to explicitly define field for this property. What actually happens is that when the C# 3.0 compiler see an empty get/set property it will automatically generate a private field for you. This means – less code to write and more to generate. Another effect is the fact that you cannot directly access the fields which solves the problem mentioned above.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Just think of all the mentioned things in the above post. You as developer can only benefit from this. If you didn’t find any sense of using getters/setters, to be honest with you - just find a better field for you.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;P.S.&lt;/b&gt; If you want to get more information on automatic properties and what happens under the covers you can go to &lt;a href=&quot;http://community.bartdesmet.net/blogs/bart/archive/2007/03/03/c-3-0-automatic-properties-explained.aspx&quot;&gt;Bart De Smet Blog&lt;/a&gt;.</description><link>http://veskokolev.blogspot.com/2008/07/basics-why-to-use-assessors-and.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-5635676370165336417</guid><pubDate>Wed, 16 Jul 2008 09:29:00 +0000</pubDate><atom:updated>2008-07-16T03:49:07.152-07:00</atom:updated><title>Future plans</title><description>Hi guys!&lt;br /&gt;&lt;br /&gt;I haven&#39;t blog for a while, but I can assure you that a lot things for blogging come to my mind for this period. I just haven&#39;t enough time last days as I had a lot of work for the &lt;a href=&quot;http://fmi.uni-sofia.bg/&quot;&gt;university&lt;/a&gt; and for my new &lt;a href=&quot;http://www.lightmaker.com/&quot;&gt;company&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As you can see I am starting with a change - my new blog design &lt;i&gt;(here I should add one big thanks to &lt;a href=&quot;http://blog.creonfx.com/&quot;&gt;Peter Velichkov&lt;/a&gt; for his help tuning the theme :-))&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;What you can expect recently? I can divide the posts from the near future in the following directions:&lt;br /&gt; - Advanced Basics - the things which every senior should know.&lt;br /&gt; - .NET 3.0/3.5 Technologies - I will try to provide some posts about the new things in 3.5 as well as some of the W* technologies from 3.0.&lt;br /&gt; - Mobile Software/Hardware - here I will try to share some of my personal experience with the Apple&#39;s iPhone , Asus EEEPC and some thoughts about Symbian.&lt;br /&gt; - Technology Specific Tricks - short posts about something, which I have researched and which I want to preserve and share with you all.&lt;br /&gt;&lt;br /&gt;Hope you like my new blog theme and my future topics. I will try to be regular in blogging because it really is very important for me as a person and for the community as whole.&lt;br /&gt;&lt;br /&gt;Expect my next post in a short time!</description><link>http://veskokolev.blogspot.com/2008/07/hi-guys-i-havent-blog-for-while-but-i.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-7895423491036533994</guid><pubDate>Mon, 19 May 2008 07:36:00 +0000</pubDate><atom:updated>2008-05-19T00:42:23.647-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">General</category><category domain="http://www.blogger.com/atom/ns#">Interlingua</category><category domain="http://www.blogger.com/atom/ns#">Machine Translation</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><title>Bulgarian is supported by Google Translate!</title><description>Yeeeeah... it&#39;s true! Goolge have recently added translation capabilities for 10 new languages! The new languages include Bulgarian, Croatian, Czech, Danish, Finnish, Hindi, Norwegian, Polish, Romanian and Swedish.&lt;br /&gt;&lt;br /&gt;Finally Bulgarian is supported! What does this means to you guys? At least you can read my blog in Bulgarian (using the translator on the right side of my blog).&lt;br /&gt;&lt;br /&gt;P.S. Martin - at last there is Bulgarian! :-)&lt;br /&gt;P.P.S. You can find the full blogpost &lt;a href=&quot;http://googleblog.blogspot.com/2008/05/google-translate-adds-10-new-languages.html&quot;&gt; here&lt;/a&gt;.</description><link>http://veskokolev.blogspot.com/2008/05/bulgarian-is-supported-by-google.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-8732100911880679034</guid><pubDate>Wed, 26 Mar 2008 15:13:00 +0000</pubDate><atom:updated>2008-03-26T12:40:50.842-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">SourceSafe</category><title>How to create branch under SourceSafe in 5 steps?</title><description>&lt;span xmlns=&quot;&quot;&gt;&lt;p&gt;Hi guys!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;A lot of people (including me of course&lt;span style=&quot;font-family:Wingdings;&quot;&gt;J&lt;/span&gt;) had a lot of troubles when they had to create their first branch under SourceSafe. Why? In my opinion this program (talking about version 8.* of SourceSafe) has a lot of problems connected with the friendliness of the UI. Actually I think that it isn&#39;t user friendly at all. So here are my bits about solving one of the problems – branching. In the following lines I will provide an algorithm in 5 steps about how to do this activity. I do not know whether there is shorter way to do this but for me this is short enough and the most important thing – it works.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The algorithm is the following. I assume that you are in the database, where is the project you want to branch. Note, that the backward blue diagonals on white background cover some data, which is important only for me.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 1: Select the root of your DB, right click on it and select Create Project.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgArEP7XQqOoDU2vFwcVlW99sh0yPQSlluOUmmDiEBdwSUAjFupw4tEYh1UUquyb9SU_Lq5532PKg5RC3Rd7I_4f6fll7vKQoupnLJOmj8UtuFyIwPBrMzGjZ0nvnIndxQ0_jCNy0oLM1Sx/s1600-h/Step1.png&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5182066430884729394&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgArEP7XQqOoDU2vFwcVlW99sh0yPQSlluOUmmDiEBdwSUAjFupw4tEYh1UUquyb9SU_Lq5532PKg5RC3Rd7I_4f6fll7vKQoupnLJOmj8UtuFyIwPBrMzGjZ0nvnIndxQ0_jCNy0oLM1Sx/s400/Step1.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 2: Give your new project a name – this will be the name of your new branch. Click OK.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCrR1wi6m4LZxz2PqAvjdsMdQg448Vx7QrAUCZrnurZdLKOXBUbi5W8fnMhyRf5iI_zTTFORWSjvcxAAT9ymACvcwiygBxvCK4xDmZFf5q_fDtPE6i4Fs4VvpUAmhzqDhEOVkZMtGKMb_r/s1600-h/Step2.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCrR1wi6m4LZxz2PqAvjdsMdQg448Vx7QrAUCZrnurZdLKOXBUbi5W8fnMhyRf5iI_zTTFORWSjvcxAAT9ymACvcwiygBxvCK4xDmZFf5q_fDtPE6i4Fs4VvpUAmhzqDhEOVkZMtGKMb_r/s400/Step2.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5182066658517996098&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 3: Go to the folder you just created – right click on it. Select Share to $/ Your_Branch.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdwtlrdPYzEHnxrxAjIDRog4MN50cOjUb4Cc_kNSiSZon16ckz4iKj8yC2rH9xEASOHcCKFnG2cfe1byRD01p7tSOmjX44M8jlX70DrjJm_YIf4M3GLpypLWd3uCGiUU_cxmiMXPif7jxR/s1600-h/Step3.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdwtlrdPYzEHnxrxAjIDRog4MN50cOjUb4Cc_kNSiSZon16ckz4iKj8yC2rH9xEASOHcCKFnG2cfe1byRD01p7tSOmjX44M8jlX70DrjJm_YIf4M3GLpypLWd3uCGiUU_cxmiMXPif7jxR/s400/Step3.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5182067384367469138&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 4: Select the project which you want to branch. Check Branch after share (in the bottom) and click Share.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2jWFOArJqcHfJBLphPSuGJp8OtvPFuMAveCV4oi9gPzHLmtY01luY2DkmydIAlbJ17zGATyvmrJb1L4q5sUUBx95JsfaMOS5z0hBaaYJRjkwzjv68FIKicI2EabGC7zn7oCgdp695Cxt0/s1600-h/Step4.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2jWFOArJqcHfJBLphPSuGJp8OtvPFuMAveCV4oi9gPzHLmtY01luY2DkmydIAlbJ17zGATyvmrJb1L4q5sUUBx95JsfaMOS5z0hBaaYJRjkwzjv68FIKicI2EabGC7zn7oCgdp695Cxt0/s400/Step4.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5182067513216488034&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 5: You can select new name of the project, which will be branched in your new folder (the one which you created on Step 1). Check Recursive. You can add your Comment in the provided box and then click OK.&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFyktVygPsFBprh3ENMiTTBK2h2dw0YgvLSSSBLdxQwu1ae65QfA7ybM3TO87LwR4plHxpEdG8HrLaBXef6cu4J0RpIIwBsndtTRIJJd7Yf8gM9YaK53bphtKxqrMqAkD14RUU3B0UfI-K/s1600-h/Step5.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFyktVygPsFBprh3ENMiTTBK2h2dw0YgvLSSSBLdxQwu1ae65QfA7ybM3TO87LwR4plHxpEdG8HrLaBXef6cu4J0RpIIwBsndtTRIJJd7Yf8gM9YaK53bphtKxqrMqAkD14RUU3B0UfI-K/s400/Step5.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5182067642065506930&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;After these 5 steps you are ready to wait for your new branch. The speed of actual creating the branch depends on your project size, database, etc.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Hope this helps!&lt;/p&gt;&lt;/span&gt;</description><link>http://veskokolev.blogspot.com/2008/03/how-to-create-branch-under-sourcesafe.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgArEP7XQqOoDU2vFwcVlW99sh0yPQSlluOUmmDiEBdwSUAjFupw4tEYh1UUquyb9SU_Lq5532PKg5RC3Rd7I_4f6fll7vKQoupnLJOmj8UtuFyIwPBrMzGjZ0nvnIndxQ0_jCNy0oLM1Sx/s72-c/Step1.png" height="72" width="72"/><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-184762741102389709</guid><pubDate>Fri, 21 Mar 2008 17:23:00 +0000</pubDate><atom:updated>2008-03-21T10:37:38.393-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Performance Counters</category><title>How to get the free available memory with C#? The first sample of using a performance counter.</title><description>There are a lot of cases in which we as developers want to know how much free memory is there (or the state of some of the other system resources). This can be used for deciding whether we can handle another request, or is there enough memory (and CPU of course) to start some background work meanwhile. A lot of examples can be given about such situations. &lt;br /&gt;&lt;br /&gt;Ok, but how we can answer this question in C#?&lt;br /&gt;The approach which I will show is a very good start for diving in the topic of monitoring. What is the way to monitor the system resources in Windows? The answer is: Performance Counters. There are a lot of counters out there which can give a lot of data. Yes, there is no mistake – just pure data. Our task is to observe, collect, manipulate mathematically, etc. this data such that we can extract meaning from it i.e. to transform it in information. Keep in mind that “Performance Monitoring is a complex subject and in some ways more of an art than a science.” &lt;br /&gt;Just for completeness I will add that you can check some of the available counters on your own system /they can differ depending on what have been installed/ from Control Panel -&gt;Administrative Tools -&gt; Performance. There – right click -&gt; Add counter. The following box appears:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluoICltMeuMmIidzwcB97ypCi5iXzM328AG5KdfP-1vCij4-0ykG0E9L9vs-ZLz2pZdPqvK6fn9SiSSBz1VVOdjP-Ur4JTYzIosULPorIZw-4Lq4ABDNXXeYHqHW20J79VJlexphHAwao/s1600-h/PerformanceCounters.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0 10px 10px 0;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluoICltMeuMmIidzwcB97ypCi5iXzM328AG5KdfP-1vCij4-0ykG0E9L9vs-ZLz2pZdPqvK6fn9SiSSBz1VVOdjP-Ur4JTYzIosULPorIZw-4Lq4ABDNXXeYHqHW20J79VJlexphHAwao/s400/PerformanceCounters.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5180247563774480914&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;OK that’s enough knowledge for you to start observing some counter if you haven’t already in the past.&lt;br /&gt;&lt;br /&gt;The counter which we are interested in today is connected with memory, so it should be in Memory performance object.  The right counter is one of the following: Available Bytes, Available KBytes, Available MBytes.&lt;br /&gt;&lt;em&gt;&quot;Available Bytes\KBytes\MBytes shows the amount of physical memory, in bytes\kilobytes\megabytes, available to processes running on the computer.  It is calculated by adding the amount of space on the Zeroed, Free, and Standby memory lists. Free memory is ready for use; Zeroed memory consists of pages of memory filled with zeros to prevent subsequent processes from seeing data used by a previous process; Standby memory is memory that has been removed from a process&#39; working set (its physical memory) on route to disk, but is still available to be recalled.  This counter displays the last observed value only; it is not an average.&quot;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;How to retrieve data from performance counters in C#? There is a namespace in .NET named System.Diagnostics . There are a bunch of classes which give us the power to play with these counters. It is very straight forward and easy. You can see the simplicity from my sample which is only 3-4 lines of code.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTB8fg4uOo92asqqcEWyR_lliWSZo1Caf7j0WeiQCJK2sztmJEbrXQrxY61MxFktHfzXI5qcD7argrGj9CfPWCZNKq6zQYL0eASSfqwUpJ-RB-TOuL0SGHvfN-pezcVQYZPf2Dx252I1XI/s1600-h/GetFreeMemory.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTB8fg4uOo92asqqcEWyR_lliWSZo1Caf7j0WeiQCJK2sztmJEbrXQrxY61MxFktHfzXI5qcD7argrGj9CfPWCZNKq6zQYL0eASSfqwUpJ-RB-TOuL0SGHvfN-pezcVQYZPf2Dx252I1XI/s400/GetFreeMemory.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5180247988976243234&quot; /&gt;&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;In this manner we can retrieve the free memory with C#.&lt;br /&gt;There are a lot other useful counters out there in Windows such as these for the processor, disk usage, etc. Of course if you have installed .NET framework, there are a lot counters connected with the CLR as a whole.&lt;br /&gt; &lt;br /&gt;In the future I am planning covering some of other performance counters and connected classes in .NET so stay turned. Hope this helps!</description><link>http://veskokolev.blogspot.com/2008/03/how-to-get-free-available-memory-with-c.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjluoICltMeuMmIidzwcB97ypCi5iXzM328AG5KdfP-1vCij4-0ykG0E9L9vs-ZLz2pZdPqvK6fn9SiSSBz1VVOdjP-Ur4JTYzIosULPorIZw-4Lq4ABDNXXeYHqHW20J79VJlexphHAwao/s72-c/PerformanceCounters.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-4028169621060809068</guid><pubDate>Tue, 18 Mar 2008 19:04:00 +0000</pubDate><atom:updated>2008-03-18T12:25:44.868-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Cumputer Graphics</category><category domain="http://www.blogger.com/atom/ns#">General</category><category domain="http://www.blogger.com/atom/ns#">Geometry</category><category domain="http://www.blogger.com/atom/ns#">Stereogram</category><title>Something that amazed me - Stereograms</title><description>Yes.. it really is true. Stereograms are something that made me feel really strange. First I will give you one of them. Your task is very simple - just stare at it.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGBHS_qJNwu7PU2CtUNp2XQj9iBwNwqU43SHGOUVPdWU-aF5fNCzjKSkwTrkK2sergjlMCp8uMizG_F6dJgceDG2NrYwX9sU0t48dkdKOrijaquX2i9MO57H4u2lZ6DnmcHivf-W7zO1Lx/s1600-h/Paper%2520Clips.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGBHS_qJNwu7PU2CtUNp2XQj9iBwNwqU43SHGOUVPdWU-aF5fNCzjKSkwTrkK2sergjlMCp8uMizG_F6dJgceDG2NrYwX9sU0t48dkdKOrijaquX2i9MO57H4u2lZ6DnmcHivf-W7zO1Lx/s400/Paper%2520Clips.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5179162006737106738&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Yes.. I know this is jsut a bunch of paper clips. I&#39;ll try to give you a hint how to see it. Go near your screen. Stare at it but do not harden your eyes. Just stare. Then move your face out of the screen slowly. After two or three (thousands) of times you will see it. And do not ask me when you will understand that you will see what is there. If you see it you will be sure.&lt;br /&gt;&lt;br /&gt;I want to present you a short definiton from &lt;a href=&quot;http://en.wikipedia.org/wiki/Stereogram&quot;&gt;Wikipedia&lt;/a&gt;: A stereogram is an optical illusion of depth created from flat, two-dimensional image or images. Originally, stereogram referred to a pair of stereo images which could be viewed using stereoscope. Other types of stereograms include anaglyphs and autostereograms.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.eyetricks.com/3dstereo.htm&quot;&gt;Here&lt;/a&gt; you can find a lot of other stereograms. It is very funny - really!&lt;br /&gt;&lt;br /&gt;In some of my next posts I will try to cover the topic of creation of stereograms. You know me - I am a deep diver! &lt;br /&gt;&lt;br /&gt;Thanks and do not take a long time staring!</description><link>http://veskokolev.blogspot.com/2008/03/something-that-amazed-me-stereograms.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGBHS_qJNwu7PU2CtUNp2XQj9iBwNwqU43SHGOUVPdWU-aF5fNCzjKSkwTrkK2sergjlMCp8uMizG_F6dJgceDG2NrYwX9sU0t48dkdKOrijaquX2i9MO57H4u2lZ6DnmcHivf-W7zO1Lx/s72-c/Paper%2520Clips.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-5914885622312291676</guid><pubDate>Tue, 05 Feb 2008 17:52:00 +0000</pubDate><atom:updated>2008-03-18T12:24:23.212-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">General</category><category domain="http://www.blogger.com/atom/ns#">Linguistic</category><title>My blog in YOUR language!</title><description>Hi guys!&lt;br /&gt;I know that there is a time in which you want to read something, which you do not completely understand because of the language in which it is written. As you may do not know I am a great fan of machine translation topic. This automatically leads to the fact that you can now read my blog in a language which you better understand or even in YOUR language. This cool functionality is produced because of who? Google of course :-). &lt;em&gt;(Look under my profile information.)&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;So lets start blogging more frequently in YOUR language! &lt;br /&gt;&lt;br /&gt;Thanks!&lt;br /&gt;&lt;br /&gt;P.S. If you know me better you will already know that I will share how you can do this to your own blog/site. Just read the information from &lt;a href=&quot;http://www.google.ca/translate_tools?hl=en&quot;&gt;here&lt;/a&gt;</description><link>http://veskokolev.blogspot.com/2008/02/my-blog-in-your-language.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-328373726045709516</guid><pubDate>Tue, 15 Jan 2008 16:30:00 +0000</pubDate><atom:updated>2008-03-18T12:24:49.602-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">AJAX</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">ScriptManager</category><title>ScriptManager in a BasePage class.</title><description>Hi guys!&lt;br /&gt;As I don&#39;t have much time I will go straight to the problem - how we can put ScriptManager in our BasePage class? You know that when you insert an UpdatePanel to a page and there isn&#39;t any ScriptManager it cries for one. When you insert more than one ScriptManager, you are said that there isn&#39;t any. As I have researched - there wasn&#39;t answer how you can put ScriptManager from a BasePage class and again we were alone ;).&lt;br /&gt;&lt;br /&gt;OK here is the solution:&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAezsMakdOkGMli8L9rTxlelPjJxFVaOXuqqPLFVYimiTluOAxlapfpe8Rf0GZbEsMzt6n_a3gIXPCJ8PcGlw209Zk_xneNdA2Nq4grt8XFTCrIfMircgFR3OfKtVRDovaUNJqUSHcfeQC/s1600-h/script_manager_in_basepage_class.bmp&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAezsMakdOkGMli8L9rTxlelPjJxFVaOXuqqPLFVYimiTluOAxlapfpe8Rf0GZbEsMzt6n_a3gIXPCJ8PcGlw209Zk_xneNdA2Nq4grt8XFTCrIfMircgFR3OfKtVRDovaUNJqUSHcfeQC/s400/script_manager_in_basepage_class.bmp&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5155744976866519154&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;How you can come to this conclusion yourself?&lt;br /&gt;When you open the code of the UpdatePanel you will see that the class has property ScriptManager, which internaly calls ScriptManager.GetCurrent(page) which internaly returns (page.Items[typeof(ScriptManager)] as ScriptManager);&lt;br /&gt;&lt;br /&gt;So I had to do two things - first to lie the UpdatePanel that there is at least one ScriptMangaer, than I had to remove it because I want to add it as first control on the page. &lt;br /&gt;&lt;br /&gt;Thats all folks! Hope this helps :-).</description><link>http://veskokolev.blogspot.com/2008/01/scriptmanager-in-basepage-class.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAezsMakdOkGMli8L9rTxlelPjJxFVaOXuqqPLFVYimiTluOAxlapfpe8Rf0GZbEsMzt6n_a3gIXPCJ8PcGlw209Zk_xneNdA2Nq4grt8XFTCrIfMircgFR3OfKtVRDovaUNJqUSHcfeQC/s72-c/script_manager_in_basepage_class.bmp" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-1632899996875795501</guid><pubDate>Sat, 10 Nov 2007 14:25:00 +0000</pubDate><atom:updated>2008-07-25T00:04:11.881-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><title>How to disable validation group with JavaScript?</title><description>Hi again!&lt;br /&gt;I haven’t blogged from a long time ago – I haven’t had enough time to do all of the stuff that I wanted. But now (at last :-)) I have time for my blog. There are a lot of ideas/problems which I want to share with you! So let’s go to the first one.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the problem?&lt;/strong&gt;&lt;br /&gt;These days comes up the need to disable a bunch of validators on the client side. For example imagine that you have a checkbox which shows/hides a number of textboxes. When the checkbox is checked the user is able to fill the boxes (thus validation is required) and on the other hand when he can’t see/fill the boxes, validators should be turned off. I tried to find an example of how to disable ValidationGroup with JavaScript but I couldn’t.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How we can fix this?&lt;br /&gt;&lt;/strong&gt;Ok guys let’s solve the problem ourselves. The idea is very simple and straightforward.&lt;br /&gt;1. We have a function provided by Microsoft ValidatorEnable(validator, isEnable) which takes a validator and whether it should be enabled/disabled.&lt;br /&gt;2. What else we have? If we look at the rendered html of a page that contains at least one validator, we will see that all of them are elements of the array Page_Validators.&lt;br /&gt;3. The third thing which we have is the property of each validator named validationGroup.&lt;br /&gt;&lt;br /&gt;Now we know how to enumerate all validators in a page, how to enable/disable particular validator and how to ask a validator whether it is part of particular validationGroup. Thus we have enough knowledge to solve the problem.&lt;br /&gt;Below is sample code of an .aspx file. In it you will see two text boxes. Both have required field validator. The second has regular expression validator, too. I have made groups for the validators from a particular type. There are two buttons – the one which enables the required field validators group and the other to disable it. The two buttons call my custom function named (accordingly to Microsoft convension) ValidationGroupEnable. The function enumerates all page’s validators and if a validator is from the given validation group it is enabled/disabled according to the value given to isEnabled. Internally the function HasPageValidators fixes the situation when we doesn’t have any validators (the problem here is that when you don’t have any validators Page_Validators array is not defined and if you try to use it there will be an error).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The code&lt;br /&gt;&lt;pre class=&#39;coloredcode&#39;&gt;&lt;span class=&#39;dir&#39;&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; CodeFile=&amp;quot;Default.aspx.cs&amp;quot; Inherits=&amp;quot;_Default&amp;quot; %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;&lt;span class=&#39;tag&#39;&gt;!DOCTYPE&lt;/span&gt; html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;&lt;span class=&#39;tag&#39;&gt;html&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; xmlns=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt; &amp;gt;&lt;br /&gt;&amp;lt;&lt;span class=&#39;tag&#39;&gt;head&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; id=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;Head1&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;&lt;span class=&#39;tag&#39;&gt;title&lt;/span&gt;&amp;gt;Enable/Disable validation group with JavaScript&amp;lt;/&lt;span class=&#39;tag&#39;&gt;title&lt;/span&gt;&amp;gt;&lt;br /&gt;  &lt;br /&gt;    &amp;lt;&lt;span class=&#39;tag&#39;&gt;script&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; type=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;text/javascript&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;        function HasPageValidators()&lt;br /&gt;        {&lt;br /&gt;            var hasValidators = false;&lt;br /&gt;          &lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                if (Page_Validators.length &gt; 0)&lt;br /&gt;                {&lt;br /&gt;                    hasValidators = true;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            catch (error)&lt;br /&gt;            {&lt;br /&gt;            }&lt;br /&gt;          &lt;br /&gt;            return hasValidators;&lt;br /&gt;        }&lt;br /&gt;      &lt;br /&gt;        function ValidationGroupEnable(validationGroupName, isEnable)&lt;br /&gt;        {&lt;br /&gt;            if (HasPageValidators())&lt;br /&gt;            {&lt;br /&gt;                for(i=0; i &lt; Page_Validators.length; i++)&lt;br /&gt;                {&lt;br /&gt;                    if (Page_Validators[i].validationGroup == validationGroupName)&lt;br /&gt;                    {&lt;br /&gt;                        ValidatorEnable(Page_Validators[i], isEnable);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    &amp;lt;/&lt;span class=&#39;tag&#39;&gt;script&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;lt;/&lt;span class=&#39;tag&#39;&gt;head&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;&lt;span class=&#39;tag&#39;&gt;body&lt;/span&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;span class=&#39;tag&#39;&gt;form&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; id=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;form1&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;span class=&#39;tag&#39;&gt;div&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;&lt;span class=&#39;tag&#39;&gt;input&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; type=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; value=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;Disable required field validators!&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;                onclick=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;ValidationGroupEnable(&#39;vgRequiredFields&#39;, false)&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;span class=&#39;tag&#39;&gt;input&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;                type=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;button&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; value=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;Enable required field validators!&quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;                onclick=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;ValidationGroupEnable(&#39;vgRequiredFields&#39;, true)&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;            &amp;lt;&lt;span class=&#39;tag&#39;&gt;table&lt;/span&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;span class=&#39;tag&#39;&gt;tr&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;                    &amp;lt;&lt;span class=&#39;tag&#39;&gt;td&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; style=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;width: 229px&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                        &amp;lt;&lt;span class=&#39;tag&#39;&gt;asp:Label&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ID=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;lblName&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; Text=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;Name: &quot;&lt;/span&gt; /&amp;gt;&amp;lt;&lt;span class=&#39;tag&#39;&gt;asp:TextBox&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ID=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;txtName&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;br /&gt;                        &amp;lt;&lt;span class=&#39;tag&#39;&gt;asp:RequiredFieldValidator&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ID=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;rfvName&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;                            ErrorMessage=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ControlToValidate=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;txtName&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;                            ValidationGroup=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;vgRequiredFields&quot;&lt;/span&gt; /&amp;gt;&amp;lt;/&lt;span class=&#39;tag&#39;&gt;td&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;                  &lt;br /&gt;                &amp;lt;/&lt;span class=&#39;tag&#39;&gt;tr&lt;/span&gt;&amp;gt;&lt;br /&gt;                &amp;lt;&lt;span class=&#39;tag&#39;&gt;tr&lt;/span&gt;&amp;gt;&lt;br /&gt;                    &amp;lt;&lt;span class=&#39;tag&#39;&gt;td&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; style=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;width: 229px&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                        &amp;lt;&lt;span class=&#39;tag&#39;&gt;asp:Label&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ID=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;lblEmail&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; Text=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;Email: &quot;&lt;/span&gt; /&amp;gt;&amp;lt;&lt;span class=&#39;tag&#39;&gt;asp:TextBox&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ID=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;txtEmail&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;&lt;br /&gt;                        &amp;lt;&lt;span class=&#39;tag&#39;&gt;asp:RequiredFieldValidator&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ID=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;rfvEmail&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;                            ErrorMessage=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;*&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ControlToValidate=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;txtEmail&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ValidationGroup=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;vgRequiredFields&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;br /&gt;                        &amp;lt;&lt;span class=&#39;tag&#39;&gt;asp:RegularExpressionValidator&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ID=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;revEmail&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; runat=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;server&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;ErrorMessage=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;!&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ControlToValidate=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;txtEmail&quot;&lt;/span&gt;&lt;span class=&#39;attr&#39;&gt; ValidationGroup=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;vgRegularExpressions&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&#39;attr&#39;&gt;ValidationExpression=&lt;/span&gt;&lt;span class=&#39;attrv&#39;&gt;&quot;^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$&quot;&lt;/span&gt; /&amp;gt;&amp;lt;/&lt;span class=&#39;tag&#39;&gt;td&lt;/span&gt;&amp;gt;&lt;br /&gt;                &amp;lt;/&lt;span class=&#39;tag&#39;&gt;tr&lt;/span&gt;&amp;gt;&lt;br /&gt;            &amp;lt;/&lt;span class=&#39;tag&#39;&gt;table&lt;/span&gt;&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;span class=&#39;tag&#39;&gt;div&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;/&lt;span class=&#39;tag&#39;&gt;form&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;span class=&#39;tag&#39;&gt;body&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;span class=&#39;tag&#39;&gt;html&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Conclusion&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Hope this helps :-).&lt;br /&gt;P.S. DD you now have what you needed. Keep up the good work! ;-)</description><link>http://veskokolev.blogspot.com/2007/11/how-to-disable-validation-group-with.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-2194464099206955010</guid><pubDate>Thu, 26 Jul 2007 20:36:00 +0000</pubDate><atom:updated>2007-11-10T07:39:26.671-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">Control Adapters</category><category domain="http://www.blogger.com/atom/ns#">WAI</category><title>ASP.NET LinkButton - when disabled renders not a valid xHTML.</title><description>&lt;strong&gt;What is the problem with LinkButton control in ASP.NET?&lt;/strong&gt;&lt;br /&gt;When you disable a LinkButton i.e. set &lt;em&gt;Enabled=&quot;false&lt;/em&gt;&quot;, ASP.NET renders &lt;em&gt;disabled=&quot;disabled&quot;&lt;/em&gt; which is not a valid xHTML property.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How we can fix this?&lt;/strong&gt;&lt;br /&gt;If you view the source code of the LinkButton control and more specific the AddAttributesToRender method, you will notice that it adds the &lt;em&gt;disabled&lt;/em&gt; attribute when &lt;em&gt;Enabled&lt;/em&gt; is set to &lt;em&gt;false&lt;/em&gt;. The second thing you will see there is that no matter you have set or not the &lt;em&gt;PostBackUrl &lt;/em&gt;property to string.Empty, the method renders &lt;em&gt;href&lt;/em&gt; property and link postbacks i.e. every time when the LinkButton is &lt;em&gt;Enabled&lt;/em&gt;.&lt;br /&gt;&lt;br /&gt;So what functionality does we have to achieve? When the LinkButton is disabled, we get these five things:&lt;br /&gt;&lt;br /&gt;0. Get rid of the disabled=&quot;disabled&quot; property.&lt;br /&gt;1. The link must not be clickable (=&gt; there will be no postback).&lt;br /&gt;2. The cursor is not a hand, but as the thing under is simple text (=&gt; the user will not expect that it is clickable ).&lt;br /&gt;3. We have no underlining.&lt;br /&gt;4. The color is grey as a disabled link. Here I&#39;ll add, that if you want to make it more flexible for design, you can set a css class name in which designers can add the appropriate color.&lt;br /&gt;&lt;br /&gt;Therefore the thing which will have to do are respectively:&lt;br /&gt;0. Set control&#39;s &lt;em&gt;Enabled&lt;/em&gt; property to &lt;em&gt;true.&lt;/em&gt;&lt;br /&gt;1. Set the &lt;em&gt;PostBackUrl&lt;/em&gt; to &lt;em&gt;javascript:void(0).&lt;/em&gt;&lt;br /&gt;2. Set the &lt;em&gt;cursor&lt;/em&gt; to be of type &lt;em&gt;text&lt;/em&gt;.&lt;br /&gt;3. Set the &lt;em&gt;text-decoration&lt;/em&gt; to &lt;em&gt;none&lt;/em&gt;.&lt;br /&gt;4. Set the &lt;em&gt;color&lt;/em&gt; to grey.&lt;br /&gt;&lt;br /&gt;As in my previous post which you can find &lt;a href=&quot;http://veskokolev.blogspot.com/2007/07/aspnet-checkbox-rendering-not.html&quot;&gt;here&lt;/a&gt;, we will achieve this with the help of control adapters. Here is a sample source code:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTvlBZKVTiwonLfLIB8PMaVx8wHy3w4_J1n8WGzlqocO1bdQ8N5JaLE8T_2PLN1RYWbz9r2Qs9c2E3RaqyrM9hY01aNXAFSiAUkiI5HMWA8FVsqUz7sGjcQe3N7NRYXC_Stzah7RK2m8Ym/s1600-h/LinkButtonControlAdaptergif.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5091621822297023250&quot; style=&quot;CURSOR: hand&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTvlBZKVTiwonLfLIB8PMaVx8wHy3w4_J1n8WGzlqocO1bdQ8N5JaLE8T_2PLN1RYWbz9r2Qs9c2E3RaqyrM9hY01aNXAFSiAUkiI5HMWA8FVsqUz7sGjcQe3N7NRYXC_Stzah7RK2m8Ym/s400/LinkButtonControlAdaptergif.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;This solution shows again the power of control adapters - properly rendered controls of some type in the whole web site just with a few lines of code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;</description><link>http://veskokolev.blogspot.com/2007/07/aspnet-linkbutton-when-disabled-renders.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTvlBZKVTiwonLfLIB8PMaVx8wHy3w4_J1n8WGzlqocO1bdQ8N5JaLE8T_2PLN1RYWbz9r2Qs9c2E3RaqyrM9hY01aNXAFSiAUkiI5HMWA8FVsqUz7sGjcQe3N7NRYXC_Stzah7RK2m8Ym/s72-c/LinkButtonControlAdaptergif.gif" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-2551471771256539175</guid><pubDate>Sat, 14 Jul 2007 21:12:00 +0000</pubDate><atom:updated>2008-01-18T13:07:14.063-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">Control Adapters</category><category domain="http://www.blogger.com/atom/ns#">WAI</category><title>ASP.NET CheckBox - rendering not compatible with WAI.</title><description>&lt;strong&gt;What is WAI?&lt;/strong&gt;&lt;br /&gt;WAI stands for Web Accessibility Initiative. It&#39;s an attempt of &lt;a href=&quot;http://www.w3.org/&quot;&gt;W3C&lt;/a&gt; to improve the accessibility of WWW with different user agent devices which is especially important for people with physical disabilities. WAI is an number of guidelines that can help to make WWW more accessible. For more information look at &lt;a href=&quot;http://www.w3.org/TR/WAI-WEBCONTENT/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the problem with CheckBox control in ASP.NET?&lt;/strong&gt;&lt;br /&gt;The problem is that WAI suggests that controls such as text boxes, images, buttons etc. must have tooltips. So when you add a ToolTip property of a asp:CheckBox control, ASP.NET renders wrapping span and set&#39;s the tooltip to the span. But as I mentioned above WAI requires an alt(title) tag for every INPUT and when you try to validate a page with a checkbox the validation will fail.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How we can fix this?&lt;/strong&gt;&lt;br /&gt;As my friend and colleague &lt;a href=&quot;http://blogs.vizibility.net/sdobrev/&quot;&gt;Stefan Dobrev&lt;/a&gt; recently rightly pointed, Microsoft ASP.NET Team done their work excellent and in ASP.NET 2.0 they have provided very elegant solution for such problems - Control Adapters. (For more information about the architecture of control adapters look at &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2005/12/21/asp-net-2-0-control-adapter-architecture.aspx&quot;&gt;this post&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;To use control adapter, we have to create the standard folder named App_Browsers and in it we have to add a file with extension .browser - the so called &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/ms228122.aspx&quot;&gt;Browser definition file&lt;/a&gt;. This is the content of the file in my example:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihEkBQHOnvWuIPRTBLecOkN8MLbpjKXY6jdhBI326Civ-1iARqhHYtm7_VJSxPVrLCjFhc4MQ6u8I7HfGf-9iaXBXccRquaUJHfIF_q5M0xUCsL0MlUivOJZwSD0W6CySKafgres8p8N5D/s1600-h/browserFile.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5087183206826717074&quot; style=&quot;MARGIN: 0px 10px 10px 0px; CURSOR: hand&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihEkBQHOnvWuIPRTBLecOkN8MLbpjKXY6jdhBI326Civ-1iARqhHYtm7_VJSxPVrLCjFhc4MQ6u8I7HfGf-9iaXBXccRquaUJHfIF_q5M0xUCsL0MlUivOJZwSD0W6CySKafgres8p8N5D/s400/browserFile.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the file we add &lt;controladapters&gt;section in which we add an adapter for control of type System.Web.UI.WebControls.CheckBox and we associated the adapter CheckBoxCtrlAdapter which is defined as below:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2OydRbTRa7V1rN2wsOC8Xg3BUSJB7GssZ4mnconApETFteW92OYCh8-IcaNg3LQ2otLGNdHir_Rdu321s_7tfVoLdCgoqEcl3JRjxHPCjZI28ZvsSO3lTMGdwpzcN3cbARN4l0pehGoC6/s1600-h/code.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5087182682840706946&quot; style=&quot;MARGIN: 0px 10px 10px 0px; CURSOR: hand&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2OydRbTRa7V1rN2wsOC8Xg3BUSJB7GssZ4mnconApETFteW92OYCh8-IcaNg3LQ2otLGNdHir_Rdu321s_7tfVoLdCgoqEcl3JRjxHPCjZI28ZvsSO3lTMGdwpzcN3cbARN4l0pehGoC6/s400/code.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Thus all of the checkboxes in your page will render WAI compatible.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br /&gt;For many people WAI is very restrictive and in some ways hard achievable and even unnecessary. I think that at least easily achievable features should be observed. The future will show whether WAI will become a wide spred standard.</description><link>http://veskokolev.blogspot.com/2007/07/aspnet-checkbox-rendering-not.html</link><author>noreply@blogger.com (Veselin Kolev)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihEkBQHOnvWuIPRTBLecOkN8MLbpjKXY6jdhBI326Civ-1iARqhHYtm7_VJSxPVrLCjFhc4MQ6u8I7HfGf-9iaXBXccRquaUJHfIF_q5M0xUCsL0MlUivOJZwSD0W6CySKafgres8p8N5D/s72-c/browserFile.gif" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3502027233909073175.post-3543448989409117016</guid><pubDate>Sat, 14 Jul 2007 21:05:00 +0000</pubDate><atom:updated>2007-11-10T07:38:37.994-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">General</category><title>My first post</title><description>Welcome to my blog! Here you will find different information about Software development - C#, .NET, ASP.NET, Java, C/C++, Win32 API, Design Patterns, Algorithms, Best practices and many other. Of course here I will post my general thoughts, too.&lt;br /&gt;I hope that it will be useful to many people!&lt;br /&gt;Wish me good luck! :-)</description><link>http://veskokolev.blogspot.com/2007/07/my-first-post.html</link><author>noreply@blogger.com (Veselin Kolev)</author><thr:total>0</thr:total></item></channel></rss>