Posted At : Jun 21, 2010 12:27 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, My Projects

Well... it's not a real heat-map, but rather is a way to see the concentration of available jobs. So it could help someone who is willing to relocate and is looking for the right region. But it also can help those who just want to see jobs in their own region.
Anyway, enough talking. For those interested, here is the link. Note that this is also available now through the JOBS HEAT MAPtop menu link.

Comments Comments (0) | Print Print | Email Send | 573 Views | 3% / 0% Popularity


Posted At : Mar 25, 2010 14:47 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, My Projects, SEO

Yet another tool to get a list of keywords from the provided text. It will return keywords with up to 4 words that was used at least twice in the text. An early version of it i use on this blog and it does help to get good positions in search engines without any additional promotion.

For those interested, HERE is the link.

Comments Comments (0) | Print Print | Email Send | 661 Views | 3% / 0% Popularity


Posted At : Feb 18, 2010 17:49 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, My Projects

ColdFusion is at version 9 already but we still seem to have problems where i would believe all has to be nice for years. I'm talking about CFHTTP tag here.
Yesterday i had to make for a client a script that will
  1. connect to a site
  2. login
  3. move to other internal page from where data should be taken

So what the usual process would be in such a case?
  1. make a CFHTTP request
  2. using the cookies from previous step, if any exists, make the CFHTTP call with login credentials
  3. using the cookies from previous step (here should be present session cookies), make the CFHTTP call to the internal page
  4. do with the data whatever you need
Sometimes step 1 may not be needed.

Everything looks fine so far and in most of the cases works as supposed, but NOT everytime. Sometimes on step 3 instead of going to the internal page it "lose the session" and as result you get there the login page instead. This is exactly what happened for me for this particular client. I have no idea what the problem is but i remember such an issue even back in 2003. I tried all i could think of: passing cookies in CFHTTPPARAMs, puttin the heder with cookies and all in USERAGENT parameter of CFHTTP (yes this one looks a bit weird, but i remember this solving the problem for some sites within last 7-8 years). Nothing helped. Then i tried CFX_HTTP that i was using years ago in such situations and of course everything worked great.

So the question is - WHAT THE HECK ?!
After so many years we still should have such problems with CFHTTP? Weird.

For this particular client it happened there to be a 64-bit system, so instead of CFX_HTTP i had to rewrite the script to use CFX_HTTP5. But this doesn't change the fact that it wasn't possible to be done with CFHTTP itself. Googling for solutions from other's experience didn't help. So i thought - if ColdFusion is Java, why not try a Java solution?
Another half day in googling, trying, testing and i've created a function that not only do a GET HTTP connection, but also works fine for the situation described above. It's far from being universal enough, but it worked well for my situation. So if anyone need it, here is the code:
<cffunction name="makeHTTPRequest" output="yes" returntype="any">
   <cfargument name="requestURL" required="Yes" type="any">
   <cfargument name="requestCookies" required="No" type="any" default="">
   
   <cfset var result = StructNew()>
   <cfset var i = 1>
   <cfset var urlConnection = createObject("java", "java.net.URL").init("#arguments.requestURL#").openConnection()>
   <cfset var inputReader = "">
   <cfset var bufferedReader = "">
   <cfif Len(arguments.requestCookies)>
      <cfset urlConnection.setRequestProperty("Cookie", arguments.requestCookies)>
   </cfif>
   <cfset urlConnection.connect()>
   
   <cfset inputReader = createObject("java", "java.io.InputStreamReader").init(urlConnection.getInputStream())>
   <cfset bufferedReader = createObject("java", "java.io.BufferedReader").init(inputReader)>

   <cfset result.headers = "">
   <cfset result.headerNoCookie = "">
   <cfset result.cookies = "">
   <cfset result.content = "">

   <cfscript>
      do
      {
         headerName = urlConnection.getHeaderFieldKey(i);
         lineCheck = IsDefined("headerName");
         if (lineCheck)
         {
            if (Len(result.headers))
            {
               result.headers = result.headers & "|" & headerName & "=" & urlConnection.getHeaderField(i);
            }
            else
            {
               result.headers = headerName & "=" & urlConnection.getHeaderField(i);
            }
            if (headerName.equals("Set-Cookie"))
            {
               result.cookies = result.cookies & ListGetAt(urlConnection.getHeaderField(i), 1, ";") & "; ";
            }
            else
            {
               if (Len(result.headerNoCookie))
               {
                  result.headerNoCookie = result.headerNoCookie & "|" & headerName & "=" & urlConnection.getHeaderField(i);
               }
               else
               {
                  result.headerNoCookie = headerName & "=" & urlConnection.getHeaderField(i);
               }
            }
         }
         i = i + 1;
      } while(lineCheck);
      
      do
      {
         line = bufferedReader.readLine();
         lineCheck = IsDefined("line");
         if(lineCheck)
         {
            result.content = result.content & line;
         }
      } while(lineCheck);
   </cfscript>
   
   <cfreturn result>
