Mostrar / Ocultar Avisos

Archive for July, 2007

Installing ImageMagick and MiniMagick on Windows

I know this has been documented in other places so this is mostly for my own sanity. I want to use the attachment_fu plug-in by Rick Olson for my rails app to upload user avatars. I also want to resize the images and create a series of smaller thumbnails for use throughout the site.

Steps to install ImageMagick

  1. Download the Windows binary of ImageMagick. I used ImageMagick-6.3.5-4-Q16-windows-dll.exe
  2. Run the ImageMagick installer (The file you just downloaded) and accept the defaults.
  3. Open a command prompt to verify the install was successful
  4. Type >convert logo: logo.miff
  5. Type >imdisplay logo.miff
  6. If all went well with the install a little picture of blue wizard should appear.

Steps to install MiniMagick

  1. Install the gem from the command prompt with the command gem install mini_magick. You may be asked to install a few required dependencies. Say yes.
  2. Wait for the download and install to complete.

You should be good now to install attachment_fu, but that is beyond the scope of this article. Use the links below for more information

References:

Easy_Messages

A few weeks ago I was looking for Rails plug-in to provide simple messaging between users on a website. I came across Acts_As_Emailable by Matt Beedle. It was a good start but only gave me a model and some methods but I would still need to flesh out a controller and some views for my little private messaging project to be complete. The result of that work is this plug-in, Easy_Messages. I took Acts_As_Emailable as a starting point and added some controller methods, a few views, a helper, and some named routes.

Below are the installation instructions. This is my first Rails plug-in so let me know if you find something to refactor. I’m open to constructive criticism.

The code is hosted at RubyForge.

UPDATE I: I have created a new branch for 0.51, please use that one for the latest stable release

UPDATE II: I have removed the docs from branch 0.51 and placed them online here: http://easymessages.samuelschroeder.com. Now the generator should work like a charm

svn://rubyforge.org/var/svn/easymessages/branches/RB-0.51

The run the generator to create the model, migration, helper, and views.

script/generate easy_messages message account

Note: Easy_Messages assumes you have Acts_As_Authenticated installed with the defaults of a model named User and a controller named Account. And you must use the above line exactly. I have grand aspirations of making the generator fully dynamic someday but for now you’ll have to deal.

The generator should produce this output.

exists app/models/
exists app/helpers/
exists app/views/account
create app/models/message.rb
create app/helpers/easy_messages_helper.rb
create app/views/account/message_view.rhtml
create app/views/account/messages.rhtml
create app/views/account/send_message.rhtml
exists db/migrate
create db/migrate/###_create_easy_messages_messages.rb

Yes, I realize the redundant naming but once/if I get the dynamic generator going it would say ###_create_easy_messages_[MessageClassNames]s.

Now you have to do three manual changes to your code. First, add “easy_messages” to apps/model/user.rb.

Second, add “authenticated_commands” to apps/controllers/account_controller.rb.

Finally, you need to copy the named routes from vendor/plugins/easy_messages/config/easy_messages_named_routes.rb to config/routes.rb.

That should be it for the setup. So start your development server and point your brower to..

http://localhost:3000/account/inbox

There is also a complete RDoc listing in vendor/plugins/easy_messages/doc

Thanks to…

**Matt Beedle for writing and releasing Acts_As_Emailable.

** Rick Olson for writing and releasing the kick-ass Acts_As_Authenticated plug-in. It was been such a help when starting new projects.

Recommend Me

ASP.Net 2.0 and It’s Crazy Strict Install Order OR Be Careful When Installing Windows Components

Recently, I re-imaged my work machine and had to re-install all of my development tools. See here for a list. The one thing I did pay attention to was to make sure IIS was installed before Visual Studio and ASP.Net 2.0. If you do it backward you’re in for a fun filled day of error messages leading your nowhere. But, I did it right so I didn’t have to worry.

Then this morning everything went to hell and the very descriptive errors appeared and I spent a few hours googling and trying some of the Kbases at Microsoft. Nothing worked until I tried this which states the cause as…

The most probable cause for this error is that you must have installed Internet Information Services (IIS) after the installation of Microsoft .NET Framework 2.0.

But remember I did do it in the right order. Right? To make a long boring story short I was messing around with adding and removing some Windows Components from the Add/Remove Programs wizard and sowhere along the line it must have reinstalled part of IIS. Either that or the Network Gnomes are back.