#algorithm

5 posts tagged algorithm.

2015 2 posts

  1. Updated

    C# - Normalize Whitespace Inside String

    Simple task - replace all sequential whitespace (tabs, spaces, newlines) with your character of choice, usually a space.

  2. Updated

    C# - Capture Full Stack Trace Inside Catch

    When you catch an exception, you only have stack trace relative to 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's say you send confirmation emails to clients as part of the ordering process. Yes, it's bad if the email cannot reach your client (say, their email address is invalid), but your web server should not crash because of that.

2010 3 posts

  1. Updated

    PowerShell - Print All Odd/Even Lines

    As a little brainstormer, suppose you have a variable with the following test content. Here is how you can print all odd lines from it. Or, if you want all even lines, change the initial $f value to 1.

  2. Updated

    VB.NET - Thread Safe Progress Bar

    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. I recently wrote a fairly simple wrapper class, which solves the problem.

  3. Updated

    PowerShell - Get MAC Address Of Any Remote IP

    Here is a PowerShell one-liner [...] If you need to dynamically resolve a host IP from its name [...] The whole script may look like the following [...] Because it's WMI based, computer can be from any network. But you must have necessary account permissions and firewall rules.