Samsung TV Emulator 3.0 - Where text files are stored

Part of Samsung's Smart TV SDK device API is the FileSystem object which is a facility for reading and writing text files to the TV's local store.  

Typically you don't need to know where these files are stored, however when developing an app is is necessary to be able to inspect and delete these files as a normal part of development & testing.

With the release of the 3.0 Smart TV SDK, Samsung has made some changes to the storage location of text files created by when running apps in the Emulator. 

Whilst previously stored with the Emulator, files created with FileSystem are now found here:

C:\Users\You\AppData\Local\VirtualStore\Program Files (x86)\Samsung\TV_3.0.0\Emulator\Emulator2011_v2.5\common

Matchmaking - jQuery and Samsung Smart TV

Some Background

Samsung's Smart TV environment supports apps built using web technologies (html/css/javascript). It also has a proprietary browser based on Gecko called Maple.

The nice thing is that the browser supports cross site scripting (XSS) so you can easily pull data from any web service into your Samsung app running on a TV.

jQuery, Well Mostly

Samsung were also nice enough to include jQuery as a pre-installed library within the environment. Some slightly wierd syntax triggers a script to be loaded from the app's runtime environment rather than the app's own files:

<script type='text/javascript' src='$MANAGER_WIDGET/Common/jquery.js'></script>

This is all well and good, but it turns out that this version of jQuery, 1.4.2, is a little out-of-date.  If you want to take advantage of bug fixes and performance improvements a later version of jQuery should be used.

This was great, except that when I started using jQuery 1.7.1, all my $.ajax calls stopped working - in fact they were throwing a cryptic error with jqXHR.status = 0.

XSS Pitfalls and Rescues

Because XSS is supported by Samsung's embedded browser, it too me a while to identify that this was the source of the problem.  However in this case jQuery was the culprit rather that browser security.

It turns out that as of jQuery 1.5, jQuery's ajax module itself blocks XSS, irrespective of what the browser supports.

Luckily the solution is simple.  Just add the following to be called when the app loads:

 $.support.cors = true;

Disk burning...the command-line way

Today I needed to burn an iso image to a dvd.  Now that I am using Linux again, I wondered what the command-line way to do this would be.

One solution is to use wodim with a command like:

wodim dev=/dev/cdrw -v -data cd_image.iso

For a more complete run-down of how to do this and other useful tasks like creating an iso, check out this ubuntu help article: https://help.ubuntu.com/community/CdDvd/Burning

Ubuntu 11.10 goes Hollywood

Out of the box, my unbutu 11.10 install wouldn't play DVDs (the movie kind, that is).  Well, the remedy to make 11.10 fall in love with Hollywood is to instal libdvd...from the terminal of course:

wget -c http://packages.medibuntu.org/pool/free/libd/libdvdcss/libdvdcss2_1.2.9-2medibuntu4_amd64.deb

sudo dpkg -i libdvdcss2_1.2.9-2medibuntu4_amd64.deb

 

 

Et voila.

JavaScript Juju: Controlling console output

I'm busy writing some jQuery plugins that will run in a proprietary (non-standard) browser environment.

There is support for writing log messages to a console but this is done via the alert() function rather than using a console object found in many of today's modern browsers.

A common pattern to handle these environment differences is to provide an alias to the environment-specific logging mechanism.  However when doing this, for Google Chrome you have to make sure that console methods are executed with a reference to a console instance and not an instance of window (else you will see Uncaught Type Error: Illegal Invocation).

The solution (picked up from StackOverflow) is to simply pass an instance of console to the method invocation like so:

var print = function() { 
    return console.log.apply(console, arguments); 
};

 

 

24 Hours back with Windows

I'm no Mac fan-boy but I've only been using apple machines over the last year with no real need to go back to Microsoft Windows...until now.  I've started a project where the development tools are all based on MS Visual Studio; so like it or not I'm back using Windows.  

Unfortunately the first 24 hours have been less than smooth.  Here is a list of things that have happened:

  • Side-By-Side Configuration Errors.  Having installed the necessary development tools (which were fine on Windows XP), opening the tools on a fresh install of Windows 7 resulted in an unhelpful error message that my 'side-by-side' configuration was incorrect.  It took a little hunting to find that this is basically Windows 7 speak for dll-hell, i.e. some dlls were missing or of an incorrect version. Resolution involved some nastiness with copying dlls and an xml manifest file.
  • Chrome Page Crashes. Chrome was pretty solid on OSX but already I have had several page crashes under Windows.  Luckily Chrome is kind enough not to lead that into a program crash.  Still, it isn't something I expected to see.
  • Skype Crashes.  Again, Skype on OSX was fine (albeit somewhat unintuitive).  Unfortunately I've already had a crash and worse still it required me to kill some orphan process in task manager before Skype would start again.
  • BSOD. I saved the best for last...just before writing this post I had a Blue Screen of Death. To be honest, I haven't seen one of those before with Windows 7, so perhaps it is a bad omen that it has already happened during my first 24 hours back with the os...

Nevertheless, one has to roll with the punches.  At least I'm not using Windows Vista!

Dial-up Dinosaurs

I don't download software from Microsoft very much any more, however last night I was fighting with some DLL issues in a VM running on my Mac.

I remember when I first spent time in the Microsoft playground writing olde VB and ASP applications.  Back then, it wasn't unreasonable to expect users to be accessing the internet via a dial-up modem.

Microsoft-download

So I was more than a little surprised to see the Microsoft download pages still, as default, calculated an estimated download time based on a dial-up 56K modem. 

I'd really love to know how many people download anything from them using such a retro connection type.  Actually, I would even expect a lot of people have never heard the little chirp of a modem as it goes through it's handshaking process.

Hello Homebrew

Installing some development tools and libraries on a Mac can be a pain. (In particular, I'm thinking of the woes of installing MySQL as I write this!)

So I was pleased to come across Homebrew when installing MongoDB.  Homebrew installs with a one-liner ruby script, but it is recommended that Fink and MacPorts are uninstalled first.

So to uninstall Fink it is simply enough to remove the /sw directory (sudo rm -rf /sw).  For MacPorts there is a little more cleaning to be done.  Firstly installed ports can be uninstalled by executing sudo port -f uninstall installed.

Then the following directories need removing by running:

sudo rm -rf \
/opt/local \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \
/Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \
/Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0 \
~/.macports

Done.