Skip to main content

Posts

Showing posts from 2012

Angularjs and inplace edit

AngularJS is an awesome framework and Angular Directives make this framework super awesome :) AngularJS  directives help us extend the existing HTML DSL. You can create new tags, extend functionality using existing tag and create reusable component. I recently created a Inplace editable control in AngularJS. It basically allows to do in place editing for elements like H1, H2, H3 div etc, basically all read only control. I took the initial idea from this fiddle and added Text selection on edit. Cursor positioning Handle the Enter key press. Here is my fiddle

Integrate ASP.Net MVC + WebAPI with Autofac in 5 mins

Recently i configured Autofac with ASP.Net MVC 4 and WebAPI . Here are the steps required to configure Autofac Install package Autofac.MVC4 Install package Autofac.WebApi Add a class AutofacBootstrap. Use this class to configure the dependencies within your project. Open Global.asax file and add a method like  Call the method from Application_Start And you are done !!

Appharbor build notification using Google Talk (XMPP) - Implementation

In my last post about creating an Appharbor notification bot, I described about the problem domain, the solution approaches and how the end to end scenario works.This post would dig deeper into the implementation aspects of the solution. To start with we need to understand the two esential ingredients for this recipe Appharbor Service hooks : Appharbor Service hooks are the building block for the solution. Appharbor provides capability, where it can post to any public url with status of a build on completion. Service hooks are available for events Build Success. Build failure. XMPP protocol : XMPP is a protocol used for Instant Messaging (IM) communication. It allows us to relay messages to the users IM client using XMPP servers (in our case Google Talk messaging servers). With the understanding on these two concept we are ready to dive into the nitty gritty  of the solution. Assuming that the user did the initial configurations to setup notifications (see my e

Appharbor build notification using Google Talk (XMPP)

Appharbor recently ran a contest to encourage developers to use their API and showcase the API capabilities. Based on some ideas floated by the Appharbor team I too decided to build something useful\interesting for Appharbor platform.I decided to create a desktop notification client which can notify user when the build is complete, its status in terms of success or failure. How Appharbor works is that you push your code to a git repo supported by Appharbor ( github , bitbucket etc). As soon as the checkin is done, Appharbor pulls the code base build it, and updates the running website. It's like a single click deployment! I started to explore my option for a desktop client and some of the options I though of were Build a desktop windows app and integrate with the Appharbor API.  This approach was the most flexible approach. I have full control of features and capabilities, but would take a good amount of time to develop. Use third party desktop notification apps like

Azure Blob file download not resuming !

Azure Blobs are a scalable infrastructure to host\store files. I was working on understanding the behavior of large file uploads and downloads and create a reasonable strategy to support both scenarios in our application. Azure blob file can be downloaded using any browser or internet download manager. For a public blob the url of file would suffice, but for downloading a private blob one needs to create a url containing the Secured Access Signature . While testing downloads I realized that in case I pause and resume the download in Firefox or Chrome or any download manager the download restarts !!! I was expecting that the download should start from the place it paused. Imagine the scenario where we have uploaded half of a 2GB file and resuming the download would start over again !!! Clearly the Azure Blob storage was not supporting HTTP Range header . As it turns out the Azure blob service is not a trivial file server. It is more of a Storage Application Server. It exp

Alogorithm: Finding Longest Increasing Subsequence using Patience Sort in C#

Finding the Longest Increasing Sequence is an interesting problem and there are multiple solutions available with varying time complexity. The solution that i plan to share today is the uses of Patience Sort  to find such a sequence. The solution finds a particular longest increasing sub-sequence as the original sequence may contain more than one such sequence. In 1999 The Bulletin of the American Mathematical Society published a paper by David Aldous and Persi Diaconis entitled: “Longest Increasing Subsequences: From Patience Sorting to the Baik-Deift-Johansson Theorem”. I have implemented this solution in C# and derived it from this excellent article which provides a Python implementation for the same. This is how patience sort works Take a deck of cards labeled 1, 2, 3, … , n. The deck is shuffled, cards are turned up one at a time and dealt into piles on the table, according to the rule A low card may be placed on a higher card (e.g. 2 may be placed on 7), or ma

Caching Images downloaded from web on Windows Phone Isolated storage

I was helping on a Windows Phone application where the requirement was to cache the images the phone downloads on the isolated storage for offline viewing. I wanted a solution which was simple and as transparent as possible. While researching I found  someone wrote a Silverlight converter for loading images from isolated storage. Taking that as a base I created a converted which can Load image from web (http + https), and persist it to isolated storage. In case of network connectivity issues can load the same image from isolated storage. It does that by mapping the http url to a isolated storage location. In case the network is down and the image is neither there in cache, loads a default image, passed as parameter to converter. Here is the gist for the implementation. To use the converter Import the name space. Declare the converter as resource. Set the Image Source Property to use this converter like this 

Architect? Give me a break :)

Davy Brion has posted some rants about the Microsoft MVP program and the type of people that are attracted to it. What David has mentioned holds true in some other areas of IT industry too. "Architect" another cool but severely abused title :) If you take David's post and replace "Microsoft MVP" with the word "Architect" you would find everything still holds true. I am a strong believer that "Architect" as a designation\title should be done away with. In my 8+ years of IT experience I have seen quite a few of this breed :) With exception of few I found most of them just good with UML modelling tools (such as Visio) Generating high quality project artifacts (Such as Function Specs, Design documents) Buzz word mongers. Smooth talkers These maybe important qualities to have in an Architect but a sound technical background is a non negotiable. Everyone knows what is the end result if you engage such people. Such Architects most

