Troy's NodeJs sample

54 views
Skip to first unread message

Justin Collum

unread,
Feb 12, 2012, 11:54:40 AM2/12/12
to Portland ALT.NET
Just because it's cool and Troy probably won't self promote: 


Pure JS and HTML5. Cool stuff, worth a look! I'm gonna send this to anyone who says to me "yeah but you can't build a rich UI with HTML5 like you can in Silverlight". 

Troy Howard

unread,
Feb 13, 2012, 3:42:22 AM2/13/12
to pdxalt...@googlegroups.com
Haha, Thanks Justin!

But really... them's just parlour tricks. You ain't seen the half of
what JS/HTML5 can do.

Justin Collum

unread,
Feb 13, 2012, 1:35:52 PM2/13/12
to pdxalt...@googlegroups.com
I kinda want the "can't build a rich ui in HTML5" camp to come up with something specific. Then I'd like to attempt it in HTML5, just as a learning experience. Rich UI Challenge?

Troy Howard

unread,
Feb 13, 2012, 2:00:36 PM2/13/12
to pdxalt...@googlegroups.com
Sounds like fun! Let's do it... Ok..

Eric, what can't we do in Javascript that you can do in Silverlight?

-T

Justin Collum

unread,
Feb 13, 2012, 2:19:07 PM2/13/12
to pdxalt...@googlegroups.com
I pointed some Silverlight types that I know to this thread. Maybe they'll have some good input. 

Travis Brooks

unread,
Feb 13, 2012, 2:38:41 PM2/13/12
to pdxalt...@googlegroups.com
My knowledge might be a little stale (things are moving fast on this) but last I checked there was no standard support for html5 full screen video.  The only silverlight i encounter on a regular basis is the netflix player for this very reason.


Date: Mon, 13 Feb 2012 11:19:07 -0800
Subject: Re: [pdxalt.net] Troy's NodeJs sample
From: jco...@gmail.com
To: pdxalt...@googlegroups.com

Ryan Eastabrook

unread,
Feb 13, 2012, 2:39:41 PM2/13/12
to pdxalt...@googlegroups.com

…full screen, and adaptive streaming.

Justin Collum

unread,
Feb 13, 2012, 2:39:46 PM2/13/12
to pdxalt...@googlegroups.com
Yeah, that DRM video is something that I don't think you can get without a plug in player.

Justin Collum

unread,
Feb 13, 2012, 2:40:40 PM2/13/12
to pdxalt...@googlegroups.com

Justin Collum

unread,
Feb 13, 2012, 2:42:50 PM2/13/12
to pdxalt...@googlegroups.com
Wanted to post quick so I didn't read it closely. Looks like it isn't supported in all browsers (fair bet that it won't work in IE). Worked fine in Chrome and they say it's coming/arrived for FF. 

Troy Howard

unread,
Feb 13, 2012, 3:18:03 PM2/13/12
to pdxalt...@googlegroups.com
Here's a good report on the topic of video in HTML5

http://www.longtailvideo.com/html5/


But, really guys -- is that all? Silverlight, as many have quipped in
the past, is just a video player? (and only for scenarios where those
two points are relevant)

-T

Justin Collum

unread,
Feb 13, 2012, 3:29:34 PM2/13/12
to pdxalt...@googlegroups.com
Agreed, I suspect that about 95% of those enterprise dev shops that say "oh we really need silverlight" are not doing any video whatsoever. 

Lee Harding

unread,
Feb 13, 2012, 4:20:02 PM2/13/12
to pdxalt...@googlegroups.com
For doing intense graphics (3D, scene graph, LOD, high complexity model) I'm not aware of any JS solution that can approach those available via Silverlight 5.  I haven't looked far into, though, since my mileage with browser native graphics has been underwhelming.  When Chrome (et. al.) fixes really basic bugs like hit testing SVG elements under 1.0 size I might get interested again.  

Justin Collum

unread,
Feb 13, 2012, 4:28:21 PM2/13/12
to pdxalt...@googlegroups.com
Html5 Scene Graph library:   http://code.google.com/p/cakejs/  and a sample of fancy lavalamp type graphics using it http://glimr.rubyforge.org/cake/redesign.html . 


Didn't see any notable CPU load on my 3 yr old processor while running any of those. 

On Mon, Feb 13, 2012 at 1:20 PM, Lee Harding <muir.lee...@orst.edu> wrote:
scene graph

Mark Knell

unread,
Feb 13, 2012, 4:54:29 PM2/13/12
to pdxalt...@googlegroups.com
I haven't tried Web Workers yet, so I'm talking out my asynchronous serial port.  But the threading model of Silverlight as far back as v3 still seems more advanced than HTML5. In SL, you can spin up threads by hand and manage your own overhead, or you can just use the CLR's shared thread pool and get a certain amount of scaling for free. I only skimmed the API's at http://dev.w3.org/html5/workers/ but I didn't even see anything about suspending Web Workers programmatically, let alone the stuff you can do with .NET Tasks library or the coming async/await. 

Maybe I'm just sore. Last week I did have some threading problems in HTML5 and JS, when multiple ajax callbacks could trigger the onload events of offscreen JS Image objects, all drawing to the same HTML5 canvas in parallel. Inconsistent but frequent rendering problems (failure to render but with no thrown exceptions) until I wrapped all the draws inside setTimeout(fn, 0). I don't know if that's an indictment of the vagueness of clientside threading or of my JS skillz, though.

On the other hand, marshalling to and from SL's UI thread (or in multiple-windowed situations, multiple UI threads) is pretty annoying, too. 

-Mark


On Mon, Feb 13, 2012 at 12:18 PM, Troy Howard <thow...@gmail.com> wrote:

Lee Harding

unread,
Feb 13, 2012, 5:06:43 PM2/13/12
to pdxalt...@googlegroups.com
CakeJS -- No LOD support, no subgraph instancing (it's a tree, not a graph)?, no hit testing.  It's a toy.

WebGL is great stuff, but it's isn't DX.

The bottom line I'm talking about is scale.  If you want to make fun (and even impressive) demos, in-browser graphics are fine.  But getting it to perform on intense usage (CAD, games, etc.) is a non-starter as things site.  The good news is, of course, that this software stuff seems to get better with time.

Adron Hall

unread,
Feb 13, 2012, 5:25:24 PM2/13/12
to pdxalt...@googlegroups.com
Well when it comes ot CAD and such Silverlight sucks too. Might as well go native.

I think the entire point was, is that the demo Troy built in about 10 minutes looked pretty sweet - and was 100% web compliant - i.e. works on phones, computers, ipads, tablets, etc...  something Silverlight can't hope to accomplish - and doesn't.

But I do digress, Silverlight still has its place, that place is just shrinking rapidly in the face of other technologies. For pure power though, think client is still tops for high end graphics.

Just providing a "back to the point of the e-mail" e-mail.  :)

Cheers!
Adron

Justin Collum

unread,
Feb 13, 2012, 5:25:46 PM2/13/12
to pdxalt...@googlegroups.com
I'm trying to envision a business meeting about making a new game where someone suggests a technology that won't work on the 20+ million ipads in the world. 

CAD, ok sure, but do people really do CAD stuff in the browser? I have no idea. 

Lee Harding

unread,
Feb 13, 2012, 5:28:47 PM2/13/12
to pdxalt...@googlegroups.com
Like, perhaps,  https://tinkercad.com/?  It's possible, and probably a better business model than games for iPads (20M * $2.99 * 60% - (100K/yr * 2 * 1yr)), but that's really a digression.  

Adron Hall

unread,
Feb 13, 2012, 5:31:24 PM2/13/12
to pdxalt...@googlegroups.com
That uses WebGL, not Silverlight though... I don't know, just seems to lead toward more web adoption and not going the proprietary Silverlight/Flash/AIR route.

...or are you saying you're a proponent of such things?

Cheers!
-Adron

Justin Collum

unread,
Feb 13, 2012, 5:32:32 PM2/13/12
to pdxalt...@googlegroups.com
Lee, thanks for sharing that link, that's bad-ass. I'm gonna show that to my kid, maybe he'll make something cool!

Lee Harding

unread,
Feb 13, 2012, 5:34:23 PM2/13/12
to pdxalt...@googlegroups.com
I'm not a proponent of technology in general -- I hate the stuff. :)  But some tools are more helpful than others.  I make a small CAD app that has a HTML 5, and a Silverlight front end.  Both are fine, but that's because I'm doing simple things.  As soon as I try doing bigger better things, both start to suck, just in different ways.

On Mon, Feb 13, 2012 at 2:31 PM, Adron Hall <adro...@gmail.com> wrote:

Allen Newton

unread,
Feb 13, 2012, 11:54:00 PM2/13/12
to pdxalt...@googlegroups.com
I have to chime in. ;)  So a really cool demo would be use of the latest Silverlight Media Framework control to share smooth streaming video in Silverlight, and gracefully degrade to the HTML5 video tag and the three video formats you need to encode for that.  I have the chops to figure that out if someone has a video to encode.  Live streaming is expensive so that would be out for a demo. 

Anyway, Silverlight is not just for video. It is so good for that and other things that the Windows team had to sideline it because it was not helping Windows sales.  All you needed was Windows XP and it would work on it. 

Silverlight is a good choice for intranet apps that work on the Microsoft stack.  I mean with WCF RIA services and Entity Framework and SQL.  But I don't like that kind of lock-in (that is another story) so right now I am working on a pet project using ServiceStack +Silverlight.  The services are REST based and can return Xml, Json, and other formats.  Which is seriously awesome and blows the WCF/EF stack out of the water IMHO. Anyway, the frameworks supporting Silverlight are mature and provide guidance for devs to work quickly.  Have you figured out which MVC Javascript framework is best yet? Backbone, Knockout, or one of the ten other frameworks?

Back to the other point I want to add to the discussion, if you give a Silverlight dev with chops a project right now he/she can probably create a working prototype as fast as a web developer.  (Unless the web developer is a monster then all bets are off.)  The idea is that the tools are excellent and people have been doing Silverlight for three years or more.

Seriously, there are 100s of millions of PCs out there.  If you are going to target 20+ million iPads why not target those Win7/XP PCs with something that is a bit less browser dependant than JTML5.  Do both!

Cheers,

Allen

Sent from my Windows Phone

From: Lee Harding
Sent: 2/13/2012 2:34 PM
To: pdxalt...@googlegroups.com

Subject: Re: [pdxalt.net] Troy's NodeJs sample

Adron Hall

unread,
Feb 14, 2012, 12:33:35 AM2/14/12
to pdxalt...@googlegroups.com
Just wanted to point out.

iPad isn't a 15 Million unit market, it is a 55.2 Million unit market.  http://en.wikipedia.org/wiki/IPad

Keep in mind also that last quarter smart phones also eclipsed PC sales, totaling over 488 Million worldwide. Less than 1% of those use or can view Silverlight in any form. All of them can read and view HTML5, and many can read/stream HTML5 video.

So that isn't just a 15 million unit market that would have the "degraded" HTML5 version, but more like 530million plus that wouldn't have any hope of accessing the Silverlight content.

Anyway, nothing concrete to add, just wanted to point out those numbers since they are a major indicator of where things are going.  ;)

Cheers!
-Adron

Bobby Johnson

unread,
Feb 14, 2012, 12:37:20 AM2/14/12
to pdxalt...@googlegroups.com
I don't know about the swinging D competition here, but Troy's work made me happy and reminded me of the demo scene. kudos Troy.
--
"The explanation requiring the fewest assumptions is most likely to be correct."

- Occam’s Razor
http://en.wikipedia.org/wiki/Occam's_Razor

Justin Collum

unread,
Feb 14, 2012, 12:37:20 AM2/14/12
to pdxalt...@googlegroups.com
Wait, so you can't do REST and various return formats in WCF? I thought that was pretty straightforward. Keep in mind that it's been over a year since I looked at WCF and just barely even then. 

On Mon, Feb 13, 2012 at 8:54 PM, Allen Newton <alle...@gmail.com> wrote:

Allen Newton

unread,
Feb 14, 2012, 1:02:58 AM2/14/12
to pdxalt...@googlegroups.com
Those seem like good numbers.  Hopefully JTML5 will be as enjoyable and powerful as Silverlight was for my projects.  :)


Sent from my Windows Phone

From: Adron Hall
Sent: 2/13/2012 9:33 PM

