Wednesday, January 25, 2012

Windows Phone 7 emulator and computer keyboard

I'm currently working on the Windows Phone version of Blind Friends and I'm using the Facebook C# SDK Framework (like the ASP.NET MVC version).

I had to debug the login page and I quickly got bored of writing my email/password in the emulator... If you have a Windows Phone device, you can enter these information with your fingers but if you debug with the emulator, you maybe want to use your computer's keyboard.

By default, the keyboard is not enabled but activating it on your development computer is easy:

  • to enable the keyboard: press the PAGE UP key (or PAUSE key)
  • to disable the keyboard: press the PAGE DOWN key (or PAUSE key, again)

It's fast and convenient, but some details may annoy you... For example, if you enable the keyboard, the emulator will not support the orientation changes. You have to disable the keyboard, and then rotate the emulator.

For more information on the keyboard mapping: http://msdn.microsoft.com/en-us/library/ff754352(v=VS.92).aspx

Tuesday, January 24, 2012

Windows Azure and Application Pool Timeouts

This article may help you if you use Windows Azure and you want your application to always responds as quickly even after a long period without use...

With default parameters, your app pool is shut down after 20 minutes of inactivity and your application will take a bit more time to respond.

You can simply change the settings if you want your application pool is never shut down:

- First step: create a new folder called "tasks" at the root of your Web Project and add a new file called "timeout.cmd" with this line of command:

   1:  %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00

Once the file created, you need to put the "Copy to Output Directory" property to "Copy Always".


- Second step: add this into ServiceDefinition.csdef (at same level than "<Sites>", "<Endpoints>", ...):

   1:  <Startup>
   2:        <Task commandLine="tasks\timeout.cmd"
   3:              executionContext="elevated" />
   4:  </Startup>


You can find the code here:

Monday, November 7, 2011

Blind Friends : Facebook game

I just launch a Facebook game : https://apps.facebook.com/blindfriends/

I used Facebook C # SDK (http://facebooksdk.codeplex.com/) and the game runs on Windows Azure.

FYI : you need an account with at least 3 friends of each gender...

Friday, September 30, 2011

Bootstrap, a toolkit by Twitter

I am a developer but not a designer... So when I work on a new personnal project, I have no inspiration for the design...
Luckily, Twitter has recently released a new toolkit designed to kickstart development of webapps and sites.

You can find the project page here: Bootstrap, a toolkit by Twitter

This toolkit is supported in these browsers:

  • Latest Safari
  • Latest Google Chrome
  • Firefox 4+
  • Internet Explorer 7+
  • Opera 11

  • The toolkit contains styles for typography, forms, buttons, tables, grids, navigation, and more.

    You can see here an exemple of a simple table with Bootstrap:









    The project is already very good and continues to evolve. It is a very good basis for a web application.

    You can follow the project here: Bootstrap

    Thursday, September 29, 2011

    Customised attribute in ASP.NET MVC


    When developing a multilingual website, I had to change the default route in the Global.asax.cs file (this might be the subject of another post here...).
    Now the route is "{lang}/{controller}/{action}/{id}" instead of the traditional "{controller}/{action}/{id}".
    On top of that, all the routes are translated according to the current culture.

    This change introduced a new problem: the utilisation of the "Authorize" attribute redirects the user when he is not connected (or when he is not in role, etc.):

       1:  [Authorize(Roles = "Admin")]
       2:  public class AdministrationController : Controller
       3:  {
       4:      public ActionResult Index()
       5:      {
       6:          return View();
       7:      }
       8:      
       9:      [........]
      10:  }

    By default the user is redirected on "/Account/LogOn". You can change this in the "web.config" file here:

       1:  <authentication mode="Forms">
       2:    <forms loginUrl="~/Account/LogOn" timeout="28800" />
       3:  </authentication>

    For my problem, it was not a solution because this URL changes according to the culture of the user...
    I can verify at each action if the user is in the "Admin" role and make the correct redirection. But this is annoying, repetitive and it is easy to forget one of the actions...