jaredpar's WebLog

Code, rants and ramblings of a programmer.
Posts
  • jaredpar's WebLog

    Tuples Part 3: Type Inference Friendly Constructor

    • 1 Comments
    Last time we were left with a constructor that required us to explicitly specify generic parameters. This is not always easy or possible. We'll now alter the script to generate a constructor which utilizes type inference to create a Tuple. In addition...
  • jaredpar's WebLog

    Tuples Part 2: Basic Structure

    • 3 Comments
    Part 1 of the series outlined the basic structure of the tuple. This entry will produce a PowerShell script that will generate N tuple classes containing 1-N name value pairs. The first step is to get a few script variables defined. All of the names used...
  • jaredpar's WebLog

    Tuples Part 1

    • 6 Comments
    A tuple in computer science can be described as a set of name/value pairs. In some cases it can be described as simply a set of values that are accessible via an index [1]. Previously I discussed how to create a Tuple inside of PowerShell . This series...
  • jaredpar's WebLog

    Ternary: Reducing code

    • 1 Comments
    I like my scripts to be readable and terse. They're scripts after all and I want to get the most done with the least amount of code. There's a lot to be said for having a readable script but I only value that when I intend to keep the script around for...
  • jaredpar's WebLog

    C# Lambda Type Inference

    • 1 Comments
    One of the limitations of C# type inference is that you cannot use it to infer the type of a lambda expression. For example, the following code will not compile var f = () => 4; Normally this is not too much of an issue because you can just explicitly...
  • jaredpar's WebLog

    Filtering get-psdrive to all Local Drives

    • 2 Comments
    Recently I needed to filter the return of get-psdrive to return all of my local hard drives. I didn't want to accidentally start operating on floppies, CDROM's and more importantly, network drives. There are a couple of ways to do this but I found the...
  • jaredpar's WebLog

    Types of Immutability

    • 3 Comments
    By definition, an immutable object in computer science is one that is not able to change. Parallel coding is becoming more necessary as the number of cores in a processor are increasing but not the overall speed. As such immutability is will become more...
  • jaredpar's WebLog

    Getting my Fortune

    • 1 Comments
    Fortune is a Unix command that gets a random message from a set of databases and displays it on the screen.  These messages have a wide variety but tend to be funny, quirky or famous quotes (most are indeed geeky).  Nearly all unix systems have...
  • jaredpar's WebLog

    ViEmu and Suites

    • 1 Comments
    ViEmu is a Visual Studio Package which adds Vim keybinding support into Visual Studio.  For former VI users this is huge benefit as I can use all of my cryptic key combinations inside of Visual Studio. For those unfamiliar, Vi is one of the original...
  • jaredpar's WebLog

    Calling Extension Methods on Null Objects

    • 1 Comments
    One of the gotchas for Extension Methods is that it's legal to call them on Null References. This isn't really surprising when you think about the feature. Boiled down to a fundamental level, extension methods are just syntactic sugar for calling a static...
  • jaredpar's WebLog

    Tuples in PowerShell

    • 6 Comments
    Tuples in computer science are usually light weight record objects with simple name value pairs. In scripting languages it is very handy to create them on the fly. For quite some time I was using associative arrays in PowerShell to do just that. PS>...
  • jaredpar's WebLog

    Piping elements of a String

    • 0 Comments
    Quick script that will allow you to pipe each char in a String into the PowerShell pipeline. function PipeStringChar() { param ( [string]$toPipe ) for ( $i = 0; $i -lt $toPipe.Length; $i++ ) { write-output $toPipe[$i] } } Alternatively...
  • jaredpar's WebLog

    Type Inference and IEnumerable

    • 2 Comments
    This is somewhat of a follow up on a previous post I did on the difference between IEnumerable(Of T) and the IEnumerable interfaces. I've seen several people type in the following code and wonder if there was a fundamental bug in the type inference code...
  • jaredpar's WebLog

    AutoSize and DockStyle.Fill don't mix

    • 1 Comments
    The title of this post essentially says it all.  AutoSize and DockStyle.Fill don't mix well together.  Both properties exist to describe the size relationship relative to the rest of the control but they do so in conflicting ways. AutoSize is...
  • jaredpar's WebLog

    VS2008 Ships

    • 1 Comments
    Orcas has shipped :) http://msdn2.microsoft.com/en-us/vstudio/default.aspx
  • jaredpar's WebLog

    Lambda Unexpected Behavior

    • 1 Comments
    One item you strive to avoid when you design and implement a feature is unexpected behavior.  Unfortunately there is one case we couldn't avoid with Lambda's in VB9.  I just ran into the this problem when coding up a handler.  I wanted...
  • jaredpar's WebLog

    Extension Methods without 3.5 Framework

    • 10 Comments
    For a time I've been avoiding extension methods. Not because I'm opposed to using them but because of the 3.5 Framework. A lot of the tools I own are designed to be very light weight tools that only require the user to have 2.0 installed on their machine...
  • jaredpar's WebLog

    Names of Anonymous Type Members

    • 1 Comments
    Recently I was asked how can you get a list of anonymous type member names given a query of anonymous types. The quick answer is that you can use a quick bit of reflection to get back the names. Public Function GetAnonymousTypeMemberNames( Of T)( ByVal...
  • jaredpar's WebLog

    C++ Refactoring: Default booleans and pointers

    • 1 Comments
    This is another recount of an experience I had refactoring some C++ code recently. In some ways this is also a follow up of my previous post about why you shouldn't use boolean parameters (especially default value ones). I recently refactored a large...
  • jaredpar's WebLog

    C++ Placement New: Tracking down a crash

    • 1 Comments
    See my previous two posts on an introduction to placement new if you are unfamiliar with the subject. http://blogs.msdn.com/jaredpar/archive/2007/10/16/c-new-operator-and-placement-new.aspx http://blogs.msdn.com/jaredpar/archive/2007/10/17/c-placement...
  • jaredpar's WebLog

    C++ Placement New and Allocators

    • 2 Comments
    This is a follow up for my previous post about operator new and placement new. This post will discuss the role of adding a custom allocator and using it with new. It's handy to use custom allocators in C++. Certain operations can be done more efficiently...
  • jaredpar's WebLog

    C++ New Operator and Placement New

    • 5 Comments
    Originally I was going to write this article to detail a particular problem I had recently with placement new in C++. A page or two of writing later I decided it would be best to start with an introduction to the "new" operator itself and the in/outs...
  • jaredpar's WebLog

    Debugging PowerShell

    • 1 Comments
    Debugging PowerShell can be extremely frustrating because it often turns into a session of debugging your own thought process. Often when I hit a PowerShell script issue I find myself feeling like everything is right and I'm just missing something basic...
  • jaredpar's WebLog

    Select-StringRecurse

    • 3 Comments
    When you need to search for text in a file, select-string is your best friend.  It has most of the functionality of old unix grep.  In addition it does full regular expression support. The only downside is that it will only run on files in the...
  • jaredpar's WebLog

    IEnumerable and IEnumerable(Of T) 2

    • 3 Comments
    Quick follow up to my earlier post . Fixing this issue in C# is even easier because of the existence of iterators. public static IEnumerable < object > Shim(System.Collections. IEnumerable enumerable) { foreach ( var cur in enumerable) { ...
Page 9 of 13 (321 items) «7891011»