Copying Build Artifacts for Visual Studio MSBuild

Lately, I’ve been working to integrate a client-side build process to a project at work.  The idea is that I would like to be able to transpile my TypeScript files through webpack and include them in my published solution.

I added my webpack build command to the pre-build commands section in my web project and thought that I would be good to go. Nope.

I ran into a road block.  Build artifacts (like my output folder that webpack puts all of the transpiled files into) don’t automatically get pushed out on publish of the web project.

After a long while testing out ideas to no avail, I finally found a solution.

If you add this target near the end of your web.csproj file, it’ll add your output directory to your published solution. (note: TypeScriptCompiledToJS was my output directory that I wished to get pushed to the published output.  You could change that in this solution to whatever name you need.)

<Target Name=”CopyTypeScript”>
<Message Text=”Copy Typescript Files” Importance=”high” />
<_CustomFiles Include=”$(ProjectDir)\TypeScriptCompiledToJS\**\*” />
<FilesForPackagingFromProject Include=”%(_CustomFiles.Identity)”>

How To Use the PayPal API with Certificate Authentication

I have struggled to find good documentation for authenticating with paypal via a certificate. I have found a few blog posts, but none of these had definitive answers on how to implement it. I’m going to be explaining how to get things setup on Windows with .NET code. However, most of the content in here will be useful for any platform, with some minor tweaks.

Convert cert_key_pem.txt to p12

Using OpenSSL, convert to the key you received from PayPal to pkcs12 format. Keep track of the password that you choose for later reference.

openssl pkcs12 -export -in cert_key_pem.txt -out cert_key.p12

Install p12

Note: I’m going to install it via command line and give permissions to “NETWORK SERVICE” so that IIS can access the certificate.  This will probably be different for OSX and Linux and also may vary depending on your programming language of choice for communicating with paypal.

First, change directories to where you saved your .p12 file.

Then you can either, try installing the cert from the directory you saved the .p12 in. Note: if you don’t have WinHttpCertCfg installed, you can get it here. It comes preinstalled on Windows Server, but if you’re testing on your developer machine, you’ll need to download it.

Make sure you are running your command prompt/powershell as an administrator during this step:

“C:\Program Files (x86)\Windows Resource Kits\Tools\WinHttpCertCfg” -i cert_key.p12 -p P@ssw0rd -c LOCAL_MACHINE\my -a “NETWORK SERVICE”

Or, if that gives you issues, you can change directories to “C:\Program Files (x86)\Windows Resource Kits\Tools\” so that you can run WinHttpCertCfg.exe in its folder.

.\winhttpcertcfg -i C:/path/to/key/cert_key.p12 -p P@ssw0rd -c LOCAL_MACHINE\my -a “NETWORK SERVICE”

At this point, you should get a message indicating that you’re certificate was imported.

If you’re not programming in C# for .NET, you can ignore the rest of this section. At this point, you’re certificate is installed and ready for use.

The Code

Where you are creating your HttpWebRequest, you can add your certificate information onto the request like:

var request = (HttpWebRequest) WebRequest.Create(WebConfigurationManager.AppSettings[“PayPalDataUrl”]);
var certPath = GetCertificatePath();
var certPassword = GetCertificatePassword();

var cert = new X509Certificate2(certPath, certPassword, X509KeyStorageFlags.MachineKeySet);


This will add the certificate to be used as authentication and you would add the rest of the request like you would with signature authentication.

At this point, you should be ready to use this certificate to authenticate your paypal express checkout order with paypal.

I plan to improve this document as I remember snags that I went through to get this working for my site. If you have any questions, or feedback, I will gladly like to hear it.

How to get Twitter Bootstrap Modals working in Internet Explorer 7

Many of you out there have been tasked with getting a website running in Internet Explorer 7 or earlier.  It can very difficult depending on the web technologies that you are using.  In personal projects, I have decided to never support legacy internet explorer versions because it’s not worth it to me.  However, if you work at a large company, this could mean A LOT of money lost from potential clients or customers.  without further ado, let’s talk about Twitter Bootstrap Modals.

Twitter Bootstrap Modals

Twitter Bootstrap Modals are very nice to deal with, unless you need to support IE6 or IE7.  For the project I’m currently working on, I needed to get them to work in IE7 (I’m lucky to not have to support IE6.. phew..).  For some reason, the default functionality when you test them in IE7 is that the backdrop appears in front of your modal.  If you click on your modal (which is seen but clearly behind the backdrop), your modal is dismissed as though you clicked away from the modal.

