Joseph Palermo's blog



Joseph PalermoJoseph Palermo
Standup 01/13/2012: Will the real 13th please stand up
edit Posted by Joseph Palermo on Friday January 13, 2012 at 12:28PM

Ask for Help

"When using the wkhtmltopdf library via the PDFKit gem, if you use an HTML snippet that does not have a height defined, it generates a PDF that appears to only be an image, the text is not searchable or selectable. If you give your element a height however, it behaves as you would expect. Both PDF documents visually look the same though."

Ask for Help

"Trying to write a custom Rails I18n exception handler to catch MissingTranslationData exceptions"

The API didn't seem to do what it claimed it should.

"RubyMine EAP undo behavior seems broken, it only wants to undo a file deletion, and then go back no farther in history."

It was suggested that RubyMine undo is context sensitive, and having focus on the file browser has a different undo stack from the editor window.

"mysql2 gem on Lion is giving us an error: "Library not loaded... Image not found" and then a path pointing down into our RVM directory."

Building the gem with options pointing to your mysql directory was suggested.

Interesting Things

"git checkout -" will toggle you between your last two checkouts (branches or just plain SHA's). Handy if you are switching back and forth. Can't seem to find it mentioned anywhere in the docs though.

Joseph PalermoJoseph Palermo
SF Standup 06/16/2011: Instantiate Paperclip model?
edit Posted by Joseph Palermo on Thursday June 16, 2011 at 11:31AM

Ask for Help

"I have paperclip columns from a custom sql query. Is there any way to instantiate the associated objects just to generate the paperclip urls for those attachments?"

Calling new on the base class and passing in the data does not seem to work.

Interesting Things

The script tab of the webkit inspector has breakpoints for all kinds of events. Is a click event not behaving like you think it should? You can easily check a box and have all click events open the debugger.

Joseph PalermoJoseph Palermo
SF Standup 06/14/2011: Case Sensitive File System
edit Posted by Joseph Palermo on Tuesday June 14, 2011 at 11:28PM

Ask for Help

"Why do NULL values get inserted as strings when using mysql LOAD DATA INFILE after dumping the data with mysql -e"

Unfortunately this team only has control over the import, not the existing export. Their only option found was to replace occurrences of NULL with \N after getting the import file.

Interesting Things

A team again reminds us to be aware that the default file system in OSX is case insensitive. They thought this was the reason git would not commit a lowercase file rename for them. However, this setting was later found for your .git/config file.

[core]
ignorecase = false

Joseph PalermoJoseph Palermo
Standup 11/23/2010: Cucumber eating sessions
edit Posted by Joseph Palermo on Tuesday November 23, 2010 at 09:31AM

Ask for Help

"Why is Cucumber clearing our sessions between requests?"

A team is doing Cucumber/WebRat tests of a SAML authentication flow using Devise. No matter what they do, their session seem to be getting cleared between requests. It was suggested to write a vanilla Rails integration test to see if the problem is in Cucumber or the App.

"Any recommendations for a CMS to use with Rails?"

The textarea backed by a single model just isn't cutting it anymore and we probably don't want to end up building our own. Any success or horror stories?

Ask for Help

"S3 is giving us 400 timeout responses on every first upload for a request. All subsequent uploads for the same request seem to work fine."

This turned out to be a bug in the HEAD version of Paperclip. They added a fingerprint method that creates a MD5 hash out of the original file, but the method forgets to rewind the original file when done. So S3 times out while waiting for data, but then rewinds the file before trying again. So it does ultimately get uploaded, but it was leading to ~10 second delays in the middle of the request.

Interesting Things

  • Be careful when doing MyModel.find_by_column-that-is-a-string in ActiveRecord. If you pass it an integer it won't do a type conversion and will pass it down to SQL as an unquoted integer. MySQL will then not use any indexes you have on that column. This is with Rails 2.3.x and MySQL 5.0.x

Ask for Help

"Does anybody have solutions for a public sandbox?"

They want people to be able to modify their data, but want the data to roll itself back to the clean state at specific times, or after certain events have happened.

Some people are having problems with the latest RubyMine EAP build. When using our standard keyboard map they are unable to make new lines, they have to use Shift-Enter.

Interesting Things

  • People have good things to say about http://html5boilerplate.com/
  • A team ran into a problem with https and S3. Using the bucketname.s3.amazonaws.com syntax instead of the s3.amazonaws.com/bucketname syntax can fail when using https if your bucketname has too many segments. This is a known limitation of wildcard certificates.

Joseph PalermoJoseph Palermo
Standup 03/25/2010: Something Interesting from the post
edit Posted by Joseph Palermo on Thursday March 25, 2010 at 09:21AM

Ask for Help

"Is there any library for Base64 encoding on the iPhone?"

Interesting Things

  • Some Pivots created a jasmine-nodejs project to run your Jasmine specs headless using node.js

  • A team was getting the below error numerous times while running tests. They managed to track it down to a libxml / Nokogiri load order problem. The errors go away if they require libxml before they require Nokogiri.

ruby(59005,0xa0797720) malloc: *** error for object 0x9586b80: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

Joseph PalermoJoseph Palermo
Standup 03/06/2009
edit Posted by Joseph Palermo on Saturday March 07, 2009 at 07:42AM

Interesting Things

  • If you're using ack in project for textmate, be sure to edit your .ackrc file to include any non-standard file types you're using.

  • A project had a dramatic speed up in their test suite by mocking out ActionMailer in tests. Something to consider if your tests cause a lot of email side effects.

  • field_named wasn't working for us when using Webrat to drive Selenium. Our fork with the simple fix can be found here.

Joseph PalermoJoseph Palermo
Standup 03/05/2009
edit Posted by Joseph Palermo on Friday March 06, 2009 at 12:09AM

Interesting Things

  • Giving your fake acts_as_fu model the same name as an actual model you have can lead to very obscure test failures. For those not in the know, acts_as_fu gives you the ability to test your model extensions directly by creating a fake model in your tests and mixing your extensions into it.

  • A few people have been using Paperclip to manage their attachments and have found it easier to integrate than Attachment_fu.

Other articles: