Updates from mcphersonz Toggle Comment Threads | Keyboard Shortcuts

  • mcphersonz 7:02 pm on March 16, 2010 Permalink | Reply  

    –@@@– showing up in development_structure.sql (plus a solution) 

    I recently wiped my laptop clean & upgraded to snow leopard (OS X v10.6). In doing so I had to reinstall all my apps including gems, libraries, drivers, frameworks, etc.

    One of my projects is a Rails application that uses a oracle database. I installed the latest version of the required gems (including activerecord-oracle_enhanced-adapter) and found that things seemed to work fine at first, but eventually I ran a migration followed by rake db:test:clone_structure & found that things where not working as expected…. in particular the generated development_structure.sql file contained __@@@__ where it should contain semicolons, making things break all over the place:

    $ rake db:test:clone_structure
    (in /Users/smcpherson/dev/awesome_project)
    Exporting Synonyms
    Exporting Primary Key Constraints
    Exporting Foreign Key Constraints
    Exporting Triggers
    rake aborted!
    OCIError: ORA-00900: invalid SQL statement: –@@@–

    I don’t know what was causing this, but I know how I eventually avoided the problem….

    First, I removed the latest version of activerecord-oracle_enhanced-adapter (1.2.4):

    sudo gem install activerecord-oracle_enhanced-adapter

    Then installed the 1.2.3, 64 bit:

    sudo env ARCHFLAGS=”-arch x86_64″ gem install activerecord-oracle_enhanced-adapter -v=1.2.3

    That’s it.

    The 64 bit thing was not a issue — but I specified that as I don’t need the 32 bit version & from what I understand I will get a 32 & 64 bit version unless I specify the ARCHFLAGS during the gem install.

    Hope this helps someone else as it consumed the better part of my day….

    • barbara walters surgery 4:18 pm on June 1, 2013 Permalink | Reply

      Hi! Someone in my Myspace group shared this site with us so I
      came to look it over. I’m definitely loving the information. I’m bookmarking and will be tweeting this to
      my followers! Fantastic blog and excellent style and design.

    • Promo Toyota Kediri 3:17 am on July 5, 2016 Permalink | Reply

      Hello! I’ve been following your site for a while now and finally got the
      courage to go ahead and give you a shout out from Houston Tx!
      Just wanted to mention keep up the fantastic job!

  • mcphersonz 4:43 am on February 18, 2010 Permalink | Reply  

    Why is git called git? 

    According to wikipedia:

    Linus Torvalds has quipped about the name “git“, which is British English slang for a stupid or unpleasant person:[3] “I’m an egotistical bastard, and I name all my projects after myself. First Linux, now git.”

    Lolz…. So in summary, some say that git is a “Global Information Tracker” — but according to the creator of git, it’s just a stupid/unpleasant person like the creator.

    Whatever it means, git is fucking awesome. It has changed the way I program & work in general. I love git. Linus, you rule!

  • mcphersonz 11:07 am on January 2, 2010 Permalink | Reply  

    New year, new house! 

    2009 was a great year for me. My wife had a baby which brings a whole new purpose to my life. It is indescribable. Ryley Jane McPherson, born on February 5th 2009. Ryley is now walking as of December 31st.

    We also bought our first house here in San Mateo, CA. It’s a small 950 square foot house but is in a great neighborhood & fits us well.

    In 2009 I celebrated 5 years with my current employer, Epocrates.com. I started as a contractor in April of 2004 & have moved around quite a bit within the company. For the last couple years I have been working for the engineering department & it has been a wonderful experience. What a great company.

    2009 also brought with it a 5 year wedding anniversary. It is amazing how time flies when you are having fun.

    With the good comes the bad — my beautiful rottweiler Lily passed away in 2009. I will never forget you Lily. You where truly a man’s best friend & will never be replaced.

    2010 will be a super year and I can’t wait for what it has to offer! Happy new year to all. Let’s make this year kick ass.

    • Lydia 11:04 pm on January 9, 2010 Permalink | Reply


      I just saw the great news about your new home. Congrats. Its a very special experience to own your own place and now was a great time to buy. I have been thinking of you lately and may actually contact you sooner than you think!

      • mcphersonz 12:57 am on January 10, 2010 Permalink | Reply

        Thanks Lydia! Yeah, it has been quite an experience especially considering the house is a fixer-upper. I love it & it is quite a gem but it has a interesting history and a but of … personality. That said, I have taken a lot of pride in the improvements we have made. Maybe one day we won’t be the least kept-up house on the block…. 🙂 Contact me anytime!

    • Skip Franks 1:05 pm on January 26, 2010 Permalink | Reply


      Wow, new baby and new home.. Would you consider a new job?

  • mcphersonz 1:37 am on November 12, 2009 Permalink | Reply  

    /etc/hosts file is reverting to a previous state in OS X?!? 

    Problem: I make changes to my /etc/hosts file — but they don’t seem to “stick”. They take affect, but after some time (hours, a day) the changes I made are lost.

    Solution: When changing the /etc/hosts file, make sure you are NOT connected to the VPN (at least if you are using Network Connect by Juniper Networks.)

    Story: For a long time I have noticed that when I make changes to my /etc/hosts file it reverts back to a old state at the end of the day (or eventually). It has been very annoying as you can imagine. I have been keeping all my entries in a separate file & add them to my hosts file when I need them. Ugg. I got a clue via aardvark that it may be VPN related.

    It turns out that when I disconnect from the VPN the hosts file reverts to the state it was in before I connected to VPN. Ahh…. but If I make changes before being connected to VPN, then they stick.  I would connect to VPN, make changes to /etc/hosts, then eventually time out or disconnect from VPN… poof! Changes are gone & the next day begins.

    This was not obvious to me because 99% of the changes I make to the /etc/hosts file require the VPN to work to begin with! In addition, I mostly work remote — so it is rare that I will be in the office (not connected to VPN) and make changes to my hosts file.

    Now I know to make changes to my /etc/hosts file before connecting to my VPN 🙂

    • theillien 5:44 am on October 3, 2011 Permalink | Reply

      Sweet. I’ve been having this same problem. Glad to find it’s a simple issue and I’m not going insane. Now to see if this fixes the problem. Thanks!

    • Scott 10:18 am on February 16, 2012 Permalink | Reply

      Fixed it for me – thanks so much!

    • Anonymous 4:04 pm on August 17, 2012 Permalink | Reply

      I seem to be having this problem since installing Mountain Lion, my hosts file never changed when i edited it before, however now it reverts all the time. Any ideas? Im not connected to a VPN

    • Mike 5:42 pm on September 13, 2012 Permalink | Reply

      Shannon, thank you very much! I’ve had exactly the same problem, and the first dozen or more posts didn’t mention this issue. Now it works like a charm!

    • Anonymous 8:58 am on March 9, 2016 Permalink | Reply

      THANK YOU!

  • mcphersonz 6:41 am on November 11, 2009 Permalink | Reply  

    UltraEdit released for Linux! 

    I am writing this post because I am excited to announce that one of my favorite editors of all time, UltraEdit, has just been officially released for linux!

    UltraEdit is a commercial text editor for programmers. It is full of features & in my opinion is the best choice for a commercial programmers text editor.

    Some Key features of UltraEdit include:

    • Group related files and folders with Projects
    • Column/block mode editing
    • Syntax highlighting for 100’s of languages
    • Find/Replace with regular expressions
    • Robust Find in Files and Replace in Files
    • Execute applications/shell commands
    • Function list for easy navigation in code
    • Code folding, brace matching, auto-indent
    • Large file handling
    • Automate tasks with Macros or Scripting
    • Unicode/UTF-8 support
    • Drag-n-drop horizontal/vertical split window
    • HEX editing
    • Configurable keyboard mapping
    • Recallable text snippets with Templates
    • File change detection

    For more info, check out the UltraEdit homepage.

  • mcphersonz 10:11 pm on July 28, 2009 Permalink | Reply  

    Chinny Fight! 

    I neglected to feed my chinchillas for a day — then I fed them & was surprised to find myself in the midst of a …… CHINCHILLA FIGHT!!!!

  • mcphersonz 4:18 am on June 3, 2009 Permalink | Reply  

    Why I choose git over Perforce, SVN and other source control systems… 

    Here are the top reasons I am a git fan:

    • price. Depending in the implementation choice, it can be free (as in free beer!). Using a service like github.com to facilitate in a centralized workflow is super cheep. Currently for a year’s service for 10 developers we are paying about $25 a year per developer for the github service (and 20 “private” repositories). Scaled up a bit it’s relatively the same cost at $24 a month per developer for 1 year (100 developers, 300 private repositories).
    • cheap local branching, merging & tagging. It’s sinfully easy to do. As fast as you can 10 characters and a branch name, it is done. It’s all local, so it’s virtually instant. Easy branching means you are more likely to do it & that can lead to better development as a whole. Isolating a feature, bug fix or re-factoring into a branch as a standard can be very rewarding. Merging is relatively straight forward, fast & in some cases completely automatic. Tagging allows for you to give the code a name at any point in time — like “release 1.2”, or “hotfix”. You can very easily switch to a given tag (or any commit) and work on it via a new local branch.
    • Fast. everything is local. Besides syncing up with other people, pretty much every interaction with the source control is local. This becomes a huge time saver — and again, when it’s quick you are more inclined to use it. Branching, merging,  looking at code history and committing are all practically instant tasks. Yes, git is faster than most source control systems out there. Oh yeah, and all revisions of every file are always locally available for you to inspect. Again, this can be a big performance booster of you are comfortable with the command prompt. When you do need to do network opperations like pulls & pushes, it is also very fast. Git uses diffs and compression to make these also very fast. “raw, blistering speed.” Does that make you think of other source control systems?? no? didn’t think so….   🙂
    • several workflows. You can follow the traditional centralized repository approach as we currently do with github. A master repository is designated, and people pull/push to that repository using it as a centralized sync area. This is very similar to the perforce workflow. Alternatively though, there is a “Dictator and Lieutenants” workflow that basically allows for anyone to sync up with anyone else’s repository. A “circle of trust” is applied here each developer trusts other developers in their commits — and each developer trusts certain people with that they have contributed. This works well for larger groups. Think of a triangle scheme, with the sr. developer (the dictator) trusts a few others (lieutenants), and those lieutenants each trust a few others, etc.
    • easy to learn. You basically learn what you need to do your tasks. You may only need to do a few things with the files you are putting under source control. Maybe you only need to know “git pull”.  If you only need to make sure you have backups of a file locally then you only need to know 1 or 2 commands. Done. If you are a source control master, there’s more git functionality than I can shake a stick at…. I get by using probably 2% of git’s core functionality. And when I need more, I do a google search & there’s a ton of user contributed info on how to accomplish a given task at hand.

    The important thing to note here is that git has some major benefits in certain cases & although it is not for everyone, I think it has some major wins in certain situations.

    As Mr. Natural said “Get the right tool for the right job”. In other words, one tool may not be a good fit for any job at hand.

    Oh yeah, github.com is the bomb. Look out for http://fi.github.com. It look killer if you need a github UI but internally (possibly due to corporate policies / restrictions)

  • mcphersonz 8:39 am on May 13, 2009 Permalink | Reply  

    The RSpec Book by David Chelimsky, Dave Astels, Zach Dennis, Aslak Hellesøy, Bryan Helmkamp, Dan North 

    I felt compelled to post this because this book is just great & I wanted to share it with anyone who is interested. If you are just getting into behavior driven development (BDD), RSpec or cucumber then I have a book to recommend to you! Having heard nothing but good things, I recently purchased “The RSpec Book” by David Chelimsky, Dave Astels, Zach Dennis, Aslak Hellesøy, Bryan Helmkamp, Dan North from Pragmatic Programmers.

    It’s a easy read that is packed with great tips on how to approach BDD – as well as detailed info on rspec’s features, and tons of other very useful stuff.

    The book is in beta right now (not finished) but you can purchase & get the PDF right now. As updates are made you can re-download the PDF. Once the book is actually finished as paperback will be sent to me. I can’t wait!

    Worth mentioning is that I  am just a fan — not affiliated with anyone who makes money from this, nor do I make any money for posting this or my website in general. 🙂

  • mcphersonz 8:32 am on May 13, 2009 Permalink | Reply  

    Key Features for Rails v2.2, Rails v2.3 and the upcoming Rails v3.0 

    Rails 2.2 new features of interest

    • Ruby 1.9 and JRuby support
    • Transactional Migrations that allow multi-step migrations to be rolled into a transaction.
    • Memoization for caching methods for a request. Allows caching based on passed params as well.
    • *!* Connection Pooling lets Rails distribute database requests across a pool of database connections
    • find_last_by_attribute finder, for example to get the last user who signed up from London:  User.find_last_by_city(‘London’)
    • Layouts for ActionMailer – you can now use layouts in your ActionMailer views.
    • *!* To avoid deployment issues and make Rails applications more self-contained, it’s possible to place copies of all of the gems that your Rails application requires in /vendor/gems.
    1. rake gems:install to install missing gems to the computer
    2. rake gems:unpack to place a copy of the required gems into /vendor/gems
    3. rake gems:unpack:dependencies to get copies of the required gems and their dependencies into /vendor/gems

    Rails 2.3 new features of interest

    • ruby 1.9.1 support
    • Engines allow for nested rails applications.
    • Metal allows you to define a area of code that completely bypasses most rails things – does not go through routing, no logging, etc – for areas that need high performance or that get called frequently.
    • Nested transactions within ActiveRecord
    • Dynamic Scopes: Order.scoped_by_customer_id(12).scoped_by_status(“open”)  — no definition needed for dynamic scopes, just works.
    • Multiple Conditions for Callbacks. When using Active Record callbacks, you can now combine :if and :unless options on the same callback, and supply multiple conditions as an array:

    for example: before_save :update_credit_rating, :if => :active,  :unless => [:admin, :cash_only]

    Rails 3.0 new features of interest (David Heinemeier Hansson KEYNOTE FROM RAILSCONF09)
    DHH’s Philosophy of rails 3:

    • Lock up all the unicorns. You can’t please everyone all the time, so don’t focus on the unicorns.
    • No holy cows. Nothing is sacred in rails & everything is up for debate. Don’t look any anything we have & feel like that is the way it has to be.

    Major Themes:

    • New routes. Faster, route by subdomain, user agents, etc. Rack to other rack machinery.
    • XSS protection (cross side injection). By default all output in views will be escaped. No more use of <%= h something %>. Assumed by default.
    • Javascript goes Unobtrusive & Agnostic. Much less JS is injected into page & instead unobtrusive JS is used to achieve same effect.
    • More Agnosticism.
    • Action ORM is a slim proxy wrapper for ORM tools that allows for easy swapping of ORM implementation,
    • Generators (script/generator) will for example allow you to specify that rspec is used, so script/generate model will create a rspec test file for model.
    • Refactoring
    • Abstract Controller takes similarities between for example ActionController & ActionMailer and combines them into one code base.
    • Cherry picking from ActiveSupport allowing you to pick parts that are used instead of pulling in the entire library.
    • Increased performance / speed with callbacks.
    • raveendran 2:23 am on December 19, 2009 Permalink | Reply

      Waiting for Rails 3.0 !!!

  • mcphersonz 8:30 am on May 13, 2009 Permalink | Reply  

    Recommended Gems, Plugins and various notes on what’s hot in the ruby on rails world 

    Performance Optimization

    • optimization doesn’t end with speeding up my Ruby code (or Rails itself).

    The performance of production application heavily depends on its environment – server filesystems, databases, load balancing solutions.


    • use gems like UnitRecord or dust to cut off the database for unit testing. Mock all unit tests out to speed things up drastically.
    • to scale large tests you can offload them to remote BAMs(Bad Ass Machines), or send tests to multiple processors. Deep Test allows you to spawn multiple remote threads to run functional tests
    • to benchmark a specific url you can use the ab (Apache HTTP server benchmarking tool) command:  ab -n 100 http://localhost:3000/quick_reply/list
    • Errorlytics web service detects 404 errors via JS & redirects user based on rules that you define at errorlytics.com – http://www.errorlytics.com/
    • Using factories instead of fixtures.
    • Fixtures are more brittle & they seperate the data from the test, creating a assumption that the data already exists & is correct to begin with.
    • Factories …. Fixjour, Factory Girl, Object_daddy and Machinist are plugins that aim at creating factories.
    • Cucumber tips: http://media.railscasts.com/videos/159_more_on_cucumber.mov


    • Write tests first, the run cucumber. To run a specific feature run: cucumber features/name.feature
    • Use output of cucumber to create stub step definitions.
    • Make each test pass, from the top down.

    Feature: title
    In Order To [business value]
    As a [role]
    I want to [action] some feature

    Scenatio: title
    When [context]
    And [more contect]
    When I do [action]
    And [other action]
    Then I should see [outcome]
    But I should not see [outcome]


    Video / Screen / Pod casts

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc