tag:blogger.com,1999:blog-110490852024-03-13T12:49:57.019+02:00Alex PinskerAgito obviam astrumAlex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.comBlogger155125tag:blogger.com,1999:blog-11049085.post-43486855598334186602019-12-12T03:15:00.000+02:002019-12-12T03:15:07.179+02:00Handling PubSub updates from multiple clients in pub-sub scenario with Reactive Extentions<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "times new roman"; font-size: 85%;">
<table border="1" style="width: 100%px;"><tbody>
<tr><td>A typical pub-sub scenario is subscribing to handle requests from multiple clients and then handling client updates in a buffered way. Let's see how this could be done using Reactive Extensions.<br />
<br />
To make this scenario more concrete - imagine your server receives a stream of frequent updates on number of stocks (e.g. IBM_1...IBM_10 in example below). We want to process the most recent price per stock and display it to a trader at most once a second.<br />
<br />
All we would need - is to use ReactivePubSubHandler given below, providing "selector" to identify a pub-sub client (i.e. what stock was updated) and an action to be implemented (e.g. update price display) - say once in a second.</td></tr>
</tbody></table>
</span><br />
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<span style="font-family: "times new roman"; font-size: 85%;">
</span>
<br />
<table border="1" style="width: 100%px;"><tbody>
<tr><td><span style="color: blue; font-family: "consolas"; font-size: 10pt;">using</span><span style="font-family: "consolas"; font-size: 10pt;"> System;</span><br />
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10pt;">using</span><span style="font-family: "consolas"; font-size: 10pt;"> System.Reactive.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10pt;">using</span><span style="font-family: "consolas"; font-size: 10pt;"> System.Reactive.Subjects;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10pt;">using</span><span style="font-family: "consolas"; font-size: 10pt;"> System.Threading;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "consolas"; font-size: 10pt;">namespace</span><span style="font-family: "consolas"; font-size: 10pt;"> ReactivePubSub<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">class</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Program</span><span style="font-family: "consolas"; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">class</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">ClientUpdate</span><span style="font-family: "consolas"; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">public</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">string</span><span style="font-family: "consolas"; font-size: 10pt;"> StockName { </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">get</span><span style="font-family: "consolas"; font-size: 10pt;">; </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">set</span><span style="font-family: "consolas"; font-size: 10pt;">; }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">public</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">float</span><span style="font-family: "consolas"; font-size: 10pt;"> Price { </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">get</span><span style="font-family: "consolas"; font-size: 10pt;">; </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">set</span><span style="font-family: "consolas"; font-size: 10pt;">; }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">static</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">void</span><span style="font-family: "consolas"; font-size: 10pt;"> Main()<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">var</span><span style="font-family: "consolas"; font-size: 10pt;"> sampledAction = </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">new</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">ReactivePubSubHandler</span><span style="font-family: "consolas"; font-size: 10pt;"><</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">ClientUpdate</span><span style="font-family: "consolas"; font-size: 10pt;">, </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">string</span><span style="font-family: "consolas"; font-size: 10pt;">>(1000, _=>_.StockName, _ => </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Console</span><span style="font-family: "consolas"; font-size: 10pt;">.WriteLine(<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #a31515; font-family: "consolas"; font-size: 10pt;">$"</span><span style="font-family: "consolas"; font-size: 10pt;">{</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">DateTime</span><span style="font-family: "consolas"; font-size: 10pt;">.Now}</span><span style="color: #a31515; font-family: "consolas"; font-size: 10pt;"> Processed update for client #</span><span style="font-family: "consolas"; font-size: 10pt;">{_.StockName}</span><span style="color: #a31515; font-family: "consolas"; font-size: 10pt;"> Price=</span><span style="font-family: "consolas"; font-size: 10pt;">{_.Price}</span><span style="color: #a31515; font-family: "consolas"; font-size: 10pt;">"</span><span style="font-family: "consolas"; font-size: 10pt;">));<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">var</span><span style="font-family: "consolas"; font-size: 10pt;"> rndStockName = </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">new</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Random</span><span style="font-family: "consolas"; font-size: 10pt;">();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">for</span><span style="font-family: "consolas"; font-size: 10pt;"> (</span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> i = 0; i < 1000; i++)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">var</span><span style="font-family: "consolas"; font-size: 10pt;"> clientUpdate = </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">new</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">ClientUpdate</span><span style="font-family: "consolas"; font-size: 10pt;">()<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> StockName = </span><span style="color: #a31515; font-family: "consolas"; font-size: 10pt;">"IBM_"</span><span style="font-family: "consolas"; font-size: 10pt;"> + rndStockName.Next(0, 10),<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> Price = (</span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">float</span><span style="font-family: "consolas"; font-size: 10pt;">) (rndStockName.Next(10000, 11000) / 100.0)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> };<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> sampledAction.OnClientRequest(clientUpdate);<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Thread</span><span style="font-family: "consolas"; font-size: 10pt;">.Sleep(200);<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">public</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">class</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">ReactivePubSubHandler</span><span style="font-family: "consolas"; font-size: 10pt;"><</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientData</span><span style="font-family: "consolas"; font-size: 10pt;">, </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientDataKey</span><span style="font-family: "consolas"; font-size: 10pt;">><o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">public</span><span style="font-family: "consolas"; font-size: 10pt;"> ReactivePubSubHandler(</span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">int</span><span style="font-family: "consolas"; font-size: 10pt;"> sampleIntervalMs, </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Func</span><span style="font-family: "consolas"; font-size: 10pt;"><</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientData</span><span style="font-family: "consolas"; font-size: 10pt;">, </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientDataKey</span><span style="font-family: "consolas"; font-size: 10pt;">> pubSubTopicSelector, </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Action</span><span style="font-family: "consolas"; font-size: 10pt;"><</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientData</span><span style="font-family: "consolas"; font-size: 10pt;">> pubSubAction)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">var</span><span style="font-family: "consolas"; font-size: 10pt;"> sampledActionsSubscription = _clientsSubscription.GroupBy(pubSubTopicSelector)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> .Select(x => x.Sample(</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TimeSpan</span><span style="font-family: "consolas"; font-size: 10pt;">.FromMilliseconds(sampleIntervalMs))).SelectMany(x => x);<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> sampledActionsSubscription.Subscribe(pubSubAction);<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">public</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">void</span><span style="font-family: "consolas"; font-size: 10pt;"> OnClientRequest(</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientData</span><span style="font-family: "consolas"; font-size: 10pt;"> clientData)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> _clientsSubscription.OnNext(clientData);<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">private</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">readonly</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Subject</span><span style="font-family: "consolas"; font-size: 10pt;"><</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientData</span><span style="font-family: "consolas"; font-size: 10pt;">> _clientsSubscription = </span><span style="color: blue; font-family: "consolas"; font-size: 10pt;">new</span><span style="font-family: "consolas"; font-size: 10pt;"> </span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">Subject</span><span style="font-family: "consolas"; font-size: 10pt;"><</span><span style="color: #2b91af; font-family: "consolas"; font-size: 10pt;">TClientData</span><span style="font-family: "consolas"; font-size: 10pt;">>();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;">}</span></div>
</td></tr>
</tbody></table>
</div>
Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-89513363638600868402018-11-07T04:19:00.000+02:002018-12-22T08:11:13.662+02:00Compiling QuantLib with Visual Studio 2017 and boost 1.68<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">This post is a self-reminder.</span><br />
<div style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Once QuantLib binaries are created as described below - you should reference .NET assembly (NQuantLib.dll) and have native .Dll (NQuantLibc.dll) to be added as a Context file with "Copy always" attribute in "Copy to Output directory".<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; margin: 22.5pt 0cm 0.0001pt;">
<b style="color: #222222; font-family: "times new roman", serif; font-size: 12pt;"><span style="color: #333333; font-family: "arial" , sans-serif;">Compiling QuantLib for </span></b><span style="color: #333333; font-family: "arial" , sans-serif;"><b>Visual Studio 2017</b></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">1.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"> Make sure VS 2017 setup installed with Windows 8.1 SDK:</span><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"></span><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><u></u><u></u></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-yzdDjk9sREw/XB3VbUF4jpI/AAAAAAAAMqk/O2c-gbeMo64FGhH1mbkjN8VK_b42xceiACLcBGAs/s1600/vs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="635" data-original-width="1252" height="323" src="https://4.bp.blogspot.com/-yzdDjk9sREw/XB3VbUF4jpI/AAAAAAAAMqk/O2c-gbeMo64FGhH1mbkjN8VK_b42xceiACLcBGAs/s640/vs.png" width="640" /></a></div>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span></div>
<div style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">2.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"> Download pre-compiled boost library for VC 14 (x64 version) from <a data-saferedirecturl="https://www.google.com/url?q=https://sourceforge.net/projects/boost/files/boost-binaries/1.68.0/&source=gmail&ust=1541628313432000&usg=AFQjCNHXqS-tfmf3K7jyBI5nxj0pb0gm0A" href="https://sourceforge.net/projects/boost/files/boost-binaries/1.68.0/" style="color: #1155cc;" target="_blank">https://sourceforge.net/<wbr></wbr>projects/boost/files/boost-<wbr></wbr>binaries/1.68.0/</a><br /> Install boost binaries boost_1_68_0-msvc-<strong>14.<wbr></wbr>1</strong>-64.exe to C:\Boost\boost_1_68_0<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">3.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Add C:\Boost\boost_current.<wbr></wbr>props file (e.g. download from <a data-saferedirecturl="https://www.google.com/url?q=https://github.com/Studiofreya/boost-build-scripts/&source=gmail&ust=1541628313432000&usg=AFQjCNEow1fbLj2TUuG-5edYd75XdHKOtQ" href="https://github.com/Studiofreya/boost-build-scripts/" style="color: #1155cc;" target="_blank">https://github.com/<wbr></wbr>Studiofreya/boost-build-<wbr></wbr>scripts/</a>), e.g.:<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; margin: 7.5pt 0cm 0.0001pt;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-UzE36t86p3M/W-JJKn8TfgI/AAAAAAAAMA0/VaskNZpT-PkM1LY6qLdKPYlNbEX2Gtl8ACLcBGAs/s1600/pic1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="426" data-original-width="1100" height="246" src="https://3.bp.blogspot.com/-UzE36t86p3M/W-JJKn8TfgI/AAAAAAAAMA0/VaskNZpT-PkM1LY6qLdKPYlNbEX2Gtl8ACLcBGAs/s640/pic1.png" width="640" /></a></div>
<br /></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">4.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Download SWIG: <a data-saferedirecturl="https://www.google.com/url?q=http://www.swig.org/download.html&source=gmail&ust=1541628313432000&usg=AFQjCNGVgZWXVgF_a09QXhTYnsIcV5dvdA" href="http://www.swig.org/download.html" style="color: #1155cc;" target="_blank">http://www.swig.org/download.<wbr></wbr>html</a><br /> <a data-saferedirecturl="https://www.google.com/url?q=http://www.swig.org/Doc1.3/Windows.html%23Windows_examples&source=gmail&ust=1541628313432000&usg=AFQjCNEtFWZ1LtrKvICr3GsX2Vet0fMNJw" href="http://www.swig.org/Doc1.3/Windows.html#Windows_examples" style="color: #1155cc;" target="_blank">http://www.swig.org/Doc1.3/<wbr></wbr>Windows.html#Windows_examples</a><u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">5.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Unpack SWIG to C:\SWIG\swigwin-3.0.12<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">6.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Add C:\SWIG\swigwin-3.0.12 to system PATH environment variable<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">7.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Unpack QuantLib to C:\QuantLib\QuantLib-1.13<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">8.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Unpack QuantLib-SWIG to C:\QuantLib\QuantLib-SWIG-1.13<u></u><u></u></span></div>
<div style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 12pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">9.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Modify C:\QuantLib\QuantLib-1.13\<wbr></wbr>QuantLib.props by including the following section:<u></u><u></u></span></div>
</div>
<div style="font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<b><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"> </span></b><br />
<div class="separator" style="clear: both; text-align: center;">
<b><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Nw0cEEm9VPnh38jFgW_EwTQSXh0qOw4CjlyyqfG3s8ZfMH4ckBUsyod0AILzJGK_1phqEusPzNTPssj2AcdhZxi3gmnxX85xM6PEUdxtYa8X23qknPcyrasPTYvezETX0fTr3A/s1600/pic9.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="367" data-original-width="1050" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Nw0cEEm9VPnh38jFgW_EwTQSXh0qOw4CjlyyqfG3s8ZfMH4ckBUsyod0AILzJGK_1phqEusPzNTPssj2AcdhZxi3gmnxX85xM6PEUdxtYa8X23qknPcyrasPTYvezETX0fTr3A/s640/pic9.png" width="640" /></a></span></b></div>
<b><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"> <u></u><u></u></span></b></div>
<div style="font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<b><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"> </span></b></div>
<br />
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">10.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Enable (uncomment) QL_ENABLE_THREAD_SAFE_<wbr></wbr>OBSERVER_PATTERN in ql\userconfig.hpp file<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">11.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Build QuantLib.sln<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">12.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Run the swig.cmd file located in QuantLib-SWIG\CSharp folder<u></u><u></u></span></div>
<div style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">13.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Modify C:\QuantLib\QuantLib-<strong>SWIG</strong>-1.<wbr></wbr>13\CSharp\QuantLib.props by including the following section:<u></u><u></u></span></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-z8FcMhQQlw0/W-JKNG8lHYI/AAAAAAAAMBE/F2R5EyAdfA8pJq9-4fnxDoy8T7wMfMh8wCEwYBhgL/s1600/pic13.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="405" data-original-width="1098" height="236" src="https://4.bp.blogspot.com/-z8FcMhQQlw0/W-JKNG8lHYI/AAAAAAAAMBE/F2R5EyAdfA8pJq9-4fnxDoy8T7wMfMh8wCEwYBhgL/s640/pic13.png" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<br />
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;"><br /></span>
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">14.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Build C:\QuantLib\QuantLib-SWIG-1.<wbr></wbr>13\CSharp\QuantLib.sln<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">15.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">Use the following residuals:<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "symbol"; font-size: 10pt;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">C:\QuantLib\QuantLib-SWIG-1.<wbr></wbr>13\CSharp\cpp\bin\vc141\x64\<wbr></wbr>Debug\NQuantLibc.dll<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "symbol"; font-size: 10pt;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">C:\QuantLib\QuantLib-SWIG-1.<wbr></wbr>13\CSharp\cpp\bin\vc141\x64\<wbr></wbr>Debug\QuantlibWrapper.pdb<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "symbol"; font-size: 10pt;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">C:\QuantLib\QuantLib-SWIG-1.<wbr></wbr>13\CSharp\csharp\bin\vc141\<wbr></wbr>x64\Debug\NQuantLib.dll<u></u><u></u></span></div>
<div class="MsoNormal" style="background-color: white; color: #222222; font-family: "Times New Roman", serif; font-size: 12pt; margin: 7.5pt 0cm 0.0001pt;">
<u></u><span style="color: #333333; font-family: "symbol"; font-size: 10pt;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><u></u><span style="color: #333333; font-family: "arial" , sans-serif; font-size: 10.5pt;">C:\QuantLib\QuantLib-SWIG-1.<wbr></wbr>13\CSharp\csharp\bin\vc141\<wbr></wbr>x64\Debug\NQuantLib.pdb</span></div>
<span style="font-family: "times new roman"; font-size: 85%;">
</span></div>
Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-16801864552987035222012-12-24T00:07:00.000+02:002012-12-24T00:08:17.402+02:00How to prevent collision of Visual Assist and ReSharper in Visual Studio<p>VassistX→Options→Projects→File Handling→Extensions to ignore: <br />.ctc;.config;.cs;.config;.xml;</p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-75255787512790406002012-05-07T22:53:00.001+03:002012-05-07T22:58:46.253+03:00GC KeepAlive method–what it really does<p>Quite useful, I was missing this corner.. <br />Below is quote from documentation as it is provided by code author.</p> <table border="1" cellspacing="0" cellpadding="2" width="90%"><tbody> <tr> <td valign="top" width="90%"> <pre class="csharpcode"><span class="rem">// This method DOES NOT DO ANYTHING in and of itself. It's used to</span><br /><span class="rem">// prevent a finalizable object from losing any outstanding references </span><br /><span class="rem">// a touch too early. The JIT is very aggressive about keeping an</span><br /><span class="rem">// object's lifetime to as small a window as possible, to the point</span><br /><span class="rem">// where a 'this' pointer isn't considered live in an instance method</span><br /><span class="rem">// unless you read a value from the instance. So for finalizable </span><br /><span class="rem">// objects that store a handle or pointer and provide a finalizer that</span><br /><span class="rem">// cleans them up, this can cause subtle ----s with the finalizer </span><br /><span class="rem">// thread. This isn't just about handles - it can happen with just </span><br /><span class="rem">// about any finalizable resource.</span><br /><span class="rem">// </span><br /><span class="rem">// Users should insert a call to this method near the end of a</span><br /><span class="rem">// method where they must keep an object alive for the duration of that</span><br /><span class="rem">// method, up until this method is called. Here is an example:</span><br /><span class="rem">// </span><br /><span class="rem">// "...all you really need is one object with a Finalize method, and a</span><br /><span class="rem">// second object with a Close/Dispose/Done method. Such as the following </span><br /><span class="rem">// contrived example: </span><br /><span class="rem">//</span><br /><span class="rem">// class Foo { </span><br /><span class="rem">// Stream stream = ...;</span><br /><span class="rem">// protected void Finalize() { stream.Close(); }</span><br /><span class="rem">// void Problem() { stream.MethodThatSpansGCs(); }</span><br /><span class="rem">// static void Main() { new Foo().Problem(); } </span><br /><span class="rem">// }</span><br /><span class="rem">// </span><br /><span class="rem">// </span><br /><span class="rem">// In this code, Foo will be finalized in the middle of</span><br /><span class="rem">// stream.MethodThatSpansGCs, thus closing a stream still in use." </span><br /><span class="rem">//</span><br /><span class="rem">// If we insert a call to GC.KeepAlive(this) at the end of Problem(), then</span><br /><span class="rem">// Foo doesn't get finalized and the stream says open.</span><br />[MethodImplAttribute(MethodImplOptions.InternalCall)] <br />[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]<br /><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">extern</span> <span class="kwrd">void</span> KeepAlive(Object obj); </pre><br /> <style type="text/css"><br />.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }</style></td><br /> </tr><br /> </tbody></table> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-37659986129237163742012-04-08T22:39:00.001+03:002012-04-08T22:39:59.060+03:00Get user name in SQL<p>… without domain:</p> <p>SELECT PARSENAME(REPLACE(ORIGINAL_LOGIN(), '\', '.'), 1)</p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-78093238259708990542012-04-08T22:32:00.001+03:002012-04-08T22:32:23.916+03:00Currencies having stocks quoted in cents<p>I think this is exhaustive list for now:</p> <table border="0" cellspacing="0" cellpadding="2" width="251"><tbody> <tr> <td valign="top" width="77">BWp</td> <td valign="top" width="172">Botswana Pula</td> </tr> <tr> <td valign="top" width="77">GBp</td> <td valign="top" width="172">British Pound</td> </tr> <tr> <td valign="top" width="77">ILs</td> <td valign="top" width="172">Israeli Shekel</td> </tr> <tr> <td valign="top" width="77">KWd</td> <td valign="top" width="172">Kuwaiti Dinar</td> </tr> <tr> <td valign="top" width="77">MWk</td> <td valign="top" width="172">Malawian Kwacha</td> </tr> <tr> <td valign="top" width="77">SZl</td> <td valign="top" width="172">Swaziland Lilangeni</td> </tr> <tr> <td valign="top" width="77">ZAr</td> <td valign="top" width="172">South African Rand</td> </tr> </tbody></table> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-27864666336054823352012-04-08T22:25:00.001+03:002012-04-08T22:25:42.527+03:00“267: The directory name is invalid” error when running via runas command<p>Should be one of:</p> <ul> <li>User Access Control settings prevent you from executing a program</li> <li>Directory has no access for user which is specified in runas</li> <li>You shared your folder and that reset user rights on the folder – <br />go to Properties->Security and add runas user..</li> </ul> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-68619551186261475442012-01-02T00:43:00.000+02:002012-06-21T14:57:31.644+03:00SQL–how to find nth row / nth order element<div dir="ltr" style="text-align: left;" trbidi="on">
Example below is self-explanatory – you should assign rank by desirable criteria and then just group by your categories (product id and name is sample below), selecting only entries of certain rank. In sample below you would select all entries with second biggest ID per category.<br />
<br />
<pre class="csharpcode"><span class="kwrd">CREATE</span> <span class="kwrd">TABLE</span> #test ( id <span class="kwrd">int</span>, ProductName <span class="kwrd">VARCHAR</span>(25) )
insert <span class="kwrd">into</span> #test
<span class="kwrd">select</span> 1, <span class="str">'Apple'</span> <span class="kwrd">union</span> <span class="kwrd">all</span>
<span class="kwrd">select</span> 2, <span class="str">'Apple'</span> <span class="kwrd">union</span> <span class="kwrd">all</span>
<span class="kwrd">select</span> 5, <span class="str">'Apple'</span> <span class="kwrd">union</span> <span class="kwrd">all</span>
<span class="kwrd">select</span> 3, <span class="str">'Orange'</span> <span class="kwrd">union</span> <span class="kwrd">all</span>
<span class="kwrd">select</span> 4, <span class="str">'Orange'</span> <span class="kwrd">union</span> <span class="kwrd">all</span>
<span class="kwrd">select</span> 10, <span class="str">'Orange'</span></pre>
<pre class="csharpcode"><span class="str"></span><span class="kwrd">SELECT</span> * <span class="kwrd">FROM</span> #test
<span class="kwrd">SELECT</span> maxID <span class="kwrd">FROM</span>
(
<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>(id) <span class="kwrd">AS</span> maxID, ProductName <span class="kwrd">AS</span> nn, RANK() <span class="kwrd">OVER</span> (PARTITION <span class="kwrd">BY</span> ProductName <span class="kwrd">ORDER</span> <span class="kwrd">BY</span> id <span class="kwrd">DESC</span>) <span class="kwrd">AS</span> MyRank
<span class="kwrd">FROM</span> #test
<span class="kwrd">GROUP</span> <span class="kwrd">BY</span> id, ProductName
) tmp
<span class="kwrd">WHERE</span> tmp.MyRank = 2</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style></div>Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-410274968654760582012-01-02T00:41:00.001+02:002012-01-02T00:41:54.488+02:00Get current username in SQL<p>SELECT PARSENAME(REPLACE(ORIGINAL_LOGIN(), '\', '.'), 1)</p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-9390839944786742622011-10-11T23:52:00.001+02:002011-10-11T23:52:39.276+02:00What is a size of DateTime type in C#?What is a size of DateTime type in C#? - A trivial question, unexcitingly facing few obstacles. Self-explanatory code below describes how you can't get it and how you can (and yes, it's 8 bytes): <div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"> <div style="padding-bottom: 2px; background-color: #ffffff; padding-left: 5px; padding-right: 5px; overflow: auto; padding-top: 2px"><span style="color: #0000ff">using</span> System; <br /> <br /><span style="color: #0000ff">namespace</span> DateTimeSizeExample <br />{ <br /><span style="color: #0000ff">  public</span> <span style="color: #0000ff">struct</span> <span style="color: #2b91af">TypeSizeProxy</span><T> <br />  { <br /><span style="color: #0000ff">    public</span> T PublicField; <br />  } <br /> <br /><span style="color: #0000ff">  public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">class</span> <span style="color: #2b91af">SizeCalculator</span> <br />  { <br /><span style="color: #0000ff">    public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">int</span> SizeOf<T>() <br />    { <br /><span style="color: #0000ff">    try</span> <br />    { <br /><span style="color: #0000ff">      return</span> System.Runtime.InteropServices.<span style="color: #2b91af">Marshal</span>.SizeOf(<span style="color: #0000ff">typeof</span>(T)); <br />    } <br /><span style="color: #0000ff">    catch</span> (<span style="color: #2b91af">ArgumentException</span>) <br />    { <br /><span style="color: #0000ff">      return</span> System.Runtime.InteropServices.<span style="color: #2b91af">Marshal</span>.SizeOf(<span style="color: #0000ff">new</span> TypeSizeProxy<T>()); <br />    } <br />  } <br /> <br /><span style="color: #0000ff">  public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">int</span> GetSize(<span style="color: #0000ff">this</span> <span style="color: #0000ff">object</span> obj) <br />  { <br /><span style="color: #0000ff">    return</span> System.Runtime.InteropServices.<span style="color: #2b91af">Marshal</span>.SizeOf(obj); <br />  } <br />} <br /> <br /><span style="color: #0000ff">internal</span> <span style="color: #0000ff">class</span> <span style="color: #2b91af">Program</span> <br />{ <br /><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args) <br />{ <br /><span style="color: #008000">// Error: 'System.DateTime' does not have a predefined size, therefore sizeof can only be used in an unsafe context</span> <br /><span style="color: #008000">// (consider using System.Runtime.InteropServices.Marshal.SizeOf)</span> <br /><span style="color: #008000">//int s1 = sizeof(DateTime); </span> <br /> <br /><span style="color: #008000">// Run time Argument Exception: Type 'System.DateTime' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed</span> <br /><span style="color: #008000">//int s2 = System.Runtime.InteropServices.Marshal.SizeOf(typeof(DateTime));</span> <br /> <br /><span style="color: #0000ff">int</span> dateTimeSize = SizeCalculator.SizeOf<<span style="color: #2b91af">DateTime</span>>(); <span style="color: #008000">// 8 bytes</span> <br />} <br />} <br />}</div> </div> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com2tag:blogger.com,1999:blog-11049085.post-14212471691311455492011-02-07T23:17:00.001+02:002011-02-07T23:17:08.843+02:00Google Desktop Search as intranet search tool<p>Here is list of GDS proxies that could be used:</p> <p><a href="http://www.asabox.com/goolag/">http://www.asabox.com/goolag/</a> <br /><a href="http://sourceforge.net/projects/soogle/">http://sourceforge.net/projects/soogle/</a> <br /><a href="http://www.projectcomputing.com/resources/desktopProxy/">http://www.projectcomputing.com/resources/desktopProxy/</a> <br />(left as comment on my <a href="http://alexpinsker.blogspot.com/2007/05/fix-dnka-invalid-request-problem-it.html">former post</a> by anonymous good Samaritan).</p> <p>See also: <a href="http://alexpinsker.blogspot.com/2006/04/turn-google-desktop-into-multisite_30.html">Turn Google Desktop into multisite search tool</a>. </p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com1tag:blogger.com,1999:blog-11049085.post-27554646611411840612011-01-29T00:51:00.001+02:002011-01-29T00:51:56.198+02:00Dynamic casting in c#<div style="font-family: courier new; background: white; color: black; font-size: 10pt"> <p style="margin: 0px"><span style="color: blue">var</span> typesSubset = <span style="color: blue">new</span>[] { <span style="color: blue">typeof</span>(<span style="color: blue">decimal</span>), <span style="color: blue">typeof</span>(<span style="color: #2b91af">Int32</span>), <span style="color: blue">typeof</span>(<span style="color: #2b91af">Int64</span>) };</p> <p style="margin: 0px"><span style="color: #2b91af">Type</span> someDynamicType = <span style="color: blue">typeof</span> (<span style="color: blue">int</span>);</p> <p style="margin: 0px"><span style="color: blue">int</span> someDynamicValue = 777;</p> <p style="margin: 0px"><span style="color: blue">if</span> (typesSubset.Any(t => t == someDynamicType))</p> <p style="margin: 0px">{</p> <p style="margin: 0px">    <span style="color: blue">object</span> result = <span style="color: #2b91af">Expression</span>.Lambda<<span style="color: #2b91af">Func</span><<span style="color: blue">object</span>>>(</p> <p style="margin: 0px">        <span style="color: #2b91af">Expression</span>.Convert(<span style="color: #2b91af">Expression</span>.Add(</p> <p style="margin: 0px">                               <span style="color: #2b91af">Expression</span>.Constant(someDynamicType), <span style="color: #2b91af">Expression</span>.Constant(someDynamicValue)),</p> <p style="margin: 0px">                           <span style="color: blue">typeof</span> (<span style="color: blue">object</span>))).Compile()();</p> <p style="margin: 0px"> </p> <p style="margin: 0px">    <span style="color: #2b91af">Console</span>.WriteLine(result); <span style="color: green">// 777</span></p> <p style="margin: 0px">}</p> </div> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-61710098246792005912011-01-29T00:35:00.001+02:002011-01-29T00:35:57.840+02:00Pass xml to stored procedure<p>In C#:</p> <table border="1" cellspacing="0" cellpadding="2" width="90%"><tbody> <tr> <td valign="top" width="400"> <div style="font-family: courier new; background: white; color: black; font-size: 10pt"> <p style="margin: 0px"><span style="color: #2b91af">    1</span> <span style="color: green">// create XML string</span></p> <p style="margin: 0px"><span style="color: #2b91af">    2</span> <span style="color: blue">var</span> dataToPass = <span style="color: blue">new</span> <span style="color: #2b91af">StringBuilder</span>(<span style="color: #a31515">"<RowsOfNumbers>"</span>);</p> <p style="margin: 0px"><span style="color: #2b91af">    3</span> dataToPass.AppendFormat(<span style="color: #a31515">"<id>{0}</id>"</span>, 1);</p> <p style="margin: 0px"><span style="color: #2b91af">    4</span> dataToPass.AppendFormat(<span style="color: #a31515">"<id>{0}</id>"</span>, 2);</p> <p style="margin: 0px"><span style="color: #2b91af">    5</span> dataToPass.AppendFormat(<span style="color: #a31515">"<id>{0}</id>"</span>, 3);</p> <p style="margin: 0px"><span style="color: #2b91af">    6</span> dataToPass.Append(<span style="color: #a31515">"</RowsOfNumbers>"</span>);</p> <p style="margin: 0px"><span style="color: #2b91af">    7</span> </p> <p style="margin: 0px"><span style="color: #2b91af">    8</span> <span style="color: green">// call SP</span></p> <p style="margin: 0px"><span style="color: #2b91af">    9</span> myDB.ExecuteStoredProcedure(<span style="color: #a31515">"GetXmlData"</span>, <span style="color: blue">new</span> <span style="color: blue">object</span>[] { dataToPass.ToString() });</p> </div> </td> </tr> </tbody></table> <p>IN SQL:</p> <table border="1" cellspacing="0" cellpadding="2" width="90%"><tbody> <tr> <td valign="top" width="400"> <div style="font-family: courier new; background: white; color: black; font-size: 10pt"> <p style="margin: 0px"><span style="color: blue">CREATE PROCEDURE </span>[dbo].[GetXmlData]    (@dataIdsXml XML)</p> <p style="margin: 0px"><span style="color: blue">AS</span></p> <p style="margin: 0px">    <span style="color: blue">DECLARE </span>@dataIdsTable <span style="color: blue">TABLE </span>(ID <span style="color: blue">int</span>)</p> <p style="margin: 0px"> </p> <p style="margin: 0px">    <span style="color: blue">INSERT INTO </span>@dataIdsTable (ID) <span style="color: blue">SELECT </span>ParamValues.ID.value(<span style="color: #a31515">'.'</span>,<span style="color: #a31515">'VARCHAR(20)'</span>)</p> <p style="margin: 0px">    <span style="color: blue">FROM </span>@dataIdsXml.nodes(<span style="color: #a31515">'/RowsOfNumbers/id'</span>) <span style="color: blue">as </span>ParamValues(ID)</p> <p style="margin: 0px"> </p> <p style="margin: 0px">    <span style="color: blue">SELECT </span>[ID] <span style="color: blue">FROM </span>@dataIdsTable <span style="color: blue">WHERE </span>[ID]=1</p> <p style="margin: 0px">GO    </p> </div> </td> </tr> </tbody></table> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-56065023819204550392011-01-28T23:57:00.001+02:002011-01-28T23:57:18.160+02:00Workforce turnover around me (LinkedIn stats)<p>Following to LinkedIn data 57 out of my 382 contacts changed jobs in 2010. <br />This is 15%. Probably actual rate is a bit higher since in some cases this info may be not updated in LinkedIn.</p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-17661110739745216282011-01-28T23:43:00.001+02:002011-01-28T23:43:30.513+02:00Subset of TED lectures on health<p>(with bits of practical information)</p> <p><a href="http://www.ted.com/talks/gregory_petsko_on_the_coming_neurological_epidemic.html">http://www.ted.com/talks/gregory_petsko_on_the_coming_neurological_epidemic.html</a> – drink coffee, no strikes/box, no avian flue, low pressure, 3 grams of omega-three a day <br /><a href="http://www.ted.com/talks/carl_honore_praises_slowness.html">http://www.ted.com/talks/carl_honore_praises_slowness.html</a> <br /><a href="http://www.ted.com/talks/dan_buettner_how_to_live_to_be_100.html">http://www.ted.com/talks/dan_buettner_how_to_live_to_be_100.html</a> <br /><a href="http://www.ted.com/talks/martin_rees_asks_is_this_our_final_century.html">http://www.ted.com/talks/martin_rees_asks_is_this_our_final_century.html</a> <br /><a href="http://www.ted.com/talks/dean_ornish_says_your_genes_are_not_your_fate.html">http://www.ted.com/talks/dean_ornish_says_your_genes_are_not_your_fate.html</a> <br /><a href="http://www.ted.com/talks/juan_enriquez_shares_mindboggling_new_science.html">http://www.ted.com/talks/juan_enriquez_shares_mindboggling_new_science.html</a> - current crisis and future bionic technology <br /><a href="http://www.ted.com/talks/julian_treasure_the_4_ways_sound_affects_us.html">http://www.ted.com/talks/julian_treasure_the_4_ways_sound_affects_us.html</a> – well once I used nice utility (still downloadable) – Aire Freshner <br /><a href="http://www.ted.com/talks/mark_bittman_on_what_s_wrong_with_what_we_eat.html">http://www.ted.com/talks/mark_bittman_on_what_s_wrong_with_what_we_eat.html</a></p> <p>Just interesting: <br /><a href="http://www.ted.com/talks/misha_glenny_investigates_global_crime_networks.html">http://www.ted.com/talks/misha_glenny_investigates_global_crime_networks.html</a></p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com1tag:blogger.com,1999:blog-11049085.post-64825681326763610202011-01-28T23:35:00.001+02:002011-01-28T23:35:49.351+02:00Fallen giantFew photo subsets from <a href="http://zhigane.livejournal.com/19093.html">this</a> blog: <p><img src="http://lh6.ggpht.com/_LvECeOebFYY/TGGgiqT-yoI/AAAAAAAABrQ/ATdYgoLzGLk/0106.jpg" width="502" height="347" /> </p> <p><img src="http://lh5.ggpht.com/_LvECeOebFYY/TGGgsvbR2oI/AAAAAAAABrk/QvkIybNaUy8/0114.jpg" /> </p> <p><img src="http://lh5.ggpht.com/_LvECeOebFYY/TGGgvfAOLCI/AAAAAAAABro/UFPAXisUNvI/0115.jpg" width="498" height="333" /> </p> <p><img src="http://lh3.ggpht.com/_LvECeOebFYY/TGGg7NXRLvI/AAAAAAAABr8/7sgj7-fD_rE/0119.jpg" width="496" height="332" /> </p> <p><img src="http://lh5.ggpht.com/_LvECeOebFYY/TGGhRpqlcXI/AAAAAAAABss/0lJItcwL4_o/0136.jpg" width="490" height="732" /> </p> <p>“Heroic deeds live in eternity” – are they?</p> <p> <img src="http://lh4.ggpht.com/_LvECeOebFYY/TGGjCi5kMGI/AAAAAAAABwk/fNaTP4WVDsU/0163.jpg" width="493" height="330" /> </p> <p><img src="http://lh3.ggpht.com/_LvECeOebFYY/TGGidrdHZzI/AAAAAAAABvU/eyrzvslDZh0/0169.jpg" /> </p> <p><img src="http://lh3.ggpht.com/_LvECeOebFYY/TGGiG8-qf_I/AAAAAAAABuo/_-Jxmckf4hc/0158.jpg" width="498" height="344" /></p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-12197148371926363922010-09-19T23:28:00.001+02:002010-09-19T23:28:23.520+02:00Free eBook’s from Red Gate<p>Please visit <a href="http://www.red-gate.com/about/book_store/dynamic_management_views.htm">here</a> for the full list with descriptions. Below some links:</p> <ol> <li><a href="http://www.red-gate.com/products/SQL_Response/offers/Mastering%20Profiler%20eBook.zip">Mastering Profiling</a></li> <li><a href="https://www.red-gate.com/dynamic/downloads/DownloadEbook.aspx?download=ebook1">Best of SQL Server central</a></li> <li><a href="http://www.red-gate.com/specials/Ebooks/Defensive_Database_Programming.pdf">Defensive Database Programming</a></li> <li><a href="http://downloads.red-gate.com/ebooks/sysadmin/SysAdmin_eBook_Final_Feb2010.zip">The SysAdmin handbook</a></li> <li><a href="http://www.red-gate.com/products/ants_performance_profiler/want_to_be_dotnet_perf_testing_expert_ebook.htm">.NET performance and optimization</a></li> <li><a href="http://downloads.red-gate.com/ebooks/SQL_Server_Maintenance_Plans_Brad_eBook.zip">Brad’s guide to SQL Server Maintenance plans</a></li> <li><a href="http://www.red-gate.com/specials/Exchange/esa_exchange2010.htm">Exchange 2010 – a practical approach</a></li> <li><a href="http://www.simple-talk.com/books/sql-books/dont-just-roll-the-dice---ebook-download/">Don’t Just roll the dice</a></li> <li><a href="http://www.simple-talk.com/books/sql-books/dont-just-roll-the-dice---ebook-download/">Best of SQL Server central</a></li> <li><a href="https://www.red-gate.com/dynamic/downloads/downloadform.aspx?download=ebook1">Protecting SLQ server data</a></li> <li><a href="http://downloads.red-gate.com/ebooks/SQL_Server_Tacklebox_EBook.zip">SQL Server Tacklebox</a></li> <li><a href="http://www.red-gate.com/products/SQL_Backup/offers/images/backup_exceptionalebook_button.gif">How to become as exceptional DBA</a></li> <li><a href="http://downloads.sqlservercentral.com/Books/SSC%20Stumper%20Vol%205.pdf">SQL Server Stumpers</a></li> <li><a href="http://www.red-gate.com/products/ants_performance_profiler/boost_app_performance_ebook7.htm">Confessions of an IT manager</a></li> <li><a href="http://www.red-gate.com/about/book_store/The_Art_of_XSD.pdf">Art of XSD</a></li> <li><a href="http://www.red-gate.com/specials/Grant.htm">SQL Server Execution Plans</a></li> </ol> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-780081030596416542010-09-18T01:35:00.001+02:002010-09-18T01:35:13.293+02:00China - The Mother of All Black Swans - By Vitaliy Katsenelson<p>Article <a href="http://www.scribd.com/doc/26781802/China-The-Mother-of-All-Black-Swans-By-Vitaliy-Katsenelson#">here</a>.</p> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-48189209110983812242010-09-18T00:59:00.001+02:002010-09-18T00:59:25.033+02:00Military segway<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/hh2nLWYnxkM?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/hh2nLWYnxkM?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-24868193305343297782010-08-26T21:49:00.001+03:002010-09-18T01:30:26.648+02:0016 years of survival in extreme conditions - in 43 sentences<span style="font-family: times new roman; font-size: 85%"></span> <div align="left"> <table border="1" align="left"><tbody> <tr> <td> <p align="left">Below is my (partial) translation of a short story written by <a href="http://en.wikipedia.org/wiki/Shalamov">Varlam Tihonovich Shalamov</a> who was prisoner of Gulag camps from 1937 till 1953. <br />It’s called “<a href="http://shalamov.ru/library/29/">What I have seen and understood in jail</a>”. <br />16 years of survival in extreme conditions in 43 sentences… <br /> <br />What I have seen and understood in jail: <br />1. Extreme fragility of human culture, civilization. Man turns into beast after three weeks of hard work, coldness, hunger and beating. <br />2. The main way of spirit defilement is coldness – people enjailed in camps of Asia hold for longer – it was warmer there. <br />3. I understood that friendship and fellowship never starts in difficult, really difficult conditions – when your life is a stake. Friendship may start in conditions that are difficult but feasible. <br />4. I understood that emotion that man keeps for last is the emotion of hate. It’s enough flesh on a hunger man to keep only his hate. A hunger man is indifferent to the else. <br />… <br />7. I understood that humans raised the humankind because human is more strong and tenacious than any animal – horse can’t sustain hard work in conditions of Far North, human – does. <br />8. The only group of people that were behaving a bit like humans were religious, mostly sectarian and camisters. <br />9. Former militaries and politicians are broken first. <br />10. I’ve seen what a sound argument an ordinary slap can be. <br />11. Mob differentiates leaders by their ardor and strength of beating. <br />12. Beating is an irresistible argument. <br />… <br />16. I understood that you may live only by hate. <br />17. I understood that you may live by apathy. <br />18. In extreme conditions – man not motivated by his hopes (there is no hopes), not by his will but rather by animal instinct, instinct of survival similar to one that exist in tree, animal or a stone. <br />… <br />23. I’ve seen that women more fair and selfless than man. There was not a single case when man followed his wife to the North, but the opposite was common. <br />… <br />31. You should differentiate people not as ‘good’ and ‘bad’, but as coward and brave. 95% are coward and ready to do any villainy in case of even minor danger. <br />32. I’m convinced that every single hour you’ve spent in camp adds to your defilement. <br />… <br />36. I learned to plan one day ahead only <br />37. I understood that thieves are not humans. <br />…</p> <p align="left"> <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b8/Varlam_Shalamov_barelef.jpg/423px-Varlam_Shalamov_barelef.jpg" /> </p> </td> </tr> </tbody></table> </div> <span style="font-family: times new roman; font-size: 85%"></span> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-17603045440236920612010-05-09T11:37:00.000+03:002010-05-09T11:37:25.311+03:00Some photos from Think Next 2010Some photos from Think Next 2010:<br />
<br />
Portable sonar device, enable to show people locations through walls:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_If2EaQD4ZgM/S-Zz60Z7WAI/AAAAAAAABQc/1_Y7xnB8m6w/s1600/14042010030.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://3.bp.blogspot.com/_If2EaQD4ZgM/S-Zz60Z7WAI/AAAAAAAABQc/1_Y7xnB8m6w/s320/14042010030.jpg" tt="true" width="320" /></a></div><br />
Big touch-screen device:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_If2EaQD4ZgM/S-Z0KoLgm5I/AAAAAAAABQk/iz_hgtONQIw/s1600/14042010031.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_If2EaQD4ZgM/S-Z0KoLgm5I/AAAAAAAABQk/iz_hgtONQIw/s320/14042010031.jpg" tt="true" /></a></div><br />
<div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:60390cbc-8599-4e64-bbf3-b99426043c7c" style="display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Technorati Tags: <a href="http://technorati.com/tags/Think+Next+2010" rel="tag">Think Next 2010</a></div>Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-61449956851251210132010-03-10T11:15:00.002+02:002010-04-27T15:30:28.341+03:00Solution for "Impossible to log SQL 2008 performance counters under Windows 2008 64 bit?"<a href="http://alexpinsker.blogspot.com/2010/02/impossible-to-log-sql-2008-performance.html">Alex Pinsker: Impossible to log SQL 2008 performance counters under Windows 2008 64 bit?</a><br />
<span style="font-family: times new roman; font-size: 85%;"><br />
</span><br />
<table border="1"><tbody>
<tr><td>Here is solution, found by our DBA:<br />
1. Open regedit.exe<br />
2. Find the key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER\Performance"<br />
3. Find the value named "Performance counters disabled"<br />
4. Ensure, that its value is NOT "4" or "1". If it is - enforce it to "0"<br />
5. Notice file name in value of "PerfIniFile" key and copy it to clipboard<br />
6. Close the regedit<br />
7. Open cmd and go to Binn folder of Sql Server installation. Usually in "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn"<br />
8. Run the following commands:<br />
8.1 unlodctr mssqlserver<br />
8.2 lodctr [clipboard filename from (5.) above]<br />
8.2.1 lodctr [clipboard filename from (.5) above]<br />
(this only needs for sure, that counters are installed - there will be a message notifying on that)<br />
8.3 lodctr /T:mssqlserver<br />
9. Restart the server<br />
10. Use perfmon to ensure, that counters for Sql Server reappeared</td></tr>
</tbody></table><span style="font-family: times new roman; font-size: 85%;"><br />
</span>Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com2tag:blogger.com,1999:blog-11049085.post-57949721316505486272010-03-07T12:06:00.001+02:002010-03-07T12:06:33.752+02:00Excellent guide on hosting wcf in asp.net iis environment<span style="font-family: times new roman; font-size: 85%"></span> <table border="1"><tbody> <tr> <td><a href="http://www.leastprivilege.com/HostingWCFServicesInASPNETTheSurvivalGuide.aspx">www.leastprivilege.com - Hosting WCF Services in ASP.NET - The Survival Guide</a></td> </tr> </tbody></table> <span style="font-family: times new roman; font-size: 85%"></span> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4d3928f9-9bf8-404b-a1e7-5369b579611a" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/WCF" rel="tag">WCF</a>,<a href="http://technorati.com/tags/IIS+7" rel="tag">IIS 7</a></div> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-7031530602184706122010-03-01T19:44:00.001+02:002010-03-01T19:44:32.286+02:00blog ping list<p>Long blog ping list - compiled from few sources:</p> <table border="0" cellspacing="0" cellpadding="0"><tbody> <tr> <td width="390">http://1470.net/api/ping</td> </tr> <tr> <td>http://api.feedster.com/ping</td> </tr> <tr> <td>http://api.moreover.com/ping</td> </tr> <tr> <td>http://api.moreover.com/RPC2</td> </tr> <tr> <td>http://api.my.yahoo.com/RPC2</td> </tr> <tr> <td>http://api.my.yahoo.com/rss/ping</td> </tr> <tr> <td>http://bblog.com/ping.php</td> </tr> <tr> <td>http://bitacoras.net/ping</td> </tr> <tr> <td>http://blog.goo.ne.jp/XMLRPC</td> </tr> <tr> <td>http://blogdb.jp/xmlrpc</td> </tr> <tr> <td>http://blogmatcher.com/u.php</td> </tr> <tr> <td>http://blogsearch.google.com/ping/RPC2</td> </tr> <tr> <td>http://bulkfeeds.net/rpc</td> </tr> <tr> <td>http://coreblog.org/ping/</td> </tr> <tr> <td>http://mod-pubsub.org/kn_apps/blogchatt</td> </tr> <tr> <td>http://ping.amagle.com/</td> </tr> <tr> <td>http://ping.bitacoras.com</td> </tr> <tr> <td>http://ping.blo.gs/</td> </tr> <tr> <td>http://ping.bloggers.jp/rpc/</td> </tr> <tr> <td>http://ping.blogmura.jp/rpc/</td> </tr> <tr> <td>http://ping.cocolog-nifty.com/xmlrpc</td> </tr> <tr> <td>http://ping.exblog.jp/xmlrpc</td> </tr> <tr> <td>http://ping.feedburner.com</td> </tr> <tr> <td>http://ping.myblog.jp</td> </tr> <tr> <td>http://ping.rootblog.com/rpc.php</td> </tr> <tr> <td>http://ping.syndic8.com/xmlrpc.php</td> </tr> <tr> <td>http://ping.weblogalot.com/rpc.php</td> </tr> <tr> <td>http://ping.weblogs.se/</td> </tr> <tr> <td>http://pingoat.com/goat/RPC2</td> </tr> <tr> <td>http://rcs.datashed.net/RPC2/</td> </tr> <tr> <td>http://rpc.blogbuzzmachine.com/RPC2</td> </tr> <tr> <td>http://rpc.blogrolling.com/pinger/</td> </tr> <tr> <td>http://rpc.icerocket.com:10080/</td> </tr> <tr> <td>http://rpc.newsgator.com/</td> </tr> <tr> <td>http://rpc.pingomatic.com</td> </tr> <tr> <td>http://rpc.pingomatic.com/</td> </tr> <tr> <td>http://rpc.technorati.com/rpc/ping</td> </tr> <tr> <td>http://rpc.weblogs.com/RPC2</td> </tr> <tr> <td>http://topicexchange.com/RPC2</td> </tr> <tr> <td>http://trackback.bakeinu.jp/bakeping.php</td> </tr> <tr> <td>http://www.a2b.cc/setloc/bp.a2b</td> </tr> <tr> <td>http://www.bitacoles.net/ping.php</td> </tr> <tr> <td>http://www.blogdigger.com/RPC2</td> </tr> <tr> <td>http://www.blogoole.com/ping/</td> </tr> <tr> <td>http://www.blogoon.net/ping/</td> </tr> <tr> <td>http://www.blogpeople.net/servlet/weblogUpdates</td> </tr> <tr> <td>http://www.blogroots.com/tb_populi.blog?id=1</td> </tr> <tr> <td>http://www.blogshares.com/rpc.php</td> </tr> <tr> <td>http://www.blogsnow.com/ping</td> </tr> <tr> <td>http://www.blogstreet.com/xrbin/xmlrpc.cgi</td> </tr> <tr> <td>http://www.lasermemory.com/lsrpc/</td> </tr> <tr> <td>http://www.mod-pubsub.org/kn_apps/blogchatter/ping.php</td> </tr> <tr> <td>http://www.mod-pubsub.org/ping.php</td> </tr> <tr> <td>http://www.newsisfree.com/RPCCloud</td> </tr> <tr> <td>http://www.newsisfree.com/xmlrpctest.php</td> </tr> <tr> <td>http://www.popdex.com/addsite.php</td> </tr> <tr> <td>http://www.snipsnap.org/RPC2</td> </tr> <tr> <td>http://www.weblogues.com/RPC/</td> </tr> <tr> <td>http://xmlrpc.blogg.de</td> </tr> <tr> <td>http://xmlrpc.blogg.de/</td> </tr> <tr> <td>http://xping.pubsub.com/ping/</td> </tr> </tbody></table> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:72c1655e-699a-4563-bab2-afcf274ad623" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/blog" rel="tag">blog</a>,<a href="http://technorati.com/tags/ping+list" rel="tag">ping list</a>,<a href="http://technorati.com/tags/ping" rel="tag">ping</a></div> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0tag:blogger.com,1999:blog-11049085.post-17000252086608135752010-03-01T19:38:00.001+02:002010-03-01T19:38:14.541+02:00::boost for C# - Umbrella<p>Nice project: <a href="http://umbrella.codeplex.com/">http://umbrella.codeplex.com/</a>. Provides many components similar to the <a href="http://www.boost.org/">::boost</a> basics (like bind()...) - for C#.</p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d42a0d4a-da98-4c4d-94ee-128f41d0bb63" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/C%23" rel="tag">C#</a>,<a href="http://technorati.com/tags/C%2b%2b" rel="tag">C++</a>,<a href="http://technorati.com/tags/%3a%3aboost" rel="tag">::boost</a></div> Alex Pinskerhttp://www.blogger.com/profile/01712994496088023843noreply@blogger.com0