BeebMC 2.3 Released
Download it here: http://www.beebmc.com/
Fixes a bug reported by a couple of people where although it launched properly, it would not play music.
TraceJS V2 R.I.P.
A couple of years ago I posted a small blog entry on a throwaway tool that I had created that uses the Debug API to log all JavaScript that Internet Explorer executes.
A year ago I decided to take a year off from consulting, mainly to spend a lot more time with our kids while they are still young, but also to have some time to explore some product ideas.
The first idea I wanted to explore was whether or not it might be possible to extend the idea I'd had in that older blog post to actually make a commercial product that would not only trace all JavaScript, but would also show call stacks, and show how often functions were executed.
Technically it was tricky because I wanted my custom JavaScript debugger to be loaded in-process into Internet Explorer, since I thought that this might speed it up considerably. The secret turned out to be that I needed to pass a special flag to IDebugProgramProvider2->GetProviderProcessData (the PFLAG_DEBUGGEE flag).
After a couple of months of development I finally got it all working.
You started it from the IE Tools menu: ![]()
This would create a separate TraceJS dialog: ![]()
Then as you access a page that contains JavaScript the TraceJS Window shows the statements that are being executed:
![]()
Once you'd captured the JavaScript execution, you could replay the executed JavaScript, either step-by-step, or continually at a pace you define:![]()
Finally you could drill-down to see which functions are called the most, and who calls them:![]()
I had it all working in my initial build environment, which was XP based. Then I tested in Vista, and I couldn't get it to work (the GetProviderProcessData failed). Ouch!
I took a step back, gave the product a long hard look, and decided to stop development. It was too slow (despite being entirely in-process), I couldn't implement features I needed such as timing (the debugging/tracing added too much overhead), and I couldn't get it working on Vista.
Now that IE8 has similar profiling features I'm happy I stopped when I did.
Of course the biggest mistake I made was to register the domain names for the product before it was completed (tracejs.com, jsprof.com, jsprofiler.com and javascriptprofiler.com are all mine).
If there is one sure way to kill a product idea it is to register domain names before you've executed on the product idea itself
.
Using ASP.NET MVC and the AJAX Control Toolkit
There are a whole range of useful AJAX behaviors available in the ASP.NET AJAX Control Toolkit, and it would be cool to be able to use them from ASP.NET MVC.
In this post I'll show you how you can use one of the extenders that I created, the ListSearch Extender, with ASP.NET MVC.
Set up your ASP.NET MVC Project
To start create a new ASP.NET MVC project.
Next download the Microsoft AJAX Library, which contains the Javascript library used in the Microsoft ASP.NET AJAX implementation. Copy the MicrosoftAjaxLibrary folder in the ZIP you downloaded to the Content folder in your MVC project.
Now download the Script Only Files from the ASP.NET AJAX Control Toolkit and copy the AjaxControlToolkit folder in the ZIP to the Content f0lder in your MVC project.
Now that the folders are copied you need to make them visible to the project. Open the Content branch of your project in the Solution Explorer, and then click on the Show All Files button:
Once you do this, you should see the two folders that you copied into the Content folder. Right click on each folder and select Include In Project.
Now your MVC project will have access to the JavaScript files it requires.
Add the SELECT
To make use of these JavaScript libraries, open the Home action's Index view under Views->Home->Index.aspx. Modify the HTML to include a simple SELECT List:
<%@ Page Language="C#" ... %> <asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"> <h2> <%= Html.Encode(ViewData["Message"]) %></h2> <p> To learn more about ASP.NET MVC visit ... </p> <select id="Countries"> <option>Switzerland</option> <option>United Kindom</option> <option>United States</option> </select> </asp:Content>
Include the required Javascript files
Next you'll need to have the page pull in the JavaScript files that are used by the ListSearch Extender:
<script type="text/javascript" src="/Content/MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js"/>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.Common.Common.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.ExtenderBase.BaseScripts.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.DynamicPopulate.DynamicPopulateBehavior.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.Compat.Timer.Timer.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.Animation.Animations.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.Animation.AnimationBehavior.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.PopupExtender.PopupBehavior.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.PopupControl.PopupControlBehavior.js" type="text/javascript"></script>
<script src="/Content/AjaxControlToolkit/3.0.20820.16598/3.0.20820.0/AjaxControlToolkit.ListSearch.ListSearchBehavior.js" type="text/javascript"></script>
Initialize the Extender
Having included the required JavaScript files, you can now create a new ListSearch Extender and attach it to the SELECT you created above:
<script type="text/javascript"> Sys.Application.initialize(); Sys.Application.add_init(function() { $create(AjaxControlToolkit.ListSearchBehavior, { "id": "ListBox1_ListSearchExtender" }, null, null, $get("Countries")); }); </script>
Access your page
Summary
Moving a blog hosted at WordPress.com to Webhost4life
A couple of days ago I decided to move this blog from being hosted at WordPress,com, to an account I have at Webhost4life. You can add new domains to your account for only US$15 a year.
When I set the blog up at WordPress.com, I ordered my custom domain (damianblog.com) and that is what I have been using.
Export your WordPress.com hosted blog
The first thing I did was to export my blog from my WordPress.com account, by logging in to WordPress.com administration page for Damianblog, clicking on Manage, and then clicking on Export:
This generated an XML file which I saved on my local hard disk.
Installing WordPress on webhost4life
Webhost4life offer a an automated installation of WordPress using the "Php Free Plug-ins" item on the "Site Admin" tab of their control panel. I first tried using this, however it currently installs version 2.0.3, which will not import the file I'd just exported from WordPress.com.
After a little searching I came across this excellent page, which explains in detail what you need to do to set up the latest version of WordPress.
It worked well for me, except for step 18 (giving NETWORK access) - I found I had to give access to IUSER_DEDI... and also IUSER_<webhost4life account name>.
I also created the zip at step 14 as 'damianblog.zip' and copied that to my root directory and then unzipped it, so that WordPress was now installed under a 'damianblog' directory under my account root directory.
Setting up the damianblog DNS so that it points to Webhost4life
In the webhost4life control panel I went to the "Domain Name" item on the "Domains" tab in the control panel and added damianblog.com to map to the damianblog directory to which I'd installed WordPress.
I paid my US$15, and I was given the name of two domain servers that I could now use to resolve damianblog.com.
Configuring your domain's DNS servers to point to the webhost4life servers
In the WordPress.com admin site I clicked on Upgrades and then on Domains (to the right of "Upgrades" and "Gifts") and saved the Customer Number shown at the bottom of the page, and then clicked on "Manage Your Domains" at the very bottom of the page.
This took me to a new page on securepaynet.net on which I entered my Customer Number that I just saved, and my password. I clicked on damianblog.com and then clicked on "Nameservers" (the fourth tab), selected "Custom nameservers", and entered the name of the two name servers I'd been given when I set up the damianblog domain name in the Webhost4life control panel.
An hour or so later, when I pinged damianblog.com it returned my webhost4life IP address.
Panic
I went into my new WordPress admin page on webhost4life, and clicked on Settings (on the right-hand part of the page), and made sure the WordPress address (URL) was http://damianblog.com
I clicked on the Import link in the admin page, and imported the XML file I'd exported from the old blog hosted at WordPress.com
I checked, and sure enough when I went to http://damianblog.com all was well. I could relax.
As an afterthought I tried clicking on one of the links on the web that pointed to my blog. It didn't work. Aggh.
It turns out that the default Permalink URL in my new blog was of the form http://damianblog.com/?p=123, whereas all my old postings hosted on WordPress.com were of the form http://damianblog.com/2007/02/25/ajax-screencast/
I went to the Permalink section but none of the common settings were in the form I wanted (they all wanted to add 'index.php' to the URL). I could configure a custom structure to be the way I wanted, but when you clicked on URLs the page was not found:
The solution was to create a small PHP file which handled the "URL Not Found" error and remapped the page as described here. Just be careful when copying the PHP code from the web page because some of the single quotes are not the standard quotes that they should be.
Finally: the Simpla Theme
The new WordPress installation did not come with the theme I've chosen: Simpla. Installing it was pretty easy, I just unzipped the theme from http://ifelse.co.uk/simpla into the /wp-content/themes/ directory.
Unfortunately none of my widgets showed on the right hand side. I had to make a couple of small modifications to get that resolved.
Done
Now it all seems to be working properly and I can customize my installation as I wish.
A new Z-Wave blog (home automation)
Z-Wave is a home automation technology which uses a mesh network to allow devices to talk to each other.
Some devices, such as infrared motion sensors can run for years off of batteries, since their power requirements are so low.
Other devices that are wired-in (such as light switches) act as relays between devices, thus forming the mesh.
I've got a few of these devices set up now, and have ordered a load more to fully automate my home. I'm going to be talking about the purchase experience, installation, configuration, and controlling them from software.
I didn't want to "pollute" this blog with a bunch of Z-Wave information, so I've just started a new blog at http://www.thezwave.com/
I'll be posting there as my Z-Wave experience evolves.
No 64 bit release of BeebMC for now
I've been looking into getting BeebMC to run on the 64 bit version of Vista. It runs fine, but plays no music.
The reason is that Media Center runs as a 64 bit process, and there is no 64 bit Real Audio plugin for Internet Explorer, just the 32 bit version.
You can run a 32 bit instance of IE and use that to listen to the BBC, but when I host IE in BeebMC, it is running in a 64 bit context, so it can't then load Real Audio to play the BBC streams.
If/when the BBC starts streaming in a format that Windows Media Player can play natively then this problem will go away (and you'll be able to use BeebMC on extenders.
BeebMC 2.1 Released
I've just released BeebMC version 2.1. Some small changes:
- It now installs properly when the TV Pack is installed
- I've changed the icon
- There are now buttons to scroll up and down on a channel page, so that people with touch-panels can use the page more easily.
Download it from http://www.beebmc.com/
MCML Scroll Button PageUp jumps to first item in list
In BeebMC when you select a channel, you are presented with the list of programs available to "Listen Again". You can scroll up and down the list using a remote control, or by positioning your mouse just before the first item, or just after the last item.
I've had a request from someone that has a touch panel. They have no easy way of scrolling through their list. I've decided to add a couple of arrow buttons to let you page up/down through the list. This was pretty easy. I first added a couple of buttons to my Content:
<con:TouchButton Name="ScrollUpButton" Command="[ScrollUpCommand]" Picture="resx://BeebMC/BeebMC.Resources/arrow_up_blue"> <LayoutInput> <FormLayoutInput Top="Parent, 0.2" Left="Parent,0.05"/> </LayoutInput> </con:TouchButton> <con:TouchButton Name="ScrollDownButton" Command="[ScrollDownCommand]" Picture="resx://BeebMC/BeebMC.Resources/arrow_down_blue"> <LayoutInput> <FormLayoutInput Bottom="Parent, 0.80" Left="Parent,0.05"/> </LayoutInput> </con:TouchButton>
When the user clicks the button, I page up or down the scroller:
<Changed Source="[ScrollUpCommand.Invoked]"> <Actions> <Invoke Target="[ScrollingData.PageUp]"/> </Actions> </Changed> <Changed Source="[ScrollDownCommand.Invoked]"> <Actions> <Invoke Target="[ScrollingData.PageDown]"/> </Actions> </Changed>
I tested and all seemed to work well, however then I noticed that although paging down through the list worked fine, paging up was jumping straight to the first item in the list
Eventually I discovered the problem. When you click the Up button, the scroll area loses focus, and so it seems to lose track of where it was in the list. I'm not sure why it works for the Down button.
In any event, the solution was to add a rule to my TouchButton UI to essentially tell it not to grab focus:
<Default Target="[Input.KeyInteractive]" Value="false" />
Now it works and I am close to releasing version 2.1 of BeebMC, which should work with the Media Center TV Pack too.
BeebMC 2.0 released: Listen Again supported
I've just released a new version of BeebMC, adding support for "Listen Again":
If/when the BBC update their web site or RSS feeds then BeebMC will probably break -- leave a comment and I'll do what I can to fix it. Many thanks to the BBC for making all this content available.
BeebMC is available here: http://www.beebmc.com/
The Channels.xml file under C:\ProgramData\Atadore\BeebMC has been extended to include the URL for each channel's RSS feed. Feel free to edit it to add/remove/modify channels:
<Channel> <Description>BBC 1Xtra</Description> <PictureUrl>http://www.bbc.co.uk/iplayer/img/nav/radio/bbc_1xtra.gif</PictureUrl> <ChannelUrl>http://www.bbc.co.uk/iplayer/console/1xtra</ChannelUrl> <ProgramsRss>http://feeds.bbc.co.uk/iplayer/bbc_1xtra/list</ProgramsRss> </Channel>
I'm going to try to add extender support next. Subscribe to the "BeebMC" category in my blog to be notified of updates: http://damianblog.com/category/beebmc/
Screencast: Creating a simple Media Center Application
I've had some demand for the source for my simple application that plays BBC Radio inside Media Center.
I thought it might be more valuable if I put together a screencast introducing how I created the application from scratch, although the source is below too.
I assume your are familiar with .NET and C#, and have perhaps browsed through the Media Center documentation a little. If you are an experienced Media Center developer then move along, move along, there is nothing here to see.
The first screencast walks through the simple application that gets created for you when you create a new Media Center Application. I show how it works, and how you can build, install, and run it. It is available to be streamed or downloaded here: http://www.atadore.com/videos/MCBeeb.wmv
The second screencast starts when the first one leaves off, and shows how I modified the initially created application to play BBC Radio. It is here: http://www.atadore.com/videos/MCBeeb2.wmv
The final project is here. It isn't quite the same as the BeebMC application (it doesn't load the channels from an XML file, and has no error checking), but feel free to play around with it.
I recorded them in one go quite late on a Saturday night, and I stumbled a couple of times with the terminology - please forgive the occasional mistake.
Hope this is useful! Do let me know.