<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Vlad Hrybok's Tech Notes</title>
  <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/" />
  <link rel="self" href="http://vladsnotes.hrybok.com/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2011-09-14T15:11:49.8895811-04:00</updated>
  <author>
    <name>Vlad Hrybok</name>
  </author>
  <subtitle>The future of Internet is &lt;a href='http://httpvpn.com'&gt;HttpVPN&lt;/a&gt;...</subtitle>
  <id>http://vladsnotes.hrybok.com/</id>
  <generator uri="http://www.dasblog.net" version="1.9.6264.0">DasBlog</generator>
  <entry>
    <title>Factors determining whether Windows 8 will succeed or fail</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,c1c4dabb-9108-4009-910f-daaae8f88e5a.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,c1c4dabb-9108-4009-910f-daaae8f88e5a.aspx</id>
    <published>2011-09-14T15:07:41.421-04:00</published>
    <updated>2011-09-14T15:11:49.8895811-04:00</updated>
    <category term="Metro UI" label="Metro UI" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Metro%2BUI.aspx" />
    <category term="Sofware Development" label="Sofware Development" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Sofware%2BDevelopment.aspx" />
    <category term="Windows 8" label="Windows 8" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Windows%2B8.aspx" />
    <category term="WinRT" label="WinRT" scheme="http://vladsnotes.hrybok.com/CategoryView,category,WinRT.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There are two different Windows 8 types: the tablet one, with ARM CPU, and desktop/laptop/server
one, with Intel x86/x64/i386 CPUs. Old code base won't run on the ARM tablets, and
Metro will not run on Windows 7,Vista and XP. Given that porting applications
to Windows 8 is likely to be not trivial, here's the dilemma we, developers, face:
</p>
        <ul>
          <li>
If we write WinRT/Metro UI applications, we'll be able to run it only on Windows 8,
both ARM and Intel, but not on ealier Windows version. We'll also be able to sell
it at Microsoft app store. 
<br /></li>
          <li>
If we write a traditional Windows application, we will be able to run it on any
non-ARM Windows version, including 8, losing ARM/tablet market and the ability to
distribute the app via the app store.</li>
        </ul>
        <p>
So it all comes down to <strong>whether developers will believe that getting Metro/Tablet
market is going to be worth forsaking Windows 7/Vista/XP desltop/laptop/server market</strong>. 
</p>
        <p>
Only Intel and AMD can truly save MS back by enabling legacy software on the tablet
- if they create low-power yet fast, tablet-worthy x86 CPUs. This would enable programmers
like me to write bulk of the logic in the backward-compatible modules and supply dual
UI: Metro and traditional Win32. In other words, I'll do Metro programming sooner
if Metro port is inexpensive, and if I don't lose backward compatibility with the
huge install base of legacy Windows.
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=c1c4dabb-9108-4009-910f-daaae8f88e5a" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Windows 8 Metro Articles, API references, Walk-Throughs, White Papers, Tutorials, Etc.</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,85717301-a24a-4ca7-b712-83589be29c95.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,85717301-a24a-4ca7-b712-83589be29c95.aspx</id>
    <published>2011-09-14T14:53:40.8915917-04:00</published>
    <updated>2011-09-14T14:53:40.8915917-04:00</updated>
    <category term="Metro UI" label="Metro UI" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Metro%2BUI.aspx" />
    <category term="Visual Studio 2011" label="Visual Studio 2011" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Visual%2BStudio%2B2011.aspx" />
    <category term="Windows 8" label="Windows 8" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Windows%2B8.aspx" />
    <category term="WinRT" label="WinRT" scheme="http://vladsnotes.hrybok.com/CategoryView,category,WinRT.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Here's all you need to know to build Windows 8 Metro applications.