To: pdxalt...@googlegroups.com
Subject: Re: [pdxalt.net] Troy's NodeJs sample

Just wanted to point out.

iPad isn't a 15 Million unit market, it is a 55.2 Million unit market.  http://en.wikipedia.org/wiki/IPad

Keep in mind also that last quarter smart phones also eclipsed PC sales, totaling over 488 Million worldwide. Less than 1% of those use or can view Silverlight in any form. All of them can read and view HTML5, and many can read/stream HTML5 video.

So that isn't just a 15 million unit market that would have the "degraded" HTML5 version, but more like 530million plus that wouldn't have any hope of accessing the Silverlight content.

Anyway, nothing concrete to add, just wanted to point out those numbers since they are a major indicator of where things are going.  ;)

Cheers!
-Adron

On Mon, Feb 13, 2012 at 8:54 PM, Allen Newton <alle...@gmail.com> wrote:

Allen Newton

unread,
Feb 14, 2012, 12:50:38 PM2/14/12
to pdxalt...@googlegroups.com
I'll have to revisit that at some point.  I ran into a corner when trying to use Entity Framework 4.1 with WCF RIA Services and a DomainService following this guidance:  http://www.silverlightshow.net/items/WCF-RIA-Services-Part-10-Exposing-Domain-Services-To-Other-Clients.aspx 

So, maybe I painted too broad a brush.  Basically, I found that I had to jump through a lot of hoops with my service method signatures and POCO objects to get things to line up perfectly.  Then when I tried to write a simple lookup call, the service architecture I was using hit a brick wall.  I've experienced none of those problems using ServiceStack and it has been very freeing to work with.  I'm generating my database from clean POCO objects that are shared with my Silverlight client.  Granted there are some conditional compilation sections around Silverlight only attributes.  But otherwise, when I change my classes, the database can be updated.  Again this is a brand new project so I have not dealt with database versions yet.  The request/response objects and services are clean and easy to write.  I'm actually dealing more with client side issues in Silverlight like using the browser stack vs the client stack for web service calls and the limitations around HTTP verbs.  The server side is going to be the same for other clients like HTML5 + Javascript/jQuery, or ASP.Net MVC, or iOS, or Android, or WinRT.  And I will be building those in the near future.  Yes, I'm using SQL but with ServiceStack I could probably use other NoSql options like MongoDB.  Also, I may not need a Windows server to run the web services if I can get away from SQL.  I don't think there is the same flexibility with WCF but you can send me resources to learn about that if I'm wrong.  That is my recent experience with it.  I'm having fun developing again, so that's why I felt like sharing.  I have this group to thank for putting me on to ServiceStack.  So, thanks.

Allen
--
Allen Newton
alle...@gmail.com

Adron Hall

unread,
Feb 14, 2012, 1:50:49 PM2/14/12
to pdxalt...@googlegroups.com
I'm a huge advocate of NOT running services on Windows. Running/hosting ASP.NET MVC is fine, running internal corp "server services" is one thing, but anything web, outside of MVC is just not in good shape, even after all these years.

Anyway, I digress, using Mono + Linux would be a vastly better option IMHO. Throw Postgresql or mysql in there if you absolutely need an RDBMS and you're set - better oompf for less money.  :)

Somewhere I'm mid-way through a blog entry about doing just that. Haven't had time to catch up on it. :(

Adron Hall

unread,
Feb 14, 2012, 2:39:50 PM2/14/12
to pdxalt...@googlegroups.com
I should have said not running "web services" on windows.  Windows Services that run via services management are cool.  :)

Troy Howard

unread,
Feb 14, 2012, 3:13:10 PM2/14/12
to pdxalt...@googlegroups.com
Bobby -- Glad you caught that. That was totally my intention. I was
really into the demo scene in the late eighties/early 90s.

Troy Howard

unread,
Feb 14, 2012, 3:22:26 PM2/14/12
to pdxalt...@googlegroups.com
Justin -- ServiceStack.Net is WCF done correctly... as an open source
project: http://servicestack.net/

