Originally written for eImagine Technology Group at blog.thinketg.com.
Introduction
If you have ever tried to develop a real-time chat web application (or pretty much any other sort of real-time web app) you have likely ran into a rough realization: either you go with a third-party solution or roll your own in creating a very complex system to mimic real-time feedback in the world of HTTP.
Traditionally you would use AJAX routines to make constant callbacks to a server that would serve as a conversation mediator with each client/browser sending and receiving to it centrally on a timed loop. On each pulse of the timer, the client asks the server if it has new text/data for it from the other party and may also push up the latest message it has to send to them. This works really well when done properly, but causes some noticeable lag in messaging and can restrict the features you can offer compared to other similar apps people are used to (like iMessaging on your iPhone) or using the Google Talk client on your desktop).
You wouldn't think this would be so hard, but the web (and its underlying protocols) was raised up on the concept of stateless connectivity (not maintaining an active connection to a server or client for long periods of time).
HTML5 Goodness
In comes the concept of WebSockets. Introduced in HTML5, WebSockets allows a persistent connection between the client(s) and server and for them to send payloads of data back and forth while raising events. The connection can be SSL secured as well, in case you plan on sending sensitive data (and what data ISN'T anymore?). If you want to learn more about implementing WebSockets yourself, look no further than the good folks at HTML5Rocks as they have some great examples to get you started.
Is That It?
No, that isn't it! All of that is preface to this: there is an easier way.
Much like the ATLAS plugin led the way of AJAX development for ASP.Net back before it was so ubiquitous, a fairly new project called SignalR is making it easy to add WebSocket technology to your ASP.Net projects. The beauty of it is that, should your browser or end client not support the emerging HTML5 spec, it gracefully falls back to other methods without the programmer having to generate code for those specific cases.
How It Works
You install the SignalR package, make a couple of calls server-side to prep the app for receiving the connection, and the rest is JS magic. By using a standard set of calls, SignalR wraps all of the behind-the-scenes fallback code and such so you don't have to worry about it. You open a connection and wait for data to be transmitted (via JS event callbacks) and/or transmit data using the active connection object you established. For specific code examples, check out the documentation page of SignalR.
Final Thoughts
Whether you are a seasoned professional or just entering into the mix, project such as SignalR can jump-start you into new areas of development with little barrier to entry. Since WebSockets is so new, this is a great way to test it out and begin thinking about the next killer app that is now enabled by this great technology.
Matt's Nerd Werd
News, findings, and observations in all things tech.
Friday, April 12, 2013
Lighting the SignalR Fire: WebSockets Made Easy
Labels:
AJAX,
HTML5,
HTTP,
javascript,
SingalR,
SSL,
Web services,
web socket,
WebSocket
| Reactions: |
Monday, March 25, 2013
Somebody Make This: Ultimate Playtime with My Daughter
Background
As a father, gamer, and technology enthusiast I often look for ways to belond the multiple facets of my life together. This isn't a new subject; I have talked about this sort of thing at length in the past.
As I am sitting at Starbucks (yes, I am being one of "those people" today), I was my mind was blown apart by the collision/mashup of several things I have been reading about lately. The fused result of this explosion was this: the next evolution in gaming for my daughter.
Imagine This
I can still recall playing with Transformers, He-Man, and G.I. Joe action figures as a youngster and, when I watch my daughter play with her My Little Pony and Barbie collection I am amazed at the commonalities between the genders. Let me try to take you there.
You are sitting on your knees, raised just high enough to see the "action" unfold on your bed. But wait - it isn't your bed, is it? No, of course not. Sometimes it is a mountainous, rugged region resembling a scene at the Grand Canyon. At other times it is a lush rainforest with exotic animals - some of which are alien in nature - lurking about and swinging from tree to tree. Your knees and legs no longer exist and it's a good thing, too - if they did they would be fully submerged in the deepest lake or river imagineable. When you are playing with those figures, the room of the "real world" disappears and is replaced by the canvas of your imagination.
The End Game
You arrive home with your new figure - perhaps it's a Monster High doll that seems to be "the thing" for my 7 year old right now - after a fun-filled shopping trip with your parent. You rush to your room and rip open the packaging (likely losing a plastic hair brush or shoe temporarily in the process) and hold the newly-freed doll up to your eyes for closer inspection. Your index fingers happens across the magic button recessed into the back of the doll and you push it with excitement.
With just a few blinks from the tiny LED in its back, the doll begins emitting a unique identifier, a string of characters, wirelessly into the room for anything that can respond to pick up. The glasses you have on, forgotten in the constant daily use, come to life again and and ask if you want to add the new doll, named "Frankie", to your existing collection to which you quickly say, "Yes!"
You saddle up to the bed as you always have done and, with anticipation at a crescendo, you say, "Monster High... Hallway!" Once again, invisibly to you or anyone else in the room, your glasses come to life and use the built-in 3D scanning capabilities, akin to the Kinect, and scan the space you are looking at. Instantly the glasses are able to calculate the 3D space you are playing in and begin to transform your surroundings.
In a blink your comforter smooths out and becomes a polished, checkered floor. Lockers, shaped like coffins, grow from the floor and now line the walls that form the boundaries of your bed. Faintly you begin to hear a sound - the distinctive "clop" of a high-heel on a hard surface. As the noise grows and multiplies, you start to see where it is coming from as the unnamed student body of Monster High begins to mingle in the hallway before you.
Still clutching your Frankie, you thrust her forward into the mix. With only a second of delay, the student body seems to become aware of Frankie's presence, weaving around her, shouting, "Hey Frankie!" from the background, and - for some - giving her a wayward glance. Your new Frankie is now fully immersed in the Monster High environment that you have come to love from the cartoon episodes and movies.
As you twist the doll to face you, you can't help but feel that this will be boring without some friends, or "frenemies", to talk to so you quickly reach over and retrieve "Cleo" from the tidy storage compartment you keep all of these dolls in (a dad can dream, right?). Pressing the little button on the backside of Cleo signals your glasses that you are ready to include Cleo in the mix. As you bring the second doll into view of the glasses, the environment becomes aware of Cleo's presence and reacts similarly to your introduction of Frankie. Frankie even seems to become aware of Cleo when you hear her say, "Hey there, Cleo! What's up?"
How Far Can You Go
With this sort of system, it isn't a stretch to think that play sets (with real-world items) could register new environmental images or further interact with the characters. Having someone over to play could be even more immersive with both "players" seeing the elements of the environment that the other brings to the table. Environments could be unlocked by purchases or free downloads (or even streaming).
Remember those special episodes of your favorite morning cartoon where the characters from another popular show were visiting? You can mashup and create an amazing mix of options just like that or stay an environmental purist.
Perhaps your GI Joe figurines come under attack from COBRA soldiers and each "joe" has an action button on it. In this case, you might actually be able to see rendered blasts and the firefight that ensues between the two factions. Environmental damage? I don't see why not!
The Tech Behind
I think it is only fair to talk about the technology that is either currently available or on the near-horizon that is driving my imagination and desire to see something similar to that described above to to fruition. These pieces, themselves building upon the great technological structures that have come before them, will undoubtedly serve as the building blocks to this vision.
Skylanders - Again, not the first to blend real-world toys/figures with a digital presence, but definitely the leader. Their platform for all the major consoles has been an overwhelming success and the constant expansion of the Skylander universe is incredible. My niece and nephew have collected nearly every figure and will continue to do so for the foreseeable future.
Disney Infinity - Building upon the success of Skylanders, this similar concept expands upon the existing leader by introducing the "Toy Box" - the ability to build your own adventure from the components of the worlds that you already "own" via the purchased figures, cards, etc. With a deep library of characters at its disposal and existing familiarities with the movie franchises under its control, Disney/Pixar has a lot to offer.
Microsoft Kinect - While intended originally for the Xbox 360 game console, this peripheral can now be integrated with PC software. That mixed with the native 3D depth and visual field capabilities opens up some amazing possibilities that have already started being explored.
Google GLASS - Google is the first company to show a real consumer-level peripheral that mixes the digital with the "real" without impeding your vision. With Google's track record for innovation, it isn't hard to see that this will materialize into scenarios of sci-fi legend.
The Brands - In order for any of it to matter, those same companies that are already producing the bulk of items found in your average kid's room will need to hop on the wagon and try to get ahead of the curve. Integration with this sort of technology will strengthen a brand's presence while being late to the party could jeopardize its future. Hasbro, Mattel, Lego, and Bandai - you are up to bat and it's on you to knock this out of the park.
Putting It All Together
So, after all this, we have to face it: we won't see this device or the software in the next year. What we will see is peripherals launching, competition in those device classes, and a scramble to find the reason consumers demand for them will increase. I think I have a compelling argument for why this could be a strong contender and when the second or third generation comes about, prices and capabilities will be where they need to be to make this ultimate playtime a reality.
As a father, gamer, and technology enthusiast I often look for ways to belond the multiple facets of my life together. This isn't a new subject; I have talked about this sort of thing at length in the past.
As I am sitting at Starbucks (yes, I am being one of "those people" today), I was my mind was blown apart by the collision/mashup of several things I have been reading about lately. The fused result of this explosion was this: the next evolution in gaming for my daughter.
Imagine This
I can still recall playing with Transformers, He-Man, and G.I. Joe action figures as a youngster and, when I watch my daughter play with her My Little Pony and Barbie collection I am amazed at the commonalities between the genders. Let me try to take you there.
You are sitting on your knees, raised just high enough to see the "action" unfold on your bed. But wait - it isn't your bed, is it? No, of course not. Sometimes it is a mountainous, rugged region resembling a scene at the Grand Canyon. At other times it is a lush rainforest with exotic animals - some of which are alien in nature - lurking about and swinging from tree to tree. Your knees and legs no longer exist and it's a good thing, too - if they did they would be fully submerged in the deepest lake or river imagineable. When you are playing with those figures, the room of the "real world" disappears and is replaced by the canvas of your imagination.
The End Game
You arrive home with your new figure - perhaps it's a Monster High doll that seems to be "the thing" for my 7 year old right now - after a fun-filled shopping trip with your parent. You rush to your room and rip open the packaging (likely losing a plastic hair brush or shoe temporarily in the process) and hold the newly-freed doll up to your eyes for closer inspection. Your index fingers happens across the magic button recessed into the back of the doll and you push it with excitement.
With just a few blinks from the tiny LED in its back, the doll begins emitting a unique identifier, a string of characters, wirelessly into the room for anything that can respond to pick up. The glasses you have on, forgotten in the constant daily use, come to life again and and ask if you want to add the new doll, named "Frankie", to your existing collection to which you quickly say, "Yes!"
You saddle up to the bed as you always have done and, with anticipation at a crescendo, you say, "Monster High... Hallway!" Once again, invisibly to you or anyone else in the room, your glasses come to life and use the built-in 3D scanning capabilities, akin to the Kinect, and scan the space you are looking at. Instantly the glasses are able to calculate the 3D space you are playing in and begin to transform your surroundings.
In a blink your comforter smooths out and becomes a polished, checkered floor. Lockers, shaped like coffins, grow from the floor and now line the walls that form the boundaries of your bed. Faintly you begin to hear a sound - the distinctive "clop" of a high-heel on a hard surface. As the noise grows and multiplies, you start to see where it is coming from as the unnamed student body of Monster High begins to mingle in the hallway before you.
Still clutching your Frankie, you thrust her forward into the mix. With only a second of delay, the student body seems to become aware of Frankie's presence, weaving around her, shouting, "Hey Frankie!" from the background, and - for some - giving her a wayward glance. Your new Frankie is now fully immersed in the Monster High environment that you have come to love from the cartoon episodes and movies.
As you twist the doll to face you, you can't help but feel that this will be boring without some friends, or "frenemies", to talk to so you quickly reach over and retrieve "Cleo" from the tidy storage compartment you keep all of these dolls in (a dad can dream, right?). Pressing the little button on the backside of Cleo signals your glasses that you are ready to include Cleo in the mix. As you bring the second doll into view of the glasses, the environment becomes aware of Cleo's presence and reacts similarly to your introduction of Frankie. Frankie even seems to become aware of Cleo when you hear her say, "Hey there, Cleo! What's up?"
How Far Can You Go
With this sort of system, it isn't a stretch to think that play sets (with real-world items) could register new environmental images or further interact with the characters. Having someone over to play could be even more immersive with both "players" seeing the elements of the environment that the other brings to the table. Environments could be unlocked by purchases or free downloads (or even streaming).
Remember those special episodes of your favorite morning cartoon where the characters from another popular show were visiting? You can mashup and create an amazing mix of options just like that or stay an environmental purist.
Perhaps your GI Joe figurines come under attack from COBRA soldiers and each "joe" has an action button on it. In this case, you might actually be able to see rendered blasts and the firefight that ensues between the two factions. Environmental damage? I don't see why not!
The Tech Behind
I think it is only fair to talk about the technology that is either currently available or on the near-horizon that is driving my imagination and desire to see something similar to that described above to to fruition. These pieces, themselves building upon the great technological structures that have come before them, will undoubtedly serve as the building blocks to this vision.
Skylanders - Again, not the first to blend real-world toys/figures with a digital presence, but definitely the leader. Their platform for all the major consoles has been an overwhelming success and the constant expansion of the Skylander universe is incredible. My niece and nephew have collected nearly every figure and will continue to do so for the foreseeable future.
Disney Infinity - Building upon the success of Skylanders, this similar concept expands upon the existing leader by introducing the "Toy Box" - the ability to build your own adventure from the components of the worlds that you already "own" via the purchased figures, cards, etc. With a deep library of characters at its disposal and existing familiarities with the movie franchises under its control, Disney/Pixar has a lot to offer.
Microsoft Kinect - While intended originally for the Xbox 360 game console, this peripheral can now be integrated with PC software. That mixed with the native 3D depth and visual field capabilities opens up some amazing possibilities that have already started being explored.
Google GLASS - Google is the first company to show a real consumer-level peripheral that mixes the digital with the "real" without impeding your vision. With Google's track record for innovation, it isn't hard to see that this will materialize into scenarios of sci-fi legend.
The Brands - In order for any of it to matter, those same companies that are already producing the bulk of items found in your average kid's room will need to hop on the wagon and try to get ahead of the curve. Integration with this sort of technology will strengthen a brand's presence while being late to the party could jeopardize its future. Hasbro, Mattel, Lego, and Bandai - you are up to bat and it's on you to knock this out of the park.
Putting It All Together
So, after all this, we have to face it: we won't see this device or the software in the next year. What we will see is peripherals launching, competition in those device classes, and a scramble to find the reason consumers demand for them will increase. I think I have a compelling argument for why this could be a strong contender and when the second or third generation comes about, prices and capabilities will be where they need to be to make this ultimate playtime a reality.
Labels:
Barbie,
Disney,
Electronics,
Games,
Gaming,
GI Joe,
GLASS,
glasses,
He-Man,
ideas,
Infinity,
Innovation,
Kinect,
Monster High,
My Little Pony,
Playtime,
Skylanders,
Transformers,
Ultimate
| Reactions: |
Tuesday, March 12, 2013
My Application Ideas for Google Glass
What is it?
In case you have missed the news and hype that has come in waves and once agained surged when released to developers early this year, Google Glass (or just GLASS) is the wearable computer and reality augmenter that sits on your face much like a pair of spectacles. The magic device then has a viewable area that displays inside part of the glasses, enabling real-time interaction with the system in conjunction with your real-world experience.
Recently Google held a mini-campaign in which they asked the world, via Google+ and Twitter, to submit ideas on what they would like to use the GLASS system for. In doing so, developers and researchers might get access to early development kits for GLASS (at a heftly price tag of $1,500). From what I can tell, there was an overwhelming number of responses and the campaign was, thus successful.
Throwing My Hat In
I never submitted anything, so I thought I would open a dialog to both predict and, perhaps, seed the next killer app for the GLASS system. Being a software engineer myself, I often look at systems (both in the IT sense as well as the organizational sense) and think of ways that a touch of technology could improve things. I have had my eye on wearable computing and augmented reality systems for a while and this seems like a prime opportunity to actually consider what would make these as imperative to my daily routine as my iPhone (or substitute that for any number of top-ranked smartphones).
So, without further ado, I present...
The List
So, there you have it: 5 quick hits that are fairly obvious (in my opinion). My question now: what can you come up with?
In case you have missed the news and hype that has come in waves and once agained surged when released to developers early this year, Google Glass (or just GLASS) is the wearable computer and reality augmenter that sits on your face much like a pair of spectacles. The magic device then has a viewable area that displays inside part of the glasses, enabling real-time interaction with the system in conjunction with your real-world experience.
Recently Google held a mini-campaign in which they asked the world, via Google+ and Twitter, to submit ideas on what they would like to use the GLASS system for. In doing so, developers and researchers might get access to early development kits for GLASS (at a heftly price tag of $1,500). From what I can tell, there was an overwhelming number of responses and the campaign was, thus successful.
Throwing My Hat In
I never submitted anything, so I thought I would open a dialog to both predict and, perhaps, seed the next killer app for the GLASS system. Being a software engineer myself, I often look at systems (both in the IT sense as well as the organizational sense) and think of ways that a touch of technology could improve things. I have had my eye on wearable computing and augmented reality systems for a while and this seems like a prime opportunity to actually consider what would make these as imperative to my daily routine as my iPhone (or substitute that for any number of top-ranked smartphones).
So, without further ado, I present...
The List
- Life Recorder (productivity) - Ever have a moment pass you by and wish you could play it back? I don't know how many times I have been in the middle of a special event with my daughter only to realize that I was so wrapped up in the "now" to remember to hit "record" so my parents or other family could experience the moment as it was when they couldn't be there. If I had, in essence, DVR for my experiences I wouldn't have to worry about it again. This app would feature:
- Real-time recording and streaming to the cloud at high quality
- Periodic archiving of recorded streams to lower-quality files so nothing is lost altogether, just maybe not as high fidelity
- Timestamping of events and tagging with geographic information for easily finding those moment days later when you get a chance to edit something together (if you are into that sort of thing)
- Easy posting to social media (Google+, Facebook, Twitter, etc)
- Quorum (social) - From concerts to political events, being able to see an indicator as simple as a green/yellow/red light system above people that indicate their response to what is going on. Taken a step further, the venue or person of interest could look at a crowd and quickly make a decision on hw to proceed or just gain some amazing insight in real-time on the response. Think of a DJ in a booth seeing that the crowd is only so-so on the current mix and calling an audible on whether to speed things up or slow things down for the next song. Some crazy features might be:
- Easy gesture recognition (literal thumbs up, thumbs down, or thumb to the side) that translates into equivalent indication online
- Decisions could be put to a vote for a geo-fenced area or worldwide and repsonses fed back in via GLASS gestures as well as aggregated social media response
- Could be an overly high-tech solution to the "coworkers standing around trying to decide where to go to lunch" conundrum
- Games (gaming) - Take the best of geocaching, online gaming (especially first-person shooters), and the role playing genre and blend them together. A multitude of options exist that either would see an extension to the GLASS platform as an additional input/output channel, but what is remarkable are the number of ways the platform could enable games that weren't reasonable to play before. Features that could be mashed-up into a killer game platform:
- Real-time geographic landmarks or waypoints served up in GLASS augmented reality style
- Over-the-head markers that indicate friendly, enemy, or mystery player types of other GLASS users allow the marker system of games like Battlefield and Call of Duty to exist in the augmented real world
- Live-action games such as KAOS can enjoy "kill confirmations" and target acquisition that would normally have to be coordinated using secret keys or
trust
-
Porn (adult) - I can only imagine that this particular industry will see some rapid uses for the technology from their current "POV" systems (literally holding the camera at the often-male protagonists face to simulate the viewer being in the video.
- Hands-free POV system allows an even more realistic experience
- Recording the "choose your own adventure" interactive systems would be that much easier and realistic
- Higher demand for Windex on the set (I couldn't resist)
- Film (general) - As I think back on the few films that I have had the pleasure to work on locally, I am reminded of the good times we had on the set as well as the tough times. We always wish we could have captured some moments and the role of documenting the behind-the-scenes always seems to be a little painful - especially in very small productions. GLASS would allow nearly anyone to serve the rol moving forward. Unprecedented (and automatic) documentation of what it is like to literally be behind the camera would be available to the public.
- Behind the scenes views easier than ever before
- Multiple sets could be recorded and time-synchronized for a plethora of angles that can be edited together or allow interactive experiences for viewers
- Being able to quickly captured the directors "vision" could change the way things are done
So, there you have it: 5 quick hits that are fairly obvious (in my opinion). My question now: what can you come up with?
Labels:
application,
development,
GLASS,
glasses,
Google,
ideas,
iGlass,
list
| Reactions: |
Tuesday, November 27, 2012
iOS and Android Source Control in a Microsoft World
Original posted at http://blog.thinketg.com/blog/matts-geek-corner/ios-and-android-source-control-in-a-microsoft-world
Introduction
Introduction
When I first joined the fabulous team at eImagine Technology Group (ETG) I knew what I was getting back into. As a multi-certified Microsoft (MS) partner, the company has a strong foundation in MS technologies including Sharepoint, Dynamics CRM, Visual Studio, and, of course, Team Foundation Server (TFS). As I was bringing a lot of iOS and Android mobile development experience to the company and had a comfort level with using Git as my primary source code repository I knew there might be some issues with interfacing to TFS. Wouldn't it be wonderful if I could continue to use the Git repository I am comfortable with and mirror it into TFS without a lot of duplicity in effort?
The Solution
I had the crazy thoughts that someone might have developed a bridge for Git to add a TFS endpoint to the list of remote repositories, but I had not expected that the developer of just that sort of thing would be none other than Microsoft themselves. In an announcement in Q3 of 2012, the Git-TF tool was released on CodePlex and is currently in its second major version release.
As the name implies, Git-TF is a java tool built for a multitide of operating systems (HP-UX, IBM AIX, Linux, Mac OS X, Solaris, Unix, Windows 7, Windows 8, Windows Vista, Windows XP Service Pack 2) that allows you to continue to commit code to your local Git repository, push to your usual remote repositories, but also adds the "git tf" or "git-tf" call to check-in, clone, and fetch your code to/from a TFS source. Even better, it only takes a quick configuration call to set the repository up for all future TFS interactions (for that folder/project).
More Information
Ready to give it a shot? Head over to read the announcement and, for fellow developers in the iOS community, read this great post from Edward Thomson on the practical implementation of this handy set of tools. If you are feeling more cavalier, you can jump directly to the CodePlex hosting page (with link to download) by going here.
The Solution
I had the crazy thoughts that someone might have developed a bridge for Git to add a TFS endpoint to the list of remote repositories, but I had not expected that the developer of just that sort of thing would be none other than Microsoft themselves. In an announcement in Q3 of 2012, the Git-TF tool was released on CodePlex and is currently in its second major version release.
As the name implies, Git-TF is a java tool built for a multitide of operating systems (HP-UX, IBM AIX, Linux, Mac OS X, Solaris, Unix, Windows 7, Windows 8, Windows Vista, Windows XP Service Pack 2) that allows you to continue to commit code to your local Git repository, push to your usual remote repositories, but also adds the "git tf" or "git-tf" call to check-in, clone, and fetch your code to/from a TFS source. Even better, it only takes a quick configuration call to set the repository up for all future TFS interactions (for that folder/project).
More Information
Ready to give it a shot? Head over to read the announcement and, for fellow developers in the iOS community, read this great post from Edward Thomson on the practical implementation of this handy set of tools. If you are feeling more cavalier, you can jump directly to the CodePlex hosting page (with link to download) by going here.
Labels:
Git,
git-tf,
Microsoft,
team foundation server,
TFS
| Reactions: |
Wednesday, March 14, 2012
Swimming with Snarks
Introduction
As many people know, I am a developer at heart. In this day and age, being a developer does not mean that you know every programming language or even all the syntax for one. The Internet has changed development forever by putting useful information within easy searching and an unbelievable community of people on-tap that are able to share their wisdom and failings (often tied closely together). Often times I find very helpful communities of people who I can share information with, receive information from, and further our profession. There are some, however, that just.... (sigh)
Identification
Being snarky isn't an IT invention, but I think people are super-exposed to it because of the prevalence of IT in our daily lives. You buy a computer from, say, Best Buy and you interface with a computer-minded salesperson. If you have issues, maybe you take it to their Geek Squad for help. You go to sync up your mobile phone with your PC and you may call your nephew - you know, the one that is SO good with computers - and you have an "IT experience" then. At any point along the way you might experience that snarky person that drives me mad.
I think the prior "age" of snarkiness was primarily identified with the attorney/lawyer crowd. Simultaneously or, probably, predating that would be doctors. And it isn't that it automatically comes with the territory; for every snarky person you come across, there are probably multiples of those that don't treat people with that impertinence. That said, stereotypes often develop from experiences of multiple people over multiple interactions (with some caveats duly noted in history).
At the risk of sounding like I am mutating Jeff Foxworthy's comedy (though he does have geek origins), you might have been "swimming" with snarks (i.e. snarky people) if you experienced any the following favorites of mine (with examples):
As many people know, I am a developer at heart. In this day and age, being a developer does not mean that you know every programming language or even all the syntax for one. The Internet has changed development forever by putting useful information within easy searching and an unbelievable community of people on-tap that are able to share their wisdom and failings (often tied closely together). Often times I find very helpful communities of people who I can share information with, receive information from, and further our profession. There are some, however, that just.... (sigh)
Identification
Being snarky isn't an IT invention, but I think people are super-exposed to it because of the prevalence of IT in our daily lives. You buy a computer from, say, Best Buy and you interface with a computer-minded salesperson. If you have issues, maybe you take it to their Geek Squad for help. You go to sync up your mobile phone with your PC and you may call your nephew - you know, the one that is SO good with computers - and you have an "IT experience" then. At any point along the way you might experience that snarky person that drives me mad.
I think the prior "age" of snarkiness was primarily identified with the attorney/lawyer crowd. Simultaneously or, probably, predating that would be doctors. And it isn't that it automatically comes with the territory; for every snarky person you come across, there are probably multiples of those that don't treat people with that impertinence. That said, stereotypes often develop from experiences of multiple people over multiple interactions (with some caveats duly noted in history).
At the risk of sounding like I am mutating Jeff Foxworthy's comedy (though he does have geek origins), you might have been "swimming" with snarks (i.e. snarky people) if you experienced any the following favorites of mine (with examples):
- The Over-Head: A person who you are relying on and likely paying an amount of money that you can't verify as being "fair" or not starts to use technical jargon or terminology unnecessarily
- Doctor: "It appears you have a subcutaneous contusion or hematoma." You: "Wait... a bruise?"
- Lawyer: "[insert archaic Old English here]" You: "So... yes?"
- Tech: "Did you RTFM? OMG! Your DDR-2600 DIMM is not going to properly interface with the bus speed of your mini-ATX board!" You: "I just want this to be faster, dude."
- The Redirector: A person takes longer to tell you the ways that you could have gotten the information than the short answer you were hoping for and they eventually provide. My favorite examples of this are on forums for helping people where the snarks lie waiting for someone to ask something that might be found elsewhere (manual, another forum post, etc) and then the feast is on. After 5 or 6 posts that ignore the continued request for help and defense of why they are there to begin with, someone will courteously interject the answer - sometimes halting the attack. I said sometimes.
- The Pretty Woman: This is an easy one - where the person can't imagine that you can be as versed as you need to be on a topic as they are and are, therefore, not worthy of their time in discussing it. This is a synonym of sorts for the famous scene where Julia Roberts' character attempts to shop on Rodeo Drive for some new clothes and is coldly turned away due to the preconception based on her attire.
The Point
The Internet is pretty diluted with forums where the snarks stalk prey, but there are some places that really shine. I continue to have great successes at places like Stack Overflow as well as on product-specific forums that are maintained even partially by in-house admins.
It's incredibly likely that we have all encountered this at some point and no one really benefits. If you have the opportunity to be a snark or be that rescuing voice that saves the newbie or inexperienced from wading through darker waters for that answer - remember your experiences and where you have been. Don't be a snark.
Labels:
answers,
assistance,
help,
snark,
snarkiness,
snarky
| Reactions: |
Thursday, February 16, 2012
Where's My Data? SQLite via PhoneGap
The Perceived Behavior
While writing an app, I was syncing massive amounts of data down from a web service using JSONP. As the data comes in (in chunks), I write it out to the SQLite database on the device. With larger data sets I started to notice an odd behavior whereby after performing a large number of tx.executeSql() statements in a row, the data that should have been there was not. In one instance, I ran 700+ inserts and saw zero records in the database table when done.
The Issue
When running a massive number of tx.executeSql() statements as I was, you essentially begin a queue in the framework. Instead of immediately processing what you are sending in, the system seems to take a step back and say, "I will wait until you are done before I do this." So, if you are queuing up a bunch of inserts unknowingly and then you think that you are good to move on to a new page, you might experience the behavior I was whereby those records never make it to the database table.
What No One Tells You
The good news is that there is an easy fix to this that I implemented successfully. Every kind of tx.executeSql() will take a success and failure callback as a parameter. While you only see examples of this in SELECT type statements, it is equally imperative that you include those callbacks in INSERT, DELETE, and UPDATE statements as well.
The callback piece is fine and well, but that still doesn't solve the issue completely. What we really need is a way to track the number of database operations we have called and compare that against the number of success or failure callbacks we get to see if there are any outstanding calls that haven't processed yet. Again, leaving before they are all processed will likely result in data loss.
My solution is to use a simple variable that increments (++) each time a database operation call is made and decrements (--) every time the framework calls back to tell us it completed one. Periodically, then, we chef to see if the number has leveled out to 0 again - meaning all the calls have processed - and then can move on. Some might recognize this as having a close similarity to reference counting.
So, you would take the normal example of this:
And turn it into:
var expectedDBCallbacks = 0;
var dbCheckIntervalId = 0;
function doInserts() {
for(var i=0; i<50; i++) {
tx.executeSql("INSERT INTO mytable (thing) VALUES (" + i + ")", [], successInsert, failureInsert);
expectedDBCallbacks++;
}
dbCheckIntervalId = setInterval("dbCheck()", 1000);
}
function successInsert() {
expectedDBCallbacks--;
}
function failureInsert(e) {
expectedDBCallbacks--;
}
function dbCheck() {
if(expectedDBCallbacks == 0) {
clearInterval(dbCheckIntervalId);
allDone();
}
}
As you can hopefully tell from the code, I would call doInserts() to initiate the process. After looping through the for loop (causing a queue of transactions), I create an interval timer using setInterval to check on the number of outstanding database requests and store the handle to that interval timer in a global variable (dbCheckIntervalId). Once zero (0) is hit, the timer self-destructs with clearInterval and then is ready to move on - demonstrated by calling allDone().
You could, alternatively, make a call to dbCheck() on each success or failure callback and avoid using the interval timer altogether. I set mine this way because I am running highly asynchronously and transactions are happening all over the place and this gives me one easy place to monitor what is going on.
Conclusion
I hope this code at least serves as inspiration for your own solution should you find yourself experiencing the same type of behavior in your SQLite calls. If you have a question or comment, I am always open to hear them.
While writing an app, I was syncing massive amounts of data down from a web service using JSONP. As the data comes in (in chunks), I write it out to the SQLite database on the device. With larger data sets I started to notice an odd behavior whereby after performing a large number of tx.executeSql() statements in a row, the data that should have been there was not. In one instance, I ran 700+ inserts and saw zero records in the database table when done.
The Issue
When running a massive number of tx.executeSql() statements as I was, you essentially begin a queue in the framework. Instead of immediately processing what you are sending in, the system seems to take a step back and say, "I will wait until you are done before I do this." So, if you are queuing up a bunch of inserts unknowingly and then you think that you are good to move on to a new page, you might experience the behavior I was whereby those records never make it to the database table.
What No One Tells You
The good news is that there is an easy fix to this that I implemented successfully. Every kind of tx.executeSql() will take a success and failure callback as a parameter. While you only see examples of this in SELECT type statements, it is equally imperative that you include those callbacks in INSERT, DELETE, and UPDATE statements as well.
The callback piece is fine and well, but that still doesn't solve the issue completely. What we really need is a way to track the number of database operations we have called and compare that against the number of success or failure callbacks we get to see if there are any outstanding calls that haven't processed yet. Again, leaving before they are all processed will likely result in data loss.
My solution is to use a simple variable that increments (++) each time a database operation call is made and decrements (--) every time the framework calls back to tell us it completed one. Periodically, then, we chef to see if the number has leveled out to 0 again - meaning all the calls have processed - and then can move on. Some might recognize this as having a close similarity to reference counting.
So, you would take the normal example of this:
function doInserts() {
for(var i=0; i<50; i++) {
tx.executeSql("INSERT INTO mytable (thing) VALUES (" + i + ")");
for(var i=0; i<50; i++) {
tx.executeSql("INSERT INTO mytable (thing) VALUES (" + i + ")");
}
}
And turn it into:
var expectedDBCallbacks = 0;
var dbCheckIntervalId = 0;
function doInserts() {
for(var i=0; i<50; i++) {
tx.executeSql("INSERT INTO mytable (thing) VALUES (" + i + ")", [], successInsert, failureInsert);
expectedDBCallbacks++;
}
dbCheckIntervalId = setInterval("dbCheck()", 1000);
}
function successInsert() {
expectedDBCallbacks--;
}
function failureInsert(e) {
expectedDBCallbacks--;
}
function dbCheck() {
if(expectedDBCallbacks == 0) {
clearInterval(dbCheckIntervalId);
allDone();
}
}
As you can hopefully tell from the code, I would call doInserts() to initiate the process. After looping through the for loop (causing a queue of transactions), I create an interval timer using setInterval to check on the number of outstanding database requests and store the handle to that interval timer in a global variable (dbCheckIntervalId). Once zero (0) is hit, the timer self-destructs with clearInterval and then is ready to move on - demonstrated by calling allDone().
You could, alternatively, make a call to dbCheck() on each success or failure callback and avoid using the interval timer altogether. I set mine this way because I am running highly asynchronously and transactions are happening all over the place and this gives me one easy place to monitor what is going on.
Conclusion
I hope this code at least serves as inspiration for your own solution should you find yourself experiencing the same type of behavior in your SQLite calls. If you have a question or comment, I am always open to hear them.
| Reactions: |
Monday, January 30, 2012
Uniting Mobile Video Chat
Introduction
Video chat has always been the "next big thing" on the horizon. Even when I was much younger, I recall technologists pontificating on the imminent explosion of video phones in every house, connected televisions, and more. Back then, I was convinced that I would be able to dial a number on the house phone and hit a button to turn on or off the video component, allowing me to truly see distant relatives and friends that are hard to connect with many times throughout a year.
Today we have all the pieces to the puzzle that makes up a complete video chat picture, but those pieces are misshapen and don't seem to really fit together into that smooth aftermath that rallies consumer adoption and, more importantly, consistent consumer use.
Nothing New Here
Even now you are likely thinking that Skype is the answer and that this article should be over. And you might be right.
Skype has been around for years and has incrementally improved on the video conferencing and chatting technology with a range of features including bandwidth detection which allows for fluid call quality changes so that each person on the chat sees video that is as good as it can be for the connection type they have. With their introduction of official mobile applications, you can now take the free video calling on the road with you. More importantly to me, I can call loved ones who are overseas for long periods of time without fancy equipment, incurring costs, or even being tied to my house.
OK, if Skype is so great, what's the problem? In one word...
Ubiquity
Ah, yes. The holy grail of connectedness both for the consumer and the developer/publisher. Ubiquity is that magical point whereby former competitors stop aiming down their sights to destroy and instead focus on alliance and interconnection. It's the moment that countless companies and individuals stopped trying to create their own spin on a Facebook-like social media site and put their effort into creating apps, games, and plug-ins that would instead work with the reigning giant to allow better access to and from them. It's 3-4 types of octane at a pump instead of 100, accelerator on the right, brake on the left, and red means stop.
So has video chat achieved this and heralded a change in echo-fixation with the new new thing? Not quite.
When Apple rolled the iPhone 4, I remember my excitement at the FaceTime feature - their answer to mobile video calls. At the time, a standards-based API was loosely promised to the world and I thought to myself, "Wow - here it is! If anyone can pull this off and wrap everyone into the fold of one solid way to communicate like this, it just might be Apple."
You can imagine my disappointment now years later: FaceTime integration on their own Mac platform is so-so and the long-rumored Windows version is complete vapor. That open and standards-based API for connecting into FaceTime: nowhere to be found. Video calls require wi-fi connections which tether you (not very "mobile" really...) and you must both be on the iOS or Mac platform to connect. Not great, guys. Not great at all.
Skype actually does a much better job of fitting the bill, but still lacks in a huge way (that, I might note, really isn't their fault). For Skype (or any other service) to really meet what I see as a critical requirement for success and full consumer adoption, they have to either wear out the competing factions or deliver such a lethal feature set that leads them to that special seat at the table of true ubiquity...
Native Platform
Lately you might have noticed that some of the great tools for iOS and Android are getting "baked in" to the OS. For instance, Twitter (once you download the application) is available to a whole host of Apple-developed and 3rd party apps on iPhones and iPads courtesy of a recent update. You can tweet from just about anywhere.
This level of native integration into the basic lifeline of the device help push users past "what are you using for service X" and lets them focus on making the connection they set out to make. I don't have to think about what app or service (or network) I have to be on to tweet a picture - I just hit the menu and get to typing. For video chat and video conferencing, we need to see the same thing.
Ian Small wrote a blog post for OpenTok's blog in which he talks about this subject. Specifically, he was reacting to news of Microsoft acquiring Skype and how some were predicting (hoping?) that this might be a big enough play to align the rest of the video conference and chat vertical. Ian and I both seem to agree that this move wasn't big enough to catapult the industry or force hands. We also seem to agree that something has to give.
I am actually a pretty big fan of what the crew over at OpenTok is producing. They see this issue and are actually trying to do something about it by providing widgets and APIs for initiating video chats with on for more people. These pieces are Javascript, HTML, and Flash based - so they cater to a wider audience than many other offerings out there. Further, there really is no "app" to install - these are embedded in web pages and other media.
But, even with the great works that OpenTok and others are doing, there is still the issue of the network.
Network
When AT&T and Apple cooked the concept of forcing wi-fi for FaceTime calls (unless you jailbreak your device), people were irritated and I was one of them. FaceTime looked like a great and valid feature for getting people moved up onto the newest iOS platform (iPhone 4) at the time. The introduction of the speed bump imposed by only supporting wi-fi is a pretty big one. But not the biggest.
When I call another mobile number, I know I am going to reach that person independent of their carrier or network. In fact, the FCC has enforced a system whereby you can port your number form one carrier to the next, letting the number find you if you switch from Verizon's network to, say, T-Mobile. That number is, for most purposes, explicitly tied to that device.
Rather than trying to tie users to email addresses, why not service video chat and conferencing using this same technique? FaceTime tries to do this (while also supporting email addresses) but, as mentioned before, it just isn't catering to the wider audience. While I am sure someone thought this would be a great draw and cause a sense of exclusivity for Apple device owners, I am convinced this has caused quite a chill in what could otherwise have signaled a drastic change in how we conduct these types of communications. Specifically, if Apple would open up FaceTime (no, seriously) and promote it across a diverse group of platforms that they don't have to own, this feature would truly be great. For now, however, I can't video chat with the ease of calling my grandmother - and that is a failure that many can share.
Final Thoughts
My message to Skype: Seek out tighter native integration, find a way to replace the ugliness being implemented at the OS level, and make the service tie to numbers and email addresses.
My message to Apple: If this is your grand plan for video chat, give it up and let someone else step in. If you can work with another prouder (OpenTok, Skype, etc) and show you are paving the way towards ubiquity, you will regain the fan base of those that saw FaceTime flop.
My message to Google: Google+ has been a dud so far, but things like the Hangout feature are taking off and showing more promise. It's possible that you, once again, are going to have to drag us all, kicking and screaming, towards the "right thing to do."
My message to the networks: If you were to solve these issues at the network layer and push the solution down to devices it would be both a miracle and a promise kept. Now is the time to stop thinking in voice and data separately. Is video conferencing and chat a new service offering with a new charge that will allow its use over standard 3G connections? Maybe. Figure it out.
And last, my message to Microsoft: What the heck happened, man?
Video chat has always been the "next big thing" on the horizon. Even when I was much younger, I recall technologists pontificating on the imminent explosion of video phones in every house, connected televisions, and more. Back then, I was convinced that I would be able to dial a number on the house phone and hit a button to turn on or off the video component, allowing me to truly see distant relatives and friends that are hard to connect with many times throughout a year.
Today we have all the pieces to the puzzle that makes up a complete video chat picture, but those pieces are misshapen and don't seem to really fit together into that smooth aftermath that rallies consumer adoption and, more importantly, consistent consumer use.
Nothing New Here
Even now you are likely thinking that Skype is the answer and that this article should be over. And you might be right.
Skype has been around for years and has incrementally improved on the video conferencing and chatting technology with a range of features including bandwidth detection which allows for fluid call quality changes so that each person on the chat sees video that is as good as it can be for the connection type they have. With their introduction of official mobile applications, you can now take the free video calling on the road with you. More importantly to me, I can call loved ones who are overseas for long periods of time without fancy equipment, incurring costs, or even being tied to my house.
OK, if Skype is so great, what's the problem? In one word...
Ubiquity
Ah, yes. The holy grail of connectedness both for the consumer and the developer/publisher. Ubiquity is that magical point whereby former competitors stop aiming down their sights to destroy and instead focus on alliance and interconnection. It's the moment that countless companies and individuals stopped trying to create their own spin on a Facebook-like social media site and put their effort into creating apps, games, and plug-ins that would instead work with the reigning giant to allow better access to and from them. It's 3-4 types of octane at a pump instead of 100, accelerator on the right, brake on the left, and red means stop.
So has video chat achieved this and heralded a change in echo-fixation with the new new thing? Not quite.
When Apple rolled the iPhone 4, I remember my excitement at the FaceTime feature - their answer to mobile video calls. At the time, a standards-based API was loosely promised to the world and I thought to myself, "Wow - here it is! If anyone can pull this off and wrap everyone into the fold of one solid way to communicate like this, it just might be Apple."
You can imagine my disappointment now years later: FaceTime integration on their own Mac platform is so-so and the long-rumored Windows version is complete vapor. That open and standards-based API for connecting into FaceTime: nowhere to be found. Video calls require wi-fi connections which tether you (not very "mobile" really...) and you must both be on the iOS or Mac platform to connect. Not great, guys. Not great at all.
Skype actually does a much better job of fitting the bill, but still lacks in a huge way (that, I might note, really isn't their fault). For Skype (or any other service) to really meet what I see as a critical requirement for success and full consumer adoption, they have to either wear out the competing factions or deliver such a lethal feature set that leads them to that special seat at the table of true ubiquity...
Native Platform
Lately you might have noticed that some of the great tools for iOS and Android are getting "baked in" to the OS. For instance, Twitter (once you download the application) is available to a whole host of Apple-developed and 3rd party apps on iPhones and iPads courtesy of a recent update. You can tweet from just about anywhere.
This level of native integration into the basic lifeline of the device help push users past "what are you using for service X" and lets them focus on making the connection they set out to make. I don't have to think about what app or service (or network) I have to be on to tweet a picture - I just hit the menu and get to typing. For video chat and video conferencing, we need to see the same thing.
Ian Small wrote a blog post for OpenTok's blog in which he talks about this subject. Specifically, he was reacting to news of Microsoft acquiring Skype and how some were predicting (hoping?) that this might be a big enough play to align the rest of the video conference and chat vertical. Ian and I both seem to agree that this move wasn't big enough to catapult the industry or force hands. We also seem to agree that something has to give.
I am actually a pretty big fan of what the crew over at OpenTok is producing. They see this issue and are actually trying to do something about it by providing widgets and APIs for initiating video chats with on for more people. These pieces are Javascript, HTML, and Flash based - so they cater to a wider audience than many other offerings out there. Further, there really is no "app" to install - these are embedded in web pages and other media.
But, even with the great works that OpenTok and others are doing, there is still the issue of the network.
Network
When AT&T and Apple cooked the concept of forcing wi-fi for FaceTime calls (unless you jailbreak your device), people were irritated and I was one of them. FaceTime looked like a great and valid feature for getting people moved up onto the newest iOS platform (iPhone 4) at the time. The introduction of the speed bump imposed by only supporting wi-fi is a pretty big one. But not the biggest.
When I call another mobile number, I know I am going to reach that person independent of their carrier or network. In fact, the FCC has enforced a system whereby you can port your number form one carrier to the next, letting the number find you if you switch from Verizon's network to, say, T-Mobile. That number is, for most purposes, explicitly tied to that device.
Rather than trying to tie users to email addresses, why not service video chat and conferencing using this same technique? FaceTime tries to do this (while also supporting email addresses) but, as mentioned before, it just isn't catering to the wider audience. While I am sure someone thought this would be a great draw and cause a sense of exclusivity for Apple device owners, I am convinced this has caused quite a chill in what could otherwise have signaled a drastic change in how we conduct these types of communications. Specifically, if Apple would open up FaceTime (no, seriously) and promote it across a diverse group of platforms that they don't have to own, this feature would truly be great. For now, however, I can't video chat with the ease of calling my grandmother - and that is a failure that many can share.
Final Thoughts
My message to Skype: Seek out tighter native integration, find a way to replace the ugliness being implemented at the OS level, and make the service tie to numbers and email addresses.
My message to Apple: If this is your grand plan for video chat, give it up and let someone else step in. If you can work with another prouder (OpenTok, Skype, etc) and show you are paving the way towards ubiquity, you will regain the fan base of those that saw FaceTime flop.
My message to Google: Google+ has been a dud so far, but things like the Hangout feature are taking off and showing more promise. It's possible that you, once again, are going to have to drag us all, kicking and screaming, towards the "right thing to do."
My message to the networks: If you were to solve these issues at the network layer and push the solution down to devices it would be both a miracle and a promise kept. Now is the time to stop thinking in voice and data separately. Is video conferencing and chat a new service offering with a new charge that will allow its use over standard 3G connections? Maybe. Figure it out.
And last, my message to Microsoft: What the heck happened, man?
| Reactions: |
Subscribe to:
Posts (Atom)
About Me
- Matt Ray
- Firecracker, father, friend. Honorable, humorist, heathen. Performer, programmer, producer. Seeking, social, sarcastic. Loyal, logical, lasting. Bold, belying, benevolent. Gamer, genuine, grinning. Reader, redeeming, ridiculous.On and off blogger, film producer, and programmer. Keurig addict. Frequent moviegoer.