NDC London – Day Three

Tags

Miguel%20Castro
Day 3 – Knocking it out the park, with KnockoutJS by Miguel A. Castro (@miguelcastro67)
The first talk I attended on day 3 was Knocking it out the park, with KnockoutJS by Miguel A. Castro

Miguel’s talk walked you through KnockoutJS, what you would use it for and showed you several demos as he went building upon each one as he covered more and more on KnockoutJS. Miguel is a very good speaker, his talk was very well delivered and flowed excellently – his demos were useful and were very well explained.

Damian%20Edwards
Day 3 – ASP.NET SignalR 2.0 and beyond by Damien Edwards and David Fowler(@DamianEdwards)
The second talk on day 3 I attended was ASP.NET SignalR 2.0 and beyond by Damien Edwards and David Fowler

Damien Edwards and David Fowler introduced everyone to a new major version of SignalR and what has been added/updated.
There is tighter integration with OWIN, .NET 4.5 server dependency, full support for self-hosting, new clients, massively improved cross-domain/CORS support, API usability improvements, easier hub unit testing and better error handling. We’ll cover all this and give a sneak peak and new features in upcoming releases in this information packed session. Very informative talk which I enjoyed.

Mads%20Torgersen%20324
Day 3 – The future of C# by Mads Torgersen (blogs.msdn.com/b/madst/)
The third talk I attended on Day 3 was The future of C# by Mads Torgersen

Mads talked about how the past several years, the Microsoft C# team has been focused on rebuilding the compilers and editing experiences as part of Project Roslyn. He also introduced us to potential new language features are on the designers’ minds. Features discussed included read only auto properties, multiple return values, null checking, structural typing is ‘on the radar’.

Jessica%20Kerr3%20256
Day 3 – Object Oriented Design in the Wild by Jessica Kerr (@jessitron)
The fourth talk I attended on Day 3 was Object Oriented Design in the Wild by Jessica Kerr

Jessica talked about the reasoning behind object-oriented design principles, and how we find their application in the wider world. This session will challenge you to go beyond rules and standards and ask, when is clean code worth your time? Go beyond OO and come back with new insight. Interesting talk all about OO in different languages.

David%20Fowler1%20324
Day 3 – ASP.NET SignalR 2.0 and beyond by Damien Edwards and David Fowler(@davidfowl)
The fifth talk on day 3 I attended was Using ASP.NET SignalR in Anger by Damien Edwards and David Fowler

Damien Edwards and David Fowler What showed off the best patterns for using SignalR in a real application – both guys walked through code samples of how to go about doing such a thing and discussed a number of topics including when best to use SignalR as opposed to other technologies.

NDC London 2013 – Day Two

Scott%20Guthrie%20London
Day 2 – Build Real World Cloud Apps using Windows Azure Part I and II by Scott Guthrie (@scottgu)
The first and second talks I attended on day 2 were Build Real World Cloud Apps using Windows Azure Part I and II by Scott Guthrie

Scott gave a two part covering the following:-

•Automating Everything
•Source Control Best Practices
•Continuous Integration/Delivery
•Enterprise Identity and SSO Integration
•Web Development Best Practices
•Data Storage Options
•Data Storage Partitioning Approaches
•Using unstructured Blob storage
•Designing to survive failures
•Monitoring and Diagnostics
•Transient Fault Handling
•Distributed Caching
•Using the Queue Centric Work Pattern

Was a really great insight into the capabilities of Azure and how as developers we can use these features for building applications right now.

Jeremy%20D%20Miller
Day 2 – Automating Testing in the big, bad Enterprise World by Jeremy D. Miller (@jeremydmiller)
The third talk on day 2 I attended was Automating Testing in the big, bad Enterprise World by Jeremy D. Miller

Jeremy discussed how his team has a strategy for faster and more productive manual testing and troubleshooting when using RavenDB and just how easy it is to use RavenDB for in memory creation and deletion of the entire database for unit testing purposes. He talked about how automated testing efforts frequently fail because the tests are too time-consuming to author, too brittle when the underlying application changes and showed examples of how he tried to make this process easier.

Robert%20C%20Martin
Day 2 – Functional Programming: What? Why? When? by Robert C. Martin (Uncle Bob) (@unclebobmartin)
The fourth talk I attended on Day 2 was Functional Programming: What? Why? When? by Robert C. Martin (Uncle Bob)

Uncle Bob talked about a number of things from the past to the future and was as always very entertaining but also thought provoking – this guys a legend and listening to him talking was a pleasure.

Burke%20Holland%20324
Day 2 – AngularJS Directives And The Computer Science Of JavaScript by Burke Holland (@burkeholland)
The fifth talk I attended on Day 2 was AngularJS Directives And The Computer Science Of JavaScript by Burke Holland

