PostGIS psqlostgis ERROR could not load library /usr/lib/postgresql/8.4/lib/postgis-1.5.so

Trying to install PostGIS and you can’t get past this error?

psqlostgis.sql:57: NOTICE:  type “spheroid” is not yet defined
DETAIL:  Creating a shell type definition.
psqlostgis.sql:57: ERROR:  could not load library “/usr/lib/postgresql/8.4/lib/postgis-1.5.so”: /usr/lib/postgresql/8.4/lib/postgis-1.5.so: undefined symbol: GEOSHausdorffDistance
psqlostgis.sql:63: ERROR:  current transaction is aborted, commands ignored until end of transaction block
psqlostgis.sql:68: ERROR:  current transaction is aborted, commands ignored until end of transaction block

A simple solution to your problem is the following voodoo command Read the rest of this post »

Posted on March 10, 2010 at 12:44 pm by Jordan Carter · Permalink · Leave a comment
In: Ruby on Rails, Server Config · Tagged with: , , , ,

Open remote application window over ssh – X11

You left the office but forgot to leave an application running.  An application that requires it’s GUI, you try to open it via ssh but “Error: Can’t open display” prevents you.

Simple fix here, you will kick yourself.

DISPLAY=:0 <command>

for me this translated into

DISPLAY=:0 transmission

What this does is instruct the application to open in display 0, which is the remote machine.

Posted on December 29, 2009 at 8:18 am by Jordan Carter · Permalink · One Comment
In: Ubuntu Tricks · Tagged with: , , ,

Fetch Email Attachments with Ruby on Rails

This snippet is used in one of my projects to automatically import a csv into the database. It uses cron to check an email account via IMAP. When a unread email is found it will try to match it to subject lines in the database. If there is an entry it will attempt to import the attachment in the email. Once done it will email me the results.

I have deleted lines of code which relate to my specific needs to just give you the overview.

Uses Net::IMAP and TMail.

require “net/imap”
class MailImporter

def self.check_for_emails
completed ||= {}
imap = Net::IMAP.new(‘imap.gmail.com’,993,true)
imap.login(“mygmailaccount@gmail.com”, “mygmailpassword”)
imap.select(‘INBOX’) #which folder
imap.search(["NOT","SEEN"]).each do |message_id| #only get messages which are not read
if MailImporter.receive(imap.fetch(message_id, “RFC822″)[0].attr["RFC822"])
imap.store(message_id, “+FLAGS”, [:Seen]) #mark read
end
imap.logout()
imap.disconnect()
completed.each do |data_email, leads|
DataEmailMailer.deliver_imported #email me
end
end

def self.receive(email)
mail = TMail::Mail.parse(email)
data_email = DataEmail.find_by_subject mail.subject #store subject lines in database, only import those which match, could link subject lines to another model if the import has any belongs_to or has_manys
if data_email
MailImporter.import_attachment(data_email, mail.attachments.first) unless mail.attachments.empty?
else
false
end
end

def self.import_attachment(data_email, attachment)
csv =  attachment.read
FasterCSV.parse(csv) do |row|
#parse the row somehow and add it to your DB
end
true #return true if it all went well, could use a condition here and relate it to the import
end
end

Posted on December 28, 2009 at 8:34 am by Jordan Carter · Permalink · Leave a comment
In: Ruby on Rails · Tagged with: , , , , ,

Factory Farming Possibility in NZ

Get the full story and how to oppose the factory farming

Posted on December 8, 2009 at 1:34 pm by Jordan Carter · Permalink · Leave a comment
In: Uncategorized

Ubuntu 9.10 Karmic Koala Fonts are wrong size

I have had a strange issue where my fresh install of Karmic Koala Ubuntu 9.10 render the fonts wrong. My friend had also just done a fresh install and had no issues. I tried messing with my DPI setting in the display options but to no luck.

I just tried installing the Microsoft Fonts and it fixed it!

sudo apt-get install ttf-mscorefonts-installer

I didn’t even restart firefox, just refreshed the page and all my website’s rendered correctly. Jordan: 1, Ubuntu: 1.

Posted on November 19, 2009 at 6:24 pm by Jordan Carter · Permalink · Leave a comment
In: Ubuntu Tricks · Tagged with: , ,