The Tester’s Attitude

Couple of weeks ago, while i was having the monthly one-on-one discussion with my manager, she told me about a new project that was coming up. It looked like there was an opportunity for me and she wanted me to take that up. Taking up this work would mean, i would have to move temporarily to the other team and stop the QA work that i was currently responsible for. The next question, naturally, was who would be owning the piece of work that i was doing?

It quite so happens that at around the same time, there were two new people joining our team. Well, one person was new to the team, the other used to work as a contractor, before he was offered a permanent post. So he was re-joining our team.

I suggested, that we give it to the guy who was re-joining us. I had my valid reasons. He knew the product, knew the people and the process involved etc.. But to my surprise, my manager suggested the new guy. She went on to say that she knew the contractor-turned-permanent-employee to be more of a developer and lacked, what she called as, ‘the tester’s attitude‘.

I have been a QA guy all my career and what she mentioned struck me. What did she mean by a ‘tester’s attitude’?

I always knew that testing was not for everyone. Testing is something that is quite different from development. It’s easy, as well as tough at times. It takes a lot of ‘courage’ to stand up against a veteran developer and fight for that Sev-1 defect that you raised. It takes effort to raise quality defects. One needs to think like a customer or an end user and uncover defects. Testing, it’s an art!

But what did she mean by a tester’s attitude? The thought was nagging me for the last couple of weeks and today i understood what tester’s attitude meant.

Continue reading

What should be my Language?

I have never been an average user of computers. I wanted to program and the primary reason for that was to make the system do things the way i wanted it to. With time i realized that some programming languages fits your need better than others.

Gradually, we will all begin to prefer one language or a set of languages over the others. We all get into that comfort zone and start to call them our favorite programming language.

I realized that it largely depends on what you want to do with a language and how long one has been ‘stuck’ with it. It has nothing to do with speed or features. The interesting part about this is that, many of us have our favorites because we use it at work and the lucky few find a job that lets them use their existing skills.

These programming languages are just as similar to the spoken ones. With repeated use one gets proficient, there is grammar, there is a way to go about with it and yet the very basics of all of it remains the same. But there is a major difference. Learning programming languages with a similar abstraction level is easy. But if you want to be good in language that has an entirely different way to doing things, then be ready to lose some of your existing skills.

We can argue that a person can be good in multiple programming languages. Yes, i agree to that. But that’s why i mentioned about abstraction levels. I’m good at Perl and Python. I’m bad at C and Java. The first two are high level programming langues compared to C and Java. The level of abstraction provided by them is greater. I was good at C in college. But as soon as i picked up Perl and got comfortable at it, i went bad with C.

For me, typing mattered and that meant i was quite comfortable when i was able to do something in 5 lines against 15.

I must say that i have been lucky at my profession too. I’m into QA and that meant a lot of scripting. Basically a lot of Perl or Python. Even though i’m working for a company that builds majority of its products in Java, I really never had to possess any deep Java skills.

So, the question is -why is it so? Why? Why can’t one be really good in any programming language that one needs irrespective of the whether it’s a low level or high level?

I think the answer is the that it ‘spoils’ you! By letting you do anything you want to, it simply makes life easier. Hence we pick the languages that we want to for the things we want to do. Let’s look at it this way, you wouldn’t write a REST client in C and you wouldn’t want to do PIC programming in Python. Technically you can, but you got to be really crazy enough to do it.

Usage of strings are a better way to demonstrate this. Let me just give some examples as a closing note.

String Additon: “Hello” + “World” = “HelloWorld” being the logic

In C :

[c]
#include <stdio.h>
#include <string.h>
main() {
char str1[] = “Hello”;
char str2[] = “World”;
strcat(str1, str2);
printf(“%s\n”, str1);
return 0;
}[/c]

In Java:

[java]

class stringAddition {
public static void main(String[] args){
String str1 = “Hello”;
String str2 = “World”;
System.out.println(str1+str2);
}
}

[/java]

In Python:

[python]
#!/usr/bin/python
str1 = “Hello”
str2 = “World”
print(str1+str2)
[/python]

String Comparison: “hello” is the same as “hello”

In C :

[c]
#include <stdio.h>
#include <string.h>
main()
{
char str1[] = “hello”;
char str2[] = “hello”;
if(strcmp(str1, str2)==0){printf(“Strings Match\n”);}
else {printf(“Strings Don’t Match\n”);}
return 0;
}
[/c]

In Java:

[java]
class stringComparison {
public static void main(String[] args){
String str1 = “hello”;
String str2 = “hello”;
if(str1.equals(“hello”)){System.out.println(“Strings Match”);}
else {System.out.println(“Strings Don’t Match”);}
}
}

