Music Library Synchronization, Sonos Tips

I love Windows Home Server.   I’ve been using Windows Home Server for years, and just purchased a Windows Home Server 2011(WHS) box from Newegg (great deal on a HP Proliant micro server).  Many have asked me why I like WHS so much – it’s NAS, it’s a media server, it’s backup.   It’s a step up from a simple NAS device (although, admittedly, not as plug and play), offers more flexibility and is more cost effective than a Drobo.  A small backup agent can take snapshots of your PC, typically on a daily basis, so they can be restored to a given point in time.  I keep snapshots of my initial installation, for example.  Restoring to those backups is a simple process.  I’m also a big fan of Sonos, a whole-home music solution that works amazingly well.  What Sonos has done exceedingly well is blend quality hardware, quality software, and reasonable (but not cheap) price points.  I have an extensive music collection, and I point Sonos to a share on my WHS box to index and stream music.  However, I consider my laptop my “database of record” for my music.  It’s where I download stuff, and I take it with me because I’m often on the road.  The problem I run into is keeping my WHS library in sync with my laptop.   In my case, I want to mirror my library on the WHS exactly as it is on my local collection – and because I’m often reorganizing my collection, adding tags, etc., I need a simple way to do this.  Enter Robocopy.   Robocopy (Robust file copy) is now built into Windows, and it’s a simple command line tool with a number of options to make this a snap.   For example, if I want to mirror a folder on my laptop with my WHS, this command will do it: c:\>robocopy "D:\Music" "\\BEAST\Sonos\music" /mir /r:10 /MT:8 D:\Music is my local folder, my server is \\Beast.  The /mir command is for mirror – it’s the same as using /purge and /e:  /purge is to delete files at the target folder that no longer exist in the source, and /e is to copy all subdirectories, including empty ones.   The /r:10 will tell it to retry up to 10 times, in case of some network glitch, and the /MT:8 will have Robocopy use 8 threads to speed things along.   (If you’re familiar with Robocopy, I don’t recommend using /z (restartable) mode as it adds overhead, not needed given the size of files we’re dealing with.) Now, what if you don’t keep all your music local, and just want to copy it over?   You don’t want to use /mir since it will remove files you otherwise want to keep!   The rest of the command will work fine, but if you move/rename files locally that were previously copied, you’ll have to remember to do that manually on the server.  Once Robocopy does its thing, you’ll get a nice summary:             Total    Copied   Skipped  Mismatch    FAILED    Extras Dirs :      1384        29      1355          0         0         0 Files :     15078       381     14697         0         0         0 Bytes : 117.188 g   3.212 g 113.975 g         0         0         0 Times :   0:16:40   0:02:52                       0:00:00   0:00:48 Here, it copied about 30 new folders.  It took about 16 minutes to run, but that’s largely due to new content, having copied some 3.2gb of new files.   Assuming minor changes only, the process typically runs in about 30 seconds. If you want to get fancy, you could even have Robocopy monitor your folders for changes.  The next challenge is to have Sonos update its music index once new files are copied over.   Sonos can update its index on a daily basis (or manually via the control software), but I want it done automatically after new files are copied over.  This one is a bit trickier, but thanks to some gurus in the Sonos forums, it’s not impossible.   I’m including the .exe file here for you to use.  Obviously, trusting an exe from someone on the web is not something I’d do, but it’s a .NET assembly which means you can use a tool like JustDecompile to crack it open and look at the source yourself.   Having said that, I’m not responsible if this code causes your computer to blow up, your music collection to vanish, or kills any puppies. The source code looks like so, and it sends an SOAP packet to a specified Sonos unit to trigger an index rebuild: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Net;namespace SonosIndexUpdater{ class Program { static void Main(string[] args) { string ip; if (args != null && args.Length > 0) { ip = args[0].Trim(); } else { Console.WriteLine("Missing IP Address. Please add IP address for any Sonos unit."); return; } string header1 = @"SOAPACTION: ""urn:schemas-upnp-org:service :ContentDirectory:1#RefreshShareIndex"""; string postData = @"<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"" s:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/""> <s:Body> <u:RefreshShareIndex xmlns:u=""urn:schemas-upnp-org:service:ContentDirectory:1""> <AlbumArtistDisplayOption></AlbumArtistDisplayOption></u:RefreshShareIndex> </s:Body> </s:Envelope>"; string url = string.Format("http://{0}:1400/MediaServer/ContentDirectory/Control", ip); byte[] byteArray = Encoding.UTF8.GetBytes(postData); try { System.Net.WebRequest req = System.Net.WebRequest.Create(url); req.Headers.Add(header1); req.ContentType = "text/xml"; req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.ContentLength = byteArray.Length; req.Timeout = 5000; Stream dataStream = req.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); using (WebResponse response = req.GetResponse()) { Console.WriteLine("Response from Sonos: {0}", ((HttpWebResponse)response).StatusDescription); using (dataStream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(dataStream)) { string responseFromServer = reader.ReadToEnd(); Console.WriteLine("Data: {0}", responseFromServer); } } } } catch (Exception ex) { Console.WriteLine("Exception occured: {0}", ex.Message); } } }}   To use it, you’d just pass in the IP address of any Sonos unit:   c:\>SonosIndexUpdater 192.168.1.100 If you stumbled on this and aren’t a developer but want to try it out, you can build this for free using Visual Studio Express.    Here are some files:   EXE file only: DownloadVS2010 Solution: Download