I was fortunate enough to meet Demis the other day but didn't get a
chance to dive into the "were not worthy" groveling I wanted to, since
we were too busy talking about lunch and music. Go figure. WCF makes
it really really hard to do things right. Like most MS products, it
demos well and performs adequately in simplistic use cases but once
you start trying to perform real work with it, you find that there are
many complications that can't be gotten around.. Well, I'll roll that
statement back a bit and say they can't be "practically" gotten
around. Microsoft has done a much better job of componentization in
their architecture, enabling developers to replace default
implementations with custom solutions. Unfortunately the investment of
time and effort required to get something useful out of WCF is just
not worth it. There are so many ways of doing the same thing with far
less friction that WCF is only reasonable when you're 100% MS and
doing relatively simple things. If you're in a mixed platform
environment you're much better off using a different strategy (which
strategy you employ is totally dependent on the use case... there's no
right answer for that except "probably not WCF").

At least... that's been my practical experience. I'm sure others will
disagree and they are probably correct, based on their practical
experiences. ;)

-T

Troy Howard

unread,
Feb 14, 2012, 3:25:33 PM2/14/12
to pdxalt...@googlegroups.com
I was gonna say... Windows Services are fine when you need to be in
Windows. Web services.. why bother?

Unix is designed for services. Mac is designed for drag and drop.
Windows is designed for drop-downs and check boxes. Use Unix if you
can.

You'd probably love ServiceStack.Net running under Mono on Linux..
Pretty sweet setup, really... but all your Linux loving friends will
turn their collective noses up for using .NET instead of Node. ;)

-T

Allen Newton

unread,
Feb 14, 2012, 3:55:24 PM2/14/12
to pdxalt...@googlegroups.com
That was the conclusion about WCF that I have arrived at. Great for
demos or all Microsoft environments. But too cumbersome when you want
to scale or play nice in other environments. Given the lack of support
for their own technology, it seems wise also too hedge bets using only
Microsoft technologies. I think they want to drive server OS sales
rather than provide a stable ecosystem. The best way to do that is make
stuff and then break it.

I still like .Net though. =)

Allen

Sent from my Windows Phone

From: Troy Howard
Sent: 2/14/2012 12:22 PM


To: pdxalt...@googlegroups.com
Subject: Re: [pdxalt.net] Troy's NodeJs sample

Justin -- ServiceStack.Net is WCF done correctly... as an open source
project: http://servicestack.net/

I was fortunate enough to meet Demis the other day but didn't get a
chance to dive into the "were not worthy" groveling I wanted to, since
we were too busy talking about lunch and music. Go figure. WCF makes
it really really hard to do things right. Like most MS products, it
demos well and performs adequately in simplistic use cases but once
you start trying to perform real work with it, you find that there are
many complications that can't be gotten around.. Well, I'll roll that
statement back a bit and say they can't be "practically" gotten
around. Microsoft has done a much better job of componentization in
their architecture, enabling developers to replace default
implementations with custom solutions. Unfortunately the investment of
time and effort required to get something useful out of WCF is just
not worth it. There are so many ways of doing the same thing with far
less friction that WCF is only reasonable when you're 100% MS and
doing relatively simple things. If you're in a mixed platform
environment you're much better off using a different strategy (which
strategy you employ is totally dependent on the use case... there's no
right answer for that except "probably not WCF").

At least... that's been my practical experience. I'm sure others will
disagree and they are probably correct, based on their practical
experiences. ;)

-T


Allen Newton

unread,
Feb 14, 2012, 7:18:38 PM2/14/12
to pdxalt...@googlegroups.com
Last comment from me on the "what good is Silverlight/WCF for" thread *promise*...the link below is an article about the road I just went down.  It's a perfect example of guidance that works for little demo apps and all-in Microsoft stack projects. 

This article looks to be based on a demo database and doesn't use a code first approach.  As I predicted to myself when reading part 1, he uses WCF RIA Services for a Silverlight LOB demo app.  Only as an afterthought does the author think about non-Microsoft platform clients.  This kind of architecture didn't work for me as promised out of the box.  Specifically the JsonEndpointFactory.  I had to subclass it to get the response format I wanted.  So the point is follow this path at your own risk: SilverlightShow article 
 

Cheers,

Allen
--
Allen Newton
alle...@gmail.com
Reply all
Reply to author
Forward
0 new messages