<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/&quot;DUAESHo_fip7ImA9WhBaEEg.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110</id><updated>2013-05-20T14:48:29.446+01:00</updated><category term="TestFlight" /><category term="Guid" /><category term="Visual Studio" /><category term="validation groups" /><category term="table owner" /><category term="tools" /><category term="bugs" /><category term="localization" /><category term="stylesheet" /><category term="events" /><category term="privacy" /><category term="SQLite" /><category term="analytics" /><category term="array" /><category term="sessions" /><category term="Revit" /><category term="vanity URLs" /><category term="copy" /><category term="Spree" /><category term="App Store" /><category term="file handling" /><category term="dependency walker" /><category term="datapager" /><category term="URL rewriting" /><category term="iOS" /><category term="HtmlTitle" /><category term="facebook" /><category term="foreign key" /><category term="file opening" /><category term="textnote" /><category term="schedules" /><category term="GridView" /><category term="SPMetal" /><category term="modal forms" /><category term="format" /><category term="IIS" /><category term="AppDomain" /><category term="Revit 2010" /><category term="iPhone" /><category term="RevitAPI.dll" /><category term="bandwidth" /><category term="build events" /><category term="network" /><category term="datetime" /><category term="Umbraco" /><category term="file associations" /><category term="elmah" /><category term="Entity Framework" /><category term="c#.net" /><category term="google" /><category term="activerecord" /><category term="accuracy" /><category term="Microsoft Jet Engine" /><category term="Xcode" /><category term="Twilio" /><category term="listview" /><category term="lists" /><category term="github" /><category term="title tags" /><category term="SQL Server Compact" /><category term="curtain panel doors" /><category term="IDE" /><category term="category filter" /><category term="currency" /><category term="Stored procedures" /><category term="grammar" /><category term="lambda queries" /><category term="Add-In Manager" /><category term="membership" /><category term="Twitter Bootstrap" /><category term="JSON" /><category term="selection set" /><category term="instance.name" /><category term="menu" /><category term="PPC" /><category term="DoEvents()" /><category term="speed" /><category term="SharpZipLib" /><category term="page directive" /><category term="cookies" /><category term="SharePoint" /><category term="Norton Ghost" /><category term="S3" /><category term="scrolling" /><category term="Add-Ins" /><category term="Sendgrid" /><category term="seo" /><category term="file uploading" /><category term="filters" /><category term="regex" /><category term="Ruby" /><category term="affiliates" /><category term="error capturing" /><category term="SetCacheability" /><category term="standards" /><category term="UITableView" /><category term="Flurry" /><category term="caching" /><category term="preprocessor directives" /><category term="type name" /><category term="level.projectElevation" /><category term="mobile" /><category term="DisplayUnitSystem" /><category term="installation" /><category term="SQL" /><category term="restart" /><category term="friendly URLs" /><category term="RvtMgdDbg" /><category term="iframes" /><category term="journal file" /><category term="dns problems" /><category term="Postgres" /><category term="dell laptop" /><category term="validation" /><category term="data attributes" /><category term="responsive design" /><category term="unhandled exceptions" /><category term="css" /><category term="Git" /><category term="migrations" /><category term="Mac" /><category term=".net" /><category term="Rubymine" /><category term="strings" /><category term="BoundingBox" /><category term="leader" /><category term="safari" /><category term="web.config" /><category term="asp" /><category term="units" /><category term="FCN" /><category term="LINQ" /><category term="buttons" /><category term="jQuery" /><category term="64-bit" /><category term="tracking" /><category term="Rails" /><category term="toolbar" /><category term="parameters" /><category term="XML" /><category term="language" /><category term="smartphone" /><category term="BackgroundWorker" /><category term="Gov.uk" /><category term="revit.ini" /><category term="ribbons" /><category term="File Change Notification" /><category term="asp.NET" /><category term="multi-threading" /><category term="software" /><category term="Amazon AWS" /><category term="building height" /><category term="directories" /><category term="html" /><category term="Razor" /><category term="ssl" /><category term="curtain panel walls" /><category term="examine" /><category term="sitemap" /><category term="selected elements" /><category term="users" /><category term="anchors" /><category term="family types" /><category term="MVC" /><category term="javascript" /><category term="dell support" /><category term="debugging" /><category term="SQL Server" /><category term="Virgin Media" /><category term="RawUrl" /><category term="ElementSetIterator" /><category term="CPC" /><category term="console" /><category term="SMTP" /><category term="P3P" /><category term="repeaters" /><category term="agile" /><category term="windows" /><category term="imagemagick" /><category term="recruitment" /><category term="canonical tags" /><category term="SIFR" /><category term="Heroku" /><category term="CKEditor" /><category term="LAMP" /><category term="ajax" /><category term="views" /><category term="updatepanel" /><category term="broadband" /><category term="random" /><category term="web user control" /><category term="lucene" /><category term="developer tools" /><category term="cross browser" /><category term="font" /><category term="config" /><category term="suo file" /><category term="pagination" /><category term="EpiServer" /><category term="dictionaries" /><category term="blogger" /><category term="UDID" /><category term="datepicker" /><category term="tab control" /><category term="Global.asax" /><category term="Microsoft Access" /><category term="nested families" /><category term="https" /><category term="Status codes" /><category term="IE" /><category term="collections" /><category term="Error 404" /><category term="command line arguments" /><category term="Devise" /><category term="zip" /><title>Another programming blog</title><subtitle type="html">ASP.NET, C#, jQuery, JavaScript, AJAX, SQL, LINQ, CSS, Ruby, Rails, HTML, iPhone, iOS, apps. Freelance programmer, developer, engineer for web and mobile in Bristol, UK.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>190</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/AnotherProgrammingBlog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="anotherprogrammingblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CkcBQn49eip7ImA9WhBaEEg.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-225410234135181965</id><published>2013-05-20T12:40:00.000+01:00</published><updated>2013-05-20T12:40:53.062+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-20T12:40:53.062+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery" /><category scheme="http://www.blogger.com/atom/ns#" term="css" /><title>Ensure a div is visible in mobile browser</title><content type="html">I'm currently working on a responsive site that has a high predicted mobile user base. There are a few areas in this site where divs are revealed or hidden using jQuery slideDown(), slideUp(), hide(), show(), and sometimes modal overlays are presented to the user with a tinted blocked UI.&lt;br /&gt;
&lt;br /&gt;
Sometimes on mobile devices presentation of these can be problematic - the reveal of a new div may happen fully or partially off-screen, seriously damaging the user experience. To counteract this I built a javascript function which I use after each new reveal to check if the div is viewable in the browser:&lt;br /&gt;

