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!

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.

A quick trip to CVS…

6 Dec

Did some more Java practice today from Big Java, but am now taking a break to explore CVS (the content management system, not the store ; ) on my newly-risen Ubuntu Linux laptop.  I’ve also got Java and Eclipse set up on that (usually I’m working on my little Macbook Pro, which I’ve come to really love) and it’s working like a charm.

I’ve used CVS and Subversion in the past as a QA tester, but am now looking at it from an administration and development perspective in order to get a better understanding.  I’ve done some of the more basic tutorials on the web which have answered a lot of questions and raised a whole lot more.  I’m now delving into Open Source Development With CVS and learning it from the ground up. Later I’ll do the same with Subversion, and find ways to apply either one or both to my own coding efforts. Fun!

Addendum: After working with the material for a couple of hours, I must say that this online (free) book is PHENOMENAL! If you’re looking to get to know CVS yourself, don’t miss it. So many questions have already been answered, and the way the authors approach the topic makes much more sense to me than the tutorials I did earlier. You’ll want to skip briefly to the administration section to get your repository created, and then continue with the Basic Concepts chapter. Great stuff.

Groovy!

4 Dec

It’s another day and time to get another dose of Java into my system.  I’m using the book Big Java by Cay Horstman (1st Edition) which, as mentioned in an earlier post, was found at a local thrift shop for the (thrifty) sum of one dollar.  So far it’s been a great follow up to the Beginning Programming With Java which gives a quick, fun over-view.  Big Java hits all the same targets but in much greater depth.  On the menu today in Chapter 5 is decisions, if statements, code blocks, comparisons and so on.  All stuff I’ve touched on before, but the examples in this book are a good bit more involved, and the review is really helping to drive home my understanding of how these things are done.  The book is also helping me get in the habit of putting in comments and formatting them so that they will respond to the javadoc utility.

I’m using vi as my editor now instead of Eclipse.  It’s been a blast learning to use the IDE, but I think it’s better for me at this point to really get a feel for each and every line of the code, where the files go and so on, without an IDE holding my hand through the process.

I almost forgot about the title of this post.  I was perusing my Groovy In Action book recently, which I’m holding off on studying until I get a bit more comfortable with java basics, and was very pleased to find that with what I’ve learned so far it’s already making a great deal more sense to me.

I was also playing earlier with taking some of my java code and replacing the .java suffix with .groovy and then running it (without compiling) as a Groovy script.  Pretty cool!

All for now.

-Kent