Wednesday, September 19, 2012

I am learning both PhoneGap and SignalR and figured out tonight how to enable both polling and message sending under PhoneGap, at least within the Windows Phone emulator. I have not tried on my Android phone yet. That will wait until I deploy the server hub.

Server Side Code

using SignalR.Hubs;

namespace Vocab.SignalR.SignalR.Sample

{

public class Chat : Hub

{

public void Send(string message)

{

// Call the addMessage method on all clients

Clients.addMessage(message);

}

}

}

Yes. That is all. That means when any JavaScript client calls the Send method, the server will dispatch the message to all connected clients by calling their "addMessage" JavaScript method. Clients is declared as dynamic to allow this to work.

HTML & JavaScript Code Under PhoneGap and Windows Phone Emulator

Pay attention most to the blue italicized lines. That's what I had to do in order for the Windows Phone emulator and/or PhoneGap to work properly. At one point before both of those lines, I had it able to get new messages when sent by the server, but it would not send messages to the server. Now it all works! See the section underneath for a standard HTML client that I run within a web browser on the desktop, which has nothing to do with PhoneGap or mobile jQuery whatsoever. But, both the phone app and the page are able to send and receive messages from and to each other now.

You may notice that not all the variable names or page elements have the same names. This is fine. The only important part is that the chat instance have an "addMessage" function, and that when the #broadcat button is clicked it calls client.send, as both of these correspond to what we saw above in the server hub code.

Agile Remedy: living standards and openness to modern and changing realities

I'm Louder = More Power Boss: the boss, when his thinking is challenged, responds by speaking louder, emphasizing he has more power than the employee.

Agile Remedy: a flatter structure, managers who are not bosses, but service-oriented leaders and hands-on

Priorities Ping Pong Boss: this boss exercises his control by shifting employees from one priority project to another at will, often leaving a trail of unfinished work behind.

Agile Remedy: singluar focus until completion on tasks and projects, not rapid reassignment based on a "fighting fires" approach.

Everything's Easy and Instant Boss: this boss assures you that your new assignment is simple, will not take long, and must be done instantly, no matter what. These bosses continually assign a fixed, non-negotiable amount of work to someone and require that it be completed by a fixed, non-negotiable, and arbitrary deadline. In software development, this is a typical "waterfall" or "big bang all at once" approach.

This list is a simple draft too. But, I really like having short-hand names for these bad behavior patterns, so it would also be nice to have short-hand names for the good behaviors.

We're going to record the results of what happens with an Everything's Easy and Instant Boss does push his a arbitrary deadline onto a much smaller scale: that of reading a couple of paragraphs. It's kind of an obvious failure case, isn't it? But, if a human being cannot predict with any accuracy how long a couple of paragraphs will take to read aloud, then why do they keep getting away with telling customers that a project can be "complete with high quality and correctness" by an arbitrary deadline?