General

How to send a large quantity of email in Rails, using ar_mailer

Radu Cojocaru

email-newsletterSending a large number of emails is not an easy task. It can take a lot of time so you need to do it asynchronously. Also, if you are on a shared hosting, you might be limited to a certain number of emails per hour, so you need to divide your list of email addresses in batches and send them at certain intervals.

There’s a plugin that can help us with this: ar_mailer.

This plugin adds a new deliver method to ActionMailer::Base :activerecord. In this delivery method, emails are not actually delivered, they are stored into a database table. A ruby script ar_sendmail can then be run (in a cron job) in order to send the emails saved in the database.

Step by step intructions on how to use the plugin:

1) Install the plugin

./script/plugin install git://github.com/adzap/ar_mailer.git

Add following line to config/environment.rb:

config.gem "adzap-ar_mailer",

Continue reading

iPad Characteristics

Ivan Kalaica

This is abstract about key iPad features and characteristics. Here you can learn few differences between iPhone and iPad phenomenon. :)

  1. Split view – you can use this iPad-only element to display more than one view onscreen at a time, such as to present data in a master-detail or source list–style arrangement. The split view is a common organizational element in iPad applications because it helps flatten the information hierarchy.
  2. Popover – you can use this iPad-only view to temporarily display additional information, controls, or choices related to content

Continue reading

Microsoft on the verge of releasing Windows Mobile version 2.0

Brad Midgley

OK… sorry about the inflammatory title, but it really does feel like MS has been coasting since it came out with its first mobile software release. I’ve used Windows Mobile on two Dell Axim revs and two cellphones. Instead of feeling like each new OS revision was an upgrade, it just felt like the same thing with a few more applications included and a few more options in settings. Before that I went through almost every model of the Apple Newton… at least with Newton, each OS update and device update felt like a significant improvement.

Windows Mobile currently has the worst browser in any shipping operating system and made development for mobile web sites or multiplatform mobile development (Rhomobile) very difficult. I’ve had countless customers tell me “no one uses” Windows Mobile so they didn’t want to target it. Lots of people use Windows Mobile every day, but the fact

Continue reading

Code blocks with optional arguments in Ruby 1.8.x

Ruby 1.9 has some cool new features. One of them is the ability to define default values for the arguments passed to code blocks, like in the following example:

pow = proc { |a, b = 2| a**b }
 
pow.call 3, 3
# 27
 
pow.call 3
# 9

This is very useful, for instance, when we dynamically create new methods using metaprogramming and want some of the arguments for these methods to be optional.

class MyMath
  class < < self
    define_method :pow do |base, exponent = 2|
      base**exponent
    end
  end
end
 
MyMath.pow 3 # 9
MyMath.pow 2, 3 # 8

But in Ruby 1.8.x we can’t do that, we can’t define default values the arguments of a code block. So what if your application runs on 1.8.x and you need to dynamically create methods with optional arguments? There is a solution, not so elegant as the

Continue reading

How long will it take to understand Rails 3 in and out?

Brad Midgley

According to David Heinemeier Hansson, you will never understand it all. Case in point? David himself.

That was the gist of his answer to how a new change to the way rails 3 renders actions in the browser would be handled for older browsers.

DHH gets involved in the parts he cares about and doesn’t worry about the exact details that have been delegated to someone else. He says we should not worry about knowing the whole framework because he doesn’t either. We don’t need to live up to an impossible standard.

Continue reading

How to Fix Chrome for Mac Broken Fonts

Mauro Dalu

ChromeFontBrokenIf your Google Chrome browser is acting awkward with fonts like in the picture (displays all “A” characters) instead of serif fonts or of all fonts, you may need to clean your Mac OS X Font Cache.

Here’s how to do it.

Continue reading

Google Chrome vs. Safari

Mauro Dalu

chrome-091208Everyone can finally download the public beta of Google Chrome for Mac. Many could think this is a piece of software that should only appeal to windows users, since they are the most subject to be unsatisfied by their Internet Explorer standard web experience, however there are reasons for you to try out Chrome even if you’re a happy Safari user.

At least, these are 3 reasons why I’ll try it out.

Continue reading

Linux kiosk

Brad Midgley

I recently did some maintenance on a linux-based kiosk project. It runs linux and has a rails application serving content. Firefox is running in a kiosk mode and there is no keyboard or mouse present.

In adding a touchscreen from a different vendor, I found some details that can help make a kiosk application more responsive to touchscreen taps.

If you use linux in a touchscreen implementation, I recommend staying away from linux drivers offered by the vendor if possible. These were very out of date and X refused to load them. Use evtouch if possible. Install the package:

apt-get install xserver-xorg-input-evtouch

Note that most of the parameters to the driver are meant to discourage it from giving us complicated mouse emulation behavior like mousovers, middle/right clicks, dragging, etc. It needs to be just the simplest it can be for kiosk operation. People will push buttons too long, unintentionally try to drag

Continue reading

Turning technologies upside down: exchanging web and embedded approaches

Brad Midgley

I’ve posted about working in Rhomobile to develop for embedded platforms. This work has been progressing and we’re seeing the platform mature as developers are pushing its limits.

This is a platform that has code snippets that look like rails. An entire page for listing several firefighter rotations for example can be as simple as:

<div>
<h1 id=”pageTitle”>Rotations</h1>
</div>

<ul id=”rotations” title=”Rotations” selected=”true”>
<a href=”/app/Rotation/new” target=”_self”>New</a>

< % @rotations.each do |rotation| %>
<li>< %= link_to rotation.name, :action => :show, :id => rotation.object %></li>
< % end %>
</ul>

Now, contrast this with working in Cappuccino, a framework that uses a javascript dialect and framework inspired by Objective C and Cocoa. This code deals with a model object:

@implementation Segment: CPObject
{
    CPString name @accessors;
    int order;
    Template template @accessors;
    CPMutableArray media;
    CPMutableArray images;
    int startTime @accessors; // relative to 0 seconds, i.e. start of 

Continue reading

Climate change: are we at the “point of no return”?

Mauro Dalu

Post by Giuseppe Dalu. During the fifties was spread the idea that consumerism would bring development and prosperity, but already in the sixties we began to see two side effects:

1. Negative impact on the environment, and the “disposable” approach very soon led to the problem of waste disposal, still unresolved;

2. Increasing the gap between rich and poor countries, and also between rich and poor people within the same country.

McNamara realized, and denounced the fact that 20% of the population was using no less than 80% of the world’s resources (Robert S. McNamara, U.S. Secretary of Defense from 1961 to 1968, president of World Bank from 1968 to 1981). Volunteerism was encouraged (ie Peace Corps) and other smaller initiatives, with a too limited scope and duration to produce tangible effects.

Continue reading