The fix is simple.  In a script at the bottom of your page, you need to append your modals to the end of the body.  I’m not exactly sure why this works, but it does.  My theory, without looking much into the code, is that the backdrop is appended at the end of the body on load and is hidden by default and that since it’s at the end of the DOM, IE7 believes that it should be in the very front of all of your content (dispite z-index, which for some reason, it does not obey).

The Fix

Here is the fix that you should add after your document is ready:



If you are depending on the form that the modal is contained in, you may want to do something like this to ensure that the click of your submit button propagates to submit the correct form:

Note: I’m using $.each for brevity, I would not use $.each in the end product if you are using a lot of javascript on load.

var modals = $(".modals"),

$.each(modals, function(i, modal) {
    form = modal.closest("form");
    submitButtons = modal.find("input[type='submit']");

    if(form && submitButtons.length) {
        (function(localForm) {
            $.each(submitButtons, function(i, button) {
                button.on("click", function() {


Hope this helps you get your modals working

Note: I’m not sure if this will work in IE6, but it’s worth a try.

What the Tech Industry Has Learned From Linus Torvalds

How to install nerdtree for vim using pathogen

Lately, I’ve been experimenting with vim because of many posts I’ve read about how productive of a coder you can become, once you’re used to all of the commands and shortcuts: here, here, and here.

When browsing the interwebs, I found that many people use a cool plugin called nerdtree to navigate between files quicker.  I started to try to install the plugin for vim and for me, it was difficult.  I’m running Ubuntu 12.04 and am relatively new to vim. So I’m going to share the process I went through to get it up and running.

Install Pathogen

I’ve found that if you install a vim plugin called pathogen, that it makes installing other plugins a lot easier.

First, you need to create the environment for pathogen by entering these commands into your terminal:

mkdir -p ~/.vim/autoload ~/.vim/bundle;
curl -Sso ~/.vim/autoload/pathogen.vim

If that didn’t work for you, you will need to install curl by entering this into your terminal:

sudo apt-get install curl

if you are new to vim and do not have a .vimrc file, create one with vim:

vim ~/.vimrc

and paste the following lines to the end of your .vimrc file:

” Pathogen
execute pathogen#infect()
call pathogen#helptags() ” generate helptags for everything in ‘runtimepath’
syntax on
filetype plugin indent on

Now we’re ready to install nerdtree. (or any other vim plugin for that matter)

Install nerdtree

You can easily download and install nerdtree using this command:

cd ~/.vim/bundle
git clone

Next, start a vim session and type

:help NERD_tree.txt

To toggle the directory listing between visible and hidden states use


An Open Letter to Wikipedia

Earlier today, Philip Roth posted an Open Letter to Wikipedia after he was unable to have some false contributions removed from the Wikipedia article on his own novel, “The Human Stain.”

I am Philip Roth. I had reason recently to read for the first time the Wikipedia entry discussing my novel “The Human Stain.” The entry contains a serious misstatement that I would like to ask to have removed. This item entered Wikipedia not from the world of truthfulness but from the babble of literary gossip—there is no truth in it at all.

Yet when, through an official interlocutor, I recently petitioned Wikipedia to delete this misstatement, along with two others, my interlocutor was told by the “English Wikipedia Administrator”—in a letter dated August 25th and addressed to my interlocutor—that I, Roth, was not a credible source: “I understand your point that the author is the greatest authority on their own work,” writes the Wikipedia Administrator—“but we require secondary sources.”

It turns out that Philip Roth is actually pretty credible. This situation indicates that there is something seriously wrong with the Wikipedia process. The English Wikipedia Administrator should not have simply denied the change request based on Philip Roth’s lack of secondary sources.  I suggest that you read his Open Letter to hear it in his own words.

The iPhone 5


The event invitations are out.  It’s official.  First reported by Jim Dalrymple from The Loop, Apple’s upcoming event is happening on September 12th, 2012.  It will take place at the Yerba Buena Center for the Arts at 10:00 am.

There is almost no question that Apple will unveil a new iPhone.  What it will be named remains unknown.  From the shadow in the above photo, that was sent with the invitation, we see that it shows the number “5.”  This could mean a few things. First, it could mean that it will be called the iPhone 5.  Second, it could mean that they will be releasing five things (such as the new retina iMac, new iPhone, new iPod Nano, new iPad mini, etc.)  When Apple released the latest generation of iPad, they rebranded it to “the new iPad.”  Apple could end up rebranding the iPhone as well and dropping the version number from the name.

One thing is for sure.  It’s almost here.

%d bloggers like this: