Thursday, March 30, 2006

Hunting down invalid signatures

I have spent the last few days trying to hunt down an archive problem in a notes mail file. In doing this, I wrote a small lotusscript button to verify signatures that I can share here.

This could be written in the C API. However, keeping it in a button makes it easy to email out to users for them to test.

Const MAXUSERNAME =256
Declare Function NSFNoteVerifySignature Lib "nnotes.dll" Alias "NSFNoteVerifySignature" ( Byval hNote As Long, Byval null1 As Long, Byval null2 As Long, Byval retSigner As String, Byval retCertifier As String) As Integer
Declare Function NSFNoteUnsign Lib "nnotes.dll" Alias "NSFNoteUnsign" ( Byval hNote As Long) As Integer
Const NOERROR = 0
Const PKG_NSF = 512
Const ERR_NOTE_NOT_SIGNED = PKG_NSF+89 'Document is not signed
Const ERR_NOTE_INVSIG2 = PKG_NSF+91 'Document has been modified or corrupted since signed! (data)

Sub Click(Source As Button)
Dim ses As New NotesSession, irc As Integer
Dim retSigner As String, retCertifier As String
Dim doc As notesdocument, vw As NotesView
Dim db As notesdatabase
Dim dc As notesdocumentcollection
Dim fileNum%
Dim i As Integer, count As Integer

Set vw = ses.currentdatabase.views(0)
Set db = ses.currentdatabase

fileNum% = Freefile
Open "c:\temp\signatures.txt" For Output As fileNum%


Set dc = db.GetProfileDocCollection()
Set doc = dc.GetFirstDocument
count = dc.Count
i = 1
Print "Check profile Notes: " &Cstr(count)
While Not doc Is Nothing
Call fix_signature(doc, fileNum, i, count)
i = i + 1
Set doc = dc.GetNextDocument(doc)
Wend

Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
count = dc.Count
i = 1
Print "Check data Notes: " &Cstr(count)
While Not doc Is Nothing
Call fix_signature(doc, fileNum, i, count)
i = i + 1
Set doc = dc.GetNextDocument(doc)
Wend

Close fileNum%
End Sub

Sub fix_signature(doc As notesdocument, fileNum%, i, count)
Dim textline As String
retSigner = String$(MAXUSERNAME ,Chr(0))
retCertifier = String$(MAXUSERNAME ,Chr(0))

irc%= NSFNoteVerifySignature (doc.handle, 0, 0, retSigner, retCertifier)
Print Cstr(i) &"/" &Str(count)
If irc% = NOERROR Then
textline = "SIGNED: " &Cstr(doc.NoteID) &" " &Left(retSigner, Instr(retSigner,Chr(0))-1)
Write #fileNum%, textline
Elseif irc% = ERR_NOTE_NOT_SIGNED Then
textline = "NO SIGNATURE: " &Cstr(doc.NoteID)
Write #fileNum%, textline
Elseif irc% = ERR_NOTE_INVSIG2 Then
textline = "INVALID_SIGNATURE: " &Cstr(doc.NoteID)
irc% = NSFNoteUnsign(doc.handle)
If (irc% = NO_ERROR) Then
Call doc.Save(True, False)
textline = "REMOVED SIGNATURE: " &Cstr(doc.NoteID)
Else
textline = "COULD NOT REMOVE SIGNATURE: " &Cstr(doc.NoteID)
End If
Write #fileNum%, textline
Else
textline = "ERR: " &Cstr(irc%) &" " &Cstr(doc.NoteID)
Write #fileNum%, textline
End If
End Sub

Friday, March 17, 2006

Updated Full Text Wiki for Ruby on Rails

I have been playing with Ruby on Rails for a while now and started to use it with MySql's full text searching abilities.
I added some code to a search library on the Ruby on Rails wiki - hope it helps others in the space
see: http://wiki.rubyonrails.org/rails/pages/TextSearch

Tuesday, March 14, 2006

FastCGI failing on Fedora with Ruby on Rails

After battling with all the FAQ and wikis getting FastCGI to work with Apache, I found the last problem. FastCGI spawns temporary files in your /etc/httpd/log/fastcgi/dynamic directory (unless you override this in your http.conf file).

I was still getting these errors:

[Mon Mar 13 17:03:08 2006] [crit] (13)Permission denied: FastCGI: can't create (dynamic) server "/var/www/html/test.rails/public/dispatch.fcgi": bind() failed [/tmp/fastcgi/dynamic/a452aa13feeda365028a2d43d1b2ce13]

It turned out that my problem was SELinux getting in the way. It really locks down what the apache user can do (which is probably a really good thing). However, for fastcgi it was locked down a little too much. I intend to now fight a little with SELinux to see if I can get it to play nice.

If you want to temporarily disable it, you can run this command:

echo "0" >/selinux/enforce

you can echo a "1" to turn it back on.

