Author Archive

Is your Netbeans running slower? Try this trick.

I use NetBeans 6 all the time on my laptop and have learned how to configure it
to run more effectively for me.
NetBeans, like any Java application needs room to work, and the default memory settings
for Java and NetBeans are usually not what I consider ideal.
Of course how would they know what is ideal, you need [...]

Run acts_as_solr in JRuby in background mode

When you try and run rake solr:start or rake solr:stop it uses Kernel.fork to spawn of a child process. However in JRuby this is disabled by default due to concurrency issues. And this prevents your solr rake tasks from running under a JRuby environment…

The Problem

When you try and run rake solr:start or rake solr:stop it uses Kernel.fork to spawn of a child process.
However in JRuby this is disabled by default due to concurrency issues. There is an option to enabling fork (jruby -J-Djruby.fork.enabled=true)
within JRuby but it is experimental and as the warning says, “WARNING: fork is highly unlikely to be safe or stable on the JVM.” as it can cause all sorts of weird and wonderful side-effects.

The Solution

The solution therefore is to simply alter the solr:start and solr:stop tasks to use Kernel.exec instead.
To do this find the solr rake tasks usually in {RAILS_ROOT}/vendor/acts_as_solr/lib/tasks/solr.rake. In the start task all that is required is to comment out the start of the fork block. so you only have the exec method call,
This will not start the solr process in the background. To do so you just have to add “&” at the end of the exec command, which causes the jar file to run in background mode.

Ruby Mixin Tutorial

In Java you just have classes (both abstract and concrete) and interfaces. The Ruby language provides classes, modules, and a mix of both. In this post I want to dive into mixins in Ruby.
In the Ruby language a mixin is a class that is mixed with a module. In other words the [...]

Center Page Horizontal & Vertical with plane CSS & HTML

Vertical centering has always been awkward with css as vertical-align only refers to inline elements within a single line and not to block level elements. However vertical align does apply to table-cells also so we can use this to our advantage in browsers that support display:table such as mozilla and opera.
We can also cater for [...]

10 Essential Plugins For Your Wordpress Portfolio

One of the best things about Wordpress is the thousands of plugins available for free. No matter how you want to customise your site, there’s probably a plugin to do it. From turning it into an ecommerce store to automatically pulling in content, the possibilities are endless.
When it comes to portfolio sites, you don’t really [...]

How Do I Enable remote access to PostgreSQL database server?

By default, PostgreSQL database server remote access disabled for security reasons. However, some time you need to provide the remote access to database server from home computer or from web server.
Step # 1: Login over ssh if server is outside your IDC
Login over ssh to remote PostgreSQL database server:
$ ssh user@remote.pgsql.server.com
Step # 2: Enable [...]

Setup Capistrano to deploy Rails application on Amazon EC2 with Git

1: Create a new Rails app – we’ll call is ‘deploytest’
$ rails deploytest
$ cd deploytest
2: Create a local Git repository for it
$ git init
$ git add *
$ git commit -a -m ‘initial commit’
$ git status
3: Create a couple of Capistrano files
$ capify .
4: Edit config/deploy.rb
# The name of your app
set :application, “deploytest”
# The directory on [...]

Installing PostgreSQL on Snow Leopard 10.6

Installing PostgreSQL 8.3
First, you’ll need to install Xcode if you haven’t already. This is available on the Snow Leopard DVD in the Optional Installs directory.
Second, if you aren’t already using it, download Mac Ports for Snow Leopard and install it. Mac Ports has come a long way in the last few years and will make [...]

Send SMS from Ruby On Rails application using web service, SOAP API

SOAP4R is a Ruby library for accessing Web Services via SOAP. Recently I had a chance to explore SOAP4R. Here’s how to get started with it.

Installation
Although Ruby 1.8.x comes with SOAP4R in its standard library, it is an old, buggy version. I highly recommend using the latest gem (1.5.8 as of the this update). It [...]