&lt;pre name="code" class="csharp"&gt;

function checkIfDivIsViewable(div) {

   
    var $window = $(window);           
    var myTop = div.offset().top;  // top of element
    var windowTop = $window.scrollTop();           // top of window
    var windowBottom = windowTop + $window.height();  // bottom of window

    if (myTop &gt;= windowTop &amp;&amp; myTop &lt;= windowBottom) {
        // div is viewable in browser, do nothing
    } else {
        // div is not viewable in browser, so scroll it
        $('html,body').animate({ scrollTop: myTop }, 300);
    }


}

&lt;/pre&gt;

I tried calling this on completion of reveals, like this:

&lt;pre name="code" class="csharp"&gt;
$('#divToShow').slideDown(300,checkIfDivIsViewable($('#divToShow')));
&lt;/pre&gt;
but this didn't prove too reliable. I don't know why, but it's posssibly because the div is still in motion when we're asking jQuery to assess it's position. So at the risk of appearing a bit hacky I check the display after a small delay. This seems to work fine:

&lt;pre name="code" class="csharp"&gt;
$('#divToShow').slideDown(300);

//now check that the div we just revealed is visible
setTimeout(function () {
            checkIfDivIsViewable($('#divToShow'));
        }, 500);
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/225410234135181965/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/05/ensure-div-is-visible-in-mobile-browser.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/225410234135181965?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/225410234135181965?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/05/ensure-div-is-visible-in-mobile-browser.html" title="Ensure a div is visible in mobile browser" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEUESXs-eCp7ImA9WhBUGUs.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-3386379834489955843</id><published>2013-05-07T22:29:00.002+01:00</published><updated>2013-05-07T22:30:08.550+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-07T22:30:08.550+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="activerecord" /><category scheme="http://www.blogger.com/atom/ns#" term="Rails" /><title>Rails Activerecord - common performance pitfalls</title><content type="html">I just found &lt;a href="https://blog.engineyard.com/2009/thats-not-a-memory-leak-its-bloat"&gt;this&lt;/a&gt; great blog entry on Engineyard on the common pitfalls using Activerecord - when an innocent bit of code works great in development but in the wild, when faced with 1000's of records, it'll grind to halt.

Here's a summary:

&lt;h3&gt;1. Model.find(:all)&lt;/h3&gt;
&lt;p&gt;In versions of Rails &lt;strong&gt;before&lt;/strong&gt; 2.3, this is a memory killer. The most common form in the wild is:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;Comment.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.each&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt; |record| do_something_with_each&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;record&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt; &lt;span class="br0"&gt;1125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you have 100,000 Comments, this will load and instantiate all 100k records in memory, then go through each one. In Rails 2.3, the .each will paginate through the results, so you&amp;#8217;ll only load in small batches, but this won&amp;#8217;t save you from the following variations:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;@records = Comment.all
@records = Comment.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;
@record_ids = Comment.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.collect&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;|record| record.id &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Each of these will load up all Comment records into an instance variable, regardless if you have 100 or 100,000 and regardless if you are on Rails 2.1 or 2.3&lt;/p&gt;
&lt;h3&gt;2. :includes are Including Too Much&lt;/h3&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;Article.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all, :include =&amp;gt; &lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;:user =&amp;gt; &lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;:posts =&amp;gt; :comments&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is a variant of the above, intensified by the one or multiple joins on other tables. If you only have 1000 articles you may have thought loading them in is not a big deal. But when you multiply 1000 that by the number of users, the posts they have and the comments that they have&amp;#8230; it adds up.&lt;/p&gt;
&lt;h3&gt;3. :includes on a has_many&lt;/h3&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;@articles.users.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all, :include =&amp;gt; &lt;span class="br0"&gt;&amp;#91;&lt;/span&gt;:posts =&amp;gt; :comments&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Variation on the above, but through a has_many.&lt;/p&gt;
&lt;h3&gt;4. @model_instance.relationship&lt;/h3&gt;
&lt;p&gt;Referring to a has_many relationship directly like so:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;@authors.comments&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;is a shortcut to the potentially bloated:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;@authors.comments.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Be sure that you don&amp;#8217;t have thousands of related records, because you will be loading them all up.&lt;/p&gt;
&lt;h3&gt;5. Filtering Records with Ruby Instead of SQL&lt;/h3&gt;
&lt;p&gt;This is also fairly common, especially as requirements change or when folks are in a hurry to just get the results they want:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;Model.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.detect&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt; |record| record.attribute == &amp;quot;some_value&amp;quot; &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ActiveRecord almost always has the ability to efficiently give you what you need:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;Model.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all, :conditions =&amp;gt; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;:attribute =&amp;gt; &amp;quot;some_value&amp;quot;&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is a simple example to make the point clear, but I&amp;#8217;ve seen more convoluted chunks of code where detect or reject is using some non-attribute model method to determine inclusion. Almost always, these queries can be written with ActiveRecord, and if not, with SQL.&lt;/p&gt;
&lt;h3&gt;6. Evil Callbacks in the Model&lt;/h3&gt;
&lt;p&gt;I&amp;#8217;ve helped a couple of customers track down memory issues where their controller action looked perfectly reasonable:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;def update
  @model = Model.find_by_id&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;params&lt;span class="br0"&gt;991;&lt;/span&gt;:id&lt;span class="br0"&gt;&amp;#93;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;
end&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;However, a look at the filters on the model showed something like this:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;after_save :update_something_on_related_model
.
.
def update_something_on_related_model
  self.relationship.each do |instance|
    instance.update_attribute&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:status, self.status&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;
  end
end&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3&gt;7. Named scopes, default scopes, and has_many relationships that specify :include Where Inappropriate&lt;/h3&gt;
&lt;p&gt;Remember the first time you setup your model&amp;#8217;s relationships? Maybe you were thinking smartly and did something like this:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;class User
  has_many :posts, :include =&amp;gt; :comments
end&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So, by default, posts includes :comments. Which is great for when you are displaying posts and comments on the same page together. But lets say you are doing something in a migration which has something to do with all posts and nothing to do with comments:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;@posts = User.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all, :conditions =&amp;gt; &lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;:activated =&amp;gt; true&lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.posts&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This could feel &amp;#8216;safe&amp;#8217; to you, because you only have 50 users and maybe a total of 1000 posts, but the include specified on the has_many will load in all related comments &amp;#8211; something you probably weren&amp;#8217;t expecting.&lt;/p&gt;
&lt;h3&gt;8. Use :select When You Must Instantiate Large Quantities of Records&lt;/h3&gt;
&lt;p&gt;Sometimes, in the reality of running a real production site, you need to have a query return a large data set, and no, you can&amp;#8217;t paginate. In that case, the first question you should ask is &amp;#8220;Do I need to instantiate all of the attributes?&amp;#8221;&lt;/p&gt;
&lt;p&gt;Maybe you need all the comment_ids in an Array for some reason.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px;"&gt;@comment_ids = Comment.find(:all).collect{|comment| comment.id }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In this case, you are looking for an array of ids. Maybe you will be delivering them via JSON, maybe you need to cache them in memcached, maybe they are the first step of some calculation you need. Whatever the need, this is a much more efficient query:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="" style="font-family:monospace;"&gt;@comment_ids = Comment.find&lt;span class="br0"&gt;&amp;#40;&lt;/span&gt;:all, :select =&amp;gt; 'comments.id'&lt;span class="br0"&gt;&amp;#41;&lt;/span&gt;.collect&lt;span class="br0"&gt;&amp;#123;&lt;/span&gt;|comment| comment.id &lt;span class="br0"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3&gt;9. Overfed Feeds&lt;/h3&gt;
&lt;p&gt;Check all the places you are making XML sandwiches. Often these controllers are written early on and don&amp;#8217;t scale well. Maybe you have a sitemap XML feed that delivers every record under the sun to Google, or are rending some large amount of data for an API.&lt;/p&gt;
&lt;h3&gt;10. Monster Migrations&lt;/h3&gt;
&lt;p&gt;Finally, watch out for your Migrations, as this is a common place where you need to do things like iterate over every record of a Model, or instantiate and save a ton of records. Watch the process size on the server with top or with &amp;#8220;watch &amp;#8216;ps aux | grep migrate&amp;#8217;&amp;#8221;.&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/3386379834489955843/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/05/rails-activerecord-common-performance.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/3386379834489955843?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/3386379834489955843?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/05/rails-activerecord-common-performance.html" title="Rails Activerecord - common performance pitfalls" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DUAESHo8eCp7ImA9WhBaEEg.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-4070805903111566715</id><published>2013-04-11T14:47:00.000+01:00</published><updated>2013-05-20T14:48:29.470+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-20T14:48:29.470+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="mobile" /><category scheme="http://www.blogger.com/atom/ns#" term="html" /><title>Disable autocorrection in HTML text input field</title><content type="html">Autocorrection is a pain when typing into HTML text input fields for user names and other kinds of data that shouldn't be auto-corrected. As web devs we should be disabling this functionality to make mobile users' lives better&lt;br /&gt;
&lt;br /&gt;
All you need is this attribute:

&lt;br /&gt;
&lt;pre name="code"&gt;autocorrect="off"
&lt;/pre&gt;
</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/4070805903111566715/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/04/disable-autocorrection-in-html-text.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/4070805903111566715?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/4070805903111566715?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/04/disable-autocorrection-in-html-text.html" title="Disable autocorrection in HTML text input field" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DUECSH84cCp7ImA9WhBSEUQ.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-7314115424590017105</id><published>2013-02-18T14:27:00.001Z</published><updated>2013-02-18T14:27:49.138Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-18T14:27:49.138Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="facebook" /><title>Adding a facebook app to a page tab</title><content type="html">https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&amp;amp;display=popup&amp;amp;next=YOUR_URL</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/7314115424590017105/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/02/adding-facebook-app-to-page-tab.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7314115424590017105?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7314115424590017105?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/02/adding-facebook-app-to-page-tab.html" title="Adding a facebook app to a page tab" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEUGQHo9eip7ImA9WhBUGUs.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-2342808396645351477</id><published>2013-01-25T12:44:00.001Z</published><updated>2013-05-07T22:30:21.462+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-07T22:30:21.462+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="activerecord" /><category scheme="http://www.blogger.com/atom/ns#" term="migrations" /><category scheme="http://www.blogger.com/atom/ns#" term="Rails" /><category scheme="http://www.blogger.com/atom/ns#" term="Postgres" /><title>Latitude and longitude in Rails activerecord</title><content type="html">I needed to store latitude and longitude in my Postgres db in a way that maintained accuracy of data but also allowed fast efficient searching of this spatial data using BETWEEN queries. The PostGIS extension was not available to me.&lt;br /&gt;
&lt;br /&gt;
The suitable data type for this is a decimal with precision of 9 and scale of 6 [decimal(9,6)]. The activerecord migration code for this turned out to be thus:
&lt;pre name="code" class="csharp"&gt;
add_column :livetokens, :latitude, :decimal, :precision =&gt; 9, :scale =&gt; 6
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/2342808396645351477/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/latitude-and-longitude-in-rails.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/2342808396645351477?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/2342808396645351477?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/latitude-and-longitude-in-rails.html" title="Latitude and longitude in Rails activerecord" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEYMSX8_eip7ImA9WhNbGEQ.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-8238147301972453710</id><published>2013-01-22T22:03:00.000Z</published><updated>2013-01-22T22:03:08.142Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-22T22:03:08.142Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="iOS" /><title>Sniff iPhone HTTP traffic with mitmproxy</title><content type="html">I always forget how to use mitmproxy, so here's a reminder for myself:&lt;br /&gt;
&lt;pre name="code" class="csharp"&gt;
Download and install mitmproxy, if you haven't done so already.
Go to a terminal and run mitmproxy.
Get the network IP address of your mac by running ifconfig en1.
Set the proxy on your iPhone by going to wifi settings. Set HTTP Proxy to “Manual”, and enter the IP of your Mac and port 8080.
Start browsing on the iPhone, or run an app. Press ‘?’ to bring up the list of commands.
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/8238147301972453710/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/sniff-iphone-http-traffic-with-mitmproxy.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/8238147301972453710?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/8238147301972453710?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/sniff-iphone-http-traffic-with-mitmproxy.html" title="Sniff iPhone HTTP traffic with mitmproxy" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;DE4ESXozeSp7ImA9WhNbE0k.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-3842343526861760610</id><published>2013-01-16T14:35:00.000Z</published><updated>2013-01-16T14:35:08.481Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-16T14:35:08.481Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="safari" /><category scheme="http://www.blogger.com/atom/ns#" term="css" /><title>Text size bigger in iPhone Safari landscape</title><content type="html">Is your text size being unpredictable when in landscape on an iPhone? Mine was. Here's the fix, just add this to your body class:&lt;br /&gt;
&lt;pre name="code" class="csharp"&gt;

-webkit-text-size-adjust:none;

&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/3842343526861760610/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/text-size-bigger-in-iphone-safari.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/3842343526861760610?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/3842343526861760610?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/text-size-bigger-in-iphone-safari.html" title="Text size bigger in iPhone Safari landscape" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CkcHRnYycSp7ImA9WhNbEUo.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-4977646758025043614</id><published>2013-01-09T13:37:00.001Z</published><updated>2013-01-14T13:27:17.899Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-14T13:27:17.899Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Twilio" /><category scheme="http://www.blogger.com/atom/ns#" term="Rails" /><title>Twilio for rails - setting the StatusCallback URL</title><content type="html">I've been using Twilio with Rails to send SMS, and needed Twilio to notify my Rails app if a send had been successful or not.&lt;br /&gt;
&lt;br /&gt;
To acheive this I added a StatusCallback parameter when calling message.create. This contains a URL with a unique identifier of the message I sent.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="csharp" name="code"&gt; # send an sms
    @client.account.sms.messages.create(
        :from =&amp;gt; '+44207XXXXXX',
        :to =&amp;gt; phoneNumber,
        :body =&amp;gt; body,
        :StatusCallback =&amp;gt; ENV['app_url']+ENV['twilio_sms_postback']+'?smsId='+textmessageId.to_s
    )&lt;/pre&gt;
</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/4977646758025043614/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/twilio-for-rails-setting-statuscallback.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/4977646758025043614?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/4977646758025043614?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2013/01/twilio-for-rails-setting-statuscallback.html" title="Twilio for rails - setting the StatusCallback URL" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D0IBR3o9fyp7ImA9WhNWFEQ.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-160135997748120428</id><published>2012-12-14T14:30:00.000Z</published><updated>2012-12-14T14:32:36.467Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-14T14:32:36.467Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="bugs" /><category scheme="http://www.blogger.com/atom/ns#" term="anchors" /><category scheme="http://www.blogger.com/atom/ns#" term="safari" /><category scheme="http://www.blogger.com/atom/ns#" term="cross browser" /><title>Anchors lost on Safari when rewriting from https to http</title><content type="html">Had an annoying problem today that I couldn't find a fix for. We have some rewrite rules that take care of enforcing which pages should be served over https and which over http. We have a link from one of the secure pages to an anchor (#myanchor) on an unsecured page.&lt;br /&gt;
&lt;br /&gt;
Safari strips the anchor from the end of the URL when navigating this link. It forgets it was ever requested, presumably because the change from https to http is actually seen as a fundamentally different URL. I'm sure this is a Safari bug but intend to do a bit more digging when I have a moment, and my MBP at hand, and am not limited to working on an iPhone.&lt;br /&gt;
&lt;br /&gt;
My hacky fix was to allow this unsecured page in particular to be served over HTTPS.</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/160135997748120428/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/12/anchors-lost-on-safari-when-rewriting.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/160135997748120428?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/160135997748120428?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/12/anchors-lost-on-safari-when-rewriting.html" title="Anchors lost on Safari when rewriting from https to http" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DUYHQ3Y_eCp7ImA9WhNWEUk.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-2694118944297403939</id><published>2012-12-10T13:45:00.000Z</published><updated>2012-12-10T13:45:32.840Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-10T13:45:32.840Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="CKEditor" /><title>CKEditor placeholder text</title><content type="html">I had to implement some placeholder text in CKEditor recently. It's more complex than you might think, and after some quick consideration I sought a plugin for it. I ended using &lt;a href="http://alfonsoml.blogspot.co.uk/2012/04/placeholder-text-in-ckeditor.html" target="_blank"&gt;this one&lt;/a&gt;, which was dead easy to implement and worked without any problems at all.</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/2694118944297403939/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/12/ckeditor-placeholder-text.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/2694118944297403939?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/2694118944297403939?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/12/ckeditor-placeholder-text.html" title="CKEditor placeholder text" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkcDRnc_eCp7ImA9WhNQFUU.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-7831473086144378566</id><published>2012-11-20T10:06:00.000Z</published><updated>2012-11-22T11:34:37.940Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-22T11:34:37.940Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="developer tools" /><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio" /><title>Easily attach to IIS process in Visual Studio</title><content type="html">Perhaps I'm a bit late to the party here but I just discovered &lt;a href="http://vscommands.squaredinfinity.com/"&gt;VSCommands&lt;/a&gt; which has just come in particularly handy for my current project, which involves attaching to IIS when debugging.&lt;br /&gt;
&lt;br /&gt;
This tool has turned a rather laborious 4-click menu-based process into a one-click dream from my toolbar. It looks like there's plenty more than this available too but for now I'm happy with this little godsend.&lt;br /&gt;
&lt;br /&gt;
Update: VSCommands just stopped me completely screwing up a project with an accidental drag and drop of a folder in my Solution Explorer. This is cool stuff:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-WzJ67vcwd18/UK4NiLXfrzI/AAAAAAAAAwk/tDaKkzCe9zM/s1600/movitems.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="237" src="http://3.bp.blogspot.com/-WzJ67vcwd18/UK4NiLXfrzI/AAAAAAAAAwk/tDaKkzCe9zM/s320/movitems.PNG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/7831473086144378566/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/11/easily-attach-to-iis-process-in-visual.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7831473086144378566?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7831473086144378566?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/11/easily-attach-to-iis-process-in-visual.html" title="Easily attach to IIS process in Visual Studio" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-WzJ67vcwd18/UK4NiLXfrzI/AAAAAAAAAwk/tDaKkzCe9zM/s72-c/movitems.PNG" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DUIEQX07cCp7ImA9WhJaGEk.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-7389864723585328982</id><published>2012-10-10T06:38:00.000+01:00</published><updated>2012-10-10T06:38:20.308+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-10T06:38:20.308+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="asp.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="IIS" /><title>Return content in ASP.NET with 503 Service Temporarily Unavailble</title><content type="html">I tried to do this today on a nice looking holding page while we were doing some site maintenance:

&lt;pre name="code" class="csharp"&gt;
Response.StatusCode = 503;
HttpContext.Current.Response.StatusDescription = "Service Temporarily Unavailable";
&lt;/pre&gt;

The problem was that my nice-looking content never got displayed. Instead, the user was presented with an ugly "The service is unavailable." page.

To overcome this is a one-liner:

&lt;pre name="code" class="csharp"&gt;
Response.TrySkipIisCustomErrors = true;
&lt;/pre&gt; </content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/7389864723585328982/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/10/return-content-in-aspnet-with-503.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7389864723585328982?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7389864723585328982?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/10/return-content-in-aspnet-with-503.html" title="Return content in ASP.NET with 503 Service Temporarily Unavailble" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Ak4GR3k-eip7ImA9WhJbFkU.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-6864043618709293373</id><published>2012-09-26T20:48:00.002+01:00</published><updated>2012-09-26T20:48:46.752+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-26T20:48:46.752+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UITableView" /><category scheme="http://www.blogger.com/atom/ns#" term="Xcode" /><category scheme="http://www.blogger.com/atom/ns#" term="iOS" /><title>UITableView with static cells not showing</title><content type="html">I'm still a noob at Xcode iOS development, and today I was trying to build a nice-looking input/edit form using a UITableView with grouped static cells. It looked good on my storyboard but when debugging the cells just wouldn't show up.

The reason? I was implementing three methods that shouldn't be there at all when using static cells. I deleted them and bingo, it worked. Here they are:

&lt;pre name="code" class="csharp"&gt;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
}
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/6864043618709293373/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/09/uitableview-with-static-cells-not.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/6864043618709293373?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/6864043618709293373?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/09/uitableview-with-static-cells-not.html" title="UITableView with static cells not showing" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkAAR3o9fyp7ImA9WhJUFk0.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-598222530387491862</id><published>2012-09-14T07:39:00.000+01:00</published><updated>2012-09-14T07:39:06.467+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-14T07:39:06.467+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Mac" /><category scheme="http://www.blogger.com/atom/ns#" term="Xcode" /><category scheme="http://www.blogger.com/atom/ns#" term="App Store" /><title>Can't install Xcode from Mac App Store</title><content type="html">I needed to do some iOS development yesterday which required direct testing on my iPhone, but since I last connected my phone to Xcode it's OS has been updated which means I need the new iOS SDK, which comes with Xcode.&lt;br /&gt;
&lt;br /&gt;
So I went to the Apple Developer centre, found the download link that opens up the Mac App Store, clicked the 'Install' link and literally nothing happened. No error messages, no download....nothing.&lt;br /&gt;
&lt;br /&gt;
After some googling I pieced together some bits of advice from around the interweb and finally fixed it by typing the following into my terminal, then deleting my existing Xcode.app and Install Xcode.app, and then fully restarting my machine. None of these steps worked on their own, or without the restart!&lt;br /&gt;
&lt;br /&gt;
&lt;pre name="code" class="csharp:nogutter"&gt;
rm ~/Library/Preferences/com.apple.appstore.plist
rm -r ~/Library/Saved\ Application\ State/com.apple.appstore.savedState
rm -r ~/Library/Caches/com.apple.appstore
rm -r /private/var/folders/*/*/*/com.apple.appstore
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/598222530387491862/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/09/cant-install-xcode-from-mac-app-store.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/598222530387491862?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/598222530387491862?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/09/cant-install-xcode-from-mac-app-store.html" title="Can't install Xcode from Mac App Store" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEEER3o-eSp7ImA9WhJaEUU.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-1729882968503321040</id><published>2012-09-11T22:00:00.000+01:00</published><updated>2012-10-02T13:56:46.451+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-02T13:56:46.451+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Virgin Media" /><category scheme="http://www.blogger.com/atom/ns#" term="broadband" /><title>dmg image data corrupted - dowloading from Virgin Media Broadband</title><content type="html">You've probably landed here because you're a Virgin Media Broadband customer and every time you download a disk image file (.dmg) or indeed any large file it appears to be a successful download until you try to open it.

Attempting to mount or verify the image returns "image data corrupted" and the file is useless.&lt;br /&gt;
&lt;br /&gt;
I've had this problem for months on my Macbook Pro, OSX Lion. Downloading from another ISP is never a problem - and today I had to download my new Ruby on Rails IDE Rubymine 4.5.4 (106MB) over 3G with Orange because Virgin Media wasn't playing ball again.&lt;br /&gt;
&lt;br /&gt;
I spoke to Virgin about this problem tonight, and despite seemingly dozens of customers suffering the same problem they don't have a solution.

So...it looks like I'll switching my broadband supplier soon.&lt;br /&gt;
&lt;br /&gt;
Update: They sent me to their forum, where I was told to leave a comment on the wrong thread. I eventually found a more suitable thread where I left a comment. This got picked up and they sent out some new kit - a Superhub. Problem solved!</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/1729882968503321040/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/09/dmg-image-data-corrupted-dowloading.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/1729882968503321040?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/1729882968503321040?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/09/dmg-image-data-corrupted-dowloading.html" title="dmg image data corrupted - dowloading from Virgin Media Broadband" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;A0UARnw_fCp7ImA9WhJQEU8.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-7887513531401470292</id><published>2012-07-24T12:27:00.000+01:00</published><updated>2012-07-24T12:27:27.244+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-24T12:27:27.244+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lucene" /><category scheme="http://www.blogger.com/atom/ns#" term="examine" /><category scheme="http://www.blogger.com/atom/ns#" term="Umbraco" /><title>Using Examine and Lucene to search Umbraco content</title><content type="html">I'm a relative noob with Umbraco, but today I was tasked with building content search functionality on the e-commerce site I'm currently building.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx"&gt;This post, Examining Examine,&lt;/a&gt; was invaluable, as was the Lucene index query tool &lt;a href="http://www.getopt.org/luke/"&gt;Luke&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Got it all working in a couple of hours - job done!</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/7887513531401470292/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/07/using-examine-and-lucene-to-search.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7887513531401470292?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7887513531401470292?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/07/using-examine-and-lucene-to-search.html" title="Using Examine and Lucene to search Umbraco content" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0AFSH48cSp7ImA9WhJTGEU.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-7039377904853009779</id><published>2012-06-28T12:04:00.000+01:00</published><updated>2012-06-28T12:08:39.079+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-28T12:08:39.079+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ajax" /><category scheme="http://www.blogger.com/atom/ns#" term="updatepanel" /><category scheme="http://www.blogger.com/atom/ns#" term="jQuery" /><title>Blocking UI while loading Ajax UpdatePanel</title><content type="html">To display a loading image and block the user interface while awaiting new content for an updatepanel you can put this JS code at the bottom of your master page. This uses the jquery.blockui.js plugin and will work site-wide:

