Google Chrome: First impressions
Posted by Jay Charles | Filed under General Nonsense
I’ve been itching to give Google Chrome a try since I read about it a few weeks ago. Everything I’ve read has given me that warm, fuzzy feeling I get any time a new application comes out that makes interweb applications more useful. The browser (as it exists in Firefox and Internet Explorer) has always been the biggest monkey wrench in the works, as when first conceived, the browser was never meant to be a client for robust web apps. I just installed the Chrome Beta, and I’m taking my first test drive around some of the web apps I like (and some that I’ve developed).
The first thing that’s striking me is how fast Chrome loads pages and javascripts. My first test of the new browser was using Twiddla, which is one of my favorite javascript based rich internet apps. Chrome seems to load up the application a bit faster than firefox, but, wait a minute… unfortunately, the overall experience isn’t as good. Using the drawing tools and moving objects around the stage is far smoother on Firefox… the dragging in Chrome is quite jerky and jumpy. I’m also finding that the more objects I put on the Twiddla stage, the slower the drag and drop in Chrome. Oh well… back to Firefox for using this application.
Next up, Pageflakes. Again, Chrome seems to stutter and sputter any time there is something being dragged around the page, particularly when there are other objects being rendered (like video playing or Iframes reloading). Aside from the bad drag rendering, the performance of Chrome on this app seems no better or worse than in Firefox.
Hmm… that warm fuzzy feeling is giving way to a “it looks good on paper, but is it really any better?” feeling.
Flash apps. Well… no need to list them one by one, as the results are the same as they are in Firefox and IE. As expected, Flash runs exactly as it does in other browsers (well… other Windows browsers that is… Flash on Mac is no fun in any browser, but that’s for another article). No faster, no slower, no better or worse, just the same reliable Flash experience.
Okay… now that I’ve played with a bunch of apps I’ll just jump back to the blog page I loaded into chrome a while ago… but… um… where’s the drop down that shows me my browsing history? Hmm… no little downward facing arrow button I’m so familiar with. After some hunting, I found that clicking and holding the history buttons gives you a context menu (assuming you have a history in the direction of the button) with an option to show your full history. This “show history” button is duplicated in the “Customize and control” menu, but really, I think I prefer the one-click dropdown in the address bar from browsers past. The history opens in a separate tab, which I don’t really get. I’m also finding that in the history, all you see is the page titles (and not the addresses)… which leaves me at the mercy of people using very descriptive page titles, or the same title for every one of their site’s pages (unlike “untitled”, or “Somesite.com” which we see so often).
Some things I really do like about Chrome are the view-source screen and element inspector. Nice to see the browser include things like that… should prove to be very helpful. And, of course, with each tab running as it’s own process, it means things like one goofy, buggy page running in a tab won’t bring the whole browser down (although, I don’t often run a bunch of tabs, but I suspect lots of people do. Maybe I’ll be one of those people when I’m using Chrome)
From the standpoint of forward facing user experience, I can’t say I’m as impressed with Chrome as I expected hoped to be. Of course I’ll be testing all of my applications against it from here on, and I’m sure I’ll use it for specific purposes (like poking around in page code) but based on this first experience (and yes, I know it’s still in beta), I don’t think it will be replacing Firefox at the top of my start bar just yet.
AS3 Adventures: Porting my FMS classes to Actionscript 3
Posted by Jay Charles | Filed under Flash Platform
I’ve been working with Flash Media Server since version 1 (when it was Flash Communication Server), and during that time, I’ve developed a fairly robust set of classes and components for rapid development of AS2/FMS applications.
Now that the majority of my clients are ready to cuddle up to the idea of requiring Flashplayer 9 (h.264 support in FP9 did a lot to help that), I’m working on porting out all of my code to Actionscript 3. I’ve been noodling with AS3 since Flash CS was released, but it’s just now that I’m finding the time (and the cause) to rewrite all of those thousands of lines of code. As work progresses, I’m finding a few interesting gotchas along the way, and I’ll update this blog post as I find and work through them. Hopefully, it will save other developers from a few time wasting sessions digging for a problem.
Gotcha - Can’t invoke methods or alter properties on a null camera device
If you’re used to Actionscript 2, then you feel perfectly confident invoking Camera.setMode() recklessly, even if you haven’t checked for the presence of a camera device. In AS3, you can’t do that. I’ve found that if you invoke a method or alter a property of a null camera object, code seems to stop running. For example:
var myCam:Camera = Camera.getCamera();
myCam.setMode(320,240,12);
If the user has a camera (or a device driver that fools the player into thinking there’s a camera somewhere), then code will continue to execute. If there is no camera device on the machine, code stops executing.
The solution here is to always test for a null value on the camera object before invoking any methods on the object:
var myCam:Camera = Camera.getCamera();
if(myCam != null){
myCam.setMode(320,240,12);
}
Gotcha - The onMetaData event isn’t part of the NetStatusEvent class
This one sort of bugs me a little. I absolutely love the event dispatcher structure of AS3, and developing custom handlers is a breeze, but for some reason onMetaData was left out of the NetStatusEvent class. I’m not sure why really, as onMetaData is [as I see things] pretty important to any video application.
Unless you want to rework the flash.net.NetStatusEvent class to include it (which I don’t recommend… but that’s for another discussion), the answer here is to use the client property of the NetStream class. You create an object, add your onMetaData method to the object, and then set the client property of the netStream to the object you just created. It’s all very Actionscript 2-esque:
var ns:NetStream = new NetStream();
var ns_client:Object = new Object();
ns_client.onMetaData = function(metaObject){
// handle meta events here. I like to run a call to my custom handler for the stream's NetStatus events so the rest of my app can use a single event listener.
}
ns.client = ns_client;
I don’t really understand why the onMeta event wasn’t included in the NetStreamEvent class… maybe in AS4?
Gotcha - You can’t invoke NetConnection.connect() from a netStatusEvent handler.
This is one really, really bugs me. Some of the FMS applications I develop are high volume with connection requests in the thousands per minute, and when I load balance, I often use an FMS application to handle the load balancing. For this reason, I tend to shy away from the “connection shotgun” approach for picking the port/protocol combination for the client (where the client makes simultaneous connection requests on all ports/protocols and uses the first one to succeed), as it would create potential for doubling or tripling the number of concurrent connection requests hitting the servers. For this reason, I prefer to make my connection attempts in sequence with a programatic timeout for each, trying RTMP on port 1935, then 80, and finally RTMPT over port 80… waiting for either a failed or rejected info code (or for the timeout to expire) before trying the next one
In Actionscript 2 I was able to handle NetConnection.Connect.Failed results in my onStatus handler for the NetConnection, but in AS3 you just can’t do that… even if the call to NetConnection.connect() resides in a function outside the netStatusEvent handler. For example…
function connectNC(){
my_netconnection.connect(blah, blah,blah);
}
function netStatusHandler(e:NetStatusEvent){
if(e.info.code == "NetConnection.Connect.Rejected" || e.info.code == "NetConnection.Connect.Failed"){
connectNC();
}
}
…results in this lovely runtime error:
#2132 NetConnection.connect cannot be called from a netStatus event handler.
I’m sure there’s some good reason for this, but I can’t help but think this is one of those “let’s prevent the novice from killing their server with connections” sort of decisions. I’m a big boy, and I think I can handle a little danger… so I wish I could have my cake here.
For the short term, my solution is to set up a timer to call the connect function from it’s handler in the NetConnection.Connect.[Failed/Rejected] event, and then run the timer down in one millisecond. It works fine, but it’s sort of hackish if you ask me. Anyone have a better/prettier solution for this? I’d love to hear it.
More gotchas to come as they find me.
Do you Yahoo!?: If you use Yahoo Mail I can’t write to you, again.
Posted by Jay Charles | Filed under Rants and Not-So-Rants
A couple of years ago, I had problems with emails to Yahoo! addresses getting rejected. It wasn’t anything I was doing, it was just Yahoo being Yahoo. If you Google “Yahoo mail deferred”, you’ll see that this is nothing uncommon, and Yahoo black/greylists legitimate senders regularly in the name of “spam management”.
When it happened, Yahoo had me jump through all sorts of hoops (by “jump I mean “fill out” and by “hoops” I mean “forms”, and by “forms” I mean the same form over and over again) so they could make their decision whether I am worthy to send email to their users. It took weeks of back and forth (after the initial two week wait for someone to respond to my request in the first place), and was a little aggravating, but the Yahoo machine fixed it, so all was well for a time
This week, I’m suffering deja vu. Suddenly, all of my emails to Yahoo! addresses are being returned with this lovely error:
451 Message temporarily deferred - [70]
…which is the same one I was getting from them the first time around. I’m not a spammer, my mailserver is not an open relay, I have reverse DNS set up, and I don’t send any bulk email. My server resends every 40 minutes when errors other than fatals are returned on the previous attempt. There are 4 email addresses on my mailserver, all connected directly to my properly configured domain. I check my SMTP logs weekly looking for anything problematic, and there never is.
GMail, Hotmail, a bevy of ISPs… none of them have a problem with me, it’s just Yahoo. This time around, I just can’t / won’t / ain’t gonna run the gauntlet again, so I’m going to give Yahoo “the big whatever” and just let it lie. If it means I never send another message to a Yahoo account, I guess life will go on.
So, if you use your Yahoo account to email me and never get a response, know that it’s not because I don’t love you, it’s because Yahoo doesn’t love me.
Test Posting: SWFObject vs. Wordpress Editor
Posted by Jay Charles | Filed under General Nonsense
Just a little test post to see how difficult it is to get SWFObject working in my Wordpress posts without building a plugin for it. If this post looks goofy, now you know why. If you see a Citrix logo below (which is totally out of place for this site), then it’s working without a fight.
I see the logo… do you? If you don’t, please post a comment to let me know.
Houston H1 Goes Supernova: ThePlanet’s Datacenter Transformer Explosion
Posted by Jay Charles | Filed under Rants and Not-So-Rants
Saturday at about 4pm (EST) my server host, ThePlanet.com experienced a major disaster at their Houston TX H1 datacenter. Apparently, a transformer in one of their electrical equipment rooms exploded, taking out most of the power infrastructure of the datacenter (as well as the walls surrounding the equipment room).
For those not familiar with ThePlanet, they are one of the biggest providers of dedicated servers in the US… with 5 datacenters serving upwards of 20,000 customers (that’s direct customers, not considering the hundreds of thousands of reseller accounts making up a million+ domains on their network). I currently have two servers with ThePlanet, and as luck would have it, they are both in ThePlanet’s H1 datacenter in Houston, TX. As a result, my servers were down all weekend, and just came back on yesterday evening. Power is still a bit shaky, and I’ve read reports that some of the phases of the datacenter are still up and down. It’s scary to think that there are portions of the datacenter currently relying on portable generators (the kind that are in a semi trailer… not the little Honda generators you get at Home Depot, silly).
Here are the good things I have to say about the incident:
- ThePlanet reports that nobody was hurt, and that in itself is a miracle. If you’ve ever seen a large (5+ Mw) transformer blow at an outdoor transfer station, you know what sort of power we’re talking about. Now imagine that happening indoors, and the destruction it would (and did) cause. Had anyone been near it during the event, that person wouldn’t be with us anymore… so thank whatever diety or statue you bow to for that fact that nobody was within harm’s reach that day.
- The Planet is doing everything they can to put the pieces back together as fast as possible… but…
Here are the bad things I have to say:
- ThePlanet really dropped the ball when it comes to handling support tickets and calls surrounding the event. Although I’m sure they are being flooded with support requests right now, it’s their job to see them through immediately, regardless of whether that means calling in every one of their support people to work 12 hour shifts. We’re not talking about some itty-bitty hosting company here, were talking about 5 major datacenters pulling in millions of dollars a month in hosting fees.
- When the tickets do get responded to, I’m getting canned responses that don’t actually answer the question or solve the problem. That, friends, is just unacceptable.
- The canned responses provide comments about what the customer can do to fix problems for himself/herself. For example, the nameservers in the H1 datacenter are now borked, so the customer servers using those nameservers simply cannot resolve domain names. Although changing nameservers not a major undertaking for an experienced server manager, it still pisses me off when someone I pay for a service fails, and then tells me to go fix it myself.
- I understand that nobody can plan for every contingency, but really, to have the potential for a single event to take out an entire datacenter (we’re talking 9000 servers here) is insane. I would think that a facility of that calibre would have enough redundancy in place to get back up within 24 hours, regardless of the magnitude of the event
Things I’ve learned from this event
- Having both of my servers in the same datacenter, is a really bad idea.
- I need to move one of my servers to another datacenter, and run a “worst case failure” backup from my office. That way, I’ll still at least get my email.
- I should feel lucky that my servers are both on the floor of the DC that got power back first. My understanding is that other customers are not as lucky.
- I need to evalulate whether this is something that warrants moving to another hosting provider. ThePlanet has been good to me for the past 5 years, but this whole mess has really shaken my confidence.
- I need to be thankful that my servers are intact. While the datacenter’s electrical infrastructure was seriously damaged, my servers are unharmed (ThePlanet has reported that no customer servers were damaged during the event).
- I need to be thankful that I don’t work for ThePlanet’s support department… life must be really tough for those guys and gals right about now.
Back from the dead.
Posted by Jay Charles | Filed under General Nonsense
I’m back from my trip into dead server land. For those that don’t know, I had a catastrophic hardware failure on one of my boxes (the box I keep this blog in) about a month ago. Fortunately, I was able to recover just about everything… just missing a few images here and there and a couple of really old pet projects I haven’t worked on in ages.
It’s funny… when it comes to my client’s projects I’m absolutely anal about keeping multiple backups. You’d think I’d have put the same effort into backing up my personal stuff. Lesson learned.
So… whatcha been workin’ on, Jay?
Posted by Jay Charles | Filed under Flash Platform
Now that it’s live, I can mention what I’ve been working on for the past year.
My part is the Flash/FMS programming for the LiveShow and Chat applications on the site. I’m not going to do a whole article on it just yet, as I don’t want to steal any thunder from the media folks at LiveVideo, so that’s all for now.
Playing with toys part 1 - Baby, you can drive my car.
Posted by Jay Charles | Filed under Flash Platform
All work and no play makes Jay a dull boy, so…
A recent project (a Jeopardy-style game application) for one of my clients had me playing with buzzers and lights, and getting the buzzers buzzing and the lights lighting through a Flash application. The game turned out to be pretty cool, and left me asking myself what else I can do with Flash based control devices, and how I can throw FMS into the mix somehow.
After a bit of tinkering (and butchering of little toy cars), I came up with this little application:
I’ll have the car running most of the time I’m in the office (or at least, until it becomes a distraction). Please be cool and don’t bump into my feet. Yeah… it’s funny and all, but “Hey… I’m workin’ ova here”.
Edit: A picture of the car at Abbey’s request:
TCMsgQueue and you: Keeping your core alive
Posted by Jay Charles | Filed under Flash Platform
Since the early days for FCS/FMS, I’ve seen messages in the FMS logs and server console telling me all about TCMsgQueue. Cool. I love when the server tells me stuff. But, umm, what’s TCMsgQueue?
Well, here’s how it seems to work; As your data goes out to your clients, the server has to be able to deal with clients who can’t receive it fast enough. So, the server maintains a queue of data in RAM for each client (actually a few queuesfor each client, for AS data, video, and audio) .
That’s very cool… sort of. If your clients have, for the most part, fast enough connections to keep up, or periods of fast-ness when they can catch up, then the queues empty out nicely, and nothing bad happens. When that happens, you’ll see a message in the FMS Admin console (the server log), telling you about a queue that has reached 100kb or so, and life goes on as if nothing had happened. If the queue doesn’t empty out after a few seconds, we get constant warnings, and we see the size of the queue growing.
Here’s where it gets a little ugly. Unless there’s something I’m missing, there is no built-in management for the size of these queues, other than the overall memory limit for the core, and no way to manage the queues programatically. It seems that, if too many slow clients are hooked up, the server will simply queue data until the core uses up all it’s memory and goes stupid [unresponsive]. Sometimes the core will crash and kick everyone out (cool, I guess), but other times, it keeps the connections alive, and just sits there doing nothing (not cool at all).
In most cases, our problem is going to be video. FMS will drop i frames (the frames between the keyframes) without issue, but with the FLV spec, you can’t drop a keyframe without breaking the stream. So, the queue grows with each keyframe the client doesn’t get in time.
So, how do we manage that… how do we get to the queue info? Well, it’s right there in the docs, sort of, if you read waaaayyyy between the lines. The application.client class has a method named getStats(), which returns an object with all kinds of useful info, including the size of the various queues FMS is holding for each client. The method is in the docs, but the properties for the queue sizes aren’t (shame on me for not running the property trace loop for myself in the beginning).
Turns out, the object returned by client.getStats() has the following properties we need:
audio_queue_msgs
audio_queue_bytes
video_queue_msgs
video_queue_bytes
data_queue_msgs
data_queue_bytes
… now we’re getting somewhere… sort of. We can monitor the queue for each client, and set up a condition where we can identify a problem, but what to do once we’ve found a problem?
If the server created the stream the client is watching, and the problem client is the only subscriber to that stream, then great, we can just kill the stream from the server side and goodbye queue. But, what about cases where the client created the stream, or when other clients are watching the same stream?
The easy thing to do is to simply disconnect the client from the server side (using application.disconnect() ), but that’s a little weak if you ask me. Why dump a perfectly good netconnection for a client with a pipe that’s too skinny for one of the streams? He’s just going to reconnect, and get the same results. That, my friend, is when people declare that your stuff doesn’t work. Instead, maybe we can kill that video stream from the client side, so we can keep our data connection alive, and at the same time inform the client about the problem.
The best I’ve come up with so far is to create a client side method (on the NetConnection) that sets receiveVideo(false) on the problem netstream. A server function then loops through the client queue data on an interval, looking for clients with a video queue larger than X. When a client’s queue is larger than X, the server app invokes the client method, and the client stops receiving video on the stream (and gives the user a visual warning about it).
Now, we need to make sure we invoke this client method before any of the client queues get big enough to slow down data packets. FMS is helpful to us here, as the priority is data, then audio, then video. I’ve found that a 100kB threshold works well.
It’s not the most graceful solution in the world, but it’s keeping my cores alive. If you have ideas for something a little cleaner, I’d love to hear about it.
Realplayer 11: Local Dis-connection
Posted by Jay Charles | Filed under Flash Platform
Now that my recent rants about the Realplayer 11 are gaining exposure, the reports about more problems are starting to come in. As information comes to me, I’ll post it here so everyone can get a good, deep whiff of every variety of Reaplayer 11’s stench.
Today’s episode comes courtesy of Andy Herrman. Andy has found that Realplayer 11 is dicking with the LocalConnection class. I’m still working on decompiling the DLL’s and other files in the Realplayer’s hijacking kit, so I don’t have the cause for this one just yet.
Anyhoo… Andy found that when Realplayer 11 is installed, LocalConnection sometimes works, and sometimes doesn’t when an HTML page containing a .swf is reloaded (refreshed). Armed with the files Andy provided, I tested for myself. It comes as no surprise… Andy had it right. Testing against IE7/Vista/Flashplayer 9, Realplayer 11 seems to block the LocalConnection from happening when the page reloads.
Oddly though, the problem only happens for me when serving the HTML and .swf from an internet location. Testing locally, the problem doesn’t seem to happen, but that’s hardly worth mentioning as just about all .swf content is going to come from an internet location.
Since the example files are someone else’s work I’m not going to post a public link to the test page, but if you need to see it happen for yourself, post a comment here (using a valid email address of course), and I’ll hit you with the link.
So, there you have it folks. Just another bit of dung to add to the Realplayer pile.
