HOWTO: Split a string using split

Recently I was faced with a problem... I had an output of a 'ps' command and I needed to get the pid out. I know that you can get it out using awk and grep, but I could not get it to work from within my Java program. So, I had my output in a string array, where each line was a separate process. If you have seen an output of the ps command, you know that there is non-constant number of spaces between each field. So, to overcome that, I had to resort to regular expressions.

Here's the code that worked for me.

HOWTO: recursive scp without following symbolic links

Recently I've acquired a new computer to be used as a file server. I have decided to move away from FreeNAS and switch over to a Ubuntu based desktop. Since I was using Software RAID on FreeNAS, I figured that it would be safer and easier to just copy files from FreeNAS to my new Ubuntu-based NAS over network via SCP. The problem that I've encountered with scp is that if I do a recursive copy, all the links that I've created will be followed and copied over.

Here's a solution I found that I think is great:

HOWTO: Compare 2 dates in different formats in TestComplete

Suppose you have two date time strings in different formats and you need to compare if they are the same. Here's a function the code that will do this task for you.
NOTE: This code assumes that your dates are in the following formats: 12/31/2011 12:00:00 AM and 31-December-2011-00:00:00

To tackle this task, we're going to parse above mentioned date string and get number of milliseconds since January 1, 1970. Once we have our date in milliseconds, compare the two numbers and see if dates are same or different.

HOWTO compute distance between 2 addresses using Google Maps API

I recently had a requirement to figure out the distance between an address and a zip code (or it could be an address too). I figured that this is best solved by using Google Maps API. If you are curious on how to do that, read on.
There are couple of ways to get the distance. The first way is the straight line between 2 points (I'm assuming it's flying distance). The second way is the distance between 2 points if you were traveling by car.
Regardless of the way, you need to load a script for JavaScript API:

How to close message in preview pane in GMail

Are you a GMail addict like I am? Do you always keep your inbox open in one of your browser's tab? Do you like to experiment with new plugins and features that Google has to offer? If you do and if you've enabled a preview pane you might have noticed that after you read an e-mail, it stays open. I don't know about you, but that really irritates me. Today, thanks to this forum thread, I found a way to keep the preview pane empty!

How to round a number to a specific number of decimal places in JavaScript / JScript

If you will look at the documentation of Math.round() method, you'll see that it takes only 1 argument, which is the number that you want to round. The rounding method is going to round your number to the closes integer. If this doesn't sit well with you, you can use the function below to round any number to any decimal places.

HOWTO: Automatically add a row to a spreadsheet in Google Docs

Have you ever found that you had to update an excel spreadsheet with the same information every month or every week? Are you using Google Docs for that spreadsheet? If you are, you are in luck since this tutorial will show you exactly how to do that.

First, you'll need to have the following squared away:

  • A Google account. So that you could access Google Docs
  • A spreadsheet that will hold the information and will get auto-populated on regular basis
  • Now that you got all the "pre-requisites" squared away, let's actually get to the good part!

    How to Query ClearQuest database using SQL

    The place I work at uses IBM's ClearQuest for defect tracking. Since right now I'm working on automating our software, I'm constantly trying to find new ways of minimizing user interaction before, during, and after script execution. My latest side project was writing some functions that will interact with ClearQuest's database, which is Oracle, and pull out defect numbers.

    HOWTO: Force GC.Collect for an application under test from TestComplete

    So, recently I've been asked to measure how much memory our application is using. The requirements were as follows:
    1) Get current memory
    2) Do somethings with an app
    3) Get new memory reading

    Seems pretty easy, right? Just go to a task manager and write down current memory reading. Then after some go back to our task manager and get new reading. Subtract one from the other and get your delta!

    HOWTO: Track test case progress in TestComplete

    Right now I'm working on automating test procedures that test the software we're working on. As always, at the end of our automation we need to provide a detailed report with results for every step of the procedure. Since our procedures have two types of steps, Action Step and Verification Step, we need to provide different pass/fail messages. So, to make this happen, I've decided to use the following approach.