Sam Pierson's blog
Help
- Perform_caching is not respected by Rails.cache methods. config.action_controller.perform_caching does not appear to affect the Rails.cache methods. Rails 2.1 introduced a new custom caching mechanism:
result = Rails.cache.fetch('key') do
# create and return item for this key
end
It would be really nice if, for testing, you could set a configuration variable that would force a cache miss every time and always execute the block associated with the fetch. However it appears that, understandably, action_controller.perform_caching only affects the kinds of caching implemented by ActionController (page, action, fragment) and not this caching mechanism that is implemented by ActiveSupport::Cache::Store. Looking at the code, is appears there is no way to disable this caching mechanism other than supplying :force => true to the fetch call to force a cache miss.
- W3C refusing to serve DTDs to 'misbehaving' clients. One of our applications that has not been deployed for a while is starting to see issues from IE users. After digging, we found this: W3C's Excessive DTD Traffic and this w3.org DTD/xhtml1-strict.dtd blocks Windows IE users?. To summarize, w3.org got tired of getting slammed with non-cached DTD requests, and cut off misbehaving user agents (ones that do not cache the DTD). IE is one of these.
We have several things so far, none of which work:
Forcing xhtml DTD to be a SYSTEM dtd, and load the DTD files off the local server. This didn't work - IE serve the pages as raw unrendered html (must have thought it was XML?)
Use a PUBLIC doctype pointing to the DTD served on our server. Alas, this had the same problem as the SYSTEM doctype in #1 - raw unrendered HTML.
Not using XHTML (e.g. have as root tag). This didn't work (haven't looked into why yet).
Ideas are welcome.
Interesting
- Range#min, Range#max: Don't use them. Use Range#first and Range#last. Min and max are not overridden by Range so fall back onto Enumerable which then converts the Range into an Array first!
Interesting
It looks like Rubymine 1.0 is out.
Shared examples pollute! If you import a shared example into an RSpec group, the before :each appears to run for all examples in that spec, not just the ones in the current scope.
SWFObject + AssetPackager = :(
SWFObject stops working on some platforms (IE, FF2 on Windows, and others) when used in conjunction with AssetPackager. This will make you sad; don't do it.
Help
"Anyone have experience dealing with failures in Amazon SQS?"
- Amazon Simple Queue Service is a reliable, highly scalable, hosted queue for storing messages as they travel between computers. You can place tasks in a queue and have worker systems extract and process them. However processing a queue item does not delete that item; you have to explicitly delete a queue item. The problem occurs when a persistent catastrophic failure occurs during processing of an item, e.g. a process core dump (say RMacick encounters an Image of Death) that does not produce an exception. Eventually SQS will timeout and mark the task as requiring processing again. Eventually all yor workers will try to process the queue item and die. There was a lot of discussion (e.g. communicate task status back to app server - too chatty, not scalable) but no obvious solutions arose that will work in the particular environment.
Interesting
SF.TUG: The first Tracker User Group will meet tomorrow. This one is somewhat exploratory, to see what the community wants out of it, so it is being kept purposefully small.
should_not is not the same as !=. Apparently, it is a feature of Ruby that you can override == but you cannot override !=. Rspec implements == but cannot implement !=. Sometimes you will get objects that will give different results when compared using should != as opposed to should_not. Use should_not.
Aviary.com is an online Photoshop-like too. They also have a vector editor. It is free, however they may reuse images you store on their site.
Pivotal Library: We are getting a tool from Delicious Monster to automate our library. It will scan barcodes, categorize books and allow people to check books in and out.
Ask For Help
- GemInstaller can fail to install either gem if it encounters two gems in the repository that have the same name but differ in case. Don't ever change the name of a gem or Adam Will Find You.
Interesting Things
- Wrapping multiple named_scopes in a class method then attempting to compose that into another list of named scopes works most of the time :( If it is the first method in the new chain of named scopes, then it will work, otherwise, not so much (it forgets about any constraints from prior named_scopes). This pattern is best avoided.
- We are pleased to announce the existence of gems.pivotallabs.com, a maintained repository for public Pivotal gems. To see it's contents try:
gem list --remote --source=http://gems.pivotallabs.com