Wifi on the Road

I spend a lot of time on the road and often need to stay online.  Back in the Windows Mobile days, it was pretty easy to turn a WM6.x device into a personal Wifi hotspot; unfortunately this isn’t so easy on Windows Phone 7.  In fact, most of us now carry Verizon air cards/USB modems for alternative access.   While this has worked great, I often would prefer a hotspot:  I might need to have other devices like a Zune player get online, or might need to share an internet connection.  There are a couple of free pieces of software out there to turn your PC into a hotspot:  Connectify and Virtual Router are two that come to mind.   It might be specific compatibility issues with my PC or Verizon modem (USB760) but Connectify would blue screen my machine.   I often don’t want my PC to have to be the gateway, either, so enter a Cradlepoint PHS-300 router.  The idea is that you take your tethered phone/modem and plug it into the USB slot on the Cradlepoint router.  The router then acts as a personal hotspot.  Your PC/devices then connect to it over Wifi.  This has a number of advantages – obviously, it allows you to share the connection.  Secondarily, though, it allows you to place the router someplace where perhaps the signal is better – for example, by a window or across the room.  While it’s not as compact/simple as a Mifi, I like the fact that there’s no added cost to use my existing devices (like any of us need another monthly access fee.) A nice touch to the router is that it has a battery – so you could use it in a car, or put it in a difficult to access location.   The router is largely plug and play and can use many devices out there.   I’m at the beach for Memorial Day weekend, and I decided to put the PHS-300 through some paces.  Plugging in my Verizon USB760 was effortless and worked great.  No issues with connectivity on the move, and setting it up was config free… it just worked.   After a series of speed tests, I found that the Verizon modem (3G) was putting around 600k/sec, taking roughly 14 seconds to pull a 1MB file, with a latency of around 200ms.  Next I decided to plug my WP7 Samsung Focus into the device.  To do this, you need to access the diagnostics of the phone.  Doing this might also violate terms of service, so proceed at your own risk.   If you don’t have the diagnostics app in your app list, dial ##634#.  This adds the diagnostics app – from there, dial *#7284# – this allows you to switch the USB function of the phone; by default, it’s Zune Sync.  To tether, switch to “Modem, Tethered Call” – this will likely require a reboot of the phone. Next, I simply plugged the phone into the PHS-300.  And it worked.  No configuration (didn’t need to dial *99***1#, connect to the Cingular network, etc. – the PHS-300 took care of all that).   Looking at the modem config page on the router, it recognizes everything correctly: I was curious to test the speed vs. Verizon, so I ran some speed tests.   I have no love of Verizon over AT&T or vice-versa, but I have to say, AT&T spanked Verizon in terms of speed over the weekend at my location.   I wouldn’t draw any specific conclusions, but I’m going to make it a point to test locations as I travel about.   In this case, after many speed tests over the weekend, AT&T 3G averaged about 1.1Mb/s, downloading a 1MB file in about 7 seconds (twice as fast as Verizon) however the latency was higher around 500ms. As for the router – I’m impressed with the PHS-300.  The inclusion of a battery makes it wonderfully portable, and while not as compact as a Mifi, I have the choice of either my Verizon modem or AT&T tethered phone – both of which (in theory) offer me unlimited data.   Another nice trick, especially if you’re sharing the router with others, is to make use of the QoS/traffic shaping feature to give your machine/devices higher priority.

Returning to Chess

Many years ago, I was a reasonably active person in computer chess and OTB (over-the-board) chess playing, though admittedly I was more interested in the computer science behind chess rather than my own chess playing strength.   I owe this resurgence in my interest to my daughter as her interest in the game has grown.   I’ve broken out the nice pieces, chess clock, and of course, software! I’ve been searching for casual chess meetups in the Greensboro, NC area, and haven’t had much luck (if you know of any, let me know).  When I left the chess scene (approaching a decade ago), endgame tablebases were becoming very popular for chess engine play – and to my surprise, tablebases haven’t really changed much.   Tablebases represent perfect endgame knowledge as a database (loosely); the idea being that chess engines can do a lookup to see if a given position is won or lost, without having to evaluate the rest of the game.  3, 4, and 5 piece tablebases are quite common.  Size quickly becomes a factor: I believe a complete 6-piece tablebase approaches 1 TB in size.   While a 5-piece tablebase doesn’t leave a lot of material on the board (remember, 2 of those 5 pieces are each player’s king), a chess engine can probe the data with more pieces on the board to gauge the strength in a position.   For example, if there are 7 pieces on the board, and white has an opportunity to exchange a piece, it can instantly look up whether that exchange is a won or lost position. This is quite a bit different than opening knowledge.  In general, chess engines don’t play opening moves.  Authors create opening books based on grandmaster-level games and the engine or GUI automatically plays those moves.    I believe endgame knowledge is ultimately how chess will be solved – and perhaps this is an interesting area for cloud computing.   Of course, it took until 2007 for checkers to be solved, so solving chess isn’t going to happen in the near future.  Generating the endgame tablebases isn’t so much of a problem, it’s the storage – and storing this data in the cloud, opening it up via some sort of API for chess engines, would be great to see if the latency could be dealt with.  (I wish I had something more concrete to say about that with Azure as a solution!) Chess engines, the heart of a chess app, are stronger than ever.  Some of them, like Stockfish, are even open source.   10 years ago, free engines may have been weak, but today, Stockfish and others can beat many of the commercial engines.  In my next post, I’ll discuss some of the problems I perceive with one of the largest Chess software companies: ChessBase.

Internet Security Slipping?

I've noticed a disturbing trend lately and not quite sure if it's just me, or happening more in the industry.  Or, maybe it's because my credit card, for the 2nd time in less than 2 years, was compromised by someone (Visa won't tell me who -- and with today's BI, it's pretty easy to figure out I would image).  So, I'm seeing a number of sites on the internet not using SSL when capturing PII.  Clearly, this is crucial for credit card transactions, but it's also important for PII.  Of course, SSL only encrypts the traffic between you and the domain, and ensures the domain is who it says it is -- what the host does with your data is out of your hands.  It's a little like going into the kitchen at a restaurant. :)The other day I was lamenting with a colleague about my lame internet connection while we were playing around with the cool sharing features in Office Communicator.  (Bottom line was my connection chokes on camera and desktop sharing.)  The best I can do on my internet connection is, sadly, 512k upload:The chart is fairly amusing on various levels but seeing that I'm out of luck in going beyond 512k, I decide to contact customer support to see if there's anything I can do.  Heck, even 768k upload would open a lot of opportunities.But when I go to ask a question on the support page, I see this page:No SSL?   No credit card information but surely enough PII to make me feel SSL should be required here.  Now, this scenario is a bit different since I'm a customer, so I did a traceroute to see where my data was going:So, fortunately, as long as I'm sending the data from my house, it seems my data is reasonably secure as it's staying within Time Warner's domain and frankly, that's the best you can get from SSL.  I didn't submit the data, but it made me realize how many sites I've run into that don't use SSL, or access points that are insecure.  I recently permanently borrowed Glen's HTC Touch Pro, and it has built in wifi.  I left it on and as I drove around, I was completely stunned at home many times the phone would ding that a new wireless network was available -- and most were insecure.  So is this my imagination, or is security really this bad? 

DTV Transition

There's a general, unwritten rule that it's a VERY good idea to avoid blogging about anything political on a blog such as mine.  It's much to divisive, but I'm going to violate that rule this one time.For the past few years, we've been seeing information about the DTV transition coming Feb. 17th, in the form of crawls across the TV screen, cheesy commercials, and marketing.  Unfortunately, it looks like this transition is going to be put on hold until June -- something I think is a big mistake.  DTV is a fantastic step forward.  In fact, if you're looking to cut costs and save a few bucks in this economy, and you'd like to ditch your cable or satellite provider, odds are you can put up an antenna and get fantastic results, including all of the subchannels that DTV stations frequently offer.  The beauty of DTV is that, for the most part, you either get the signal or you don't -- there's virtually no middle ground (yes, it's possible for a marginal signal to experience digital dropouts -- but the classic snow and ghosting is gone).  To test this myself, the first thing I did was get a decent antenna.  After researching the net, I picked up a Channel Master 4228HD.  I wasn't sucked into the "HD" hype on the antenna label -- although DTV signals requires ATSC tuners (and really, that's where the difficulty is with this whole transition), it's same signal folks have been getting since the beginning of TV -- except, most stations are broadcasting in UHF and only a few, percentage wise, are staying in VHF.To know for sure what your situation looks like, the two best sites to visit are antennaweb.org and tvfool.com.  Both sites allow you to put in your address and see where the local stations are relative to you, and also anticipate what kind of antenna you will need to receive signals.  In my case, I decided to mount the antenna in my attic.   Attic mounting isn't as desirable as mounting outdoors, of course, but much easier and less of an eyesore and will be better (generally speaking) than set-top antennas.  I disconnected my cable feed (well, in truth I left the one hooked up for the cable modem, but that's it) and plugged the antenna into my house distribution amp.  Most antennas will require some type of amp if you'd like to drive more than one TV.   There are two types of amps -- preamps, and distribution amps.  Preamps are "in line" amps that you hook up close to the antenna, and help make up for weak signals and long cable runs.   Distribution amps split the signal a certain number of times -- 2, 4, or 8 are most common -- and instead of a passive splitter that would cause significant signal loss on each leg, the distribution amp minimizes that loss as much as possible.Part of the reason the DTV transition is delayed is because the government coupon program ran out of money.  I got in before the coupon program began waitlisting folks, but I have to say, I think they should've offered only 1 coupon per family.  While we've all been in hard times financially at one point or another (and right now is a pretty popular time), one converter per family, I feel, is fair.  If finances are so tight, TV shouldn't be a priority.  But I digress.  So, I have two TVs -- one with an ATSC tuner, and one without.  The one with the ATSC tuner, of course, can take the signal directly from the antenna.  The one without needs a converter box, so I went to my local store and used my coupon to get an Insignia converter box.  I fired it up, it scanned, and got all my channels right away -- this is a TV in my workout corner of the garage (excuse the dark border -- the converter is to the right side of TV with a blue light):The nice thing is that DTV signals are crisp, carry subchannels and program information.  Obviously this set above cannot do HD, but my other one can and the quality is actually better than cable or satellite, since those providers need to compress the signal more than OTA does.One thing to realize regarding DTV is that channels are virtual.  For example, my local Fox affiliate is channel 8, but it's really broadcasting DTV on channel 35.  An ATSC tuner handles this seamlessly and you don't really need to concern yourself with this information, except in this case, channel 8 is VHF and 35 is UHF, so it may affect what antenna you get.  (My affiliate is actually switching back to channel 8 VHF post-transition for their DTV signal.)Unfortunately, though, it looks like this transition will now be pushed back to June.  As I said above, I personally feel the delay is a mistake.  While it's certainly true that many Americans will be unprepared, I'm not quite sure a few months would make any real difference, and if anything, cause widespread confusion and chaos.  As I write this, all literature including the DTV site is saying "12 days" until the transition.  Broadcasters, in many cases, are maintaining two towers to broadcast both analog and digital until the transition, and many companies are preparing to use the new whitespace for their products.   Some other products, like wireless microphones that operate above 700MHz are in a similar transition period, since they can't (or shouldn't -- I'm not sure if it's a law or not) be used post-transition.  To make up for the added cost, the bill was amended to essentially let carriers choose if they'd like to cease analog transition post February 17.  So, some stations might stop, others might keep going.  Perhaps others will stop somewhere in between.   Top it all off is the mixed messaging consumers are seeing regarding the transition.   What a mess.Senator Rockefeller (D-WV) introduced this bill and posted the information on his website.  While some reasons are of course valid (and will be valid at any time, even in June), the one bullet point I found particularly humorous:So ... no one thought, when they picked this date way back when, that it would be winter?   Are we going to hear in the summer that there's the danger of heatstroke?   Because DTV uses the exact same signals, consumers generally won't need a new antenna, and many installed them months or years ago to prepare, or do attic installs like myself.   Tower crews face many dangers at any time, and because most/all are broadcasting both signals right now, it's not like someone needs to climb the tower on midnight of February 17.  By far, I believe the most valid reason for delaying the transition is the ability for folks to receiving emergency messaging.  However, the smartest thing to do is to have a battery or crank operated emergency radio for such things, especially the kind that can alert you when everyone is asleep.   Come to think of it, maybe we should have a coupon program for emergency radios?While everyone will have different opinions on this issue (and that's why we tech bloggers should avoid political issues to begin with), and the end of day, is TV really all that important?

My Apps

Dark Skies Astrophotography Journal Vol 1 Explore The Moon
Mars Explorer Moons of Jupiter Messier Object Explorer
Brew Finder Earthquake Explorer Venus Explorer  

My Worldmap

Month List