Monthly Archives: January 2012

JIRA OnDemand: Great Solution For Vendors and Partners

Keeping track of technical issues, bugs and tasks between companies can be a real hassle. In my current job, we’ve been using Excel spreadsheets with a couple of partners, emailing them back and forth with changes and updates. These quickly get out of sync, causing us to lose track of important issues. Also, this is only helpful for a very short summary of each issue — forget trying to have a more detailed conversation or screenshot attachments.

For one project we decided to try JIRA OnDemand and couldn’t be happier with the results. For only $10/month for the first 10 users, we’ve got a shared online tracking system that both companies can access. We divided the 10 users up across the two companies, and were up and running in about 10 minutes.

It helps that JIRA is pretty simple to learn and use, especially for anyone who’s used any type of bug tracking system. We’ve got email notifications, attachment support, and the ability to converse in detail on each issue as we resolve them.

Highly recommended!

JIRA OnDemand pricing chart
JIRA OnDemand pricing starts at an easy $10 per month for 10 users!

Stack Overflow: Kind of Addicting

Over this past Christmas break I spent some more time on Stack Overflow, answering some questions in a few areas I felt I could contribute. As I answered and contributed more, I saw how the reputation and badges system can really draw you in. Not as a motivator per se, but it’s fun to get “kudos” when someone finds your answers or edits helpful.

Some conclusions so far:

  • Some questions get answered very quickly – if you watch the most recent questions you’ll see a small number of page views, but a bunch of answers already. Must be a lot of people watching the newest questions and trying to contribute.
  • Answering older questions is worthwhile if the originator has a decent accept rate. Corollary: it’s not worth bothering with really old questions asked by User1234 with only 1 reputation point.
  • Editing tag (wiki) descriptions is a good way to contribute for lesser-known tags.
  • Upvoting good quality questions and answers is a good way to keep up the overall quality level of the site


profile for BrianC at Stack Overflow, Q&A for professional and enthusiast programmers

Check out my sweet Stack Overflow flair badge!

Curl Cheat Sheet

This is a quick introduction and cheat sheet for Curl – a very handy command-line tool for downloading pretty much anything from a URL.

The Curl website describes it as:

… a command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks.

There are many things that Curl can do, and there is a voluminous man page that lists all of the details.

Here I want to boil down all those options into the most common and useful ones for web or webservices developers (using HTTP/HTTPS protocols). If you don’t already have Curl installed on your system (try running curl from a command prompt), see Getting Curl below.

Basic Usage

The basic form of all Curl commands is:

curl [options...] <url>

For example:

$ curl http://www.google.com/humans.txt
Google is built by a large team of engineers, designers, researchers, robots, and others in many different sites across the globe. It is updated continuously, and built with more tools and technologies than we can shake a stick at. If you'd like to help us out, see google.com/jobs.

Common Options

Options are the real power of of Curl. Here we’ll cover the most common ones that I’ve used for typical web and webservices development. (You can get the full set of options on your system with curl --help or curl --manual.)

-A / –user-agent AGENT
Set the HTTP User Agent string if you don’t want the default “curl” string
–compressed
Add the HTTP header to request compressed content, if the server can provide it
-d / –data DATA
Set data to be sent with a POST request
-D / –dump-header FILE
Save the response headers to a separate file
-H / –header HEADER
Set a custom HTTP header
-i / –include
Include the response headers in the output
-k / –insecure
Skip SSL certification verification
-o / –output FILE
Write output to a file rather than stdout
-s / –silent
Run silently (i.e., don’t show progress meter)
–trace-ascii FILE
Write request and response headers and data to local file
-x / –proxy HOST:PORT
Route data through the given proxy
-X / –request METHOD
Set custom HTTP method (GET, PUT, POST, DELETE)

Examples

Fetch and Save Web Page

$ curl --silent http://boston.com -o boston.html
$ head boston.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Refresh" content="900;url=?refresh=true">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Boston.com - Boston, MA news, breaking news, sports, video</title>

Check Size Without Downloading

$ curl --head http://s3.amazonaws.com/hanselminutes/hanselminutes_0300.mp3
HTTP/1.1 200 OK
x-amz-request-id: 31D80700E3C2811E
Date: Wed, 11 Jan 2012 04:01:35 GMT
Last-Modified: Sat, 07 Jan 2012 02:49:49 GMT
ETag: "1d08609ab5434eea651e95af332ddb3a"
Accept-Ranges: bytes
Content-Type: audio/mpeg
Content-Length: 24474192
Server: AmazonS3

Getting Curl

If you’re running Mac OSX, Linux, FreeBSD, or similar systems, you’ve probably already got Curl installed. (Try curl --version to double-check your version.)

If you’re running Windows, you’ll need to download it yourself. Start at the Curl downloads page and find the Win32 section. I suggest the “Win32 – Generic binary, with SSL” option. You will also need the Windows OpenSSL libraries; I suggest using the “Win32 OpenSSL v1.x Light” installer. Make sure to put both Curl and OpenSSL libraries in the same location, and add that location to your path.

Simple Webservice Echo Test

While troubleshooting some PHP Curl issues, I found and used http://respondto.it/ (and later http://requestb.in/) which allows you to create a dummy webservice endpoint which reveals the full request made to it by your code.

An even simpler use case would be a webservice that simply returned data about the request directly to the calling application. I just created such a simple echo webservice on my scooterlabs.com domain.

Update 2012-03-23: Added XML response example as well (scooterlabs.com/echo.xml).

Plain text example

$ curl http://scooterlabs.com/echo
Array
(
[method] => GET
[headers] => Array
(
[User-Agent] => curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
[Host] => scooterlabs.com
[Accept] => */*
)
[request] => Array
(
[foo] => bar
)
[client_ip] => 68.125.160.82
[time_utc] => 2012-01-08T21:33:28+0000
[info] => Echo service from Scooterlabs (http://www.scooterlabs.com)
)

JSON example

$ curl --silent curl http://scooterlabs.com/echo.json?foo=bar | json_xs
{
"info" : "Echo service from Scooterlabs (http://www.scooterlabs.com)",
"request" : {
"foo" : "bar"
},
"headers" : {
"User-Agent" : "curl/7.21.3 (i386-portbld-freebsd7.3) libcurl/7.21.3 OpenSSL/1.0.0e zlib/1.2.3 libidn/1.22",
"Accept" : "*/*",
"Host" : "scooterlabs.com"
},
"client_ip" : "66.39.158.129",
"time_utc" : "2012-01-08T22:07:54+0000",
"method" : "GET"
}

XML example

$ curl --silent http://scooterlabs.com/echo.xml?foo=bar | xml_pp
<?xml version="1.0"?>
<echo>
<method>GET
<headers>
<User-Agent>curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
<Host>scooterlabs.com
<Accept>*/*
</headers>
<request>
<foo>bar
</request>
<client_ip>68.122.10.221
<time_utc>2012-03-24T17:05:49+0000
<info>Echo service from Scooterlabs (http://www.scooterlabs.com)
</echo>

Source

Source code is up on Github: https://github.com/bcantoni/echotest. If anyone has any comments or feedback, let me know here or on Github.