The squirrels are blogging


posted in HowTo, 28.05.10 19:47


HowTo: Share a session with mutliple subdomains in Rails

Sharing a Session between multiple subdomains/rails-apps is quite easy.

Make shure you're using the ActiveRecord (db-based) session store and all instances share the same secret (- obviously the same db, too). In config/environment.rb (config-block):

  config.action_controller.session_store = :active_record_store #store session in db
  config.action_controller.session = {
	:session_key => '_MYWEBAPP', #has to mach over all instances
	:secret      => 'mysecretmysecretmysecret' #has to mach over all instances
  }

Tell rails to set the session-cookie on "all subdomains" by adding this line to config/environments/myenvironment.rb. Note the leading dot in ".mydomain.com".

	ActionController::Base.session = { :domain => '.mydomain.com' }

(Apprently this works only for rails >= 2.3)


posted in Unrelated, 05.03.10 16:12


Google, I don't like your attitude

We've been advertising with Google AdWords for a few months now, during which we spent several thousand euros.

The click quality is good. The prices are fair. Only one thing always bothered us: A complete lack of customer support or a contact person.

Ten days ago we issued the latest bank transfer to AdWords. After the money still hadn't arrived the next day we checked the paperwork and found a mistake. Unfortunately a bank employee missed a "7" in the reference number.

We wrote several emails; and tried online support, yet nothing happened.

We tried the public hotline (0180/1111134). After asking for an account number, an answering machine reefers to the online support and ends the call. What nerve!

We found out about another hotline. Since it is a third party company without any access to account data they couldn't help us.

Our Bank had a private Irish Number, to which they sent a fax, but nothing happened.

Our Lawyer sent a fax, and again there was no reaction.

We're still waiting for our money.

Dealing with Google is nearly inevitable, but be clear about one thing: Regardless whether you're paying or not - Google doesn't "give a shit" about you.

On a sidenote: We applied for Google AdSense. Just out of curiosity. We were rejected several times for dubious reasons ("Unsupported Language: German", "We can't disclose the reason at this time", etc pp). We're in favor of a regulative publisher policy, but still would like to understand the real reason for our rejection.


posted in ActionScript, 26.02.10 12:27


HowTo: Play MP3 with ActionScript 3.0

Playing MP3 from a http source (fake streaming) is quite easy in AS3. It's all done by the flash.media.Sound class.

var mySound:Sound = new Sound;
mySound.load(new URLRequest(myFileURL));
mySound.play();			

One possible pitfall (It took me a few minutes to figure this out): The stop()-method and position-property are not part of Sound, but rather SoundChannel.

var mySoundChannel:SoundChannel;
mySoundChannel = mySound.play();			

Stopping the playback:

private function stopPlayback:void(){
	mySoundChannel.stop();
	try{
		mySound.close();	
	} catch(error:IOError) { ... }			
}

The volume can be set by assigning a SoundTransform object:

soundtransform = new SoundTransform(0.75, 0);
mySoundChannel.soundTransform = soundtransform;

Note: The Sound class can't load a second file after one has been played. To play another file instantiate a new Sound object.


posted in Ruby, 01.02.10 12:08


Speed up Mongrel / RubyOnRails development

This is great! With the Talentsuche.de RubyOnRails app growing the mongrel development server was getting slow and slower. Lately a request took up to 3000ms - that's unusable for front end development.

But there is quick way to speed this up. Mongrels default behaviour is to listen on all interfaces/addresses (0.0.0.0). By setting a single ip you can make it a lot faster.

 ./script/server -b 10.23.23.23 -p 3000

posted in Unrelated, 30.01.10 19:43


Facebook: See friends of hidden profiles

Apparently facebook's autocomplete-script for the friends search returns data it's not supposed to.

Even hidden profiles's friends are revealed. All you need is the profiles uid, which is public.

 (...)

The url of the php script is:

 http://www.facebook.com/ajax/typeahead_friends.php?u=*******&__a=1