Tuesday, February 20, 2007

Maitreya Festival feb 2007 photo's online

From Maitreya Festival 2007


such an awesome festival, Maitreya had brilliant music and a great mix of people... reminded me of parties going back a few years

Sunday, February 11, 2007

Bluetooth remote controls for you PC

I have a sony Sony Ericsson Walkman® w800i and my laptop has bluetooth

what's really cool is you can use HID profiles and use your phone as a remote control, for bluetooth winamp for example.



there are a couple of tricks to know

firstly, you can find the remote controls under the entertainment menu on your mobile phone

secondly, in order to get it working on a toshiba laptop, you need to make a new connection to your phone, but not via the express method, use custom and select the HID driver

Toshiba Assist -> BlueTooth Settings -> New Connection





Make sure you select the HID (Human Interface Driver)



this secret to getting the bluetooth remote control working with a toshiba laptop and a w800i... otherwise you get a Bluetooth connection failed error, even when you can transfer files to your phone

Saturday, February 10, 2007

IP to Country using Oracle and CFMX

Firstly download the IP-To-Country Database and unzip it

Then create a table in oracle

CREATE TABLE IPTOCOUNTRY(
IP_FROM NUMBER,
IP_TO NUMBER,
COUNTRY_CODE2 CHAR(2 BYTE),
COUNTRY_CODE3 CHAR(3 BYTE),
COUNTRY_NAME VARCHAR2(50 BYTE),
REGISTRY VARCHAR2(30 BYTE)
) TABLESPACE USERS;


ALTER TABLE IPTOCOUNTRY ADD (
CONSTRAINT PK_IPTOCOUNTRY PRIMARY KEY (IP_FROM, IP_TO)
USING INDEX
TABLESPACE USERS);

Load the data using the following sqlldr control file
(hint edit the paths)

OPTIONS (SKIP=132, DIRECT=TRUE)
LOAD DATA
INFILE 'C:\downloads\geoip\IpToCountry.csv'
BADFILE 'C:\downloads\geoip\IpToCountry.bad'
DISCARDFILE 'C:\downloads\geoip\IpToCountry.dsc'

INTO TABLE "IPTOCOUNTRY"
WHEN (1) <> '#'
FIELDS TERMINATED BY ',' ENCLOSED BY '"' AND '"'
( IP_FROM,
IP_TO,
REGISTRY,
assigned filler,
COUNTRY_CODE2,
COUNTRY_CODE3,
COUNTRY_NAME)

then once that's loaded, you can then query the database, but you need to convert the ip address ( IE CGI.REMOTE_ADDR ) to a long ip format (ip2long in php, inet_aton in mysql), here's a CFMX library IPConvert for CFMX that will convert dotted quads to long numeric ip addresses and back.

then you just need to do a simple database query

<cfquery name="q_ip" datasource="oracle">

SELECT *

FROM iptocountry

WHERE ip_from <= <cfqueryparam value="#ip_long#" cfsqltype="CF_SQL_NUMERIC">

     and ip_to >= <cfqueryparam value="#ip_long#" cfsqltype="CF_SQL_NUMERIC">

</cfquery>


#q_ip.COUNTRY_CODE3# is the country name and #q_ip.COUNTRY_CODE2# is the two letter equivalent which can be used with thse small country flags or large country flags simply with the following code ("ZZ" are unassigned countries)

<fif q_ip.recordcount and q_ip.COUNTRY_CODE2 neq "ZZ">

<cfoutput>
  #q_ip.COUNTRY_CODE3#
  <img src="#q_ip.COUNTRY_CODE2#.png"
   width="20" height="13" alt="">
</cfoutput>

<CFELSE>

unknown

</cfif>

Friday, February 09, 2007

Postgres Double Quotes

I'm working a new project and i'm using postgres for the first time in a while...

I was experiencing very strange behavior, queries are only working if i double quote the column and table names.

I know this from autogenerating the query in pgAdmin III. I'm using CFMX and JDBC, but as always with a database, go back to the native db tools first to test a
problem

SELECT "USER_ID", "EMAIL_ADDRESS", "FIRST_NAME",
FROM "USERS";

works fine!

SELECT USER_ID, USER_TYPE_ID, EMAIL_ADDRESS, FIRST_NAME, MIDDLE_NAME,
LAST_NAME, USER_PASSWORD, DATE_CREATED, DATE_UPDATED,
DATE_LAST_LOGIN, DATE_PASSWORD, IS_ACTIVE
FROM USERS;

but this one fails with "ERROR: relation "users" does not exist"

I had been stumped for a while and i then I found the answer: http://www.thescripts.com/forum/thread3102.html

The create table script had double quotes around all the column and table names and will only work as such as a result, "USERS" and USERS are two different things..

very intuitive... it's friday

Thursday, February 01, 2007

My Rainbow Serpent 2007 Photos

Time for a new lens :)

I finally got a Canon 10-22mm EFS lens just in time for this years Rainbow Serpent Festival.

It's a great match to my existing 17-85mm EFS lens, but to be honest i barely switched lens the entire 5 days, wide angle rocks

From Rainbow Serpent 2007...


Really fun festival, great people, awesome vibe... the music was as usual a little dull for my tastes, progressive just doesn't compare to decent psy or dirty electro, it's always facscinating to watch the difference on the dance floor between the two style.

I know i slept thru some of the better music ;) but I am talking about the festival as a whole. Bring on the Maitreya Festival

I can't wait to see ANDROMEDA again, my personal music highlight at Soulclipse in Turkey

this weekend brings the return of the St Kilda Festival