&lt;script src="https://gist.github.com/3010693.js"&gt; &lt;/script&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/7039377904853009779/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/blocking-ui-while-loading-ajax.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7039377904853009779?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7039377904853009779?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/blocking-ui-while-loading-ajax.html" title="Blocking UI while loading Ajax UpdatePanel" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;D0UNRHwycCp7ImA9WhJTEE8.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-6742850716324266447</id><published>2012-06-18T14:14:00.001+01:00</published><updated>2012-06-18T14:14:55.298+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-18T14:14:55.298+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="windows" /><title>Reverse Windows mouse scroll wheel</title><content type="html">You're so used to the mouse wheel direction in OSX Lion that you want to reverse your mouse wheel in windows, right? Just change every entry in your registry for 'flipflopwheel' to '1' instead of '0'.

Simples.</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/6742850716324266447/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/reverse-windows-mouse-scroll-wheel.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/6742850716324266447?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/6742850716324266447?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/reverse-windows-mouse-scroll-wheel.html" title="Reverse Windows mouse scroll wheel" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;A0IMQng4fCp7ImA9WhVaFkw.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-5766296421545974400</id><published>2012-06-13T21:33:00.000+01:00</published><updated>2012-06-13T21:33:03.634+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-13T21:33:03.634+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVC" /><category scheme="http://www.blogger.com/atom/ns#" term=".net" /><category scheme="http://www.blogger.com/atom/ns#" term="elmah" /><title>Elmah and MVC - 404 and 403 access and permission errors</title><content type="html">I've said it before and I'll say it again - I love Elmah. But today I had trouble getting it to work with my latest MVC project which is due for launch. It took some googling to find out exactly what the problem was, and I had to piece together hints and tips from across the web.

So, in short, take the latest Elmah.dll and drop it into your bin directory.

Add this line to your RegisterRoutes method in Global.asax.cs:

&lt;pre name="code" class="csharp:nogutter"&gt;routes.IgnoreRoute("elmah.axd")&lt;/pre&gt;

Then you need to configure your webconfig file like &lt;a href="https://gist.github.com/2926327"&gt;my gist on github&lt;/a&gt;. Just look for all the 'Elmah' bits and do the same.

Then visit http://yourserver/Elmah.axd and you'll see your error logs. Cool huh?</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/5766296421545974400/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/elmah-and-mvc-404-and-403-access-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/5766296421545974400?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/5766296421545974400?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/elmah-and-mvc-404-and-403-access-and.html" title="Elmah and MVC - 404 and 403 access and permission errors" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DU4FRHw9eip7ImA9WhVaFE0.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-7513686350090716062</id><published>2012-06-11T10:44:00.001+01:00</published><updated>2012-06-11T10:45:15.262+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-11T10:45:15.262+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework" /><category scheme="http://www.blogger.com/atom/ns#" term="debugging" /><title>See 'EntityValidationErrors' property for more details</title><content type="html">This morning I was doing a db.SaveChanges() and getting the error:

&lt;pre&gt;See 'EntityValidationErrors' property for more details&lt;/pre&gt;

I'd seen this umpteen times before and always resolved it quickly without having to to look at the EntityValidationErrors property. This morning however I couldn't work our where it was failing, and what field I needed to pay attention to, so I really did need to look into this property. After a bit of googling and good old Stack Overflow, I found this to be the easiest way. Simply put the following into your watch list:

&lt;pre name="code" class="csharp:nogutter"&gt;
((System.Data.Entity.Validation.DbEntityValidationException)$exception).EntityValidationErrors&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/7513686350090716062/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/see-entityvalidationerrors-property-for.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7513686350090716062?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/7513686350090716062?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/see-entityvalidationerrors-property-for.html" title="See 'EntityValidationErrors' property for more details" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CUYCSHs4cSp7ImA9WhVbFk4.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-603610665643016381</id><published>2012-06-02T11:23:00.000+01:00</published><updated>2012-06-02T11:32:49.539+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-02T11:32:49.539+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="data attributes" /><title>Using hyphenated data attributes in MVC</title><content type="html">In .net MVC this doesn't work:

&lt;pre name="code" class="csharp"&gt;
@Html.TextBox("name", null, new { @class = "input-xlarge", @data-input = "75"})
&lt;/pre&gt;


The hyphenated 'data-input' attribute causes the error "Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access."

Well, as of MVC 3, you can actually use an underscore instead, like so:

&lt;pre name="code" class="csharp"&gt;
@Html.TextBox("name", null, new { @class = "input-xlarge", @data_input = "75"})
&lt;/pre&gt;

And it'll handle it for you, converting it to a hyphen. It knows you want a hyphen rather than an underscore as underscores aren't valid in html attributes. Lucky huh?

&lt;pre name="code" class="html"&gt;
&lt;input name="name" class="input-xlarge" data-input="75"&gt;
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/603610665643016381/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/using-hyphenated-data-attributes-in-mvc.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/603610665643016381?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/603610665643016381?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/06/using-hyphenated-data-attributes-in-mvc.html" title="Using hyphenated data attributes in MVC" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;CUQDQ3g_fCp7ImA9WhVWGUs.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-6017298025234333200</id><published>2012-05-02T13:55:00.000+01:00</published><updated>2012-05-02T13:56:12.644+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-02T13:56:12.644+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="IIS" /><title>asp.net MVC 403 error when deployed to IIS7.5</title><content type="html">Today I had to deploy my test .Net MVC app to Win Server 2008, IIS7.5, but I kept getting a 403 forbidden error when visiting the site.

