Skip to main content

Posts

Showing posts from December, 2006

Ruby on Rails: How to load session objects into console

This took a little bit of poking around, so I decided to post it here. Basically I was tracking down a bug, which resulted in a corrupt object (cart) in the web session. So I thought, it would be nice to play with this object in the console to see what's up... But how do I get it in there? There may be a more elegant way to do this but here is how I got it to load: Look in tmp/sessions and find the most recent file (ls -alrt on UNIX). Let's say the file is called 'tmp/sessions/ruby_sess.8eb9614a7e4e1e3b' Open console and type: >> session = Marshal.load(File.open('tmp/sessions/ruby_sess.8eb9614a7e4e1e3b')) => {"hash"=>{:cart=... >> cart = session["hash"][:cart] .... In this case I was trying to access a cart object in the session, which was placed in the session with: session[:cart] = Cart.new That's it!

Wanted: 11.3Tb flash drive to move house to a new location

Isn't it just great that these days you do not need a truck to move stuff? As long as the stuff you are moving is digital. I was thinking that in a pretty near future each house may include a giant mass storage that holds everything we own which can be digitized. Such are the books, photos, personal documents, bills, music, etc. All of those things are already available in a digital form, but what about furniture, kitchen counters, decorations, paintings, or the super-heavy piano for god's sake? What if... the house of the future is a completely configurable and intelligent hardware device that can reconfigure itself to it's owner's liking and create those items entirely from it's own supply of materials? What if the paintings can be built into walls and show digitized image, books are digital single-page fold-out with downloadable content, furniture can be created from built-in modules... Then - instead of moving your stuff you just have to download your ex