Friday, October 25, 2013

A couple of projects

At the beginning of the year, I wanted to get more involved with technology I really care about.
  • It started with me gaining some confidence by taking a few courses, then contributing back to StackOverflow.  
  • I wanted to learn more about Javascript and understand JSON, so I built a map using Open Data from Waterloo Region. 
  • I learned so much using TileMill that I created a training video since there was not a lot out there on this.
  • I maintain my VPS too, that houses my website; but it does so much more. 
  • Even with all of this, I took a few course to learn more about mobile development (I love my iPhone) and I also decided to put some of these accomplishments up on LinkedIn.

Wednesday, October 16, 2013

1100 stage alerts (one of my favorite bugs)

This is a post I have had ready for about 5 years now. A long time ago, I caused a partial meltdown of our software. This was the email thread that went out by QA, and the reply from Dev. FYI: Stage Alerts are just emails sent to everyone saying something bad has just happened.

Note: this is the first time I have looked at it in about 3 years and its still pretty funny... well to me. Maybe you had to be there.

------------------------
From: QA Group
To: Dev
Sent: 1:40pm
Subject: 1100+ Stage Alerts in 3 hours

I've given up trying to keep track of the Stage Alerts. Since noon today we've had over 1,100.

I haven't checked, but I'm pretty sure we (in QA) haven't reported bugs for every alert that has come through.

Just thought I'd send out a quick note to check and see if anyone in Dev has an eye on these alerts too.
------------------------
From: Developer
To: QA Group
Subject: RE: 1100+ Stage Alerts in 3 hours?

There alerts are caused by problems try to persist audit events to the database. I've discovered a couple bugs in our logging implementation, that were exposed by some unique data.

Specifically, there was a borrower user in the database with the following:

First Name: Jebediah Obadiah Zachariah Jedediah Springfield-KD
Last Name: Squeaky Voiced Teen né Jeremy Peterson/Freedman-KD

This extra long name ends up in an audit message, and eventually causes problems because it exceeds a length limit. I've updated the user to shorten the name so that no more alerts will be generated.

I'll attempt to cleanup any existing audits that are failing/retrying in the bowels of BizTalk.

An experiment with Open Data


TileMill - A quick tutorial on how to use TileMill with Open Data

I decided a few months ago to play with more open data sets. I went to the GO Open Data conference in May and that really got me excited about how we interact with data and use it. I thought "why not play with some new GIS software and see how it goes". With that in mind, I created a few maps and a video to help me remember how to use TileMill.

BTW: Yesterday, Github announced government.github.com which is a huge leap forward with regard to indexing and organizing open data sets. There is so much out there, now its a matter of trying to find good ways to use all of this information.

Wednesday, May 08, 2013

Career advice for testers

Here's a blog post that has taken me a few years to create.

There was a site called prizes.org. The idea was that people can post questions and responses were graded for their merits by the people posing the question. In exchange for a good response, you could earn money. In this case, someone asked the following question:
Searching for projects in test engineering to improve my technical skills
Test engineering has long been a passion of mine. I dabbled in it in school and has worked as a full time software test engineer since. I have no interest in management nor do I want to become a developer, I'd like to focus purely in the testing field. 
In the last 4 years, I've been so busy with my day job that I haven't had time to improve on my technical abilities outside of work. I want to take this opportunity to offer a prize for the best recommendation on part time gigs or projects that will challenge me mentally, sharpen my skills and push me to learn new things in the field. I don't mind if there's no compensation involved, I'd really like this to be a learning experience.
Google owned prizes.org. Like many of their other properties, it was taken down and its content removed. Rather than it being lost forever, I thought I should post it here.

The following answer was created by me and it also 'won' the competition; a whole $20. Apparently money does occasionally motivate me. :-) Anyway, it was worth something to someone once; I hope its worth something to you too.

Below is my response (circa 2011, I think):

Personally, I think your best options are to do the following:
  • Meet people: if you want to talk to other testers, http://weekendtesting.com/ is a great place to challenge your skills and meet people
  • Take a course: join AST (http://www.associationforsoftwaretesting.org/training/courses/foundations/) and take the foundations course. Great way to meet people and learn/add to your skillset. Its free once you join the AST and membership is only $80 US
  • Read some books: Depending on your perspective, find a book and read it. Read anything, fiction, blogs, etc. Anything from Gerald Weinberg or Andy Hunt would be excellent. Find your own context. My recommendation, stay away from purely technical books like "learn C++". I'm currently reading "How to Break a Terrorist" (http://www.amazon.com/How-Break-Terrorist-Interrogators-Brutality/dp/1416573151); amazingly useful when talking to developers!
  • Practice! : http://testing-challenges.org is a great place to actually try out some of the skills you have learned. Alternately, join uTest - from my experience, you get to use all your new found skills in a safe environment; and you can make money to boot.
  • If test automation is your thing: Join either an open source group and do some of their testing (see Github, bitbucket.org, SourceForge). If you don't know how to program, try Ruby as your first language. There's lots of web testing frameworks (Selenium and Watir). Remember, test design before coding... ask yourself what you are trying to test, then design the test. Maybe it can be automated, maybe it can't. Good test design is the key. See "A Practitioner's Guide to Software Test Design" (http://www.amazon.com/Practitioners-Guide-Software-Test-Design/dp/158053791X). Older book, but still really good.
  • Context Driven Testing Y! list. Lurking is good. To that end, if you are a AST member, try the new forums. Maybe there's something there.
That is easily enough to keep you busy for a year. For the last few years, I have been trying all of these and found them immensely useful. In fact, there are two more things that could be added to the list. Going to conferences of your peers and writing a blog. Both of these take a lot of money or a lot more time. Both require you to be self directed. My suggestion, follow through with one of the the points I mentioned and you'll be better suited to do the conference/blog thing later.

Frankly, don't do the "get a certification" route. there's lots of "experts" that suggest it is a title without meaning. See:
I would agree with them. Certifications are mostly memorize and regurgitate. Not terribily useful if you actually want to improve your technical skills.

JSON parsing in iOS, using the Tiny Tiny RSS API

I saw a recent question posted to reddit a few days ago. It was around the idea that there aren't any good tutorials on how to take JSON data and parse it in iOS. Since I'm a newbie to iOS, I decided that it might be a good problem to solve. Before we start, take a look at https://gist.github.com/kgdesouz/5542543/.

How the heck do you connect to a JSON API that is remote (in iOS)?

Using curl, its easy. Using iOS, there's a few more steps. First we need to put our data into some sort of dictionary (well, at least that's what I wanted to do). Inside the viewDidLoad method, you can just use NSMutableDictionary. This data will need to be serialized afterwards in order to prep it to be sent to the API.

    NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithDictionary:@{
                                       @"op" : @"login", @"user" : login, @"password" : password
                                       }];
    [self fetchData:dictionary];
    [self getCategories:_sid];
Then we need to serialize the data. The magic is done in the fetchData method. Actually, all the heavy lifting is done the the fetchData method, let's break it down a little.
- (void)fetchData:(NSMutableDictionary *)dictionary
{
    NSError *error = nil;
    NSData *jsonData = [NSJSONSerialization
                        dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted error:&error];
    
    
    if ([jsonData length] > 0 && error == nil){
        NSLog(@"Successfully serialized the dictionary into data."); NSString *jsonString =
        [[NSString alloc] initWithData:jsonData
                              encoding:NSUTF8StringEncoding];
        NSLog(@"JSON String = %@", jsonString);
Now that we have a serialized object, we can now get it ready to be sent.
        // create the connection and send it to the server
        NSString *requestString = kTinyTinyRSSURL;
        
        NSURL *url = [NSURL URLWithString:requestString];
        
        NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
        [req setHTTPMethod:@"POST"];
        
        NSString *dataString = jsonString;
        
        NSData *requestData = [NSData dataWithBytes:[dataString UTF8String] length:[dataString length]];
        
        [req setHTTPBody:requestData];
        
        NSURLResponse *theResponse = NULL;
        NSError *theError = NULL;
        NSData *theResponseData = [NSURLConnection sendSynchronousRequest:req returningResponse:&theResponse error:&theError];

The money here is theResponseData, it allows you to POST the data to the server. Once you have sent the data, you will get back a response, so you need to deserialize that back into something useful. I'm putting it into a NSArray.
 
        //deserialize the response into something usable
        NSDictionary* json = [NSJSONSerialization
                              JSONObjectWithData:theResponseData //1
                              options:kNilOptions
                              error:&error];
        
        NSArray* validResponse = [json objectForKey:@"content"]; //2
        NSLog(@"content: %@", validResponse); //3

That's basically it. fetchData is reusable, so you can now use the same method to make other JSON queries. As per the gist, anyone should be able to use the code to connect to a JSON API.

Note: I mashed together a lot of this code from:
A few more thoughts about this little piece of code:
  • My full code snip can be found here: https://gist.github.com/kgdesouz/5542543/
  • The code was meant to be quick and dirty. I didn't really follow the MVC, since really I didn't need the view or the controller, just the model. I wanted everything to go to stdout (to keep things simple). I basically just looked at some tutorials and tried to integrate it. 
  • There's no GUI component required. Without too much effort, anyone should be able to use the code for any JSON calls, with a little tweaking.
  • There is a lot of clean up required. I'm still playing with unit testing in this language. Specifically, JSON unit testing. Its a little different since I need to figure out how to reset the JSON. I will probably create a JSON mock object to do this. 
  • I totally didn't use getter and setter methods here. I know I should, but read the first bullet point; quick and dirty.