Posts

C# woes - "call is ambiguous between the following methods" - identical methods

Oh the irony. An ambiguous message about ambiguous methods. As you'll notice, the conflicting method names are the exact same: Error 48 The call is ambiguous between the following methods or properties: 'Ecommerce.Core.Helpers.DateTimeHelpers.Verify(System.DateTime?)' and 'Ecommerce.Core.Helpers.DateTimeHelpers.Verify(System.DateTime?)' C:\Ecommerce\Ecommerce.Core\Helpers\DateTimeHelpers.cs 9 24 Ecommerce.Core The issue here was that my Ecommerce.Core project was referencing itself. Yes, you heard that right. At first I assumed I was responsible but upon closer inspection it looks like Visual Studio or a Visual Studio plugin was responsible for automatically adding the reference... I removed the reference and, voila, the error (actually hundreds of errors for various methods) disappeared. I don't mean this in a cynical way, but I would legitimately like to know if there are any valid use cases for a project referencing itself.

Sublime Text 3, SublimeREPL and CLISP

You may get the following file not found error when attempting to combine CLISP (I installed via MacPorts, but I'm guessing this works the same for homebrew...) with SublimeREPL in Sublime Text 3 on OSX. FileNotFoundError(2, "No such file or directory: 'clisp'") Essentially, you need to tell SublimeREPL where to find the CLISP binaries. Simply add the following line to your SublimeREPL user configuration file (Sublime Text->Preferences->Package Settings->SublimeREPL->Settings - User) "default_extend_env": {"PATH": "{PATH}:/opt/local/bin"}

Review: Functional Thinking

Image
Disclosure: I received a review copy of this title from O’Reilly Functional Thinking by Neil Ford of Thoughtworks is another great series in the O'Reilly video library. As I've come to expect from O'Reilly videos, the production quality, picture and audio are excellent. The content is also pretty great. The key to this title is in the name - Functional Thinking . The aim of these videos isn't to teach a specific functional programming language, and you won't be fluent in a specific language as a result of watching them. Instead, the focus is on thinking a little bit differently. As Mr. Ford emphasizes: learning functional programming isn't comparable to learning a new language - it is a new way of thinking. This is a very important distinction and one i'm glad that the author made. I'd recommend this title for seasoned developers who are new to the functional programming world. The videos seem intended for use by those already schooled in object-...

Responsible use of the ASP.NET MVC AntiForgeryToken

The use of anti-forgery tokens is a necessary safeguard against cross-site request forgery attacks. The ASP.NET MVC framework provides easy-to-use security mechanisms right out of the box, but unfortunately these are opt-in rather than opt-out and are easy to miss/forget. For a non-trivial website it is difficult to guarantee tokens are supplied and checked in all form submissions and AJAX posts. This is how I do it. Note: Web security is a tricky business and I do not consider myself a security expert. Use the information in this post at your own risk. 1. Use the ValidateJsonAntiForgeryToken attribute for AJAX calls There's a nice post by Johan Driessen on anti-XSRF validation with newer versions of the .NET framework. I use Johan's ValidateJsonAntiForgeryToken attribute to great effect. In summary, Johan's attribute should be applied to actions invoked via AJAX calls. Check out his blog post - it explains everything in detail. 2. Ensure all AJAX posts conta...

Mocking NHibernate with Typemock Isolator is Awesome

Note: I am not affiliated in any way with Typemock Unit testing methods that contain NHibernate calls is notoriously difficult. In fact, a common suggestion is to give up and use an in memory database instead. This is fine (I've personally tried it on multiple occasions), and it works I suppose, but has always felt more like integration testing than unit testing (what happened to "no external dependencies"?..perhaps I'm a purist) and undoubtedly slows down the test suite - especially in all but non trivial cases where reference data needs to be loaded. I'm a novice Isolator user and messed around with the RecordExpectations syntax for a little bit before realizing just how simple Isolator makes things. Once you understand the warnings that Typemock puts out there, things get really easy. Really easy . First Attempt Let's say I wanted to fake the count of the products currently mapped to a specific category on my website. Normally the chained nature...

Review: Computer Science Programming Basics in Ruby

Image
Disclosure: I received a review copy of this title from O’Reilly Computer Science, more than any other field I know of, poses a difficult balance between theory and practice. It is difficult to understand the theory without having some practical knowledge. It is difficult to teach the practical aspects of Computer Science without a solid foundation in theory. I'm years into my development career and still discovering the true value of CS concepts I was able to mentally retain long enough to sit an exam. I wanted to review this book for 3 reasons: 1. I am on a mini ruby kick at the moment and am reading/viewing everything I can get my hands on 2. I wanted to see how Computer Science was taught from a non traditional language (C/Java) standpoint 3. I wanted to fill any holes in my knowledge and/or revisit what I've already forgotten The book is a short read, at 188 pages, yet does an admirable job of providing a basic overview of both the core Ruby programming language and s...

Review: Strata Conference New York + Hadoop World 2012: Complete Video Compilation

Image
Disclosure: I received a review copy of this title from O’Reilly This set is without doubt my favorite set of O’Reilly videos to date. If you’ve read my earlier reviews you’ll know that I’m a big fan of O’Reilly’s videos and conferences. What differentiates this set is that combines the usual diversity of topics from a good tech conference with numerous deep dives - groups of videos with 4 or 5 titles in the set that dig deeper into a specific subject.  As with previous O'Reilly content that I have reviewed, the production quality of this set is amazing. Video is high definition, sound is crystal clear and, while not cheap, at a whopping 107 hours the set is very reasonably priced at $400. So far some of my favorite talks have been:   An Introduction to Hadoop – Mark Fei This talk demonstrates everything that is great about this conference and video set. In this 4 part introduction to Hadoop Mark Fei does a great job of introducing MapReduce, core Hadoop and hdfs and ...

Exception: Method 'MS.Internal.Interop.PROPVARIANT..

I’ve used NopCommerce for years and have had very few issues. For the last few days a project which had been working without issue broke down due to a runtime error on my development machine. The error was an unhandled ReflectionTypeLoadException exception but the LoadException properties showed something more obscure – the following error when attempting to load an assembly: [Exception: Method 'MS.Internal.Interop.PROPVARIANT..ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)' is security transparent, but is a member of a security critical type.] What threw me off the scent was the fact that I received the same error on my desktop PC and my recently formatted laptop environment. This led me to believe the issue was with the code but, having gone back through GIT and failing to build numerous commits previou...

Installing Couchbase on Windows 8

This weekend I played around with Couchbase’s caching infrastructure on my Windows 8 box. Getting things set up was a bit of a nightmare, but thanks to some perseverance and much Googling, I got things up and running. You’re likely to run into two issues post install: Post install: Navigating to localhost:8091 resulted in an error page Upon successful login: the Active Servers count is 0 and the Servers Down count is 1 The following guide should address both issues Installation Guide Install Couchbase as usual Fix IP Address issue . For some reason the registration process generated a strange IP address on my box. Looking at the registration script it became obvious that the IP was saved and subsequently read from an ipaddr.out file Copy the file C:\Program Files\Couchbase\Server\bin\ipaddr.out to your desktop and replace the IP with 127.0.0.1 Copy the modified version back to C:\Program Files\Couchbase\Server\bin\ Replace tcmalloc binary (glad somebody smarter figured t...

Setting up Android Debugging on a Nexus 4

My beloved Nexus 4 – seriously, I LOVE the thing! - has inspired me to write some Android Apps. I haven’t used Eclipse in years, and have never written a non-hello-world Android App, so had some teething issues getting started with on-device debugging. Here are a few tips for the uninitiated: Enabling debugging on Jellybean and above is interesting. Developer Options are not enabled by default and to make them visible you need to go to Settings->About Phone and tap Build number 7 times! You even get a playful message indicating when you are halfway there… Once you’ve performed step #1, go back to settings on your phone and Developer Options should now be present. Make sure to enable USB debugging. Your system may recognize your N4, but that doesn’t necessarily mean that it has the driver it needs for debugging. Typing adb devices in the command prompt from the ADT’s sdk\platform-tools folder will enumerate the devices on your system. If you see one, ignore this step Otherwis...