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

    SQL Reporting Services - Fix Border Thickness

    When the report is rendered on the screen in preview mode, it looks okay. However, when it is saved to PDF and/or printed, table borders might have slightly different thickness depending on relative location on the sheet. I believe this issue is related to DPI scaling.

  4. Updated

    Visual Studio 2010 RC - Switch Back To Mouse Pointer After Drawing Controls

    Speaking about WinForms, there is usually a mouse pointer (cursor) on top of each logical control group in the toolbox. You use it to cancel control drawing mode and go back to control selection mode (default).

  5. Updated

    Set Server To Synchronize Time With External Source

    Here's how you can do it - w32tm /config /syncfromflags:manual /manualpeerlist:<peerlist>.

  6. Updated

    VB.NET - Extract an Image Embedded as a Resource

    Here's one of the ways to embed an image into EXE file Left click the file in the project tree Set [Build Action] -> [Embedded Resource]. And here's how you can access this file in code...

  7. Updated

    VB.NET - Nullable DateTimePicker

    One of the popular ways to do this - change format to " " (space) whenever null value is being set and roll it back to the old format on anything else. I have been looking for clean implementation of this approach. In the end I decided to write my own, using source code available on the net. Here is what I came up with.

  8. 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.

  9. Updated

    PowerShell - Control Code Execution

    In this article we are going to discuss basics of how to control code execution in a PowerShell script. There are several keywords, which have slightly different behavior - BREAK, RETURN and EXIT.

  10. Updated

    PowerShell - Get Current User

    Actually, there are many ways to get name of the user, which is currently logged on, including built-in .NET commands. But let's keep our code clean and stick with native PowerShell.