Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Jonathan Barnes

Posts By

Standup 08/13/2010: (css3 nth-child pseudo selector bug in safari)

Ask for Help

*"when using the css3 pseudo selector nth-child followed by a nested selector e.g.

td:nth-child(4) > p

some times (but consitently) they do not match to the correct element. Has anyone using nth-child experienced this before and know why it sometimes works and other times not?"*

For now the solution is to use jQuery to get to the nth child and apply the styles that way.

Interesting Things

  • jQuery 1.4.2 ajax json responses with a response code of 200 and responseText:" " (note the non empty string) causes jquery to trigger the failure callback instead of the success. Previous versions would handle this as a special case and still trigger the success callback. Most people agree this is proper as an empty string is not valid json, but be aware!

  • Perseids is a metor shower happening right now (July 23 – August 24) so look up!

Read More

Standup 08/12/2010: (Text encoding issues)

Ask for Help

"We have a file claiming to be ISO-8859-l encoded, but having characters that don't seem to be encoded that way. Every editor we try to open it in shows the bad characters. We have tried to use the iconv utility to change it to a UTF8 file type but it keeps crapping out whenever it hits an unknown character for that encoding. Any ideas how to fix these files??"

There were multiple suggestions:

  • Try running iconv to encode it to its current encoding and see if that works i.e. latin1 -> latin1
  • Manually fix the characters that iconv complains on. (this was rejected as there were thousands of fils that needed fixing).
  • Try pasting the file into a WYSYWIG editor that may fix the bad characters and then copying them out again (using mechanize or similar to automate)
  • Try opening it in MS-Word or similar and saving it back out.

Interesting Things

  • the ':contains' pseudo selector in jQuery & webrat behave differently with regards to commas. in jQuery it treats it as a string, in webrat (probably because it is converted to xpath) it is treated as separator.
  • spec.opts << --format profile will show you the 10 slowest specs after the suite is run.
  • Rails versions > 2.3.x use HTTP only cookeis so you cannot use selenium to clear them out. You can turn that off in your test environment to fix this. while a slower you may also just want your sleenium tests to open a fresh browser for every test in case there are other side effects in the browser like local data stores etc.
  • If you are using RubyMine and are experiencing a perpetual 'Attach gems' problem you may be able to fix it by clearing out older gem versions. gem clean
  • Riak is a distributed hash table data store solution. They are working on a project that is going to implement the SOLR api but be backed by Riak instead of lucene
  • If your using Rails 3/Passanger and you would like to have a production like environment but not call it 'production', say 'demo' You will need to change not only the RAILS_ENV but also the RACK_ENV variable to get it to work. Someone also mentioned that there may be a Passenger config that will also do this.

Read More

Standup 08/11/2010 (using VCR to mock out external dependencies and much more)

(Title: Standup 11/31/2000: Something Interesting from the post)

Ask for Help

"I have a paid for iPhone app in the app store and I want to deprecate the paid for feature and release the next version as a free app with ads. How can I continue give the users who have paid an add free version while keeping all new/future downloads free-with-ads?"

So far the only idea has been to release a second app that is free, but that has the problem of loosing all positive press/feedback for the existing app. And would seem to double the effort to provide upgrades for all users.

"We are getting 'Connection reset by peer' errors using Rescue to kick off some background jobs. It seems to be happening even for jobs that run only locally on the machine. They seem to happen randomly for various bg jobs. Has anyone else experienced this or have ideas on what is causing it?"

The connection reset by peer error is most often thrown by TCP/IP connections being closed by someone other than the client. Either the remote service close the connection or the network failed to keep the connection open. No one seems to have ideas on why/how it would be happening for local BG jobs.

"Devise + Selenium == 'you are being redirected'. When trying to selenium test log in, rather than redirecting correctly post login as it really does, the selenium test fails with a page stating 'you are being redirected'. Why is it not doing the actual redirect?"

There is a config somewhat deep in SeleniumRC config that tells selenium whether or not to follow redirects, it may be that it is set wrong. (the default should be to follow them and if you have not messed with it, not sure if this is your problem)

"We would like to be able to run our full and long-running test suite in the background while still having the 'test' environment free for doing BDD/focused testing. There are many potential solutions for this but what is the easiest/best to implement?"

solutions include:

  • Create a VM image that has your dev/test environment setup on it, push the changes to it and run you full suite in the through a terminal window. This has the drawback of a fair amount of time/effort setting up the vm correctly but that is a one-time-cost. You also need to do some interesting things with your hosts file and ssh keys to make access between your main system and the VM easier, and tends to require to commit the code somewhere in order to push it to the vm which, depending on your workflow, may be exactly what you don't want to do.
  • Create a new env & db call 'test_suite' and run your full suite against that environment. This solution generally requires you to clone a bunch of the default rake tasks which have the 'test' env hard coded in them such as db:test:prepare and related. if you look at db.rake for how often the test env is hard-coded you will see that it is non-trivial. Also once you have duplicated all those tasks you are stuck maintaining them as you upgrade rails.
  • Someone mention a project called Vagrant as a variant on the VM solution. This may solve some of the main pain points with doing it that way.
  • Someone else mentioned a plugin called Parallel Tests that utilizes the multiple environments approach. Maybe it can be tweaked/referenced as a solution to run all tests in an alt test environment

"I have upgraded to Selenium 2 pre-alpha 5 and seem to be unable to use 'click' in chrome?"

Most suggestions involved "... then don't use click" or "... try double-click"

"We are trying out the new bluetooth only 'magic mouse' from apple but in this office with lots of macs it is taking for ever to connect the mouse. why?"

It seems that a lot of the machines have bluetooth enabled and have discoverability turned on at all times. It would be bets to turn bluetooth off if your not using it and if you are to turn off discoverability except when connecting a new device.

"after using 'tail -f' my terminal window no longer shows keyboard input. why?"

It is possible that you have a complex and buggy PS1 defined and there is some data being printed in whatever you are tailing that is messing with that PS1. Try greatly simplifying your PS1 and see if that resolves the problem then do a binary search on your old PS1 to find the offending portion. If you are unable to find the root cause you can try one of the following. Try resetting your terminal using the unix command 'reset' and see if it fixes your terminal window. Try using the tailing option in Less 'less -F [file]'

Interesting Things

  • VCR is a great way to fake out an external dependency to run your tests against. It is an especially good/easy way to fake out external api's

Read More

Title: Standup 05/22/2009: RubyMine – CentOS – Symlink Testing – JSON gem – EY Solo

Ask for Help

"I am having trouble installing Mechaize on CentOS any tips and tricks?"

None from the pivots...

"Any good tips on testing the creation of symlinks from ruby?"

shell out and do an ls -l then parse the string to see if it's target is correct.

Interesting Things

  • RubyMine's changes -> repository pane only seems to show the current users changes (SVN) instead of all changes for the repository. Showing history of a file still shows all user changes.
  • The JSON gem overrides active supports to_json method. So if you are using the built in rails JSON support and you install the gem be aware that there are differences between them.
    • Word is this is better on Edge and the gem no longer conflicts with the built-in version
  • We have started moving some of our servers to Engine Yards cloud solution, and while it is still in the early stages it is looking like a promising solution.

Read More

Title: Standup 05/21/2009: Slow dependent destroy's

Ask for Help

