<?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-36341263</atom:id><lastBuildDate>Wed, 28 Aug 2024 11:53:01 +0000</lastBuildDate><category>.NET</category><category>C#</category><category>SQL Server</category><category>IIS</category><category>ASP.NET</category><category>Setup</category><category>windows</category><category>Installshield</category><category>System</category><category>Visual Studio</category><category>C++</category><category>COM</category><category>Certificate</category><category>Database</category><category>Interop</category><category>Win32</category><category>vista</category><category>web</category><category>winforms</category><title>The Last Don</title><description>Programming tips through experience</description><link>http://lastdon.blogspot.com/</link><managingEditor>noreply@blogger.com (The Last Don)</managingEditor><generator>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-2014521104071813557</guid><pubDate>Mon, 09 Jan 2012 10:54:00 +0000</pubDate><atom:updated>2012-01-09T13:01:53.309+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">COM</category><category domain="http://www.blogger.com/atom/ns#">Interop</category><title>Register .NET COM Interop DLL</title><description>One day, running RegAsm I got error:&lt;br /&gt;&lt;b&gt;&quot;Cannot create a stable subkey under a volatile parent key&quot;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It took a couple of hours trying to understand, what is going on. At last solution has been found. &lt;i&gt;Restart computer&lt;/i&gt;. &lt;br /&gt;Registry was in the state to prevent add keys, because it expecting restart from some previous operations.</description><link>http://lastdon.blogspot.com/2012/01/register-net-com-interop.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-418782041251354304</guid><pubDate>Tue, 12 Jan 2010 06:51:00 +0000</pubDate><atom:updated>2010-01-12T08:58:45.386+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><title>Sql Server cache</title><description>To clean cache:&lt;br /&gt;&lt;br /&gt;DBCC DROPCLEANBUFFERS&lt;br /&gt;DBCC FREEPROCCACHE&lt;br /&gt;&lt;br /&gt;To view cache list (SQL 2005):&lt;br /&gt;&lt;br /&gt;SELECT objtype, p.size_in_bytes, t.[text], usecounts&lt;br /&gt;     FROM sys.dm_exec_cached_plans p&lt;br /&gt;     OUTER APPLY sys.dm_exec_sql_text (p.plan_handle) t&lt;br /&gt;     WHERE objtype IN (&#39;Prepared&#39;, &#39;Adhoc&#39;)&lt;br /&gt;     ORDER BY usecounts DESC</description><link>http://lastdon.blogspot.com/2010/01/sql-server-cache.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-6730050855141886119</guid><pubDate>Tue, 07 Oct 2008 11:30:00 +0000</pubDate><atom:updated>2008-10-07T13:37:54.742+02: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#">winforms</category><title>winforms: Dock Fill is working wrong</title><description>I experienced much time with troubles in the C# windows form, if control is set &lt;b&gt;dock:fill&lt;/b&gt; and I adding any other control (menu, status bar,whatever) to the form or panel. &lt;br /&gt;In this case, main control with fill dock style doesn&#39;t recognize that need to fit, it overlapping any new control. Sometimes, to fix I creating new form and redesigned it from scratch.&lt;br /&gt;&lt;br /&gt;Solution is very easy:&lt;br /&gt;Right click on the control with fill dock style, and choose &lt;b&gt;Bring to Front&lt;/b&gt;. Docking will be fixed :)&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://dotnetref.blogspot.com/2008/08/using-dock-fill-on-control-when-you.html&quot;&gt;Source&lt;/a&gt;</description><link>http://lastdon.blogspot.com/2008/10/winforms-dock-fill-is-working-wrong.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>9</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-144693027188600287</guid><pubDate>Thu, 25 Sep 2008 11:36:00 +0000</pubDate><atom:updated>2008-09-25T14:40:24.077+03: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#">windows</category><title>Performance Counters are damaged.</title><description>Found at the customer station that all perfomance counters are damaged and only numbers appears in the performance monitor app. &lt;br /&gt;My application is failing when tried to use perfomance counters &quot;Input string incorrect format&quot;.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://msmvps.com/blogs/robfarley/archive/2007/05/03/system-monitor-perfmon-shows-numbers-instead-of-counter-names.aspx&quot;&gt;Solution:&lt;/a&gt;&lt;br /&gt;run command:  &lt;br /&gt;lodctr.exe /r&lt;br /&gt;&lt;br /&gt;Performance monitor now ok, as well as my application too.</description><link>http://lastdon.blogspot.com/2008/09/performance-counters-are-damaged.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-3937008829960755641</guid><pubDate>Mon, 15 Oct 2007 17:17:00 +0000</pubDate><atom:updated>2007-10-15T19:38:23.905+02: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#">IIS</category><category domain="http://www.blogger.com/atom/ns#">vista</category><title>IIS7: Application pool, managed pipeline mode</title><description>Referenced posts: &lt;br /&gt;&lt;a href=&quot;http://lastdon.blogspot.com/2007/07/iis6-separated-application-pool.html&quot;&gt;Separated application pool&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://lastdon.blogspot.com/2007/08/iis6-application-pool-identity.html&quot;&gt;Application pool idenity&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Windows Vista comes with new property of application pool..&lt;br /&gt;Now we have property &quot;managed pipeline mode&quot;.&lt;br /&gt;It allows two options:&lt;br /&gt; - 0 - Integrated (set by default during creation of the new application pool)&lt;br /&gt; - 1 - Classic &lt;br /&gt; &lt;br /&gt;In the .NET 3 new .NET library &lt;i&gt;Microsoft.Web.Administration&lt;/i&gt; allows us to manage IIS settings very easy.&lt;br /&gt;&lt;br /&gt;Unofortunately, I was required to turn IIS settings on the Windows Vista in old way, because software product still not working with .NET 3, so I use old good way of the ADSI and System.DirectoryServices &lt;br /&gt;&lt;br /&gt;To set application pool in classic mode on Windows Vista/IIS7, I make additional call (in bold):&lt;br /&gt;string appPoolName = &quot;myAppPool&quot;;&lt;br /&gt;DirectoryEntry poolRoot = new DirectoryEntry(&quot;IIS://localhost/W3SVC/AppPools&quot;);&lt;br /&gt;DirectoryEntry pool = poolRoot.Children.Add(appPoolName, &quot;IIsApplicationPool&quot;);&lt;br /&gt;&lt;b&gt;pool.InvokeSet(&quot;ManagedPipelineMode&quot;, new Object[] { 1 });&lt;/b&gt;&lt;br /&gt;pool.CommitChanges();&lt;br /&gt;&lt;br /&gt;I set 1, because I need to set my application pool working in classic mode. 0 should be used for integrated mode.</description><link>http://lastdon.blogspot.com/2007/10/iis7-application-pool-managed-pipeline.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-2873271905093396026</guid><pubDate>Wed, 29 Aug 2007 13:16:00 +0000</pubDate><atom:updated>2007-09-16T14:56:30.267+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">IIS</category><title>IIS6: Application pool Identity</title><description>&lt;a href=&quot;http://lastdon.blogspot.com/2007/07/iis6-separated-application-pool.html&quot;&gt;&lt;b&gt;Referenced post: Separated app pool&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In referenced post I wrote how to create application pool and assign virtual directory for it..&lt;br /&gt;Now I faced with requirement to change identity from default (Network service) to Local system account) to allow web application more permissions..&lt;br /&gt;&lt;br /&gt;Property &lt;a href=&quot;http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e3a60d16-1f4d-44a4-9866-5aded450956f.mspx?mfr=true&quot;&gt;&lt;b&gt;AppPoolIdentityType&lt;/b&gt;&lt;/a&gt; should help.&lt;br /&gt;Following code will create pool and set Local System account identity for the pool:&lt;br /&gt;&lt;p style=&quot;font-size:11px&quot;&gt;&lt;br /&gt;string appPoolName = &quot;myAppPool&quot;;&lt;br /&gt;DirectoryEntry poolRoot = new DirectoryEntry(&quot;IIS://localhost/W3SVC/AppPools&quot;);&lt;br /&gt;DirectoryEntry pool = poolRoot.Children.Add(appPoolName, &quot;IIsApplicationPool&quot;);&lt;br /&gt;&lt;br /&gt;pool.InvokeSet(&quot;AppPoolIdentityType&quot;, new Object[] { 0 }); &lt;br /&gt;pool.CommitChanges();&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;possible values:&lt;table style=&quot;font-size=&#39;12&#39;;&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;0&lt;/td&gt;&lt;td nowrap&gt;Local System&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td nowrap&gt;1&lt;/td&gt;&lt;td nowrap&gt;Local Service&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td nowrap&gt;2&lt;/td&gt;&lt;td nowrap&gt;Network Service&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td nowrap&gt;3&lt;/td&gt;&lt;td nowrap&gt;Specific user&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;In the case of specific user need to use following additional operations:&lt;br /&gt;&lt;br /&gt;pool.InvokeSet(&quot;WAMUserName&quot;, new Object[] { computerName + @&quot;\&quot; + user }); &lt;br /&gt;pool.InvokeSet(&quot;WAMUserPass&quot;, new Object[] { password });</description><link>http://lastdon.blogspot.com/2007/08/iis6-application-pool-identity.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-4332735891719121518</guid><pubDate>Tue, 21 Aug 2007 09:43:00 +0000</pubDate><atom:updated>2007-08-21T12:53:34.908+03: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#">SQL Server</category><title>Sql Server 913 error: Could not find database ID</title><description>Strange behaviour of sql server I found.&lt;br /&gt;When databaseid is changed in the sysdatabases, but name of database is same I get 913 error on some queries:&lt;br /&gt;&lt;b&gt;Could not find database ID %d. Database may not be activated yet or may be in transition.&lt;/b&gt;&lt;br /&gt;It is totally thrue, my database have another id after series of drop/create, but somehow .NET SqlConnection remember it. There is no matter, if I am closing and reopen connection. I even did SqlConnection.ClearAllPools() &lt;br /&gt;Even creating new connection with same connection string doesn&#39;t help. And it is not bug referencing by MSDN if I am using user-defined function. Nope, I don&#39;t have UDR in query.. But error appears in some specific queries, like Create mydb.dbo.mytable, or update, or insert..&lt;br /&gt;One note.. I always use connection string with default database &lt;b&gt;master&lt;/b&gt;&lt;br /&gt;After drop/create database, I changed connection string and set default database name to the just created.&lt;br /&gt;&lt;br /&gt;Bingo!!! It works! &lt;br /&gt;But why?? Why connection of master, even with clearing pools, remember obsolete information from sysdatabases, if I even recreate new connection on it?&lt;br /&gt;Didn&#39;t found any reasonable answer.</description><link>http://lastdon.blogspot.com/2007/08/sql-server-913-error-could-not-find.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-557699744053215397</guid><pubDate>Thu, 09 Aug 2007 07:55:00 +0000</pubDate><atom:updated>2007-09-06T12:02:58.993+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><title>list of table indexes</title><description>I was need to drop all indexes for specific table excluding primary key indexes.&lt;br /&gt;Following example demonstrates how to get list of indexes.&lt;br /&gt;&lt;br /&gt;USE mydb; &lt;br /&gt;&lt;br /&gt;SELECT indexes.name, * FROM sysindexes indexes  &lt;br /&gt;INNER JOIN sysobjects objects ON indexes.id = objects.id  &lt;br /&gt;WHERE &lt;b&gt;indexes.indid&gt;0&lt;/b&gt; AND objects.name=&#39;mytable&#39;    &lt;br /&gt;and indexes.name not in &lt;br /&gt;(select constraint_name  from INFORMATION_SCHEMA.TABLE_CONSTRAINTS  where table_name = &#39;mytable&#39; and   constraint_type = &#39;primary key&#39;)  &lt;br /&gt;&lt;br /&gt;if table doesn&#39;t have clustered index, then result set of sysindexes will contain heap with the field indid=0.. Because it is not real index, and I cannot drop it, I am filtering it out by the indid&gt;0&lt;br /&gt;&lt;br /&gt;Lately I found that table may contain statistic indexes, which cannot be dropped as well directly with DROP INDEX, but through &quot;drop statistics&quot; statement&lt;br /&gt;&lt;br /&gt;To filter them out I added following part to WHERE:&lt;br /&gt;and INDEXPROPERTY(indexes.id, indexes.name, &#39;IsStatistics&#39;)=0&lt;br /&gt;and INDEXPROPERTY(indexes.id, indexes.name, &#39;IsHypothetical&#39;) = 0&lt;br /&gt;and INDEXPROPERTY(indexes.id, indexes.name, &#39;IsAutoStatistics&#39;) = 0</description><link>http://lastdon.blogspot.com/2007/08/list-of-table-indexes.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-5472556126721671645</guid><pubDate>Tue, 24 Jul 2007 10:21:00 +0000</pubDate><atom:updated>2007-07-24T13:30:58.422+03:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><title>Foreign keys for the referenced table</title><description>Let&#39;s say, I have a database table &quot;SingleTable&quot; and I want to get list of all tables which are referencing to this SingleTable and names of foreign keys...&lt;br /&gt;&lt;br /&gt;(I need this, for example, if I am going to drop SingleTable but I need drop all dependencies from this table first )&lt;br /&gt;&lt;br /&gt;I have option to use undocumented stored procedure sp_MStablerefs, however I am trying to avoid using undocumented feature. Never know when and where Microsoft will put stick in my wheels :)&lt;br /&gt;So, there is alternative way I found by experiments:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;USE mydatabase&lt;br /&gt;SELECT name as fkname, OBJECT_NAME(parent_obj) as fkTableName &lt;br /&gt;FROM sysobjects &lt;br /&gt;INNER JOIN sysreferences &lt;br /&gt;  ON sysobjects.id=sysreferences.constid &lt;br /&gt;   WHERE name like &#39;FK%&#39; AND xtype=&#39;F&#39;  -- foreign key only&lt;br /&gt;         AND rkeyid=object_id(N&#39;SingleTable&#39;)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Result is set of forein key names and table names referencing to my table.. &lt;br /&gt;Bingo. Now we can drop them one by one using cursor, or DataSet on the upper code level..</description><link>http://lastdon.blogspot.com/2007/07/foreign-keys-for-referenced-table.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-7308429615773167638</guid><pubDate>Wed, 11 Jul 2007 14:11:00 +0000</pubDate><atom:updated>2007-09-16T14:32:25.022+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">IIS</category><title>IIS6: separated application pool</title><description>When IIS runs multiple versions of .NET web projects, collision happens sometimes.&lt;br /&gt;So, I required to assign my web project in separated application pool under Windows 2003 /IIS6  programmatically.&lt;br /&gt;&lt;br /&gt;It is easy through System.DirectoryServices of .NET &lt;br /&gt;There is, I create virtual directory &quot;myWebDir&quot; and assign it to new pool with the name &quot;myAppPool&quot;:&lt;br /&gt;&lt;div style=&quot;width:400px; overflow:auto&quot; &gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DirectoryEntry folderRoot = new DirectoryEntry(&quot;IIS://localhost/W3SVC/1/Root&quot;);&lt;br /&gt;DirectoryEntry virDir = folderRoot.Children.Add(&quot;myWebDir&quot;, &quot;IIsWebVirtualDir&quot;);&lt;br /&gt;object[] param ={ 0, &quot;myAppPool&quot;, true };&lt;br /&gt;virtDir.Invoke(&quot;AppCreate3&quot;, param);&lt;br /&gt;//set virtual directory properties&lt;br /&gt;//.......&lt;br /&gt;newVirDir.CommitChanges();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Application pool is created automatically if third parameter is a true in the param array.&lt;br /&gt;&lt;br /&gt;However, I would like also to manage my application pools without specific virtual directory.&lt;br /&gt;Here are examples to create/remove application pools:&lt;br /&gt;&lt;br /&gt;Create Application pool:&lt;br /&gt;&lt;div style=&quot;width:400px; overflow:auto&quot; &gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;string appPoolName = &quot;myAppPool&quot;;&lt;br /&gt;DirectoryEntry poolRoot = new DirectoryEntry(&quot;IIS://localhost/W3SVC/AppPools&quot;);&lt;br /&gt;if (!DirectoryEntry.Exists(IISAppPoolRootPath + &quot;/&quot; + appPoolName);&lt;br /&gt;{&lt;br /&gt;    DirectoryEntry pool = poolRoot.Children.Add(appPoolName, &quot;IIsApplicationPool&quot;);&lt;br /&gt;    pool.CommitChanges();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Remove Application pool:&lt;br /&gt;&lt;div style=&quot;width:400px; overflow:auto&quot; &gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;string appPoolName = &quot;myAppPool&quot;;&lt;br /&gt;DirectoryEntry poolRoot = new DirectoryEntry(&quot;IIS://localhost/W3SVC/AppPools&quot;);&lt;br /&gt;DirectoryEntry pool = poolRoot.Children.Find(appPoolName, &quot;IIsApplicationPool&quot;);&lt;br /&gt;if (pool != null)&lt;br /&gt;{&lt;br /&gt;   poolRoot.Children.Remove(pool);&lt;br /&gt;   poolRoot.CommitChanges();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Remove only works, if no one web application assigned to pool.</description><link>http://lastdon.blogspot.com/2007/07/iis6-separated-application-pool.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-5128737577921678524</guid><pubDate>Tue, 15 May 2007 10:22:00 +0000</pubDate><atom:updated>2008-12-10T13:10:43.532+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><title>depending on loading Sql Server 2000</title><description>My C# Service depends on MS SQL 2000 service and my service is starting to use database immediatly during loading. Everything ok, service is starting and stopping untill... restart.&lt;br /&gt;On some computers, my service is not run automatically after computer restart because database not ready yet. &lt;br /&gt;(I got error: &lt;i&gt;Could not find database ID 2. Database may not be activated yet or may be in transition&lt;/i&gt;)&lt;br /&gt;&lt;br /&gt;After investigation of the sql server I understand  that server starting listening clients before, than starts up my database... How it can be??? Ok, there are milliseconds difference, but  my service already tried to access db, and exited because it cannot. On other computers, where service is starting, I see in the log that my database was started before than server starts listening clients.&lt;br /&gt;&lt;br /&gt;My database is not marked &quot;Auto Close&quot;. Sql Server configuration is exactly same on computers, SP4 installed. So I don&#39;t have idea, why some sql servers change their loading priority...&lt;br /&gt;&lt;br /&gt;Well, I found some things that may fix this.&lt;br /&gt;1.&lt;br /&gt;I unchecked autostart MSDTC service. Anyway this service is loading when DTC transaction initiated by somebody. And it helps&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigUOkRLlYjO-3P83HMs_3Q6dm1LlodZ3q8F93YCbbHfEIPsshsfGvZYmGGcbr5328fXIXK0RAepepn-yTzqZFVTcrOBv1LVp-4lu7crlFuXWa3puxR6JeF-1QDbdmVvYTsWxjK/s1600-h/sql1jpg.JPG&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigUOkRLlYjO-3P83HMs_3Q6dm1LlodZ3q8F93YCbbHfEIPsshsfGvZYmGGcbr5328fXIXK0RAepepn-yTzqZFVTcrOBv1LVp-4lu7crlFuXWa3puxR6JeF-1QDbdmVvYTsWxjK/s320/sql1jpg.JPG&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5064734216965672290&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Interesting, service started, but it is not solution, I don&#39;t know, what settings user will have.. I And I suspect, it is just loading time issue.. Because log still shows starting database only after starting listening, not before.&lt;br /&gt;&lt;br /&gt;2. I found at microsoft if I will use trace flag  3614, the startup sequence of SQL Server 2000 will be slightly different. And they rules the world with such phrases like &quot;slightly different&quot;?&lt;br /&gt;I checked checkbox &quot;Autostart MSDTC&quot; back and added parameter -T3614. Ooops, service started... Let&#39;s see sql server log.Yes! My database is loaded before than service started to listen clients.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibx_9nqDin0hpHwFrGWBhOyl2Toz_Reic4wQtdZUrN74g2OeKOA18LOYRNs_jzsyuD8kgHt_v8J7_prlnwVeIpjTyAKGL7Yedu_znF9Tghibl-ximfKzXD39yHqHLv5CbXiH4U/s1600-h/sql2.jpg&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibx_9nqDin0hpHwFrGWBhOyl2Toz_Reic4wQtdZUrN74g2OeKOA18LOYRNs_jzsyuD8kgHt_v8J7_prlnwVeIpjTyAKGL7Yedu_znF9Tghibl-ximfKzXD39yHqHLv5CbXiH4U/s320/sql2.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5064737738838855026&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Nice. Solution may be used for workaround in the case of problem. But for my serenity, I added to OnStart method of my service check for accessibility of my database, and in the negative case sleep service for some time before continue..&lt;br /&gt;Now it works. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;However, I don&#39;t have real solution or understanding, why it is happens when Sql Server put user databases to load after starting to accept requests.. Question is opened for while. &lt;/strong&gt;&lt;br /&gt;It looks like &lt;a href=&quot;http://support.microsoft.com/kb/834798&quot;&gt;this article&lt;/a&gt; have similar situation, but it is not enough to understand.</description><link>http://lastdon.blogspot.com/2007/05/depending-on-loading-sql-server-2000.html</link><author>noreply@blogger.com (The Last Don)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigUOkRLlYjO-3P83HMs_3Q6dm1LlodZ3q8F93YCbbHfEIPsshsfGvZYmGGcbr5328fXIXK0RAepepn-yTzqZFVTcrOBv1LVp-4lu7crlFuXWa3puxR6JeF-1QDbdmVvYTsWxjK/s72-c/sql1jpg.JPG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-4212645529339924425</guid><pubDate>Wed, 14 Feb 2007 11:39:00 +0000</pubDate><atom:updated>2007-02-14T14:41:33.391+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><title>Drop default constraint</title><description>Somebody created table like this:&lt;br /&gt;&lt;font size=&quot;-2&quot;&gt;&lt;br /&gt;CREATE TABLE [dbo].[MyTable] (&lt;br /&gt;...&lt;br /&gt;[MyField] [bit] NOT NULL DEFAULT (1),&lt;br /&gt;...&lt;br /&gt;) ON [PRIMARY]&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;I need to do some changes, but first I should drop constraints and after changes, create again. Oops, I don&#39;t know constrain name, because somebody used bad style in creation tables. &lt;br /&gt;I need to execute SQL query like following&lt;br /&gt;ALTER TABLE [dbo].[TreeNodeRelation] DROP CONSTRAINT [DF__MyTable__MyField__2B3F6F97]  - but we cannot be sure that name will be same on all installations because it is autogenerated during &quot;create table&quot;.&lt;br /&gt;&lt;br /&gt;Solution. Following example receives name of default constraint for the specific field, and if it is exists, drop it.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;width:400px; overflow:auto&quot; &gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;pre&gt;&lt;br /&gt;declare @cnstname sysname &lt;br /&gt;declare @sql nvarchar(4000) &lt;br /&gt;&lt;br /&gt;select @cnstname = [name] from  sysobjects as so &lt;br /&gt;where  xtype = &#39;D&#39;   and parent_obj = object_id(&#39;dbo.MyTable&#39;) &lt;br /&gt;        and col_name(parent_obj, info) = &#39;MyField&#39; &lt;br /&gt;&lt;br /&gt;if @cnstname is not null &lt;br /&gt; begin &lt;br /&gt;    set @sql = N&#39;alter table dbo.MyTable drop constraint &#39; + @cnstname &lt;br /&gt;    execute sp_executesql @sql &lt;br /&gt;    end &lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://lastdon.blogspot.com/2007/02/drop-default-constraint.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-4108862973094654028</guid><pubDate>Sun, 04 Feb 2007 13:17:00 +0000</pubDate><atom:updated>2007-02-04T15:46:53.039+02: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#">System</category><title>Access common windows folders from C#</title><description>I interested to get desktop and programs folder from C# application to create some shortcuts there.  .NET allows it in following way:&lt;br /&gt;&lt;font size=&quot;-1&quot;&gt;&lt;br /&gt;Environment.GetFolderPath(Environment.SpecialFolder.Desktop);&lt;br /&gt;Environment.GetFolderPath(Environment.SpecialFolder.Programs);&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;But results are directories for the current user, like &lt;br /&gt;&lt;font size=&quot;-1&quot;&gt;&lt;br /&gt;c:\document And Settings\LastDon\Destkop. &lt;br /&gt;&lt;/font&gt;&lt;br /&gt;However I want to place shortcuts for all users, for profile ALLUSERS.&lt;br /&gt;So, I found registry key &lt;br /&gt;&lt;font size=&quot;-1&quot;&gt;&lt;br /&gt;HKEY_LOCAL_MACHINE\SOFTWARE\microsoft\windows\currentversion\explorer\shell folders &lt;br /&gt;&lt;/font&gt; &lt;br /&gt;Not too happy - Windows 2003 is not using this key, and anyway, it is not recommended by microsoft.&lt;br /&gt;So, I come to solution by using API Shell32.dll:&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;width:400px; overflow:auto&quot; &gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[DllImport(&quot;Shell32.DLL&quot;)]&lt;br /&gt;public static extern int SHGetSpecialFolderLocation(&lt;br /&gt;     IntPtr hwndOwner, int nFolder, out IntPtr ppidl);&lt;br /&gt;&lt;br /&gt;[DllImport(&quot;Shell32.DLL&quot;)]&lt;br /&gt;public static extern int SHGetPathFromIDList(&lt;br /&gt;        IntPtr pidl, StringBuilder Path);&lt;br /&gt;&lt;br /&gt;const int CSIDL_COMMON_PROGRAMS         = 23;&lt;br /&gt;const int CSIDL_COMMON_STARTUP          = 24;&lt;br /&gt;const int CSIDL_COMMON_DESKTOPDIRECTORY = 25;&lt;br /&gt;&lt;br /&gt;private string GetSpecialFolder(int folderType)&lt;br /&gt;{&lt;br /&gt; IntPtr pResultList;&lt;br /&gt; IntPtr handlePtr = new IntPtr(0);&lt;br /&gt; int result =SHGetSpecialFolderLocation(handlePtr, folderType, out pResultList);&lt;br /&gt; if (result &lt; 0)&lt;br /&gt; {&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt; StringBuilder sb = new StringBuilder (500);&lt;br /&gt; result = SHGetPathFromIDList(pResultList, sb);&lt;br /&gt; if (result == 0)    // boolean result&lt;br /&gt; {&lt;br /&gt;  return null;&lt;br /&gt; }&lt;br /&gt; return sb.ToString();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Get destkop path: &lt;br /&gt;  GetSpecialFolder(CSIDL_COMMON_DESKTOPDIRECTORY);&lt;br /&gt;Get programs path: &lt;br /&gt;  GetSpecialFolder(CSIDL_COMMON_PROGRAMS);&lt;br /&gt;&lt;br /&gt;Following microsoft article helped me to solve it out&lt;br /&gt;&lt;a href=&quot;http://support.microsoft.com/kb/306285&quot;&gt;http://support.microsoft.com/kb/306285&lt;/a&gt;</description><link>http://lastdon.blogspot.com/2007/02/access-common-windows-folders-from-c.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-1663926856942440663</guid><pubDate>Sat, 03 Feb 2007 16:13:00 +0000</pubDate><atom:updated>2007-02-03T18:53:44.461+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Installshield</category><category domain="http://www.blogger.com/atom/ns#">Setup</category><title>Uninstall by installshield IDriver</title><description>&lt;span style=&quot;margin-right:6px;margin-top:5px;float:left;color:white;background:khaki;border:1px solid darkkhaki;font-size:40px;line-height:30px;padding-top:2px;padding-right:5px;font-family:times;&quot;&gt;A&lt;/span&gt;gain problem with installshield. &lt;br /&gt;Uninstall installshield product (InstallScript &amp; MSI) command line is: &lt;br /&gt;&lt;em&gt;IDriver.exe /M{GUID}&lt;/em&gt;&lt;br /&gt;I found this command in the registry in uninstall key under InstallShield_{GUID}.&lt;br /&gt;&lt;br /&gt;But I want it uninstall silent so i run  &lt;br /&gt;&lt;em&gt;IDriver.exe /M{GUID} /uninst&lt;/em&gt;&lt;br /&gt; &lt;br /&gt;Nothing. Product is not uninstalling. Macrovision just kidding. &lt;br /&gt;Ok, solution is following.&lt;br /&gt;1. Run setup.exe /r from product media  and do uninstall the product&lt;br /&gt;2. Copy setup.iss file from windows folder to somewhere.&lt;br /&gt;3. Now command line to uninstall silent will be:&lt;br /&gt;&lt;em&gt;Idriver.exe /M{GUID} /f1&quot;c:\somewhere\setup.iss&quot;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Thanks God, it works, so I can return back to my C# work.</description><link>http://lastdon.blogspot.com/2007/02/uninstall-by-installshield-idriver.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-7800851857952828131</guid><pubDate>Tue, 23 Jan 2007 07:40:00 +0000</pubDate><atom:updated>2007-02-03T18:51:06.115+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">web</category><title>CSS</title><description>&lt;!-- the drop cap --&gt; &lt;br /&gt;&lt;span style=&quot;margin-right:6px;margin-top:5px;float:left;color:white;background:khaki;border:1px solid darkkhaki;font-size:40px;line-height:30px;padding-top:2px;padding-right:5px;font-family:times;&quot;&gt;N&lt;/span&gt;ice CSS examples. &lt;br /&gt;Navigation, tabs menu, shadows, rounds, etc... &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.smashingmagazine.com/2007/01/19/53-css-techniques-you-couldnt-live-without/&quot;&gt;53 CSS techniques you couldnt live without&lt;/a</description><link>http://lastdon.blogspot.com/2007/01/n-ice-css-examples.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-6032411146542327942</guid><pubDate>Thu, 11 Jan 2007 07:42:00 +0000</pubDate><atom:updated>2007-01-11T10:01:06.191+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Installshield</category><category domain="http://www.blogger.com/atom/ns#">Setup</category><title>Installshield hangs</title><description>I would prefer stay away from Installshield. I will never write my experience in this product in the my resume. But it happens, I must work with it &lt;em&gt;&quot;time after time&quot;&lt;/em&gt;&lt;br /&gt;Setup hang after finished whole work, and exited from any of my install script events.&lt;br /&gt;Why? &lt;br /&gt;Because I forgot to call &lt;strong&gt;SdShowMsg(&quot;&quot;, FALSE)&lt;/strong&gt; in one of cases.&lt;br /&gt;After &lt;a href=&quot;http://community.installshield.com/showthread.php?t=143412&quot;&gt;investigation of the community&lt;/a&gt; I found, this problem happens  on &lt;strong&gt;abort&lt;/strong&gt; or &lt;strong&gt;exit&lt;/strong&gt; calls as well in different versions. I have latest Installshield 12. Should Macrovision fix their bugs? No answer.</description><link>http://lastdon.blogspot.com/2007/01/installshield-hangs.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-2656061414830786101</guid><pubDate>Mon, 08 Jan 2007 07:11:00 +0000</pubDate><atom:updated>2007-01-08T10:01:14.178+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C++</category><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><category domain="http://www.blogger.com/atom/ns#">Win32</category><title>VS 2005 DLL Hell and simple C++ Win32</title><description>So many people have problems with C++ on VS 2005 and just released Service pack 1. So many blames, hysterics, and threaths to change development environment. What Microsoft doing for C++ programmer? As they explaining, they trying doing best to avoid DLL Hell.&lt;br /&gt;Come on, enough! Let&#39;s move to Linux. Just kidding. :)&lt;br /&gt;&lt;br /&gt;Fortunately, since .NET appeared, I am not writing C++ too often. However, yesterday I required to write simple Win32 C++ application and got troubles with running it on computer w/o .NET installed.&lt;br /&gt;Damn, where is old good VS 6.0?&lt;br /&gt;I created empty Win32 application, compiled it and copied to computer without .NET.&lt;br /&gt;Bah!&lt;br /&gt;&lt;strong&gt;&quot;Application has failed to start because MSVCR80.dll was not found&quot;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Ok, I copied this runtime DLL to application folder. Bah!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&quot;An application has made an attempt to load C runtime library incorrectly&quot;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Ok, result of the investigation is clear - together with exe, VS 2005 built manifest file. I copied manifest file to application directory. Now... error is same.&lt;br /&gt;Just to check, I installed .NET 2.0 and application started to work. Wow. But wait, I am writing win32 C++ application, why I need this framework?&lt;br /&gt;&lt;br /&gt;I get through project properties, disabled any manifest settings, and saw, that project settings were set to not require .NET CLR. No progress. Application doesn&#39;t work w/o .NET. As experienced C++ programmer, I think, I am too old for this. :) Where I put CD &quot;Visual Studio 6&quot; ?&lt;br /&gt;&lt;br /&gt;At last, I changed to static linking for the runtime library. I choosed using /MT rather than /MD. Yes, Microsoft doesn&#39;t recommend it. But... Bingo! Application started to work!&lt;br /&gt;Some explanation of the strange behaviour of VS 2005 is found there.&lt;br /&gt;&lt;a href=&quot;http://www.itwriting.com/blog/?postid=261&quot;&gt;http://www.itwriting.com/blog/?postid=261&lt;/a&gt;&lt;br /&gt;There are also another solutions, but they doesn&#39;t seem workable for system w/o .NET&lt;br /&gt;I decided to stay with static linking for now as single way to get win32 exe and run it everywhere. Is there another way? God knows.&lt;br /&gt;&lt;br /&gt;BTW, there is another source describing the situation. &lt;a href=&quot;http://www.grimes.demon.co.uk/workshops/fusWSThirteen.htm&quot;&gt;http://www.grimes.demon.co.uk/workshops/fusWSThirteen.htm&lt;/a&gt;&lt;br /&gt;I agree with article that implementing strange ideas in unmanaged programming doesn&#39;t look too nice and handy.&lt;br /&gt;&quot;&lt;em&gt;The whole process of manifests and embedding them is topsey-turvey and is a complete mess. This is yet another example of Microsoft losing the plot&lt;/em&gt;&quot;</description><link>http://lastdon.blogspot.com/2007/01/vs-2005-dll-hell-and-simple-c-win32.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-8059262263555934370</guid><pubDate>Mon, 11 Dec 2006 09:51:00 +0000</pubDate><atom:updated>2008-12-10T13:10:43.839+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Certificate</category><title>C# free test</title><description>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsloA_Z3y5xB-ferGgEvffqSVDyV7qUtdJMsA0XUiUwkm6L6i_DtZ5PZTswK-J_j0eS8pnT_q_U9oo5psQ9PYgbxZLd9LPVoJbQCXxCI_yBTOpzElgH0ateqgT4NnpS3l6K5yC/s1600-h/Certificate1.gif&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5007205559402713362&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/AVvXsEjsloA_Z3y5xB-ferGgEvffqSVDyV7qUtdJMsA0XUiUwkm6L6i_DtZ5PZTswK-J_j0eS8pnT_q_U9oo5psQ9PYgbxZLd9LPVoJbQCXxCI_yBTOpzElgH0ateqgT4NnpS3l6K5yC/s320/Certificate1.gif&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; Actually I don&#39;t think these tests make sense. They check knowledge more then programmer&#39;s possibilities. Even erudite person may not give good result on job, because knowledge is not all. Yes, good knowledge may help to code effectively in the clean new project. But in the big existing projects, it doesn&#39;t make sense without other things.&lt;br /&gt;&lt;br /&gt;We always know &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_0&quot; onclick=&quot;BLOG_clickHandler(this)&quot;&gt;ourself&lt;/span&gt; very good, but in any moment that we can to get free exam, we going to get it. :) Even if the test is so stupid, like this one.&lt;br /&gt;&lt;a href=&quot;http://www.brainbench.com/xml/bb/common/testcenter/freetests.xml&quot;&gt;Free exams&lt;/a&gt;</description><link>http://lastdon.blogspot.com/2006/12/actually-i-dont-think-these-tests-make.html</link><author>noreply@blogger.com (The Last Don)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsloA_Z3y5xB-ferGgEvffqSVDyV7qUtdJMsA0XUiUwkm6L6i_DtZ5PZTswK-J_j0eS8pnT_q_U9oo5psQ9PYgbxZLd9LPVoJbQCXxCI_yBTOpzElgH0ateqgT4NnpS3l6K5yC/s72-c/Certificate1.gif" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-7615425896695056011</guid><pubDate>Thu, 07 Dec 2006 09:50:00 +0000</pubDate><atom:updated>2006-12-07T12:10:16.214+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><title>Visual Studio macro - collapse all projects</title><description>I have 125 project in solution, and it is hard to manage them without one-click macro. After migration to VS 2005 things are same - Microsoft just doesn&#39;t think about it, so I use old good macro again. &lt;br /&gt;This macro collapses on top level only. I think, it is enough, anyway it takes time to collapse all.&lt;div style=&quot;width:400px; overflow:auto&quot; &gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    Sub CollapseAll()&lt;br /&gt;&lt;br /&gt;        &#39; Get the the Solution Explorer tree&lt;br /&gt;        Dim UIHSolutionExplorer As UIHierarchy&lt;br /&gt;        UIHSolutionExplorer = DTE.Windows.Item( _&lt;br /&gt;            Constants.vsext_wk_SProjectWindow).Object()&lt;br /&gt;&lt;br /&gt;        &#39; Check if there is any open solution&lt;br /&gt;        If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then&lt;br /&gt;            &#39; MsgBox(&quot;Nothing to collapse. You must have an open solution.&quot;)&lt;br /&gt;            Return&lt;br /&gt;        End If&lt;br /&gt;&lt;br /&gt;        &#39; Get the top node (the name of the solution)&lt;br /&gt;        Dim UIHSolutionRootNode As UIHierarchyItem&lt;br /&gt;        UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)&lt;br /&gt;&lt;br /&gt;        &#39; Collapse each project node&lt;br /&gt;        Dim UIHItem As UIHierarchyItem&lt;br /&gt;        For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems&lt;br /&gt;            UIHItem.UIHierarchyItems.Expanded = False&lt;br /&gt;        Next&lt;br /&gt;&lt;br /&gt;        &#39; Select the solution node, or else when you click &lt;br /&gt;        &#39; on the solution window&lt;br /&gt;        &#39; scrollbar, it will synchronize the open document &lt;br /&gt;        &#39; with the tree and pop&lt;br /&gt;        &#39; out the corresponding node which is probably not what you want.&lt;br /&gt;        UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)&lt;br /&gt;&lt;br /&gt;    End Sub&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://lastdon.blogspot.com/2006/12/visual-studio-solution-collapse-them.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-3208050105045639260</guid><pubDate>Wed, 06 Dec 2006 10:40:00 +0000</pubDate><atom:updated>2006-12-06T13:54:53.885+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">IIS</category><category domain="http://www.blogger.com/atom/ns#">Setup</category><title>Setup web application on Windows 2003</title><description>Windows 2003 come with NET 1.1 preinstalled. However, ASP.NET web extension may be not installed by default. It is depends on checkbox ASP.NET in the &quot;Windows Components&quot; of the Add/Remove Programs.&lt;br /&gt;Well, I can ask user to prepare the system, before install my web application.&lt;br /&gt;However, I get clear right now, it doesn&#39;t help to me. Because it is ASP.NET 1.1 and nothing more. So, I leave user without stupid requirements and do following.&lt;br /&gt;&lt;br /&gt;My setup installs .NET 2 &lt;br /&gt;My setup registers ASP.NET 2 through aspnet_regiis.exe&lt;br /&gt;But ASP.NET web extension appears in the IIS settings as &lt;em&gt;prohibited&lt;/em&gt;&lt;br /&gt;Ok, another day for search/trying/insomnia and my C# application running from the setup, will do things right:&lt;div style=&quot;width:400px; height:210px; overflow: scroll;&quot;&gt;&lt;table style=&quot;font-size:11px; font-family:Sans Seriff&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;pre&gt;&lt;br /&gt;// if windows 2003&lt;br /&gt;if (Environment.OSVersion.Version.Major == 5 &amp;&amp;&lt;br /&gt;Environment.OSVersion.Version.Minor == 2)&lt;br /&gt;{&lt;br /&gt;DirectoryEntry folderRoot = new DirectoryEntry(&quot;IIS://localhost/W3SVC&quot;);&lt;br /&gt;folderRoot.Invoke(&quot;EnableWebServiceExtension&quot;, &quot;ASP.NET v2.0.50727&quot;);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;Bingo!&lt;br /&gt;User installs my web application setup, and doesn&#39;t complain. :)&lt;br /&gt;&lt;br /&gt;I found also other usefull methods:&lt;br /&gt;-----------&lt;br /&gt;If we want to check, is ASP.NET installed at all&lt;br /&gt;we should use &lt;strong&gt;ListWebServiceExtensions&lt;/strong&gt; and search for ASP.NET in the returned list of extensions.&lt;br /&gt;System.Array installedObj = (System.Array)folderRoot.Invoke(&quot;ListWebServiceExtensions&quot;, null);&lt;br /&gt;&lt;br /&gt;-----------&lt;br /&gt;Also we can check, is web extension restricted or not. If ASP.NET is restricted, then property &lt;strong&gt;WebSvcExtRestrictionList&lt;/strong&gt; will return list containing ASP.NET:&lt;br /&gt;System.Array restrictedObj = (System.Array)folderRoot.Properties[&quot;WebSvcExtRestrictionList&quot;].Value;</description><link>http://lastdon.blogspot.com/2006/12/setup-web-application-on-windows-2003.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-1053526562322964873</guid><pubDate>Thu, 30 Nov 2006 12:28:00 +0000</pubDate><atom:updated>2006-12-03T15:32:45.924+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">System</category><title>Windows User: SID and name</title><description>I wasted much time trying to find easy way how in C# .NET get SID by user name and back, w/o writing C++ dll. I already spend two days once for such dll, but I lost it or something. However, I spent two hours in google groups and web search, untill I found so &lt;a href=&quot;http://www.codeproject.com/cs/library/sidtranslator.asp&quot;&gt;nice article&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Sections import Win32 functions to C#, and two functions. &lt;br /&gt;&lt;br /&gt;&lt;a onclick=&quot;document.all.sp30112006_import.style.display=&#39;block&#39;;&quot; style=&quot;text-decoration:underline; cursor:hand;&quot;&gt;Import section&lt;/a&gt;&lt;br /&gt;&lt;div style=&quot;display:none;&quot; id=&quot;sp30112006_import&quot; style=&quot;width:400px; height:200px; overflow: scroll;&quot;&gt;&lt;br /&gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;pre&gt;&lt;br /&gt;private static extern bool LookupAccountSid(&lt;br /&gt;    [In,MarshalAs(UnmanagedType.LPTStr)] string systemName,&lt;br /&gt;    IntPtr sid,&lt;br /&gt;    [Out,MarshalAs(UnmanagedType.LPTStr)] StringBuilder name,&lt;br /&gt;    ref int cbName,&lt;br /&gt;    StringBuilder referencedDomainName,&lt;br /&gt;    ref int cbReferencedDomainName,&lt;br /&gt;    out int use );&lt;br /&gt;&lt;br /&gt;[DllImport(&quot;advapi32.dll&quot;, CharSet=CharSet.Auto, SetLastError=true)]&lt;br /&gt;public static extern bool LookupAccountName(&lt;br /&gt;    [In,MarshalAs(UnmanagedType.LPTStr)] string systemName,&lt;br /&gt;    [In,MarshalAs(UnmanagedType.LPTStr)] string accountName,&lt;br /&gt;    IntPtr sid,&lt;br /&gt;    ref int cbSid,&lt;br /&gt;    StringBuilder referencedDomainName,&lt;br /&gt;    ref int cbReferencedDomainName,&lt;br /&gt;    out int use);&lt;br /&gt;&lt;br /&gt;[DllImport(&quot;advapi32.dll&quot;, CharSet=CharSet.Auto, SetLastError=true)]&lt;br /&gt;internal static extern bool ConvertSidToStringSid(&lt;br /&gt;    IntPtr sid,&lt;br /&gt;    [In,Out,MarshalAs(UnmanagedType.LPTStr)] ref string pStringSid);&lt;br /&gt;&lt;br /&gt;[DllImport(&quot;advapi32.dll&quot;, CharSet=CharSet.Auto, SetLastError=true)]&lt;br /&gt;internal static extern bool ConvertStringSidToSid(&lt;br /&gt;    [In, MarshalAs(UnmanagedType.LPTStr)] string pStringSid,&lt;br /&gt;    ref IntPtr sid);&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onclick=&quot;document.all.sp30112006_GetSid.style.display=&#39;block&#39;;&quot; style=&quot;text-decoration:underline; cursor:hand;&quot;&gt;GetSid(string name)&lt;/a&gt;&lt;br /&gt;&lt;div style=&quot;display:none;&quot; id=&quot;sp30112006_GetSid&quot; style=&quot;width:400px; height:200px; overflow: scroll;&quot;&gt;&lt;br /&gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;pre&gt;&lt;br /&gt;public static string GetSid(string name)&lt;br /&gt;{&lt;br /&gt;    IntPtr _sid = IntPtr.Zero;    //pointer to binary form of SID string.&lt;br /&gt;    int _sidLength = 0;            //size of SID buffer.&lt;br /&gt;    int _domainLength = 0;        //size of domain name buffer.&lt;br /&gt;    int _use;                    //type of object.&lt;br /&gt;    //stringBuilder for domain name.&lt;br /&gt;    StringBuilder _domain = new StringBuilder();    &lt;br /&gt;    int _error = 0;                &lt;br /&gt;    string _sidString = &quot;&quot;;&lt;br /&gt;&lt;br /&gt;    //first call of the function only returns the size &lt;br /&gt;    //of buffers (SID, domain name)&lt;br /&gt;    LookupAccountName(null, name, _sid, ref _sidLength, _domain, &lt;br /&gt;                       ref _domainLength, out _use);&lt;br /&gt;    _error = Marshal.GetLastWin32Error();&lt;br /&gt;&lt;br /&gt;    //error 122 (The data area passed to a system call is too small) &lt;br /&gt;    // normal behaviour.&lt;br /&gt;    if (_error != 122) &lt;br /&gt;    {&lt;br /&gt;        throw(new Exception(new Win32Exception(_error).Message));&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        //allocates memory for domain name&lt;br /&gt;        _domain = new StringBuilder(_domainLength); &lt;br /&gt;         //allocates memory for SID&lt;br /&gt;        _sid = Marshal.AllocHGlobal(_sidLength);   &lt;br /&gt;        bool _rc = LookupAccountName(null, name, _sid, ref _sidLength, _domain, &lt;br /&gt;                                  ref _domainLength, out _use);&lt;br /&gt;&lt;br /&gt;        if (_rc == false)&lt;br /&gt;        {&lt;br /&gt;            _error = Marshal.GetLastWin32Error();&lt;br /&gt;            Marshal.FreeHGlobal(_sid);&lt;br /&gt;            throw(new Exception(new Win32Exception(_error).Message));&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            // converts binary SID into string&lt;br /&gt;            _rc = ConvertSidToStringSid(_sid, ref _sidString);&lt;br /&gt;&lt;br /&gt;            if (_rc == false)&lt;br /&gt;            {&lt;br /&gt;                _error = Marshal.GetLastWin32Error();&lt;br /&gt;                Marshal.FreeHGlobal(_sid);&lt;br /&gt;                throw(new Exception(new Win32Exception(_error).Message));&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                Marshal.FreeHGlobal(_sid);&lt;br /&gt;                return _sidString;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;} &lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onclick=&quot;document.all.sp30112006_GetName.style.display=&#39;block&#39;;&quot; style=&quot;text-decoration:underline; cursor:hand;&quot;&gt;GetName(string sid)&lt;/a&gt;&lt;br /&gt;&lt;div style=&quot;display:none;&quot; id=&quot;sp30112006_GetName&quot; style=&quot;width:400px; height:200px; overflow: scroll;&quot;&gt;&lt;table style=&quot;font-size:11px&quot;&gt;&lt;tr&gt;&lt;td nowrap&gt;&lt;pre&gt;&lt;br /&gt;public static string GetName(string sid)&lt;br /&gt;{&lt;br /&gt;    IntPtr _sid = IntPtr.Zero;    //pointer to binary form of SID string.&lt;br /&gt;    int _nameLength = 0;        //size of object name buffer&lt;br /&gt;    int _domainLength = 0;        //size of domain name buffer&lt;br /&gt;    int _use;                    //type of object&lt;br /&gt;    StringBuilder _domain = new StringBuilder();    //domain name variable&lt;br /&gt;    int _error = 0;&lt;br /&gt;    StringBuilder _name = new StringBuilder();        //object name variable&lt;br /&gt;&lt;br /&gt;    //converts SID string into the binary form&lt;br /&gt;    bool _rc0 = ConvertStringSidToSid(sid, ref _sid);    &lt;br /&gt;&lt;br /&gt;    if (_rc0 == false)&lt;br /&gt;    {&lt;br /&gt;        _error = Marshal.GetLastWin32Error();&lt;br /&gt;        Marshal.FreeHGlobal(_sid);&lt;br /&gt;        throw(new Exception(new Win32Exception(_error).Message));&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //first call of method returns the size of domain name &lt;br /&gt;    //and object name buffers&lt;br /&gt;    bool _rc = LookupAccountSid(null, _sid, _name, ref _nameLength, _domain, &lt;br /&gt;                     ref _domainLength, out _use);&lt;br /&gt;    _domain = new StringBuilder(_domainLength);    //allocates memory for domain name&lt;br /&gt;    _name = new StringBuilder(_nameLength);        //allocates memory for object name&lt;br /&gt;    _rc = LookupAccountSid(null, _sid,  _name, ref _nameLength, _domain, &lt;br /&gt;                     ref _domainLength, out _use);&lt;br /&gt;&lt;br /&gt;    if (_rc == false)&lt;br /&gt;    {&lt;br /&gt;        _error = Marshal.GetLastWin32Error();&lt;br /&gt;        Marshal.FreeHGlobal(_sid);&lt;br /&gt;        throw(new Exception(new Win32Exception(_error).Message));&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        Marshal.FreeHGlobal(_sid);&lt;br /&gt;        return _domain.ToString() + &quot;\\&quot; + _name.ToString();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;links:&lt;/em&gt;&lt;br /&gt;&lt;a href=&quot;http://www.codeproject.com/cs/library/sidtranslator.asp&quot;&gt;http://www.codeproject.com/cs/library/sidtranslator.asp&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://support.microsoft.com/kb/157234&quot;&gt;http://support.microsoft.com/kb/157234&lt;/a&gt;</description><link>http://lastdon.blogspot.com/2006/11/read-more-hidden-text.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-116462958466424431</guid><pubDate>Mon, 27 Nov 2006 12:09:00 +0000</pubDate><atom:updated>2006-11-27T14:59:23.898+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">windows</category><title>XP Baloons tips</title><description>It is great, no more stupid baloons from Win XP systray.&lt;br /&gt;&lt;br /&gt;HKEY_CURRENT_USER/Software/Microsoft/Windows/Current Version/Explorer/Advanced&lt;br /&gt;create DWORD value EnableBalloonTips and set it to zero.</description><link>http://lastdon.blogspot.com/2006/11/xp-baloons-tips.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-36341263.post-116462776259212189</guid><pubDate>Mon, 27 Nov 2006 11:40:00 +0000</pubDate><atom:updated>2006-11-27T15:00:30.215+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">windows</category><title>How to run program as a different user</title><description>“runas /user:myComputer\administrator &quot;explorer /separate&quot;”&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://blogs.msdn.com/florinlazar/archive/2005/09/17/470001.aspx&quot;&gt;http://blogs.msdn.com/florinlazar/archive/2005/09/17/470001.aspx&lt;/a&gt;</description><link>http://lastdon.blogspot.com/2006/11/how-to-run-program-as-different-user.html</link><author>noreply@blogger.com (The Last Don)</author><thr:total>0</thr:total></item></channel></rss>