Monit Error: Could not create a server socket at port 2812 Cannot assign requested address

Ran into the following error on Amazon AWS EC2 server installations of Monit. In the /etc/log/monit.log file:

1
2
3
4
5
monit: Cannot bind -- Cannot assign requested address
http server: Could not create a server socket at port 2812 -- Cannot assign requested address
monit HTTP server not available
Shutting down monit HTTP server
monit HTTP server stopped

Turns out you must use the Amazon internal URL address. Change the following lines to read as follows:

1
2
3
4
set httpd port 2812 and
# use address localhost # only accept connection from localhost
use address ec2-###-###-###-###.compute-1.amazonaws.com # only accept connection from localhost
# allow localhost # allow localhost to connect to the server and

Updated ‘ec2-###-###-###-###.compute-1.amazonaws.com’ to your own internal URL.

Drupal default_value Won’t Set Default Value Correctly

This was annoying. For Form select objects (and others) the documentation says to use ‘#default_value’ to set the default.

http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#select

Turns out it’s not ‘#default_value’ instead one must use ‘#value’.

This works:

1
2
3
4
5
6
7
  // Membership Status
  $form['member_status'] = array(
    '#type'     => 'select',
    '#title'    => t('Membership Status'),
    '#options'    => array(0 => t('Inactive'), 1 => t('Active')),
    '#value'    => 1,
  );

This doesn’t:

1
2
3
4
5
6
7
  // Membership Status
  $form['member_status'] = array(
    '#type'     => 'select',
    '#title'    => t('Membership Status'),
    '#options'    => array(0 => t('Inactive'), 1 => t('Active')),
    '#default_value'  => 1,
  );

Drupal: Set Header Background Image

Setting a background image is not a straightforward as one would hope.

What works:

1
2
3
4
#header .section {
  background-image: url(../images/background-image.png);
  background-repeat: no-repeat;
}

What does not:

1
2
3
#header .section {
  background-image: url(../images/background-image.png) no-repeat;
}

http://drupal.org/node/653702

Ubuntu 12.04 Ruby on Rails Install

Whoa!  It doesn’t get any easier than this: Sudobits Blog

Finally a method of instantiating a Rails server using Amazon EC2 made trivial.

HTC Screen Capture

Want a screenshot of your HTC but don’t want the hassle of rooting the device or dealing with the Android SDK?

Well, here you go: http://www.fjsoft.at/en/

It’s a bit of overkill, but hey, it works!

Screen Snapshot on Samsung Galaxy 7″ (Froyo Android 2.2)

Holding down the Back button and press the power button to take a snapshot of the current screen.

Set Default to Landscape

The default orientation for Flash Builder is portrait.  One way of setting your Flash Builder app to run in landscape by default is to add a new ‘aspectRatio’ element to the application node within /src/[app name]-app.xml.

<aspectRatio>landscape</aspectRatio>

Google TV Code 100 Error

Funny, while running through the setup of a new Google TV (Logitech Revue) device, the following error message appeared:

! The server is unavailable

An error occurred while processing your data.  Please call Logitech Customer Support at +1 866-654-5644 [Code 100]

[Retry] [Cancel]

The correct number is +1 866-954-5644.

Redline Back or Cancel Button

It would be nice to have a ‘cancel’ or ‘back’ button on at minimum the Administration views. The single Save button on these views tends to leave the user uncertainty in some circumstances.  The problem is the Rails submit_tag posts back to the controller and the link_to tag doesn’t use a button graphic unless you go the CSS route.

This snippet is not optimal in all instances but it works nicely.

<%= submit_tag l(:button_cancel),

{

  :name => 'reset',

  :id => 'reset_button',

  :type => "reset",

  :onClick => "javascript:history.back()"

}

%>

Implemented: