What I’m doing starting March

this week I’ll continue working on Twilio integration with our web applications at Zgura.

My colleague Anders has added references to Twilio using Nuget. It’s great to see how you can use Twilio extensions for MVC, including TwilioResults.

Very important, before being able to use SIP integration with Twilio, set the voice URL Twilio will use for requests on SIP call. You do that at Twilio site, SIP options. Be aware (at least it was that way last week I was using it) that you can set the type of request for the voice URL. If you make a change to the SIP configuration, request type returns to POST, even that configuration hasn’t been changed. Ensure to review and set it back to GET, if that is the type of request required.

Also this week I’ll be finishing work on another system we are working on, production process management and data collection.

Finally, keep studying for certification (web development). There is a sample application I want to study too: SocialGoal sample app.

Cheers, Danfer.

Timeout issue at Azure Scheduler

Found an issue on implementing service execution using Windows Azure Scheduler. The triggered call is a long running one. Scheduler times-out after 60 seconds, as waiting for response to request made by the job.

The solution I came out with, for my situation, was to modify service code (Web API), making method call asynchronous, so execution of the action method called by Scheduler job request continues and finished on time.

This is the code I used for calling the method asynchronously, at the Web API action method:

Task.Factory.StartNew(() => MyMethodClass.MyStaticMethod(parameter));

Details: http://social.msdn.microsoft.com/Forums/en-US/46f56a6f-204a-416f-b267-b558dbeeffa2/how-to-change-the-timeout-for-azure-scheduler-job?forum=azurescheduler



Starting the year – Improvement through creativity

First post for 2014. I made my New Year’s resolutions, professional field, creating great software with Zgura:

  1. Learn, get certified for Web development, exams 70-480, 70-486 and 70-487 link
  2. Apply SOLID development principles
  3. Always try to improve through creativity

On 3, I’d like to comment on the ideas expressed at Fareed Zakaria GPS program, in an interview to Elon Musk GPS link, summarizing, people working at his company must not just develop technology, they must improve on what has been developed. Just doing one work is not enough, need to improve on existent work.

As such, I’d like to share on an improvement I just implemented, developing on work already done by my colleagues at Zgura:

As we develop ASP.Net MVC apps and deploy continuously from Git into Azure Websites, one website for each stage of development and branch on source control (i.e., development, test, production) we wanted to set and use configuration environment variables for between other things, connection strings to databases, in Azure Websites and get them from Environment variables, using:

public static string ConnectionString
                return Environment.GetEnvironmentVariable("APPSETTING_ConnectionString,"varname");

But after implementing that, we had an issue when trying to do local debugging as the application doesn’t have access to the environment variables repository. A solution I found was to add that variables at Application_Start, under Global.asax.cs:





As per a comment from my friend Salvador Aguilar, I’d like to show a screenshot of deployment configuration into Azure websites.

Continuous Deployment Azure

MVC 4, Keeping Convention over Configuration

I’ve found myself adding several actions methods to a controller, repeating the action method type, like for example, having more than one Index method at the controller. Of course, I add something like ProcessAIndex, ProcessBIndex, etc.

I believe that may not be according to MVC principle of convention over configuration, so think I should have more controllers. I also think I can use Areas to mitigate controllers proliferation I’ll get. Will investigate more and will keep updated.

Twitter Bootstrap Less package on MVC 4

I followed the excellent article from Maarten Sikkema, from Macaw

Very good as it shows how to use Web Essentials plugin for VS to compile Bootstrap LESS files into CSS files.

I was able to successfully publish the site to an Azure Website while keeping simple layout view. I like using a separated navigation bar partial view as to separate that part from the general layout.


MVC Views, Returning to the same view after edit

I’d like to share how to return the same view after adding or editing content to the current item.

I had the case where I was editing a transportation record where I can have one or more containers (in my example).

Since I’m modifying an specific transportation, in the get version of the ActionResult method, is a parameter, lets say:


public ActionResult Create(Guid id)

Once I make the addition, at the POST version of the ActionResult method, I want the user to stay at the same view, for current Transport. if I used something like:

return View("Create", TransportationId)

I got the user back to the same view (page) but he/she can still see the same values just entered before saving, which is confusing and made users to sometimes add containers records more than once. In order to solve that situation I used:

return RedirectToAction("Create", new {id=TransportationId})

RedirectToAction returns a response to the browser and causes it to make a GET request to Create Action. The new… part carries the route parameter (as parameters are included on route querystring.

This way, when users adds the container, he/she can see the same page but with empty values so can keep entering more containers without thinking previous save was not successful.


TEDx Managua

Participé en TEDx Managua como voluntario este recién pasado viernes 6 de septiembre.

Felicidades a los organizadores y ponentes, excelentes presentaciones. Diferente al TedXManagua del año pasado, esta vez hubieron 2 salas donde la audiencia pudo presenciar el evento. Esto aparte del streaming por Internet.

Pueden encontrar más información sobre el evento en su página en Facebook: TEDxManagua FB