Log analyzer plugin for Railo admin
A briljant and long missing plugin for log analyzing within the admin of Railo. Made by my good friend Paul Klinkenberg, a must have for every Railo user.
Railo Log Analyzer
4098 viewed | Your opinion... | Tjarko @ 11:03 cet
Getting the closest locations based on Latitude / Longitude
I'm not going to explain what is being done here (SQL script) because I just don't understand. I searched a long time for this script and at the moment i'm not even sure where I got it... bottomline.. it works, and really really good.
Let's say you got the lat/lng from an http call to the Google API (small example below) and you want to get the nearest 10 other "stores" in the area around you.
<cfhttp url="http://maps.google.com/maps/geo?q=#yourpostcode-address#&gl=nl&output=csv&sensor=false&key=#yourGooglekey#" method="GET" />
<cfset aRet = listToArray(cfhttp.filecontent) />
<!--- Is it a good request and is the accuracy more then 5 (postcode level) --->
<cfif aRet[1] eq 200>
-- call the stored procedure
EXEC getstores @lat = #aRet[3]#
,@lng = #aRet[4]#
</cfif>
<!-- Save procedure in your database MSSQL 2000 and up. -->
CREATE PROCEDURE [dbo].[getstores] @lat float, @lng float AS
DECLARE @radius float, @DegToRad float
SET @DegToRad = 57.29577951
SET @radius = 25000
SELECT TOP 10
sto_city
,sto_name
,sto_lat
,sto_lng
,sto_street
,sto_postcode
,sto_tel
,sto_fax
,sto_email
,sto_url
,sto_supplier
,sto_cnt_code
,ROUND((ACOS((SIN(@lat/57.2958) * SIN(sto_lat/@DegToRad)) +(COS(@lat/@DegToRad) * COS(sto_lat/@DegToRad) *COS(sto_lng/@DegToRad - @lng/@DegToRad))))* 6387.7, 2) AS distance
FROM store
WHERE (sto_lat >= @lat - (@radius/111))
And (sto_lat <= @lat + (@radius/111))
AND (sto_lng >= @lng - (@radius/111))
AND (sto_lng <= @lng + (@radius/111))
AND (
ISNUMERIC(sto_lat) = 1
AND
ISNUMERIC(sto_lat) = 1
)
ORDER BY distanceThe distance column from the stored procedure is the total distance from the location you submitted to the Google API (postcode / address). Hope you can find a good use for this.. I did for several projects already :-)
7203 viewed | 4 opinion(s) | Tjarko @ 23:43 cet
Get SEO keywords automatically from an article or page
I just finished a nice little function to get the "best" keywords for the page displayed in every website we build with our CMS. Below is an example, what you get is a list of the words that are mostly used in the given page and therefore the best to use as META keywords or tags in your page. At least if you like to be found on the contents of your page...
<cfsavecontent variable="txt">
A nice little piece of text with at least twice the word little in the text, and off course three times the word text ;-)
</cfsavecontent>
<cffunction name="getSEOWords" access="public" output="true">
<cfargument name="content" required="true" type="string" />
<cfset var lsStopWords = "stop wordlist in your language (google it)" />
<cfset list = arrayToList(listToArray(REReplace(arguments.content, "[[:space:]]{2,}"," ", "all" ), " ")) />
<cfset var stWords = structNew() />
<cfset var lsTop = "" />
<cfset var aSort = arrayNew(1) />
<!--- Get a unique structure of words counted --->
<cfloop list="#list#" index="value">
<cfif !listFindNoCase(lsStopWords, value) && !isNumeric(value)>
<cfset value = trim(value) />
<cfif structKeyExists(stWords, value)>
<cfset stWords[value] = stWords[value] + 1 />
<cfelse>
<cfset stWords[value] = 1 />
</cfif>
</cfif>
</cfloop>
<!--- Order the structure with words, first keys are the words with the most counts --->
<cfset aSort = structSort(stWords, "numeric", "desc") />
<!--- Get the first 15 words from the list, if the count is more than one. --->
<cfloop from="1" to="15" index="i">
<cfif stWords[aSort[i]] GT 1>
<cfset lsTop = listAppend(lsTop, aSort[i]) />
</cfif>
</cfloop>
<cfreturn lsTop />
</cffunction>
<cfoutput>
#getSEOWords(txt)#
</cfoutput> 8264 viewed | 16 opinion(s) | Tjarko @ 17:19 cet
Delete errors since hotfix 3 Coldfusion 8
Since the last hotfix these errors come flying by. This has always worked without any problems and all of a sudden these errors appear.
ColdFusion could not delete the file C:\somedir\somefile.jpg for an unknown reason.
Does someone know what a good solution is?? We need to delete the file after some file operations. These are not big files, maybe 1MB at the most. Seems like a timing or locking issue but it always worked until last week when we installed the hotfix.
7374 viewed | 1 opinion(s) | Tjarko @ 12:13 cet
Strange font behaviour with cfdocument pdf
When we run a scheduled task that produces PDF files with cfdocument we get randomly PDF files with the complete text but in a strange font, or something?? (see example)
After searching on the internet I cannot find anything that explains this.... Does anyone have a clue on what's going on with these PDF files?? We produce hundreds a day without a problem but every now and then we get jibberish like below. It's becoming a real problem because these are contracts with people who are getting or wanting a home and can't see what's in the letter.
The PDF document that looks strangeIf someone from Adobe sees this, I still have the other issue posted on this blog with PDF files (and more people do) fix it please!! We pay you for it!!
Thanks in advance if you can point me in the right direction.
7411 viewed | 1 opinion(s) | Tjarko @ 9:48 cet