Spot any errors? let me know, but Unleash your pedant politely please.

Thursday 19 December 2013

Markdown Pro and Syntax Highlighting

I've been writing some documentation for some code in markdown using Markdown Pro, but the code looked a little boring:

def func(blah):
    pass

I've used Alex Gorbatchev's Syntax Highlighter on Blogger, so I figured I could use it for these pages too.

def func(blah):
    pass

This worked quite well, and I wrote a script (thinking that I was being clever) to add the syntax highlighter code to all the HTML files in a folder hierarchy.  The only problem was that the syntax highlighting code isn't shown in the Markdown HTML view, XML inside pre tags was blank.

A couple of days ago, I started tweaking the Markdown Pro generated css to make the tables a bit nicer and colours of headings stand out a little more.  Last night, as I was dropping off to sleep, it occurred to me that I may be able to add the highlighter css and javascript to a Markdown Pro template too.  Just tried it, and it works. The template has to be re-applied to refresh after changes in order to force the javascript to run. Export to HTML is still good. It's necessary to refresh in order to save the highlighted code to PDF.


Note that the 'template' isn't the usual simple template, but all of the exported css that Markdown Pro would generate on exporting to HTML, (with <script> tags).

(The 'template' file is here if you're curious)

Monday 9 December 2013

SFTP Python Paramiko (and some of the problems I had)

I needed to rename a file on a RHEL server as part of some test automation scripts.  Hope this helps.

I used paramiko to do it with SFTP.  I pretty much copied some code from Stack Exchange to make this:

import paramiko

class SingleCommandSFTP(object):
    def __init__(self,
                 host,
                 username,
                 password,
                 port = 22):

        self.host = host
        self.username = username
        self.password = password
        self.port = port
        
        
    def _open(self):
        self.transport = paramiko.Transport((self.host,
                                             self.port))
        self.transport.connect(username = self.username,
                               password = self.password) 
        self.sftp_client = paramiko.SFTPClient.from_transport(self.transport)

        
    def _close(self):
        self.sftp_client.close()
        self.transport.close()
        
    def rename(self,
               source,
               destination):
               
        self._open()
        self.sftp_client.rename(oldpath = source,
                                newpath = destination)
        self._close()

    # Add further commands as and when required.

It only has rename, but that's all I need for now. It would probably be worth making a decorator for the _open / _close functions if many more functions were to be added, but I don't quite know how to do that (yet).

Problems (Mac):

If you try to easy_install paramiko on Mavericks, it'll probably fail because it can't compile pycrypto.  You need to install Xcode and fiddle about a bit (Found at Stack Exchange and Abakas):
  • In Xcode, go Preferences > Downloads, and click on the "Install" button next to "Command Line Tools" to install the compiler needed by Python.
  • sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
I also got this at some point: warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. Unfortunately I can't remember what I did to fix that.


Problems (Windows):

On Windows, it wasn't practical to install a suitable compiler to build pycrypto from source.  I used the 32-bit installer for Python 2.7 (downloads are here).   I had installed Python for all users, but that caused another problem solved by Stack Exchange.  I uninstalled Python an installed for the user only.

I also had to install the ECDSA cryptographic signature library as this wasn't found when importing paramiko.

Tuesday 29 October 2013

Mavericks "Mail Web Content" going to 100% CPU

If your fans are a blowin', check Activity Monitor/CPU (sorted by descending % CPU). You may see 'Mail Web Content' at the top, hogging 100%.  I've also seen two instances hogging 100% each.


Bouncing Mail doesn't always do the trick.  I've had some success with just killing the process, but YMMV.

I couldn't find any info on it from a quick Google.



My hypothesis is that it's HTML Mail rendering that's got it's knickers in a twist. When the process had been quit, the mesage I was reading was blank, but selecting another one and then coming back to the blank one ... it was rendered, and it was and HTML page.

Dunno if that helps anyone.  Maybe it's enough to know you're not alone ?

Saturday 25 May 2013

Monday 15 April 2013

1993 versus 2013

The 1993 watch function has been replaced in the 2013 version.


I don't know who made this, so unfortunately, I'm unable to add a credit.

Saturday 13 April 2013

Panic's Status Board

Panic's Status Board is fascinating. It's using an iPad for content design/layout, although HTML components could, I guess be designed anywhere and imported later. Data, I suppose can come from any networked source, and output can be via HDMI or Airplay if an Apple TV is used.


What's odd here is that when it's outputting to an HDTV via Airplay, an Apple TV is required.  The Apple TV is perfectly capable of being the client device. What I think should be happening is that the Status Board is prototyped on the iPad (or Mac), and the configuration uploaded to a Status Board app on the Apple TV, which happily runs it all day long. That's a beautiful bit of digital signage for £9.99 + £99 + £Display.

There are often vague murmurs about Apple allowing apps for the Apple TV,  it's this kind of thing from Panic that makes me want to see it happen.

Tuesday 19 March 2013

Pervert!

I watched a terrible movie on Netflix last night. It's meant to be bad though, so has a certain charm.  Badly written, mostly badly acted, poor production values, laughable special effects, juvenilia, moderate but nevertheless gratuitous nudity, misogyny, misandry, homophobia, etc.

I short, a genuine, not up its own arse B movie.  Think Inseminoid rather than Waterworld.

I'd recommend not watching it unless you're willing to embrace its deliberate awfulness.  The first frame should probably put you off...


Darrell Sandeen actually put in as credible a performance as was possible. Juliette Clark also looked as though she might be able to act, though there wasn't much call here. The rest of the cast's acting was atrocious.

Having described most of the plot to a colleague, Bobby, over lunch today,  another, John, who I'd venture is more of a movie buff, sat with us…

Me: "I've been telling Bobby about terrible film I watched last night".
John: "What was it?"
Me: "Pervert! In essence, a homage to Russ Meyer"
John: "Fantastic large breasted women in the desert?"
Bobby:"That's exactly what he said!", amazed that John worked this out from the exchange.

I think it was worth watching it just for that bit of conversation.  For the stop-motion, voodoo-cursed, detached, sentient, penis monster,  not so much.

Saturday 16 March 2013

6 Nations Champions

Great day. Wales v England, Cardiff, last day of the 6 Nations.

England 4 for 4. Wales 3 for 4.

If England win, they get the Grand Slam, Championship, Triple Crown.

If Wales win, but the margin is less than 7,  England win the Championship.

If Wales, the margin is 7, and England score 3 more tries than Wales, England win the Championship.

If Wales win by 7, and England score 2 more tries than Wales, the Championship is shared.

If Wales win by 7, and England score fewer than 2 more tries than Wales, Wales win the Championship.

If Wales win and the margin is more than 7,  Wales win and retain the Championship.

Before the game, it seemed to close to call.  This is an England that beat the All Blacks, but were lucky to scrape it against Italy.  Wales have been getting steadily better with each game, but had a shocker of a first half against Ireland.

I've been quietly excited all week. I was hoping for a win, obviously, but didn't dream of what transpired. Wales won, no, destroyed them with a record 30-3 score (They've done us by more in the past, mind you).  Watching the BBC News (in England) after the game, I couldn't resist rewinding, making a shaky recording directly form the TV screen using my phone and making this…



Marketing Bullshit

I'm not a fan of marketing bullshit.  I'm a bit of an Apple fan.  It only seems fair that I call them out on some marketing bullshit on the new Why-iPhone page.


Only iPhone has the Retina display.The Retina display on iPhone ushered in the era of super-high-resolution displays. Its pixel density is so high, your eye can’t distinguish individual pixels. The images and words are amazingly vivid and crisp. Everything just looks so real. In fact, once you see a Retina display, you’re never satisfied with anything less. Yet it remains a feature found only on iPhone and other Apple products.


Really Apple?  Isn't Retina just ppi measurement?  And for a phone, roughly more than 300ppi?  The Galaxy S3's display is 330ppi. This week's Galaxy IV's display is 440ppi.   If these aren't Retina, then Retina is Apple marketing Bullshit.


Only iPhone has Siri. Your wish is its command.
Siri, the intelligent assistant, lets you use your voice to send messages, schedule meetings, place calls, set reminders, and more. You can even ask Siri who’s winning the game. And with Eyes Free, you can use Siri to get things done in your car without taking your eyes off the road. You can speak naturally to Siri — it understands what you say, knows what you mean, and helps you do the things you do every day. All you have to do is ask.

Really Apple?  Isn't Google's equivalent widely considered to be faster and more accurate? At this stage, Siri is just Apple's trademark for voice recognition. Marketing bullshit.

Thursday 14 March 2013

Super Skinny Normal

Super Sized versus Super Skinny was on as background noise a few weeks ago. I could go on the show myself, in the Super Sized class, except that I'm fully aware that eating too much shit and doing no exercise is why I'm the size I am. I doubt that I gain anything but being shamed in my pants.

I couldn't find the episode on 4OD, but my initial reaction to the Super Skinny was that she looked rather attractive. Young, pretty, slim. I found myself wondering what she was doing on the show. She looked pretty good.

I realised that the problem is simply that unhealthily super skinny / size 0 women are the promoted media ideal. Worse still, I think if I had to identify visually the point at which a woman was worryingly thin, I think I'd get it wrong.

I was reminded of skinny woman today when reading a tweet by Caitlin Moran with this photo of a more reasonably proportioned Swedish mannequin attached:


More of this kind of thing…

It's seems likely that in medical terms, this model for American peddlars of lingerie for the larger lass Hips & Curves is obese. She's also damned sexy. Apologies if this crosses the line between aesthete and objectification. I kind of struggle with that.




Fabienne: I don't give a damn what men find attractive. It's unfortunate what we find pleasing to the touch and pleasing to the eye is seldom the same. 

Fabienne is probably right, but maybe we can consciously create a synaesthesia,  imagining how what we see might feel, and for the visuals to become more attractive at a result.

Python SOAP Request using Requests

If this helps anyone, that would be splendid…



#!/usr/bin/env python
# encoding: utf-8

import requests
from XML import XML
     
request = u"""<?xml version="1.0" encoding="utf-8"?>
              
                  
                  
                      
                          GBP
                          CHF
                      
                  
              """

encoded_request = request.encode('utf-8')

headers = {"Host": "www.webservicex.net",
           "Content-Type": "text/xml; charset=UTF-8",
           "Content-Length": len(encoded_request)}
                          
response = requests.post(url="http://www.webservicex.net/CurrencyConvertor.asmx",
                         headers = headers,
                         data = encoded_request,
                         verify=False)
                         
print unicode(XML(response.text))
    

The XML thingamy used is my own. I've just used it to format the response:



<?xml version="1.0" encoding="utf-8"?>

    
        
            1.4279
        
    



UnicodeEncodeError | UnicodeDecodeError

I've been battling with UnicodeEn/DecodeErrors today. For bloody hours.

I'd looked at soap libraries ages ago, but didn't really get anywhere with them.  I've just been using soapUI to send manually altered requests as an when to a WebMethods service.  Now that I want to do more than scratch the surface, I want to do some data driven testing.  From poking around with soapUI this week, I know soapUI can do this, but as far as I can tell, I need to Pro version, which I can't quite justify at the moment.  I'd also need to learn a lot more about soapUI, Groovy, and the intricacies of the soapUI Groovy interface.  I probably should do this.  Right now though, I can't quite face it.

More recently, I've been using some HTTP libraries to communicate successfully with the API at Project Place.  This go me thinking that I should be able to send some SOAP requests using the in-favour requests using Python.  It took a little while, but I got this working with Currency Converter, using the sample requests, host and endpoint information for the same service in soapUI.

So I'm bypassing the WSDL and hand-crafting some messages. There are probably many reasons why this is a bad idea.  I'm more interested in getting some testing done though.

Once I'd got Currency Converter working with a set of test data…


    test_data = [{u'FromCurrency':u'CHF', u'ToCurrency':u'GBP', u'Expected':0.712},
                 {u'FromCurrency':u'GBP', u'ToCurrency':u'CHF', u'Expected':1.411},
                 {u'FromCurrency':u'USD', u'ToCurrency':u'GBP', u'Expected':0.671},
                 {u'FromCurrency':u'GBP', u'ToCurrency':u'USD', u'Expected':1.493},
                 ]

Using an XML library (also shamelessly schema free) I cooked up a couple of years ago, I can modify values in the tree…

        message.replace_value_at_path(path      = u'',
                                      new_value = test_datum[u"FromCurrency"])


I moved on to the WebMethods request.  This also required basic authentication, which turned out to be fine once I'd had yet another battle with some recalcitrant proxy settings.  Gradually it seemed to be coming together.  I got it working, and tidied up the code so that it was reasonably readable to my the less code-aware colleagues. One of the refinements was to read the template/sample message from a file rather than have the message inline. At that point, I tried a second file, just to confirm that it was all working.  That's when it broke.  I'd been fairly careful to use unicode throughout, but even so, I saw this as the result of an 'é' in the second file…


  File "C:\Python27\lib\httplib.py", line 990, in _send_request
    self.endheaders(body)
  File "C:\Python27\lib\httplib.py", line 943, in endheaders
    self._send_output(message_body)
  File "C:\Python27\lib\httplib.py", line 810, in _send_output
    self.send(message_body)
  File "C:\Python27\lib\httplib.py", line 775, in send
    self.sock.sendall(str)
  File "C:\Python27\lib\socket.py", line 222, in meth
    return getattr(self._sock,name)(*args)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 143-149: ordinal not in range(
128)


I can't find the page that solved this for me.  It took a fair bit of trawling through many Stack Overflow questions and answers to discover that I needed to do one small thing: encode as UTF8 on output.

      soap_request = soap_request.encode('utf-8')

Testing this on my Mac seemed to confirm that all was well - though the service wasn't available.  Testing on a Windows client that did have access to the service threw up this gem…


  File "/usr/local/lib/python2.7/httplib.py", line 946, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/lib/python2.7/httplib.py", line 987, in _send_request
    self.endheaders(body)
  File "/usr/local/lib/python2.7/httplib.py", line 940, in endheaders
    self._send_output(message_body)
  File "/usr/local/lib/python2.7/httplib.py", line 801, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 484: ordinal not in range(128)


I spent a lot of time on this, including a bit of a wild goose chase with repr as a result of this comment.  I briefly thought I'd got it working, but instead of 'é', I saw '\xe9'.  At breaking point, I though I'd add a comment to the bug report in case one of the requests guys could help.  And it was in writing that comment that I finally found the answer.  I'd written this…

I'm also having trouble with this. It's fine on Mac (2.7.2), but not working on Windows (
At which point I checked the version on Windows. It was 2.7 dated 2010-07-04.  I thought that looked a bit old, so I installed latest Python version (2.7.3 2012-04-10) and the problem disappeared. It's a shame that I wasted so many hours trying to get it to work.

With all the fiddling, I managed to break some code.  I'm not using a proper repository, but Dropbox came to the rescue.  I made a copy of the current file, restored last night's version and managed to get it all working.

Now where I had '\xe9', I now have 'é', and I'm in a position to demo it to some colleagues tomorrow.

Thursday 28 February 2013

Tarantino's Movie Picks on Netflix

No. It doesn't exist, but it's certainly something I'd like to see.  Not just Tarantino, of course, but other directors, critics. del Toro, Ebert, the Cohens, The Good Doctor Kermode etc.

This idea starts, with my wife.  On a spare evening with nothing on TV, not even a Come Dine With Me. we turned to Netflix.  We don't watch that many films together, having quite different taste, which, sadly, are pretty much gender stereotypical.

I was agonising over which film to watch in much the same way as I used as a customer to in a video rental shop.  Scanning all the titles on all the files. Picking some boxes, comparing, returning some, picking others. For ages. It was pretty annoying for my wife, who eventually said, "Oh, just pick one, if it's rubbish, we'll just watch something else". So we watched Bottle Shock. It was both a perfectly acceptable film, and one that I wouldn't have picked from a shelf.

The same thing happened last weekend. We watched Salmon Fishing in the Yemen on the basis that "It's got Euan McGregor in it. Again, it was perfectly acceptable entertainment for a lazy Sunday evening and there was no pressure to invest much time in it if it didn't look watchable.

If I'm not choosing a movie like a customer, maybe this new just play it and see method is more like choosing a movie like a video store clerk. Probably the most famous example is Tarantino, so it seems like a few recommendations from him would be pretty cool.

Wednesday 27 February 2013

Requests revisited.

Further to not so stupid after all, the pain of oauth just keeps giving.  I basically got a bunch of stuff working with Requests that was previously working with the old libraries, but in a simpler way.  On that foundation, I tried to once again upload a file to Project Place.

No joy. The request was badly signed. Same problem as before.

I Googled. I searched the Requests issues log etc, but there wasn't much information.

So I contacted the developer at Project Place to explain my problem.  The initial response was the same as before, that I only need to sign the headers, not the body of the HTTP request.   The problem remained that I wasn't in control of that stuff. I was using a library to do it all for me.  I could get an Oauth object by supplying some parameters to something I didn't fully understand and I could send a (GET) request by a url and supplying a nice dictionary of parameters to something else I didn't fully understand.

Jon at Project Place then very kindly sent me some client code that used the Request library to upload a file successfully to Project Place. Now that I had some working code in front of me, I could try to figure it out and then try to figure out where Requests was going wrong. I could see how Jon's code signed the request headers before adding the body - there's no way to specify this in Requests.  I found the Requests code that does the signing. Now one of the issues made a bit more sense. I took a local copy and did a little tweaking, and things seemed to be much better.

While it works, it's not really the correct fix. The problem is (apparently) in requests-oauthlib, but I don't have the knowledge required to fix it.

I didn't think a local copy of Requests was really a long term solution, so today I started to refactor in order to use Jon's code.  It took a while to get anything working at all due Jon's code's handling of parameters: it doesn't (at least not for GET or PUT).  Fortunately he'd commented really well, and once I'd RTFMed, I could see I needed to first add them to the URL - the kind of inconvenience I was hoping to avoid by using Requests.

WAY too much effort went into this line:

url = unicode('%s?%s'%(request,urlencode(params)))

It appears to be working now, with a standard Requests library, plus Jon's code.  It's a just a lot more untidy than I'd hoped for :(

Tuesday 26 February 2013

An Impression of Hanson

A friend, Paola, has been sharing quite few pictures of Hanson on Facebook. Like this:



I wasn't sure if it was real enthusiasm or Facebook doing automated sharing after a single share in a similar way to likes of products show up repeatedly and long after the initial like. Facebook can be creepy like that.

Turns out it wasn't Facebook at all. It was Paola actively sharing her love of this band. As a recovering cynic, this kind of enthusiasm is starting to appeal to me.

You may have no knowledge of Hanson, or just one reference, like me:



I never had any interest in the band back then and probably dismissed it as a good but irrelevant pop song with "at least they pay their own instruments" thrown in. My wife goes a bit nuts singing along to Mmmbop if it's ever on the radio or played at a wedding. It makes her happy, and so it's grown on me over the years.

Paola played a selection of songs for me.  These are just my initial impressions, which could be different on another day:

All This Love Crap - Heavy Led Zeppelin influence. No complaints from me. I'd happily sing along with this in the car.

Zombie - Feels like a homage to Thriller, but I couldn't get beyond the fake synth horns, which are unfortunately a pet hate of mine. Fingernails meet blackboard. This isn't necessarily a criticism of the song.

No Sleep For Banditos - I'm getting a hint of Chilli Peppers on a good day, but also lots of other aromas that I can't quite place.  This is definitely my favourite track. Inscrutable. The drums are oddly simple and I find myself listening to them at the expense of the rest of the song.  I'm certainly not against simplicity. I smile if I see a kit that's just a kickdrum, snare, and hi-hat (like here). Somehow they feel like a beginner playing rather than an accomplished musician.  I think it must the mix/live recording, or in some other way, they're wrong for the track.

A Sunny Day / Cecelia - Cecelia is always going to win with me.

Sonny Get Your Gun - reminiscent me of Bon Jovi circa Wanted:Dead or Alive. It's the kind of track that. if I wasn't paying attention, I might listen to most of the way through until I realised it was annoying me. I don't particularly like it, but it's just preference.

Fire on the Mountain - Reminds me of Extreme or Mr Big doing acoustic stuff. I don't mind this kind of thing in small amounts. It fortunately doesn't stray over the line into shitty Aerosmithery.

It seems unlikely that I'll ever be a Hanson fan, but there are 2 out of 5 songs here that I'd happily listen to.  If there was a convenient and not too expensive gig, I could see myself buying tickets and taking my wife. She doesn't really like the same music as me, but I think there would be some common ground here. It'd be half a joke, a bit of a novelty maybe. Without Paola enthusiasm, they'd be completely off the radar. Novel isn't enough though. Without listening to a few songs and liking enough of them, going to see them would be incomprehensible.  Some bands I like live, but almost never listen to their records. I suspect that Hanson could fall into that category.

It's important to remember that opinions of music are mostly subjective. People like what they like. There's almost no bad music. This exchange pretty much sums it up:


I have to remember this when I can't get my head around anyone listening to Coldplay when they could be immersed in Radiohead instead.  And to avoid knee-jerk reactions to Girls Aloud or Wand Erection.


Thursday 21 February 2013

Please sort it out, Sony (by which I mean Sony Consumer Electronics)


First of all, there's lots of Sony gear in my house. About as much Sony gear as Apple gear. Roughly: 5 TVs; PS2; PS3; 3xDVD players; DSLR. It's fair to say that I like Sony gear.

Today, I happened to see the box for a Sony Blu-Ray player.  I didn't go browsing for it on Amazon or Play. I didn't see the model on display in a shop. It didn't see it in an email circular.  I saw the physical box.

This is not something that normally happens. The other stuff does, but usually the box is about the last thing you see, briefly, before it's thrown away and long after a buying decision is made.

The significance of this is that the box was a better advertisment for the product than anything else I've seen, which means all the other advertising is rubbish. I'm not really in the market for a blu-ray player. My son's PS3 will play them, but I've never bought a blu-ray disc. I couldn't be bothered to pay more when I bought DVDs, and now that I've subscribed to Netflix, physical media for movies just seems plain odd to me.  A Blu-Ray player is perfectly fine for playing all those old DVDs, but it'd need some additional features to make it interesting…

Back to the box. In nice big clear icons and logos is a list of key features of device. Other than the usual, what catches my eye is a Netflix logo and a Lovefilm logo. Interesting.

Currently my daughter can access Netflix via her Wii. She doesn't have a connected TV. My son can access via his PS3. His TV is connected, but he has a PS3, so it may as well not be. The TV in the master bedroom is the same as my son's. We have a DVD player hooked up with SCART and can watch iPlayer via the TV and WiFi. We don't have access to Netflix from that TV.  The living room TV is smart, but doesn't have WiFi (which is another story). We have a V+ box for iPlayer, 4OD etc, and an AppleTV for music and Netflix (but not Lovefilm).

The fifth TV, and AppleTV, live at my mid-week digs (I commute weekly to work).

We can disconnect the Apple TV and move it to the bedroom, but almost never do.

The ideal, pie-in-the-sky solution would be a firmware upgrade from Sony to add Netflix to the TV.  I suspect that there's no incentive for Sony to do that though other than making people think that Sony products and customer support are the freakin' awesomes.

An actual solution would be to replace the DVD player with the WiFi version of the one I saw (link). It's £30 extra, which is a bit steep, but possibly worth it for the symbolic removal of one more hated SCART cable from the house.

When I was looking for the WiFi enabled version, given the lack of Netflix support on many Sony devices, I wanted to check this feature.  From the Sony website, it's impossible to find out. The product page simply does not mention Netflix or Lovefilm.  Search the site for Netflix, and these players simple don't show up in the results.

Amazon pages weren't much better. Either finding the devices in results for netflix players or the using the specific device product codes.  If searching the pages for Netflix, even with additional information open, it's not until you hit the user reviews that there's any clue.

Honestly, if I hadn't seen the box - and most people won't see the box - I'd be utterly clueless that this product existed.

I can approach this from another angle. From the 'Ways to Watch' page at Netflix https://signup.netflix.com/Watch. This tells me that I can watch via PS3, Sony Blue-Ray players and smart TVs. For BR Player and TV, it's just a link to the Sony site, which is pretty much a dead end. If you manage to navigate to http://www.sony.co.uk/hub/internet-tv/entertainment-on-demand, there's no mention of Netflix (the LoveFilm logo is shown).  Note that there's no link to Sony streaming players because neither of them currently support Netflix (according to reviews).

Note: Can't currently add screenshots from Sony Site because, and I shit ye not:



If I click on the Western Digital link from Netflix, I immediately see a product shot and a Netflix logo: http://www.wdc.com/en/products/products.aspx?id=330, there's a link to a logo grid of actual services I can get on the device. Lovefilm isn't there, but I'm confident that this isn't ano oversight, it's not available on the WDTV yet.  Netflix and iPlayer have a 'new for UK' banner, which also suggests that the device is getting active updates. I wouldn't be surprised to see Lovefilm listed in the near future.



Roku gets it right too:


Phillips isn't great, but much better than Sony. The landing page from Netflix is to the streaming players, but only one of them appears to be Netflix capable. On the plus side, this is mentioned in a bullet point on that page, and when opening the device page, there are a couple of Netflix logos to make it clear that it's supported. (Also no Lovefilm here).



Then there's Apple. The landing page is http://www.apple.com/uk/, but should probably be http://www.apple.com/uk/appletv/. There's no obvious way to find the Apple TV device from the front page. You can get to it through the iPod link, but that makes little sense. If you search for 'Netflix' or 'TV' or 'Movies', however, you'll find a link.


Once on the right page, there's immediately a Netflix logo on the picture of the TV and Netflix is mentioned in the HD Content box.  Further, if you click on 'What's on Apple TV', again the Netflix logo is prominent in a grid (not unlike the Sony BR Player's box). Clicking on the logo jumps the a dedicated Netflix portion of the page, though there's no link back to Netflix to sign up for some reason.


I've no idea what the boxes for Phillips, Roku and WD are like, but I do know what the Apple TV box looks like. It's just some pictures of the product and the minimum amount of legalese required. It's not advertising what it can do, because if you're buying it, you've already figured that out.

Sony needs to change its website. The approach should prioritise actual features that people give a shit about, like Netflix, over marketing bullshit such as "See shows in every shade of colour - With Triluminos Colour you’ll enjoy brilliant images and a wide range of colours which add depth to any scene".

'Triluminous' doesn't even seem to be a feature of the device, it's something* to do with LCD TVs that you don't care about. It may be that you need a triluminous aware player to get your triluminous enabled TV to do triluminous things, but if you're buying a Netflix player because your current TV or slightly dumb smart TV doesn't do Netflix, you'll be trilouminless .

If the website's difficult to manage for some reason, that may point to a larger problem. If it would be impossible to simplify the website with the current range of products, that probably points to a deeper issue.

I really, really want Sony to survive, reinvent and then thrive. I think they can do it, but not without a fundamental re-think. Firstly, make considered, truly designed, great products rather than just making everything and seeing what sticks. Then market the hell out of them without resorting to bullshit.

Tuesday 19 February 2013

easy_install or pip through proxy

I was having trouble using easy_install and pip on the company netork. Turns out that I needed to configure an HTTP_PROXY environment variable.

HTTP_PROXY=username:password@host:port

Source: http://kaamka.blogspot.co.uk/2009/06/httpproxy-environment-variable.html

I was trying to get around this initially by downloading the source packages, but the setup.py for one of them itself seems to use pip to get another dependency.

Monday 18 February 2013

Cynicism Fail

Yesterday, my daughter and I watched a slightly bizarre documentary call 'We Are Wizards'. It's a poorly made film that documents a small number of creative Harry Potter fans. There are a couple of bands featured - 'Harry and the Potters' and 'Draco and the Malfoys'. The former are a couple of nerdy teen brothers who reminded me a little of Napoleon Dynamite or Jedward. The latter seem a bit more self aware and are having fun being a bit silly.

It's tempting to laugh at 'Harry and the Potters'. It's also a bit too easy to do that. I checked the movie on IMDB. Finding that it was about 5 years old, I wanted to find out if they were still a band and whether they'd improved.

This is what I found:

Musically it's pretty mediocre, which is a considerable improvement, but that's not important. Don't listen to this critically, watch and understand what's going on here.

These are Harry Potter fans singing a song at Leakycon, a Harry Potter convention. The song, Luna Luna, is basically Louie Louie. It's about the character Luna Lovegood. Now get this… on stage with them is Evanna Lynch, the young actress who plays Luna in the movies. She's buzzing. The band is buzzing. The audience, which must number at least several hundred, is buzzing.

These kids must've endured a fair bit of ridicule from their cooler peers for doing what they do. By simply ignoring that and just getting on with what they love doing, they've experienced something wonderful and will always have the memory of that.

While I could easily laugh at them, in truth I'm a little envious of just how much fun they're having at this gig. It's something I've experienced in an audience, but never as a musician. I probably worry far too much about how other people are going to react.

Thursday 31 January 2013

A regular thing


My father accidentally clicked on a column header.

Call:
Hi Aitch,
  sorry to be a dickhead but my email is just listing all
previous emails in order of who sent them, as an example
all emails you have sent in order or all emails from Allan etc.
How do I reset everything?
You will have to text me as what to do, cheers pal.
Resolution:


Wednesday 30 January 2013

Cheap WiFi for Wired-only Smart TV

Sony WiFi dongle for smart TV : £79.98

The Smart aspect of my TV isn't worth this. I wonder if there's a cheaper alternative?


Enter the TP-Link Nano Router : £16.78

The router is USB powered (micro-USB).

I configured the router to extend my WiFi, which meant it's one Ethernet port acts like a LAN port on the network.  Using the supplied cables, it takes juice from the TV and connects via ethernet.  The TV sees the network, gets an address etc. A quick test of iPlayer confirms it's all hunky-dory.

A bit of velcro would secure this to the back of the TV with no problem (Though I'd want to test Rx in that position  in case the TV was shielding the signal.

This doesn't fix the problem of all smart TVs being a bit crap at being smart. The Sony TV doesn't do Netflix in the UK even though US models apparently do, as does the PS3.

It does do Love Film though, which my Apple TV does not.  If I want to switch from Netflix, I have that option.

For now it's not plugged in.  I just wanted to see if it'd work.  This little router goes in the box of useful things in case I want to temporarily hook up a wired only device to the network.

The only problem I could see is that it could slow the entire network down having multiple access points too close to each other.  I think that there's probably a market for a USB WiFi dongle that also has a LAN port, but that is just a device on the network rather than an access point.


Not so stupid after all

Further to Sometimes I Feel Stupid and Still feeling a bit stupid, a small victory has been made in using requests with the ProjectPlace API.  I still have to make some significant changes, but main hurdle of actually getting a response has been, er, hurdled.

Nothing clever on my part at all, other then patience, the work of others and a tiny epiphany.  Where by 'epiphany', I mean to say I used my noodle briefly.

Having noticed that Requests was up to 1.1.0, I installed this new version…

$ sudo pip install requests --upgrade

This didn't work.  Fortunately though, I'd logged the errors I was getting in the previous posts. The error has regressed. I took a look at the documentation for Oauth, which reminded me that the Oauth gubbins that requests uses had been split out to requests-oauthlib.

I done another pip [sic]…

$ sudo pip install requests-oauthlib --upgrade

This time I got ValueError, which was new…

Traceback (most recent call last):
  File "/Users/bob/Dropbox/Coding/Python/ProjectPlace (requests)/requests_test.py", line 26, in 
    r = requests.get(u'https://api.projectplace.com/1/user/me/profile.json', auth=auth)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/sessions.py", line 276, in request
    prep = req.prepare()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 227, in prepare
    p.prepare_auth(self.auth)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/models.py", line 400, in prepare_auth
    r = auth(self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests_oauthlib/core.py", line 53, in __call__
    unicode(r.url), unicode(r.method), None, r.headers)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauthlib/oauth1/rfc5849/__init__.py", line 228, in sign
    raise ValueError('Body signatures may only be used with form-urlencoded content')
ValueError: Body signatures may only be used with form-urlencoded content

Had I been paying attention, there was a pretty big clue at the end…

ValueError: Body signatures may only be used with form-urlencoded content

I wasn't paying attention though, so I added an exception handler to ensure that I would run through all signature types. and to get a bit more information. This wasn't a complete waste of time…

Running this code…

import requests
from requests_oauthlib import OAuth1


#Hywel:
consumer_key        = "That"
consumer_secret     = "would"
access_token_key    = "be"
access_token_secret = "telling"

for signature_type in ('auth_header','body','query'):
    auth = OAuth1(client_key            = consumer_key,
                  client_secret         = consumer_secret,
                  resource_owner_key    = access_token_key,
                  resource_owner_secret = access_token_secret,
                  signature_type        = signature_type)
    try:
       r = requests.get(u'https://api.projectplace.com/1/user/me/profile.json', auth=auth)
    except ValueError,e:
       print 'Exception for %s:%s'%(signature_type,e)
       print
    else:
        print 'No Exception for %s'%signature_type
           
    print signature_type
    print r.encoding
    print r.text
    print r.json


Gave me these very useful results…


No Exception for auth_header
auth_header
None
{"province": "", "city": "", "first_name": "Hywel", "last_name": "Thomas", "address2": "", "home_phone": "", "language": "english", "title": "Software Tester", "work_phone": "", "address1": "", "description": "", "id": that, "email": "would", "mobile_phone": "+be", "avatar": "/images/00/1f/34/da6c-a6d5a995.jpeg", "country_code": "GB", "organisation_homepage": "", "sort_name": "Thomas, Hywel", "homepage": "", "organisation_name": "Telling", "zip_code": ""}
[bound method Response.json of [Response [200]]


Exception for body:Body signatures may only be used with form-urlencoded content

body
None
{"province": "", "city": "", "first_name": "Hywel", "last_name": "Thomas", "address2": "", "home_phone": "", "language": "english", "title": "Software Tester", "work_phone": "", "address1": "", "description": "", "id": that, "email": "would", "mobile_phone": "+be", "avatar": "/images/00/1f/34/da6c-a6d5a995.jpeg", "country_code": "GB", "organisation_homepage": "", "sort_name": "Thomas, Hywel", "homepage": "", "organisation_name": "Telling", "zip_code": ""}
[bound method Response.json of [Response [200]]


No Exception for query
query
None
{"province": "", "city": "", "first_name": "Hywel", "last_name": "Thomas", "address2": "", "home_phone": "", "language": "english", "title": "Software Tester", "work_phone": "", "address1": "", "description": "", "id": that, "email": "would", "mobile_phone": "+be", "avatar": "/images/00/1f/34/da6c-a6d5a995.jpeg", "country_code": "GB", "organisation_homepage": "", "sort_name": "Thomas, Hywel", "homepage": "", "organisation_name": "Telling", "zip_code": ""}
[bound method Response.json of [Response [200]]

I don't fully understand what Body signatures may only be used with form-urlencoded content means at the moment, but I kind of don't care. I think I just need to know that with the latest versions of requests and requests-oauthlib installed and a signature_type of 'auth_header' or 'query', I should be good to go.

Tuesday 29 January 2013

An incoherent ramble about Apple's prices.

I've pretty much always been an Apple fan.  I first saw one in 1985 as a schoolboy at a trade fair in Cardiff. I was instantly captivated.  I used them at college 87-89 for writing.  I used them for a few years at work, probably 1995-1998, for writing, accessing a defect database in Filemaker, as a client to some DEC VMS boxes somewhere in a basement.

In 2000, with some Y2K double-time, I got a G4, and have only used other systems when strictly necessary - which is becoming less and less frequent.

The main problem I have with Apple, really, is pricing. The prices of machines and options defy simple logic. That's not how Apple rolls. I guess Apple figures out what it can get away with asking to maximise profit.

Today's announcement of a 128GB iPad is summed up by Richard Gaywood:
The iPad 16 GB costs $499. Then it's +$100 for another 16 GB. Then +$100 for another 32 GB. Then +$100 for the last 64 GB. That's weird.
I got myself unnecessarily worked up recently when considering a new home desktop machine and trying to figure out the best compromise.  The problem is that the best compromise is at least a bit shit, and no compromise is expensive.

The solution was to not buy a new machine at all, but to repurpose my wife's 13" MacBook Pro (broken optical drive, mostly broken display). I put an SSD in where the optical drive was, stuck it in a Henge Dock and hooked it up to a £100 LG 22" IPS 1920x1080 display.  The display can take VGA, DVI and HDMI. I'm using the HDMI for a Raspberry Pi.

The internal drive is 160GB, the SSD is 80GB and there's a 1TB Lacie hooked up for doing iMovie and as a Time Machine (I gave up trying to use the Drobo FS as a Time Machine drive - it's just too slow).

Why didn't I buy a new machine? Because I couldn't configure the one I wanted without paying for stuff I didn't want. Below is the kind of thought process I'm going through while checking the online Apple store…

If you look at the mini, there are two machines. a 2.5GHz i5 dual core at £499 and a 2.3GHz i7 quad core at £679.  . Most of the time, those extra cores are going to be idle, so I opt to save £180. The BTO options on the i5 machine are RAM or RAM. But I'd get that from Crucial anyway. 16GB from Apple is £240; 16GB from Crucial is under £67.19. The RAM is accessible and easy to replace. (Even this amount of tinkering isn't for everyone)

We all know that these days, SSD is where it's at. There's no SSD option for the £499 machine. Replacing the hard drive in a Mac mini is possible, but requires spudgers and tweezers and is not what you want to do with a brand new machine.

So £679 and £67.19 is the starting price. What are my other options?  I can bump from 2.3GHz to 2.6GHz for £80. Not interested. The RAM is already covered … what's left?  I can upgrade to a 1TB 'Fusion' drive for £200 or get a 256GB SSD for £240.  The SSD is expensive (Comparable would be £150 from Crucial), but the extra £90 is probably worth it to avoid the hassle of fitting and voiding the warranty

. I'd like some space though, so I'd opt for the 'Fusion' drive. What this adds is a 128GB SSD that the OS intelligently uses as a sort of cache for commonly accessed filed. The idea is that you get the speed of SSD with the capacity of a spinning disk.  For comparison, a 128GB SSD from Crucial would be £79.19, so there's a bit of a mark up. It's a different form factor though, and perhaps not a fair comparison. It seems likely that this adds at least £100 of profit to Apple.

There's no option for a 2TB or 3TB drive because it's a 2.5" drive.

A machine with a reasonable compromise is an unreasonable £950 (RAM from Crucial).  The machine with the compromises I'd like would be about £770 (Dual code i5, 1TB Fusion, 16GB from Crucial).


On to the iMacs…

The main choice appears to be screen size with two 21.5" models (1920x1080) and two 27"(2560x1440).

21.5"…

The low end one has two options: RAM (£160) and Fusion (£200).  Neither can be upgraded easily by a user. Not getting the Fusion drive seems like madness. I'd get the RAM too. That's £1459 (up from the base price of £1099.

The 'high end' one doesn't really have significant additional options. It just has a slightly better GPU (up to 30%), a faster CPU (2.9GHz vs 2.7GHz) and the option of an even faster CPU (3.1GHz i7).  I'd much prefer to see one 21.5" here with the higher GPU and just a choice of 2.7GHz i5 and 3.1GHZ i7. Where there's some confusion over specs, it probably doesn't really matter, so it'd be better to offer the same.

There's no option for a 3TB drive because it's a 2.5" drive.

27"…

Things don't get much simpler here. Low-end is £1499, high-end is £1699. There are two models that are differentiated by speed of CPU in bold and speed and capacity of GPU, of secondary importance judging by the emphasis on the store's pages. Honestly, I don't give a toss about 3.2GHz i5 vs 2.9GHz i5, so really it's £200 for about a 30% GPU improvement.  Upping the CPU to a 3.4GHZ i7 is only available on the high-end model.

Fortunately, the RAM is user-upgradable on the 27". Increasing to 16GB is £34 (from Crucial versus £160 from Apple). Increasing to 24GB is £67.19 (not an option from Apple), increasing to 32GB is £135 (vs £480).

The user-upgradable RAM in the 27" makes it much more interesting. It means that there's no pressure to get it now.  I'd probably be happy with an 8GB machine with a Fusion drive. That's £1699 (or £1734 if you add the RAM) for a 27" versus £1459 for the 21". That's £275 for the bigger display, a significantly better GPU and an insignificantly faster CPU and room to add loads more memory later).

Or going back to the mini…

It looks like a 27" 2560x1440 display is going to be pretty expensive.

2.3GHz i7, 1TB Fusion, keyboard, mouse/trackpad = £978
16GB Crucial RAM = £67.19
21.5" IPS Monitor = £105

Total = £1151.

One benefit of the mini is that it has separate audio in and out sockets. The iMac has one that's combined.  I guess audio users should be using USB, but my audio-gear is older than that.

Monday 28 January 2013

Anonymous Following

Much is written about unfollowing. Most recently, the splendid The Unfollower from Matt Gemmell. It's not particularly relevant to me. I have much more modest following made up of friends, some reciprocal followers, some strangers, some passive robots.

Active robots get reported for spam.

I'm not a superstar famous, like a Stephen Fry. I'm no national treasure, like a Clare Balding. I'm not popular, like a Caitlin Moran. I'm not well-known in a particular niche, like a Matt Gemmell.

Reciprocal followers are people who have followed me as a result of me following them. I find that slightly puzzling.

Of the strangers than aren't passive robots.  I don't know why most of the strangers than aren't passive robots are following me, but I'd quite like to. In some cases that I'd otherwise ignore, I'd probably want to reciprocate.

The information I'd like is "@daycoder Hi I've just followed you because you're in lots of conversations with @friend_a and @friend_b." or "@daycoder Hi! I saw you were friends with @friend_c and remembered you from school".

People with thousands of followers probably wouldn't want this information. It'd just add to the noise. This is just a nice-to-have for us mortals.