My First 2012

Inspired by @bearwithclaws‘ and @cheeaun‘s own posts, I thought I should sit down and reflect on 2012.

This year has seen a number of firsts for me:

  • Quit my job and founded a company!
  • Pair programmed with @kamal, @bearwithclaws, and very briefly @sengming — a tremendous learning experience for me in Rails, JavaScript, and CSS. Between them, they’ve helped redefine how I think as a developer.
  • Learnt Ruby, and Ruby on Rails.
  • Attended Red Dot Ruby Conf for the first time. This was really fun thanks to the guys at SAYS, Aaron Chipper, and of course, the regular crew from Fluent Space and WCKL :)
  • Vacationed overseas for the first time (despite having travelled internationally dozens of times for work) at Sri Panwa in Thailand.

It’s been a good year, all things considered. I think a lot of it had to do with my actively spending time slowing life down, stopping to smell the metaphorical roses if you will.

Here’s to 2013, and new beginnings.

P.S.: @kamal I still remember the way you used to grip that glass of water oh so firmly during those first few days when I stumbling around in Ruby :)

Shockingly Good Facebook Virus/Trojan Attack Attempt

So this morning a friend of mine sent me a bunch of messages on facebook, claiming that I was caught doing some funny stuff on video (entirely possible really):

By now I was suspicious, cause Amin doesn’t actually type messages out like a teenage girl (for the most part). So I clicked the link, and found this page next:

This is brilliant! A message that you need to update your Flash Player, very common for new installs of Windows. What makes it more convincing is the comments list — people from my Friends List, and that of the original victim appear to be egging me on to download the Flash Update and install it!

I suspect I’m going to be getting an increased number of desperate please for help within the next few days from people who worry if their antics have been caught on video, and as a result upgraded their Flash Player. Sigh.

UPDATE: Thanks to Sophie Hamilton, I have more info on it at Malware City.

Building a SOAP Server with Zend_Soap_Server and Returning Arrays of ComplexTypes

ZendFramework is awesome but suffers from a peculiar lack of thorough examples and documentation.

To save you all some time scouring the internet fruitlessly, I will document how to use Zend_Soap_Server, and Zend_Soap_AutoDiscover in combination with Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex (try saying that really fast a few times!).

A Complete Example

No one ever put together a full example in the documentation, their blog posts, the official Zend samples or anywhere else I searched yesterday. It’s always snippets here and there, and they don’t fit together well. So let me save you some trouble. I figure your reaching this page means you’ve already passed the first test which is to know the classes you need, which is why the search brought you here :)

I’m binding my webservice to a class, as that would be the logical choice in most cases.

/* these are required for it all to work */
require("Zend/Soap/Server.php");
require("Zend/Soap/Wsdl.php");
require("Zend/Soap/Wsdl/Strategy/ArrayOfTypeComplex.php");
require("Zend/Soap/AutoDiscover.php");


/* my system makes use of a global prefix, feel free to do as needed */
$serviceURL = WWWPREFIX . '/webservices/myservice';


public class MyService {
     /**
     *
     * @param integer $UserID
     * @return array
     */
    function GetCoupons($UserID) {
        // do some work here
        $coupons = array(new Coupon(), new Coupon());
    }
}

// Generate WSDL relevant to code
if (isset($_GET['wsdl'])){
    $autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
    $autodiscover->setClass('MyService');
    $autodiscover->handle();
} else {
    $server = new Zend_Soap_Server($serviceURL . "?wsdl");
    $server->setClass('MyService');
    $server->setObject(new MyService());
    $server->handle();
}

There are a few points of interest in the code block above (which is a completely functional service btw):

  • Notice the PHPDoc block above the function? If you don’t get that right, it won’t work at all
  • The return type of array because we’re returning an array of objects
  • The Zend_Soap_AutoDiscover bit at the bottom? That’ll auto-generate your WSDL for you

There, you’re done. It should all just work, complete with WSDL auto-generation. If you’re looking to make use of an existing WSDL file, you can use the secondary method of binding to methods/functions as outlined over at the official documentation on Zend_Soap_Server.

Say thank you Uncle Kevin :)

Instapaper

Instapaper is one of the best web-based tools I’ve used in a long long while. I love the recommendations — I just skim the headlines and click Read Later. The Google Reader integration is awesome too. It just integrates so well into my daily routine.

Instapaper, an example of a tool that does one thing, and does it well.

He’s Definitely Not Getting a Zonda

“I want a 350Z”, Sanjev said to me. “Well, I want a Zonda“. We were discussing dreams for one reason or another while waiting for the phone-shop dude to finish sticking on a screen protector for me. It took him about fifteen minutes from start to end, which really built up my expectations. From the care he showed in positioning it (3 retries!) I thought to myself, “this is going to be the best screen protector ever!”.

I was wrong. He positioned it too far right, and somewhere along the way managed to leave a mark on the top left edge.

As we walked away, I was ranting about how badly done it was, and Sanjev turned and said sardonically, “Well he’s definitely not getting a Zonda”. I have to agree.

SVNKit + Subclipse Problems

If you’re experiencing difficulty getting Subclipse working with SVNKit, install the very latest. One of the dependencies pulled in will list an SVNKit beta. Install that one and it’ll suddenly show up as a provider.

This is true as of Eclipse Ganymede and Subclipse 1.6.2 (installed with CollabNet Desktop). Just thought to save someone else several hours of their life :)

On Google Accounts

I have several domains running Google Apps for Domains. I also have a GMail/Google account. I’ve always found it odd that I cannot link my kevin@kevinfrancis.net account to my Google account in some way.

It’s a bit funny to have to keep what appears to be multiple Google accounts sitting around… I wonder if OpenID will factor into this in the future?

Update: Turns out that Google has fixed this now, by making Google Apps accounts first-class citizens, like gmail accounts. There is a downside though — you can only be logged into a maximum of 3 Google Accounts at the same time :(

Firefox Scaling Zoom Kills Performance

I’m rather insistent about scaling zoom being set by default 120% of my copy of Firefox. I achieve this with the NoSquint plugin add-on. Of late I’d been noticing that Firefox page scrolling was really really really bad.

Turns out this is caused by scaling zoom — turn the default page zoom to 100% and performance is really good, with scrolling being smooth and uniform.

Also, I today discovered that I’ve been right to avoid using the word performantperformant is not a word! Seems this is quite endemic to the technology industry as I’ve seen this word being used in everything from white papers to published books…

Safari 4 Scaling Zoom

Finally, Safari has page scaling in the v4 Beta. Sadly though it appears to exhibit strange behaviour with GMail for instance — When I zoom in, it also scales the width of the entire page, which means I now have to scroll left and right :(

Now, whilst this may or may not be the best thing for scaling zoom to do, my question is rather about whether it’s the right thing to do…

Page scaling should in theory scale everything right? Thoughts anyone? Perhaps you’re familiar with the W3 recommendation on this matter…