[/java]

In Python:

[python]
#!/usr/bin/python
str1 = “hello”
str2 = “hello”
if(str1==str2):
print(“Strings Match”)
else:
print(“Strings Don’t Match”)
[/python]

Let me know your thoughts…

5×4 Led Matrix with Arduino

My first attempt in soldering was in making a 5×4 led matrix. Why 5×4? Well, let’s just say i only had around 20 leds at my disposal. To my surprise the soldering went quite fine with all the contacts properly in place (and with some really painful contacts of the soldering iron and my hand).

There were no shift registers used in displaying characters on the matrix and it purely relies on the principle of persistence of vision.

Code for Arduino

/*
5x4 Led Matrix using Arduino
*/

int i=0, j=0;
int l_col=4;
int l_row=5;
int col[4] = {2,3,4,5};
int row[5] = {8,9,10,11,12};

int pattern[5][4] = {
  {1,1,1,1},
  {1,0,0,0},
  {1,1,1,1},
  {1,0,0,0},
  {1,1,1,1},
};

void setup() {
  for(i=0; i<l_col; i++)
  {
    pinMode(col[i], OUTPUT);
    digitalWrite(col[i], LOW);
  }
  for(i=0; i<l_row; i++)
  {
    pinMode(row[i], OUTPUT);
    digitalWrite(row[i], HIGH);
  }
}

void draw(){
  for(i=0; i<l_row; i++)
  for(j=0; j<l_col; j++)
  {
    if(pattern[i][j])
    {
      digitalWrite(col[j], HIGH);
      digitalWrite(row[i], LOW);
      delay(1);
      digitalWrite(col[j], LOW);
      digitalWrite(row[i], HIGH);
    }
  }
}

void loop() {
  draw();
}

Using DataPower XSLT extension to add custom Headers

N.B. this tutorial assumes the reader has some knowledge of DataPower.

IBM WebSphere DataPower SOA Appliances provides, apart from the XSLT1.0 extension functions, a wide range of DataPower specific XSLT extensions functions. Anyone who has got their hands dirty trying to do DataPower programming using XSLT knows that there are many ways to solve a problem.

In this post i will explain how to add a custom header to a request/response. More specifically i will add a custom response header to an HTTP request. If you have gone through the DataPower Extension Elements and Functions Catalog knows that there are 2 options available -

  1. set-http-request-header and set-http-response-header
  2. set-request-header and set-response-header

The later being for both HTTP and MQ.

I will be using the set-response-header in this example. This is particularly useful when dealing with web-services.

We will consider the following scenario –

  1. User makes a simple HTTP POST to a DataPower HTTP FSPH
  2. The backend of the DataPower config echoes the POST message
  3. On the response rule we add a custom header

This way we can verify the header getting added without having to enable the debug logs or probe on the appliance.

The policy looks like the one below.

addHeader

Under the Server to Client rule, which is our response rule, I have added a Transform action. The style sheet with in the Transform action just adds a custom header to the response rule. This is the XSLT that I used

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:dp="http://www.datapower.com/extensions"
                extension-element-prefixes="dp"
                exclude-result-prefixes="dp">        
<xsl:template match="/">
<xsl:variable name="s" select="dp:variable('var://service/routing-url')" />
<dp:set-http-response-header name="'SomeRandomlyAddedHeader'" value="$s"/>
</xsl:template>
</xsl:stylesheet>

We are adding an additional header “’SomeRandomlyAddedHeader”. When we place the POST request to the DataPower service we get the headers as shown below –

addHeaderRequest

“Hello World” in 10 Languages

How to print “Hello World!” in 10 Languages (compiled, interpreted and markup included).

1. C

#include<stdio.h>
int main ()
{
printf(“Hello World!\n”);
return 0;
}

2. Java

class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello World!”);
}
}

3. (Bash) Shell Script

#!/bin/bash

echo “Hello world!”

4. Perl

#!/usr/bin/perl

print “Hello World!”;

5. Python

Python 2.0

#!/usr/local/bin/python

print “Hello World!”

Python 3.0

#!/usr/local/bin/python

print(“Hello World!”)

6. Tcl

puts “Hello World!”

7. HTML

<html>
<head>
<title>Hello World</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>

8. JavaScript

<html>
<head>
<title>Hello World</title>
<script type=”text/javascript”>
document.write(“Hello World!”);
</script>
</head>
<body>
</body>
</html>

9. PHP

<?php
echo “Hello World!”;
?>

10. XSLT

<?xml version=”1.0″ encoding=”UTF-8″?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>
<xsl:template match=”/”>
Hello World
</xsl:template>
</xsl:stylesheet>