Burke gave us a run through of Directives in AngularJS, what they are and how they work showing code samples.

TimGThomas%20324
Day 2 – Test Your Javascript…with the Help of D&D by Tim G. Thomas (@timgthomas)
The fifth talk I attended on Day 2 was Test Your Javascript…with the Help of D&D by Tim G. Thomas

Tim talked about how testing JavaScript—the modern Web’s ubiquitous development language—can be a daunting task. In his session he introduced us to some methods to do just that…but with a Dungeons and Dragons twist.

NDC London 2013 – Day 1

Tags

Dan%20NorthKeyNote with Dan North – JackStones: the Journey to Mastery (@tastapod)

Dan’s talk was about how you go about becoming a Master at something and was very insightful, Dan talked about a lot of cool stuff and talked about learning how you learn to become at whatever it is your trying to master.

Dan described some of the many facets of craftsmanship and talks about trying to figure out exactly what the craft is that we programmers do.

Venkat%20SubramaniamDay 1 – Cleaning up Code Smell by Venkat Subramaniam (@venkat_s)
The first talk I attended was Cleaning Up Code Smell by Venkat Subramaniam – his talk was covering ways to identify code smell, how to clean them up. We will also discuss proactive ways to avoid smells in the first place.

Venkat is a superb speaker and covered a lot within 1 hour, his talk was well delivered and he cracked a few good jokes along the way, very entertaining talk.

Mark%20Rendle%20324Day 1 – Simple.Web 101 by Mark Rendle (@markrendle)
The second talk I attended was Simple.Web 101 by Mark Rendle – his talk was covering his .NET/Mono web framework Simple.Web.

Simple.Web applies the SOLID design principles to web application development, and makes building web applications an experience of the deepest joy. Simple.Web makes keeping your code clean, and building real REST/HATEOAS APIs.

Mark talked about why he wrote Simple.Web, showed us some of the code and then showed off some examples of how to use Simple.Web in an application

Scott%20Guthrie%20London
Day 1 – Introduction to Windows Azure Part I and II by Scott Guthrie (@scottgu)
The third and fourth talks I attended was Introduction to Windows Azure Part I by Scott Guthrie

Scott gave a two part talk which provided an overview of Windows Azure – including a number of demos, and how you can take advantage of it to build great applications in the cloud. His talk was a superb introduction to what Azure is and how you can leverage Windows Azure to build great applications. As always his talks were very informative, every question was given a detailed answer and was a really great way to learn about what Azure can do.

Michele%20Bustamante%20324
Day 1 – Windows Azure Essentials by Michele Leroux Bustamante (@michelebusta)
The fifth talk I attended was Windows Azure Essentials by Michele Leroux Bustamante

Michele’s session was aimed at getting you up to speed on the essential features developers should be aware of, and how to apply them in practical scenarios on all aspects of Windows Azure.

Michele showed off the differences between web sites and cloud services, as well as other practical tips for building Azure apps such as storing content, sending email, working with queues and choosing the right technology, and collecting important metrics for visibility into application health.

Dan%20North
Day 1 – Why Agile doesn’t scale – and what you can do about it by Dan North (@tastapod)
The sixth and final talk I attended was Why Agile doesn’t scale – and what you can do about it by Dan North

Dan talked about shared guiding principles, a clear vision and a common understanding enable what he called contextual consistency. He also talked about delivery assurance, governance and portfolio management in the enterprise.

Was a very interesting talk and a nice end to the day.

NDC London 2013 – big thank you to all

Tags

ndc_london_Ben_front2

NDC London was last week and I have to say I enjoyed every second of it.

This was my first conference and I will hopefully be back, the content each day was fantastic, the choice of content varied enormously and the people who run it, sponsor it and attend it deserve huge credit.

Having the chance to talk to developers from all over the world working on all sorts of projects and that was probably my favourite part of the conference, hugely grateful to my company for giving me this opportunity.

I will cover the 3 days I attended in a separate blog post but for now I just wanted to take the time to thank everyone involved, I managed to chat with of attendees and met some folks I chat to on twitter which was pretty cool.

Big thanks to the guys at Redgate who I managed to chat to and get a demo of some of their tools which I haven’t had the chance to try out as yet, was really nice to put a face to some of them.

I now have my blogging mojo back and have lots of content to go off and learn about – the next blog post coming soon will cover each of the 3 days I spent learning new technologies.

Thanks once more to all involved – hopefully see you again.

Visual Studio 2012 Remote Debugging – how to getting it working

The last couple of days I’ve been trying to figure out why a console application we use at work was throwing an error whilst trying to connect to oracle, we had some issues with Devart’s DotConnect for Oracle throwing the following error – ‘Error loading db connection’

