increase acceptable email size in Plesk with Postfix

If you want to increase the acceptable size of an email on your server configured with Plesk (> 11), this might help:
In order to increase it to over 50M, you have to configure the mailbox_size_limit parameter in Postfix to 0. This limit is totally arbitrary and needless if using Plesk. It says in the knowledge base (http://kb.parallels.com/de/119263), that Plesk controls the size of a mailbox independently.

Anyway, this saved my afternoon. Hope it might save yours one day. πŸ˜‰

Advertisements

rails test db cheat sheet

Just a little cheat sheet about test databases for a rails application:

rake db:test:clone            Recreate the test database from the current environment’s database schema
rake db:test:clone_structure  Recreate the test database from the development structure
rake db:test:load             Recreate the test database from the current schema.rb
rake db:test:prepare          Check for pending migrations and load the test schema
rake db:test:purge            Empty the test database.

Unfortunately, this is not part of the standard help output from rake -T. 😦

how to migrate your rails test database – despite of FactoryGirl

Suppose you write this application in Rails. You wanna be a good developer and use test-driven-development (TDD). Now suppose you use Rspec and FactoryGirl to specify your tests. You write tests, go from red to green and everything is fine.

Then a bit later you have to regenerate the test db and boom! rake aborts with an error (“could not find table roles”), originating from your test spec. 😦 It occurs everytime you run the migrations or try to open the console in test environment.

After hours of trying to fix this and googling around, I came across a solution:

You have to write your factories in FactoryGirl in a way that uses lazy evaluation (or late evaluation). This means, that the expressions within your factory will be resolved when you call the factory – not earlier. You can specify this with curly brackets {} around the expression, like in this example:

factory :involved_user, class: User do
 email "involved@example.org"
 # the curly brackets are important to avoid an error with
 # FactoryGirl and Migrations
 # this used to be: roles [Role.find_by_name("involved_user")]
 roles {[Role.find_by_name('involved_user')]}
end

After the change – bingo! – it all worked fine.

I found the solution here on Stack Overflow: http://stackoverflow.com/questions/12423273/factorygirl-screws-up-rake-dbmigrate-process

migrate your iTunes Library to a new computer

The scenario is pretty common: You get a new computer and you have to migrate your music and stuff in iTunes over to the new machine.

Apple has a pretty good rundown for everyone keen enough to try this endevor: http://support.apple.com/kb/HT4527#2

The trick is, that even though your content (music, videos, etc.) kann be stored in a different location – the Library-Metadata is not. You can set the path to your content (in Windows-Version) under Edit -> Preferences -> Advanced -> Location. However, as I pointed out, the Metadata is not stored there. It lives under “c:\users\[your username]\Music\iTunes”.

On the new machine:

  • install iTunes
  • open iTunes
  • close iTunes
  • move your metadata-folder (c:\users…) to desktop
  • copy your old metadata-folder from your old computer to the new computer
    • to c:\users\[your username]\Music\iTunes
  • copy your content-data to the new computer (same path as on old device)
  • start iTunes

I expected a lot of trouble doing this, but it worked like a charm! Thanks Apple! (once again)

my attempt to integrate facebook into my rails application

A word of warning before I get to my story: This takes a lot longer than you might anticipate! I started of doing this as a sunday morning excercise and it took me all day to just cover the basics. πŸ˜‰

So, the goal is to integrate facebook – to be precise: facebook connect – into a rails application. The application runs on Rails 2.3.5 – which is the latest stable version as of this writing. Rails 3 is on the way, but not yet ready for production yet – let alone the gems, that I use.

In the last days, facebook released a new API that will make you wanna go out and give the world a hug if you ever had to work with the old one. πŸ˜‰ The new API is RESTful and it uses OAuth2 for authentification. Let me say it again: this is gonna make your life so much easier! Thank you to the guys at facebook to finally take the high road and use these standards in their implementation. The guy that got me interested in this topic (Michael Bleigh, http://intridea.com/about/people/mbleigh) suggests that it might have something to do with the guys from FriendFeed joining the Facebook team. You can read his full post, that I highly recommend here:
http://intridea.com/2010/4/22/oauth2-gem-just-in-time-for-facebook-graph.

Another good starting point is the official API documenation at
http://developers.facebook.com/docs/api

Michael implemented the OAuth2-Library in Ruby and even better, he released it as a gem. To top it of, he even supplied a rails example on how to use this with facebook’s API. So, many thanks to Michael for this ingenius project!
I went ahead and installed the gem with the usual

gem install oauth2

which went smooth. Then – as suggested by the example, I generated a controller for the OAuth authentication (inside the rails-directory):

./script/generate controller oauth

Follow the example and one of the Tutorials out there for the rest of the steps. I gave up a while ago and settled for the devise gem.

Ruby on Rails ON WINDOWS – finally (done right)!

This is something I’ve been waiting for ever since I got hocked with Ruby on Rails: An easy way to install it on a windows machine. I deploy on Linux-machines, I usually also developed on such a maschine. Since I am told, that I’m generally to poor to buy the MacBook Pro I desire so much, I’m stuck with windows on the Desktop-Machine.

Now I have finally found something, that makes Ruby on Rails on Windows really usable for the first time! It’s the RailsInstaller Project from EngineYard (railsinstaller.org).

It has treated me very good so far, just one minor problem: It assumes, that you have a clip.exe on your system, which seems to be deployed with all Server versions since 2003 and Windows 7 appearantly. Since I’m still on XP, I had to download it manually (see this tip here, or download it directly from Microsoft) and put it in my c:\windows\system32 folder. Now it’s working like magic. πŸ˜‰

I’m very excited to see, how this goes on for me and what functionality I can actually use on windows – which usually lacks the c-bindings a lot of gems still have.

Update #1: It turns out that you can even install native extensions. The RailsInstaller includes a package called the “Development Kit” (here on github) which includes the necessary headers, libs etc for compiling the extension on windows. Brilliant! πŸ˜‰

fetchmail + Postfix = mail forwarding loop

Just a short thank you for the author of this little snipplet:
"
This will hopefully save somebody hours of googling........

If using fetchmail with kolab, you may be collecting from an isp who uses
qmail.  Qmail puts a 'delivered-to' line into the mail header.  When
fetchmail passes such a mail onto postfix, postfix will read such a line in
the header, and throw up a 'mail forwarding loop error, and not deliver the
mail to the local user.

The solution is to place 'dropdelivered' in the .fetchmailrc file as per the
example which follows:

poll mail at yourdomain.uk.com proto POP3
user thisonedrovememad4hours at yourdomain.uk.com password foobar dropdelivered
is localuser1 at yourdomain.uk.com here
user foundtheanswer at yourdomain.uk.com password yippee@@ dropdelivered is
foundtheanswer at yourdomain.uk.com here
"
his contact seems to be: vincent at acheson.uk.com vincent at acheson.uk.com 

Whoever you are, you just saved my evening! Thank you very much!