Liquid error: undefined method `include?' for nil:NilClass
April 24th, 2008
One of the mantras in the Rails community is DRY (Don't repeat Yourself), this is nothing new if your a software developer you should always look for ways to refactor your code to avoid copy and paste. Trying to maintain code with logic that has been copied and pasted to different locations is a nightmare, and one that unfortunately most of us have been exposed too.
In Rails the view part of MVC is handled by ActionView and the default templates are ERb. The views are further broken down into layouts and views. Layouts are called first for each controller then the view corresponding to the action. For the most part the layout is going to contain header elements for the xml, but what if you need some special javascript in one of you actions but not others.
You could just add it to the layout and say tough you are going to have the client load it no matter what, besides taking up extra bandwidth this can cause javascript errors for things like Google Maps where there is no associated div.
Rails gives you a better way though, you can use content_for to specify content associated with a particular yield command. For example if you wanted to use YM4R (Yellow maps 4 Ruby) to helps with your Google Maps mashup project, you could do something like this:
You would add a yield item to your layout.1 2 3 4 5 6 |
<head>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag "popup" %>
<%= yield :head %>
</head> |
1 2 3 4 |
<% content_for :head do %> <%= GMap.header %> <%= @map.to_html %> <% end %> |
1 2 3 4 |
@map = GMap.new("map_div") @map.control_init(:large_map => true,:map_type => true) @map.center_zoom_init([75.5,-42.56],4) @map.overlay_init(GMarker.new([75.6,-42.467],:title => "Hello", :info_window => "Info! Info!")) |
That's it, your layout stays DRY and your single view gets the Google Map.
Liquid error: undefined method `include?' for nil:NilClass
April 6th, 2008
Once again it has been a while since I've posted, so I'm trying out a product called Mars Edit to see if it helps make the posting easier.
I couldn't think of a good topic right off the bat, so I thought I would go with one of my favorites, which is Barbecue. Barbecue is one of those things that vary by region, so just to be clear since I'm in the south we're talking about pulled pork.
There are many great Barbecue places in Georgia, but one of the most well known is Col. Poole's in Ellijay. If you are traveling up Hwy. 515 Col. Poole's is hard to miss, with the Hill of Pigs.
It's called the Pig Hill of Fame for a reason and many local politicians and radio personalities have their own pig on the hill.
In order to compete with the Hill's attention the building is a nice match of faux logs, yellow and pink florescent paint and a red tin roof.
Moving inside there is a large assortment of memorabilia to remind you of your trip.
Not to worry though the menu is simple and direct, the pork plate is excellent
The interior decorating follows the exterior's pattern with pictures and news paper clippings about the restaurant
The service is quick and you will not soon forget the excellent slow cooked pork
Liquid error: undefined method `include?' for nil:NilClass
October 21st, 2007
I know I have not posted in a while, but I have been slacking, I have been busy developing some new sites. One of the sites is called Walk across USA, it is a completely new type of web site that is a combination of social networking, team building and fitness tracking. Here’s how I describe it on the site: A corporate contest designed to encourage exercise and friendly competition by taking a virtual walk across America on the Discovery Trail. Start a contest, form teams, track your individual steps with a pedometer and compete with your coworkers to see who can finish the Discovery trail first.
Here’s the rules we came up with, these are up to the administrator of the contest and are configurable in the Rails Application.
Random teams of 4 are created- This has been a mixed bag, there are some very competitive people getting mixed in with some not so competitive people, but that is part of the contest to get people better aquatinted along with getting in better shape.
Each person on the team will track their mileage with pedometer while the Omron pedometer is not required, its the only one I believe is accurate.
Each step will count for 3 feet – another mixed bag, the game tends to favor shorter people since their gate is smaller they get more steps. A future enhancement may have everyone measure their stride and calculate actual mileage.
The course will follow The American Discovery Trail . The trail goes through: Delaware, Maryland, West Virginia, Ohio, Kentucky, Missouri, Kansas, Colorado, Utah, Nevada and ends in California. The trail is about 5000 miles long. Adding some pictures and commentary on the trail is on the roadmap.
It is tough to get to more than 10,000 steps in a single day, although 10,000 steps a day is what you need to lose weight. As an incentive, there is a 1000 step bonus for each multiple of 10,000 steps you walk each day, i.e. 10,000 steps =1000 step bonus, 20,000 steps = 2000 step bonus. I think this has been a big win, I find myself constantly trying to get in another 500-1000 steps before bed to get the bonus and many of the other contestants say the same.
Here is some screen shots from the site:
Each contestant enters their steps for each day

The site will chart your progress

The site calculates actual steps vs. contest steps

The site aggregates individual results into team results

Team progress is shown as teams slowly make their way across the USA

Liquid error: undefined method `include?' for nil:NilClass
July 19th, 2007
I’m still slowly working on the jargonfly site and I said I would post the source code as I went along so this is my first installment. Once someone registers a domain and builds a site, you need to get the word out about your new site, one way to do this is to use search engine optimization technique (SEO). SEO is a way of optimizing your site to make sure Google and other search engines equate your site to search terms related to your site. For example when someone is searching for Hiking trails in Georgia, Alabama, Tennessee, North Carolina or South Carolina I want Secret Falls listed, since it’s target audience is hikers in those states.
Using these SEO instructions and the ones from Google I found I was doing some things wrong. One of the biggest mistakes I was making was that my title for each page was the same, this is a huge problem but one that is easily corrected. I changed the title on each page to either take the name of the state or the name of the trail. It takes a couple of weeks for the change to show up in the Google search results, but slowly I started moving up from page 10 to page 3-4.
I wanted a way of tracking this progress so I put together the following script. It takes an Array of search terms and uses Ruby , Mechanize and Hpricot to find what position your site places for each search query. I plan to make this a feature on the jargonfly site where you can set this up, then run it on a regular basis and graph the results using ziya which I’m using on another site. I have one for Yahoo search too, but I need to merge them together and end up with one script that works on all the big search engines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
require 'rubygems' require 'mechanize' require 'hpricot' # Added delay so I wouldn't get blocked from Google, not sure this would really happen but successive queries could trigger a bot alert delay=3 query=["Hiking Georgia","Hiking Alabama","Hiking Tennessee", "Hiking North Carolina", "Hiking South Carolina"] site="www.secretfalls.com" query.each do |q| position=0 agent = WWW::Mechanize.new agent.user_agent_alias = 'Mac Safari' page = agent.get("http://www.google.com/") search_form = page.forms.with.name("f").first search_form.q = q search_results = agent.submit(search_form) # puts search_results.body.class doc = Hpricot(search_results.body) while position<200 do (doc/"/html/body/div#res/div/div.g/h2.r/a.l").each do |link| position += 1 url = link.attributes['href'].gsub(/'/,'') if url.include?(site) puts "#{position} #{url} #{q}" position=1000 end end next_page=(doc/"/html/body/div#res/div#navbar.n/table/td.b/a").last.attributes['href'].gsub(/'/,'') sleep rand*delay page=agent.get(next_page) doc = Hpricot(page.body) end end |
Liquid error: undefined method `include?' for nil:NilClass
June 23rd, 2007
I recently took a trip to Sweden, there was a connection through Philadelphia, so I turned my GPS on for that segment. I did try on some of the other segments but I was in the middle of the plane but even my new Garmin 60CSx was not capable of keeping a lock.
There are a couple of sites out there to translate your GPX files into a google map route, one of those is Walking Boss. I ran across this site because the author had written a ruby gem for processing gpx files in Ruby and I was looking for something like that for my Hiking Trails website.

This is a map of the trip, you can't show airport to airport because they want you to turn you electronics off for landing and takeoffs.
Liquid error: undefined method `include?' for nil:NilClass
April 25th, 2007
I’m starting a new web project today and I’ve decided to do this one a little different. I’m going to document each step of the project on this blog and make the source code available too, so it’s kind of an Open Source Web 2.0 site.
I’ll be using Ruby on Rails to develop the site, which is one of the faster growing Database backed Web Application environments. If you have not read the book Beyond Java I would encourage you to read it, Bruce Tate has done an excellent job of explaining some of the problems Java is facing and how Ruby on Rails solves those.
The idea for the site is to make it easier for entrepreneurs to come up with nifty Web 2.0 domains themselves. The number of .com domains registered has skyrocketed to over 50 million as of last year, according to Domain counts but at the same time a .com domain is still the gold standard for your presence on the web. Trying to come up with an unregistered site is getting very hard and that’s where this new site will help. I also need to give credit to this site Domain Generator which got me thinking along these lines, the problem with this site is that there seems to be a fixed list of names and most are not available, I plan of fixing both of these issues with my site.
There are a couple of ways to find a good domain name, the first one is to make a word up like google.com, ebay.com or skype.com, which is feasible for some creative types out there unfortunately I’m not one of those… Or you could use foreign words like yugma.com or nexo.com, but many of these are taken and to me they are harder to remember. So that leaves us with another way which is to use compound words, like hotmail.com, fogcreek.com or livewire.com . You are not going to find these in the standard dictionary like other compound words such as newsstand, flowerpot or ladybug but they are easy to remember and they can be used to describe a concept also. They also have a nice feature for engineers in that they can be created by an algorithmic process.
The site I picked for this website is JargonFly.com (see compound word sites make sense), which is a site I registered a while back. This is also how the title for this article came up, because a couple of weeks ago a company made me a cash offer for the JargonFly.com domain and they were willing to pay $2500 dollars for it. I obviously didn’t sell, but it did motivate me to go ahead and get the site developed so I can generate revenue from it (hopefully much more than the $2500 I turned down).
Now I’ve got the idea, the domain, a machine to host it on and the framework I’ll use, now I have to figure out how to monetize the site. The obvious things that come to mind is to become an affiliate for an ICANN registrar and collect money for registering sites. The other thing is to have other advertisers such as how to form your own corporation, raising venture capital, etc, plus there is always adwords from Google. I will research those a little later, for now I need to get the site built.
That’s it for now, hopefully by next time I will have the framework laid out for creating the domain names and a way of verifying they are still available.
Liquid error: undefined method `include?' for nil:NilClass
April 20th, 2007
I ran across this great site Freelance Switch. Its about making the switch from the corporate world to being a freelancer. The site design is incredible and it looks like they plan on it being more than a blog.
They have some really good articles on different types of clients and also some QA type articles.
It looks like the illustrations used in the blog come from I Stock Photos. I could really use more style on this site, so I will be looking into them to see if they have graphics I can use.
Liquid error: undefined method `include?' for nil:NilClass
April 6th, 2007
I ran across this article Working for the Man this morning and it really hit home. I’m not sure exactly why it is, but the younger generation (18-28) is much different about work ethic and attitude than the previous generation (29-45). I can look around and see some of the reason, when I’m driving home from work and see kids in the back of peoples SUV with the built-in DVD player playing the Disney movie, I know where the sense that everything must be entertaining comes from. One thing I can’t figure out is where the sense of entitlement came from, when I was growing up (way back in the day…) it was still taught that if you worked hard you could accomplish whatever you want, now it seems to be if you complain and whine enough you will get that raise you want. To be honest I’m sure my parents generation thought my generation didn’t have to work hard and compared to them we didn’t, I didn’t have to feed the animals before school and then work at my Dad’s school after work but I didn’t think anyone owed me…
I saw one of the comments towards the bottom and posted the following response, hopefully young people will realize the opportunities they have and go after them.
Your attitude is what is holding you back. I work for a company that was a startup, then got acquired by a mid-size company and not is getting acquired by a big multi-national and the hardest part of my job is finding good developers. By good developers I’m talking about the ones being described in this article, the ones that have a passion for what they do and see writing software as the same thing as creating a fine piece of furniture.
I find it interesting that so many people disagree with the fact that you need to learn the internals of the machine; I think that is absolutely essential. Most people don’t even realize the order of magnitude difference, between memory and disk speeds/network speeds. You can be a good object oriented developer, have the perfect base classes, perfect inheritance pattern and have a terrible product because you don’t know how the overall system works. Most people do not have the patience it takes top learn this level of detail, the interrupt level in daily life makes this difficult. If you can’t do a google search and get back the exact information you are looking for in 55 milliseconds, then people move on to the next thing. There use to be a time (BG) before Google, where any manual or book you got was treasured and squirreled away for the knowledge it possessed, I worry that Google searches are replacing that deep level of understanding most good developers had to build up….
Anyways you can still live in that small town and make good money developing software, but you do have to go after what you want. Start by trying to bid for some outsourced projects from Companies that can’t get everything done. Build up you contacts, write emails, send sample code, maybe even do a project for free to show people you can do it. It is not going to fall into you lap, but if you can make some mid level managers job easier by writing a test harness or a utility program, you will have people beating down you virtual door with work.
Liquid error: undefined method `include?' for nil:NilClass
March 25th, 2007
After I wrote the article about the Sony GPS-CS1KA GPS, I did a little more research and I’m not convinced that is the best way to go. The main intent of Geocoding your photographs, is to insert the GPS info into the EXIF headers. There are several programs that allow you to do this, from just plain editing the latitude and longitude into each picture, to pulling the GPS data from the time stamps of a back track log.
One of the main problems with the Sony unit is that it does not seem to be sensitive enough in urban areas. I would look at this review from digitalurban before making a decision.
Robogeo seems to be one of the more popular ones and it seems very full featured. It can directly access a Garmin GPS unit and can used GPX files generated by other GPS’s.
Another option if you are a little more technical and don't want to spend the money on Robogeo, is to use gpicsync. It's written in Python and will run on Windows and Linux. You still have to produce a GPX file so it's not as tightly integrated as Robogeo is.
You will still need a receiver capable of recording GPX files. I'm leaning towards the Garmin GPSMap 60CSx it uses the SiRF GPS chipset which is very accurate from everything I've read. It is quite a bit more than the Sony, but it's a full featured GPS. I do have an older Magellan Meridian Gold GPS unit, but when I downloaded back track information I did not see any time and dates associated with it.
Liquid error: undefined method `include?' for nil:NilClass
March 15th, 2007
I was looking into different search engine optimization techniques (SEO) and one of the things they said were that search engines filter some links based on http get arguments. If you have a link like http://www.secretfalls.com/trails/show?1, it might not index that page. Well in Rails that shouldn’t be an issue, because the way the controller works, you get the identifier as part of the http URL, so the above example would be http://www.secretfalls.com//trails/show/1 which is better, but it would still be nicer to have http://www.secretfalls.com//trails/show/Hickey_Gap_Trail.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
class HikingController < ApplicationController before_filter :common def common @states = State.find_states end def index @trails = Trail.find_trails end def show @trail =Trail.find(params[ :id ]) end def show_by_state @trails =Trail.find_by_state(params[ :id ]) end end |
I was going to do a big write up here, but like so many things in rails I found that someone had already doe exactly what I wanted. Take a look at SEO for Ruby on Rails This plugin acts_as_friendly_param is super easy and gives you nice seo friendly URL’s
Liquid error: undefined method `include?' for nil:NilClass
March 8th, 2007
I'm a big fan of having a Weather radio and apparently many others are too. I wonder if this is season specific, but I was surprised at how high of a sales rank this product had.

You get local weather reports when you need them (Like when an F4 is approaching your house). Digital PLL tuning for clear reception; S.A.M.E. localized reception; 30 programmable county codes so you can receive alerts about one county or many counties... from your home, to your cabin and where your kids go to college(I didn’t think about this one, it would be nice to call you kids at school in the event of bad Weather, because you know they won’t be paying attention); Full function alarm clock; Built-in AM / FM radio; 10 memory alerts... easily add, edit and remove unwanted ads Powered by included AC wall adapter and 4 AA batteries (not included).
Amazon.com Sales Rank: #24 in Electronics
Liquid error: undefined method `include?' for nil:NilClass
March 7th, 2007
When I go camping or hiking I want to remember where I was when I took a picture, so I started looking around for a camera with a built-in GPS unit. I didn’t find what I was looking for, but I did find something close.

The Sony GPS-CS1KA GPS image tracker calculates and records the time, date and location of each picture you snap (well sort of). What it does is constantly record your position every 15 seconds with accurate time information, then when you take your pictures off your camera it compares the Datetime recorded in the Exif 2.1 header to determine where you were when the picture was taken. It’s a pretty cleaver approach, but honestly with GPS chipset prices coming down so low, building it directly into the cameras makes sense.
Amazon.com Sales Rank: #1,346 in Camera & Photo
If anyone has one of these, can you tell me how you like it?
Before you buy one of these see my other article about robogeo
Liquid error: undefined method `include?' for nil:NilClass
March 4th, 2007
I like to check the more popular websites like amazon.com, buy.com, etc to see what is moving up the ranks. This one caught my eye FloorPlan 3D v.11 Remodel & Home Design at buy.com, ranked as #1 software in entertainment
I thought the housing market was imploding, subprime lenders were going bankrupt and the Yen carry trade is unwinding, so then I looked a little closer and noticed that after the mail in rebate the software is free.
This makes sense, people will take anything that’s free.
Liquid error: undefined method `include?' for nil:NilClass
March 2nd, 2007
FACING THE GIANTS is a movie that was written, directed and stars an Associate Pastor from Sherwood Baptist Church in Albany, Georgia named Alex Kendrick. The movie consisted of an all volunteer staff with Alex playing the role of Grant Taylor, the head football coach in the movie.

Even more amazing is that this is actually their second movie, their first movie was FLYWHEEL, which was filmed on a $20,000 budget that came from private contributions. Using an all-volunteer cast of actors, the movie utilized local homes and businesses as sets.
The filming of FACING THE GIANTS lasted six weeks and was done in and around Albany with a two-week break midway through. University of Georgia football coach Mark Richt, volunteered to fly from Athens to Albany for a cameo appearance.
What does this have to do with the niche consumer, well FACING THE GIANTS is currently ranked #25 at amazon.com for most popular DVD’s.