It turned out that despite setting my app pools to use .Net 4.0 you have to register .Net 4 with IIS. I'm not sure if I've understood it correctly or got my terminology correct, but this command-prompt solution I found on &lt;a href="http://stackoverflow.com/questions/6011636/403-forbidden-on-basic-mvc-3-deploy-on-iis7-5"&gt;StackOverflow&lt;/a&gt; sure hit the spot:

&lt;pre name="code" class="csharp:nogutter"&gt;
cd \
cd Windows\Microsoft .NET\Framework\v4.xxx.xxx
aspnet_regiis -i
&lt;/pre&gt;

Big-up to &lt;a href="http://stackoverflow.com/users/281614/michael-shimmins"&gt;Michael Shimmins&lt;/a&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/6017298025234333200/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/05/aspnet-mvc-403-error-when-deployed-to.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/6017298025234333200?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/6017298025234333200?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/05/aspnet-mvc-403-error-when-deployed-to.html" title="asp.net MVC 403 error when deployed to IIS7.5" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D0YDQXc5eCp7ImA9WhJVEUs.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-3262595157841487019</id><published>2012-04-30T10:49:00.000+01:00</published><updated>2012-08-28T15:46:10.920+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-28T15:46:10.920+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="Twitter Bootstrap" /><category scheme="http://www.blogger.com/atom/ns#" term="datepicker" /><title>Twitter Bootstrap datepicker British format dd/mm/yyyy</title><content type="html">This morning I've been using Scott Storborg's Twitter Bootstrap datepicker (which I believe he has now pulled from Github), which looks and works beautifully, but wasn't in my required date format. I couldn't find much documentation on how this might be modified, but I figured out the following works:

&lt;script src="https://gist.github.com/2556909.js?file=gistfile1.js"&gt;&lt;/script&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/3262595157841487019/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/04/twitter-bootstrap-datepicker-british.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/3262595157841487019?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/3262595157841487019?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/04/twitter-bootstrap-datepicker-british.html" title="Twitter Bootstrap datepicker British format dd/mm/yyyy" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUQCRX4_cSp7ImA9WhVWFUw.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-2562617088932412192</id><published>2012-04-27T08:56:00.000+01:00</published><updated>2012-04-27T08:56:04.049+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-27T08:56:04.049+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><title>Cross-browser safe javascript console logging</title><content type="html">You can keep this in your js code and it won't error on non-supporting browsers:

&lt;pre name='code' class='csharp:nogutter'&gt;
if(window.console.log&amp;&amp;window.console){window.console.log('This is safe!');}
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/2562617088932412192/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/04/cross-browser-safe-javascript-console.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/2562617088932412192?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/2562617088932412192?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/04/cross-browser-safe-javascript-console.html" title="Cross-browser safe javascript console logging" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;A0QASHYyfSp7ImA9WhVXE08.&quot;"><id>tag:blogger.com,1999:blog-5628236597237771110.post-5058019650427261850</id><published>2012-04-13T16:01:00.001+01:00</published><updated>2012-04-13T16:02:29.895+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-13T16:02:29.895+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="P3P" /><category scheme="http://www.blogger.com/atom/ns#" term="IE" /><category scheme="http://www.blogger.com/atom/ns#" term="Rails" /><title>Setting a P3P header in Rails - Session cookies in iframes in IE</title><content type="html">Friday 13th, and today I spent far too long battling with a problem that I should have recalled from a previous skirmish. Never shall I forget again!&lt;br /&gt;
&lt;br /&gt;
Some versions of IE, on some versions of Windows, have stricter policies regarding 3rd party content served through an iframe. Confusingly, the same browser (IE8 for example) will behave differently on different Win versions: some will allow session cookies, and some won't. You know you've been nobbled when you see the evil eye at the bottom of the browser with a red sign on it.&lt;br /&gt;
&lt;br /&gt;
The way round this is to send a P3P header with a compact privacy policy in your iframed content:&lt;br /&gt;
&lt;pre name="code" class="csharp:nogutter"&gt;class ApplicationController &lt; ActionController::Base
...  
  before_filter :set_p3p
...
  private
    # for IE session cookies thru iframe
    def set_p3p
      headers['P3P'] = 'CP="ALL DSP COR CURa ADMa DEVa OUR IND COM NAV"'
    end
end
&lt;/pre&gt;</content><link rel="replies" type="application/atom+xml" href="http://dot-net-web-developer-bristol.blogspot.com/feeds/5058019650427261850/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/04/setting-p3p-header-in-rails-session.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/5058019650427261850?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5628236597237771110/posts/default/5058019650427261850?v=2" /><link rel="alternate" type="text/html" href="http://dot-net-web-developer-bristol.blogspot.com/2012/04/setting-p3p-header-in-rails-session.html" title="Setting a P3P header in Rails - Session cookies in iframes in IE" /><author><name>Ed</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://1.bp.blogspot.com/-mANb1LXfEAI/T2rvIjem5RI/AAAAAAAAAvY/DSvy34M7-gg/s220/avatarFullSQ.jpg" /></author><thr:total>5</thr:total></entry></feed>
