Friday, February 27, 2009

schema-less table using MySQL

http://bret.appspot.com/entry/how-friendfeed-uses-mysql

A nice solution to FriendFeed's scaling problems.

Basically, they're doing a bigtable variant using mysql. The consistency check discussion at the end of the article also seems reasonable.

Friday, February 20, 2009

good to know

Array.count was added in ruby 1.8.7, but our deployment environment has 1.8.6, so you need to stick with Array.length for the time being. Hooray individual integration (thanks nathan!)!

--
Love,
Fritz

Thursday, February 19, 2009

dynamically selecting constants from a class

If you haven't yet, check out consts_starting_with() in vendor/plugins/aardvark_shared/lib/active_record_extensions.rb. It dynamically collects constants from a class. For example if your constants start ADDED_CONTEXT_* you can collect them all into an array like so: 

VALID_ADDED_CONTEXTS = consts_starting_with('ADDED_CONTEXT_')

--
Love,
Fritz

Wednesday, February 18, 2009

carbon5 blog post about unittesting for iphone apps


http://blog.carbonfive.com/2009/02/testing/iphone-unit-testing-toolkit

--
Love,
Fritz

Get the date in your OS X menubar

I noticed today that Tim had the day of the month in his Mac's clock display, which I've wanted for a long time (I look at my watch for the date at least three times a day, because it's not the sort of thing I bother to remember, but should be).

To get this is kind of tricky: you go to System Preferences > International > Formats. Click "Customize" in the Dates area, select any date-related fields you want, and copy them to your system clipboard. Then, go back and click "Customize" in the Times area, and choose "Medium". Then, paste in the fields and massage formatting to your heart's content. Et voila, you can have the date fields available in your menubar, beyond just the day of the week.

i did not know you can do this

I've always found the default failure message for most validations really unhelpful. For example, with a "validates_inclusion_of :added_context, :in => VALID_ADDED_CONTEXTS" the failure message is:

ActiveRecord::RecordInvalid: Validation failed: Added context is not included in the list

However! You can use {{value}} and when specifying a message, for example:

  validates_inclusion_of :added_context, :in => VALID_ADDED_CONTEXTS,
      :message => "Value {{value}} not listed as a valid context in Interest::VALID_ADDED_CONTEXTS"

And now if I pass in an illegal value "your mom" we get something much more useful:

Added context Value your mom not listed as a valid context in Interest::VALID_ADDED_CONTEXTS

--
Love,
Fritz

Celerity | Easy and fast functional test automation for web applications

http://celerity.rubyforge.org/

Wednesday, February 11, 2009

ah hah! why IDEA sometimes doesn't let you run individual tests

I've wondered for a while why idea lets you click on some tests in
order to run them individually whereas in other test files it will
only let you run the whole thing. It's really annoying. Well I finally
just noticed why: if not all your methods start with test_ (or setup
and teardown I suppose) then it won't let you run individual tests!
I'm not sure why, but I'd like to find out, and it's good to know. If
you have helpers in the test, IDEA won't find the individual tests!

--
Love,
Fritz

creating a password protected zip archive on mac osx

~> sudo port install zip
# you can also use fink

~> sudo mv /usr/bin/zip /usr/bin/zip-old
~> sudo ln -s /opt/local/bin/zip /usr/bin/

~> zip -e new_zipfile_name.zip /path/to/file1 /path/to/file2 ...

# enter password when prompted...

# note that this will open perfectly normally under windows
# but under mac osx you need to use either unzip via a terminal
# or download and use stuffit expander to open the file
# mac osx's bomarchivehelper does not handle password zip files

useful password generator site

http://www.pctools.com/guides/password/

hotmail adds pop, integrates inbox msn chat

http://lifehacker.com/5151551/hotmail-enables-pop3-for-us-users

the pop3 support will let us eventually fix up our various email forwarding nonsense (currently we forward all email to our Google apps aardvark@vark.com account, and then pop it out; this adds email latency).

the integrated chat obviously is helpful for our product.

Tuesday, February 10, 2009

Back Door References Can Hurt

http://feeds.feedburner.com/~r/jrothman/nZRY/~3/535886852/back-door-references-can-hurt.html

confluence IM presence plugin

http://confluence.atlassian.com/display/CONFEXT/Confluence+IM+Presence+Plugin

Continuous Deployment at IMVU

http://timothyfitz.wordpress.com/2009/02/10/continuous-deployment-at-imvu-doing-the-impossible-fifty-times-a-day/

A great case study for continuous deployment. We have a bit of work to do before we reach this point, but we have the right foundation.

Friday, February 6, 2009

cool: multiple "inbox" views in gmail

http://gmailblog.blogspot.com/2009/02/new-in-labs-multiple-inboxes.html

--
Love,
Fritz

Will it parse? i =+ 1

In this week's episode of "Will it parse?": i =+ 1

The answer is, of course, yes! Ruby just assigns +1 to i. I discovered this when my confusion matrix came out as all zeros and ones...

Thursday, February 5, 2009

an example of what NOT to do from the ruby standard library

What's wrong with Ruby's implementation of conditional variables here? Hint: what's wrong has nothing to do with synchronization, concurrency, or conditional variables.

class ConditionVariable
class Timeout < Exception; end

# Create a new timer with the argument timeout, and add the
# current thread to the list of waiters. Then the thread is
# stopped. It will be resumed when a corresponding #signal
# occurs.
def wait(timeout = nil)
@monitor.instance_eval {mon_check_owner()}
timer = create_timer(timeout)

Thread.critical = true
count = @monitor.instance_eval {mon_exit_for_cond()}
@waiters.push(Thread.current)

begin
Thread.stop
return true
rescue Timeout
return false
ensure
Thread.critical = true
begin
...


--
Love,
Fritz

Tuesday, February 3, 2009

openfire has a simple presence plugin

http://www.igniterealtime.org/projects/openfire/plugins/presence/readme.html

This would allow some simple dashboard status reporting of aardvark's legacy handle status as reported by openfire, w/o requiring opening up or logging into the admin console.

Probably not as useful as just getting heartbeat monitoring working on our legacy network handles, but the presence page in openfire's admin console has been a useful debugging tool in the past for times when when openfire is mis-reporting the status of a handle.

Sunday, February 1, 2009

use_db and Transactional Fixtures

Randy and I spent some time tackling this on Friday.

First off, I should note, use_db "is a piece of crap. Don't use it"...this according to its project page on github: http://github.com/jcnetdev/use_db/tree/master.

In the databuilder project, we use the ML db as the primary and configured use_db for to use aardvark database for shared models. While fixtures for aardvark database located in test/fixtures seem to work, transaction fixtures do not. We poked around in the use_db library and couldn't find where it went wrong. After 20 mins, we gave up.

So AFAWK, use_db doesn't adequately support transactional fixtures on the secondary database.