Posted by & filed under User Interface.

Splurged on a new dev rig.  There isn’t a lot of information out there about using two monitors with a Macbook Pro.  There are some third party docks that are built for this purpose.  These products are not necessary with the right cables or adapters.

I hooked up two 1900X1200 Dell monitors with one mini DisplayPort to DisplayPort cable and one HDMI to DVI-D cable.

This is the setup:

Mini DisplayPort to DisplayPort cable

HDMI to DVI-D cable

Two 24″ Dell UltraSharp U2412M Monitors

Macbook Pro

 

devrig

Posted by & filed under IDE.

I needed to get a release build on an running emulator.  So from the command line I did “gradle installRelease”, which resulting in a message “waiting for device”.  The solution was to startup the “Android Debug Monitor” (Tools -> Android -> Monitor) from Android Studio.

Posted by & filed under IDE.

Most times you see this message it means you need to upgrade your existing data or delete any existing data and start over. See this post for more info on that issue.

You will also see this message if if you have multiple configurations in your core data model in Xcode and you forget to add an entity to it’s proper configuration. You can add data to the entity but when core data tries to save the data you will see this error message.

Posted by & filed under Opinion.

The Scobleizer weighed in on Randy Bias’s opinion that Openstack should adopt Amazon’s AWS API.

So who get’s the cloud right – Amazon, Microsoft, Google, Openstack, ect…?

I’ve used AWS quite a bit. I have a project in production on Google App Engine. I keep up on Azure. Which do I like best? Hands down, without a doubt Parse.com.

When I first learned about Parse.com I thought I didn’t need it. I know the server side. I can play the IIS or Apache admin role. I may not know every nook and cranny of those technologies but I can get a website up. I can setup a database server and connect it to a website. I can even program the server side, Python, C#, NodeJs, you name it. I thought to myself, “I’m the man. I just got auto updating in NHibernate working and I can spin up AWS servers from the command line. So why do I want Parse.com?”

My boss, however saw the potential of Parse.com right away and so down that road I went. I work for a software development firm, Red Shed Technology, and we build mobile and web apps. He saw that not managing servers is a major benefit for us.

Of all the major cloud providers, Google App Engine comes closest to parse. With GAE you do not need to worry about servers. You do, however, need to write a lot more code to get your solution up.

So what makes Parse.com special? Well besides always needing to type “Parse.com” in any google search because the word “parse” is too broad? It is dead simple and covers a large percentage of use cases. With Parse.com and a good client side SPA like AngularJS I can build web apps or mobile apps with phone gap and never need to spin up a server or setup a database. What’s more I get an app framework on the server that includes user registration, password management, login and roles. I get a framework for tracking mobile installations. I get push messaging to mobile.

Parse.com’s original mission was to create a backend service for mobile developers that needed backend functionality but had no server side experience. They did an amazing job and Facebook’s acquisition of them shows that. Facebook is now a cloud provider, and one with a big upside.

I used to work for a Fortune 500 company who could learn a lot from how Parse.com supports developers and gives them the backend tools to build a large variety of apps, the data for which is on a common platform and under centralized control. Just the centralized user account management would probably save them millions. I mean really, imagine the potential.

Scoble talks about innovation. So how can Openstack innovate, or AWS or Azure or Google? Make it dead simple for companies to give their developers the Parse.com API or something similar (plenty of room to innovate here) in a cloud environment that they can control.

I’ve had experience working inside two enterprise level environments and they both desperately needed this solution. Millions are wasted because developers are solving too many problems and solving the same problems over and over.

As for me, I’ve said goodbye to the server, fell in love with Javascript, traded my PC for a Mac, Visual Studio for WebStorm and life is good :).

Posted by & filed under Web API.

Mattieu Gamach lays it out nicely here.

Application ID: This is the main identifier that uniquely specifies your application. This is paired with one of the keys below to provide your clients access to your application’s data.


Client Key: This key should be used in consumer clients, like the iOS or Android SDK. It adheres to object level permissions. If your app has client push enabled, it can be used to send push notifications from the iOS and Android SDKs.


JavaScript Key: This key should be used in JavaScript SDK applications. It also adheres to object level permissions.


Windows Key: This key should be used in the Windows 8 and Windows Phone 8 SDK. It adheres to object level permissions. It cannot be used to send push notifications to iOS and Android devices.


REST API Key: This key should be used when making requests to the REST API. It also adheres to object level permissions.


Master Key: This key is only allowed to access the REST API and does not adhere to object level permissions. This is equivalent to admin level access and should be kept secret.


You’ll find all these keys on the dashboard page of your app.

Posted by & filed under User Interface.

I saw this little nugget in the Parse.com JavaScript library.  It took me a second to figure it out but once I got my head around it I started using it.  It is a very nice way to control your variable scoping in javascript.

//self executing function
(function(root) {
    //root is the global context

    //setup namespacing
    root.MyNamespace = MyNamespace || {};
    MyNamespace.Classes = MyNamespace.Classes || {};
    
})(this) // <- pass in the global context

Posted by & filed under IDE.

As my previous post shows I recently installed MVC 4 on my development machine.  I ran into an annoying gotcha by doing this.

I have an MVC 3 app that I maintain and I needed to make a small change to a previous version of the app in our test environment.  I should have been pretty straight forward. I branched my in progress changes, updated to the version in test, made the change and rebuilt the app.  Then I pushed the new dlls to the server, assuming everything would work.

