Shaun Mccran

My digital playground

06
M
A
Y
2009

Suckerfish sticky drop down issues in IE7

Most people are familiar with the suckerfish style drop down menus, but as a quick recap they are lightweight CSS driven dropdown menus.

I won't go into massive depth here, but suffice it to say that there have been many improvements to the way they work, and the most streamlined version I've come across is here:

http://www.htmldog.com/articles/suckerfish/dropdowns/

It's a good article on how to get them working on your site, and how they interact with different browser versions.

What is quite interesting though is that there is an issue with them in IE7. If you use the 'sticky' version of them (where the menu stays visible even after mouse out) then IE7 has a CSS flaw in the handling of it.

As the link under here explains, there is a fix for earlier IE versions that creates a pseudo class to get them to work as they should, but IE7 handily circumvents this to break.

http://css-class.com/articles/explorer/sticky/

This entry details how to fix the IE7 bug and end out with a totally cross browser CSS friendly version.

18
F
E
B
2009

Reading a file using a Java object

Sometimes in Coldfusion development its handy to use coldfusions standard functions such as CFfile or CFdirectory. But you can also invoke the underlying Java objects that share similar functionality. These can often be more efficient too, as there is no coldfusion server compilation layer involved.

For one piece of work I had recently I was reading a series of files, parsing them out and inserting a the collection of records into a database.

So I created used a java file reader object to read the files.

There is the odd extra config line in here, as the server pathing is unix based not windows based, and I'm dynamically reading the files from the directory.

view plain print about
1<cfset variables.dir = cgi.path_translated>
2<cfset variables.replaceVar = listlast(variables.dir, '\')>
3<cfset variables.dir = replaceNoCase(variables.dir, variables.replaceVar,'', 'all')>
4<cfset variables.filename = variables.dir & "datafile#url.fileNo#.txt">

Next I use the file name variable in the java FileReader object call. I wrap the file reader in a BufferedReader object as this greatly reduces the operation overhead of the FileReader object as the data is buffered into memory and not read from the disk.

Next I'll loop over the outptut string from the buffered file reader object, parsing each line and invoking the cfc method of 'processContent', passing in the string (line of data) as the argument 'content'. '

view plain print about
1<cfscript>
2        cnt = 0;
3        srcFile = variables.filename;
4    
5        // create a FileReader object
6
        fr = createObject("java","java.io.FileReader");
7        fr.init(srcFile);
8    
9        // create a BufferedReader object
10
        br = createObject("java","java.io.BufferedReader");
11        br.init(fr);
12        str = br.readLine();
13    
14        // writeOutput(str);
15
        while isDefinedd("str")) {
16            cnt = cnt + 1;
17            str = br.readLine();
18                if(isDefined("str")){
19                    //writeOutput(cnt);
20
                    //writeOutput(str);
21
                    // pass to CF to do the rest
22
                    processContent(str);
23                }
24            }
25        br.close();
26        //writeOutput(cnt);
27
    
</cfscript>

Now you can perform any sort of parsing you want to perform on the content. In the example below I am creating a local structure and populating it with each delimited value. This allows me to use standard notation to pick out individual elements for whatever processing you want.

view plain print about
1<cffunction name="processContent" output="true" hint="function for processing the file content">
2        <cfargument name="content" type="string">
3    
4        <cfset var local = structnew()>
5    
6        <cfset local.today = now()>
7
8        <cfset local.filecontent = replace(arguments.content,'\n',"", "all" )>
9    
10        <!--- list to array based on tab --->
11        <cfset local.data = local.filecontent.split("\t")>
12        <cfset local.variableName1 = local.data[1]>
13        <cfset local.variableName2 = local.data[2]>
14        
15        Etc...
16
17    </cffunction>

26
O
C
T
2008

ActiveCrossSelect custom tag

In several previous projects I've had cause to be moving data from one list to another. Rather than creating a form, with a list, I'd wanted a more elegant solution, so I 'found' a really handy custom tag that doesn't seem to have had much press.

Its fairly old, but does a great job of creating two text areas, and allowing a user to move data between them.

ActiveCrossSelect is the custom tag. I like it, you will to :-).

I didn't write it, it was written by 'Vitaliy Shevchuk', so all credit there.

View a test script here.

Download the Rar archived version here.

view plain print about
1<cf_ActiveCrossSelect
2 left_name = "left_C1"
3 right_name = "Right_C1"
4 valuesleft = ""
5 valuesright = "1,2,3,4,5,6,7,8,9,0"
6 textleft = ""
7 textright = "11,22,33,44,55,66,77,88,99,00"
8 formname="form1"
9 width="250"
10 sizeleft = "7"
11 sizeright = "7"
12 headleft="Left Text 1 "
13 headright="Right Text 1"
14        onChange="alert(oh);"
15        quotedlist = "No"
16        JS = "ActiveCrossSelect.js"
17        >

26
A
U
G
2008

JavaScript checkBox checker and unchecker

A few times I've encountered the need to check, or uncheck a large column of records in a data display. Say you have one hundred records returned from a query, instead of having a user check each one, simply give them a button that allows them to check or uncheck a whole column in one go!

[ More ]

_UNKNOWNTRANSLATION_ /