Monday, October 31, 2011

UNIX/Linux to Perl

I like this article from perlmonks.

http://www.perlmonks.org/?node_id=627015

It shows UNIX/Linux commands and their Perl equivalents.

Thursday, October 27, 2011

Behavior Driven Development

Last night I went down to Draker Laboratories on Pine St. for a presentation on Behavior Driven Development.  The presentation was by Pete Brown in affiliation with "Burlington Web Application Group (BWAG)".

The presentation was excellent and there was a lot of good participation and feedback.  Here are my main takeaways from the presentation.

There were really 2 main topics, test driven development (TDD) which seems to focus on automated unit tests and behavior driven development (BDD) which seems to focus more on automated functional/user tests.  Think of it as automatically testing agile user stories.  If you do TDD well, you are probably doing BDD also.

There are tons of benefits of both of these strategies, but the ones that I liked were how you can get much better decoupled code as a result.  Decoupled code is much easier to reuse.  Also if you create your functional tests first (before writing code), it helps you analyse your requirements.  Then write your unit tests.  Then write your code.  One obvious benefit is code with fewer bugs ;)

When writing code, FAIL the test first.  Then make it work.  Then refactor and repeat.  This is known as the Red, Green, Refactor cycle.

A product called Cucumber was highly recommended for BDD which is a tool that allows you to create user stories and acceptance tests (think agile) and automate the testing of these.  Cucumber works with most languages.  (You can use Jasmine for javascript).

Having said all this, QA starts with developers but definitely does not end there.  You still get a lot of value from real user testing and testing by subject matter experts (SMEs).

Pete mentioned a book called "Refactoring" which came highly recommended.

Another topic that was mentioned was "continuous" testing, which means the minute you change the code, the test is run, so you can get instant feedback.

Finally, Selenium was mentioned as an automated browser testing tool.

There is more I could say, but these are some of the highlights.

Monday, October 24, 2011

Git Amended Commit Issue

I ran into an issue with Eclipse and EGit.  I did an amended commit and tried to push upstream.  The push failed with a really generic error message.  Luckily the answer is really easy, thanks to RIP: pull first, then push your amended commit.

Wednesday, October 19, 2011

Git is Awesome

We started using git at work and I love it.  Specifically, we are using EGit with Eclipse.  I love how it does not operate a file at a time and how you can commit as much as you want, saving push to upstream for when you are ready to "share".  I'm still getting used to the lingo, push, fetch, pull, etc.

Wednesday, October 12, 2011

Dojo charting Tooltips

It took me a while to get the tooltips working on my chart.  There was no definitive answer anywhere.

What I found is that in dojo 1.6.1, you need to do the following:

  1. dojo.require("dojox.charting.action2d.Tooltip");
  2. chart.addSeries("seriesName", chartData, {plot : "default"}); // Here you have to make sure chartData is an array of objects like this [{y: 1234, tooltip: "Tooltip text 1"},{y: 2000, tooltip: "Tooltip text 2"}]
  3. tooltip = new dojox.charting.action2d.Tooltip(chart, "default");  // Where default is an already defined plot and chart is also already defined.
  4. chart.render(); // You MUST declare the tooltip before adding the chart.
I read some stuff out on the net that you have to create a div or add dojoTheme: true to your dojoConfig.  From what I did, neither of these are required.

I also read that I have to use a theme.  I am already including and using claro, so maybe that requirement was already met in my app.

Good luck.  I hope this helps someone.

Tuesday, October 11, 2011

Eclipse is Awesome

I'm sorry, but Eclipse is just plain awesome.  I wanted to do ssh right from Eclipse and after a quick google search, here I am editing code and running it in ssh in the same IDE.  So cool.  No plugin required.

Friday, October 7, 2011

Dojo Charting Woes

Man oh man.  I wish dojox.charting worked better.

I have a chart with 2 different types of plots, and several "Series" for both of them.  It's a stacked bar chart with a few marker lines also.  My page allows the user to regenerate the chart.  Unfortunately for me, the dojox.charting.widget.Legend does not update when I regenereate the chart, even if I call legend.refresh.  There is a solution on the net for this, but even the author admits, it is a bad workaround.

I found a solution.  Here's the code:


if (chart == undefined) {
chart = new dojox.charting.Chart("chart");
} else {
chart.removePlot("bars");
chart.removePlot("lines");
}
...
chart.render();
...

if (legend != undefined) {
legend.destroyRecursive(true);
}
legend = new dojox.charting.widget.Legend({
chart : chart,
horizontal : false
}, "legend");




Also I found that dojox.charting.widget.SelectableLegend does not work with my chart.  I think it is the multiple different types of plots that is messing it up.  If I un-check an item in the legend, the wrong bar/line is removed from my chart.  Whoops!

Thursday, October 6, 2011

Firebug won't delete a breakpoint

I kept running into this issue where Firebug 1.8.3 in FireFox 6.0.2 was not removing my breakpoints.  It removed the red dot, but continued to break at that line of javascript code anyway.  Even "Remove all breakpoints" did not help.  I found something that DID help.  You need to find and rename/remove your breakpoints.json file while Firefox is closed.  Mine is located here (Windows 7):

C:\Users\me\AppData\Roaming\Mozilla\Firefox\Profiles\2ziq4yrx.default\firebug\breakpoints.json

Tuesday, October 4, 2011

Rant #1

My iPhone 3G has gotten ridiculously slow. It's only 2+ years old.

Blogger for iPhone does not have horizontal keyboard.

Facebook on iPhone and iPad is slow and/or lacking features. On the iPad, you can't upload a photo.

Google docs is horrible on iPad.

You can't attach a google doc to an email in gmail?

What gives! Where is convergence?

Monday, October 3, 2011

Javascript JSON Query Languages

Here's a good link for Javascript JSON Query Languages.  The point here is to have a in memory data model of arrays, hashes, and objects and be able to perform SQL-like operations on them like select, join, union, order by, group by, etc.  Don't you wish your favorite javscript framework had this functionality already?