Posts

Azure Continuous Delivery Build Configuration

Image
Setting up an Azure website with continuous git deliveries from Visual Studio Online was straightforward enough but it wasn't entirely clear to me how you specify which Build Configuration to use (e.g. Debug vs Release). It turns out to resolve this: 1. Open your site up in Azure Management Portal 2. Click on the Visual Studio link (bottom right of the above screenshot). Studio should then open up 3. Within Visual Studio's Team Explorer Tab, click on the Builds button 4. Within the Builds tab, you'll see the build definitions. Interestingly, behind the scenes Azure created a "{site}_CD" build definition 5. Right click on the _CD build definition and select "Edit Build Definition..." 6. On the property page that appears, select the "Process" tab You can then edit the Configurations and select the Build Configuration you want

Amazon S3 Bucket custom DNS name

Image
Amazon's S3 is an incredibly useful service for storing files and blobs of data. The data is stored in Buckets which are accessibly via an Amazon generated url, similar to: http(s):// .s3.amazonaws.com/ or, for example,  http://myFabBucketExample.eoinclayton.net.s3.amazonaws.com The url does end up being a bit unwieldy though. You may also want to cover the potential future scenario of moving away from S3 and not having to deal with amazonaws.com urls littered throughout your code bases. To deal with this, if you already have a DNS name (e.g. eoinclayton.net) you can map it to your bucket. To achieve this: 1. Create a bucket in S3 with the same name as you would like your DNS name to appear. E.g. I wanted to end up with a new "assets" subdomain, e.g.  http://assets.eoinclayton.net/{somefile}, so I made a bucket called "assets.eoinclayton.net": 2. If you want the bucket contents to be viewable by the public, modify the S3 bucket so that 'Everyo

HTML5 AppCache with MVC bundles

HTML5 has many handy additions and I recently had the opportunity to use the Appcache Manifest. This feature enables your site to work offline which is particularly useful for mobile orientated sites as users may not always have a reliable 'net connection. The following guide goes through the approach I took for getting it working via .Net's MVC framework. Prep the HTML tag On the page you want to have a manifest for, add the following: <html lang="en" manifest="/AppCache/AppManifest"> This will tell the browser to look for the appcache manifest. Setup the Model We don't need many properties on our Model for the manifest generation. The following will do public class AppCacheModel     {         public string AssemblyVersion { get; set; }         public List< string> CacheCollection { get; set; }     } An assembly version which will help update the manifest file contents after every build A CacheCollection list of urls

Setting up SourceTree, BitBucket, SSH with a proxy on Windows

Image
When using SourceTree to connect to Bitbucket with an SSH key through a proxy server, there are a number of steps to follow... SourceTree setup 1. Open SourceTree, goto Tools and select 'Create or Import SSH Keys' 2. A dialog will open up. Click Generate to generate a public private key pair:   Provide a suitable passphrase and save both the public and private keys 3. In your system tray, right click on Pageant (PuTTY authentication agent) and select "Add Key"   Select the private key you created in step 2 Proxy Setup with Putty 1. Setup your HTTP Proxy settings in Putty Click on your Start button and search for Putty When Putty comes up goto the Session Category 'Default Settings' and then Load Goto the Proxy category and add in the proxy settings, making sure to select the right proxy type Go back to the Session Category and save the updates to the Default Settings   Bitbucket setup 1. Goto BitBucket, navigate to "Your Acc

Using Xamarin Sharpie to build a Flurry assembly

Image
The main project I work on is a series of Xamarin based apps for iOS devices. To help track usage stats we use Flurry Analytics which gives us a handy dashboard showing us session usage, device & OS breakdown, error logs, etc. With the iOS 7 release, Flurry required a update: Flurry doesn't have a .Net assembly out-of-the-box, so we needed a way of converting the native library into .Net. When we had added Flurry to our project ages ago, we started with the Flurry monotouch-bindings to get things started. However this time Flurry had changed something in their library and the monotouch-binding no longer worked correctly. Trying to run the app with the built assembly resulted in build errors including: Undefined symbols for architecture armv7:   "_SecItemAdd", referenced from:       -[FlurryKeychainWrapper setData:forKey:] in libFlurry.a(libFlurry.a-armv7-master.o)   "_SecItemCopyMatching", referenced from:       -[FlurryKeychainWrapper d

Intro to using the Windows Debugger

Image
Windows Debugger can be downloaded as part of the Windows SDK . I would install both the 32 and 64bit versions. I used it in the past when diagnosing why a website was performing poorly during peak periods. Users would hit the website url, wait for 30+ seconds and then the site would appear quickly. Even the home page which did nothing (i.e. no db hits), was slow to appear. I got a memory dump from the server and using the analysis approach below could see that all available IIS worker threads were in use and all were busy rendering. The server was starved of threads and user requests were ending up in a queue waiting to be processed. I tweaked the IIS settings and added more worker threads. The problem went away. Thanks Windows Debugger! How do you to get a memory dump? 1. Open a command prompt 2. Get the list of worker process ids: %systemroot%\system32\inetsrv\APPCMD list wps This is a useful page describing how AppCmd works: http://www.iis.net/learn/get-started/get

MVC HTTP Headers for CDN caching

Image
On a recent project I added upgraded our systems to use a Content Delivery Network (CDN). The project supplied content to users and we wanted to offload the 'heavy-lifting' of the content supply away from our PROD server onto a more robust delivery network. The mobile clients would request the content from the CDN. If the CDN hadn't cached the content yet, it would grab it from our PROD server, cache it, and respond back to the clients. For this caching to work, though, some HTTP Header magic was required. Which headers should you watch out for? Cache control should be public For the CDN to cache the content on behalf of your origin server, set the Cache-control=public Expires Date To stop the CDN regularly requested the same static content from your PROD server, set the Expires-Date setting to be in the far future (e.g. > 1 year)  Vary  Watch out for the 'Vary' header. MVC3 had initially defaulted to adding the "vary=*" http head