Archive | December, 2012

“Busy busy BUSY!”

27 Dec

Had a great Christmas here an am looking forward to a stellar New Year.  My brother gave me the gift of knowledge, in the form of a paid course at Udemy.com for Selenium 2 WebDriver Basics.  It uses Java in an IDE instead of a scripting language like Ruby and this course is DEEP!  I’ve already completed the pre-requisite course which is free and available here. I can’t recommend the course enough. There were moments of hair-pulling here and there wrestling with the Eclipse and IntelliJ IDE’s, but the learning that has resulted is well worth the effort. I know have full training/test environments set up on both Mac and PC platforms, with Maven, Ant and JUnit all stitched in properly.

Warm thanks to my brother Scott for this gift and the greater gift of his constant encouragement and inspiration!

Advertisements

Dec 21, 2012 Ruby jam

21 Dec

The results of today’s ruby jam can be admired and even downloaded here.

In this riveting episode I explored Ruby objects, methods, putting a class in a separate file, class methods. populating an array in a loop, formatting with printf and other riotously interesting topics.

Also got to know Git a little (just a little, mind you) better. Found a nice, concise reference guide here which was helpful (if not a tad potty-mouthed ; ) for getting back up to speed.

What’s a Ruby jam?

Why same as a Java jam of course!

It’s just a term I like to use for a little unstructured exploration, starting with an exercise from a book or tutorial and then ‘jamming’ along with whatever ideas I come up with to make it more interesting.  Questions and conundrums arise and then fall with a bit of constructive Googling, hand-wringing and hair-pulling, bringing to light other questions and exciting options to keep the ball rolling.  Fun!

A different sort

20 Dec

Turns out it’s basically a ‘sort’ operator, borrowed from Perl:

results.sort! { |a, b| a.lname <=> b.lname }

In this case, from an example I was studying and expanding upon here, ‘results’ is an array of similar Person objects each of which have an ‘fname’ and ‘lname’ attribute for first and last name respectively.  I wanted to sort them by last name before printing to the screen and found the syntax illustrated above as a solution.  Lo and behold, there’s my little UFO, just in time to sort things out before the Christmas rush and that pesky Mayan apocalypse from Planet X.

Symbol Hound to the rescue!

18 Dec

In pursuit of learning Ruby (and Selenium Webdriver), I found myself wanting an explanation for an operator I saw in a bit of example code:

a <=> b

I tried searching in Google to no avail. The ‘<‘ and ‘>’ characters are stripped out and I wasn’t getting the query results I was looking for.

And then I found this:

http://symbolhound.com/

In their own words:

“SymbolHound is a search engine that doesn’t ignore special characters. This means you can easily search for symbols like &, %, and π. We hope SymbolHound will help programmers find information about their chosen languages and frameworks more easily.”

Just paste it right in there and hit the shiny red Launch button. No fuss, no muss, and constructive answers up the wazoo. Okay, so there’s not really a ‘Launch’ button, but don’t hold this against them. It’s a great sight and really useful!

With the help of SymbolHound I found that the ‘<=>’ (aka ‘UFO’ ; ) operator does exactly what it looks like (?) and tells you if  is less than, equal to or greater than  b,  assuming that  a  is to the left of the operator and  b  is to the right. The response given for each, respectively is -1, 0 or 1. Kind of a Boolean operator with a little extra oomf. I haven’t found a use for this myself as yet, but I’m sure its benefits will become apparent in short order.

For now, I’ll just enjoy it for the cute little UFO it is, arriving just in time for the 2012 clash with the hidden planet Nibiru and the end of civilization as we know it.

Which reminds me. If you celebrate Christmas, may it be joyful and merry to the extreme. If you don’t, then Season’s Greetings and the very best of wishes to you and yours, and a very Happy New year!

Cool, cool Watir

13 Dec

Got a phone call this morning for a potential contract position, and as a result of some of the requirements I’m taking a closer look at Ruby and Watir for web test automation.

Cool stuff!

After the days spent studying Java, this is far less intimidating than it might have been. In fact it’s downright fun! I’ve worked with Selenium a bit in the past and I must say I like Watir a lot better. I never feel very safe with the whole ‘recording’ approach to automating a web interaction. What actually happens after a recording session and what the resulting code looks like is usually pretty disappointing. Not to put that app down though, because clearly a lot of folks are having a great time with it.

I find I’m much more comfortable, myself, coding some basic interactions in a Ruby script, running and tweaking that, and then creating test statements to verify behavior and print a simple report. I’ll be taking a much closer look now at how others are using this in real test scenarios so I can get a better idea of how to scale this up into a more complex environment.

I’m doing this on my Mac right now with Firefox, but will be working with the PC later this afternoon. The job prospect is .NET which I’ve worked with in the past but most of my recent experience is with UNIX and Java, so I’m catching up on that as well.

I’m really pleasantly surprised by Watir. I can see using this right off the bat to really accelerate my manual testing, setup for special scenarios and so on. Great stuff. Down the road I can see doing extensive regression testing and tying it all together with something like Hudson or Bamboo. More on that as it develops.

Log *THIS*

12 Dec

I was a rather dis-spirited on java a couple of days ago when trying to get log4j working with a small test program at the command line (rather than app server) level. Nothing was working, I didn’t understand why and the world was a very dark and unfriendly place.

Started fresh today and realized that there’s a lot more to setting up log4j than just getting the jar file in your CLASSPATH. I had to create the log4j.properties file and put it in a directory visible to the CLASSPATH. I now have my very on ‘conf’ directory which is the proud container for my log4j.properties.

WE HAVE LOGGING!

Granted, it’s just a simple tutorial app to spit out a few lines on demand, but still, WHAT A FEELING!

Soon, I’ll be able to  tail -f  and watch my mistakes scroll by at lightning speed. Now THAT is going to be cool. I may give up all my other hobbies at that point. Parsing through my own prodigious output is going to be just too much fun!

(Waitaminute…did that sound a little off to anyone else, or is it just me?  Anyways…)

I also learned a bit more about Java packages today, from the Big Java book. Learned a lot more about why they are named the way they are.

Things like:

com.this.that.the.other.thing

…are now actually beginning to make sense. I create my own packages now based on my email as suggested by the book:

com.rcn.kwood.log4jTest

Whaddya think? You’ve got to admit, that’s some package I’ve got there!

Waitaminute…

;)

Now GIT!

10 Dec

Wow. Feeling fairly comfortable with the basics of CVS, but it gets deep fast. Still wrapping my head around what it means to merge code and how that works/looks in the real world. My online studies of CVS lead me to explore Git as well, a newer content repository system championed by Linus Thorvalds himself. I’ve explored GitHub.com and created a couple of test repositories of my which you can check out in all their shining glory here.

Git, so far, seems much more something that I would/will be using myself than SVN or CVS. Of course what I want to use and what potential customers and employers want to use is something altogether different, so I will continue getting familiar with SVN and CVS as well.

I really like the ease of getting set up with Git, and the way it can be used for much more than code.

I did have trouble, however, getting a sample repository set up from the command line alone. It kept behaving as though I were typing the url wrong, which I probably was, but I couldn’t quite get to the bottom of it and ended up creating the ‘FearOfJava’ repo manually via the web site as well, whereas I had originally intended to do it all via the Linux command line. Once I created it on the site, I copied the exact url they gave me there, cloned the empty repository via the command line, and now I can add files, commit and so on without a hitch. I’ll hafta sort out those details as time allows.

Right now it’s time for more (Big) Java. The book is getting really interesting now as we go deeper into designing classes (chap 7) and the unit testing and debugging in chapter 8.