Kittenify

10 August 2009 15:34

Awesome. Kittenify.

Filed: General // Tagged: , , // No Comments

ColdFusion Leap Year bug still there

13 July 2009 16:45

So just got ColdFusion 9 Beta 2 up and running and my old leap year bug is still there. I’ve posted a public bug, #78713 now the tracker has been launched. It effects 7, 8 & 9 so hopefully it’ll get fixed!

Filed: Technology // Tagged: , , // 1 Comment

New Releases

13 July 2009 13:17

A few new releases for you to catch up on. Firstly Wordpress 2.8.1 – essentially a bug fix and security release by the look of it but worth doing anyway, quick note that if you get stuck with a maintenance page check in your web root for a file called .maintenance, just rename that and the site will come back.

Next up two public beta’s from Adobe. ColdFusion 9 boasting some new useful and some not so useful/utterly pointless changes and the ColdFusion Builder which can either be standalone or as a plugin to Eclipse.

Filed: Technology // Tagged: , , , // No Comments

List of titles

9 July 2009 20:40

With most forms, on most sites, if asked for your title you’ll normally get the usual; Mr, Mrs, Miss, Ms, Dr. Sometimes you’ll see a few more but not often. Harrods however outdoes themselves with this impressive array of titles, I think we should all start using this as a list on forms… out of curiousity if nothing else!

  • Mrs.
  • Mr
  • Mrs
  • Mr & Mrs
  • Miss
  • Ms
  • Baron
  • Baroness
  • Sheikh
  • Sir
  • The Honourable
  • The Right Honourable
  • Viscount
  • Viscountess
  • Begum
  • Brigadier
  • Captain
  • Commander
  • Colonel
  • Count
  • Countess
  • Dame
  • Doctor
  • Doctor & Mrs
  • Doctors
  • Earl
  • His Royal Highness
  • Her Royal Highness
  • Judge
  • Lady
  • Wing Commander
  • Lord
  • Lieutenant
  • Lieutenant Commander
  • Lieutenant Colonel
  • Madam
  • Mademoiselle
  • Major
  • Monsieur
  • Prince
  • Princess
  • Professor
  • Reverend

Filed: General // 1 Comment

Awesome Idea

8 July 2009 11:11

Are you in an office with RFID door-entry? If not you should be… this idea is awesome! [via @timblair]

Filed: Technology // Tagged: , , // No Comments

Sphinx Multi-Value Attributes

6 July 2009 11:03

Sphinx allows you to create a multi-value attribute index which is great for document tags or categories. By default if you search across these the search is an OR match. If you want to run an AND match you must specify multiple filters rather than passing an array of values.

In ColdFusion using the Java API requires a little tweak as you can’t pass a normal ColdFusion array to sphinx, you have to use a basic java type array. Tim Blair has a good article on how to create them but here’s an example of calling the API.

This example will search for document tagged with either 100 or 200. Note the array creation method.

<cfset variables.sphinx = createobject("java", "org.sphx.api.SphinxClient").init()>
<cfset variables.sphinx.SetLimits(0, 10)>
<cfset variables.arrObj = createobject("java", "java.lang.reflect.Array")>
<cfset variables.jClass = createobject("java", "java.lang.Integer").TYPE>
<cfset variables.jArr = variables.arrObj.newInstance(variables.jClass, 2)>
<cfset variables.arrObj.setInt(variables.jArr, 0, 100)>
<cfset variables.arrObj.setInt(variables.jArr, 1, 200)>
<cfset variables.sphinx.SetFilter("tag", variables.jArr, FALSE)>

If you want to search for 100 AND 200 you’d do it like this:

<cfset variables.sphinx = createobject("java", "org.sphx.api.SphinxClient").init()>
<cfset variables.sphinx.SetLimits(0, 10)>
<cfset variables.sphinx.SetFilter("tag", 100, FALSE)>
<cfset variables.sphinx.SetFilter("tag", 200, FALSE)>

Filed: Technology // Tagged: , , , , // No Comments

More Geocoding

1 July 2009 23:18

More geocoding fun today, this time done with perl. For what I want to do, convert OS Grid easting and northing into latitude and longitude using an API, like Yahoo! was going to take ages due to throttling. Turns out that in perl using the handy Geography-NationalGrid-1.6 CPAN package it’s a lot easier and gives for most cases a result very close together.

Here’s a quick example:

#!/usr/bin/perl
use Geography::NationalGrid;
my $point1 = new Geography::NationalGrid( 'GB',
Easting => '385600',
Northing => '801900'
);
print "Latitude " . $point1->latitude . " Longitude " . $point1->longitude . "\n";

You can also give it a grid reference like TH 1234 1234 or a latitude and longitude.

Filed: Technology // Tagged: , // No Comments

sphinx, ColdFusion and geodist

30 June 2009 23:16

Over the past few days I’ve been looking into a new search engine for an application. The chosen search daemon is sphinx and it’ll be called via the Java API (that comes with sphinx) from ColdFusion. Getting the basic searching going was pretty easy, creating an index, do a basic search, set some filters, done. The next step was to look into geodist matching, calcuating how far apart two latitude / longitude’s are, slightly more tricky. In CF you can do it with some crazy curvature of the earth calculations but in sphinx it’s real easy – when you know what it wants. The key there is radians.

