1. Making Unicorn behave....

    This one had me going for a bit so I figured that I would share my solution..... I am using git-deploy for one of my clients for their two servers.  It is quite similar to Capistrano but I like it better. The git-deploy uses 3 files for deployment; after_push, before_restart, and restart.  I needed to restart Unicorn after deployments but found that I could not do so without using sudo and the password for the user.  This didn't work in the "restart" file so I found myself manually restarting Unicorn after every deploy.  Pain in the ass...... First run "visudo" from the server command line.  It may require using sudo first.  Then I added:

    <server_name> ALL=NOPASSWD: /etc/init.d/unicorn restart, /etc/init.d/unicorn stop, /etc/init.d/unicorn start
    This gave the <server_user> the privilege to run sudo  /etc/init.d/unicorn restart without having to enter the password. So I just needed to add run "sudo /etc/init.d/unicorn restart" to the git-deploy "restart file"


  2. Ruby Expression snippet for Sublime Text 2

    https://gist.github.com/5384619 …


  3. Rails CRM gets an upgrade

    A while back I created Rails CRM.  It was always meant to be a bare bones Customer Relations Management application as I did not find any that I liked. I just released a beta version of Rails CRM - Advanced.  It is still pretty bare bones but we have added a few new features and a new look as well.  I am thinking of maybe providing a hosted solution for the new Rails CRM but I am not sure if there is any interest. In the meantime, feel free to check it out at Rails CRM As usual, this is open sourced and there are links to the Github repos on the front page. …


  4. Merging Pdf's in Rails application

    Alright, I had a lot of fun today trying to figure out how to merge pdf's in our Rails application.

    We are using pdfkit to create our pdf's.  What I needed to do was to take several pdf's and merge them into one large pdf.  Frankly I did not think it was even possible.  I found several Ruby gems that were supposed to do the job but everyone I tried was just another PITA dead end.

    After getting pointed in the right direction by @m3talsmith, I ended up solving my issue the old school way.  So, if you have done this before with Ruby gems stick with it.  If not, here we go... [sourcecode language="ruby"]
    def merge_pdfs
    pdfs = []
    pdfs &lt;&lt; @bulletin.pdf.path
    @bulletin.bulletin_inserts.first.bulletin_insert_items.each do |bii|
    if bii.pdf.present?
    pdfs &lt;&lt; bii.pdf.path
    end
    end
    if pdfs.count &gt; 1
    system &quot;gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=temp.pdf #{pdfs.join(' ')}&quot;
    system &quot;cat '/Users/bob/Projects/bulletin-builder/temp.pdf' &gt; #{@bulletin.pdf.path}&quot;
    end
    end [/sourcecode]

    I first started with an empty array for pdfs.  Then I went thru a couple of processes to add all the pdfs to the pdfs array.

    After that, comes the old school.  Using Ghostscript (gs) we joined all of the pdfs and outputted them to a temp.pdf.  I tried several times unsuccessfully to overwrite the original pdf but I never got it to work correctly.  After creating the temp.pdf we used good old cat command to copy the temp.pdf to the original pdf.

    If you know or find a better way, please tell me!! …


  5. Cleanup files created with Rspec

    So I guess I just never took the time to look but our main Ruby on Rails web application creates a lot of files during testing.  Now I am not talking about database anything here.  We create icons, and pdf's and rtf files during our Rspec test suite. Just add this to you spec_helper.rb file: [sourcecode language="ruby"] config.after(:suite) do
    FileUtils.rm_rf(Dir["#{Rails.root}/public/system"])
    end
    [/sourcecode] Obviously change the directory to the correct one. Hope that helps somebody :) …


  6. Rails Rspec total test time error

    So I was getting this crazy value for the total time to run my Rspec tests.  It was like a bizarre decimal.  I never really cared until I started to try to speed up my tests. It took me longer to find the solution than it took to fix it.  If you are not getting a actual positive number in Rspec tests it might be Timecop.  We are using Timecop and the time was frozen, hence the crazy total time.  After running a test using Timecop, just add Timecop.return. Piece of cake!! …


  7. Remote / Telecommuting Web Development

    I know that I have bitched and complained about this before.  There have been many that have as well.  Companies and headhunters are always contacting me to move to some place I will never ever ever want to move to.  Ask them about telecommuting and they say they do not do that.  So they continue to search.  Maybe they find somebody or maybe they just take the best they can find and not the ideal candidate. Well I think that most of us have heard of StackOverflow so take a look at the SUCCESS they are having with literally a totally virtual company: http://blog.stackoverflow.com/2013/02/why-we-still-believe-in-working-remotely/ Keep kicking ass SO and spreading the word


  8. To Freelance or Not To Freelance, that is my question

    Recently I have been seriously questioning my desire to be a Rails freelancer.  I love RoR and coding and all that goes with being a freelancer except for the continuos struggle to find new clients.

    That struggle has been the core of my recent frustrations and the reason for questioning freelancing.  For those of you that are considering becoming a freelancer, do not get me wrong, it is a great life and I would never try to deter anybody from becoming a freelance developer.  I think that the one-person freelance operation is great but I tried to take it further.

    What are the reasons that people prefer to freelance as opposed to working for the man?  Two main reasons in my opinion; higher pay and not working in an office.  What would make a developer want to work for a company?  In my opinion again, I feel it is for security and benefits.

    That is what I wanted to offer the guys that work with me; benefits and security.

    I have learned an amazingly lot about running a business mostly the hard way after my first year.  Employees simply will cost more money and by employees I mean W-2 employees.  Contractors cost less for a business.  So I struggled with that; my desire to help out those working with me and the increased cost to do so.

    Ultimately, I recently failed a couple of those guys.  I just could not find any work for them.  What leads I had were mostly people with great ideas and no money.  Others seemed to prefer the lost cost development available overseas.  I looked on the various freelance sites and boards but all there are there are jobs that pay less than if I went to work in a fast food restaurant.

    I then thought about RoR telecommute jobs.  There are not many of those out there.  I guess it is that companies feel that they cannot trust a person to work remotely.  Maybe they hate working in an office and figure that everybody should have to be miserable too.  I know that some big name developers have repeatedly commented on the lack of telecommute jobs.  Hey I might want to work for a Bay Area company but I sure as shit do not want to work there.  I got a headhunter email from Boston asking if I was interested in moving.  Why the hell would I leave my beautiful Phoenix weather to go play in the cold and snow?

    So I am left with the idea of local jobs.  Punching the time clock (do they still have time clocks anymore) and sitting in an office.  Would I rather do that than be a freelancer? Well, no but the other option is hoping to get new business.  Who know, maybe tomorrow the phone will ring with a great big shiny new application that needs to be built.

    Bottom line, do what makes you happy if you can.  Maybe my feelings are just those of somebody in their 40's and maybe I would fell differently if I were in my 20's. …


  9. Rebel Outpost and Open Source

    So I blogged recently about giving back to the community.  Well we are.  When we are not working on Ruby on Rails client work, we are working on the RailsCRM which has been out for a bit in a more or less alpha state but is usable for anybody that wants it. Next we have @the_tong_song who has been working on a sharable calendar built on Rails and @rickcarlino is going to be rolling out his goal setter application. We will be adding these to our Rebel Outpost website very soon. My future plans for Rebel Outpost is to dedicate 20% of our time to either open source or internal projects.  I hope that everybody makes that a goal for themselves as well. …


  10. Plans for 2013

    Well another year has gone by.  Time now for all of our plans that we sillily (I guess that is a rela word) call resolutions!!

    Last year was big for me.  First I was made partner with RebelHold, and then created my own Rebel Outpost, LLC.  I had two successful interns which are still working with us.  I spent the majority of the year working on a behemoth project called Bulletin Builder for the Greek Orthodox church.  I finally passed the reins for Bulletin Builder off to Steve Young to see to completion.  I worked on another short project as well as some in house open source stuff.

    RailsCRM is still in the works with a recent Alpha release.  I am trying to add some more functionality to it without bloating it.  We are using it full time now for internal leads and finding a few changes needed here and there.  I have even been thinking about forking it and going full blown with it to offer SaaS to compete with the likes of Salesforce.

    I have additionally been working on perfecting a script to create the perfect Rails production server.  I started to use Vagrant for testing my server setup.  I wish the world survived just on Heroku but it unfortunately does not.  So for the rest I am trying to come up with a better way to do it.

    OK, so 2013.  I have big plans for Rebel Outpost this year.  I hope to make it a breeding zone for Rails developers as plan on taking on more interns.  I also have been talking to a friend about some more serious Rails incubation.  I find myself with a bit more time at the beginning of the year and have focused on getting all caught up and ready for tax time.  Now, I should have the time to finally get going with my "Rails, now what?" screencasts that I have been talking about since last year.  I intend to be a bigger part in the local Rails community and hope to get others to join me.

    I want to continue to work on free and open source applications and might even think about building some kind of money making application as well.

    So that is it.  Open source, teaching interns, and making Rebel Outpost a kick ass place to work. …