Showing posts with label explanation. Show all posts
Showing posts with label explanation. Show all posts

Tuesday, August 13, 2013

Making Chainmail

I've decided to make a set of chainmail. Ever since high school, I've known people who had either made or were making a set and I'd always wanted to give it a try. Finally, last weekend, I went and bought the equipment and materials that I would need to get started.

I've read about how to do it extensively and it was just a matter of getting started. Here's what you need to make chainmail:
- Wire. I chose 14 gauge aluminum wire. I plan to also get some copper, brass and maybe colored aluminum wire in the future to add some color and style to the armor.
- Wire cutters. Choose good, strong cutters with a nice grip. You'll be using them a lot to cut the rings and you want something that will last a long time and be comfortable to use.
- Steel Rod. You'll use this to wrap the wire around to make the rings. I bought a 4' long rod, but I might suggest a 3 or 2 foot rod instead as it can be hard to wrap the wire by yourself with that long of a rod. My rod is 3/8" in diameter, but I've read about people using other diameters.
- 2"x4" board. You'll build a contraption with the boards to hold the rod while you're wrapping the wire around it. I had some scraps in my garage that I used to build mine.
- Drill. You'll probably need this to build your contraption and also to help you wrap the wire around the rod.
- Gloves. You'll want at least one glove to protect your hand while wrapping the wire. Don't use gloves that have a rubber grip as it will stick to the wire and could get your finger stuck in the wrapped wire. Believe me that this hurts a lot.

I'm not going to go through all the steps, there are tons of tutorials out there from people with more experience. If you're interested, go check some of them out.

I started with the plan to just make a bracelet for my daughter, but it turned out to be so easy to make a chain that I just kept on going. My first attempt at wrapping the wire didn't go very well, I almost cut my finger off when it got stuck in between the wire and the steel rod when my gloves stuck to the wire and pulled my finger in. Ouch. Also, I had trouble keeping a constant gap, but I didn't have to throw away too much of my first attempt. I made 103 rings in my first attempt. I haven't had a second attempt yet, but I think I'll get to 115-130 or so rings when I do.

Here are shots of my progress. Stay tuned for updates!

My wire wrapping contraption
My first attempt made 103 rings.
My first two sets of five rings.
Connecting those two sets.
My first chain!




Thursday, July 11, 2013

Basegolf

I've been trying to get my kids exposure to baseball by hitting whiffle balls and tennis balls to them at the park. Well, the other day they weren't interested in running around and chasing balls, so they decided to play at the park. I didn't want to do that, so I started hitting the whiffle ball and tennis ball around the open space at the park.

After a while I started to make a game of it. I hit the tennis ball as far as I could, then tried to get the whiffle ball to it in as few hits as possible. It hit me that this goal was the same as golf, so I started making a few rules and came up with Basegolf.








Here's what you need to play:
1 baseball bat
1 whiffle ball per player
1 tennis ball

I'm using an aluminum bat, I don't know how a wooden bat would effect the game since I don't own one. If you try the game out with a wooden bat, let me know how it works out!

The rules are simple and designed for solo or group play.  The game is best played in a large space with some obstacles, but probably not a heavily wooded area.

You start the game in one corner of the area you intend to play in.  Make sure all players know what the out of bounds, or foul territory will be as if they hit a foul ball, it will cost them a stroke.  You may decide, however makes sense to you, who goes first. That person will take the tennis ball and hit it as far or close as they want.  The tennis ball is the "hole" that the players must hit their whiffle balls to.  Players take turns "teeing off" by throwing their whiffle ball into the air and hitting it towards the hole.  Then, the players farthest away from the hole take turns hitting until everyone has "sunk" their whiffle ball.  A whiffle ball counts as getting into the hole when it is within a bat's length of the tennis ball.

Once everyone has finished the hole, the next player will hit the tennis ball from the point it landed for the prior hole.  If the tennis ball is in the middle of the play area, and all players agree (or a judge if you have one), the hitting player may chuck their whiffle ball in any direction and hit the tennis ball from where their whiffle ball lands instead of from the spot of the prior hole.

Putting: You can putt by leaving your whiffle ball on the ground and hitting it with the bat.  I've considered making a rule about how you can't putt unless you're on the "green", but I haven't decided what the definition of the green would be.  If you have an idea, leave it in the comments.

Foul balls: As I mentioned before, the play area has a boundary.  Balls hit outside of this boundary are considered foul and cost the player a stroke.  They will drop the ball at the boundary where the ball left fair territory for their next stroke.  This changes a little for the tennis ball.  Instead of a plain drop, the player must make an underhand throw from the boundary.  This still causes the player a stroke.

Whiffs, Strikes and Biffs: If you don't know, a whiff is when a player misses hitting the ball when they throw it up to hit it.  This is a strike.  When you get three strikes, it costs you a stroke.  A Biff is when you hit the ball and it goes less than 10 feet.  This is a strike and you must try to hit the ball from where you started.

Finishing the game: The game is done when the players want it to be done.  The players can agree beforehand on a number of holes, or you could play the standard 9 or 18 holes like in golf.

Scoring: Count the number of strokes it takes each player to sink their whiffle ball in the hole.  At the end of the game, the player with the fewest strokes wins.

Par: I consider Par an optional rule as it can be hard for a group to agree on what the par should be on a particular hole.  It would be easier if you have a judge, I guess.

Strategies: I've considered a few strategies as I was playing by myself.  One, hit the tennis ball as close to foul territory as you can without being foul.  This has risk, but could be good if an opponent hits foul trying to get to the hole.  Two, utilize obstacles to make getting to the hole harder.  Also risky, but if you're confident in your skills, might be worth it.  Three, bunting or "pitching" can be a good tactic when you're too close to swing away and too far to putt.  Leave any other strategies that you come up with in the comments!

I've played Basegolf a few times by myself, but I think it would be fun with a partner or group.  One warning, I've already broken one whiffle ball in half with my aluminum bat, so that's something you've got to watch out for.  Try out the game and let me know if you enjoy it!

Wednesday, July 10, 2013

Geekonablog News

I can't believe that I haven't posted since April 23rd.  It doesn't seem like it was that long ago, but I guess that I've let things go around here for a while.

Well, let me tell you what's been going on in my life.  In April, I started on a new team at work, which I mentioned in my last post.  We're creating a new web page configuration app for the new web platform that Best Buy (me included) has been working on for over a year.  You may have noticed changes to Best Buy's product pages, I had a hand in that work and now I'm on the team that is going to allow more pages to go to the new cloud-based platform by having a tool to configure those pages that isn't based on the old platform.  I know that this description is a little hand-wavey, but I'm not sure how much I should be sharing.  I figure that just mentioning I'm doing this work is safe enough.

Since April, my family and I have gone on two vacations.  The first one was with my family and...my family.  Meaning the family that I started with my wife and the family I was born into (mom, dad, brother, sister and her family).  We stayed at a cabin that my sister found online.  It was awesome!  Fishing every day, hanging out, playing games, relaxing.

The second vacation was camping at the Hayward, WI KOA.  We stayed there three days and two nights with some friends.  I've stayed at that KOA and the Hixton, WI, and I would recommend either of them for anyone looking for a good time.  They have plenty of activities and they are reasonably priced.  We stayed in a small cabin (basically four walls and beds).  When the kids grow up a little, we'll probably try it with a tent.

Other than that, it's summer, so some more fishing, swimming, working in the yard, etc.  Busy, busy.  I have missed writing here and writing stories.  I've been wanting to get back to some of my serial stories (Uroth, Candy Land, maybe even Thaw Deal).  I've also wanted to do more Chuck Wendig challenges, but haven't had any weekend time to do those.  Look for something (hopefully) soon.

In the non-fiction realm, I think I might write a post about Pair Programming.  I used to be against the concept, but my new team does it and I think that I can see the benefits, but more on that when I write that post.

Tuesday, April 23, 2013

Using FreeMarker Templates in a Grails App

I've started in a new team at my job.  We're creating an admin system that is going to take the functionality of several disparate systems and put them all under one UI.  Since we're writing a whole new app from scratch that will interface with existing systems, we had our choice of technologies (within reason) and frameworks.  We ended up choosing Grails because we figured it would be easy to integrate with our other systems and provide us with easy to create RESTful services.

One of our requirements was to use FreeMarker to generate the HTML of our UI.  This is a  requirement because we're using FreeMarker in other areas and we've created a development tool that uses FreeMarker in addition to other front end technologies (JS, SASS).

The problem is that Grails wants to use GSPs (Grails Server Pages), which are like JSPs (and, in fact, compile down to JSPs).  Grails has the ability to incorporate third-party plugins into your project, and there's a FreeMarker plugin for Grails.  Unfortunately, the plugin was made for Grails 1.2 and we're trying to use Grails 2.2.1.  I tried for two days to try to get the FreeMarker plugin to work, but it just didn't seem to do anything.  It was a frustrating situation.

Having read a lot of Grails documentation over the last few days, I found that you could configure Grails similarly to how you configure a Spring application.  You put that configuration in the resources.groovy file.

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver

// Place your Spring DSL code here
beans = {
 freemarkerConfig(FreeMarkerConfigurer) {
  templateLoaderPath = "/"
 }
 viewResolver(FreeMarkerViewResolver) {
  cache = "false"
  prefix = "bin/freemarker"
  suffix = ".ftl"
  exposeSpringMacroHelpers = "true"
 }
}


Spring configuration is, of course, XML and this is a Grails closure.  That part wasn't hard to convert.  You can find an example of how to configure FreeMarker in a Spring app looks like, here.  The only other thing we had to do was to put the line below into our BuildConfig.groovy file.

dependencies {
 ...
 runtime "org.freemarker:freemarker:latest.release"
 ...
}

Now, the only thing we had to figure out was where to put the FreeMarker templates.  At first, we had them in our views folder where the GSPs went, but we were getting 404s when we ran the app.  After some debugging (thanks Roy for helping debug!) we figured out that the template loader was looking for the templates in the web-app folder.  That was easy enough to fix, we copied our templates from the views folder over to the web-app folder.  After that, everything worked just fine!

So, to recap, we added a typical Spring configuration to the resources.groovy file, added the FreeMarker jar as a runtime dependency in the BuildConfig.groovy file and put our templates into the web-app folder (in the folder configured in the prefix of the viewResolver).

The solution was frustratingly simple after we figured it out.  I wrote this post because I researched and experimented on whether this was possible or not for over two days without any success.  Hopefully this helps anyone else who is trying to use FreeMarker in their Grails app.

If you're like me, though, you want to see more.  Here's an example of a generic Controller:

class ApplicationController {

    static defaultAction = "show"

    GrailsApplication grailsApplication

    def show() {
        [model: [version: getAppVersion()]]
    }

    private getAppVersion() {
        def metadata = grailsApplication.metadata
        return metadata['app.version']
    }
}

It has one public method, show.  We want that when you navigate to /app-name/application or /app-name/application/show that it displays the version of the app.  I created a template, /web-app/application/show.ftl.  Now, the template contents are:

hello world<br>
${model.version}


When I navigate to /app-name/application/show, I get:




Which is as expected.  Pretty slick.  We're still at the beginning, but this should allow us to borrow front -end devs from other teams since they'll already understand the view technology and we'll be using the same tools that their teams use.

Tuesday, February 19, 2013

History is Repeating Itself...Again


The Internet is like the Caribbean in the Sixteenth Century.  No, I don't mean it's full of Spaniards, French and Englishmen, though they are present on the Internet too.  I mean that the Internet seems to turning into a lawless area prone to increasing levels of conflict.  I'm not talking flame wars here, people, but rather "cyber war".  I personally don't like that term, but I'll use it because I don't have a suitable replacement.  If you read the article I just linked, you'll read an us versus the world story, but the whole time I read that article I couldn't help but draw links to a time centuries ago when the Spanish were probably saying much the same things about the English and French.

The Spanish were constantly shipping silver from Mexico to Spain and their rivals and independent entrepreneurs wanted in on that action.  Eventually, piracy became a huge problem in the Caribbean and led to several wars between the European powers as they fought to control shipping in the Atlantic and Indian Oceans (not to mention their religious differences).  Eventually, things settled down when England emerged as the biggest naval power in the Caribbean and shut down most pirating organizations there.

I've been reflecting on similarities between that period and now.  Right now, on the Internet, it seems that there are lines being drawn and sides taken in this new free-for-all battle happening on the Internet.  The US is on one side, Iran, China and Russia seem to be on their own sides.  Everyone seems to be attacking everyone else out there right now, much like in the sixteenth century in the Caribbean.  If you read the history of piracy there, you'll note that players came and went and eventually, England won out by outlasting the competition.

That could happen with the Internet, too, and brings up several questions.
-Do we really want it to go that far?
-How much virtual destruction, theft and damage will happen if we let it play out like it did in the Caribbean?
-Would there even be an end to the "cyber war"?
-How will the cyber war play out in the real world?
-Will it cause real wars, much like piracy in the Caribbean caused (and was caused by) real wars?

I don't know the answers to these questions, but I would like to posit some guesses.  First of all, I don't think we want events to run like they did in the Caribbean.  We don't want a long period of conflict that only works itself out when one power can dictate how the others will behave.  That path would mean incalculable damage to the world economy and leave one nation in control of Internet security or governance.

That is assuming that one nation (or a coalition of nations) could even win the struggle.  In the modern world, that would mean that the conflicting nations would probably have to fight a real war, or find a way to control an enemy nation's Internet infrastructure (not likely).  I do think that large scale cyber wars would be likely to spill into real world conflict.

For example, let's say that Iran manages to bring down our nation's power grid (not that I'm saying that's possible).  We would go through some amount of time recovering from the event and then figuring out who was responsible.  Do you know what would happen after that?  We'd invade Iran and I don't think there's anyone in the world who thinks that their military really stands a chance against ours.  What would that mean though?  It would be like Afganistan and Iraq all over again.  There would be a long period of occupation and fighting a guerrilla war against foes who have all the time in the world to kick us out and a population motivated to see that happen.

Switch that to China or Russia.  Say one of them decided to initiate a full-scale cyber war against us.  We'd duke it out on the Internet, and then someone would end up declaring war in the real world.  I don't think that anyone really knows how a war against Russia or China would end up, but it wouldn't be pretty and could even end up in Nuclear War.  None of which I'd be excited to have to endure.  Hell, switch it to England or France and you're likely to get the same outcome.  They are our allies right now, but things change.

This line of thinking makes me think of the Chinese curse, "May you live in interesting times".  These are interesting, and scary topics.  I wish I knew what was going to happen, or even what was likely to happen.  I only know that I want things to go smoothly and peacefully.  We'll see if that can happen.

It also makes me think of the far future, when we start mining Near-Earth Objects.  Will space piracy be next?  At least with that, we do have a direct historical reference and not an inference, but would events play out any differently than they did in the sixteenth century?

Tuesday, February 12, 2013

What it Means to be a Consultant


It occurred to me the other day that a lot of people don't really know what I do and how it's different from what a lot of other people do in the IT industry.  If you want a detailed definition of IT, you can go here.   Basically, we make computer systems that do the things we're asked to make them do (most of the time!).  This industry consists of more jobs than just developers and engineers, but I'm not going to explain about the different jobs because it's unimportant to the topic.

I've been working in IT for over seven years now.  For most of that time, I've been a Consultant.  What does that mean?  It means is that I work for a company who sells my services to another company for a fee.  As a Consultant, I have a full-time job independent on whether or not my company has a contract to sell my work to another company.  This is an important distinction from other people who work in IT.  There are three other groups: Contractors, Full-time Employees (FTEs), and Offshore.

Consultant vs. Contractor

Contractors are people who contract directly to the customer, without an intermediate employer, like I have.  This normally means that the Contractor is taking home more pay, but they are not receiving any benefits (i.e. insurance).  Contractors, by definition, are bound to a contract with their customer, but once that contract is complete, they can either renew the contract (assuming their customer wants that), or move on to another customer.  This is similar to me, but my employer also has a say in where I go.  Contractors typically have to find their own gigs, or pay a placement agency to do so for them.  My employer finds my gigs for me and pays me a full wage when I'm on the bench, if they can't find anything for me.  When a Contractor doesn't have a gig, that person isn't earning a wage.

Consultant vs. Full-time Employee

The first similarity is that a Consultant and an FTE are both fully employed, complete with benefits.  When I'm working for a customer, I behave like that customer is my employer.  When most people ask, I don't say I work for Daugherty Business Solutions, I say I work at Best Buy as a Consultant from Daugherty Business Solutions.  If I'm in a hurry, or don't want to confuse the issue, I just say that I work at Best Buy.  This is also becomes one of the hardest parts of being a Consultant.  When it's time to leave one customer for another one, I've already developed an affinity for the workplace and the people who I have worked with there.  I've worked at eight different customers in the seven years I've been a Consultant.  I'm still in contact with people from those customers through Facebook, or Twitter, etc.

Consultant vs. Offshore

The main difference here is that I work at the customer's location.  Offshore people are typically employees of a company located away from the customer's location (either in another country, or another part of the same country).  As such, I get a lot of face-to-face interactions that the Offshore people don't get.  From my experience, this helps me produce better results.  I've worked with Offshore teams before and the results are always hit or miss.  The main benefit, of course, is that the costs of Offshoring are greatly reduced compared with what a company will pay for my services.  This is a real, calculable benefit, but you should also pay attention to the adage, "you get what you pay for".

Why am I a Consultant?

A Contractor makes more, so why be a Consultant?  There are several reasons for this.  I'm lazy and don't want to have to find my own employment and I'm too cheap to pay someone to do that for me.  Also, I don't have to worry about having a gap of employment when my current contract ends.  If my employer can't find something right away, they'll put me on the bench and I'll do some internal work until they find something.  This is the biggest benefit to me.  The bench is no fun, but I'm still getting paid and I can use the time to improve my skill base or bring some value to my employer through an internal projects.

You can get stability from being a Full-time Employee, why not do that?  Stability there comes with a price, monotony.  If I end up not liking a customer for any reason (commute, people, atmosphere, etc.), I can request not to be renewed there when the contract is complete.  As stated before, I don't have to find a new job then, I can just wait until my employer has found one.  Also, not every company uses the same technology stack to develop their systems.  Moving from one customer to another can increase your skill base and your personal network.

As for Offshore, until companies in the US start selling Offshore services to India and China as their labor costs increase, I'm not going to even begin to think about that.

Summary

Overall, I'm happy with my current role as a Consultant.  I could see myself doing something else, but I just don't think that I'd be as happy in those roles as I feel now.  I have good flexibility, careeer mobility and stability.

Wednesday, July 11, 2012

DIY Climbing Wall


In our backyard we have a pretty nice playset that has been estimated to be at least ten years old and maybe even older.  As such, some parts of the playset are in need of repair or replacement.  Last year, we re-stained much of the structure (some of which looked like it hadn't been stained before) and tightened all the bolts.  This year we had our sights much higher.
The old ramp
The ramp into the playset was starting to fall apart.  Years of water and ant damage were starting to get us worried about the safety of the ramp.  Since I've always liked rock walls, we decided to replace the ramp with a rock wall entrance to the playset.  For our kids' birthdays (both in July), my mother-in-law ordered a rock wall from the original manufacturers of our playset.  It cost $600 and didn't quite fit our playset since it's so old.  We decided to return it (the installer took it back instead of installing it) and decided to build our own.  Along the way, I learned a lot about what to do and what not to do.  Hopefully, this helps some of you if you are ever in this situation.


I started with a basic design in mind.  I would have two 4x4 supporting posts and several boards to mount the climbing holds onto.  I bought:


  • 2 - 8' long 4x4 posts
  • 2 - 8' long 2x12 boards
  • 2 - 8" long carriage bolts w/washers, nuts and caps
  • a 1/2" drill bit (I didn't have one that big before)
  • sandpaper for my sander (I had run out)
  • a 4" paintbrush for staining
  • climbing wall hand holds


All of this stuff cost less than $150.  The other supplies I already had were:


  • a circular saw
  • a small sander
  • wood screws
  • a drill (with drill bits)
  • wood stain
  • a hammer
  • a small level


Day 1 - Sunday evening.  First, we went shopping and bought the wood.  When we got home, I started by measuring the opening that the old ramp was waking up and cutting the 2x12 boards to just under that width.  Next, I measured the height that I wanted the posts to be and I cut those out as well.  I started sanding the boards and posts, but ran out of daylight.


Day 2 - Monday evening.  We took my kids to get the bolts and handholds.  Getting the handholds was the hardest part.  First we went to REI because I know someone who built a climbing wall and they had gotten their holds there, but apparently REI recently stopped carrying them in there stores (sold online only).  After that we called: Fleet Farm, Gander Mountain, Home Depot and finally, Menards.  Generally, I'm not a big fan of Menards, but they did save us from having to order the holds online and having to wait to finish building the wall.  So, we bought the hand holds and bolts there and went home.  I finished sanding the boards and put a first coat of stain on the boards and posts.  The stain is very quick to dry, so I got to start assembling the wall.  I used wood glue and wood screws to put attach the boards to the posts.
The wall after the second coat of stain
Day 3 - Tuesday evening.  I started by putting a second coat of stain on the assembled wall.  After that coat dried, I removed the old ramp from the playset.  It was then that I discovered the colony of ants living in the base of the ramp.  After the ramp was out of the way, I dug out some of the rocks where the bottom of the wall would rest and put the wall in the opening.  I drilled the holes for the carriage bolts through the wall's posts and the posts on the playset.  After securing the bolts, my wife and I started deciding where the hand holds would go.  Attaching the handholds was very frustrating.  The screws that came with the holds were the worst quality that I'd ever worked with.  They would strip almost immediately if I put any more than the minimum amount of torque that my drill had.  If you have a choice, avoid climbing wall handholds made by PlayStar, Inc. out of Janesville, WI.  Or, use different screws as they ones provided are horrible.  Once the handholds were attached and secured, I tested each of them by briefly hanging some of my weight on them.  None of them budged, so I okayed a test climb for my daughter who was eagerly waiting to use the wall.  You can see the results, below.

Daughter, Kate, first time climbing wall
Overall, I'm very pleased with how this turned out and very satisfied to have saved $450 over the price of the manufacturer's climbing wall.  Plus, I always enjoy building things myself and getting to use my power tools is always fun.




Attached and awaiting hand holds


Attaching hand holds


After handholds attached

Thursday, May 24, 2012

Javascript TDD/BDD/Unit Testing


I've been doing some pretty cool stuff at work lately and I think it's time for me to share some of the cool things that we're doing.  Web development isn't anything new, I've been writing HTML since I was 12 years old, but it has changed quite a bit since I wrote my first, very simple, web pages.

Another thing that isn't new for me is Javascript, but I never really got that into it or relied on it to do anything powerful.  Since starting at Best Buy, I've really gotten good at Javascript and have realized that it is quite powerful and can do a lot of good for a website.  I've also realized that it can also do a lot of harm to a website.  One thing that a lot of people omit from Javascript development is testing.  A lot of people consider testing their scripts in the browser to be adequate for their purposes.  I disagree.  Coming from back end systems, I know that thorough testing is very important and I think that this is a component of front end systems that has been lacking across the industry.  That being said, there are ways to automatically test your Javascript without using a browser.

One of the goals of the team I'm on is to introduce an automated testing tool to test Javascript automatically when the project is built.  Our build is written using ant, which I hadn't used since college, but since it's well documented, I didn't have any trouble picking it up again.  Also, I'm using Eclipse as my IDE, so it supports ant syntax highlighting and parsing, which is very helpful.  Ant is very powerful, but since it's written like XML, it can be hard to write complicated constructs like looping and conditions, but we've made it work for us, so far.

I was put in charge of incorporating Code Quality tools into our build.  At first, this was a little overwhelming.  I was just starting to get good at Javascript development and didn't have any experience with testing tools for it, but I started doing research on the internet and quickly found some testing frameworks that I didn't think would be hard to incorporate into our build.  We settled on using Jasmine and I worked on finding a way so that we could call our spec scripts from our build.

This started the frustrating part of our journey.  The people who built Jasmine don't support the different ways to launch the tool (like from an ant build), but only the framework itself.  Okay, I can overcome this, there are some open source tools that I can use listed right on their page.  I started with Jasmine-Node since we were using Node.js for our local web server to test our pages.  I quickly realized that this wouldn't work for us since Jasmine-Node doesn't create a DOM and a lot of our Javascript relies on a DOM in one way or another.

My next attempt was to try Node-Jasmine-DOM.  It has DOM support and Jasmine integration, so I thought I was getting close.  I incorporated it in the build and got it to run in the browser, but there's an aspect to Node development that I didn't realize until it was too late.  Node makes it really easy to use other Node tools as dependencies in the tool you are building.  This is great for reuse, but dependencies are called that for a reason.  One of the dependencies that the Node-Jasmine-DOM tool used had a defect in it and that was blocking our scripts from being tested in the build.  I waited patiently for a couple of weeks after submitting the bug to the owners of the dependent tool, and there was initially some good back and forth about it for a while and someone submitted a workaround for the bug.  I was excited and tried it out on my machine, but their workaround didn't work for mem (in Mac OSX), but worked in Windows.  I went back to the forum and they had closed my defect, so I commented that the workaround didn't work for me and I needed another way to make it work for me.  Another week of waiting without a response and I decided to pursue another way to run our tests.

I started my new search by trying to find a tool that would run Javascript straight from a command-line.  I would do myself what Node-Jasmine-DOM was trying to do (create a DOM and insert Jasmine).  Enter Rhino and Env.js.  I found a blog that had done this before and I was all set.  It took me less than a day to incorporate these new tools into the build and I was immediately running our specs from the build.  At the same time that I was ecstatic to be finally done with this, I was very frustrated that I had wasted so much time trying some of these other tools.

For those curious about what exactly I did, read on.  For those who don't want the technical details, thanks for reading this far!  This next part may not be for you as it will be pretty technical.

Our test target in our ant build does a few steps to run the spec scripts.  The first step is to identify the pages that need testing and has some logic built into it for that.  The next step is to convert these pages into spec runners (example), this means that I needed to insert references to our spec.js files and the Jasmine Javascript files.  Since I wanted to test the Javascript on the page, I just copied the page, changed the extension to *.runner.html and inserted the appropriate spec and Jasmine scripts.

The next step that the build does is to get the list of runner files and run them.  I created an ant macro for this step.  The Build-Doctor guy provided the envjs.bootstrap.js file that I started with, but later customized.  His was very simple and was basically just a for loop that told Envjs to load a page.  I found that that wouldn't work for more than one runner, so I changed it a bit to reload Envjs at the beginning of the loop and then load the runner file.  I also added some console.log entries so that the build is more vocal about what it's doing.

Here's where I got a little bold and changed the Jasmine.js and Env.js files to eliminate some extra console.log calls that I didn't feel were required and I added some in a couple of places where I wanted visibility.  In the end, it looks great in the build and it creates JUnit style reports that our Jenkins CI server can interpret.

I was planning on covering the other major aspect of our build, Freemarker, but this post is getting pretty long, so I'll save that for another day.  Below are some examples of what I did in our build.

This is the macro I wrote in our ant build.
<macrodef name="runRunnerList">
 <attribute name="runnerList" />
 <sequential>
  <echo message="Running files: @{runnerList}" />
  <exec executable="java">
   <arg line="-jar ${dir.lib}/java/js.jar -opt -1 lib/javascript/envjs.bootstrap.js @{runnerList}" />
  </exec>
 </sequential>
</macrodef>
This is the results of running a spec in our build as seen in the terminal.
     [exec] Launching runner: /trunk/bin/debug/_slider/_sliderTest.runner.html
     [exec] 
     [exec] Runner Started.
     [exec] _slider : should have 100 hundred items after the method addItem is called 100 times ... 
     [exec] Passed.
     [exec] _slider : should have 99 items after the method removeItem is called ... 
     [exec] Passed.
     [exec] _slider : should have zero items after the method removeAllItems is called ... 
     [exec] Passed.
     [exec] _slider : should show slider when content extends past the width of the slider ... 
     [exec] ***FAILED***
     [exec] _slider : should hide slider when content does not extend past the width of the slider ... 
     [exec] Passed.
     [exec] _slider : should remove padding from the left side of the viewport ... 
     [exec] Passed.
     [exec] _slider : should add the class bby-slider-item-first to the first item in the slider ... 
     [exec] Passed.
     [exec] _slider : should recieve the second item out of five and the HTML should match ... 
     [exec] Passed.
     [exec] _slider: 7 of 8 passed.
     [exec] Runner Finished.
     [exec] 
     [exec] Done with runner: /trunk/bin/debug/_slider/_sliderTest.runner.html
This is one of our runner files. The highlighted parts are what the build inserts into the file.
<!DOCTYPE HTML><html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/__common/__common.css" rel="stylesheet" type="text/css" media="all">
<link href="../css/_slider/_slider.css" rel="stylesheet" type="text/css" media="all">
<script type="text/javascript" src="../js/__common/libraries.js"></script>
<script type="text/javascript" src="../js/_slider/_slider.js"></script>
<link rel="stylesheet" type="text/css" href="../js/lib/jasmine-1.2.0/jasmine.css" />
<script src="../js/lib/jasmine-1.2.0/jasmine.js"></script>
<script src="../js/lib/jasmine-1.2.0/jasmine-html.js"></script>
<script type="text/javascript" src="../js/specs/_slider.spec.js"></script>
</head><body>
<script src="../js/lib/jasmine-dom/jasmine-dom-matchers.js"></script>
<script src="../js/lib/jasmine-dom/jasmine-dom-fixtures.js"></script>
<script src="../js/lib/jasmine.console_reporter.js"></script>
<script src="../js/lib/jasmine.junit_reporter.js"></script>
<script type="text/javascript">
$(function() {
    jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter());
    jasmine.getEnv().currentRunner_.name = "__common";
    jasmine.getEnv().execute();
})
</script></body></html>
I will note here that most of our runner files have actual content in the body. The specs for this runner insert some test content into the body before the spec is run. The scripts in the body are inserted just before the </body> tag.

Tuesday, November 1, 2011

NaNoWriMo

So, it's November already.  Man, this year has gone by really fast.  Well, it being November means that it's NaNoWriMo again.  You're probably asking what NaNoWriMo is?  Well, you should visit their site.  I really like the idea of trying to blast out a novel in 30 days.  It's a goal, much like my Story a Week thing that I do.  I'm going to try NaNoWriMo this year for the first time.  I don't know yet if I'll be able to write 50,000 words in 30 days (that's 1,667 words per day, for those keeping track).  It's hard enough to crank out ~1000 word stories every week.

I'm going to try though.  I have a story in mind.  Let me tell you about it.  A couple people know about my currently unfinished novel that I'm writing.  I've put the prologue on my blog.  I'm going to write the sequel for NaNoWriMo.  You might be thinking that writing the sequel before the first novel is finished is just plain wrong, but I assure you that the story for the sequel isn't really dependent on the completion of the first part.  In fact, I'll probably just make the first novel a prequel if I finish the second novel.

So, wish me luck.  I think I'll post an update in a couple of weeks.  Oh, and I'm not sure that I'll be able to write Story a Weeks, but I'm going to try to continue to do that.  It might help to keep the creative juices flowing to change it up every now and then.

EDIT:  You can track my progress here.

Monday, August 1, 2011

Change is Inevitable

I've been told before that change is inevitable.  I don't disagree with this, but there are times when I absolutely hate that things change.  Change can be good or bad, but it always brings with it a level of uncertainty.  I hate uncertainty.

There has been a major change at my company today.  Wyde has been bought by an Indian company called MphasiS, a subsidiary of Hewlett-Packard.  You can read more details about this here and here.  We had a companywide phone call this morning when the news was dropped.  I tweeted about it here.  Needless to say, it was quite a surprise.

I've been with Wyde for four and a half years now.  Being with a company that long gives you some idea at what your career prospects are like within the company.  I knew where I was and where I was likely to go and I was happy with that.  Now, though, this change has introduced a large amount of uncertainty to that path.  Sure, management told us several times that we would remain a separate entity and that nothing would be changing.  I'm not so sure.  I'd like to believe that, but if management didn't want anything to change within the company, why would they sell it to MphasiS?

They explained that MphasiS would bring us more opportunity and I do believe them.  One of our problems of late is getting large insurers to take us seriously due to our size.  While the company has at least grown by four times in the time that I've been there, two hundred employees doesn't make us a large company.  MphasiS will solve that issue because of their numbers.  They will allow us to create an off-shore team in India that can support Wynsure development efforts.  Their size brings a certain amount of credibility to Wynsure and a guarantee that Wyde won't just disappear off the face of the earth at any moment.

I never really write about my personal life, so why am I writing about this?  Good question.  Well, I have been filled with a tumultuous sea of emotions ever since I heard the news and I thought that getting it all down into a blog post would help me sort out my feelings on the issue.  Also, because I don't really write a lot about my personal life.

So, what are my feelings about all this?  Well, I don't really like the uncertainty that this change brings to the table.  I'd like to think that I've cemented my reputation and career path within Wyde and this has cracked that foundation.  Why would Wyde use me as a project manager when I'm sure MphasiS has many project managers chomping at the bit to get on one of our projects?

Of course, there is the feeling of hope that this change brings.  Lately, I haven't been terribly satisfied with my job.  Sure, it pays well enough and I certainly am good at it, but I've been having a lot of trouble lately caring about it.  I do the job from day to day, but I haven't been putting any feeling into my job.  The hope here is that this change forces me to care or forces me to find something else.  Since I'm kind of lazy and hate job hunting, I'm hoping that this shakes things up a little for me and gives me a reason to care again.

So, what does this change mean for me right now?  Nothing.  Right now I'm going to play the wait and see game.  I'll be prepared, of course, the best I can.  I've tried to stay positive and that's the best that I can do right now.  Is this change good or bad?  I think it's too early to say, quite yet.  I'll let you know as soon as I know.

PS: I almost titled this post "How I became a third tier HP employee".  Is that a better title?  :)

PPS: Since change is inevitable, I've changed my Twitter handle.  I'm now @geekonablog!

Wednesday, June 29, 2011

The Cloud - A Breakdown and Opinion

Image courtesy of Wikipedia
So, a few weeks ago, Apple announced iCloud at E3.  Amazon launched their Cloud services earlier this year.  The "Cloud" seems to be the current hype nowadays in many technology fields.  Even in insurance we've started getting questions like "Does Wynsure take advantage of Cloud Computing?"  You might be saying, "What does that even mean?"  Well, in this post, I will explain the "Cloud" and tell you about the pros and cons of using it, as I see them.

What is "The Cloud"?
The Cloud is really the Internet.  I remember from my networking classes, several years ago, my professor talking about the internet was like a cloud.  You couldn't see all the little parts (like the raindrops in a cloud) from the outside, but you knew that they were there.  So, when Amazon or Apple talks about storing your data in the "Cloud", they are talking about storing this information on the internet somewhere.  What you need to know is that your data will not be floating about the internet.  It will be stored on secure* servers owned by these corporations, but accessible from anywhere you would have access to the internet.  While "the Cloud" has become mainstream, the concept of the cloud is quite old.  Organizations have been using the cloud for decades.  SETI has been using "Cloud Computing" for a long time to try and find hidden radio transmissions in all of the static and background noise of the galaxy.  Apple and Amazon have opened this up to the public for several reasons: hardware is cheaper than ever; they see a demand for this with all of the handheld devices out there; it's another easy way for them to charge whatever they want for a service that costs them very little (relative to the potential income).

Pros to using the Cloud:
1. Using the cloud will allow individuals and corporations to offload the costs of hardware maintenance and upgrades.
2. Cloud services are guaranteed not to ever have data loss**.
3. Especially in the case of iTunes using the cloud, you would never have to buy songs over again.

1: If all of your files are stored in the cloud, you don't have to have as much hard drive space on your servers and personal computers.  In fact, Apple is planning on launching a laptop that doesn't come with a hard drive that uses the Cloud to store the users' files.  This would be cool since you wouldn't have to keep buying bigger and bigger hard drives to store your ever growing library of ripped music and movies.  They would just all be out in the cloud.

2: Corporations spend a lot of money on fail-safes and backups to prevent data loss.  Recovering data after a loss is also very expensive.  This one is kind of an extension of #1, but I wanted to call it out specifically because most people ignore backups until it's too late.  I know that I am guilty of this as well.

3: I have songs that I know that I've purchased from iTunes, but I can't seem to find them on my computer.  So, I just haven't bought them again.  I'm sure that I'm not alone in this.  Also, Apple has offered to upload your non-purchased music to the cloud and they will allow you to count them as purchased if you pay their yearly service fee.  This in particular interests me.  I know that I have over 10000 songs in my library at the moment, but I also know that I've probably lost a couple thousand to moves from computer to computer.  Apple's service would prevent that loss.

Cons of using the Cloud:
1. Losing "possession" of your data.
2. Tracking my use and files.
3. Securing my data.

1: This fear of mine might be a little paranoia, but I'm worried that if I'm storing all of my files in the Cloud (like if I used that particular Apple laptop), couldn't Apple do whatever they want with my files?  If I have a particularly nice picture, couldn't Apple take that picture and sell it to an advertising agency?  Now, you might say something like, "They can't do that.  In their Terms of Service, they state that I retain ownership of my files."  Well, let me tell you two things about that my friend.  One, "possession is 9/10 of the law".  Two, Terms of Service change all of the time.  You may or may not have heard about a recent change to Twitpic's Terms of Service.  In it, you still retain "ownership and copyrights", but in the same Terms of Service you give Twitpic the rights to sell your photos.  That's some doubletalk right there.  Once whoever has your files, how are you going to be sure that if you end your contract with them that they aren't keeping your files?  There's no way to be sure of that.  In fact, they'll probably tell you that they're keeping your files for in case you want to join their service again in the future.  That just rubs me the wrong way.  I don't trust it.  Of course, I do recognize how untrusting and crazy this might sound.  I probably sound like someone who refuses to put any of their money in the banks.

2: Just think about it, if Apple and Amazon can track how many times you've played a particular song, isn't that the perfect market research?  Then, they can pitch you the artists (or e-books, movies, etc.) that match your plays.  Maybe that's not all bad, but I don't like having my activities monitored that closely.

3: With all of the hacking that's been going around lately (LulzSec and Anonymous and the other hacking groups targeting large corporations), eventually someone will hack into Amazon's or Apple's cloud servers.  Mind you, this isn't an "if", it's a when.  Now, how deep they get in is really up to Apple and Amazon (and whoever else starts offering these services).  Security is something that is often overlooked by a lot of companies because it's expensive to maintain and there are so many vulnerabilities being discovered all of the time.  Frankly, that's part of what would motivate a corporation to use a Cloud service in the first place.  But, how am I going to be sure that the data is secure?  After all, I would have thought that a huge technology company like Sony wouldn't be vulnerable to the most basic of exploits.  Let's just hope that Apple and Amazon learn from the mistakes of others.

Conclusion
So, will I be jumping on the Cloud bandwagon?  Not if I have a choice.  It's just not worth the risk and unknowns to me.  On the other hand, I've heard rumors of the WiiU using the cloud to store your game saves, and I would be alright with that.  My Wii has run out of hard drive space and that wouldn't be a worry then.  Will I be uploading my gigs and gigs of music and movies to Apple?  No.  Maybe (and that's a big maybe) once the service has proven itself.  For now, please excuse me while I go bury my files in my back yard.

*See part 3 of the Cons section.
**There is no such thing as "no data loss".  Servers and hard drives die, it's a fact of life.  Cloud services will obfuscate this so that you never see the data loss.