My new MacBook Pro!!

January 10th, 2013 by admin No comments »

I just received my newest toy at work, a brand new 15″ MacBook pro!! I used to be a pretty tough critic of MacBooks back when my wife was using them at her job doing graphic design work, and now I admit I was that was because I truly didn’t understand the quality of these machines. Granted, Macs have came a long way from their past, but this machine is a beast, its just an amazing piece of hardware, here are specs:

15-inch MacBook Pro with Retina display

• 2.6GHz Quad-core Intel Core i7, Turbo Boost up to 3.6GHz
• 16GB 1600MHz DDR3L SDRAM
• 512GB Flash Storage
• Backlit Keyboard (English) & User’s Guide (English)
• Apple Thunderbolt to Gigabit Ethernet Adapter
• Mini DisplayPort to VGA Adapter

I set it up to dual boot Windows 8 as well and that has pretty much gone without a hitch using Bootcamp that comes with the Mac. I think installed refit to allow me to choose the OS I want, otherwise the mac always just boots into windows 8 which I probably don’t want to do everytime the machine boots up. Refit was the only hiccup that I have experienced so far, it took around 6 restarts to finally get the refit screen to come up and I have noticed others experiencing that online as well, but its running like a champ now.

I have already went thru a tutorial and wrote a simple iPhone app, :), I have been wanting to do that for a while and its not that bad once you get the hang of it. Expect some blog posts about that down the road as well, :).

So far the default installed software on the mac is able to replace pretty much everything I did on windows except visual studio. The only reason I have visual studio and windows on this machine is for the windows azure emulator, which I plan on figuring out a way around it down the road.

MacBook Pro

Getting 500 errors with Windows Azure and IIS

January 8th, 2013 by admin No comments »

I have yet another fix for anyone that is having problems running windows azure and getting the 500 errors, details follow.

features

Basically all I had to do was check the boxes you see here in “Windows Features” and all was well, I have no idea why this fixes this problem.  My guess is that somewhere along the line, Microsoft forgot to include this stuff in the Azure Tools SDK.  I hope this helps someone, thanks.

How to correctly use the parse function in backbone.js

January 5th, 2013 by admin No comments »

Ok, I have been looking for this example for a long time myself, so I thought I would post it to my blog for anybody strugging with this themselves. When you use fetch() to get a collection it does a great job of setting the properties of your model, the one thing it does not do is set nested collections, so I have an example below of using backbone’s parse() function and how to take your response that has arrays on it and turn those into new collections and set it back to your main model.

If you would rather use a library and have all your models structured nicely to have backbone handle the work for you, and you have a project that has a lot of models and collections, I would recommend looking into the Backbone-Relational library, it looks very nice. I kinda like to do my own thing and not get the overhead that comes with a third-party, plus this code is very small, vs. the amount of extra you would get with the third party, enjoy.

1parse: function (response) {
2            if (response != null) {
3                response.YourCollection = new yourCollection(response.YourCollection);
4                return response;
5            }
6        }

My hack to stop jQuery events from unnecessarily firing.

January 4th, 2013 by admin No comments »

Recently I created a UI where I had 4 text inputs that will change the calculations after you lose focus of each input, each input has an event I am watching the ‘blur’ event, which is just the lostfocus of the input. You can read more about the jQuery blur event here: jQuery Blur

The problem is that jQuery is throwing these events for each of those inputs because my processing code is setting values in the other inputs, which looks like it tosses the events, so I had to write in a little hack, as seen below:

1$("#YourInputId").on('blur', function (evt) {
2                var $th = $(this);
3                if ($th.hasClass('processing'))
4                    return;
5                $th.addClass('processing');
6               //stuff you want to do or process
7                $th.removeClass('processing');
8            });

This will cause jQuery to stop its processing and wait till its done to fire off, thus not causing any UI weirdness. I hope this is of help to someone, enjoy.

Twitter Bootstrap Datepicker control with custom placement!!

December 29th, 2012 by admin No comments »

There really aren’t many good calendar controls for javascript at the moment, the best one I could find is located here: http://www.eyecon.ro/bootstrap-datepicker/  This guy has done a great job setting up this control for everybody to use and if you use bootstrap it looks and feels just like the rest of the library.  The one problem with the control is that it doesn’t show up anywhere except below your input box, which is bad if you are showing your site in a screen limited place, like an IPad, it will just go below your screen if the control is close to the bottom.

This guy took the project to github here: Original Github repo and I recently forked that and you can get the update I have made here: My Github repo.

A word of warning with my project, I have removed the little caret arrow that the original project had because I didn’t want to take the time to figure out the  triangle by border trick, be my guest if you would like to take that one on, I don’t think its that bad, just needs to be placed at the bottom instead of the top if you are placing the datepicker above the control.

The issue I sort-of resolved, well, hacked for my situation can be found here: https://github.com/eternicode/bootstrap-datepicker/issues/200.  Here is the final result of what my script will do.

datepicker_top_placement

How to dynamically set the template in a Marionette ItemView

December 28th, 2012 by admin No comments »

Don’t judge me on this, I am just trying to offer some help, this took me a lot longer to figure out that it should have, but I am glad I figured it out and I thought I would throw this out there for anybody else struggling with it too. I beat my head into the wall trying to set the template for an itemview and it turns out it was stupid simple, as outlined in the code below:

