1. Next up...Intern number 2

    So I was in my usual hunting grounds (Ruby::AZ) for scouting for interns, when there sitting in the middle wide-eyed as can be, I saw my next victim.  We spoke for a bit and he said that he was just beginning to learn RoR.  He emailed me a more thorough profile of himself and we spent quite a bit of time chatting the next day.

    So without further ado, please welcome Steve Tong to the Rebel Outpost community:

    "Here is a little bit about myself to see if you are interesting in working (teaching) with me. I have business degree with a major in marketing. I have been doing marketing (mostly internet marketing) and advertising operations as a day job for about 5 years now. Side projects including email development, SEO work, and the occasional website build....

    My development experience consists of a year of C# in college and about another year of dabbling around with it after. Although the only thing I really retained was logic. I have done work with HTML/CSS and have started really learning Ruby on Rails since this past May. I feel I have taught myself a lot but am definitely still a beginner and need to learn much more, and would greatly benefit having someone help me turn this into a career."

    After looking at some of the work that Steve Tong has done on his own, I am highly impressed with his Rails skills.  We are happy to bring him on with his SEO skills in addition to Marketing skills and expect Steve to be a great fit and a great coder.

    We all know that he has some big shoes to fit after our last intern, but I think he can do it!!   …


  2. Dynamically change options for select based on first drop down

    I recently needed to change the options for select for a drop down based on the selection of another drop down.  At first this seemed like a pretty easy thing to do, right?  I thought that I could simply throw an if statement into the view and all would be well.  As I started to add the code to the view, I realized that this approach was not going to work at all.  That is when it hit me that I was going to need to use Javascript. There were a million examples and forum answers all over the web and I tried about half of them to no avail.  I called in the big gun himself, Michael (@m3talsmith) our in-house Javascript expert. Here is the entire code (minus the extra crap obviously) : https://gist.github.com/3710100 Now, I will break it down into each part.  First lets start with the form part, and again this is not the entire form but rather just the 2 drop downs that we are working with. https://gist.github.com/3729943 So we have the two drop downs in our form.  The first drop down has the values from the controller as @share_types.  So based on the selected value of the :share_type we will have different set of options for select for the second drop down.  For this we will need to check the selected value of the :share_type.  The first thing that we do is look for the change of that selection. https://gist.github.com/3729944 First we call the initSubOptions() function on document ready.  This function watches the #selected_share_type drop down for it to change.  When it sees that drop down change it takes the value of it ($(this).val()) and passes that to the populateSubOptions function. https://gist.github.com/3730040 The populateSubOptions() function looks at the selected value of the first drop down.  There are only 3 options that will ever be present in the first drop down and we have just two cases, if it is “share_across” or either of the other options.  Our if statement looks to see if the value is “share_across” and if it is it calls .empty() on the #share_exp_dates select and then appends to it the optionFromArray(share_across_options) otherwise it appends the optionFromArray(share_down_options). https://gist.github.com/3730070 The optionsFromArray function creates the options for select based on which array it is passed.  The two array options are defined based on the values that are passed in from the controller; either @share_across_dates or @share_down_dates. It then runs thru the array and creates the option values.  The @options for @share_across_dates is an array of arrays: [['1 Week', 'one_week'], ['2 Weeks', 'two_weeks'], ['3 Weeks', 'three_weeks'], ['4 Weeks', 'four_weeks'], ['5 Weeks', 'five_weeks'], ['6 Weeks', 'six_weeks'] ] So, easy stuff here if you are good at javascript.  We watch for the value of the first drop down to be changed and then based on that we display the options for select accordingly. I am sure that there may be a better/easier way out there, but this worked for me. …


  3. Rails CRM

    An ongoing pet project of mine has been Rails CRM which is a CRM (Customer Relations Management) built on Rails and using Mongodb for the database.  This was also a practice project for my last intern Ricky.  This all came about when we were trying to find an open-sourced CRM for RebelHold to use.  There are a few out there but none using our preferred and probably the best database, Mongodb.  Many also had a lot of shall I say baggage.  I was looking for a more or less basic CRM to customize and finally came to the conclusion that I would need to make a new one.

    Well recently I spent quite a bit of time cleaning up the Rspec tests and the Twitter Bootstrap layout.  It is by no means ready for primetime but we are really close.  Most of the basic functionality is there but I am planning on adding some more bells and whistles.  After that, I am going to leave it alone and use a clone of it to further customize for our use.

    You can find more information on the Rails CRM homepage or can find the project on Github.  Please feel free to email me ideas/suggestions/bitches and/or complaints.  I will update when the project is fully completed.

    Update: You can now go to railscrm.com or to check out the demo, go to demo.railscrm.com. …


  4. Issue installing Ruby after upgrading to Mountain Lion

    I think that most of us that have upgraded to Mountain Lion have encountered this issue already, but for those that have not, here is what you need to do. Chances are that if you are trying to install Ruby you are getting an error, which once you look in the log, says: configure: error: no acceptable C compiler found in $PATH Even if you had Xcode installed before you will need to download it from the App store and install it.  After it is installed, open Xcode, go to preferences and then the downloads tab.  There you will see an option to install the command line tools. Restart your terminal, and you should be able to install Ruby. …


  5. Invitation Modal

    Very good tutorial covers a lot here. Great Job! …


  6. What I have learned as a freelance developer

    Well, I am almost at one year since I quit corporate America and went freelance.  I am not really sure what the definition of a 'freelance' developer is and I don't care what wikipedia says it is.  All I know is that I do NOT work for a company and I consider that freelancing.

    So what have I learned in the almost year of not working for the 'man'?  I would have to say a lot.  Let's break it down into pros and cons with the cons up first.

    Cons

    • No health insurance
      • Now this might not matter to all of the younger generation of developers, but at my age this is something that I dreadfully miss.  There are options out there for individual health insurance but they are overly expensive and that is a shame.
    • What am I doing next week?
      • It can be said that there is security in working for a company, but I have seen that to be a fallacy in many situations.  I left my 'corporate' job when they started to cut out benefits.  I figured that was the writing on the wall that things were going to be tight for some time to come.  To me it seemed that IF they were going to pull employee benefits, then the chances of a raise anytime in the near future were pretty slim.
      • The best way to counter this 'fear' is to secure large projects whenever possible.  This may mean making less money but for a guaranteed amount of time which for me was the case and that in itself added a feeling of security.  There is no guarantee of anything in this world but try to give yourself as much of a safety net as possible.
    •  No taxes
      • This might sound like a great thing but I am shitting my pants in fear on next April.  Set the money aside for taxes or you will regret it.  This sounds like a no brainer but I know this and I have not done it.  Epic Fail!

    Pros

    • Being your own boss
      • Now this could go in the cons category for a lot of you.  It takes something to be your own boss.  You have to be a bigger asshole than any boss that you have ever worked for.  It is so easy to get lazy when there is nobody looking over your shoulder.  This really is not a good situation for everybody but if you are dedicated, then this really is a pro.
      • Work hard and play hard but don't burn yourself out.  There are many development companies out there that adhere to a 4 day work week with Fridays being set aside for open-source or fun projects.  Do not work yourself to death which is the extreme opposite of being lazy and occurs more often than not.
    • Unlimited Income
      • Now there really is not anything as unlimited income but as a freelancer you have the opportunity to make as much (and as little) money as physically possible and by that I mean that there are only so many hours in the week and one does need some sleep.
    • Your own time
      • You control your time.  Obviously you have deadlines for your client(s) but how you spend your time is up to you.  Use it well and do not waste it.
      • Work on open-sourced projects.  I have heard that this is a great way to get your name out there.  Make the time to learn something new and to work on your own project.  In my case I found that there was not any Ruby on Rails CRM out there that was based on MongoDB so I decided to make my own Rails-Mongo-CRM in the hopes that people will see not only my work but that I am giving back to the community.
    • Do your own thing
      • I fell that the bottom line is that you can do your own thing.  Do what you want to do and what you enjoy doing.  The moment that you no longer 'enjoy' if, go back to corporate America


  7. Writing stories for Pivotal Tracker

    I have had a lot of hits from people searching for how to write user stories for project management solutions like Pivotal Tracker.  User stories are used in the Agile development process so that the client can define the way that they want their application to perform.  They are written in a way that a non computer savvy client can describe what they want to the developer.

    User stories can be as simple as a one line sentence describing a function.  This is normally to answer the "who", "what", and "where" but not necessarily always.  A user story can also, and generally should, include a list of tasks that need to be accomplished to result in the desired behavior.  User stories are a big portion of the Behavior Driven Development (BDD) as they describe a desired behavior.

    ISBAT

    A common term in writing user stories is ISBAT, short for "I should be able to" and is a great why for the client to think thru the functionality that they wish to achieve.

    A simple user story example

    The client wants a site that a customer can go to, create and account and purchase something.  So the first thing we need to do is create an account.  Our story could start as "As a user ISBAT create an account."  This reads and is clear to what the desired behavior is.  So now how will we do that.  We can create tasks working together with the client.

    1. Task 1 - visit the home page
    2. Task 2 - click on create an account
    3. Task 3 - fill in a form and submit it
    4. Task 4 - click on  confirm my account in email

    Now we have a pretty good understanding of exactly what the client wants and expects.  The more explicit that the user stories are the easier it is to write your tests.  You can use "create an account" in your describe and your first test should be it "creates new user account." Following this story, you can easily write the rest of the test such as visit root_path, click_link "Create Account", etc.


  8. Twitter Bootstrap, Oh how I love thee

    As a person that cannot even draw a worthwhile stickman, I have to say that I do not have a designer bone in my body.  Oh I can get around HTML/HAML and CSS/SASS but other than that I am pretty hopeless as a designer.

    I started to use Twitter Bootstrap on a side project of mine and used it entirely for Rebel Outpost.  It seems that the argument is that using it will make all sites look alike and I see that to a point.  But let me tell you the use that I found for it; I am learning to design.

    Using Twitter bootstrap has improved my HAML and SASS skills.  I used to give every element a different id or class and had mountains of CSS/SASS.  Now I do not do that any more.  I have learned to use grids as well.  I have started to make my own custom Twitter Bootstrap file which I can now use as a foundation to any new site.

    So if you are like me, take a Twitter Bootstrap file, customize it and go with it as a foundation to use for your site.


  9. Django or Rails?

    Today I got into a conversation on Twitter about Rails versus Django.  I know that I have blogged about this before but I thought that I should maybe clarify my reasons for preferring one over the other.

    Before I start, I must confess that I did not use Django that much and it was also in my beginning stages of web development so bear that in mind as you read this.

    I came from Python where I first learned it for geoprocessing to use with ArcGIS.  Now using Python (which is installed with ArcGIS) for geoprocessing inside of ArcGIS is easier than natively.  For example, there is a UI for forms to define what fields or data types to use.  Python for geoprocessing is very well documented and is very easy to use.

    I soon found out that I was very limited are far as functionality goes using Python "inside" of ArcGIS.  I looked at options for creating desktop GUI's and found that wxPython was the easiest for me to use to accomplish what I wanted to do.  I have several posts regarding this stuff in my archives so I will not repeat myself.

    On to web development…

    At my old "job" we had an app written in Ruby on Rails and that was my starting transition to web applications.  I started by creating Python interfaces for desktop applications to interact with our RoR web application and then started to assist on the web application itself.  This piqued my interest.  I had taught myself Python so why not learn Django?

    I other posts I have commented that the best place to find help learning a new programming language is to go to user groups.  In Arizona there was not a Python/Django user group.  I found via Twitter a couple of local guys that were Django developers and met with them at coffee shops to try to learn from them and I greatly appreciated their assistance.

    It was the learning at home, alone, that was not successful.  I found that there was not a lot of training "materials" online for Django.  Do not get me wrong, there is a lot of stuff on the web to help with learning Django but a lot of it is just as confusing as Django is.  I even went as far as trying to start-up/re-incarnate a local Python group which was not very successful.

    Enter Ruby user group…

    I found out that there was a local Ruby group and a local Rails group.  I went to my first Ruby::AZ meeting.  I was at a transitional stage where the separation between the Ruby group and the Rails group was diminishing and morphed into what it is today; Ruby and all things Ruby.

    I found the support group I was looking for.  There were so many Rubyists that were happy to point me in the right direction and to help me when I needed it.  The resources for learning RoR are phenomenal.  My still all time favorite and a major reference guide for me is Railscasts.com.

    I then met @m3talsmith with RebelHold and he took me on as an apprentice.  The rest is history.  I now have my own company Rebel Outpost which is a member of the RebelHold family.

    Django or Rails?

     In all fairness, I prefer Rails as I was able to learn it.  That does not mean that Python or Django are bad languages at all.  I also cannot say that Rails is better than Django but I do love Rails.

    Ruby is so clean and elegant to read and write but lacks the whitespace-ness (is that a word?) that Python has.

    So I hope that clarifies my love for Rails over Django……… …


  10. My how they grow up so fast.....

    So our intern Ricky is headed off to Korea for a bit and we will miss him.  The project that he was working of for Rebel Outpost has been quite a monster legacy Rails project.  Ricky was really amazing in that he never gave in without a fight. The project required an activity stream and off to Google, Ricky went.  His approach was not only a huge success but something that none of us have ever used before; Mongoid Observers. He even wrote a short tutorial for it at So you want to make an observer in Mongoid… Thanks again Rick and hurry back! …