Spelling, Code Blocks and Twitter on Channel 9

Description

Hey folks, I thought I'd take a moment to update you on what the dev team has been working on recently, including spell checking in the editor, a slick way to insert code snippets and some already deployed features that you may or may not have noticed.

We asked nicely and were given the code behind the 'insert code' button on MSDN's editor (from their forums) and between Nathan and myself we were able to wrestle it into place onto
our site. Not a lot of work in truth, but we needed to replace their script and css references with ones that work for us and build a simple service that takes in code and returned styled html (for the preview function). Of course, sending all sorts of code
and markup to that service was causing the ASP.NET Request Validation to freak out, so that had to be selectively disabled ... isn't web development fun!

Next up came the addition of spell checking.... which
TinyMCE already includes a plug in for, with all the client side code already in place to break up the text into small chunks and send it off to a server side encoded into a block of JSON. The server side code they supply is php though, which is workable
on our IIS boxes, but would involve a fair bit of custom work for a relatively small feature and either calls a console app (aspell ?) or calls out to Google. Neither of those options seemed that appealing, so I wrote a service that works with the
Live (Bing!) Search APIs and does the same thing.

I'm still doing some testing with this service, but so far it seems to be working out fine... English only at the moment, but the Live API certainly supports more options so I'll add more options in the future.

And last, but not least, I thought I'd talk about a feature that was rolled out a while back; the addition of MSDN/Twitter/DotNetShoutout to the 'Share' drop down on videos.

Ages back, Erik converted our 'share' options to be pulled from a database, with the idea that we'd add new ones from time to time, and now we finally have! In a recent update we added
Twitter, DotNetShoutout and support for the
MSDN bookmarking service.

We toyed with the idea of a 'send to twitter' option for awhile, but once you put our URL into a tweet, we are either over 140 characters or we've hardly left any room for you to talk about the content! That meant that the deployment of a twitter link was dependent
on the use of some form of URL shortening service. We have all sorts of reasons why we'd rather not use any of the existing services (bing problems url shortening canonical for
some of these reasons), so now the twitter button had to wait on the creation of our own URL shortening service.

Enter the C9 url shortening service

Not really a replacement for Tiny URL or any of those services, as ours only works for our content, but definitely what we needed so that we could (1) create short URLs that we control to prevent future broken links and (2) create them algorithmically so that
we didn't have to make an external service call to display the twitter link on our page.

The formula is simple, just turn the Entry ID of our post, which is a long into a short string by
Base-36 encoding it and then stick 'http://ch9.ms/' onto the front of it. This produces reasonably short URLs, and can be computed at either end without any need for a database look up. The result, a URL like
http://ch9.ms/A49H is then used in creating the twitter link.

You can access the twitter link from the little 'share' drop down below each post, which is another interesting bit of code

This drop down and the 'Formats' drop down for downloadable media files share a common set of code and both support the storing of user preferences. It was our thought that most people have a single way that they usually will want to share a link and a single
file format they usually want to download, so when you pick an item from either of these lists, we store your choice in a local cookie. Then, when you visit that page again later or any other page on C9 with the same drop down on it, we'll remember your choice
and make that the default choice shown in the drop down. Of course, you can pick something different at anytime, so if you like to use Twitter most of the time and then feel like trying out DotNetShoutout you are not blocked in anyway!

When will we see those editor updates?Soon... I'm still working on them, trying to make sure they are stable and reliable before we deploy them, but I definitely expect them live within a week!

We've considered it, but around the time we were thinking about using it we were asked to add support for MSDN's bookmarking service and decided that we needed (wanted) the flexibility to add destinations ourselves. Their widget does look amazing though
and has many customization options!

It is also worth noting that using their widget, I couldn't put a custom URL in for twitter, while leaving the full URL for a service like DIGG.

We are working on that, but the player isn't making it easy... it was built using all Grid controls so it auto sizes a bunch of things and moves the whole media element up when the video isn't as high...

Hi Duncan, I am one of the developers of the TinyMCE editor, we noticed the Bing spellchecker API a while ago and was thinking of implementing it, but it would be sweet (and save some time) if we could look into your implementation. Get in touch for further
discussions, mail to joakim at moxiecode dot com.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.