Posts

Running Linux CMD in Windows - the webpack Case

So I am learning now that consistency is key: I was working on a Single Page Application (SPA)  project in windows, but running the tooling (npm, webpack, etc.) from WSL, just because I think the Linux native commands work better from Linux.

Well, it turns out there are larger differences than I thought: In this particular case, I ran npm install from WSL, which in turn created the node_modules dir, and populated all my dependencies. So far so good. no weird errors or anyting, I tried before to run it from PowerShell and I got permission issues.

The bigger problem appeared when I tried to run my project from Visual Studio. I am not certain what commands are run when in VS that trigger the webpack process, and that webpack process failed miserably on my application. I started debugging and I found out I was not even able to run the webpack command from windows CMD!.

It turns out that depending on the environment you are, the files created are registered in different ways in the node_mo…

Running Linux CMD in Windows - the RipGrep Case

Not a new thing, lots of posts there about it.. I have been trying to get it to a nice point, and I think I have been able to.
I installed a new CMD client that actually works better than the one OOB.

Go to https://github.com/goreliu/wsl-terminal  to get it. It allows changing the default font, which is necessary if you want to run the cool Oh My ZSH extension, on the zsh shell.

Now, I installed Angular CLI, Docker CLI, GIT, and I am in a better place.

Recently I needed to use RipGrep on my shell, so I tried the mythical apt-get, with no luck. I Went online to find another way to do it, and the installation notes on RipGrep tell you to install using snappy (for Linux). That didn't work either. Snappy is not functional in WSL ­čśľ.

However, the Debian install did work! so I ran the commands stated for Debian :

$ curl -LO https://github.com/BurntSushi/ripgrep/releases/download/0.8.1/ripgrep_0.8.1_amd64.deb$ sudo dpkg -i ripgrep_0.8.1_amd64.deb
That allowed me to run rg from my CMD!

Unity in a webAPI project

I have just created a proof of concept for a client where I demo how to configure Microsoft's Unity DI container to resolve the API controllers and their dependencies.

The code is available in this github repository.

The concepts that I tried to showcase are

How to configure Unity in OWINHow to do automatic registration of IObject->Object references.How to use an injectionFactory to resolve object that depedn on dynamic data.Different Lifetime managersContainer Controlled (Singleton)Per Resolve (Once per request)Transient (Once per call)Unit testing an application with dependenciesAbstracting away the HttpContext from the controller, which is useful for unit testing.
Take a look and comment in the blog or in the repo..

Testing Exceptions in Nunit 4.7

I am getting in TDD a lot, and of course, when thinking in border cases, you'll end up throwing exceptions, And you'd want to see ith they get thrown. With Nunit 4.7 the thing is that If, for example, you're testing that some parameter is null, when you decorate your test with [ExpectedException] it eventually gets thrown, but You'll never know what piece of code actually did it...
So, I created this little R# snippet to test excxeptions in a more granular way:
[Test] public void $TestName$() { try { $Code$ } catch (Exception e) { Assert.That(e, Is.TypeOf(typeof($ExpectedException$))); $END$ return; } Assert.Fail("Did Not Throw the Exception."); }
For example, if you want to test if a parameter is null before you excercise some code, you could have a test like this:

[Test] public void Intermediary_ParamOneCannotBeNull() { try { new Intermediary(null, null); } catch(Exception e) { Assert.That(e, Is.TypeOf(typeof(ArgumentNullException…

Alt.NET in Colombia

I recently found @jorgegamba, which has been very active on VAN meetings for hispanic community.

He is also from Colombia and share the same interest on making Alt.Net widespread on Colombia.

He is trying to build a community for Colombian programmers who want to grow as agile .net programmers. I beleive is a very good initiative and I'm planning on supporting his idea any way possible.

Adelante Jorge!

Debugging Sharepoint Applications

When developing sharepoint apps, it becomes a pain in the neck to know what process to lint to (via debug-attach process) because it usually has many w3wp process running, and knowing which is the one you need is usually a trial-and-error thing.

Spence Harbar has a very handy application called Application Pool Manager which lets you do several things:

1. Reset application pools, which is faster than iisreset.
2. Show the list of application pools running
3. Establish which application pool has which process ID associated, and refresh it if someone else recycled them (i.e. VSeWSS)

This way, by just having a look at the tool's menu, you can know for sure what process ID you need to attach to!

Firefox add-ins I use

I love the customization FF can give you!! I have a lot of add-ons installed, preety useful for all my work and browsing time:
All in one gestures :
Lets you have mouse gestures to control your browser
Distrust:
erases all browsing info from a session (useful when browsing in sites that can install sw in your machine)
Firebug:
Developer toolbar... lets you analyze your HTML and http traffic
FlashGot:
DL manager, I use it with FlashGet to manage my dls, it even let you DL Toutube moveies!!!
Google Gears:
With this addon I can work Google docs, Gmail, Calendar offline!!
Google Toolbar:
the classic one!
IE Tab:
Lets you open a page in FF using the engine of IE.MileWideBack:
allows you to navigate and close tabs using the left margin of your browser.
ScreenGrab:
capture screenshots of your pages
TabSidebar:
shows you all open tabs in a vertical toolbar, showing a thumbnail of the page. you can even browse back and foth without having to switch to that tab.
Web Developer Toolbar:
Lots of goodies for We…