Expensive dot-sourcing

IT Pro PowerShell experience

dot-sourcingToday a very short post about a concern that I would like to share. It all started at work, when our internal module went up to something like 12 seconds to load. And you my ask yourself: what is the big deal here? Well picture this:

Boss stands behind you and asks you: hey, do we have any JIRA tickets about this change you did last week? Can you find them for me?

Not expecting any issues, you type PowerShell command that should let you perform a quick JIRA search in CLI, proud of your own creation and simplicity of it. You type in the command name, a parameter that allows you to specify J<TAB>QL and… you wait…

View original post ещё 342 слова

How to compress and decompress files with GZip in .NET C#

Exercises in .NET with Andras Nemes

You have probably seen compressed files with the «gz» extension. These are files that hold a single compressed file according to the GZIP specifications.

GZip files are represented by the GZipStream object in .NET. It’s important to note that the GZip format doesn’t support adding multiple files to the same .gz file. If you need to insert multiple files in a GZip file then you’ll need to create a «tar» file first which bundles the individual files and then compresses the tar file itself. The result will be a «.tar.gz» file. At present tar files are not supported in .NET. They are supported by the ICSharpCode SharpZipLib library available here. We’ll look at tar files in another post soon.

With that in mind let’s see how a single file can be gzipped:

View original post ещё 19 слов

The Arrow — Advanced kanban board

The Agileist

Ever since we started to use Kanban I have been thinking about how the ”perfect” kanban board would look like. I have searched for answers in the Kanban literature, but usually the boards shown there are simple examples to get you started, rather than ”evolved” or ”advanced” variants. Shortly after I had the idea with the priority pyramid I discussed it with some other persons in the agile community. One of them gave the advice, ”Why don’t you rotate the pyramid 90 degrees and connect it to a kanban board?”. This is what I came up with.

””The

This is some sort of advanced or «ultimate» kanban board to aim for. At least for now, our kaizen efforts will for sure evolve it in the future 🙂 The picture holds quite a lot of information, let me walk you through the arrow from left to right. Let’s get started!

Priority triangle

The priority…

View original post ещё 1 124 слова

Effective PowerShell Item 16: Dealing with Errors

Keith Hill's Blog

There are several facets to the subject of errors in PowerShell that you should understand to get the most out of PowerShell.  Some of these facets are error handling, error related global variables and error related preference variables.  But the most fundamental facet is the distinction between “terminating” and “non-terminating” errors.

Terminating Errors

Terminating errors will be immediately familiar to software developers who deal with exceptions.  If an exception is not handled it will cause the program to crash.  Similarly if a terminating error is not handled it will cause the current operation (cmdlet or script) to abort with an error.  Terminating errors and are generated by:

  • Cmdlet calling the ThrowTerminatingError API.
  • Exceptions escaping unhandled from a cmdlet
  • Script using the “throw” keyword to issue a terminating error
  • Script syntax errors

The gist of a terminating error is that the code throwing the terminating error is indicating that it cannot…

View original post ещё 2 581 слово

SQL Server – Finding the Source of Excessive I/O

Add your thoughts here… (optional)

LichtenBytes

I recently had to troubleshoot a poorly-performing instance of SQL Server.  The cause turned out to be a single stored procedure that was producing excessive disk I/O. 

Following is a description of the process I used to identify the problem and find its source. 

This is a summary of the Windows server and SQL Server instance that was experiencing the problem:

SQL Server 2005 Enterprise edition
Windows 2008 R2 Standard edition
23 separate user databases, 7 in use 24/7

The initial suggestion that something was wrong was slowness in multiple web sites and applications that accessed databases hosted on the server.  These sites and applications all accessed different databases, so the indication was that the problem was affecting the entire server.

  1. First I opened the SQL Server Management Studio Activity Monitor, and examined the four graphs at the top of the monitor.  The graphs of “% Processor Time”, “Waiting…

View original post ещё 867 слов

Log Parser Rocks! More than 50 Examples!

Add your thoughts here… (optional)

LichtenBytes

Log Parser is a tool that has been around for quite some time (almost six years, in fact).  I can’t really do any better than the description on the official download page, so here it is: “Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows operating system such as the Event Log, the Registry, the file system, and Active Directory”.  

Log Parser is a command line (yes, command line!) tool that uses a SQL dialect to extract information from data sources.  In particular, I have found it to be invaluable for extracting information from the web server logs of the sites that I manage and develop.

First, about that SQL syntax Log Parser uses to query the data sources… many developers seem to have a…

View original post ещё 3 111 слов