Posted by Phil in .NET
on Apr 22nd, 2013 | Comments Off on Netvibes App for Windows Phone 8
This is just a quick post to announce a Windows Phone 8 app I’ve been working on, Netvibes Reader.
It pulls in your RSS feeds aggregated on netvibes.com into native, WP8 app. You can download Netvibes Reader from the Windows Phone store.
Phil
Posted by Phil in ASP.NET MVC
on Sep 6th, 2012 | Comments Off on Creating a proxy with ApiController
I’ve recently moved to MVC 4, and as part of the clean up work I’ve moved a lot of methods I use for AJAX operations to the new ASP.NET Web API, on controllers that inherit from ApiController.
When it came to migrate a proxy action, I was amazed to find how much easier it is to build a proxy, with the method only taking a couple of lines.
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using Http = System.Net.WebRequestMethods.Http;
namespace PhilsVersion
{
public class ProxyController : ApiController
{
[AcceptVerbs(Http.Get,...
Posted by Phil in Uncategorized
on Aug 17th, 2012 | 1 comment
This is a minor annoyance at worst, but the VS2012 rules for <legend /> being mandatory in a <fieldset /> is wrong, legend should be optional.
If you’re like me, and refuse to stand for such things, you can easily hack a couple of files to fix it, the files are as follows:
C:Program Files (x86)Microsoft Visual Studio 11.0BlendHtmlSchemasenhtml_5.xsd
C:Program Files (x86)Microsoft Visual Studio 11.0Common7Packagesschemashtmlhtml_5.xsd
C:Program Files (x86)Microsoft Visual Studio 11.0Common7Packagesschemashtmlxhtml_5.xsd
In each of the files, find the following line and change...
Posted by Phil in Uncategorized
on May 18th, 2012 | Comments Off on ASP.NET MVC3 EditorFor that looks for inheritance
Today I ran into issue with MVC 3 where a view with a model type TModel won’t check to see if the model’s instance is a subclass of TModel, resulting in any attributes on overridden properties being ignored. This is because the metadata is read from the type specified in the view, and not the actual instance.
For example, with the following class structure and view will never render “SomeProperty” as “required”, even if the model is an instance of InheritedClass.
Classes:
public class BaseClass
{
public virtual string SomeProperty { get; set; }
}
public class...
Posted by Phil in .NET, Entity Framework
on Feb 21st, 2012 | 5 comments
I’ve just started using Entity Framework, and I’ve found that it really helps speed up development time when dealing with queries where performance isn’t a huge issue.
I added to an existing project which needed to keep the EF classes isolated in the data layer. This made it difficult to pass in a sort order without having a massive switch statement to deal with each of the options.
I solved this by building an OrderBy extension method that takes a string, and builds the sort expression using reflection. This means you can sort without having to know the actual type of what...
Posted by Phil in JavaScript
on Oct 24th, 2011 | 1 comment
A couple of weeks ago I posted about C# like Properties in JavaScript. I wanted to explore how properties could possibly be added into JavaScript, and hopefully offer some insight into how some frameworks might work.
Another feature that JavaScript doesn’t explicitly support is events. Though using some of the same techniques I used for events also work very well for building events.
Most implementations of events in JavaScript use optional arguments in order to provide two overrides to an “event” function, one for adding a listener and the other for raising the event, like this:
//...