You’ll find plenty of tidbits on the web about this but no real end to end examples so hopefully this will help!

If you need to geocode some postcode or zip values I can highly recommend tinygeocoder.com. It’s basic and gives you a straight lat / long value which is perfect. If you want something with a bit more information you’ll need to check out the Yahoo! YDN geocode API or Google’s HTTP API. I’ve got the YDN working with ColdFusion (I’ll post about that later).

First up you’ll need some data, I’ve created a basic DB table called sphinx_test.sql which you can download. It’s been written for MySQL. Quick note on the float values, if you don’t specific float 10,6 (or something similar) your lat/longs will automatically be chopped to only 4 decimal places.

The SQL contains 3 locations in England. The British Airways London Eye (51.502893,-0.118811), Millennium Dome (51.501984,0.004764) and Windsor Castle (51.481971,-0.600686).

Once you’ve created your table you’re ready to create an index. I’m going to assume you’ve already installed sphinx in /opt/sphinx (this is on a CentOS platform). To get the Java API part for ColdFusion is easy as well.

[root@hosting ~]# cd /root/sphinx-0.9.9-rc2/api/java
[root@hosting ~]# make
[root@hosting ~]# cp sphinxapi.jar /opt/coldfusion8/runtime/servers/lib
[root@hosting ~]# /opt/coldfusion8/bin/coldfusion restart

This is the sphinx.conf you’ll need to get this running. Now there’s a whole load of stuff you could do in the configure file but I’ll just give you a basic one which should be enough.

Note you have two options when it comes to getting the lat/long from MySQL, you can either use RADIANS(val) or use a pre-stored the radian value of the lat / long In this case we’re going to use the latter but I’ve included a commented line for the former.

Now for the actual code that does the work. I’ve created a file called sphinx.cfm (view as text or click it to actually see it working) with comments inline. The interesting parts are:

<!--- sort order must be @geodist to allow distance matching --->
<cfset variables.sphinx.SetSortMode(variables.sphinx.SPH_SORT_EXTENDED, '@geodist desc')>

<!--- where are we starting, this will be the london eye latlong converted to radians --->
<cfset variables.sphinx.SetGeoAnchor('latitude', 'longitude', degreesToRadians(51.502893), degreesToRadians(-0.118811))>

All of the API calls are the same as the documented PHP functions so you can refer to the documentation for more information.

Thanks go out to various bloggers and Tim to get this running.

Filed: Technology // Tagged: , , , , // No Comments

Moving on up

22 June 2009 22:29

The continued, and if by continued I mean actually starting, migration of my sites over the Rackspace Cloud is moving forward again at last. I’ve nearly finished setting up the initial Cloud Servers and all the DNS. The 4th server setup this evening however shows more signs of the move from Mosso to Rackspace Cloud, the inital RDNS entry for the previous 3 had been slicehost.com addresses but this time out it’s 000-000-000-000.static.cloud-ips.com. A quick lookup shows that the domain still lives on slicehost nameservers and has a Rackspace contact but I guess it’s movement.

Some changes are present in the control panel but not a lot, maybe they’ll be more or maybe it is just a logo update.

Update:

So after some playing I’m not going anywhere. The cloud servers are great, real easy to get running but for what I’m doing and have hosted, mess around with etc a dedicated box is ideal. Currently with The Planet and have a good deal, a UK server would be nice but the cost just doesn’t make it viable right now. I might look at either a bigger TP box, more RAM or go to iWeb or ServerBeach but not sure – any recommendations or reviews of those?

Filed: Technology // No Comments

Railo, Resin, Caucho and me

12 June 2009 23:06

I’ve finally got resin, railo and caucho playing together in a nice, no longer ripping each other’s hair, out kind of way. I have to say my biggest comment (and probably one of the more tricky things to do) is that for Railo to become a big player in trying to take away Adobe’s CF user base installers are going to be essential. That said railo does seem quicker on processing CFML (need to do more tests to verify that).

I’ve got apache 2.2.3 running on CentOS 5.3. I have railo 3.1.0.015 (not updated to 016 yet) and caucho.

My resin.conf has this addition (multiple times for the different domains):

<host id="www.domain.co.uk" root-directory="/home/domain/public_html">
<host-name>www.domain.co.uk</host-name>
<host-alias>domain.co.uk</host-alias>
<web-app id="/" document-directory="."/>
</host>

The apache virtual hosts are just normal vhosts. No extras.

My caucho.conf (in /etc/httpd/conf.d) looks like this:

LoadModule caucho_module /usr/lib64/httpd/modules/mod_caucho.so
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes
<Location /caucho-status>
SetHandler caucho-status
</Location>

Hopefully that might help someone out. I’m going to try and do a from scratch CentOS build guide for The Rackspace Cloud sometime next week. I’ve started migrating some sites over to the cloud server and so far not hit any issues.

Filed: Technology // Tagged: , , , , // 1 Comment

 
Twitter   •   About   •   Contact
©2010 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset