‘coldfusion’ Archive

ColdFusion Developers Wanted!

27 October 2009 15:05

Are you looking for a job? Are you a ColdFusion developer? If you are then we’re looking for you!

We’re looking for a ColdFusion developer to join our team of 15 developers and designers at WhiteLabelDating.com. We’re focused on creating the very best online dating platform in the industry. We’re highly profitable, growing quickly and want to recruit the best people to work with our experienced team and be a part of our future.

We’re based at 1 High Street in the centre of Windsor, west of London. We’re easily commutable from London (West from Paddington or South-West direct from Waterloo), Reading, Staines or Slough.

Our core application is written ColdFusion and we’re looking for someone to join the team to help maintain and improve all areas of the code. This would be an ideal role for an intermediate level developer looking to improve their skill set and also diversify into other languages and frameworks such as Ruby on Rails. We are currently investigating architecture changes and someone with an interest in cloud computing, sphinx and highly available database systems would be a great asset.

For the full job spec check out our site: http://www.whitelabeldating.com/jobs/current-vacancies/coldfusion-developer/

Filed: Work // Tagged: , // No Comments

Get a domain from a URL

7 October 2009 17:11

Been looking for a function in ColdFusion to get the root domain from a url. There are a few but none actually cope with the many combinations. This function by no means copes with every combination however it does cover quite a lot. Comments inline indicate which domains the rules handle.

<cffunction name="getRootDomain" returntype="string" output="no" hint="Take a URL and get the domain from it.">
<cfargument name="url" type="string" required="true">
<cfset var dots = listLen(arguments.url,".")>
</cfset><cfset var domain = "">
</cfset><cfset host = arguments.url>
<!--- host.com, host.biz, host.ly --->
<cfif dots eq 2>
<cfset domain = host>
<cfif dots eq 3>
<!--- www.host.com, sub.host.com, www.host.mobi, www.host.ly, del.icio.us --->
</cfif><cfif listfirst(host,".") eq "www" or
((len(listgetat(host,3,".")) eq 3 or len(listgetat(host,3,".")) eq 2) and len(listgetat(host,"2",".")) gte 3)>
<cfset domain = listdeleteat(host,1,".")>
<!--- host.co.uk, host.com.za --->
<cfif (len(listgetat(host,3,".")) eq 2 and (len(listgetat(host,2,".")) eq 2) or len(listgetat(host,2,".")) eq 3)>
<cfset domain = host>
<cfif dots eq 4>
<!--- www.host.ltd.uk, www.host.co.uk --->
</cfif><cfif len(listgetat(host,4,".")) eq 2 and (len(listgetat(host,3,".")) eq 2 or len(listgetat(host,3,".")) eq 3)>
<cfset domain = listdeleteat(host,1,".")>
<!--- www.sub.host.com, sub.sub.host.com --->
<cfif len(listgetat(host,4,".")) eq 3 and len(listgetat(host,4,".")) gte 3>
<cfset domain = listdeleteat(listdeleteat(host,1,"."),1,".")>
<cfif dots eq 5>
<!--- sub.sub.host.co.uk, www.sub.host.co.uk, www.sub.host.com.za --->
</cfif><cfif len(listgetat(host,5,".")) eq 2 and (len(listgetat(host,4,".")) eq 2 or len(listgetat(host,4,".")) eq 3)>
<cfset domain = listdeleteat(listdeleteat(host,1,"."),1,".")>
<cfreturn domain />

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

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: , , // 2 Comments

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

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

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.

[[email protected] ~]# cd /root/sphinx-0.9.9-rc2/api/java
[[email protected] ~]# make
[[email protected] ~]# cp sphinxapi.jar /opt/coldfusion8/runtime/servers/lib
[[email protected] ~]# /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, [email protected] 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

Cumulative Hot Fix 2 for ColdFusion 8.0.1

17 March 2009 16:20

Adobe have today released announced the 2nd hotfix for ColdFusion 8.0.1. You can go get it from the Adobe site. It has quite a few bug fixes listed as well.

Filed: Technology // Tagged: , // 2 Comments

CF8 JRun init script error

21 July 2008 11:55

Setting up a staging server environment which will run 3 instances of CF and looking to alter the init scripts so it fires them all up on boot. Took a look at the one the installer creates and thought simple enough to just put multiple calls in for each server instance. Oh no.

On our RHES4 platform we have CF starting up as the apache user, but, running the script causes a “This account is currently not available.” error to be thrown because it has no shell and it’s locked. After looking at another server running a server install I notice the issue is down to the su command issued.


su $RUNTIME_USER -c "$CF_DIR/bin/jrun -stop cfusion"
su $RUNTIME_USER -c "$CF_DIR/bin/jrun -start cfusion >& $CF_DIR/logs/cfusion-event.log &"

Server Install

su -s /bin/sh $RUNTIME_USER -c "export PATH=$PATH:$CF_DIR/runtime/bin;
cd $CF_DIR/runtime/bin; nohup $CF_DIR/runtime/bin/cfmx7 -jar jrun.jar -autorestart -start coldfusion &"

Key difference is the “-s /bin/sh” part. Altering my script to the following makes it work. Yay. Not sure if this a known bug of something funky in our setup, but, as it’s a vanilla OS install I don’t see what it could be.

su -s /bin/sh $RUNTIME_USER -c "$CF_DIR/bin/jrun -stop cfusion"
su -s /bin/sh $RUNTIME_USER -c "$CF_DIR/bin/jrun -start cfusion >& $CF_DIR/logs/cfusion-event.log &"

Filed: Technology // Tagged: , // 3 Comments

CFMail and Gmail

11 July 2008 12:20

Been looking a lot lately at various email related projects. One of the issues I noticed as part of this work is that if you send a mail with cfmail to a gmail account that only has a cfmailpart text/plain gmail won’t render it.

If you send both, it works fine.

Strong HTML

So, if you’re sending plain only, don’t put it in a cfmailpart. Probably shouldn’t have been in the first place, but, issue now solved.

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

ColdFusion 8.0.1

4 April 2008 10:58

The latest update to ColdFusion has been released in the form of 8.0.1 which will let you have a painless install on Leopard and on 64 bit OS’

Full details on the Adobe site.

A lot of other tweaks and bug fixes as well including new FCKEditor and changes to the attributeCollection stuff.

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

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