Thursday, March 09, 2006

Looking forward to some Sun

We are in London now until the 21st when we go back to Concord and had a good week of rain and clouds. It is really amazing how a little bit of sun goes a long way in the winter. Coming from Brisbane, you really took the sun for granted where here and in Concord you notice it and try to make the most of it. All said, I could really use a few sunny days here in London and hope for the best.

Friday, February 24, 2006

Setting up BIND locally on XP

BIND looks to have very good install instructions at: http://www.zytrax.com/books/dns/ch5/win2k.html

but it seems like the "run as service" option has moved in XP. However, running locally on 127.0.0.1 address it did not seem to stop it if I ignore the errors that there are too many privileges. I would never do this in production, but then I would tend to run *nix there rather than XP.

I found the trick to be go to a command and run: C:\windows\system32\dns\bin\named-checkconf.exe

and check for any errors in your C:\windows\system32\dns\etc\named.conf (that you have create yourself compared with fedora that gives you a cache servers out of the box).

So, I can now dig rather than nslookup and us my own DNS server. I found different DSL providers seem to be really mean on caching their names and do not update them as fast as I would like.

dig @127.0.0.1 mazhire.com any

Thursday, February 23, 2006

Mazhire is ready for car hire rental orders

We have launched a new car hire rental website at: http://www.mazhire.com and there is city level content on each major city in the world. This includes cities such as Brisbane, Austrlaia to larger ones like London, UK.
Here we can bring our own content and ideas per city to help anyone planning to rent or hire a car. Now that the back end is all sorted out, there remains lots more work including JSON, widegets, xml editions and other exciting ways to hire cars online.

Thursday, February 09, 2006

I have added my bookmarks

I am now keeping a del.icio.us link roll in my blog so you can all see what sites I like. You might find my tagging interesting but it makes sense to me.

Wednesday, February 08, 2006

Is Ruby beyond Java?

I just bought the Ruby and Beyond Java book from Foyles in London. I have played with Ruby on Rails but after reading blogs I think a bit of reading is in order.
I cannot help but think scripting is not the answer here but I really miss what Notes/Domino provides in the web world. I like the idea of just creating a field once and getting Create, Read, Update, and Delete without too much work. Struts, Hibernate, JSP and Tomcat involve a lot of typing and it does take time. Maybe my issue is getting Notes like flexibility from a relational back end but I do want to think on this issue for a while and I suspect there is no easy answer here.

Sunday, February 05, 2006

Farewell and thanks for all the fruit

After a wonderful full 6+ years at IRIS and then IBM, I have decided to go out on my own. I will be starting with a week in London, UK where I just flew into - the superbowl is on but I guess I miss the million dollar commercials here.

Thanks to all my wonderful friends and workmates at Westford and beyond. I had a really nice last week and had a chance to talk to almost everyone and wish them well.

The new support site my team was working on will continue to change the IBM world for the better and Notes/Domino is going to continue to be the leader in groupware. I had a unique opportunity to see how truly professional software is written, tested and supported and learned and grew so much there.

The last project I worked on really drove home the importance of the Model View Controller (MVC) pattern. It is really important that complicated web applications or portal sites have a solid pattern in place from the start in order ensure quality code. I also learned that the View should be given to two different skill sets: user interface (UI) and development. It is probably possible to have the html and backend code generated by the same person but I expect this to be the exception rather than the rule.

I also really appreciated the UI team that can produce really clean compliant XHTML code. Having such a clean base to build on really makes all the difference when putting together complicated sites. I also learned just how important the UI team was in the development process and would encourage all UI teams that are working in the web space, to be able to provide XHTML rather than just photoshop or png files. If you cannot produce the HTML, then the chances are slim the development team will make a site that looks how you intended.

Thursday, January 26, 2006

Franchising legislation being debated in Congress

The Federal Communications Commission is seeking comment on this issue. Click Here. I am not sure what comments they want apart from it is a bad idea that was paid for by companies and not citizens. If only they would conduct some independant research rather than rely on what the lobby groups provide :(

Tuesday, January 24, 2006

Cash is king - not miles

I have to disagree with a recent WSJ article "When It Still Makes Sense
To Take the Miles
". I agree that their might be some point when it makes sense to use miles over cash back, but not based on the numbers they present.
I am not sure their "discounted" trans-atlantic flight is that discounted. The table gives an example of $900 as a discounted fare. I have personally never paid that much and am pretty picky when I fly. I like the morning flight out of Boston on BA so that I avoid the night flights that give you 3 hours sleep (maybe) and get you there at 5am in the morning.
Also, the example for a business class ticket from AA, at $6700 does not factor in two real points.
1. AA does not really have a proper business class (no bed), and
2. It is not too hard these days to get a decent discounted business class or economy plus flight.
In fact, recently, BA had a $199 each way economy plus ticket available. That is a discounted seat that is 7" longer.
The other missing point with points tickets is that you still have to pay for taxes and fees. Once you factor this into the table, I think you will find cash is king and I will stick to my Blue Cash card from AMEX.
Sorry WSJ, but I suspect you have written about this without asking the real question you need to ask and that is for the amount you pay (not the price advertised).

Saturday, January 07, 2006

Inline HTML editors

Just found a neat HTML editor that I will try out at the concordtv web site. Seems really neat: http://tinymce.moxiecode.com/
It was mention in the comparison chart at: http://www.geniisoft.com/showcase.nsf/WebEditors

Sunday, January 01, 2006

Concord TV Grand Opening is on Thursday

The renovations have been completed and the TV Station is about to be opened.

The Grand Opening: Reception & Open House
Thursday, January 5, 2006
5:00-7:00 PM
ALL WELCOME!

The Open House is followed by the Annual Meeting of the Corporation.

http://www.concordtv.org (or 978-369-5038)

Helped create tomcat Realm for QuickPlace

Tomcat authenticates with Realms. These are nothing more than a class that will return a Principal object that contains a username, password and list of roles.
For QuickPlace there are no roles as such but there is ACL level. So, I mapped the role to the ACL entry (manager, author, reader). This will allow admins to extend QuickPlace into the J2EE world without needing to creating yet another directory.
To me, one of the really nice parts of QuickPlace is the user management. Adding, removing, editing users is really well thought out and it would be silly to have to re-work that with some complicated LDAP setup when you can use the domino backed classes to hook into the QuickPlace contacts1.nsf.
It is now up and published under GPL and hope it helps people extend QuickPlace functionality with Tomcat.
QuickPlace Realm for Tomcat

Saturday, November 19, 2005

Nice UI for a milk site

The UI in this site is really neat and easy to use. It almost feels like a normal application rather than a web site. It is really amazing that only two Australians wrote it. The web tools these days are really amazing.

http://www.rememberthemilk.com

Monday, October 10, 2005

In-Frequent Flyers Programs by the numbers

We all know it is damn near impossible to find an available award seat on QF, BA or CX for any most routes that people want (to Europe, USA, etc). Why else would it have this page show it is impossible to find any flights to these locations (Awards Available). Also, using ExpertFlyer.com I have seen no inventory for as far as I could go (U0 is a familar code on that site let me assure you).

I thought I would sit down and do the numbers from information available on the Qantas web site to see if it makes sense. Here is a quick summary of what I found:

* Just over 3 Million Seats awarded in 2004 (Awards Given)

* and they carried 27Million (Traffic Stats)

So, a little over 11% of seats are award seats (not sure what % of revenue is attributed towards FF program as it is not in the report).

It is possible to earn points every 1.6km (Earning Points)

Total revenue km is 76Million (traffic stats report) and thus about 47Million points could be issued. We know that they are not all issues but that is a staggering number. It also does not factor in the points given out with credit cards, car rentals, hotels, etc (Partners).

So, looking at a middle point zone 6 flight = 36,000 points (Points Table), this works out to be a possible 4.7Million zone 6 economy flights. So, it seems clear that they are issuing more points than they are giving out - if they published the frequent flyer points as a liability on the annual report we would know for sure but I could not find it.

An alternative way to look at it, is how long does it take to accrue a zone 6 economy ticket. Given that the ratio of award to revenue flights is 3:27, it seems that it should take you about 9 flights to get one. However, it only takes you about 7 zone 6 tickets to earn one free flight. So the odds are against you from the start and that does not factor in any bonus points flyers with status get (Up to twice as much).

To me, this does not makes sense in any way when you do the maths - the system is fundamentally flawed as they are trying to pay back a 14% bonus program at 11%.

Saturday, September 17, 2005

I'm over it now - Australia lost the ashes

I don't really follow the criket and didn't ever get past being a very poor wicket keeper. However, when I was in london last it was hard not to get into it. However, the first time I followed the Ashes it did not work out so well for the Australia - sorry to all for that.
It was a really good series to follow and seemed to really push the game's following along in the UK so it is probably all for the best. Well done England!

Saturday, September 10, 2005

Spoke at the recent selectmen meeting

I spoke at the last selectmen meeting for our town. It was a real treat – being able to stand up and have my own say on local issues. I am really impressed with local town government in the north east. It really seems like ordinary citizens can make a difference for the better.

The topic of the speech was to ask for a letter objecting to certain pending bills before the federal government. The laws are very complex but have the effect of taking away local control of local TV and preventing towns like mine from negotiating with new cable TV providers. It also threatens the funds currently being paid to support local TV stations all over the country.

The speech went well and the letter is getting written. I hope this will help stop these provisions getting in the final bill – it would be very sad if the future of PEG is ended after we put a lot of effort getting Concord TV up and running. See: http://www.concordtv.org

Hello World

First Post