<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" 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:media="http://search.yahoo.com/mrss/"><channel><title>algorithm on Neolisk's Tech Blog</title><link>/tags/algorithm/</link><description>Recent content in algorithm on Neolisk's Tech Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>neolisk@gmail.com (Victor Zakharov)</managingEditor><webMaster>neolisk@gmail.com (Victor Zakharov)</webMaster><copyright>©2020-2024 Victor Zakharov. All Rights Reserved</copyright><lastBuildDate>Fri, 14 Aug 2015 00:00:00 +0000</lastBuildDate><atom:link href="/tags/algorithm/index.xml" rel="self" type="application/rss+xml"/><item><title>C# - Normalize Whitespace Inside String</title><link>/posts/2015-08-14-csharp-normalize-whitespace/</link><pubDate>Fri, 14 Aug 2015 00:00:00 +0000</pubDate><author>neolisk@gmail.com (Victor Zakharov)</author><atom:modified>Sat, 05 Jun 2021 11:36:56 -0400</atom:modified><guid>/posts/2015-08-14-csharp-normalize-whitespace/</guid><description>Simple task - replace all sequential whitespace (tabs, spaces, newlines) with your character of choice, usually a space.
Fact - StackOverflow is on top in google results, when searching for &amp;ldquo;C# normalize whitespace&amp;rdquo;.
How to replace multiple white spaces with one white space c# Fastest way to remove extra white spaces Why this article? Highest voted answers are not the best performing, and some answers are just wrong.
I propose a solution which is based on this StackOverflow answer.</description><dc:creator>Victor Zakharov</dc:creator><category>csharp</category><category>algorithm</category></item><item><title>C# - Capture Full Stack Trace Inside Catch</title><link>/posts/2015-08-13-csharp-capture-full-stacktrace/</link><pubDate>Thu, 13 Aug 2015 00:00:00 +0000</pubDate><author>neolisk@gmail.com (Victor Zakharov)</author><atom:modified>Sat, 05 Jun 2021 11:36:56 -0400</atom:modified><guid>/posts/2015-08-13-csharp-capture-full-stacktrace/</guid><description>When you catch an exception, you only have stack trace relative to the catch point.
The problem is very clearly described in this article on CodeProject:
.NET: Exception stack trace has no frames above the catch point. Why is this important? Suppose the error occurs when sending email and this is a non-critical part of your application. Let&amp;rsquo;s say you send confirmation emails to clients as part of the ordering process.</description><dc:creator>Victor Zakharov</dc:creator><category>csharp</category><category>algorithm</category></item><item><title>PowerShell - Print All Odd/Even Lines</title><link>/posts/2010-03-30-powershell-print-all-odd-even-lines/</link><pubDate>Tue, 30 Mar 2010 00:00:00 +0000</pubDate><author>neolisk@gmail.com (Victor Zakharov)</author><atom:modified>Mon, 12 Oct 2020 10:25:43 -0400</atom:modified><guid>/posts/2010-03-30-powershell-print-all-odd-even-lines/</guid><description>As a little brainstormer, suppose you have a variable with the following test content:
1 2 3 4 5 6 7 8 $str = @&amp;#34; Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 &amp;#34;@ Here is how you can print all odd lines from it:
1 $f=0; $str.Split(&amp;#34;`n&amp;#34;) | % { if($f = !$f) { $_ } } Or, if you want all even lines, change the initial $f value to 1:</description><dc:creator>Victor Zakharov</dc:creator><category>powershell</category><category>algorithm</category></item><item><title>VB.NET - Thread Safe Progress Bar</title><link>/posts/2010-03-28-vbnet-thread-safe-progress-bar/</link><pubDate>Sun, 28 Mar 2010 00:00:00 +0000</pubDate><author>neolisk@gmail.com (Victor Zakharov)</author><atom:modified>Mon, 12 Oct 2020 10:35:19 -0400</atom:modified><guid>/posts/2010-03-28-vbnet-thread-safe-progress-bar/</guid><description>Normally, when you are using .NET built-in progress bar in a multi-threaded application without Callback tricks, you are likely to get an exception on value assign, similar to the following:
I recently wrote a fairly simple wrapper class, which solves the problem. See code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Public Class MyProgressBar : Inherits ProgressBar Public Delegate Sub SetRefreshCallback() Public Delegate Sub SetValueCallback(ByVal v As Integer) Public Shadows Text As String = String.</description><dc:creator>Victor Zakharov</dc:creator><category>vbnet</category><category>algorithm</category></item><item><title>PowerShell - Get MAC Address Of Any Remote IP</title><link>/posts/2010-02-09-powershell-get-mac-of-remote-ip/</link><pubDate>Tue, 09 Feb 2010 00:00:00 +0000</pubDate><author>neolisk@gmail.com (Victor Zakharov)</author><atom:modified>Mon, 12 Oct 2020 14:40:56 -0400</atom:modified><guid>/posts/2010-02-09-powershell-get-mac-of-remote-ip/</guid><description>Here is a PowerShell one-liner:
1 2 #change/assign $hostIp to a valid IP address (gwmi -Class Win32_NetworkAdapterConfiguration | where { $_.IpAddress -eq $hostIp }).MACAddress If you need to dynamically resolve a host IP from its name:
1 2 #change/assign $Computer to a valid host identifier $hostIp = [System.Net.Dns]::GetHostByName($Computer).AddressList[0].IpAddressToString The whole script may look like the following:
1 2 3 4 5 6 7 8 9 10 11 12 param ( $Computer , $Credential ) #to make it work without parameters if($Computer -eq $null) { $Computer = $env:COMPUTERNAME } #program logic $hostIp = [System.</description><dc:creator>Victor Zakharov</dc:creator><category>powershell</category><category>devops</category><category>algorithm</category></item></channel></rss>