<?xml version="1.0" encoding="utf-8" ?>

<rss version="0.91" >
<channel>
<title>GiS</title>
<link>http://gis.shandyba.com/</link>
<description>Gone Into SEH</description>
<language>en</language>
<image>
        <url>http://gis.shandyba.com/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: GiS - Gone Into SEH</title>
        <link>http://gis.shandyba.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>C++ Delayed Constructor</title>
    <link>http://gis.shandyba.com/archives/16-C++-Delayed-Constructor.html</link>

    <description>
        &lt;p&gt;Messing recently with a multiple--dispatch solution in C++ / Boost / Loki environment I faced a number of challenges one of which was to implement a &amp;quot;delayed constructor&amp;quot; mechanism. Basically, this is a somehow known problem of binding values to constructors which isn&#039;t solvable by boost::bind as there is no way to get an address of the constructor, but for which a solutions exists in boost::lambda::bind. Honestly, I didn&#039;t look into there in deep. Instead I went for a short [maybe elegant] solution, compilable by any compiler supporting variadic templates (spirit of c++0x is already within our codes):&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;template &amp;lt;class TObject&amp;gt;
class DelayedConstructor
{
public:
    template &amp;lt;class ...Args&amp;gt;
    DelayedConstructor(Args ...args)
    {
        class ConstructHelper
        {
        public:
            static TObject* DoConstruct(Args ...args)
            {
                return new TObject(args...);
            }
        };
        m_funHelper = boost::bind(ConstructHelper::DoConstruct, args...);
    }
    
    TObject* operator()()
    {
        return m_funHelper();
    }
    
protected:
    boost::function&amp;lt;TObject*(void)&amp;gt; m_funHelper;
};&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And here we use it:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;class A
{
public:
    A(int a, std::string str) { }
};

//Binding values to the constructor
DelayedConstructor&amp;lt;A&amp;gt; dc(21, &amp;quot;Good stuff!&amp;quot;);

//Actually creating an object
A *pA = dc();&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To me it looks very simple and rational. And keep in mind that it would work with any number of constructor arguments, which you don&#039;t have to worry about at all. Just Use it.&lt;/p&gt;

&lt;p&gt;But what&#039;s left for a homework? Okay, let&#039;s teach it to accept binding of only specific args. As we are used to do with regular functions.&lt;/p&gt;

&lt;p&gt;P.S. But what is even more exciting is that as soon as c++0x lambdas come to play the solution of this problem would become trivial by using lambda factory function for desired class, which will eliminate usage of boot::bind.&lt;/p&gt;

 
    </description>
</item>
<item>
    <title>Same DLL loaded twice</title>
    <link>http://gis.shandyba.com/archives/15-Same-DLL-loaded-twice.html</link>

    <description>
        &lt;p&gt;&lt;p align=&quot;justify&quot;&gt;If you ever felt interest into how Windows loader works you definitely know that it works just so same DLL can&#039;t be loaded twice, under any circumstances. OK, I can put a correction here, a DLL referred by &lt;em&gt;same &lt;/em&gt;path.&lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;Though a colleague of mine, James Thomson, was lucky to prove the opposite. The question has already been risen in 4 different places in the Internet:&lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2535695&amp;amp;amp;SiteID=1&#039;);&quot;  href=&quot;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2535695&amp;amp;SiteID=1&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;MSDN Forums&lt;/a&gt;&lt;br /&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/groups.google.com/group/microsoft.public.vc.atl/browse_thread/thread/6798d92924ea759c/2c114cb23eb72cb9?lnk=gst&amp;amp;amp;q=dll+loaded+twice+side+by+side#2c114cb23eb72cb9&#039;);&quot;  href=&quot;http://groups.google.com/group/microsoft.public.vc.atl/browse_thread/thread/6798d92924ea759c/2c114cb23eb72cb9?lnk=gst&amp;amp;q=dll+loaded+twice+side+by+side#2c114cb23eb72cb9&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;Google Groups&lt;/a&gt;&lt;br /&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.wasm.ru/forum/viewtopic.php?id=24411&#039;);&quot;  href=&quot;http://www.wasm.ru/forum/viewtopic.php?id=24411&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;WASM Phorum&lt;/a&gt; (in Russian)&lt;br /&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.rsdn.ru/forum/message/2773971.all.aspx&#039;);&quot;  href=&quot;http://www.rsdn.ru/forum/message/2773971.all.aspx&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;RSDN Forums&lt;/a&gt; (in Russian )&lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot; /&gt;&lt;p align=&quot;justify&quot;&gt;Still I would like to point out attention to it here as well, as in none of that places we were able to get the explanation of what&#039;s going on with Windows loader.&lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;If you like you can have a look at sample application prepared by James &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/download/uploads/Stuff/SideBySideTest.zip&#039;);&quot;  href=&quot;http://gis.shandyba.com/uploads/Stuff/SideBySideTest.zip&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;In few words we first load a DLL by creating a COM object living in it using SxS (Side by Side) COM manifest for that purpose. And then we load it again, as statically linked DLL to an intermediate DLL that we load via LoadLibrary. Load order is explained here&lt;br /&gt;
&lt;img src=&quot;http://gis.shandyba.com/uploads/Stuff/SideBySideCOMProblem.jpg&quot; alt=&quot;1&quot; /&gt;.&lt;br /&gt;
Well, voila, you can already see 2 instances of the same binary image in memory. Just if you are curious and try changing steps of load procedure you&#039;ll be surprised to see that doing so causes only one DLL instance to reside in memory.&lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;That&#039;s all. Reproducible under WinXP SP2 and under Vista Business. Have not tried under any other OS though.&lt;/p&gt;&lt;p align=&quot;justify&quot; /&gt;&lt;/p&gt;

 
    </description>
</item>
<item>
    <title>&quot;What the heck?!&quot; thought Bill trying to find a &quot;Start&quot; button on his iPhone</title>
    <link>http://gis.shandyba.com/archives/12-What-the-heck!-thought-Bill-trying-to-find-a-Start-button-on-his-iPhone.html</link>

    <description>
        &lt;p&gt;&lt;p align=&quot;justify&quot;&gt;Don&#039;t really know why everybody talks about iPhone so much?! :)&lt;/p&gt;

 
    </description>
</item>
<item>
    <title>Google Analytics does not reveal IP addresses of site visitors</title>
    <link>http://gis.shandyba.com/archives/11-Google-Analytics-does-not-reveal-IP-addresses-of-site-visitors.html</link>

    <description>
        &lt;p&gt;&lt;p align=&quot;justify&quot;&gt;Recently while playing with wonderful &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/analytics.google.com&#039;);&quot;  href=&quot;http://analytics.google.com&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;Google Analytics&lt;/a&gt; service I&#039;ve been greatly dissapointed to know that there was no way to obtain statistical information about visitors IP addresses! This sounds like nonsense having in mind an awesome number of different other pieces of information about visitors capable of being analyzed. Really, the prehistory was also quite interesting, just look here: &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.roirevolution.com/blog/2006/09/view_visitor_ip_address_in_google_analytics.html&#039;);&quot;  href=&quot;http://www.roirevolution.com/blog/2006/09/view_visitor_ip_address_in_google_analytics.html&quot; onclick=&quot;window.open(this.href, &#039;_blank&#039;); return false;&quot;&gt;http://www.roirevolution.com/blog/2006/09/view_visitor_ip_address_in_google_analytics.html&lt;/a&gt;. The found backdoor to workaround the limitation was closed quite fast :) If you haven&#039;t read all the comments there, here is what I wrote:&lt;/p&gt;&lt;blockquote dir=&quot;ltr&quot; style=&quot;MARGIN-RIGHT: 0px&quot;&gt;&lt;p align=&quot;justify&quot;&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&amp;quot;It seems to be a strange position of Google. Information about IP addresses hardly breaks any privacy rules as there is no way to access a web site and not to reveal the IP address. So any visitor by default agrees for his / her IP to be collected. If higher level of privacy is need, higher level tools should be used by users. That&#039;s how it is done, you all know that.&lt;br /&gt;This Analytics limitation just makes the product less handy as info about IPs is anyway stored in web-server&#039;s log files and can be easily accessed and analyzed by site owner.&amp;quot;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p dir=&quot;ltr&quot; align=&quot;justify&quot;&gt; &lt;/p&gt;&lt;p dir=&quot;ltr&quot; align=&quot;justify&quot;&gt;Another interesting thing is that there are people agreeing with Google in this strange Policy. Internet is a big sandbox with little still fundamental rules. One of the main ones is that privacy is really a hardly achievable thing. Just becuase it&#039;s not there by design.&lt;/p&gt;&lt;/p&gt;

 
    </description>
</item>

</channel>
</rss>
