rts page 8 - Dave's Blog

Search
My timeline on Mastodon

Windows Media Center and Zune Integration Hack

2007 Nov 28, 1:23One of the new Zune features that had me the most excited was the claimed improved Windows Media Center integration which unfortunately turned out to simply mean support for the Win MCE video format (with an exception for HD). I wanted to be able to pick shows recorded by my Win MCE and have the Zune automatically sync up the latest episodes. However, with the improved podcast support in the Zune software one can easily create a ridiculous hack to accomplish this.

The new Zune software has podcast support which does everything I'd want to do with a Win MCE recorded TV series so the goal is to shoehorn a TV series into a Zune podcast. An overview of the steps: Create an XSLT that converts Win MCE data to a podcast, run the XSLT as a scheduled task every few hours per TV series, setup a Web server pointed at the resulting podcasts and the Win MCE Recorded TV directory, and subscribe to the resulting podcasts in the Zune software.
  1. Reading through the Win MCE data stored as an XML file in "C:\ProgramData\Microsoft\eHome\Recording\Recordings.xml" and the spec for podcasts I created an XSLT to convert a series from Win MCE data to a podcast.
  2. I added a new task to the Scheduled Tasks to run my XSLT using my xsltproc.js script. The task runs a handful of commands that look something like the following:

    C:\windows\system32\wscript.exe C:\users\dave\bin\xsltproc.js C:\Users\Dave\Documents\trunk\development\mce-zune\mce-to-podcast.xslt C:\ProgramData\Microsoft\eHome\Recording\Recordings.xml --param title "The Daily Show With Jon Stewart" --param max 4 --param baseURI "http://groucho/" --param thisRelURI "tds.xml" -o "D:\recorded tv\tds.xml"

    For each TV series I run a command like the above and that outputs a podcast for that series into my "D:\Recorded TV\" directory.
  3. Zune only allows http URIs for its podcasts so I installed a web server on my Win MCE server. I'm running Vista Ultimate so it was quick and easy for me to install IIS7 but any Web server will do. Then I pointed it at "D:\Recorded TV\".
  4. Once all the above was done I just subscribed to the resulting podcasts via my Web server and viola! Since I'm forced to use a Web server I can even run the Zune software on a machine other than my Win MCE server. You can see a screen-shot above of my Zune software showing my Colbert Report podcast.
PermalinkCommentstechnical xml mce hack windows media center zune windows xslt podcast

Undercover restorers fix Paris landmark's clock | Art, Architecture & Design | Guardian Unlimited Arts

2007 Nov 26, 12:32Guerrilla clockmakers fix famous Paris clock. Andrew says: "It seems a team of clockmakers broke into the Pantheon in Paris in September 2005 and spent a year fixing the historic and neglected clock, which had been abandoned by the authorities. They werePermalinkCommentsclock culture history humor paris france via:boingboing cultural-disobediance

Bad Science

2007 Oct 29, 1:48FTA: "Ben Goldacre is a medical doctor who writes the Bad Science column in the Guardian, examining the claims of scaremongering journalists, quack remedy peddlers, pseudoscientific cosmetics adverts, and evil multinational pharmaceutical corporations. ThPermalinkCommentsmonthly blog science politics religion media news healthy research humor

Charts And Graphs: Modern Solutions | Developer's Toolbox | Smashing Magazine

2007 Oct 24, 10:12Without realizing it this was the page I was looking for three weeks ago.PermalinkCommentsvia:kris.kowal web chart graph ajax .net flash programming visualization statistics reference

WebBrowser Customization

2007 Oct 5, 1:50How to host a WebBrowser control and customize it to your hearts content.PermalinkCommentsie internet microsoft web browser msdn reference howto webbrowser

Wikipedia Tools

2007 Sep 12, 6:54I'm visiting Wikipedia more and more recently but I always find myself reading the referenced webpages to get the full context of quotes and for more info. Basically I use Wikipedia as an introduction and a place to look for links. For times when I'm looking for opinions rather than facts I like to use Everything2. No need to check references there.

There's the much hyped WikiScanner tool which reports who has been making anonymous (thought to be anonymous at the time anyway) edits to Wikipedia. Its humorous and interesting in a few cases, but in general I think its stretching to say that because an IP address range is owned by a corporation and someone edited Wikipedia on an IP in that range that you can attribute that edit to that corporation. If I edited Wikipedia I'd probably do a bit of that during my lunch break, but that wouldn't mean that Microsoft wants the Wikipedia pages for Weird Al, Dave Risney, URIs, or whatever else I would edit on Wikipedia changed.

Also, via Everything Is Miscellaneous I found the tool Wiki Dashboard. Wiki Dashboard proxies Wikipedia and on each page shows a timeline view at the top with who made edits and when. Its nice to see a gentle curve down from an initial spike at the beginning for topics you don't imagine to be controversial. As the canonical test page for this service I looked up 'Elephant' the Wikipedia page Stephen Colbert suggested folks vandalize on his show on 2006 July 31st. If you look at the Wiki Dashboard Elephant page you can see a very large spike in edits on that date. That's all I need to see.

As a side note, for the link on Stephen Colbert suggesting folks vandalize Wikipedia I linked to a Wikipedia article. Is it inappropriate to provide info about Wikipedia being vandalized and thus incorrect via a link to a Wikipedia article?PermalinkCommentswikidashboard stephen-colbert wikality wikipedia wikiscanner colbert-report

Native Win32 ports of some GNU utilities

2007 Aug 9, 1:33Win32 versions of many common Unix commands.PermalinkCommentsunix linux tool tools download windows sourceforge shell software free

Which which - Batch File Hackiness

2007 Aug 9, 5:41To satisfy my hands which have already learned to type *nix commands I like to install Win32 versions of common GNU utilities. Unfortunately, the which command is a rather literal port and requires you to enter the entire name of the command for which you're looking. That is 'which which' won't find itself but 'which which.exe' will. This makes this almost useless for me so I thought to write my own as a batch file. I had learned about a few goodies available in cmd.exe that I thought would make this an easy task. It turned out to be more difficult than I thought.

for /F "usebackq tokens=*" %%a in ( `"echo %PATH:;=& echo %"` ) do (
    for /F "usebackq tokens=*" %%b in ( `"echo %PATHEXT:;=& echo %"` ) do (
        if exist "%%a"\%1%%b (
            for  %%c in ( "%%a"\%1%%b ) do (
                echo %%~fc
            )
        )
    )
)
The environment variables PATH and PATHEXT hold the list of paths to search through to find commands, and the extensions of files that should be run as commands respectively. The 'for /F "usebackq tokens=*" %%a in (...) do (...)' runs the 'do' portion with %%a sequentially taking on the value of every line in the 'in' portion. That's nice, but PATH and PATHEXT don't have their elements on different lines and I don't know of a way to escape a newline character to appear in a batch file. In order to get the PATH and PATHEXT's elements onto different lines I used the %ENV:a=b% syntax which replaces occurrences of a with b in the value of ENV. I replaced the ';' delimiter with the text '& echo ' which means %PATHEXT:;=& echo% evaluates to something like "echo .COM& echo .EXE& echo .BAT& ...". I have to put the whole expression in double quotes in order to escape the '&' for appearing in the batch file. The usebackq and the backwards quotes means that the backquoted string should be replaced with the output of the execution of its content. So in that fashion I'm able to get each element of the env. variable onto new lines. The rest is pretty straight forward.

Also, it supports wildcards:
C:\Users\davris>which.cmd *hi*
C:\Windows\System32\GRAPHICS.COM
C:\Windows\System32\SearchIndexer.exe
D:\bin\which.exe
D:\bin\which.cmd
PermalinkCommentswhich cmd technical batch for

Moved

2007 Aug 6, 4:07I've moved from my previous apartment in Redmond into Sarah's condo in Kirkland. Over the past week I'd been coming home from work and packing and sorting all of my belongings. Everything had a few destination options: I donated two carts of computer related junk (two CRTs, two desktops, six laptops, untold number of cables, piles of network and sound cards, etc) to RE-PC and six garbage bags of clothing that I either never wear or into which I have worn holes into friendly looking clothing donation bins. Of course I still need to find some place to get rid of my 15 inch CRT TV, VCR, DVD player, and X-Box. I finally emptied my bags of coins that had been collecting for about seven years (one of the bags was from my college orientation) through Coinstar and got ~$160. Some items seemed to fit very well at work like my satirical RIAA propaganda poster and my Darth Vader Nutcracker. This past weekend I had movers come and actually move my furniture. Most of its now in storage except for my living room which is moved into Sarah's second bedroom. Now all I have to do is unpack...PermalinkCommentsmove personal repc recycle nontechnical

Wp64 Issues

2007 Aug 6, 3:43Miladin told me about the Visual Studio compiler's promising option Wp64 that finds 64bit portability issues when compiling in 32bit. If, for instance, you cast from a (long*) to a (long) you get a W4 warning. However, the #defines are still set for 32bit builds. This means that other parts of the code can make assumptions based on the #defines that are valid on 32bit but generate 64bit errors or warnings.

For instance, in winuser.h the public published Windows header file there's the following:
...
#ifdef _WIN64
...
WINUSERAPI
LONG_PTR
WINAPI
SetWindowLongPtrA(
    __in HWND hWnd,
    __in int nIndex,
    __in LONG_PTR dwNewLong);
...
#else  /* _WIN64 */
...
#define SetWindowLongPtrA   SetWindowLongA
...
#endif /* _WIN64 */
...
In 64bit everything's normal but in 32bit SetWindowLongPtrA is #defined to SetWindowLongA which takes a LONG rather than a LONG_PTR. So take the following code snippet:
...
LONG_PTR inputValue = 0;
LONG_PTR error = SetWindowLongPtrA(hWnd, nIndex, inputValue);
...
This looks fine but generates warnings with the Wp64 flag.

In 64 bit, p is cast to (LONG_PTR) and that's great because we're actually calling SetWindowLongPtrA which takes a LONG_PTR. In 32 bit, p is cast to (LONG_PTR) which is then implicitly cast to (LONG) because we're actually calling SetWindowLongA. LONG and LONG_PTR are the same size in 32bit which is fine but if you turn on the Wp64 flag there's a W4 warning because of the implicit cast from a larger size to a smaller size if you were to compile for 64bit. So even though doing a 32bit or 64bit compile would have worked just fine, if you turn on the Wp64 flag for 32bit you'd get an error here.

It looks like I'm the most recent in a list of people to notice this issue. Well I investigated this so... I'm blogging about it too!PermalinkCommentswp64 technical 64bit compiler c++ visual-studio setwindowlongptra

Glarkware

2007 Jul 15, 9:03Humorous t-shirtsPermalinkCommentsclothing purchase shopping shirt humor

Trendsspotting Blog Archive - kids are heavy social network users, they don’t say no to relevant marketing efforts: online surveys and tips for marketersTrendsspotting

2007 Jul 11, 9:54Stats on who uses social networks.PermalinkCommentsresearch reference statistics social web

What the World Eats

2007 Jul 2, 9:15Photos of what a family eats in a week in various parts of the world.PermalinkCommentsphotos culture diet food health artle

Instructables EMP shopping cart locker

2007 Jul 2, 9:04Build a device to remotely lock shopping carts.PermalinkCommentsarticle humor electronics shopping-cart wireless diy via:swannman

RFC 4790 Internet Application Protocol Collation Registry

2007 Jun 27, 11:27RFC defining a registry of string sorts that other future RFCs may reference.PermalinkCommentsrfc reference ietf internet protocol registry collation sort string locale

Flags By Colours

2007 Jun 5, 4:07Pie-charts of the colors in country flags.PermalinkCommentsart chart visualization statistics flag graph

Tesla's Motorized Pink Bunny Slippers: The Fast and the Furry-ous - Gizmodo

2007 May 21, 2:49Little go carts disguised as giant bunny slippers.PermalinkCommentshumor technology slippers bunny car

New XSLT - IE7 XML Source View Upgrade Part 2

2007 May 11, 8:55Last time, I had written some resource tools to allow me to view and modify Windows module resources in my ultimate and noble quest to implement the XML content-type fragment in IE7. Using the resource tools I found that MSXML3.DLL isn't signed and that I can replace the XSLT embedded resource with my own, which is great news and means I could continue in my endevour. In the following I discuss how I came up with this replacement for IE7's XML source view.

At first I thought I could just modify the existing XSLT but it turns out that it isn't exactly an XSLT, rather its an IE5 XSL. I tried using the XSL to XSLT converter linked to on MSDN, however the resulting document still requires manual modification. But I didn't want to muck about in their weird language and I figured I could write my own XSLT faster than I could figure out how theirs worked.

I began work on the new XSLT and found it relatively easy to produce. First I got indenting working with all the XML nodes represented appropriately and different CSS classes attached to them to make it easy to do syntax highlighting. Next I added in some javascript to allow for closing and opening of elements. At this point my XSLT had the same features as the original XSL.

Next was the XML mimetype fragment which uses XPointer, a framework around various different schemes for naming parts of an XML document. I focused on the XPointer scheme which is an extended version of XPath. So I named my first task as getting XPaths working. Thankfully javascript running in the HTML document produced by running my XSLT on an XML document has access to the original XML document object via the document.XMLDocument property. From this this I can execute XPaths, however there's no builtin way to map from the XML nodes selected by the XPath to the HTML elements that I produced to represent them. So I created a recursive javascript function and XSLT named-template that both produce the same unique strings based on an XML node's position in the document. For instance 'a3-e2-e' is the name produced for the 3rd attribute of the second element of the root element of the XML document. When producing the HTML for an XML node, I add an 'id' attribute to the HTML with the unique string of the XML node. Then in javascript when I execute an XPath I can discover the unique string of each node in the selected set and map each of them to their corresponding positions in the HTML.

With the hard part out of the way I changed the onload to get the fragment of the URI of the current document, interpret it as an XPath and highlight and navigate to the selected nodes. I also added an interactive floating bar from which you can enter your own XPaths and do the same. On a related note, I found that when accessing XML files via the file URI scheme the fragment is stripped off and not available to the javascript.

The next steps are of course to actually implement XPointer framework parsing as well as the limited number of schemes that the XPointer framework specifies.PermalinkCommentsxml xpointer msxml res xpath xslt resource ie7 technical browser ie xsl

ISO50

2007 Mar 30, 1:50Cool retro shirts and posters.PermalinkCommentscool poster shirt retro product shopping

GameDrift - Technology and Gaming Combined - Articles - 22 Month Old Baby Rocks at Wii Sports

2007 Mar 22, 12:24A 22 month old child plays Wii Tennis pretty well.PermalinkCommentswii video nintendo games humor baby
Older EntriesNewer Entries Creative Commons License Some rights reserved.