</p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/windows/apps/">http://msdn.microsoft.com/en-us/library/windows/apps/</a>
        </p>
        <p>
 
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=85717301-a24a-4ca7-b712-83589be29c95" />
      </div>
    </content>
  </entry>
  <entry>
    <title>First look at Windows 8 Metro UI Development</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,80d118ae-c5aa-430a-9d44-592e98a0fa11.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,80d118ae-c5aa-430a-9d44-592e98a0fa11.aspx</id>
    <published>2011-09-14T10:50:05.401-04:00</published>
    <updated>2011-09-14T10:57:28.4101715-04:00</updated>
    <category term="Metro UI" label="Metro UI" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Metro%2BUI.aspx" />
    <category term="Visual Studio 2011" label="Visual Studio 2011" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Visual%2BStudio%2B2011.aspx" />
    <category term="Windows 8" label="Windows 8" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Windows%2B8.aspx" />
    <category term="WinRT" label="WinRT" scheme="http://vladsnotes.hrybok.com/CategoryView,category,WinRT.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
.NET developers have had major source of anxiety lately: Microsoft mentioned only
JavaScript as a programming language for Windows 8 Metro UI application development.
Now, since the Windows 8 Preview with development tools was released yesterday, I
installed it and it's clear it's not only JavaScript, but also C#, VB and C++.
Why Microsoft didn't say this at the same time as they mentioned JavaScript is totally
beyond my comprehension. 
</p>
        <p>
Here's how Visual Studio 2011 New Project dialog screenshot looks like:<br /><img src="http://download.ultidev.com/Images/Blog/New%20Metro%20UI%20Projects%20in%20Visual%20Studio%202011.png" /></p>
        <p>
Once the project is created, you end up in the very WPF- and Silverlight-like environment,
with new project containing XAML &amp; code-behind files. First thing I
did was I looked at the project's properties to see whether Windows Runtime (WinRT)
is actually an extension to a standard .NET Framework. To my surprise, Target Framework
project property is disabled and blank.
</p>
        <p>
For me personally, I was most worried about whether I will be able to port or extend
my <a href="http://ultidev.com/products/UWS-Cassini-Pro/">UltiDev Web Server Pro</a> project
(a tiny free redsitributable web server) to support Windows 8 UI. I wanted to make
sure that WinRT framework is compatible with existing .NET Framework. It appears it
is.
</p>
        <p>
To find out what .NET framework Metro applications are running in, I simply put a
breakpoint in my app and inspected Environment class member values. Here's the answer:<br /><img src="http://download.ultidev.com/Images/Blog/Metro%20UI%20CLR%20Environment%20Class%20member%20values.png" /></p>
        <p>
It appears that .NET Framework we'll be targeting is still good old 4.0, with tons
of WinRT exntensions, all in GAC, to support tiles-based Metro UI.
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=80d118ae-c5aa-430a-9d44-592e98a0fa11" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Free SSL digital server certificates from a trusted CA</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,4fba4332-4042-4821-80da-be1fbc36b2f1.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,4fba4332-4042-4821-80da-be1fbc36b2f1.aspx</id>
    <published>2011-08-30T11:22:50.058-04:00</published>
    <updated>2011-08-30T11:24:02.8721001-04:00</updated>
    <category term="Operations" label="Operations" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Operations.aspx" />
    <category term="Security" label="Security" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Security.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I was looking for someone like <a href="http://www.startssl.com/">http://www.startssl.com/</a> for
a long time: a real, trusted Certificate Authority with very good root cert ubiquity
(wich would include iOS) that would issue <strong>free server certificates</strong>.
</p>
        <p>
          <a href="http://affirmtrust.com/free-ssl-certificate-products.html">AffirmTrust</a>,
which is supposed to go online any day now, promises to issue free server certs for
three year period. If their root CA certificate is going to be as widely distributed
as StartSSL's, then it may be even a better deal than StartSSL, especially given that
StartSSL web site and provisioning process are a little corky.
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=4fba4332-4042-4821-80da-be1fbc36b2f1" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Upgrading YetAnotherForum (YAF) from 1.9.0 to 1.9.5.5</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,8d7b5303-c969-4c78-b885-e233194527de.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,8d7b5303-c969-4c78-b885-e233194527de.aspx</id>
    <published>2011-06-21T12:46:04.265-04:00</published>
    <updated>2011-07-08T10:28:42.1054998-04:00</updated>
    <category term="Operations" label="Operations" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Operations.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Old <a href="http://ultidev.com/Forums/">UltiDev Forum</a> engine, YAF 1.9.0, lacked
some important features: it didn't support SSL SMTP; user registration didn't have
captcha allowing user store to be filled with fake users; search didn't work
properly in IE; and topic URLs were not search engine optimized. YetAnotherForum 1.9.5.5
had all that fixed and some additional valuable features.
</p>
        <p>
Although the process of preparation and practicing the upgrade was as protracted
as I expected it to be, the end result is good. Here's what I had to do:
</p>
        <ol>
          <li>
Backed up web.config and modified default.aspx. 
</li>
          <li>
Switched database compatibility mode from SQL Server 2000 (8.0) to SQL 2005 (90). 
</li>
          <li>
Cleaned up database from fake users. 
</li>
          <li>
Stopped IIS application containing forum. 
</li>
          <li>
Removed all old YAF files from forum site folder. 
</li>
          <li>
Copied new YAF files over. 
</li>
          <li>
Customized default.aspx to be look the previous one. 
</li>
          <li>
Renamed 1.9.1 upgrade web.config as web.config. 
</li>
          <li>
Modified db.config, mail.config and app.config according to my needs. 
</li>
          <li>
Re-started forum IIS application. 
</li>
          <li>
Ran http://approot/install/ and followed the steps.</li>
        </ol>
        <p>
After that forum was working. Since I practiced the upgrade before and had all
the .config files ready, the entire downtime was around 5 mintues required to replace
files and run install wizard.
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=8d7b5303-c969-4c78-b885-e233194527de" />
      </div>
    </content>
  </entry>
  <entry>
    <title>U-Verse Static IP Addresses: works but 2WIRE gateway barely supports the feature.</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,c0d25f61-fa93-45e9-80a5-642f2ea891e9.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,c0d25f61-fa93-45e9-80a5-642f2ea891e9.aspx</id>
    <published>2011-02-23T10:58:34.689-05:00</published>
    <updated>2011-06-27T22:30:17.1834193-04:00</updated>
    <category term="Digital Home" label="Digital Home" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Digital%2BHome.aspx" />
    <category term="Hardware" label="Hardware" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Hardware.aspx" />
    <category term="Security" label="Security" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Security.aspx" />
    <category term="Virtual Server" label="Virtual Server" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Virtual%2BServer.aspx" />
    <content type="html">&lt;p&gt;
I wanted to have multiple IPs on my server set up for quite some time because I run
multiple SSL sites and only one of them could be on a standard port 443. I ran SSL
sites on non-443 ports, but unfortunately, many companies block outbound ports, with
a funny implication that using one port number is somehow more secure than another.
But we have to deal with the reality we have, not the reality we want. So to enable
letting multiple port 443 routes, as well as routing port 80 to different boxes inside
my LAN I went ahead and got multiple static IPs from U-Verse. Here's what I learned
while making it work.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
If 2Wire RG router has invalid entries in the device list - clean the list first.
Otherwise clicking Save button on the "IP Address Allocation" page will produce "Invalid
Address Assignment" error if you don't change anything. One can clean up the list
on the System Restart page. If you have ports NATted/forwarded using Firewall page,
cleaning up the list will unlink all "applications" from "devices". So after you have
cleaned the device list, you will have to set port forwarding again. The fact that
you can't remove one device from the list and have to clear the entire list - a really
destructive thing to port forwarding settings - shows that 2WIRE RG management console
software is written very poorly.&lt;br&gt;
&lt;li&gt;
Routing multiple external IPs to the same machines is possible only if the PC has
multiple NICs. 2WIRE RG can't simply map and external IP to a LAN IP. Instead, it
maps an external IP to an internal MAC address. Which is why you can't just add multiple
IPs to the same NIC and be done with that. Adding an extra virtual NIC to a VM is
not an issue, but adding a physical NIC to an up &amp; running production server could
mean one has to &lt;a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16833156133"&gt;improvise&lt;/a&gt;.
There you have it: it's pretty easy to host multiple SSL/443 on the same box this
way. It's funny to see that as you add NICs to a box, you'll see multiple instances
of the same box in the device list - that's, of course, because RG sees them by MAC
but shows them in the list using device names. Like I said, RG web management console
is kind of pathetic.&lt;br&gt;
&lt;li&gt;
Another "no kidding" feature. In order to use an IP from a range of static addresses,
the box needs to get its IP from RG's DHCP - no static IPs allowed. RG then will give
your box the IP from static range, making your box essentially a DMZ box sitting unfirewalled
exposed to the world of hurt (internet attackers). It appears it may be possible to
use firewall on external IPs, but not clear how, especially given that RG's port forwarding
feature doesn't support multiple external IPs. It seems to forward ports only with
an assumption that router has only one external IP. So if you want your box to be
visible inside the LAN, add another NIC and give it your LAN's IP. As you see, you
ended up with a server being a poor man's firewall instead of being behind the firewall.
Did I mention that RG web console sucks?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Anyway, UVerse's multiple static IP feature would be much easier to use if 2WIRE had
better software. RG's mapping internal MACs to external IPs, and its inability to
forward and external IP to a LAN IP (eliminating the firewall) are really serious
drawbacks to be considered when deciding on whether to do static IPs with such a crude
RG.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=c0d25f61-fa93-45e9-80a5-642f2ea891e9" /&gt;</content>
  </entry>
  <entry>
    <title>Permanently Displaying Google Chrome Bookmarks Toolbar</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,fc0f16ad-6a41-4c7d-8765-7cbf9f6759cd.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,fc0f16ad-6a41-4c7d-8765-7cbf9f6759cd.aspx</id>
    <published>2010-12-28T12:20:48.934-05:00</published>
    <updated>2010-12-28T12:20:48.9348895-05:00</updated>
    <category term="Digital Home" label="Digital Home" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Digital%2BHome.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Every time I need to add Favorites toolbar to Google Chrome browser, it takes an internet
search to figure it out. Along with the lack of the Home link it's these are easily
two most annoying UI shortcomings of otherwise very good product.
</p>
        <p>
So here it is: <b>Ctrl+Shit+B</b> shows or hides Chrome bookmarks/favorites bar.
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=fc0f16ad-6a41-4c7d-8765-7cbf9f6759cd" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Restoring Windows 7 from Backup Image</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,976c682d-6ad9-477d-8529-afbe02d20274.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,976c682d-6ad9-477d-8529-afbe02d20274.aspx</id>
    <published>2010-11-22T21:38:00.465-05:00</published>
    <updated>2010-11-22T21:38:45.0753072-05:00</updated>
    <category term="Backup/Restore" label="Backup/Restore" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Backup%2fRestore.aspx" />
    <category term="Windows 7" label="Windows 7" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Windows%2B7.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I had to restore a backup image of my Windows 7 box. I have two drives and only one
of them, the system, needed to be restored. Hardware configuration has not changed,
and yet restore would fail with every concievable error message regardless what options
I chose, which dirves I included or excluded, until I cleared "<span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 16px 'Times New Roman'; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"><span style="LINE-HEIGHT: 19px; FONT-FAMILY: 'Segoe UI', Arial, Verdana, Helvetica, sans-serif; COLOR: rgb(51,51,51); FONT-SIZE: 13px" class="Apple-style-span"><strong style="FONT-WEIGHT: bold">Format
and repartition disks</strong></span></span>" checkbox. That did restore
my system, although it restored both drives, not only the one that I needed.
It was an hour of sheer terror not knowing whether I will be able to restore my information.
It's horrible, MS, this should not be happenning.
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=976c682d-6ad9-477d-8529-afbe02d20274" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Dealing with 80070005 error while instantiating a COM+ object/Services Component</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,7f3b8726-ec0a-442f-a88f-3abc68c8d021.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,7f3b8726-ec0a-442f-a88f-3abc68c8d021.aspx</id>
    <published>2010-10-22T12:37:13.2-04:00</published>
    <updated>2010-10-22T12:37:42.4500094-04:00</updated>
    <category term=".NET Programming" label=".NET Programming" scheme="http://vladsnotes.hrybok.com/CategoryView,category,.NET%2BProgramming.aspx" />
    <category term="Security" label="Security" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Security.aspx" />
    <category term="Sofware Development" label="Sofware Development" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Sofware%2BDevelopment.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
