• Archives
  • Categories
  • CFQuery and CFQueryParam for CFscript in CF8

    2010 - 07.20

    When it comes to programming in Coldfusion I like to do things a bit different–mainly due to my background in php. For instance I hardly use cftags because I prefer to use cfscripts. This has it’s limitations, such as: no query functions exist in cfscript! The only way to execute a query is to do so before (or after) your script. Input validation can also be troublesome if you try to use cfqueryparam outside a cfquery nest. And what if you’re in the middle of a for-loop and need to query something? Thats right, your whole method has to be restructured. Until now.

    I have created two wrappers that allow you to use the power of cfquery and cfqueryparam from within your cfscripts! w00t!

    <cffunction name="queryParam" output="no">
      <cfargument name="data">
      <cfargument name="type" requried="no" default="CF_SQL_VARCHAR">
      <cfargument name="max" requried="no" default="255">
      <cfquery name="getFixedData" datasource="cyberSchoolDemo">
        SELECT <cfqueryparam value=#arguments.data# cfsqltype=#arguments.type# maxlength=#arguments.max#> as newData
      </cfquery>
      <cfreturn getFixedData.newData>
    </cffunction>
    <cffunction name="query" access="public">
      <cfargument name="queryString" required="yes">
      <cfargument name="DSN" required="no" default="#application.DSN#">
      <cfset tmpResultStruct = {} >
      <cfquery name="builtQuery" datasource="#arguments.DSN#" result="result">
        #preserveSingleQuotes(arguments.queryString)#
      </cfquery>
      <cfset tmpResultStruct.query = arguments.queryString>
      <cfset tmpResultStruct.dataSource = arguments.DSN>
      <cfset tmpResultStruct.result = result>
      <cfif isdefined("builtQuery")>
        <cfset tmpResultStruct.data = builtQuery>
      </cfif>
      <cfreturn tmpResultStruct>
    </cffunction>
    

    Example Usage:

    getUser = query('SELECT * FROM users WHERE uID = #queryParam(form.userID, 'CF_SQL_INTEGER', 11)# LIMIT 1');
    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Droid in Hand!

    2010 - 07.08

    My Droid Incredible just arrived at work.. I couldn’t be happier!

    The images are of course taken with the old phone.. new photos coming soon!

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Droid is Coming Early!

    2010 - 07.07

    I just got a warm feeling…

    “Thank you for placing your order with Verizon Wireless. We wanted you to know that your Verizon Wireless order was shipped.”

    Yes! It wasn’t supposed to ship for another week or two.. this is the best news I’ve heard in a long while! I can’t wait for it to get here!!!!

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Confirmed Delivery Date

    2010 - 06.28

    Today I called Verizon to see when my Droid would ship out.. if they even knew. The lady told me it’s scheduled to ship by the 17th.. Jeez! The 17th! Fine. ;)

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Droid is Ordered!

    2010 - 06.15

    Today I ordered my Droid Incredible from Verizon :)

    Unfortunately it’s back ordered until NEXT MONTH but hopefully it wont take that long..

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Welcome to da404lewzer.com!

    2010 - 02.04

    I have finally decided to get a domain for my username before someone steals it and it becomes a huge ordeal to take control of it.  I am an active php enthusiast and I develop software and solutions for small businesses.  From time to time I have an interesting idea or project I’m working on and plan on sharing this with you here.  Da404lewzer.com is now my personal headquarters and will start porting older content here.

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Bright House is Slow and Irritating

    2008 - 12.17

    For the past couple months, the internet in my home has been very unstable. Up and down, up and down. At first, I thought that it was my roommates router, after setting up a Linksys WRT54GL and getting the same problems, we turned to the cable modem. Nothing. So whats the deal here?

    When I ping www.google.com -t for a while, I get scary results:

    Reply from 74.125.95.104: bytes=32 time=66ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=64ms TTL=239
    Request timed out.
    Reply from 74.125.95.104: bytes=32 time=69ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=69ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=75ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=67ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=64ms TTL=239
    Request timed out.
    Request timed out.
    Request timed out.
    Reply from 74.125.95.104: bytes=32 time=65ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=66ms TTL=239
    Request timed out.
    Request timed out.
    Request timed out.
    Reply from 74.125.95.104: bytes=32 time=65ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=64ms TTL=239
    Request timed out.
    Request timed out.
    Reply from 74.125.95.104: bytes=32 time=67ms TTL=239
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    Reply from 74.125.95.104: bytes=32 time=75ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=68ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=65ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=66ms TTL=239

     
    That’s a lot of timing out. And, it’s been worse.

    Nearly every other click, website, download, or IM is hesitated up to 2 minutes depending on the application and how hey implemented network errors.

    I’m paying extra for the pro-package. My connection speed 3 months ago was registering on speedtest.net at 14mb. My average download was 500-600k/sec down and 300k/sec up, I’m starting to get a little pissed that I cant download anything from a respectable server faster than 40k/sec. Not to mention, it takes forever to just navigate around a website.

    I have heard that somewhere between Bakersfield and LA is a broken connection and is therefore contributing to this mess, true or not, this sounds feasible. I have various friends all over Bakersfield who have the same issues. In the time it has taken me to write this blog, here are my pings:

    Reply from 74.125.95.104: bytes=32 time=68ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=68ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=65ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=64ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=65ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=66ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=68ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=63ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=70ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=67ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=67ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=68ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=64ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=70ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=69ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=69ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=65ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=64ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=69ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=68ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=181ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=64ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=75ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=74ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=69ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=68ms TTL=239
    Request timed out.
    Reply from 74.125.95.104: bytes=32 time=71ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=73ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=65ms TTL=239
    Reply from 74.125.95.104: bytes=32 time=66ms TTL=239

    Magically all better, WTF??? Any why am I still averaging 67ms to google.com ???

    This is the kind of crap this is bugging the hell out of me. As a programmer I make a lot of FTP uploads and navigate the web quite often. It’s pretty annyong chatting on yahoo about how google.com won’t load. It’s irritating.. existing connections work somewhat ok, but making NEW connections is iffy…

    Bright House needs to get their shit together because I for one am tired of this crappy service. I was at a friends business and a Bright House employee came in to ‘inspect the modem’ and was greeted with “So, here to fix my internet?” his responce was “Well, I can’t guarantee that”

    So, could Bright House be sending out employees to keep people thinking it’s their faulty equiptment? You decide.

    If you are having issues with Bright House, please leave a comment and a sample of your pings by using ping www.google.com -t in cmd

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Six tools you shouldn’t live without

    2008 - 11.07

    Hello, I have decided to blog about some of the various applications I have installed and can’t live without. These applications will help you speed up your computer lifestyle.

    Process Explorer

    What it is:
    Process Explorer is a Task Manager Replacement and I can’t stress this one enough. The Task Manager that comes with windows is a piece of crap, to put it kindly. Process Explorer is actually recommended by Microsoft, what, huh? That’s right, and it does a HELL of a better job.

    What it does:
    It allows you manage your processes, and get TONS of detailed information about them. For example, you can right click on firefox.exe and see how many TCP connections it has and where.

    Notes:
    I have mine set to replace the system task manager. You can do this by going to:
    Options -> Replace Task Manager (doing it again reverts it back)
    I also turn off the bottom tray, because it can get annoying unless you need that information.

    Get it! http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

    TaskSwitchXP

    What it is:
    A replacement for the standard Alt-Tab Task Switcher. This is my second favorite application.

    What it does:
    In addition to the standard alt-tab, it can be configured to use different skins, become sticky, and you can even right click an application and end it’s process without even needing to use Process Explorer or Task Manager (shun).

    Get it! http://www.ntwind.com/software/taskswitchxp.html

    UltraMon

    What it is:
    UltraMon is screensaver/desktop/taskbar manager for multi-screen windows users.

    What it does:
    UltraMon gives you the power to have seperate screensavers, wallpapers and even extends a taskbar to your other monitors. Also, applications are given extra buttons to toss them between monitors. If you are using multiple screens, you NEED THIS.

    Get it! http://www.realtimesoft.com/ultramon/

    TeraCopy

    What it is:
    TeraCopy is a Windows File Transfer replacement. It’s fast and not as annoying.

    What it does:
    TeraCopy handles file transfers in copy/move operations and when you tell it to always do something, it remembers that. File transfers also don’t get killed with an error on low disk space. The application simply waits for free space. All in all, great applications!

    Get it! http://www.codesector.com/teracopy.php

    AutoRuns

    What it is:
    This is a MSCONFIG replacement recommended by Microsoft.

    What it does:
    AutoRuns shows you tons of information about your system startup and is a better replacement for MSCONFIG.

    Get it! http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx

    DirectFolders

    What it is:
    Direct Folders allows you to have shortcuts to applications and folders. It will also assist in remembering applications open/save dialogs so the settings for displaying files is set per-application.

    What it does:
    Too much to explain, watch this video: http://www.codesector.com/directfolders-demo.htm

    Get it! http://www.codesector.com/directfolders.php

    I hope these tools help you as much as they’ve helped me! Don’t forget to comment!

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    The Database

    2008 - 10.22

    When re-writing a project that you’ve already done it sometimes gets difficult planning out the entire project in your head. This is easy to do with smaller projects, but when you are working on something that manages multiple sites, employees, users, products, orders, email, reports and accounting, things can get a little hectic at times.. especially when you’ve put hours into something and have to re-write it or hack it to death to implement an overlooked feature. Welcome to programming! Just like the first photoshop job you did, looking back on old work is hard and sometimes down right scary.

    I believe the first thing to be considered when starting a project is your database. It most likely will containing every bit of data you will be outputting to the user and it only makes sense to satisfy the needs of correctly storing and handling it. Once you have thought out your database tables and fields, the next step is to fill your tables with test data.

    One thing I have learned over the years is, NEVER EVER WRITE ADD/EDIT FORMS FIRST!! It is far easier to use phpmyadmin to load the database with values to test things than it is to have to keep going back and forth editing your form html and form logic pages. Once you have the data successfully stored, create a way to display/edit and then finally add your data. This has always saved me time, try it yourself.

    I was just bored and thought I would write something

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)

    Updating Old Code

    2008 - 10.19

    The time has finally come. A custom CRM that I developed for a company about 5 years ago needs to be completely rewritten. You might say that at the time of writing version 1.0 I was a bit of a newbie. I didn’t understand Objects, I was still designing in tables and my CSS abilities were limited to in-line font modifications.

    When I first opened up my code, I was immediately frustrated. I decided that as I go about writing version 2.0 I should share the experience.

    The CRM has a couple basic sections:

    • Today Page
    • Orders Page
    • Address Book
    • Messages / Notes
    • Sample Requests
    • Mass Mailer
    • Report Generator

    With new features planned for v2, I need to get v1 code ported to prettier code that I will feel good about calling v2. This requires re-writing all the MySQL tables and updating all the old MySQL queries to take advantage of join optimization, separating the logic from the presentation and from the data, re-designing the CRM with divs and smarty, and writing scripts to convert the old db to the new db.

    I will be doing lots of posts as there is a lot to do. I will report in daily.

    Digg This
    Reddit This
    Stumble Now!
    Buzz This
    Vote on DZone
    Share on Facebook
    Bookmark this on Delicious
    Kick It on DotNetKicks.com
    Shout it
    Share on LinkedIn
    Bookmark this on Technorati
    Post on Twitter
    Google Buzz (aka. Google Reader)