</cffunction>

It takes at input the URL and optionally a string with cookies and returns a structure with 4 keys headers, headerNoCookie, cookies, content

And here is an usage example:
<!--- make first request to firstURL with login credentials --->
<cfset firstCall = makeHTTPRequest(firstURL)>
<!--- make second request to secondURL using the cookiens from the first request --->
<cfset secondCall = makeHTTPRequest(secondURL, firstCall.cookies)>

Hope it will help somebody.

HAPPY CODING !!!

P.S.: If anyone want to comment on it, please do so.

Comments Comments (4) | Print Print | Email Send | 1395 Views | 7% / 24% Popularity


Posted At : Feb 01, 2010 18:10 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, cfHSSF, My Projects

After over 2 years, cfHSSF has been updated. It has been done by Steven Durette and he did a really great job!

From his email:
I made a couple more additions and I set it up so that it would degrade gracefully if the version of POI isn't high enough to support the features.
I also made a change to the way values are set in cells. Before a row was created every time a cell value was set. With newer versions of POI if a cell already existed in a row, it was wiped out when another cell in the same row was set. The new method first checks to see if the row exists and uses that. If the row doesn't exist then it creates it.
The ability to put JPEG and PNG images into workbooks was added. This works with the POI included with CF9. If someone tries to use it that doesn't have a new enough version, it takes the cell where the image was to reside and places a message that the POI version doesn't support it.
You can now stream the workbook directly to the browser instead of having to create a file first by using one of the new functions.

Basicaly there has been done the following changes:
  1. Added options for XLSX (Office 2007) files if the POI is the right version.
  2. Added getRow function. This function will get a row or create it if it doesn't already exist.
  3. Added getCell function. This function will get a cell or create it if it doesn't already exist.
  4. Changed multiple functions to use getRow and getCell functions.
  5. Added AddImage function to place an image in the spreadsheet.
  6. Added AddJPGImage function to put a JPEG image in the spreadsheet.
  7. Added AddPNGImage function to put a PNG image in the spreadsheet.
  8. Added createBookVar to allow for streaming workbook to the browser without creating a file.
  9. Updated create region to allow creation of regions in xlsx workbooks.

If anyone interested, you may download it here.

Comments Comments (0) | Print Print | Email Send | 1061 Views | 5% / 0% Popularity


Posted At : Jan 26, 2010 17:13 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, My Projects, Fun

Right now HERE are not too many tests, but it's a start.
So, have fun!

Comments Comments (0) | Print Print | Email Send | 968 Views | 5% / 0% Popularity


Posted At : Jan 05, 2010 18:12 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, My Projects, 1ssBlog

Posts - 56 (29 of them being in december)
Comments - 60 (18 being my answers)
Total views - 118758 (15280 in december)
Unique views - 25415 (2910 in december)

My open source projects downloads: 1939
  • 1ssBlog - 351
  • cfWatcher2.1 - 324
  • cfFirewall - 256
  • cfWatcher1 - 203
  • cfHSSF - 201
  • cfSQLMaster - 138
  • mollom - 115
  • robots - 114
  • defensio - 79
  • yahooSiteExplorer - 75
  • 1ssBlog1Update1 - 43
  • 1ssBlog1Update2 - 40

Top 10 posts by views:

Top 10 posts by unique IP views:


Comments Comments (0) | Print Print | Email Send | 594 Views | 3% / 0% Popularity


Posted At : Dec 24, 2009 18:10 PM | Posted By : Ed Tabara
Related Categories: ColdFusion, My Projects

As promised, i updated the Mollom component based on recent recommendations from Dries Buytaert. Anyone that use this component, please upload the updated version. It will change nothing in your work process (except: if you do not pass the IP when checking the content, please do so) so it will be an easy change.
And now on testing results. After doing the updates, i've run that exact 747 spam records through the changed process and here are the results:
Mollom:
  • ham - 5
  • spam - 271
  • unsure - 471

As you may see no more "no answer" there and the number of spam went to 271 from 24, while ham from 49 went to 5. But it still show 471 as unsure. I've been told by Dries taht that's a weirdly high amount of unsure records, but... that's what i have got.

Comments Comments (5) | Print Print | Email Send | 1143 Views | 5% / 29% Popularity