Tuesday, December 29, 2015

pslist not working – solved

I’m a huge fan of Sysinternals tools, and one of my favorites – pslist – suddenly stopped working one day after a reboot. The error message I received was:
Processor performance object not found on PC01
Try running Exctrlst from microsoft.com to repair the performance counters.
The Exctrlst in question is from the Windows Resource Kit. After installing and running the Exctrlst utility, it still didn’t work. Luckily, more Googling led me to running this command:
lodctr /r
Which of course didn’t work either. First I got an error code 5, which I recognized as the old “Access denied” error code, so I ran it again as Administrator. No dice. That just gave me an error code 2.
More Googling until I found the following solution:
C:\> cd C:\Windows\SysWOW64
C:\Windows\SysWOW64> lodctr /r
Info: Successfully rebuilt performance counter setting from system backup store
Yay! And finally:
C:\Windows\SysWOW64> winmgmt.exe /RESYNCPERF
C:\Windows\SysWOW64>
A subsequence pslist worked perfectly.

Tuesday, December 22, 2015

Bootstrap horizontal scrollbar mystery solved

Sometimes when creating a Bootstrap-based site, I've had a pesky problem with a horizontal scrollbar that appears and just won't go away. It turns out the root cause -- and the solution – are simple.
Essentially, make sure any “row” div is inside a “container” div, e.g.:
Wrong
<div class="row">
    <div class=”col-md-12”>This is some content inside the column</div>
</div>
Right
<div class=”container”>
    <div class="row">
        <div class=”col-md-12”>This is some content inside the column</div>
    </div>
</div>

Tuesday, December 01, 2015

Git TFS with Git 2.5 and above - Solved!

I experienced the same issues as the OP here: https://github.com/git-tfs/git-tfs/issues/845

In my case:
$ git tfs clone https://me.visualstudio.com/DefaultCollection/_versionControl $/MyProject
TFS repository can not be root and must start with "$/".
You may be able to resolve this problem.
- Try using $/C:/Program Files/Git/MyProject
The solution, courtesy of dscho: an msys2 flag that looks like the most bastardized bash syntax in the world, but apparently works. (Is this valid bash or a special msys2 thing?)
$ MSYS_NO_PATHCONV=1 git tfs clone https://me.visualstudio.com/DefaultCollection/ $/MyProject
Initialized empty Git repository in C:/Projects/MyProject/.git/
This is documented in the release notes here: https://github.com/git-for-windows/build-extra/blob/master/installer/ReleaseNotes.md#known-issues

EDIT:

You can also double up the initial quote after the $, e.g.:
$ git tfs clone https://me.visualstudio.com/DefaultCollection/ $//MyProject
Initialized empty Git repository in C:/Projects/MyProject/.git/


Tuesday, January 27, 2015

Doug Crockford on Monads and JavaScript

He's not the father of JavaScript, he's more the strongly opinionated caretaker.

Here is his fascinating YouTube video on JavaScript and Monads.

Here is the sourcecode: https://github.com/douglascrockford/monad

He covers four monads in the talk:

  • The Identity Monad
  • The Ajax Monad
  • The Maybe Monad, which eliminates the possibility of a null -- very cool!
  • The Promise Monad, which apparently is not agreed upon by all to be a monad

Two links he mentions

Carl Hewitt, inventor of the Actor Model

Mark Miller, Secure Distributed Programming with Object-capabilities in JavaScript

How to Page in ASP.NET Web API

Great article. There are several ways of doing it, including the Twitter way, which handles infinite feeds in real-time scenarios using cursors.

Paging in ASP.NET Web API: Introduction | Jerrie Pelser

Cool Visual Studio Extensions From Mads Kristensen

Mads, the author of the essential Web Essentials extension for Visual Studio, has created a number of other plugins and extensions as well. Here's a link to two blog posts by him describing these extensions.

New handy Visual Studio extensions
New handy Visual Studio extensions - part 2

Monday, January 26, 2015

Learn F# or Haskell?

Here's a side-by-side comparison of ML dialects, of which F# is one, with Haskell:
ML Dialects and Haskell: SML, OCaml, F#, Haskell - Hyperpolyglot

Then there are the various "99 Bottles" F# implementations. Interestingly, Don Syme's is one of the longer version. He is the creator of F# and arguably knows it the best.
99 Bottles of Beer | Language F#

Here's the Haskell version:
99 Bottles of Beer | Language Haskell

Friday, January 23, 2015

ASP.NET - don't minimize files if you're bundling!

If you've got bundling turned on, the ASP.NET bundling library will choose the already minimized instead of minimizing it at runtime. This can cause problems if you have updated the the source file -- file.js or file.css -- and you haven't remimized it.

So don't minimize the file in the IDE. Alternatively, set up some sort of automation that will automatically minimize the file or your minimized CSS and JavaScript files will be out of sync and your won't know why.

See this StackOverflow question: ASP.NET Bundling - Bundle not updating after included file has changed (returns 304 not modified)

Thursday, January 22, 2015

Adding only non-whitespace changes in Git.

Sometimes it's useful to add only the non-whitespace changes because typically they'll be the meaningful content. This StackOverflow question show how to do that.

Here's the command to add everything, ignoring whitespace-only changes:

git diff -w | git apply --cached --ignore-whitespace


Link here: http://stackoverflow.com/questions/3515597/git-add-only-non-whitespace-changes