To my surprise I was getting exceptions in previously working code.  Turns out the MVC 4 install updated the System.Web.Helpers dll in the GAC.  This caused my project to now have a dependency on this new version.  The fix was pretty straight forward, I just set the “copy local” flag in the project reference, rebuilt and pushed that dll to server.  I also need to update the web.config to reflect the dependency on this version.

<add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral" />

Posted by & filed under Server Admin.

There is a lot of great advice out there about remote debugging in Visual Studio.  But what I didn’t find was what I needed, so I’m adding it here.

Depending on how you are running the remote debugger you may need TCP port 135 or 4015.  Also I think I saw the service wants UPD ports 450 and 4500 open.  I opened all of those both in Windows Firewall and AWS security group.  This allowed me to get the initial connection but then the process would hang.

So after many dead ends I downloaded and fired up TCP View on the AWS server and low and behold I found that the remote debugger process (msvsmon.exe) was also opening two ports in the 49000’s.  This would be different every time it started.  (I was running it manually with no authentication.)  The solution to the problem was opening ports 49200-49499 in the AWS security group.

Posted by & filed under IDE.

VS 2010 does support the new MVC 4, which includes the new Web API.

You need VS 2010 SP1 which you can get through the web platform installer (WPI).

I could not find the MVC 4 in my WPI.  Not sure why but you can get it here (http://www.microsoft.com/web/gallery/install.aspx?appid=MVC4VS2010)

The download opens WPI but I needed to close WPI first to get the download to work.

 

VS 2010 in WPI

SNAGHTML3f5b87a

MVC 4 in WPI

SNAGHTML3f64177

Posted by & filed under User Interface.

I was on a project recently that had the business requirement to automatically save data as it was entered.  This can be accomplished be hooking into the onChange event of your ui controls.

When you add Knockout into the mix you can get some very nice functionality with very little effort.

First thing we need is a form.  (note: this form is marked up with Twitter Bootstrap classes.)

<form class="well">
  <fieldset>
   <legend>Auto Save Form</legend>
   <div class="control-group">
      <label class="control-label">First Name</label>
      <input type="text" data-bind="value: FirstName, event: { change: saveForm }"/>
   </div>
   <div class="control-group">
      <label class="control-label">Last Name</label>
      <input type="text" data-bind="value: LastName, event: { change: saveForm }"/>
   </div>
   <div class="control-group">
      <label class="control-label">Email</label>
      <input type="text" data-bind="value: Email, event: { change: saveForm }"/>
   </div>
  </fieldset>
</form>

This form includes both the Knockout js file as well as the Knockout mapping plugin.

In the JavaScript the first thing we do is setup our observables.  Many times I will will use the knockout mapping plugin to setup my viewModel.  Another technique that can be improve page loading times is to retrieve the viewModel data via an ajax call to the server while displaying some sort of “loading” indicator.   For this demo however I will keep it simple.

   var viewModel = {
      FirstName: ko.observable(''),
      LastName: ko.observable(''), 
      Email: ko.observable('')
   };
   ko.applyBindings(viewModel);

Now all we need is the saveForm function.  Knockout will pass two parameters to this function “data” and “event”.  This is well documented here.

The “event” parameter is the DOM event object.  This is very useful if you need to have a reference to the control that fired the event.  That can be retrieved using event.target.

In this example I will only use the “data” parameter.  The “data” parameter is always the parent object of the element the control is bound to.  In this case that is the viewModel object.  Inside a foreach or with binding this could be a child or other descendent of the viewModel.

The saveForm function uses the jQuery ajax function to post our viewModel to the server.

   function saveForm(data, event) {
      $.ajax({
         type: "POST",
         url: '/SaveForm',
         data: ko.mapping.toJS(data),
         success: function(result) {
            if (result) {
               //update viewModel with any changes from the server
               notify(result.Message, 'success');
               for (var prop in result) {
                  if (prop != 'message' && data[prop]() != result[prop])
                     data[prop](result[prop]);
               }
            } else
               notify("Changes Failed", 'error');
         },
         error: function(req, status, error) {
            notify("Changes Failed", 'error');
         }
      });
   }

The first thing to notice is how the viewModel is converted to a JavaScript object using the knockout mapping plugin – ko.mapping.toJS(data).

In this example the server will pass back a JSON object that almost matches our viewModel structure with the exception of a property called “Message”.  Because the result object matches our viewModel we can loop through the properties of the result object and update our viewModel will any values that were changed on the server.  This technique can be very useful if you want to compute values in your viewModel on the server and update them client side.

That’s pretty much it for the purposes of auto saving.

You can see a working demo and download the source files here.

Lastly I have a notify function that wraps a call to the noty jQuery plugin.  This is a nice plugin for notifications that I have been using lately.

Here is the notify function.

function notify(message, type) {
      noty({
         "text": message,
         "theme": "noty_theme_twitter",
         "layout": "top",
         "type": type,
         "animateOpen": { "height": "toggle" },
         "animateClose": { "height": "toggle" },
         "speed": 500,
         "timeout": 5000,
         "closeButton": false,
         "closeOnSelfClick": true,
         "closeOnSelfOver": false,
         "modal": false
      });
   }