programming

Creating zip files using ColdFusion 7

Here is the code to zip multiple files and compress them using ColdFusion and Java. I tested it using two picture files and two text files.

MS SQL: Insert Multiple Rows With One Query

Just figured this out. Using Microsoft SQl Server 2000, you can insert multiple rows into a table with one query as in the following examples:

Single Column:

CREATE TABLE test
(
val1 INTEGER NOT NULL
)

INSERT INTO test
SELECT 62
UNION
SELECT 91
UNION
SELECT 95
UNION
SELECT 98
UNION
SELECT 99

This will insert 5 rows into the table. To do multiple columns, use the following:

CREATE TABLE test
(
val1 VARCHAR(10),
val2 VARCHAR(10),
val3 VARCHAR(10),
val4 VARCHAR(10)
)
GO

INSERT INTO test
(val1, val2, val3, val4)

Detecting Javascript In Coldfusion And Other Languages

I had been struggling for a while trying to find a way to detect JavaScript capability in my applications, then adjusting the application accordingly. My employer requires accessibility to all websites and web applications with JavaScript disabled. This can be done using the noscript tags with a meta refresh, but this is very, very bad form.

Using ColdFusion, I was able to solve this problem. I believe this can be done in any language which allows the setting and manipulation of cookies. Here is the code:

<cfset jscript = 0>

Viewing Private Profiles On MySpace, No Can Do

I don't believe there is any way to view a private profile on MySpace. I am writing this because I have noticed an huge increase in traffic to this blog, resulting from searches regarding hacking private myspace profiles.

When you go to a private profile, the page checks to see if your friend ID is on the list of friends for the person you are trying to visit. If it is not, or if you're not logged in, the page will not show your request.

Dynamic Picture Generation Using ColdFusion

I had an unusual problem to solve today. One of my applications generates signed documents using Microsoft Word. The user clicks a button and is prompted to open or save the word document. The signatures are important ones, and stored outside the webroot.

I solved this by referencing a coldfusion file in the src attribute of the image tag in the html that outputs the document. The file is called dynpic.cfm. So the image tag looks like this:


<img src="https://someserver.someschool.edu/production/someapp/dynpic.cfm?pic=chair" />

XMLHttpRequest Problem In Firefox

The latest version of Firefox seems to have broken the XMLHttpRequest object. Specifically, if the asynchronous flag is set to false, the object will no longer function. I haven't done much research into this. I just wanted to jot a quick note. Set the asynchronous flag to true and everything should be fine.

Ajax: Post And Eval()

As I demonstrated, the XMLHttpRequest object can be used to query a page using the get method. The object can also query a page using the post method. It is a bit more difficult as one must create the request header. Here is an example:

Ajax: The Basics And Get

I've been working with some aspects of the Ajax group of technologies lately. It sounds complicated and difficult to learn, but it really isn't. It uses the XMLHttpRequest object supported by many browsers. My current development requires I code for IE and Firefox, although it seems to be functional in Netscape.

To use the XMLHttpRequest object, I put together two simple functions and put them in a file named SimpleAjax.js. Here are the functions:

MS SQL: Using A Case Statement In A View

Here is a neat trick for using conditional processing in a view.

I needed to create a view that contained an employee id and employee name amongst other data. The original view included two joins, but for the sake of simplicity, I have altered the view. This view uses a case statement to determine which "full name" to show, the full name using the first name or the full name using the nickname if the employee has one.

Pages

Subscribe to RSS - programming