require 'win32ole'
require 'socket'
@application = WIN32OLE.new('Notes.NotesSession')
def check_file(server, mail)
@database = @application.GetDatabase(server, mail)
@database.Open(server, mail) unless @database.IsOpen
@view = @database.GetView('($InBox)')
dnsbls = %w{bl.spamcop.net cbl.abuseat.org}
count = @view.TopLevelEntryCount
count.times do |index|
doc = @view.GetNthDocument(index+1)
spamdocs = []
doc.GetReceivedItemText.each do |t|
start = t.split(/[()]/)
start[1] =~ /(\d+).(\d+).(\d+).(\d+)/
dnsbls.each do |dnsbl|
begin
var = Socket.getaddrinfo "#$4.#$3.#$2.#$1.#{dnsbl}", 0
puts var[0][2]
if var[0][2] =~ /127.0/
puts "Access denied for #{start[1]} by #{dnsbl}"
spamdocs << doc
end
rescue
end
end
end
spamdocs.each do |doc|
doc.RemoveFromFolder("($InBox)")
doc.PutInFolder("($JunkMail)")
end
end
end
check_file('www/projectlounge',"mail/iconnor.nsf")
Monday, August 14, 2006
Retrospective Spam Filter
As a good spamcop user, I like to report all the spam that slips through the black lists and filters. That way, making sure the network admins know about any open relays they might have while building the black lists. However, a lot of spam comes through over night and I get a full inbox in the morning. When I report most of these, they have already been black listed. So, I thought it would be best to write a script that would check to see if these had already been listed and filter based on this. This way, even if the spam slipped through the black list on the first try, eventually it would be listed and filtered out of the inbox after the fact. This code seems to be working well for my inbox so I thought I should share it for all Lotus Notes and Ruby users:
Saturday, August 12, 2006
Happy birthday and anniversary Dowds

We went out to Ecco for dinner with the Dowds to celebrate 38 year anniversary and Tack's birthday.
We all had a wonderful night and thanks to the staff at Ecco for making it such a pleasant night.
Saturday, July 22, 2006
Installing Ubuntu on a Dell PowerEdge without a CD drive
I recently purchased a very basic DELL in Australia. In the USA, it is impossible to buy a DELL server without a CD ROM and after buying a few there for various reasons, I did not think to ask when ordering the one on the phone. Well, let me assure you, no other CD drive I could get my hands on would actually work and the support staff at DELL were of no help. I even managed to get a DELL CD from a friends PC but it would not work in the server either - the server was just too fussy.
Before sending it back, I thought I would give it one last shot and purchased a 1GB USB key from a local computer dealer. Then downloaded a ubuntu ISO for a CD install. After a few trial and errors and searching on the internet, I think I have the actual instructions to get it working. Although, I am no linux kernel hacker, here goes:
1. Download the ISO that you want (in my case ubuntu 6.06 desktop)
2. Download the syslinux tool for windows (syslinux latest)
3. Optional USB format utility (from HP)
4. Copy the CD contents to your USB device
5. Unzip the syslinux and run it against your USB drive (syslinux.exe -f F:) from the win32 directory of syslinux
6. Copy these files to the root of the USB
7. Then edit the syslinux.cfg so that the vmlinux and initrd.gz now point to the root
e.g.
8. Eject the USB and you can now boot from it as soon as you go into the BIOS settings on the DELL server (F2 at boot) and set the boot order to allow the USB device to boot as a priority
Before sending it back, I thought I would give it one last shot and purchased a 1GB USB key from a local computer dealer. Then downloaded a ubuntu ISO for a CD install. After a few trial and errors and searching on the internet, I think I have the actual instructions to get it working. Although, I am no linux kernel hacker, here goes:
1. Download the ISO that you want (in my case ubuntu 6.06 desktop)
2. Download the syslinux tool for windows (syslinux latest)
3. Optional USB format utility (from HP)
4. Copy the CD contents to your USB device
5. Unzip the syslinux and run it against your USB drive (syslinux.exe -f F:) from the win32 directory of syslinux
6. Copy these files to the root of the USB
vmlinuz (kernel binary) from "casper\vmlinuz"
initrd.gz (initial ramdisk image) from "casper\initrd.gz"
syslinux.cfg (SYSLINUX configuration file) rename and copy from "isolinux\isolinux.cfg"
7. Then edit the syslinux.cfg so that the vmlinux and initrd.gz now point to the root
e.g.
DEFAULT /casper/vmlinuz
GFXBOOT bootlogo
GFXBOOT-BACKGROUND 0xB6875A
APPEND boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram
rw quiet splash --
....Becomes....
DEFAULT vmlinuz
GFXBOOT bootlogo
GFXBOOT-BACKGROUND 0xB6875A
APPEND boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram
rw quiet splash --
8. Eject the USB and you can now boot from it as soon as you go into the BIOS settings on the DELL server (F2 at boot) and set the boot order to allow the USB device to boot as a priority
Monday, July 10, 2006
Disposable email, spamcop and a trap
I will never be afraid to give out my email address again. Well, maybe not my actual address, but I will give away my sneakemail address. This service (http://sneakemail.com), will allow you to generate a random looking email address like "a9svgun0211@sneakemail.com" that you can safely give out. It is a disposable address that you can use to sign up for a given site, tag it for that purpose and then if you get any spam from that site, delete the address.
However, I have recently taken this one step further. I have created a spamtrap address that will automatically report spam to spamcop and blacklist the IP address of the hosting servers. So, instead of deleting the address, I simply re route it to the spam trap and increase the power of the blacklist.
Requires tools:
1. Sneakemail (free accounts available)
2. Spamcop reporting account
3. Automatic report account - the trap account (Thunderbird Reporter or Lotus Notes reporter )
Then you can use your disposable email addresses as you need and have them divert to the spam trap if they start to get spammed.
However, I have recently taken this one step further. I have created a spamtrap address that will automatically report spam to spamcop and blacklist the IP address of the hosting servers. So, instead of deleting the address, I simply re route it to the spam trap and increase the power of the blacklist.
Requires tools:
1. Sneakemail (free accounts available)
2. Spamcop reporting account
3. Automatic report account - the trap account (Thunderbird Reporter or Lotus Notes reporter )
Then you can use your disposable email addresses as you need and have them divert to the spam trap if they start to get spammed.
Friday, June 30, 2006
Brisbane in the morning
Wednesday, June 28, 2006
LotusScript to restore removed QuickPlace
This is a LotusScript button that the QuickPlace SU administrator can run on a server to restore a QuickPlace that has been removed with QPTool. It goes through and changes all the titles of the place back to their original one before being marked as [Pending Deletion].
Dim s As notessession
Dim server As String
Dim placename As String
Sub Click(Source As Button)
Set s = New notessession
placename = "yourplacename"
server = "yourserver/projectlounge"
Print "Starting in main room"
Call restoredb(placename, "quickplace/"+placename+"/main.nsf")
End Sub
Sub restoredb(roomtitle, roompath)
Dim roomdb As NotesDatabase
Dim roomview As notesview
Set roomdb = s.GetDatabase(server, roompath)
If roomdb.IsOpen = False Then
Call roomdb.Open(server, roompath)
End If
roomdb.Title = roomtitle
Print "Set title: " + roomtitle
Set roomview = roomdb.GetView("System\Subrooms")
Dim doc As NotesDocument
Set doc = roomview.GetFirstDocument
While Not (doc Is Nothing)
Dim iroomtitle As String
Dim iroomfile As String
iroomtitle = doc.GetItemValue("h_Name")(0)
iroomfile = doc.GetItemValue("h_LocDbName")(0)
Print "Working on: " + iroomfile
Call restoredb(iroomtitle, "quickplace/"+placename+"/" + iroomfile)
Set doc = roomview.GetNextDocument(doc)
Wend
End Sub
Sunday, June 25, 2006
RoR authentication with IBM Notes/Domino
This is a very simple authentication system for a Ruby on Rails server in the same internet domain. It will allow you to get back the username of the person hitting your server provided they already have authenticated with an IBM Lotus/Domino or Websphere server that uses multi-server based session authentication.
IBM Domino/Websphere authentication works by placing an encrypted cookie for a given domain. There are a number of ways to find out what this cookie means.
For instance, you could either:
1. Decrypt the cookie using the secret key in the domino directory; or
2. Pass that cookie along to a live domino server and get back the username.
In this example, we are going to use the second option. This means we take that cookie and then pass it to an IBM server to check the authentication.
The cookie is stored in as LTPA token. Here is the ruby on rails code:
On the domino side, you just need to create a database and then a page within the database that has a field returning @username().
This will then return the full username. If you are using QuickPlace for instance, you will get back something like "CN=user/OU=placename/OU=QP/O=certifier" and you can deal with this as you like in your ruby code.
IBM Domino/Websphere authentication works by placing an encrypted cookie for a given domain. There are a number of ways to find out what this cookie means.
For instance, you could either:
1. Decrypt the cookie using the secret key in the domino directory; or
2. Pass that cookie along to a live domino server and get back the username.
In this example, we are going to use the second option. This means we take that cookie and then pass it to an IBM server to check the authentication.
The cookie is stored in as LTPA token. Here is the ruby on rails code:
require 'open-uri'
module DominoAuthenication
public
# accesses the current user from the session.
# overwrite this to set how the current user is retrieved from the session.
# To store just the whole user model in the session:
#
# def current_user
# session[:user]
# end
#
def current_user
if session[:user]
@current_user ||= session[:user]
else
begin
tokenstring = "LtpaToken="
tokenstring = tokenstring + cookies[:LtpaToken] if cookies[:LtpaToken]
OpenURI.open_uri('http://[your domino server here]/[your database]/[some page that returns the username]',
"Cookie" => tokenstring) do |http|
@current_user = http.read.strip
end
#rescue
end
end
end
end
On the domino side, you just need to create a database and then a page within the database that has a field returning @username().
This will then return the full username. If you are using QuickPlace for instance, you will get back something like "CN=user/OU=placename/OU=QP/O=certifier" and you can deal with this as you like in your ruby code.
Wednesday, June 14, 2006
Ruby Skype Bot
Here is a very simple Ruby Script that will reply to anything anyone says to you.
It requires the Skype ActiveS dll to be registered. The ActiveS site does not have the dll in the latest MSI so, I was able to download it here and make it available for people to register.
require 'win32ole'
oSkype = WIN32OLE.new('SKYPEAPI.Access')
puts "Version: #{oSkype.Version}"
oSkype.Connect()
puts "Getting events"
ev = WIN32OLE_EVENT.new(oSkype, '_IAccessEvents')
ev.on_event('ChatMessageReceived') do |msg|
to = msg.MessageFrom.Handle
puts "#{to} said: #{msg.Body}"
if to != oSkype.CurrentUserHandle
response = "OMG, I can't believe you just said '#{msg.Body}'"
oSkype.SendMessage(to, response)
end
end
# infinite loop to keep the script alive
loop do
WIN32OLE_EVENT.message_loop
end
It requires the Skype ActiveS dll to be registered. The ActiveS site does not have the dll in the latest MSI so, I was able to download it here and make it available for people to register.
Monday, June 12, 2006
Being stalked by click torrent girls

In the past few weeks, I have been in Dublin Ireland, Cork Ireland, London UK, Bad Homburg Germany, Dubai UAE, Sydney Australia and Brisbane Australia and have connected to a torrent web site in each location to catch up on my shows.
I know it is probably not the best way to get TV shows, as is shown by the quality of advertisers that support their site. However, click torrent has to take the cake here.
In each of these location, it has show the exact same girls as "in my area" that want to meet me. Same photo, same clothes, same girls - just the names and locations change. If I didn't know better, I would have thought these women are traveling around the world stalking me under different aliases. For instance, in Germany, they had German names and were staying in the same place "Bad Homburg" - a small town near Frankfurt that has one main shopping street and not much going on (sorry but the toscana pizza place is very nice mind you).
However, how dishonest can this advertising get and how ignorant do they think the male population is? These girls are not in my area, are not wanting to meet me, and have nothing to do with the shows I am downloading. I am not the biggest fan of the google adwords but at least I am not getting totally lied to in a spam like manner.
Saturday, June 10, 2006
Ruby on Rails: Open source project collaboration
ProjectLounge Lite is a ruby on rails based project collaboration tool. It has calendars, tasks list (with Gantt view), document sharing and member management. There is a hosted version at http://www.projectlounge.com and also the full source code is available for download and use under LGPL.
read more | digg story
read more | digg story
Friday, June 09, 2006
ProjectLounge Lite released to open source
It has been a few months coming, but we have finally released all our code into the glory of LGPL open source. The open access SVN repository is open and available for anonymous read access. If anyone wants to contribute code, please contact me with what you want to add.
The svn URL is svn://svn.projectlounge.com/open/light and I will be updating a project home page soon.
There is also going to be a simple one click install via the Instant Rails framework.
If all this code seems a little too much, you can see a hosted version at: http://www.pllite.com/projects/new to create your own project there. The access code is currently "pl124" but this will change to a captcha eventually.
The next few weeks will see a lot more development, so please if you are interested in contributing to an open source project that helps people get out of email and collaborate online about projects, please let me know.
The svn URL is svn://svn.projectlounge.com/open/light and I will be updating a project home page soon.
There is also going to be a simple one click install via the Instant Rails framework.
If all this code seems a little too much, you can see a hosted version at: http://www.pllite.com/projects/new to create your own project there. The access code is currently "pl124" but this will change to a captcha eventually.
The next few weeks will see a lot more development, so please if you are interested in contributing to an open source project that helps people get out of email and collaborate online about projects, please let me know.
Tuesday, June 06, 2006
Cool Tip to Beat Procrastination
A "life hack" tip for how to stop being a procrastinator. The basic idea is to just do the task for 10min to get over the procrastination urge. I will try this with my next task ... right after I read through my blogbridge :)
read more | digg story
read more | digg story
Monday, June 05, 2006
Web 2.0 Has Corporate America Spinning
The array of new tools that foster online collaboration -- and could revolutionize business and we have a blog entry here about it read more | digg story
Friday, June 02, 2006
Projectlounge has a new blog
I will be contributing to that as well as this blog. This will still remain my random thoughts and travels. However, all thoughts related to online collaboration technology will start to be posted there. The Projectlounge online collaboration blog should be interesting to those of us who don't really like email and prefer to collaboration in a real system that was designed for it.
Wednesday, May 31, 2006
To MacBook Pro or not?
Two people I trust have just taken the dive into the MacBook Pro world. Sami Shalabi and Will Raabe. They have both promised updates on their thoughts and how much they use them. Will tends to love his toys and will test out all the latest gadets I am sure. Sami is more the hard core coder and if Sami likes it, I know it will be a very good development machine (fast compiles and eclipse j2ee friendly).
If both of these people still love it in a month, then it will be almost impossible for me to resist ditching my 2 month old Dell and getting one.
If both of these people still love it in a month, then it will be almost impossible for me to resist ditching my 2 month old Dell and getting one.
Tuesday, May 30, 2006
5 countries in a week
We have arrived in Australia now and hope to stay for a while. In the last week we have been in Bad Homburg Germany, Dublin & Cork Ireland, London UK and then Dubai UEA on the way to Sydney Australia. It will be good to be a little more settled and less "homeless" for the release of ProjectLounge Lite. We go to Brisbane this weekend and hope that will be the last of the flights for a while.
Having, just complained about flights, I was really impressed with Emirates for their service. Coming back to Australia did not really feel "proper" by not getting on Qantas. However, the combination fare from travelmood could not be beat on price. The economy sector from London to Dubia was only 6 hours and I did notice the extra 2 inches leg room over BA/QF. They even give out hot towels. However, when it came to the lounge in Dubai and the Business service to Sydney I was very impressed.
If they can keep up the prices, I am not sure I would fly anything else on long hauls to Australia. They even had an espresso machine on board to get me going before landing - they really thought of everything.
Having, just complained about flights, I was really impressed with Emirates for their service. Coming back to Australia did not really feel "proper" by not getting on Qantas. However, the combination fare from travelmood could not be beat on price. The economy sector from London to Dubia was only 6 hours and I did notice the extra 2 inches leg room over BA/QF. They even give out hot towels. However, when it came to the lounge in Dubai and the Business service to Sydney I was very impressed.
If they can keep up the prices, I am not sure I would fly anything else on long hauls to Australia. They even had an espresso machine on board to get me going before landing - they really thought of everything.
Wednesday, May 17, 2006
Reporting Spam to SpamCop from Lotus Notes
Here is a very simple agent to report a select email or emails to spamcop's quick reporting service. You will need a spamcop account and access to quick reporting.
It uses a new r6 feature of lotusscript to get the received header information so that spamcop will know exactly where the email came from at each hop. This is important as they use this for their black lists so that the correct servers are blocked while the innocent receiving servers are not.
It is also important to list your allowed hosts with spamcop so that if it routes through some of your servers then these will not be treated at open relays.
Like this article? Digg it!
It uses a new r6 feature of lotusscript to get the received header information so that spamcop will know exactly where the email came from at each hop. This is important as they use this for their black lists so that the correct servers are blocked while the innocent receiving servers are not.
It is also important to list your allowed hosts with spamcop so that if it routes through some of your servers then these will not be treated at open relays.
Sub Initialize
Dim s As New notessession
Dim dc As NotesDocumentCollection
Dim db As notesdatabase
Dim doc As notesdocument
Set db = s.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
While Not(doc Is Nothing)
Dim text As String
text = ""
Forall t In doc.GetReceivedItemText
text = text + "Received: " + t + Chr(10)
End Forall
Forall it In doc.Items
If it.name <> "Received" Then
text = text + it.name + ": " + it.text + Chr (10)
End If
End Forall
Dim mail As notesdocument
Set mail = db.CreateDocument
mail.form = "memo"
mail.subject = "Spam to report"
mail.body = text
Call mail.Send(False, "spam@uce.gov")
Call mail.Send(False, "quick.[yoursecretkeyhere]@spam.spamcop.net")
'You can then save or just delete it here
doc.RemoveFromFolder("($junkmail)")
Call doc.Save(True, False)
Set doc = dc.GetNextDocument(doc)
Wend
End Sub
Like this article? Digg it!
Thursday, May 04, 2006
Rails acts_as_threaded Plugin
Left a comment on the acts_as_threaded plugin page as a warning to someone using it that wants to use proper ids for their tables.
If you end up using a guid for the table primary key and root_id, it you need to enclose the "#{self[root_column]}" with quotes. If you don't the sql will get broken by the hyphens in the id.
Otherwise, it works well even when you combine it with guid self generating 36 char ids.
Lines with root_column will change from something like this:
self.class.update_all( "#{left_col_name} = (#{left_col_name} + 2)", "#{scope_condition} AND #{root_column} = #{self[root_column]} AND #{left_col_name} >= #{right_bound}" )
to become something like this:
self.class.update_all( "#{left_col_name} = (#{left_col_name} + 2)", "#{scope_condition} AND #{root_column} = '#{self[root_column]}' AND #{left_col_name} >= #{right_bound}" )
If you end up using a guid for the table primary key and root_id, it you need to enclose the "#{self[root_column]}" with quotes. If you don't the sql will get broken by the hyphens in the id.
Otherwise, it works well even when you combine it with guid self generating 36 char ids.
Lines with root_column will change from something like this:
self.class.update_all( "#{left_col_name} = (#{left_col_name} + 2)", "#{scope_condition} AND #{root_column} = #{self[root_column]} AND #{left_col_name} >= #{right_bound}" )
to become something like this:
self.class.update_all( "#{left_col_name} = (#{left_col_name} + 2)", "#{scope_condition} AND #{root_column} = '#{self[root_column]}' AND #{left_col_name} >= #{right_bound}" )
Wednesday, April 26, 2006
People getting taller and seats getting smaller
I would like the executive at Airbus who thought of the idea of standing room only flights to fly economy to Australia from the USA or Europe before adding these seats. In fact, I challenge any airline executive who runs a service to Australia to fly this route in the small seats down the back.I would like to see economy sleeper seats before economy standing seats. There must be a way to have bunk beds or the like that still allow you to have lots of people on the flight and not taking up too much room.
I am not against getting a lot of people onto the planes. In fact, that is the best idea. Flying is a really polluting business and if we can have more people on the flights, then this is better than more flights. However, it would be nice if there was a way to get some sleep when you are stuck on a 16 hour flight.
Sunday, April 23, 2006
gzip for your bedroom
I have been packing away some bedding using a vacuum bag system. I always thought these systems were a bit of a joke but they really work well on bedding and pillows (and we certainly have a lot of pillows). Anyway, I recommend a vacuum pack system for anyone who is moving. It really feels like gzip for your bedroom... now if only I could store these things on a sftp server somewhere while we move.
Subscribe to:
Posts (Atom)