Having tried a number of options it was suggested to me that I should try remote debugging, something that I had never actually done before, odd I know but I had never set this up so below are the steps I followed to get it working:-

  • Download and install Remote Tools for Visual Studio 2012 Update 2 here – (Make sure to install the correct version x86 or x64).
  • I then started the Remote Desktop Service making sure to ‘Run As Administrator’. An entry with the date and time and a description will be shown once we connect to the remote debugging service.
  • In my case I wanted to debug a console application – so I ran the console application (on the remote server)
  • Make sure to have your VS 2012 solution open, add some breakpoints to the code you’re looking to debug on the remote server – its important that the code on the remote server is exactly the same as the code which is open in VS 2012 – if not breakpoints wont be hit.
  • Now go back to Visual Studio and from the debug menu select Attach to Process, on this screen I change the Qualifier to the name of the remote server and select the console application process from the list of running processes on the remote server.
  • If you check back on the remote server it should say that you’ve connected to the remote debugger service.
  • If all is setup correctly then your breakpoints will be hit and hopefully you can figure out why your code wasn’t working
  • Turned out the licence file we had been using was empty and by debugging I was able to see a more detailed exception stack trace and information.

This is how I got it running fairly easily – if you run into any issues :- For more info on setting up remote debugging follow this link here.

Hope this helps someone out there.

RavenDB – Exporting and Importing using Smuggler

Tags

, ,

badge1Smuggler is a tool for RavenDB which is used for exporting and importing data – today at work I was shown a nice way to use it to take production data out and import it locally for just one collection of documents – something which might be useful and I know I will forget the syntax I the future for so blogging about it helps me know remember it and I can always read here again in the future if and more likely when I do forget it.

The syntax for exporting a collection called Categories would be as follows:-

smuggler

What are we doing here, well we are saying use Smuggler to export from the Catalogue Tenants database a dump file – we are also using metadata so that we are only exporting a collection of documents called Categories and then only the latest version so no revisions, and lastly only export the Documents so no Indexes or any other types of documents.

I wanted to then import this into my local instance of RavenDB so the following command does just that:-

smuggler2

This will import the Categories and override any existing Categories in my local RavenDB instance.

You can read more about smuggler here.

Hope someone finds that useful.

ElmahR – monitor errors in your app using a dashboard

Tags

, , ,

If your unfamiliar with Elmah and/or ElmahR then please take a quick look here.

If you’re using Elmah but haven’t taken advantage of ElmahR then read on.

If you have one or more application(s) which currently use Elmah then you can very easily add in ElmahR which gives you a superb dashboard from where you can monitor either one or all of you applications which log errors.

The dashboard is basically one webpage which makes very nice use of SignalR to display information regarding errors thrown by your application(s), so if you deploy something and you monitor this page and see the error count for your application counting up quickly then you know you have a problem. You can use the dashboard to monitor a number of applications on different environments for example.


Existing/New Web Application

  • Either create a brand new test web application or you can use an existing web application – add ElmahR to this application using the Nuget package as below:-
    ElmahR
  • Ok now that we have added ElmahR to a web application we need to configure it accordingly, open up the web.config and look for the elmah section, should look something like this:-
  • elmah1

  • Important – The sourceId setting needs to match the sourceId setting in our dashboard application’s web.config

DashBoard

  • Now lets create our dashboard, so create a new MVC or Web application, then add the Nuget package as below:-
    ElamhrDash
  • Now we need to edit the dashboard’s web.config so that the sourceId’s match, shown below:-
    elmahr3

Testing ElmahR is working

  • Within your web application we want to test that ElmahR is set up and working correctly, to do this we need to have an error generated, so deliberately add an exception, such as a throw new NotImplementedException() or similar into an area you can test quickly (e.g. index actionresult within the home controller in MVC)
  • Run the dashboard application, which should look something like this:-

    elmahr5

  • Then run your web application and browse to the page which will generate an error so we can see if it logs as we expect.
  • If you have everything configured correctly then you will see the error count change in the dashboard application, like so:-
    elmahr6

TroubleShooting

  • If you don’t see your application logging errors on the dashboard it’s usually the sourceId element or the targetUrl element within your web.config

Hope you find this of use and start using ElmahR.

If you get stuck or something isn’t working add a comment.

Code coverage results for your JavaScript

I wanted to find out if there were any tools that can display code coverage results for JavaScript code (without the need for Java on the server or having to use Node), I experimented with a few different frameworks, test runners and what not and have spent a couple of hours looking in to this, in the end I opted for the following:-

jasmine_logo At work we currently use Jasmine which is a behaviour-driven development framework for testing JavaScript code along with PhantomJS which we use to run the tests using a specrunner (there are several ways to do it but this works for now)

I have installed the Visual Studio Extension called Chutzpah which is a JavaScript Test Runner which gives you a few nice things such as integration with TeamCity and the ability to right-click and then select Run Tests similarly to unit testing your C# code with your favourite unit testing framework.

chutzpah

Ok so back to code coverage for our JavaScript code – Matthew the guy who created Chutzpah is working on integrating code coverage into the next release so in the mean time here is how you get it to work – enter one further library called Blanket.js – Blanket.js is used to give us the code coverage results and currently supports Qunit, Mocha and Jasmine. An adapter API exists for supporting other test runners.

At this point you might be thinking its a fair amount of work to get this going but I will simplify the steps required to get your JavaScript code outputting code coverage results.

  • Download Blanket.js and look for the file called blanket-jasmine.js, add this to your Scripts folder inside your web application. This file is blanket version that works with Jasmine.
  • Add the Nuget package jasmine.js jasminenuget
  • Add some JavaScript code as below for example this is code.js
  • var stringLib = {
        vowels: function (a) {
            count = 0;
            for (var i = 0; i < a.length; i++) {
                if ("aeiou".indexOf(a[i]) > -1) {
                    count++;
                }
            }
            return count;
        }
    }
    var mathLib = {
        add5: function (a) {
            return a + 5;
        },
        mult5: function (a) {
            return a * 5;
        }
    }
    
  • Add a JavaScript file with your Jasmine tests for the code above like so :-
    describe("general", function () {
        it("A basic test", function () {
            expect(true).toBeTruthy();
            var value = "hello";
            expect("hello").toEqual(value);
        });
    });
    
    describe("stringLib", function () {
        it("will get vowel count", function () {
            var count = stringLib.vowels("hello");
            expect(count).toEqual(2);
        });
    });
    
    describe("mathLib", function () {
        it("will add 5 to number", function () {
            var res = mathLib.add5(10);
            expect(res).toEqual(15);
        });
    
        it("will multiply 5 to number", function () {
            var res = mathLib.mult5(10);
            expect(res).toEqual(50);
        });
    });
    
  • Ok so we have some JavaScript code and Jasmine tests for the code, lets add some required links to our Jasmine specrunner page so we can see the code coverage
    results output to the screen, edit the spec runner like so:-

    specrunner2

    The above screen shot shows that we have added a reference to both our JavaScript code file and the file containing the Jasmine tests.

  • Now if we browse to the specrunner page for Jasmine we will see the results of the test – green for passed and red for failed (no code coverage results yet).

    jasmineresults1

  • Now lets show the JavaScript code coverage results – which is as simple as adding in the line to reference Blanket for Jasmine:-

    specrunner3

  • Refresh the specrunner page and you will now see your JavaScript code coverage results like so:-

    specrunner4

    The screen shot above shows us 100% code coverage, so no lines of JavaScript are coloured red (not covered)

  • If I comment out one of the tests we can see the difference below:-
    specrunner5
  • And there we have it code coverage results of your JavaScript, brief post but enough to get you started I hope, next time I will add this to TeamCity and see what that gives us.

KoLite – dirty flag and more

Tags

,

KoLite its written by John Papa and Hans Fjällemark and has helpers which add some extra very nice functionality to KnockoutJS.

I was working on a project which uses KnockoutJS and had the need to implement the idea of setting a dirty flag if a user made a change to a form, this would in turn enable a save button and allow the changes to be saved.

KoLite makes this very easy indeed, I decided to put together some quick code demonstrating the features I mention – at work jsfiddle.net doesn’t work too well so I have added the code to a sample app and uploaded it to GitHub.

The original samples and more information can be found here, I thought they could do with being expanded upon a little.

The ViewModel I used for the demo code is as follows:-

code2

Dirty Flag and how to use it

  • The code on line 10 is creating the dirtyflag by using KoLite’s DirtyFlag – I pass in which observable’s I want to monitor to see if they become dirty when they’re value changes.
  • The code on line 27 is setting up a computed observable which will return true if the observables have theyre values changed, otherwise it will return false.

So by having some observables updated we can track for dirty changes and then decide what we want to do on our form, an example would be to enable the clear form button as well as enable the save button on when we have the dirty flag set to true.

Grey out button when Ajax request is in progress

  • The code on lines 29-33 is making use of the KoLite asyncCommand
  • If you then add the code below, to the html then we have the functionality were after.
<button data-bind="command: saveCommand">Save</button>

Grey out button when Ajax request is in progress and show activity icon

  • If you add in the extra binding like so:-
  • <button data-bind="command: saveCommand, activity: saveCommand.isExecuting">Save</button>
    

KoLite will now add in an activity icon within the button, and that’s it – in the example code I am using an Ajax post to call the MVC Controller and whilst this is off doing work the activity icon spins.

save

  • My demo code can be found here
  • You can download the code for KoLite here

Leave a comment after the beep.

Follow

Get every new post delivered to your Inbox.

Join 26 other followers