Download CFBuilder 2 ide_config XML Schema (XSD)

Couldn’t find any XML Schema for the CFBuilder 2 extension file ide_config.xml, so I decided to create one myself during Christmas. Why? Well a good XML Schema provides code assist and inside within Eclipse, which means faster coding and more important, less coding errors. 

Don’t know why Adobe didn’t provide us with a XSD though, or did they ...?

Anyways, below a video which shows code assist within Eclipse incase you didn’t get the picture yet. I’m using the XML Editor of Eclipse, so didn’t test the one from Adobe/Aptana.

CFBuilder XML Schema - Eclipse Code Assist

Ready to Rumble? Setting it all up is pretty easy:

  1. Download the zip which contains the XSD file (updated);
  2. Copy the ide_config.xsd file to the folder where your ide_config.xml lives;
  3. Replace the application xml tag with the code snippet below;
  4. (Re)open your ide_config.xml file;
  5. Ready, you can now press CTRL+SPACE for code assist.
   1: <?xml version="1.0" encoding="UTF-8"?>
   2: <application xsi:noNamespaceSchemaLocation="ide_config.xsd"
   3:     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Convert RTF to Plain TEXT....Java Swing rescue

You want to convert RTF to plain text? Here's the code:


<cffunction name="getPlainTextFromRichText" access="public" returntype="string" output="false">
    <cfargument name="richText" type="string" required="true">
    <cfscript>
        var RTFEditorKit = CreateObject("java","javax.swing.text.rtf.RTFEditorKit").init();
        var styledDocument = CreateObject("java","javax.swing.text.DefaultStyledDocument").init();
        var reader = CreateObject("java","java.io.StringReader").init(arguments.richText);
        
        RTFEditorKit.read(reader,styledDocument,0);
        return styledDocument.getText(0,styledDocument.getLength());        
    
</cfscript>
</cffunction>

If you know a better solution, please let me know...

....and to strip HTML tags and let Java do the regex..:


<cffunction name="getPlainTextFromHTML" access="public" returntype="string" output="false">
    <cfargument name="html" type="string" required="true">
    <cfscript>
        var HTMLEditorKit = CreateObject("java","javax.swing.text.html.HTMLEditorKit").init();
        var styledDocument = CreateObject("java","javax.swing.text.html.HTMLDocument").init();
        var reader = CreateObject("java","java.io.StringReader").init(arguments.html);
        
        HTMLEditorKit.read(reader,styledDocument,0);
        return styledDocument.getText(0,styledDocument.getLength());        
    
</cfscript>
</cffunction>

What do you think...? MySQL Toad

I just came across Toad for MySQL

 image

Please let me know if you think it's worth a try and if it's a good replacement for MySQL WorkBench (which contains more bugs after every update!)

WHOIS your Daddy?

I was playing around with querying a whois server. Actually I didn't know it was that easy...

Here's the code:


<cffunction name="getWhoisData" access="public" returntype="string" hint="I return data from a whois server">
    <cfargument name="whoisQuery" type="string" required="true" hint="e.g. 'domain microsoft' or '?' to show whois server help-commands">
    <cfargument name="whoisServer" type="string" required="false" hint="e.g. whois.ripe.net. Default server is whois.internic.net">

    <cfscript>
        var whoisData = '';
        var whoisClient = createObject("java","org.apache.commons.net.WhoisClient");
        
        // use default whois server?
        if ( not isDefined("arguments.whoisServer") ){
            arguments.whoisServer = whoisClient.DEFAULT_HOST;
        }    
        
        try {
            whoisClient.connect(arguments.whoisServer);
            whoisData = whoisClient.query(arguments.whoisQuery);
            whoisClient.disconnect();
        } catch (Any exception) {
            whoisData = exception.message;
        }

        return whoisData;
    
</cfscript>
</cffunction>

Some examples:


<cfoutput>
    <h1>? [whois.internic.net]</h1>
    <pre>#getWhoisData('?')#</pre>    
    <h1>domain microsoft.com [whois.internic.net]</h1>
    <pre>#getWhoisData('domain microsoft.com')#</pre>
    <h1>=microsoft.com [whois.internic.net]</h1>
    <pre>#getWhoisData('=microsoft.com')#</pre>    
    <h1>registrar TUCOWS INC. [whois.internic.net]</h1>
    <pre>#getWhoisData('registrar TUCOWS INC.')#</pre>    
    <h1>-G -B 192.113.224.88 [whois.ripe.net]</h1>
    <pre>#getWhoisData('-G -B 192.113.224.88','whois.ripe.net')#</pre>    
</cfoutput>

Ant + Subversion - How to list revision numbers

Today I needed a way to list all revision numbers of a repository.

I came up with the following solution:

Notes:
- svnant required;
- subversion called from command line.


<project name="buildexample" basedir="." default="svn.revisions">
        
    <!-- Setup svnant -->
    <import file="svnant.xml"/>
    
    <!-- Temp -->
    <property name="tempDir" value="C:\\DATA\\TEMP\\${ant.project.name}" />
    
    <!-- svn repo url -->
    <property name="svn.url" value="YOUR REPO URL HERE" />

    <target name="prepare">
        <!-- Create temp directory -->
<mkdir dir="${tempDir}" />
    </target>

    <!-- Set svn.revisions property -->
    <target name="svn.revisions" description="Sets property: svn.revisions" depends="prepare">

        <!-- creates log.xml for reading revisions -->
        <exec executable="svn" outputproperty="svnlog.out" output="${tempDir}\\log.xml" >
            <arg line="log --xml -v ${svn.url}" />
        </exec>
        <xmlproperty file="${tempDir}\\log.xml" collapseattributes="true" />     
        
        <property name="svn.revisions" value="${log.logentry.revision}" />
    
        <echo>${svn.revisions}</echo>
    
        <input message="Select Start Revision" validargs="${svn.revisions}" addproperty="svn.startRevision" />
        <input message="Select End Revision" validargs="${svn.revisions}" addproperty="svn.endRevision" />
    
    </target>

</project>

Please let me know if you think there's better way to list revision numbers.

BOOKMARKS in Eclipse,OPENS frequently used FILES!

Just stumbled upon on article of Luis de la Rosa which explains how to use bookmarks in Eclipse to track important lines of code.

This feaure is really handy for fast opening frequently used files in Eclipse e.g. Transfer.xml.cfm or i18n files.

Am I the only one who never used bookmarks in Eclipse before?

USE Ant.....it will save you a lot of time!

Jim Priest has a really nice wiki focussed on using Ant.

Check it out

WireShark - PERFECT Network Sniffer

You want to ANALYSE your network traffic?

Take a look at WireShark !!

MySQL Workbench ROCKS!!

Working with MySQL databases?

Check out the Beta release of MySQL Workbench !!!!

Linux Administrator Cheat Sheet

http://tiger.la.asu.edu/Quick_Ref/linux_quickref.pdf

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.004.