<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>eisber's blog &#187; coding</title>
	<atom:link href="http://www.eisber.net/blog/archives/category/coding/feed" rel="self" type="application/rss+xml" />
	<link>http://www.eisber.net/blog</link>
	<description>my personal-tech-project's journey log</description>
	<lastBuildDate>Fri, 27 May 2011 06:58:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Outlook 2010 Duplicate Item Remover (Free VBA)</title>
		<link>http://www.eisber.net/blog/archives/164</link>
		<comments>http://www.eisber.net/blog/archives/164#comments</comments>
		<pubDate>Sun, 02 Jan 2011 21:42:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[Exchange]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/?p=164</guid>
		<description><![CDATA[For those that don't want to pay 20$ for removing duplicate mail items. Create a new macro and add this code: Dim t As Items Dim i As Integer Dim arr As Collection Dim f As folder Dim parent As folder Dim target As folder Dim miLast As MailItem Dim mi As MailItem Set parent [...]]]></description>
			<content:encoded><![CDATA[<p>For those that don't want to pay 20$ for removing duplicate mail items.</p>
<p>Create a new macro and add this code:</p>
<p><code><br />
Dim t As Items<br />
Dim i As Integer<br />
Dim arr As Collection</p>
<p>Dim f As folder<br />
Dim parent As folder<br />
Dim target As folder</p>
<p>Dim miLast As MailItem<br />
Dim mi As MailItem</p>
<p>Set parent = Application.GetNamespace("MAPI").PickFolder<br />
Set target = Application.GetNamespace("MAPI").PickFolder</p>
<p>For Each f In parent.Folders<br />
    Set t = f.Items<br />
    t.Sort "[Subject]"</p>
<p>    i = 1<br />
    Set miLast = t(i)</p>
<p>    Set arr = New Collection</p>
<p>    While i < t.count<br />
        i = i + 1</p>
<p>        If TypeName(t(i)) = "MailItem" Then<br />
            Set mi = t(i)<br />
            If miLast.Subject = mi.Subject And miLast.Body = mi.Body And miLast.ReceivedTime = mi.ReceivedTime Then<br />
                arr.Add mi<br />
            Else<br />
                Set miLast = mi<br />
            End If<br />
        End If<br />
     Wend</p>
<p>     For Each mi In arr<br />
        mi.Move target<br />
     Next mi<br />
Next f<br />
</code></p>
<p>On my 1.4gHz Intel ULV for 7000 items it took approx. 5min.</p>
<p>The code asks for the folder to scan and then the target folder where the items should be moved to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/164/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CardTerminals.List()</title>
		<link>http://www.eisber.net/blog/archives/98</link>
		<comments>http://www.eisber.net/blog/archives/98#comments</comments>
		<pubDate>Wed, 25 Feb 2009 19:00:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/?p=98</guid>
		<description><![CDATA[Sample code to list all CardTerminalson your machine: import javax.smartcardio.*; public class main { public static void CardTerminalsList(String[] args) throws Exception { for(CardTerminal ct : TerminalFactory.getDefault().terminals().list()) { System.out.println("Name: '" + ct.getName() + "'"); } } }]]></description>
			<content:encoded><![CDATA[<p>Sample code to list all CardTerminalson your machine:</p>
<pre lang="java5">
import javax.smartcardio.*;</p>
<p>public class main<br />
{<br />
	public static void CardTerminalsList(String[] args) throws Exception<br />
	{<br />
		for(CardTerminal ct : TerminalFactory.getDefault().terminals().list())<br />
		{<br />
			System.out.println("Name: '" + ct.getName() + "'");<br />
		}<br />
	}<br />
}<br />
</java></p>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/98/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Driven Unit Tests fail during TFS 2008 Build&#8230;</title>
		<link>http://www.eisber.net/blog/archives/62</link>
		<comments>http://www.eisber.net/blog/archives/62#comments</comments>
		<pubDate>Wed, 11 Jun 2008 15:41:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[team foundation]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/?p=62</guid>
		<description><![CDATA[but not when executed in Visual Studio 2008. Error Message: The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library. Error details: An error has occurred while establishing a connection to the [...]]]></description>
			<content:encoded><![CDATA[<p>but not when executed in Visual Studio 2008.</p>
<p>Error Message:<br />
<font color="red">The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library.<br />
Error details: An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)</font></p>
<p><strong>Solution</strong>: Don't specify the connection string and the table in the constructor of the DataSource attribute, but follow <a href="http://msdn.microsoft.com/en-us/library/ms243192.aspx">this</a> (use the configuration section).</p>
<p>Make sure you specify Version 9.0.0 and not 8.0.0 like in the sample!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/62/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSL secured IIS-hosted WCF Application using OpenSSL</title>
		<link>http://www.eisber.net/blog/archives/58</link>
		<comments>http://www.eisber.net/blog/archives/58#comments</comments>
		<pubDate>Wed, 09 Apr 2008 23:07:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/archives/58</guid>
		<description><![CDATA[enviroment An ASP.NET Application invokes a WCF Application hosted in IIS using a WCF Client over SSL and authenticates itself with a client certificate. PKI must be created too. problem Just try it without this documentation... took as 2 1/2 days solution (All commands are in formatted and shall be executed on cmd.exe) Preparations Download [...]]]></description>
			<content:encoded><![CDATA[<p><strong>enviroment</strong> An ASP.NET Application invokes a WCF Application hosted in IIS using a WCF Client over SSL and authenticates itself with a client certificate. PKI must be created too.</p>
<p><strong>problem</strong> Just try it without this documentation... took as 2 1/2 days <img src='http://www.eisber.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>solution</strong></p>
<p>(All commands are in
<pre>formatted</pre>
<p> and shall be executed on cmd.exe)</p>
<p><u>Preparations</u></p>
<p>Download OpenSSL (<a href="http://www.slproweb.com/products/Win32OpenSSL.html">for Win32</a>)</p>
<pre>cd c:\openssl\bin</pre>
<pre>mkdir demoCA</pre>
<pre>echo 01 > demoCA\serial</pre>
<p>create a new and empty file named demoCA\index.txt</p>
<p><u>Certificate Authority (CA)</u></p>
<pre>
mkdir work
openssl genrsa -out work\CA\CA.key 1024
openssl req -new -key work\CA\CA.key -days 3650 -out work\CA\CA.csr -subj "/CN=choose.some.name"
openssl x509 -req -days 3650 -in work\CA\CA.csr -signkey work\CA\CA.key -out work\CA\CA.crt
</pre>
<p>Result: CA.key (private key of CA), CA.crt (public key / self-signed certifcate of CA)</p>
<p><u>Server Certificate for IIS</u></p>
<p>start IIS-Admin on web server<br />
Properties of WebSites/<WebSite hosting the WCF Application><br />
Set SSL Port to 443 (e.g.)<br />
-> Directory Security Tab<br />
-> Server Certificate Button<br />
-> Create new certficate<br />
-> Prepare request<br />
<b>IMPORTANT</b> the common name must equal the DNS name used to invoke the WCF service</p>
<p>Result: certreq.txt (Certificate Request)</p>
<pre>mkdir work\IIS</pre>
<p>Copy certreq.txt to work\IIS</p>
<pre>openssl ca -policy policy_anything -cert work\CA\CA.crt -in work\IIS\certreq.txt -keyfile work\CA\CA.key -days 3650 -out work\IIS\iis.cer -outdir work\IIS –batch</pre>
<p>Result: IIS.cer (signed server certificate)</p>
<p>start IIS-Admin on web server<br />
Properties of WebSites/<WebSite hosting the WCF Application><br />
-> Directory Security Tab<br />
-> Server Certificate Button<br />
-> Process pending Request<br />
-> select work\IIS\IIS.cer</p>
<p><u>Installation of CA on WCF Hosting Server and Client machine (the machine hosting the ASP.NET application)</u></p>
<p>Start mmc (goto Start\Run: mmc)<br />
Add Snap-In: Certificate\LocalMachine<br />
-> Certficates (LocalMachine) \ Trusted Root Certification Authorities<br />
-> Right click on Certificates \ All Tasks \ Import...<br />
-> Select work\CA\CA.crt</p>
<p><u>Create client certificates for ASP.NET application</u></p>
<pre>
Mkdir work\Client
openssl genrsa -out work\client\Client.key 1024
openssl req -new -key work\client\Client.key -out work\client\Client.csr -subj "/CN=Client"
openssl x509 -req -days 365 -CA work\CA\CA.crt -CAkey work\CA\CA.key -CAcreateserial -in work\client\Client.csr -out work\client\Client.crt
openssl pkcs12 -export -in work\client\Client.crt -inkey work\client\Client.key -out work\client\Client.p12
</pre>
<p>Start mmc (goto Start\Run: mmc) on ASP.NET hosting machine<br />
Add Snap-In: Certificate\LocalMachine<br />
-> Certficates (LocalMachine) \ Personal<br />
-> Right click on Certificates \ All Tasks \ Import...<br />
-> Select work\client\Client.p12</p>
<p><u>Configure IIS hosting WCF application to require SSL and Client Certificates</u></p>
<p>start IIS-Admin on WCF application hosting server<br />
Properties of WebSites/<WebSite hosting the WCF Application><br />
-> Directory Security Tab<br />
-> Secure Communication / Edit<br />
Select "Require Secure Channel"<br />
Select "Require Client certificates"</p>
<p>Optionally select "Enable certifications trust list" and create a new list holding the CA.crt if you only want to authenticate clients signed by your CA</p>
<p><u>Configure WCF Client</u></p>
<p>In your Web.config</p>
<pre>
&lt;system.serviceModel&gt;
&lt;bindings&gt;
&lt;basicHttpBinding&gt;
&lt;binding name="BasicHttpBinding" &gt;
&lt;security mode="Transport"&gt;
&lt;transport clientCredentialType="Certificate"/&gt;
&lt;/security&gt;
&lt;/binding&gt;
&lt;/basicHttpBinding&gt;
&lt;/bindings&gt;
&lt;behaviors&gt;
&lt;endpointBehaviors&gt;
&lt;behavior name="behavior"&gt;
    	&lt;clientCredentials supportInteractive="false"&gt;
      	&lt;clientCertificate findValue="Client"
                           x509FindType="FindBySubjectName"
                           storeLocation="LocalMachine"
                           storeName="My" /&gt;
&lt;/clientCredentials&gt;
&lt;/behavior&gt;
&lt;/endpointBehaviors&gt;
&lt;/behaviors&gt;
</pre>
<p><b>IMPORTANT:</b> Make sure your application does not run under NETWORK SERVICE account. Without tweaking your permissions of the LocalMachine store, you cannot access private keys - which you need when you want to authenticate to the server using client certificates.</p>
<p><u>Configure WCF Server</u></p>
<p>In your Web.config</p>
<pre>
&lt;binding name="basicSec"&gt;
&lt;security mode="Transport"&gt;
&lt;transport clientCredentialType="Certificate"/&gt;
&lt;/security&gt;
&lt;/binding&gt;

&lt;serviceBehaviors&gt;
&lt;behavior name="returnFaults"&gt;
&lt;serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/&gt;
&lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
&lt;/behavior&gt;
&lt;/serviceBehaviors&gt;
</pre>
<p>Some explaination: although the complete SSL handshake and the authentication is done by IIS, the WCF settings still need to match those of IIS. One reason is that the protocol differs (e.g. http vs. https).<br />
You cannot enable httpGetEnabled and httpsGetEnabled at the same time.<br />
You can using BasicHttpBinding - SSL is just the transport layer.</p>
<p><u>Some debugging tips</u></p>
<p>Get <a href="http://www.microsoft.com/downloads/details.aspx?familyid=cabea1d0-5a10-41bc-83d4-06c814265282&displaylang=en">SSLDiag</a> for validating you IIS SSL setup</p>
<p>To decrypt SSL traffic using Wireshark:</p>
<p>Start mmc (goto Start\Run: mmc) on WCF application hosting machine<br />
Add Snap-In: Certificate\LocalMachine<br />
-> Certficates (LocalMachine) \ Personal<br />
-> Right click on Certificates \ All Tasks \ Export...<br />
-> Select work\IIS\IIS.pfx</p>
<pre>openssl pkcs12 -in vde\iis\iis.pfx -out work\iis\iis.pem –nodes</pre>
<p>Start Wireshark</p>
<p>Goto Edit\Preferences\Protocols\SSL: RSA Keys: <ip of server>,443,http,c:\openssl\bin\work\IIS\iis.pem<br />
Goto Capture \ Options \ Filter: "Port 443"</p>
<p>Happy capturing!</p>
<p>WCF Tracing might be helpful too:</p>
<pre>
  &lt;system.diagnostics&gt;
      &lt;sources&gt;
            &lt;source name="System.ServiceModel"
                    switchValue="All"
                    propagateActivity="true"&gt;
            &lt;listeners&gt;
               &lt;add name="traceListener"
                   type="System.Diagnostics.XmlWriterTraceListener"
                   initializeData= "c:\temp\Traces.svclog" /&gt;
            &lt;/listeners&gt;
         &lt;/source&gt;
      &lt;/sources&gt;
   &lt;/system.diagnostics&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/58/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008: Setup Project Targeting .NET Framework 2.0</title>
		<link>http://www.eisber.net/blog/archives/53</link>
		<comments>http://www.eisber.net/blog/archives/53#comments</comments>
		<pubDate>Fri, 21 Dec 2007 15:42:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/archives/53</guid>
		<description><![CDATA[environment: Visual Studio 2008, .NET/C# Project Targeting Framework 2.0, Standard Setup Project problem: Setup always requests framework 3.5 solution All deployed projects must target framework 2.0 Prerequistes of setup project must be 2.0 (not 3.5). ATTENTION I couldn't change this separately for Release build and had to this manually using notepad/gvim Launch condition must be [...]]]></description>
			<content:encoded><![CDATA[<p><strong>environment:</strong> Visual Studio 2008, .NET/C# Project Targeting Framework 2.0, Standard Setup Project</p>
<p><strong>problem:</strong> Setup always requests framework 3.5</p>
<p><strong>solution</strong> </p>
<ul>
<li>All deployed projects must target framework 2.0</li>
<li>Prerequistes of setup project must be 2.0 (not 3.5). <b>ATTENTION</b> I couldn't change this separately for Release build and had to this manually using notepad/gvim </li>
<li>Launch condition must be changed to 2.0 (I had to clean and rebuild a couple of times until it let me select 2.0)</li>
</ul>
<p><strong>links</strong></p>
<p><a href="http://www.codeproject.com/KB/dotnet/targetnet2fromvs2008.aspx?print=true">Same problem</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/53/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008: Release vs. Debug</title>
		<link>http://www.eisber.net/blog/archives/52</link>
		<comments>http://www.eisber.net/blog/archives/52#comments</comments>
		<pubDate>Tue, 11 Dec 2007 13:04:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/archives/52</guid>
		<description><![CDATA[Some observations: String pooling seems to be enabled in Debug (although not selected) __FILE__ is expanded with relative path in release build, but contains absolute paths in debug mode. The "use full paths" option was set to "no" in Release and Debug]]></description>
			<content:encoded><![CDATA[<p>Some observations:</p>
<ul>
<li>String pooling seems to be enabled in Debug (although not selected)</li>
<li>__FILE__ is expanded with relative path in release build, but contains absolute paths in debug mode. The "use full paths" option was set to "no" in Release and Debug</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/52/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gSoap and MapPoint</title>
		<link>http://www.eisber.net/blog/archives/50</link>
		<comments>http://www.eisber.net/blog/archives/50#comments</comments>
		<pubDate>Fri, 17 Aug 2007 07:26:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/archives/50</guid>
		<description><![CDATA[environment linux, Qt, c, gsoap, Microsoft MapPoint problem I want an IRC bot which can calculate distances between users and display the local time of a user solution Modifications to karmabot, which is written in Qt. The MapPoint WebService comes in handy. Although gSoap doesn't like MapPoint straight OOTB. Thus you need to remove "opaque=" [...]]]></description>
			<content:encoded><![CDATA[<p><strong>environment</strong> linux, Qt, c, <a href="http://www.cs.fsu.edu/~engelen/soap.html">gsoap</a>, <a href="http://www.microsoft.com/mappoint/products/webservice/default.mspx">Microsoft MapPoint</a></p>
<p><strong>problem</strong> I want an IRC bot which can calculate distances between users and display the local time of a user</p>
<p><strong>solution</strong> Modifications to karmabot, which is written in Qt. The MapPoint WebService comes in handy. Although gSoap doesn't like MapPoint straight OOTB. Thus you need to remove "opaque=" from </p>
<pre>
gsoap-linux-2.7/plugin/httpda.c:243:      sprintf(soap->gt;tmpbuf, "Digest realm=\\"%s\\", username=\\"%s\\", nonce=\\"%s\\", uri=\\"%s\\", qop=\\"%s\\", nc=%s, cnonce=\\"%s\\", response=\\"%s\\", opaque=\\"%s\\"", soap->gt;authrealm, soap->gt;userid, data->gt;nonce, soap->gt;path, qop, ncount, cnonce, response, data->gt;opaque);
gsoap-linux-2.7/plugin/httpda.c:245:      sprintf(soap->gt;tmpbuf, "Digest realm=\\"%s\\", username=\\"%s\\", nonce=\\"%s\\", uri=\\"%s\\", response=\\"%s\\", opaque=\\"%s\\"", soap->gt;authrealm, soap->gt;userid, data->gt;nonce, soap->gt;path, response, data->gt;opaque);
</pre>
<p>thanks to this <a href="http://microsoft-programming.hostweb.com/MissingPage.aspx?aspxerrorpath=/TopicMessages.aspx">posting</a>.<br />
You need to use httpda.h for digest authentication. Add gsoap-linux-2.7/plugin/httpda.c and gsoap-linux-2.7/plugin/md5evp.c and link against openssl (-lssl). That should do the trick. Because it cost me some time, I'll paste code for a find request:</p>
<pre>
char* arr[] = { "PopulatedPlace" };
struct mpt__ArrayOfString EntityTypeNames = {1, arr };

struct mpt__FindSpecification spec = {
        "MapPoint.World",
        "Vienna, Austria",
        &EntityTypeNames,
        NULL };

struct _mpt__Find req = { &spec };
if(soap_call___ns2__Find(gSoap, NULL, NULL, &req, resp) != SOAP_OK)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/50/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Re-format #defines into C# enums</title>
		<link>http://www.eisber.net/blog/archives/47</link>
		<comments>http://www.eisber.net/blog/archives/47#comments</comments>
		<pubDate>Sun, 12 Aug 2007 06:01:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/archives/47</guid>
		<description><![CDATA[environment msdn documentation, gvim, C# problem I want legacy C defines like this to be represented by a nice C# enum. solution Copy the table from msdn containing the #define names, values and comments to gvim Use this regular expression %s#\\v(\\u)([A-Z_]+) (0x\\d+)L (.*)#^M///&#60;summary&#62;^M/// \\4^M///&#60;/summary&#62;^M\\1\\L\\2 = \\3,# Paste into your C# file Notes \v sets vim [...]]]></description>
			<content:encoded><![CDATA[<p><strong>environment</strong> <a href="http://msdn.microsoft.com/library/">msdn documentation</a>, <a href="http://www.vim.org">gvim</a>, C#</p>
<p><strong>problem</strong> I want legacy C defines like <a href="http://msdn2.microsoft.com/en-us/library/bb166205(VS.80).aspx">this</a> to be represented by a nice C# enum.</p>
<p><strong>solution</strong></p>
<ol>
<li> Copy the table from msdn containing the #define names, values and comments to <a href="http://www.vim.org">gvim</a> </li>
<li> Use this regular expression
<pre>%s#\\v(\\u)([A-Z_]+) (0x\\d+)L (.*)#^M///&lt;summary&gt;^M/// \\4^M///&lt;/summary&gt;^M\\1\\L\\2 = \\3,#</pre>
</li>
<li> Paste into your C# file </li>
</ol>
<p><strong>Notes</strong></p>
<ul>
<li> \v sets vim to <b>very magic</b> mode - fear - so the () don't have to be escaped. </li>
<li>  \u matches uppercase characters. </li>
<li>  ^M is a new line - on Windows use "Strg+Q Enter" to get it. </li>
<li>  \L\2 changes the contents of the succedding back reference to lower case. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/47/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overloading new, delete in C++</title>
		<link>http://www.eisber.net/blog/archives/46</link>
		<comments>http://www.eisber.net/blog/archives/46#comments</comments>
		<pubDate>Sat, 07 Jul 2007 14:39:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/archives/46</guid>
		<description><![CDATA[environment C++ with Visual Studio 2005 problem Override new operator including additional parameter. Override delete operator and check if the correct delete operator is called when invoked on a base class. solution class A { }; class B : public A { public: void *operator new( size_t stAllocateBlock, char chInit ) { printf("B.new called\n"); return [...]]]></description>
			<content:encoded><![CDATA[<p><strong>environment</strong> C++ with Visual Studio 2005</p>
<p><strong>problem</strong> Override new operator including additional parameter. Override delete operator and check if the correct delete operator is called when invoked on a base class.</p>
<p><strong>solution</strong></p>
<p><code><br />
class A<br />
{<br />
};</p>
<p>class B : public A<br />
{<br />
public:<br />
	  void *operator new( size_t stAllocateBlock, char chInit )<br />
	  {<br />
		  printf("B.new called\n");<br />
		  return malloc(stAllocateBlock);<br />
	  }</p>
<p>	  void operator delete( void * p, size_t)<br />
	  {<br />
		  printf("B.delete called\n");<br />
		  free(p);<br />
	  }<br />
};<br />
</code></p>
<p>main:<br />
<code><br />
	A* a = new('a') B;</p>
<p>	delete a;<br />
</code></p>
<p>Well, B::delete is <b>not</b> invoked. </p>
<p><strong>links</strong></p>
<ul>
<li><a href="http://msdn2.microsoft.com/en-us/library/t48aek43(VS.71).aspx">new operator</a></li>
<li><a href="http://msdn2.microsoft.com/en-us/library/248aa748(VS.71).aspx">delete operator</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/46/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic AssemblyInfo generation during Team Build</title>
		<link>http://www.eisber.net/blog/archives/38</link>
		<comments>http://www.eisber.net/blog/archives/38#comments</comments>
		<pubDate>Wed, 16 May 2007 15:18:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[team foundation]]></category>

		<guid isPermaLink="false">http://www.eisber.net/blog/?p=38</guid>
		<description><![CDATA[environment Team Foundation Server, msbuild, each projects is located below the solution file problem Provide team build number and flavor (debug, release) for compiled assemblies from multiple projects in a solution solution Edit your .csproj files (make sure you do a "Checkout for edit") and add ... &#60;Import Project="..\\AssemblyInfo.proj" /&#62; &#60;/Project&#62; The AssemblyInfo.proj should be [...]]]></description>
			<content:encoded><![CDATA[<p><strong>environment</strong> Team Foundation Server, msbuild, each projects is located below the solution file</p>
<p><strong>problem</strong> Provide team build number and flavor (debug, release) for compiled assemblies from multiple projects in a solution</p>
<p><strong>solution</strong> Edit your .csproj files (make sure you do a "Checkout for edit") and add</p>
<pre>
  ...
  &lt;Import Project="..\\AssemblyInfo.proj" /&gt;
&lt;/Project&gt;
</pre>
<p>The AssemblyInfo.proj should be placed next to the .sln file:</p>
<pre>
&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  &lt;Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/&gt;

  &lt;Target Name="BeforeBuild"&gt;
    &lt;Attrib Files="Properties\AssemblyInfo.cs" Normal="true"/&gt;

    &lt;!-- Build := Days since StartDate; Revision := 65534 / (24*60*60) * seconds since midnight <img src='http://www.eisber.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  --&gt;
    &lt;Version BuildType="Automatic" RevisionType="Automatic" StartDate="2007/01/01" Major="1" Minor="0"&gt;
      &lt;Output TaskParameter="Major" PropertyName="Major" /&gt;
      &lt;Output TaskParameter="Minor" PropertyName="Minor" /&gt;
      &lt;Output TaskParameter="Build" PropertyName="Build" /&gt;
      &lt;Output TaskParameter="Revision" PropertyName="Revision" /&gt;
    &lt;/Version&gt;

    &lt;AssemblyInfo CodeLanguage="CS"
        OutputFile="Properties\AssemblyInfo.cs"
        AssemblyConfiguration="$(Configuration)"
        AssemblyCompany="Company Name"
        AssemblyProduct="$(AssemblyName) $(Configuration) $(BuildNumber)"
        AssemblyCopyright="Copyright Company Name 2007"
        AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)"
      	AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)" /&gt;

    &lt;Attrib Files="Properties\AssemblyInfo.cs" ReadOnly="true"/&gt;
  &lt;/Target&gt;
&lt;/Project&gt;
</pre>
<p>You need to install <a href="http://msbuildtasks.tigris.org/">msbuildtasks</a> on your local machine AND the build server. Apart from the Team Build revision, you'll get another auto-generated assembly revision.</p>
<p><strong>debugging</strong> Unload, Reload the project after every change to AssemblyInfo.proj</p>
<p><strong>links</strong> <a href="http://blogs.msdn.com/jomo_fisher/archive/2004/09/16/230631.aspx">MSBuild infos</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.eisber.net/blog/archives/38/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

