Thursday, October 24, 2013

Inspecting Angular Forms

I have a long, multi-part Angular form on my <a href="http://www.divorces.ca/" title="Toronto Uncontested Divorces - Lawyer Prepared">new website</a>. At a certain point, I began to find it difficult to review the source to ensure that the model being produced lined up with the output I wanted, so I wrote a bookmarklet that displays the ngModel attribute above each form control. The current version unfortunately requires jQuery to be used on the page. [codesyntax lang="javascript"]
javascript:$('.debugAngular').remove();$("[ng-model]").each(function(i, el){ var pos = $(el).offset(); varNewEl = $("body").append('<div style="position:absolute;z-index:9999;top:'+(pos.top-15)+'px;left:'+pos.left+'px;background:#000;color:#fff" class="debugAngular">'+$(el).attr("ng-model")+'</div>') });
[/codesyntax]

Originally posted by William Barnes (Billy Barnes)

Monday, September 16, 2013

Dojox/Socket, Node.js, and Socket.io

I've been playing around with node.js and I decided to try setting up a web socket connection. I'm using socket.io on the server side and Dojo Toolkit on the client side. Things on the server-side were straightforward. However, I decided to give dojox/socket a shot and got the following error:
-debug- destroying non-socket.io upgrade
As it turns out, dojox/socket is a fairly plain wrapper over the browser's built-in Websocket object (with long-polling support added). Socket.io does rather a bit more and (rightly or wrongly) seems to prefer talking to itself. Luckily, if you're not too picky, you can easily include the official (AMD-compatible) socket.io client: [codesyntax lang="javascript"]
require([  	'../socket.io/socket.io.js'  ], function(io) {  	var socket = io.connect('ws://localhost:8000');  	socket.send("Hiya server!");  });
[/codesyntax] Note that the proper relative path to the socket.io.js file has to be specified (the proper version of this file is automatically served by socket.io through node.js).

Originally posted by William Barnes (Billy Barnes)

Thursday, May 9, 2013

Wednesday, May 8, 2013

Tuesday, May 7, 2013

Monday, May 6, 2013

Sunday, May 5, 2013

Saturday, May 4, 2013

Friday, May 3, 2013

Thursday, May 2, 2013

Wednesday, May 1, 2013

Tuesday, April 30, 2013

Monday, April 29, 2013

Sunday, April 28, 2013

Saturday, April 27, 2013

Friday, April 26, 2013