It's basically a note to self in order to avoid having to research this ever again.
I got "Retrieving the COM class factory for remote component with CLSID {XXXX} from
machine localhost failed due to the following error: 80070005 localhost" error along
with UnauthorizedAccessException in RuntimeTypeHandle.CreateInstance while attempting
to call Activator.CreateInstance(Type type) to instantiate serviced component/COM+
object. 
</p>
        <p>
To work around, "Enforce access checks for this application" checkbox needs to be
unchecked on the Security tab of COM+ application properties. To do it programmatically, the
code will look like this:
</p>
        <pre class="csharpcode">COMAdminCatalogObject app;
<span class="rem">// app = ...</span> app.set_Value(<span class="str">"ApplicationAccessChecksEnabled"</span>,
0); </pre>
        <p>
 
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=7f3b8726-ec0a-442f-a88f-3abc68c8d021" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Instantiating Proxy for Out-of-Process ServicedComponent/Managed COM+ Component</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,13fb0c97-9045-40f5-a28f-f7723ef6ebd3.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,13fb0c97-9045-40f5-a28f-f7723ef6ebd3.aspx</id>
    <published>2010-07-25T16:23:48.017-04:00</published>
    <updated>2010-07-27T00:40:35.5058342-04:00</updated>
    <category term=".NET Programming" label=".NET Programming" scheme="http://vladsnotes.hrybok.com/CategoryView,category,.NET%2BProgramming.aspx" />
    <category term="Sofware Development" label="Sofware Development" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Sofware%2BDevelopment.aspx" />
    <category term="x64" label="x64" scheme="http://vladsnotes.hrybok.com/CategoryView,category,x64.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
It appears that a client proxy instance for and out-of-process ServicedComponent expects
the client to have a compile-time reference to the ServicedComponent assembly,
unless ServicedComponent is either of different CLR version or has different bitness
(either client or server is x64 while another one is x86). This creates a bizarre
problem: if the client has no design-time reference to the ServicedComponent, Activator.CreateInstance(compoentClsID)
fails if the component is of the same bitness and CLR version with a cryptic "Cannot
load type" RemotingException, while working perfectly fine when ServicedComponent
is of different bitness or compiled targeting different .NET Framework version.
Google offered no insight, so I started thinking of why matching CLR and bitness would
lead to failure. I started suspecting that when client and server have mismatched
CLR/bitness attributes, runtime must be doing cross-process marshalling in somewhat
different manner than when attributes match. Now what I needed is to ensure that same
"deep proxying" is taking place when client and server have matching CLR/bitness.
On the hunch I decided to use overloaded <strong><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas"><font color="#2b91af" size="2" face="Consolas">Type</font></font></font><font size="2" face="Consolas"><font color="#000000" size="2" face="Consolas">.GetTypeFromCLSID(clsID, </font></font><font color="#a31515" size="2" face="Consolas"><font color="#a31515" size="2" face="Consolas"><font color="#a31515" size="2" face="Consolas">"localhost"</font></font></font></strong><font size="2" face="Consolas"><font size="2" face="Consolas"><font color="#000000"><strong>)</strong></font></font></font>,
and lo and behold, it worked! Now I have a client that at design time is only aware
of ServicedComponent's interface, but does not hold a direct reference to it, and
yet it is able to talk to multiple out-of-process ServicedComponent implementing same
interface while having different CLR and bitness attributes. At the end of the day
it turned out to be possible to instantiate ServicedComponent while knowing neither
its CLSID at the design time nor having a hard reference to the assembly implementing
ServicedComponent.
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=13fb0c97-9045-40f5-a28f-f7723ef6ebd3" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Preserving ViewState in ASP.NET CompositeControl</title>
    <link rel="alternate" type="text/html" href="http://vladsnotes.hrybok.com/PermaLink,guid,fdfab71a-a92a-4a4f-823d-23bc1025aeeb.aspx" />
    <id>http://vladsnotes.hrybok.com/PermaLink,guid,fdfab71a-a92a-4a4f-823d-23bc1025aeeb.aspx</id>
    <published>2010-07-16T11:33:00.232-04:00</published>
    <updated>2010-07-26T10:55:20.5504836-04:00</updated>
    <category term=".NET Programming" label=".NET Programming" scheme="http://vladsnotes.hrybok.com/CategoryView,category,.NET%2BProgramming.aspx" />
    <category term="ASP.NET" label="ASP.NET" scheme="http://vladsnotes.hrybok.com/CategoryView,category,ASP.NET.aspx" />
    <category term="Sofware Development" label="Sofware Development" scheme="http://vladsnotes.hrybok.com/CategoryView,category,Sofware%2BDevelopment.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I thought I knew ASP.NET. I started ASP.NET programming in 2001, and I started it