"I have a dependent destroy that is taking 5sec+, What can I do to speed that up?"

  • try dependent delete on the leaves of the chain if you don't have any after destroy hooks there that need running.
  • try cascade delete in your database (again as long as you don't have any after destroys to worry about)
  • try marking the element at the top of the tree as deleted (using acts as paranoid or similar), then run an offline process to look for those records and destroy them and their dependent objects.
  • don't worry about orphaned records and manually clean them up every once in a while (unrecommended but least development effort)

Read More

Standup 05/20/2009: "Merging Large Data Sets – after_commit"

Ask for Help

"What are some good ways to merge large business location data sets?"

There was a bunch of input including the following:

  • You should create a scoring of how close the matches are.
  • Good admin merge tools are worth the effort to create.
  • Normalizing the data prior to the merge (i.e. pass the addresses through the USPS API to turn [Av Ave Avenue] => Ave)
  • Humans do this best, outsource or Mechanical Turk it.

Interesting Things

  • The after_commit plugin allows you to hook events to after the transaction commits. This is really useful when kicking off threads that expect to have access to the data in the database. Note: using after_save can cause you to have a race condition if the other thread attempts access to the data before the original thread has a chance to commit the transaction.

  • If you are storing a marshaled object in the database, you should make that field a blob type, it is smaller to store and if you leave it as a text or varchar you can corrupt the binary data you are storing in there. If you don't have a choice about field types you should at least base64 encode the marshaled data before storing it.


RE: "NewRelic Side Effects?" from 05/19/2009 Standup

  • It seems that NewRelic was not the cause of the problem but helped in exacerbating the problem by holding the transaction open long enough to create a race condition that still shows up when the system is put under enough load. To fix our problem we moved the trigger that launches the background process from and after_save to an after_commit see plugin. We also re-added NewRelic.

Read More

Standup 05/19/2009: Tool Annoyances; Better Firebug SASS Support

Ask for Help

"Who is getting svn: Server sent unexpected return value (403 Forbidden) in response to PROPFIND in SVN?"

Lots of people! This is a known bug when a SVN project has to traverse the repository using more than one user. Check out subversion: Issue 3242.

"Has anyone gotten ImageMagic to work with Phusion Passenger on CentOS?"

It seems to work with Mongrel, but not Passenger.

"Who is getting svn: Server sent unexpected return value (403 Forbidden) in response to PROPFIND in SVN?"

Interesting Things

  • Firebug 1.4 - Alpha

    • It has some cool new features, such as showing you CSS comments -- handy for SASS debugging! Works in conjunction with enabling SASS line numbers in the CSS output.
    • It also supports FireDiff, which "records all of the changes made by firebug and the application itself to CSS and the DOM".
  • NewRelic Side Effects? We have some background processes that get kicked off from after saves of some of our ActiveRecords. These processes use Active Resource to post back updates to these records. Unfortunately the transaction that creates the record initially doesn't seem to have completed before the first post-backs attempt to update them. (race condition). After trying a bunch of stuff we randomly removed the NewRelic plugin and all of the sudden we had no more race conditions. Is the NewRelic plugin holding the DB transactions open too long?

  • MySQL index sample size: We discovered that MySQL's ANALYZE TABLE uses a fixed sample size from the index regardless of the size of the table and thus can have really incorrect cardinality and which could lead to it choosing the wrong index. Also ANALYZE TABLE gets run often (opening new connections, first read of table) and due to the problem mentioned above can cause the system to switch from using the right index to the wrong index each time you look at it.

Read More

Standup 05/18/2009: Ruby Profiling

Ask for Help

"Does time spent in the C code show up in the ruby-prof output?"

Yes it does -- There are two stats for method time: "Self" [time in method] - [time spent in called children]), "total" [total time in method]. The second should include time spent in the C code

It was also mentioned that it is much more useful to look at the ruby prof output as HTML or even better using KCachegrind (though it was mentioned that it can be a bit of a pain to get it installed see KCachegrind OS X 10.5.6

Read More

Hide .svn files in changes view of RubyMine

You have probably noticed that the changes view is unusable in RubyMine because of all the .svn files showing.

Well if you refresh ( 'changes' reload image ) the changes view they go away...Hurray!

Read More

Standup 08/21/2008

Interesting Things

  • is a web app that provides a rich and usable interface for searching, perusing and improving the documentation of projects that are included in the app.

Read More