So you got a job offer !!!

So you got a job offer !!! It always a great feeling irrespective of ones experience level. You start envisioning about your fatter pay-cheque, your role, your growth prospects, may be a new city (in case you are transferring).  During this euphoria we may throw caution to the wind and not do a thorough check about the organization, type of work, work culture. The consequence of our carelessness can cost us, sometimes dearly. Through this post I just want to highlight things one should consider while looking out for jobs and while accepting any job offer. Since i am an IT professional i can and would only talk about IT companies and jobs. Product Company vs Services Company : Many may not have any preferences on this but this distinction has an affect. Services company is all about billing and one almost always works under deadline pressure, delivery pressure. The story is different in product companies where activities revolve around the product. Time to market is import

Case of missing Iron Foundry VMC client

While installing the latest Iron Foundry VMC client and Cloud Foundry Explorer there is an installation issue. Due to this VMC client install gets lost if both the VMC Client and CF Explorer are installed irrespective of the location of the install. As it turns out, if you install VMC client first and CF Explorer next, installer would delete the VMC install directory. If you install CF Explorer first and try to install VMC client later you get this error "This version or newer version of VMC Command Line Tool is already installed."  Current workaround would be copy the installed folder for VMC before starting CF Explorer install. Hope it helps.

NoSQL Data Modelling

Recently in one of the project we planned to use some NoSQL   Document database . One of the reasons we though document database would be a great fit was that we could get started without setting up any DB schema and start shoving entities into the document database. Nothing can be further from the truth. Data modeling is as essential and as fundamental an exercise for NoSQL stores as it is for RDBMS. It is just that the concepts are different as compared to RDBMS where normalization\de-normalization provide some guidance. In my pursuit to understand how to model data for a document database i came across some great reference material that i want to share here. MongoDB Schema Design : Great resource from MongoDB. Start with this one first. MongoDB Data Modeling : A quick read but explains some important concepts related to modelling. Embedding vs Linking. MongoDB Data Modeling and Rails : Covers an example to make things more clear. NoSQL Data Modelling Techniques : A great

Trying to make sense of REST (over HTTP)

People who come from WCF/ Web Services background and  transition to RESTish type communication infrastructure make mistakes that follow a common pattern. I have seen it with people who are new to REST and with people who have spent some time working with RESTful services. (Throughout the post where every I mention REST I mean REST over HTTP)  The common misconceptions  are Not understanding the difference between HTTP POST and GET, in fact having too little or no clue about HTTP Verbs. For most devs interaction with server involves calling a client proxy method, handling the request on server, sending a response back from server, handling the response on client. This abstraction means no one knows what happens at infrastructure level. When programming for HTTP one cannot ignore the abstraction, else we cannot take full advantage of the medium. The manifestation of the above affect is, either every call becomes a POST or every call becomes a GET. When every call becomes

Contrasting Azure and IronFoundry Deployment Behaviour

I have been exploring Iron Foundry a PaaS player in .Net space for the last few weeks. One of the things I liked about Iron Foundry was, how fast deployments happened. One of the reasons for this is how binary\file package gets uploaded to the cloud infrastructure. The Iron Foundry \ Cloud Foundry approach (since Iron Foundry is port of CF) of only uploading change-set instead of complete binary\file package makes this step of deployment quite fast. What happens in Azure is You create a package file (cspkg) using either Visual Studio (VS) or command line tool cspack The generated package file contains the complete set of binaries and other resources such as images, css, javasripts etc  This package is then uploaded to Azure infrastructure and then deployed by the Fabric Controller. In contrast the process that Cloud Foundry follows to decide what it should send to cloud follows a multi-stage process. When an application is ready to be pushed to Cloud Foundry the client and C

Nerddinner on Appharbor

My last exercise on deploying Nerddinner on IronFoundry helped me a lot to understand the platforms capabilities. Time to do the same thing on AppHarbor , another PaaS player in .Net space. AppHarbor tries to emulate Heroku in .Net space. They are the ' Azure done right ' brigade. As a developer I just needs to push code either to AppHarbor or some of the supported repositories such as CodePlex, GitHub, BitBucket and AppHarbor does the rest. AppHarbor Builds the code. Runs unit tests Deploys the application on AppHarbor’s application servers (backed by Amazon EC2 ). Other than that it also provides all the standard benefits as provided by most PaaS players. To gain first hand experience on AppHarbor I decided to port Nerddinner onto AppHarbor. I already had the Nerddinner codebase in github so i could start right away. Creating Account   The first step was to register my account with AppHarbor. Once registration is complete we get a single instance under the

Porting Nerddinner on IronFoundry

One of the new entrants in the .Net PaaS space is IronFoundry . Tier 3 an enterprise cloud platform for mid-tier, large enterprise and SaaS have come up with Iron Foundry(IF) a port of Cloud Foundry (CF) that is targeted towards Microsoft .Net platform. IF is an implementation of CF that is tightly integrated with the .NET Framework. It can support multiple frameworks, cloud providers, and application services all on a cloud scale platform. The platform is currently thin on documentation so what better way to learn about it than to port some application to run on IF Nerddinner - The application of choice Nerddinner was a good fit for this exercise. It is a tiered application with an ASP.Net MVC based front end and MS SQL Server based data access, both supported by Iron Foundry out of box. The Process The process started with setting up an Iron Foundry account that would be used to deploy the application. Since the service is in beta there is no cost incurred during setting up