Google gadget launched
Categories: Uncategorized
Yesterday I finished working on the Google gadget for this blog, which allows you to view the latest articles posted. Creating the gadget was straight forward and easy to test using Google’s developer gadget and developer notes. They provide all the documentation necessary to design and create a gadget using a variety of JavaScript functions embedded into an XML file…
CFFormProtect v1.0 released
Categories: Uncategorized
Thanks to Mike Sprague for pointing this one out: CFFormProtect….
Read Morerss.cfc for simple rss 2.0 compliant XML
Categories: Uncategorized
I have created a ColdFusion component for simple creation of RSS Feeds. It seems that the need to create valid RSS 2.0 XML is required in various locations throughout sites and it would be a lot nicer to have a component to hand the creation of the XML. This will make it much easier to upgrade your RSS feeds in the future when new specifications are released. This also lends us the ability to follow the DRY technique, and of course makes our lives a lot easier. Note, this CFC is based off of the RSS 2.0 specifications.
To use rss.cfc is quite simple:
- First, instantiate the object.
- Secondly, pass in the channel data into the init method.
- Third, set each item for the channel using the setItem method.
- Lastly, create the RSS feed by calling the create method
Here is an example script that creates a test feed:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22<cfsetting showdebugoutput="false"> <cfscript> rssObj = createobject("component","rss"); channelStr = StructNew(); channelStr.title = "Test"; channelStr.link = 'http://www.brianflove.com'; channelStr.description = 'testing'; channelCategories = ArrayNew(1); catStruct = structNew(); catStruct.category = 'category 1'; catStruct.domain = 'http://www.brianflove.com'; ArrayAppend(channelCategories,catStruct); ArrayAppend(channelCategories,'category 2'); channelStr.category = channelCategories; rss = rssObj.init(channel=channelStr,editor="Brian"); if (isValid('string',rss)){ WriteOutput(rss); }else{ rss.setItem(title="test",link="testing",description="test",category=channelCategories); rss.create(); } </cfscript>
Notice, that you can both pass in each argument into the init and setItem functions to set the value of that property within the channel or item, or you can pass in a struct that contains key-value pairs that match the argument names. This is shown on line 4 through 14, where I am creating the channelStr struct and setting the value of the channel’s title, link, description, and category elements. Also note that categories (for either channels or items) can be set as a single string, an array of strings, or an array of structs containing either just the category key-value or both the category and domain key-value pairs.
To make it easier to use this CFC check out the Component browser output from CF that outlines all 3 methods and their arguments, defaults, return types and hints. Ok, now just download the RSS CFC and give it a try (be sure to remove the txt file extension). If you run into any problems or have any questions, leave me a comment.
Read MoreLocal versus Global variable scope in JavaScript
Categories: Uncategorized
There has been a lot of discussion on the CFUGCNY (ColdFusion User Group of Central New York) listserv in regards to local versus global scope of variables in JavaScript. I thought I would take this opportunity to explain the difference, the problems that arise, and how best to avoid these problems.
Local versus Global Variables
Local variables exist only within the function they are defined and have no presence outside that function. The value of local variables cannot be changed or retrieved by other functions, methods, objects. And, local variables are defined by setting the value of the variable within a function using the var keyword.
On the other hand, global variables exist throughout the script and can be accessed and altered within any scope. Global Variables are defined by setting the value of the variable outside any function or object without or without the var keyword, setting the value of the variable within a function or object without using any scope, or using the window scope since all global variables are stored in the window object.
Problems that may arise
is always advisable to use the local scope for your variables within a function to avoid any problems where variable names might exist in more than one script or chunk of code - think of the variables ‘i’ that is often used as an index in enumerators. Often times the value of global variables will be changed by other scripts that use the same global variables by not defining variables local to a function or object. Also, if you define a local variable with the same name as a global variable, you will not be able to access the value of the global variable within that particular function.
How to solve the problem
- Don’t use generic names for variables and functions, such as ‘i’ and ‘init’,
- Try to ensure variable names are unique, or
- You can ensure the problem will not exist through the use of objects.
Objects allow you to encapsulate and share variables among function, or better called, methods withing your object (or class). The Following example illustrates how we can ensure that we don’t confuse local and global variables through the use of objects:
1 2 3 4 5var test = 'global test'; var testing = { test: 'test within testing object', alerttest: function(){ test='global variable has changed'; window.alert(test); window.alert(this.test); } }
What will the two alerts be when we call the function using and onclick="testing.alerttest();"? First, we will get the value of the global variable after being modified by the function ‘global variable has changed’, following by the value of the parameter test to the object testing ‘test within testing object’. Furthermore, you can extend objects using JavaScript using the Object.extend method and you can go even further by extending the capabilities of objects (and more) using the prototype.js library.
Read MoreCFEclipse 1.3 released
Categories: Uncategorized
If you haven’t checked out the latest version of CFEclipse, be sure to install the update… it’s definitely a major improvement and will help you to perform your job better. There are many enhancements, fixes, and additional functionality that make this release a milestone in the life of CFEclipse. According to their web site:
CFEclipse 1.3 has been finally released after a years development. This release includes a number of new features including: External Browsers, Multiple ColdFusion version dictionaries (such as Railo, BlueDragon and ColdFusion 5, 6 and 7), a Component Explorer, improved FTP, drag and drop linking to files, "Edit this tag" functionality (both using the right click on a tag or Ctrl + T), A Dictionary viewer to get information on tags and functions with double click insert support and a host of other improvements over the previous version.
You can install CFEclipse into your current Eclipse installation by:
- Select the "Help->Software Updates->Find and install" menu option
- On the screen that is displayed, select ‘Search for new features to install’ and click the ‘Next’ button
- Now click the ‘New Remote Site’ button
- Enter a name for the update site, for example "CFEclipse". In the URL box, enter "http://www.cfeclipse.org/update" and click the OK button
- You should now have a ‘CFEclipse’ node in the ‘Sites to include in search’ box.
- Tick the ‘Stable CFEclipse’ box and click ‘Next’
- Eclipse will contact the CFEclipse site and retrieve the list of available plugins. Tick the plugin with the highest version number and click ‘Next’
- The next instructions are self-explanatory, agree to the license, install the software and restart Eclipse
Once Eclipse has restarted CFEclipse should have been successfully installed
If you are already using CFEclipse, you can install the latest stable version by:
- Select the "Help->Software Updates->Find and Install…" menu option
- On the screen that is displayed, select the ‘Search for updates of the currently installed features’ and click the ‘Next’ button
- If there are any updates for your current plugins, you will be able to select those, and click install.
Also, as a side note, those using Aptana should also upgrade to their latest version (0.2.7.13425) which was released on 02/05/2007 and includes the Aptana JavaScript Debugger.
Lastly, be sure to check out the new CFEclipse TV section, which provides some screencasts showing you the features of both CFEclipse and Eclipse in general. If you are still using Dreamweaver, then take a look and see what you’re missing.
Read MoreSuccessful identification of customer needs lends the creation of innovative product concepts
Categories: Uncategorized
I believe that having a process to identify customer needs is a key component to a firm’s ability to create innovative product concepts and eventually successful products that often disrupt the customer expectations or a disruptive technology. According to Wikipedia, a disruptive technology is defined as a "technological innovation, product, or service that eventually overturns the existing dominant technology or product in the market" (Disruptive technology, 2007). Having a structured process for identifying customer needs should be an integral component in the knowledge management of a firm in the pursuit of innovative products and services.
A structured process can provide insight into the expectations, needs, and wants of the customer, however, it is just as important to share the knowledge throughout the firm. A structured process should include the integration of the data retrieved through customer satisfaction and needs evaluation into a knowledge management solution that can in turn provide the firm with the ability to analyze customer needs alongside existing knowledge about the product generating and expanding organizational knowledge. According the author of "Collective intelligence: a keystone in knowledge management" in the Journal of Knowledge Management, knowledge management can provide an organization with the ability to integrate the collective intelligence of the customers into the process of cultivating an innovative culture and creating innovative product concepts. The author explains that "while information technology provides the organization with methods to manage workflows of information taking place in the course of a business activity, knowledge management shall provide the organization with methods to articulate the existing knowledge (internal and external) and promote innovation - that is generation of new knowledge, as a respond to a specific customer problem" (Boder, André 2006).
A structured process for the identification of customer needs leads an organization towards a problem-oriented paradigm, where the goal is create solutions to solve the problem that exists between the customer current state and desired state. But product innovation is not just about creating another product or expanding the features, uses, or usability of current product offerings. In today’s highly competitive environment this will assist a firm in sustaining and growing an already existing competitive advantage, but will not allow a firm to create new uncontested markets. According the the BusinessWeek article entitled "The world’s most innovative companies" the author states that innovation is more than just reinventing product concepts, its about "reinventing business processes and building entirely new markets that meet untapped customer needs" (McGregor, Jenna 2006). A process for identifying customer needs can lend insight into expanding upon pre-existing product concepts and markets, which can lead to a foundation for establishing a truly innovative product concept such as the ‘Post-It note’ or a disruptive technology such as Google’s AdSense.
Works Cited
- Disruptive technology. (2007, January 25). In Wikipedia, The Free Encyclopedia. Retrieved 16:02, January 30, 2007, from http://en.wikipedia.org/w/index.php?title=Disruptive_technology&oldid=103191224
- Jena McGregor, with Michael Arndt and Robert Berner in Chicago, Ian Rowley and Kenji Hall in To (2006, April). THE WORLD’S MOST INNOVATIVE COMPANIES. Business Week,(3981), 62. Retrieved January 30, 2007, from ABI/INFORM Global database. (Document ID: 1023976861).
-
