jaredpar's WebLog

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

    Script Blocks and Arguments: Figuring it out for myself … again

    • 4 Comments
    Script blocks are a powershell construct for storing an expression or group of statements inside an expression.  It’s the equivalent of a C#/F#/VB Lamba expression.  Recently I needed to use a script block but found I had forgotten how to read...
  • jaredpar's WebLog

    Case Sensitive vs. Case Insensitive Languages

    • 10 Comments
    Just had a random thought while I was looking at some code today.  It’s yet another argument in the case sensitive vs. case insensitive language battle.  Do you really want this to be able to compile? class C1 { int M1; int m1; } Yes...
  • jaredpar's WebLog

    Count-Object

    • 1 Comments
    With all of the great built-in commands for processing pipelines the absence of a good command to count the number of elements in a pipeline seems to stand out.  The best built-in way to count the number of objects in a pipeline is to convert the...
  • jaredpar's WebLog

    NotImplementedException vs. NotSupportedException

    • 5 Comments
    In responding to a recent blog post , one of the readers, Jeremy Gray, noted that I was using a NotImplementedException where I should have been using a NotSupportedException .  At first I did not agree.  There was a method on an interface which...
  • jaredpar's WebLog

    Extension Methods and ByRef targets

    • 7 Comments
    One of the seldom used, and often unknown, features of VB extension methods is that the argument of the extension method (the first parameter) can be passed by reference.  This gives extension methods the power to change the reference that was used...
  • jaredpar's WebLog

    Immutable Collections and Compatibility with Existing Frameworks

    • 3 Comments
    When developing my immutable collections library , I spent a lot of time on usability. After all, if a library is not useful then what’s the point? A big portion of usability is being able to work with existing frameworks and technologies. For .Net...
  • jaredpar's WebLog

    Mapping LINQ to F#

    • 2 Comments
    In my projects with F#, I often find that I know exactly what type of sequence transformation I want to run, yet I spend all of my time trying to find it!!!  The problem is I’m used to query comprehensions in LINQ terminology.  Select, Where...
  • jaredpar's WebLog

    Sorting out Binary Files

    • 1 Comments
    I constantly get tripped up in my powershell scripts/commands because I run them against a binary file.  In particular when I’m searching through a directory structure looking for a particular string or regex.  I’ve found the simplest way to...
  • jaredpar's WebLog

    Comparing Continuations in C# and F# Part 3: Double wrong

    • 1 Comments
    Is it better to be wrong once or to be right then think you’re wrong but find out you were right but wrong about being wrong? Besides the obvious be right the first time, it’s certainly an educational experience.  Here’s the original sample: let...
  • jaredpar's WebLog

    Comparing Continuations in C# and F# Part 2

    • 3 Comments
    In my last post I went over the differences between using a continuation in F# and C# . As it turns out I was right about the limits and symptoms but wrong about the reason. The F# code does indeed generate tail calls for part of the continuation....
  • jaredpar's WebLog

    Properly Incrementing an IntPtr

    • 7 Comments
    Just as native pointer types are moved around with pointer arithmetic in native code, it can also be useful to move IntPtr types around in managed code.  Say for instance there is an IntPtr available which points to a native array of Dog instances...
  • jaredpar's WebLog

    Comparing Continuations in F# and C#

    • 4 Comments
    Lately I’ve been playing quite a bit with F#.  I have several hobby projects I’m working on that take up a bit of my time.  But when I’m not playing around with F# I’m exploring ways to apply certain functional patterns to actual coding on the...
  • jaredpar's WebLog

    Dereference a double IntPtr

    • 3 Comments
    A common PInvoke question is how to deal with a double pointer.  More specifically, how can one dereference an IntPtr to another pointer without using unsafe code?  Dereferencing a double pointer is done the same way a dereference to any other...
  • jaredpar's WebLog

    PInvoke and COM objects

    • 4 Comments
    I've occasionally found the need to mix COM interop and PInvoke.  For certain scenarios it's just easier to code up a PInvoke declaration and function.  It's perfectly legal to include COM objects in these scenarios provided the appropriate...
  • jaredpar's WebLog

    Stop the Beeping!!!

    • 2 Comments
    Recently I was working on a PowerShell script which involved translating byte arrays into strings using the appropriate encoding.  Unfortunately I kept getting the wrong choice for encoding and printed out essentially random data to the console screen...
  • jaredpar's WebLog

    Presentation Follow up

    • 1 Comments
    Thanks to everyone who showed up at the presentation on monday .  For those interested, I've uploaded the contents of the presentation here .  I was unable to upload the large DB file used during the demo due to size limitations (sky drive will...
  • jaredpar's WebLog

    Is IntPtr(long) truncating?

    • 1 Comments
    The short answer is: No, not when it matters A colleague and I were discussing a particular scenario around IntPtr,PInvoke and 64 bit correctness.  Eventually our discussion lead us to the IntPtr constructor which takes a long.  To my surprise...
  • jaredpar's WebLog

    Properly handling a WinForms Timer event

    • 4 Comments
    The WinForms Timer class allows the user to perform a particular action at a set interval.  Timer objects fire a Tick event at the set time which users can easily respond to.  This is very useful if a developer wants to check for a particular...
  • jaredpar's WebLog

    Redefining Success

    • 1 Comments
    Spent about an hour debugging a bit of code today.  I was attempting to read data from a particular source and kept getting back failure codes.  After some debugging I discovered the data didn't actually exist in the source I was reading from...
  • jaredpar's WebLog

    Presenting at Net Developers Association Meeting Oct 27

    • 1 Comments
    I will be presenting at the Net Developers Associating meeting this upcoming Monday.  If you're interested in hearing me ramble on in person please drop by.  Event Details: When: Oct 27 7:00PM Where: Microsoft Building 40: The Steptoe Room ...
  • jaredpar's WebLog

    When can you catch a StackOverflowException?

    • 0 Comments
    Answer: When you're the one who threw it.  Starting with the CLR version 2.0, the policy for handling a StackOverflowException was changed.  User code can no longer handle the exception[1].  Instead the CLR will simply terminate the process...
  • jaredpar's WebLog

    Program Files, I just want the 32 bit version

    • 0 Comments
    As part of my transition into using 64 bit windows I keep running into a problem with some scripts.  I have a whole set of Powershell scripts that are dedicated to ensuring certain programs are installed on all of my dev machines.  Or that certain...
  • jaredpar's WebLog

    Custom Exceptions: When should you create them?

    • 5 Comments
    I think the best answer is: rarely.   It's really hard to go straight to a justification here though.  I find that answering a different question will eventually shed led on when to create a new exception. "What are the benefits of...
  • jaredpar's WebLog

    Community Interview

    • 1 Comments
    Recently I did a community interview with Microsoft MVP Alessandro Del Sole .  The Italian version can be read here.   And no, I don’t speak Italian.  The original transcript is below. 1. Nice to meet you Jared Parsons! Let’s begin by asking...
  • jaredpar's WebLog

    Powershell and 64 bit windows helper functions

    • 0 Comments
    Recently at work I started using Windows 2008 64 bit edition.  Mainly for hyper-v but powershell also comes as part of the deal.  I'm starting to work through the fun issues of getting some of my environment specific scripts to run in a 64 bit...
Page 4 of 13 (321 items) «23456»