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

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.