Skip to main content

Posts

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...

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 im...

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 gr...

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...

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 a...

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...

The cloud billing mess

"with great power comes great responsibility" - Spiderman Movie Nothing can be more true than this statement when it comes to Cloud. Spinning up a new server is effortless, scaling up and down even easier. While building a cloud based solution for our client we too have made same mistakes. Since the impact of such mistakes are not immediate these thing many a times go unnoticed. It is not until we receive inflated bills that we start looking into such matters and realize our mistakes. Cloud infrastructure should not cause an organization to abandon all server provisioning workflows but tweak them to take Cloud components into consideration. Thanks, Chandermani

Developer to Client Representative ratio

From the time I started software development, time and again I have faced one issue which hinders with the progress of software execution cycle. The scenario goes like this. There are n people in a team generating result at a speed that is overwhelming the client. The client is not able to provide feedback on time and hence delays. This happens more so with Agile methodology. Many times it happens that client want to achieve a lot within a specific time but does not have resources on his side to continuously monitor and provide feedback. As a service provider we can deploy more of BA's (Business Analyst) to help us, but no amount of BA's can resolve the bottleneck on clients part. In software industry we have ratios of dev/test, dev\lead (module, team etc), i believe such a ratio should also be there for client. Imagine a team of 20 developer churning out code with only one client frontending. Having multiple client personal to help the development team would help in such sce...

Namespace aliasing and extension methods

One of the interesting thing that i learned today is, namespace aliasing can break extension methods declared in the name space. To safeguard against this situation add the same namespace again without alias. For example using alias=X.Y.Z; should be changed to using alias=X.Y.Z; using X.Y.Z and everything works, Happy Coding, Chandermani

Assigning Icon to a file type by tweaking registry

On our recent project we had an requirement for assigning a icon to a file type which is not associated with any executable. Visual Studio installer project does a great job of creating such association if there is a executable involved. Else we need to manually add some registry edit steps in the installer process. The changes required were Under HKEY_CLASSES_ROOT add you extension key such as .myx Set the (default) string value to a friendly name for your application. Create another key in HKEY_CLASSES_ROOT with the friendly name as specified in step 2. Create a sub key for key created in step 3 with name DefaultIcon. Its (default) string should point to the folder location where the icon is. In case of Visual Studio Setup project the macro [TARGETDIR] comes in handy. This macro can help identify the location of the icon file if stored in the installation folder iteself. For example [TARGETDIR]Process.ico Happy Coding, Chandermani

Curious case of PDF file not being included as part of deployment

I included a PDF file as a part of web project and hyperlinked it in a page. This web application was part of Azure deployment. When I tried to test this in the dev fabric to my surprise i was greeted with 404 error :( I turned out while VS does some magic for web content files (html, asp, jpg etc), but for PDF file it does not set the Build Action property of the file and hence this error. Changing the Build Action to 'Content' solved everything. Happy Coding, Chandermani

Integrate ELMAH with WCF and Azure

I recently integrated ELMAH (Error Logging Modules and Handlers) with our Azure application. ELMAH is an excellent error logging and reporting libary available for ASP.Net. We used ELMAH for logging all unhandled service exceptions in WCF and ASP.Net. While there is information available on internet about how to integrate these technologies, data is scattered in bits and pieces. My aim through this blog post is to details the steps required for integration. The scenario of usage is, we wanted to log all unhandled exception thrown by our WCF service layer in a database which in our case was SQL Azure. Once done we could easily navigate to the the elmah default url to get a nice report on what errors were being generated by the application. Had it been a typical ASP.Net application, integrating ELMAH is a piece of cake. But since we were working on a Azure web deployment with SQL Azure as the backend some tweaks were necessary. Here are the things to do to get ELMAH fully functional in...

What i learned today.

Working with ASP.Net and SilverLight in my current project i learned two important things today SL will always show generic NotFound exception for a remote call failures irrespective of what was returned from server. This limitation roots in the browser which does not pass the exception details to the SL plugin. The only way around is to always send a responses which have Fault property for the SL client to work with. ASP.Net forms authentication mechanism always redirects on 404 error and behaviour is hard to change. This becomes a problem working with SL or ASP.Net MVC clients which expect Http error code (REST clients). The workaround that i found on Stackoverflow was to thrown 403 Error Code instead of 401. This way service calls made from SL or ASP.Net MVC can return http status codes (REST endpoints) and will not cause server redirects.

Encoding\Escaping special characters in Silverlight

I spend almost half an hour to find how to do encoding\escaping special characters in SL. Started with SecurityElement to HttpUtility etc but none were available in SL. Well as it is with google, if you ask correctly you would be rewarded. Turns out that there is a class in System.Windows.Browser assembly for SL that contains HttpUtility class. Checkout here If i had just type HttpUtility in the IDE i could have got it :( Anyhow, Happy Coding.