1var v = new this.options.itemsView({
2    collection: l,
3    itemView: yourItemView.extend({ template: "<div>yourTemplate</div>" })
4});
5//show it in your region
6this.listing.show(v);

As you can see, all you have to do is use the extend method of the itemView and set the template inside of that and voila. This may not be the recommended way of getting this done but it works for me and its nice and simple and allows for some very clean code. I hope this helps someone, enjoy!!

Getting Node Package Manager (npm) to run on Chrubuntu

December 25th, 2012 by admin No comments »

If you have tried to install the node package manager on your chromebook running Chrubutu, you will have probably notice that most of the instructions out there will not work, here is the curl command that worked for me:

curl https://npmjs.org/install.sh | sudo s

Just simply run that and then check that it installed correctly via:
npm -v
If that returns a version number, you are good to go, ready to install to your hearts content :).

Running Ubuntu on the Samsung ARM Chromebook

December 20th, 2012 by admin No comments »

If you have been following my posts you would know that around a month ago I purchased one of the $250 Samsung ARM Chromebook that runs the Chrome OS. Well, I like to tinker so I did some research and learned that you can run a version of Ubuntu called “Chrubuntu” which is basically Ubuntu Linux written for the Chromebook ARM processor. Well, here is a link to the group of people maintaining that project: Chrubuntu Install He has the full instructions on there to get you going with Chrubuntu on your chromebook. A word of warning though with doing this with your machine, the trackpad will not work quite like you want it, but thats nothing a USB mouse won’t fix. I am still struggling with getting audio to work exactly as I would like, but that’s not a big deal since I just plan on doing web development with this machine. Even still, its a very nice way to make better use of this little lightweight netbook. I will post as time goes on interesting things I learn, stay tuned….

Having problems setting focus on your input boxes?

December 13th, 2012 by admin No comments »

I have a html template that contains a table and rows which looks like this below

01<td>
02    <label class="pull-left" data-link="productname<%= elId %>"><%= ProductName %></label>
03    <input class="hidden-phone input-large" id="productname<%= elId %>" type-id="Id" type="hidden" />
04    <a id="mobileRef" href="#mobileModal" role="button" class="visible-phone pull-right" data-toggle="modal">Edit...</a>
05</td>
06<td class="hidden-phone">
07    <label data-link="Rate<%= elId %>"><%= Rate %></label>
08    <input id="Rate<%= elId %>" type-id="Rate" class="input-small" value="<%= Rate %>" />
09</td>
10<td class="hidden-phone">
11    <label data-link="RateUnit<%= elId %>"><%= RateUnit %></label>
12    <select id="unitsSelector<%= elId %>" type-id="RateUnit" class="input-mini" style="width: auto; min-width: 80px;" >
13        <option value="<%= RateUnit %>"><%= UnitAbbr %></option>
14    </select>
15</td>
16<td class="hidden-phone">
17    <label data-link="Cost<%= elId %>"><%= Cost %></label>
18    <input id="Cost<%= elId %>" type-id="Cost" class="input-mini" value="<%= Cost %>" />
19</td>
20<td class="hidden-phone">
21    <label data-link="TotalProduct<%= elId %>"></label>
22    <div id="TotalProduct<%= elId %>" type-id="TotalProduct" class="input-mini">0</div>
23</td>
24<td class="hidden-phone">
25    <label data-link="TotalCost<%= elId %>"></label>
26    <div id="TotalCost<%= elId %>" type-id="TotalCost" class="input-mini">0</div>
27</td>

The problem was that when I set focus using Jquery’s focus() like so:

selectAll: function(id)
{
//this works but gets overridden by something else
$(id.currentTarget).focus();
}

So what I had to do was use the focusin() method outlined here: http://api.jquery.com/focusin/

This seems to set the focus to only the input field and ignores any other focusing that is going on, I hope this helps someone.

Google has no plans to write native windows 8 applications.

December 13th, 2012 by admin No comments »

According to this article, http://www.v3.co.uk/v3-uk/news/2231503/google-shuns-windows-8-for-app-development, Google has announced that they have no plans to write any native Windows 8 applications.

“We have no plans to build out Windows apps. We are very careful about where we invest and will go where the users are but they are not on Windows Phone or Windows 8,” he said.
“If that changes, we would invest there, of course.”

I would assume that since they are saying “Windows Apps” that would include the RT apps that run on the surface device.  Microsoft needs google to back them, if they can’t get google on board with apps, then other companies are going to follow suit and not build apps for the Windows 8 platform.  This could be a huge blow to Microsoft and could kill their average commercial sales, I do think its a bit early to tell how well Windows 8 is going to fare, but from the looks of it, it doesn’t seem promising.It’s not like google is singling out Microsoft, they are investing heavily into iOS apps, if you haven’t noticed, they have redesigned all the apps they make for iOS, and I got to admit, they are extremely slick.  Google maps now includes turn by turn directions, which my iPhone 4 couldn’t do but 4s can, so I no longer have a reason to get the 4s, cause I don’t care about Siri.

Microsoft has been climbing the apple hill for years now and its starting to look like that hill is getting steeper by the day.