Posts filed under 'Programming'
Convert Microsoft Word Characters
I’ve written a JavaScript function a while ago that converts Microsoft Word Characters (crap) to valid HTML characters. Till today I didn’t realize how valuable the function is, it could probably do with some expansion on what it converts so any help to improve is much appreciated.
Continue Reading 1 comment March 31, 2009
Why use JavaScript Form Field Validation?
You can be sure that any user that completes a form will make some data entry mistake, mistakes you want to catch before submitting the data to the database server or other mechanism.
Continue Reading Add comment March 30, 2009
JavaScript Form Validation Framework
We’ve just made a JavaScript Form Validation Framework freely available for download.
Continue Reading Add comment March 26, 2009
MS SQL Date Time to Epoch
I know it’s been a while for you programmers out there, but here is an MS SQL function that converts Date Time to Epoch.
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER FUNCTION [dbo].[fn_dateTimeToEpoch] (
@dateTime DATETIME
)
RETURNS BIGINT
AS
BEGIN
DECLARE @epochDay BIGINT
DECLARE @epochSecond INT
– epoch ‘01-01-1900 00:00:00′
– one day 86400 seconds
SET @epochDay = DATEDIFF( day, ‘01-01-1900 00:00:00′, @dateTime )
– get the remainder
SET @epochSecond = DATEDIFF( second, ‘01-01-1900 00:00:00′, DATEADD( day, -@epochDay, @dateTime ) )
– convert to seconds
RETURN ( @epochDay * 86400 ) + @epochSecond
END
Leave a message if you want the Epoch to Date Time function.
3 comments August 25, 2008
ColdFusion Memory Leak, you think?
Got lots of memory consumption and have no idea where it’s going? Thinking it might be a memory leak in ColdFusion?
Continue Reading Add comment February 29, 2008
cfchart – CFIDE/GraphData.cfm problems
Got cfchart – /CFIDE/GraphData.cfm problems?
If you’re running into problems with <cfchart> you’re more than likely experiencing problems with the mappings. On a productions machine you don’t want to expose the CFIDE to the public, so you remove it! However, ColdFusion needs access to some files to process the <cfchart> and display it.
Luckily it’s easy enough to fix this problem by creating zero-byte files for internal ColdFusion processes. These files are empty files, so they should not pose any security thread.
Follow the following steps to create the files
- Open Windows Explorer.
- Navigate to the web_root/CFIDE directory, typically located at \inetpub\wwwroot\CFIDE.
- Create a blank file named GraphData.cfm.
- Create a directory called main.
- Navigate to the new directory atweb_root/CFIDE/main.
- Create a blank file titled ide.cfm.
- Repeat steps B-F for any additional instances ofweb_root/CFIDE.
You should be fine after that.
4 comments February 13, 2008
Create random list in ColdFusion (Randomizer)
Looking for a way to generate a random list of values?
Continue Reading Add comment February 12, 2008
ColdFusion asynchronous calls (event gateway)
Do you have some methods that require lots of processing, but don’t want the customer to have to wait for the result?
Continue Reading 2 comments February 1, 2008
Application.cfc event methods order (order called in)
For anyone wanting to know in what order the methods in the application.cfc are called.
The methods in the Application.cfc are called in the following order when a request is made:
-
onApplicationStart (skips this method if called before, i.e. it’s only called once)
-
onSessionStart (skips this method if called before, i.e. it’s only called once)
-
onRequestStart
-
onRequestEnd
onApplicationEnd is triggered when the application times out
onSessionEnd is triggered when the session times out
onError is triggered when an error occurs
Add comment February 1, 2008
Securing ColdFusion (tips)
I’ve started to write a document for OWASP about ColdFusion security which I hope will be included on the site when I finish it.
Any feedback is more than welcome, if you’d like to see anything included about ColdFusion Security, let me know and I’ll do my best to include it.
Some of the items covered are:
- SQL Injection
- Database Logins
- Logging
- XSS (Cross Site Scripting)
- Cookie Hijacking
- Proper Error Handling
- Input Validation
- Securing Protected Areas
- Forms being submitted outside of your domain
- Automated data mining
The document about ColdFusion security can be downloaded here. Please note that the document is still a work in progress.
This document is sponsored by www.clickfind.com.au
Add comment January 23, 2008