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

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.