Parameterized JUnit Tests

Useful when multiple tests have the same structure, but have different inputs and produce different results. Here’s the skeleton:

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

public class SumTests
	@Parameters(name="{index}: {0}+{1}={2}") // name is optional, {index} will be used by default; arguments used here must be declared in constructor
	public static Collection<Object[]> data() 
		return Arrays.asList(
			new Object[][] 
				{1, 1, 2},
				{3, 5, 2}, // fails
				{-1, 1, 0}

	public SumTests(int a, int b, int sum)
		this.a = a;
		this.b = b;
		this.sum = sum;

	public void sum()
		assertEquals("Sum is not correct", sum, a + b);
	private int a, b, sum;
Parameterized JUnit Tests

JMeter Plug-In development: setting up Maven project

A typical setup, with only one additional dependency:


where ${version.jmeter} is a JMeter version, e.g. 2.8:


Unfortunately JMeter brings a lot of transitive dependencies, which can collide with project’s own dependencies. Most obvious are com.sun:tools, which is really part of JDK, and junit.

This is the only special entity in the pom.xml for JMeter plug-in project.

JMeter Plug-In development: setting up Maven project

Infographic Tools

Tableau Public
Requires tool download (Windows only) and creation of the account, and allows to publish charts online, as well as store them as PDF or image. Very powerful set of graphs, and ability to create a dashboard. Allows to load data set from many different sources.
Requires to create an account (Facebook / Twitter login can be used). Good selection of charts (data can be imported from Excel spreadsheets), which can also be wrapped into a few themes (and can contain graphical text, images and charts). Simple intuitive UI. No graphs or trees, however, and no option to export (can only publish online).
Requires to create an account. You can choose a theme from many different templates, or create a new one from scratch.  Shapes are a central piece of the design, and can create many different forms: from tree and graph to a diagram. Presentations can also contain images and graphic text, but no ability to create charts based on data. Can be published online or exported as JPG.

Many Eyes
IBM site, based on Cognos, that allows to visualize data sets. Site design, and user experience in general are quite outdated, clumsy and slow (Java applets are used to render charts). However has a decent set of chart types, diagrams, and maps. Result can be published online or exported as PNG.

Charts Bin
Requires to create an account. Allows to upload and visualize location-based data. Has a few options, and user interface is not very smooth. However what’s valuable is the ability to create interactive maps with data, allows to publish or download it as PNG.

Infographic Tools

Selenium WebDriver on Firefox: Working with Add-Ons

Running Selenium WebDriver on Firefox with Static Add-Ons

  1. Create a special profile for Firefox
  2. Install add-ons on that profile
  3. Start Firefox as described here

Installing Add-On when Starting Selenium WebDriver on Firefox

import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.FirefoxDriver;
// ...
final String addOnPath = "C:\\Temp\\youraddon.xpi";
File addOnFile = new File( addOnPath );
FirefoxProfile profile = new FirefoxProfile();
profile.addExtension( addOnFile );
WebDriver driver = new FirefoxDriver( profile );

Getting List of Installed / Active Add-Ons with Selenium WebDriver on Firefox

There’s no easy way to achieve this unfortunately. So the method below is really an ugly hack, but it get the job done:

  • Firefox is loaded on about:addons page
  • The page contains list of add-ons in JSON format, which can be parsed
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference( "browser.startup.homepage", "about:addons" ); 
WebDriver driver = new FirefoxDriver( profile );
driver.get( "about:addons" );
String source= driver.getPageSource();
final String addOnsSectionStart 		= "<browser id=\"discover-browser\"";
source = source.substring( source.indexOf( addOnsSectionStart ) + addOnsSectionStart.length());
source = source.substring( source.indexOf( "{%22" ) );
source = source.substring( 0, source.indexOf( "\" clickthrough" ) );
source = URLDecoder.decode( source, "UTF-8" );
JSONObject addonObjects = new JSONObject(source);
JSONArray jsonAddonArray = addonObjects.names();
		"user disabled",
		"is compatible",
		"is blocklisted",
for(int i = 0; i < jsonAddonArray.length(); i++)
	JSONObject jsonAddonObject = addonObjects.getJSONObject(jsonAddonArray.getString(i));

The output will look like this:

type      	version        	user disabled  	is compatible  	is blocklisted 	name
plugin        	false          	true           	false          	QuickTime Plug-in 7.7.1
plugin      	false          	true           	false          	Java(TM) Platform SE 6 U26
theme     	17.0.1         	false          	true           	false          	Default
plugin    	2.4.2432.1652  	false          	true           	false          	Google Updater
extension 	2.28.0         	false          	true           	false          	Firefox WebDriver
Selenium WebDriver on Firefox: Working with Add-Ons

How to Not Get Hired

So you want to be one of those lucky people, who, despite all the efforts of evil employers to grab and hire them, remain unemployed and free? Here’s how you do it.


  • Start your resume from praising yourself. Don’t use any modest words, go big: you are an expert, a guru, a visionary.
  • Describe your amazing skills: if you ever heard about some technology, say you are familiar with it; if you ever sat in front of a machine, which sysadmin had told you was Linux, you have a proficiency with Linux; if, on top of that, you know what ls -al command is, you are clearly an expert in shell scripting. Since you obviously know how to send email, you have a good understanding of POP3 and SMTP protocols; and you probably own a smart phone, so you can clearly claim expertize in mobile technologies.
  • In general, the words expert and expertize should appear at least 10 times in your resume.
  • Don’t leave out anything you have ever touched. In fact, come up with a list of at least 500 technological buzz words, and put them in your resume in “Technical Skills” section. This list should include “google”, “email”, “notepad” and “SMS” to make sure employer understands that you know thing or two about technology. Another good strategy is to use a lot of 3-letter abbreviations, as most of them will indeed mean something (and possibly more than one thing) in technological world, so the reader of your resume will have fun time guessing what you’ve meant.
  • Then describe your soft skills. Make sure there’s nothing in this section that stands out: always write that you have excellent communication skills, always mention that you are a team player, who also likes to work independently with a little or no supervision, and don’t forget to say that you are a quick learner.
  • Now your work experience. First of all, mention all the jobs you ever held in your life, since high school. Remember that summer job in supermarket you had for two weeks in grade 8? Don’t leave it out! It’s extremely important that employer sees it in your work history. And as far as number of positions goes, the more the merrier: ideally you changed your position every 2-3 months in the last 10 years; and never stay in one position for more than 1 year, or it will seriously affect your credibility. So carefully list them all, with exact months and years of your employment, at which point your resume hopefully exceeds 5 pages.
  • Close your resume with list of your hobbies and interests. Make sure this list takes at least half a page.
  • The last important detail: liberally sprinkle orthographic mistakes over your resume, and make them stand out. That is: don’t bother with missing commas, and don’t misspell some obscure words, which reader may miss. Misspell words everyone would know and notice, such as names of well-known technologies or companies, your own name, or name of the employer. It’s also helpful to misuse capitalization: skip capitalization of first letter in some sentences, and at the same time use some capitalized words in the middle of another sentence for no particular reason.

Cover Letter

Unfortunately cover letter is rarely read by employers. But it’s still a good idea to:

  • Misspell a company name, or better yet, refer to another company.
  • Add a paragraph that describes why you apply specifically to this company. Start it with “I want to work for your company because ” and then paste an opening sentence from About Our Company page on company’s own site
  • Use an x-rated address to send resume: emails like misskitty69@…com or 10inbob@…com are what most professionals would recommend.
  • Apply separately to every position advertised on company site at the same time, just change the titles you apply for in the cover letter. There’s no way employer will notice this.

Phone Interview

If your efforts to not get employed on resume stage have failed, and you received a dreaded phone interview call with a potential employer, don’t panic! You still have plenty of ways to prevent your employment. Most employers call to screen out. So here is how you get yourself screened out properly.

  • If interviewer sets a specific time for interview, make sure you don’t pick up the phone at that time. Most annoying interviewers may call you again and again, to trick you into accepting their call. Just ignore them.
  • If you did pick up the phone by accident, tell the interviewer that you “don’t have time to talk right now”. This is one of the best ways to get rid of potential employer for good.

If you have no other choice but proceed with phone interview, here are a few rules that will help you to fail it.

  • Make sure you don’t answer correctly to any questions about the skills for which you said you were an expert.
  • When asked how you acquired this or other skill, say something like: “I was sitting next to a guy, who was reading a book about it, so I picked up some“.
  • And when you are asked to described your last job, make sure you describe in details anything surrounding your work, but avoid any technical details about work itself. Describe meetings, coffee breaks, Excel spreadsheets you had to fill, and so on. But when describing your responsibilities be as vague as possible.
  • In the end, don’t forget to cheerfully ask the interviewer: “so, I’m surely your best candidate so far, am I not?
  • If interviewer still asks you whether “you think you could come for an interview in our office?”, ask a few simple, “could easily be googled” questions, such as: company address, and driving directions from your house to the office.

In-Person Interview

The interview is your last line of defense. Here you absolutely must make such an impression on your potential employer, that hiring you becomes impossible.

  • First of all, you should look like you are hangover after a night-long party and never slept or changed your cloths afterwards.
  • Never come on time: you should be late by at least 30-40 minutes, and you should not notify your interviewers that you will be late. Another original strategy is to get to the company 24 or 48 hours after the scheduled time.
  • Tell interviewers that you really hate the area their office is located in, and you had a hard time finding it. Sound angry when you say so.
  • Be confident. It’s OK to tell the interviewer that they “don’t know shit“, they “shouldn’t be using tool X, because tool Y is definitely better“, and that when you are hired, “you will ditch that thing on first day
  • Never admit that you don’t know something, answer every question. It helps to learn basics of lawyer language, which will allow you to talk about any topic for minutes, without saying anything. For example if you were asked what do you like and dislike about Jambalaya API (you never heard of), say something like this: “I don’t have much experience with Jambalaya API, however according to my current understanding, it has a very strong potential and definitely a lot of thought was invested into its design and set of features, but I would have to learn more about its scalability and ease of implementation“.
  • At the same time your interviewer should never be clear on whether you really know something: you must keep them in the dark. So give very vague answers to the questions about the topics you are supposed to know very well, don’t be afraid to give wrong answers, and don’t be afraid to argue with interviewer in most confident tone, defending a point of view, that you know is wrong.

Providing references

To further deepen an impression you’ve made on a potential employer, choose your references carefully:

  • Ideally, people you provided as references will mention some of the criminal activities you were involved in while working with them.
  • Next best thing are references who refuse to talk about you
  • If neither is possible, then provide references from places you worked for 10 or more years ago.

Waiting for Results

So you did well on the interview, and your references are solid. You are almost sure they will not hire you (thanks goodness!). Now improve your chances to not get hired even further by following these simple rules:

  • Call your hiring manager at least 3-4 times a day.
  • If they don’t pick up, leave message every time.
  • Just to be sure, also send an email daily, asking when you can start your job

At this point, and we are quite confident, you have successfully dodged all the efforts of sneaky employers to hire you. Enjoy your freedom!

How to Not Get Hired

Quick Notes on HTML 5: Document Skeleton and Basic Rules

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<!-- saved from url=(0014)about:internet -->
<title>Titles goes here</title>
<link href="style.css" rel="stylesheet">
<script src="script.js></script>
<p>Contents are here</p>

1. Use of <html>, <head> and <body> tags is optional. If they are not present, browser renders them automatically. Usage is still recommended for cleanness purposes.

2. <!DOCTYPE html> is required to prevent browsers from displaying document in quirks mode

3. <meta charset=…> definition is highly recommended right after <!DOCTYPE… or at the top of <head> section. UTF-8 is the most widely used encoding (most compact and fastest for pretty much all browsers).

4. Natural language specification, e.g. lang=”en” is optional, but recommended, as it allows search engines and screen readers to identify section correctly. Specifying language for html tag defines it for entire page, however it also can be specified for elements, such as div.

5. Stylesheet definition does not require type=”text/css” specification, since “rel” (relationship) defines link as stylesheet, and css is the only style sheet language.

6. Similarly, no need to specify language=”JavaScript” for script tag: JavaScript is assumed by default.

7. Closing </script> tag is required, even when referring an external JavaScript file.

8. Comment <!– saved from url=(0014)about:internet –> is only required to enable debugging of local page in IE; if not specified, when you load local page, IE prevents running any JavaScript on the page, unless you explicitely click “Allow blocked content” (this comment is ignored by any other browser)

9. Tags can be lower and/or upper case.

10. Attributes can be specified without values (e.g. <input type=”checkbox” checked>). This is not commonly used, however, since inconsistent with other attributes. XHTML standard required value for each attribute (e.g. <input type=”checkbox” checked=”checked” />).

11. Closing tags are not required for void elements (elements without nested contents) such as <br>, <img> and <hr>. Again, XHTML required <br />, <img … /> and <hr />.

12. Quotation marks around attribute values are only required if attribute values contain >, = or space. E.g. “<img alt=”This is an image” src=image.gif> is valid for HTML5, but not XHTML.

Loose rules 9-12 are likely to fail on validators. It also may be considered a bad “not-so-clean” style. From the browser perspective, however, those inconsistencies do not add any overhead, and thus following XHTML rules is not necessary from performance or compatibility perspective.

Quick Notes on HTML 5: Document Skeleton and Basic Rules

Little WordPress annoyances and findings

I discovered that WordPress does not support Google Analytics. Not even if you have a paid account. For my blog I could care less: I keep it mostly for myself as a tool to preserve some thoughts and information, or direct people to specific post, when I need to share something with them… But when tracking visitors is important (e.g. somebody’s own business blog), paid WordPress blog is not a good option at all: for approximately the same amount of $30, you can get a hosting (such as iPage or GoDaddy) with WordPress support, and then configure Google Analytics or install a plug-in.

The blog of the WordPress staff in that thread (she doesn’t disclose her name), however, is pretty useful.

Little WordPress annoyances and findings