with customer/server control development and was cranking them out with no problem.
So theoretically I should not have struggled for six hours with a CompositeControl
not being able to save nested controls' state between postbacks. 
</p>
        <p>
All it came down to is calling EnsureChildControls() from the OnInit().
</p>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
            <p>
[
</p>
          </font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">ToolboxData</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">(</font>
        </font>
        <font color="#a31515" size="2" face="Consolas">
          <font color="#a31515" size="2" face="Consolas">
            <font color="#a31515" size="2" face="Consolas">"&lt;{0}:BogusCustomControl
runat=server&gt;&lt;/{0}:BogusCustomControl&gt;"</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">)]<br /></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">public</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">class</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">BogusCustomControl</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> : </font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">CompositeControl<br /></font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">{<br />
    </font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">Button</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> btn
= </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">new</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">Button</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">();
<p></p></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">
              <font color="#003300">    </font>protected</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">override</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">void</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> OnInit(</font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">EventArgs</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> e)<br />
    {<br />
        </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">base</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.OnInit(e);
<p></p></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">
              <font color="#003300">        </font>
              <span style="BACKGROUND-COLOR: yellow">
                <strong>this</strong>
              </span>
            </font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
            <strong>.EnsureChildControls();</strong>
            <font color="#008000" size="2" face="Consolas">
              <font color="#008000" size="2" face="Consolas">
                <font color="#008000" size="2" face="Consolas">//
&lt;&lt; This is it! This makes ViewState work for a CompositeControl</font>
              </font>
            </font>
            <br />
    }
<p></p></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">
              <font color="#003300">    </font>protected</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">override</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">void</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> OnLoad(</font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">EventArgs</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> e)<br />
    {<br /></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">
              <font color="#003300">        </font>if</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> (!</font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">this</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.Page.IsPostBack)<br />
        {<br /><font color="#008000" size="2" face="Consolas"><font color="#008000" size="2" face="Consolas"><font color="#008000" size="2" face="Consolas">           
// Set value once to test whether it's preserved between postbacks</font></font></font><br />
            </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">this</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.btn.Text
= </font>
        </font>
        <font color="#2b91af" size="2" face="Consolas">
          <font color="#2b91af" size="2" face="Consolas">
            <font color="#2b91af" size="2" face="Consolas">DateTime</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.Now.ToLongTimeString();<br />
        }
<p></p></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">
              <font color="#003300">        </font>base</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.OnLoad(e);<br />
    }
<p></p></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">
              <font color="#003300">    </font>protected</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">override</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">
          </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">void</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas"> CreateChildControls()<br />
    {<br />
        </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">this</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.btn.ID
= </font>
        </font>
        <font color="#a31515" size="2" face="Consolas">
          <font color="#a31515" size="2" face="Consolas">
            <font color="#a31515" size="2" face="Consolas">"whatever"</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">;<br />
        </font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">this</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.Controls.Add(</font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">this</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.btn);
<p></p></font>
        </font>
        <font color="#0000ff" size="2" face="Consolas">
          <font color="#0000ff" size="2" face="Consolas">
            <font color="#0000ff" size="2" face="Consolas">
              <font color="#003300">        </font>base</font>
          </font>
        </font>
        <font size="2" face="Consolas">
          <font size="2" face="Consolas">.CreateChildControls();<br />
    }<br />
}
</font>
        </font>
        <p>
 
</p>
        <img width="0" height="0" src="http://vladsnotes.hrybok.com/aggbug.ashx?id=fdfab71a-a92a-4a4f-823d-23bc1025aeeb" />
      </div>
    </content>
  </entry>
</feed>
