Comments
yourfanat wrote: I am using another tool for Oracle developers - dbForge Studio for Oracle. This IDE has lots of usefull features, among them: oracle designer, code competion and formatter, query builder, debugger, profiler, erxport/import, reports and many others. The latest version supports Oracle 12C. More information here.
Cloud Expo on Google News
SYS-CON.TV
Cloud Expo & Virtualization 2009 East
PLATINUM SPONSORS:
IBM
Smarter Business Solutions Through Dynamic Infrastructure
IBM
Smarter Insights: How the CIO Becomes a Hero Again
Microsoft
Windows Azure
GOLD SPONSORS:
Appsense
Why VDI?
CA
Maximizing the Business Value of Virtualization in Enterprise and Cloud Computing Environments
ExactTarget
Messaging in the Cloud - Email, SMS and Voice
Freedom OSS
Stairway to the Cloud
Sun
Sun's Incubation Platform: Helping Startups Serve the Enterprise
POWER PANELS:
Cloud Computing & Enterprise IT: Cost & Operational Benefits
How and Why is a Flexible IT Infrastructure the Key To the Future?
Click For 2008 West
Event Webcasts
WML & CFM E-Mail Delivery
WML & CFM E-Mail Delivery

wML 1.1 is my chosen standard and ColdFusion 4.5.1 is my preferred development platform. I'm sure there are pros and cons for other versions and standard figures. Here I'll discuss my reasons for using WML and ColdFusion.

WML 1.1

I chose this standard because I don't intend to serve up advanced pages; the advancement of this application is server-side, not client-side. From the start the application must be able to work on all phones, old or new. For this reason I've never coded in WML stylesheets, used a bold (notice the closing tag), or any other display-modifying tags anywhere in my application code. It does add to the appearance, but if one user's phone doesn't support it, what's the point? I have no way of knowing my user base or their phones' browsers and/or version numbers. You can code if statements based on browser types into templates, then redirect to wherever you want, which is useful. An index.cfm file for the domain is redirected to a certain directory based on that browser type. I'm not planning on coding example templates after considering the possibilities, which are beyond the scope of my example. I just made the appearance simple. After all, this isn't the
Internet, this is WAP. The goal is quality information at the touch of a few keys, not pretty pictures and huge server processing/download times that are likely to cause phones to time out connections and older phone browsers to crash.

ColdFusion 4.5.1

Why this upgrade from 4.5 to 4.5.1? Why not wait until 5.0 comes out? Well, after a rather long period of dealing with 4.5 and 4.0 problems, I convinced my employer to upgrade the public server to 4.5.1. It turns out that it wasn't as necessary as I thought. I assumed that some of the CFMAIL and CFPOP problems would be fixed in this update. I suspect not. In fact, I still see some pop up from time to time. If you want to get more details on those problems,
visit the Allaire Forums at http://forums.allaire.com. Don't get me wrong; I love ColdFusion and will continue to work with it for many years, but I'm truly expecting great things from ColdFusion 5.0, and I believe I'm not alone.

Let's face facts. WAP isn't the Web and it isn't meant to be. Just as the Web is not WAP. Each platform has its benefits. I'll try to explain and provide working examples of CFM and WML code together that should serve up e-mail messages to all WAP-enabled devices without any differences in the display. I'm not going to a provide an example of a seriously advanced WAP e-mail application because of space limitations. Perhaps in a future article I can explain in depth
about modules of a larger application. Perhaps, over time, a much larger application can be built using these articles.

The Login

You have two choices here: query a database (you choose the type) for the server details and e-mail, or request them from the user. My advice? Get everything but the user's password from a database, then use the username to query the database and find the server and e-mail details. That way users aren't giving you access to
their e-mail accounts. Plus WAP devices are a pain to type information into. With that in mind, here begin the code examples for a simple CFM-WML WAP e-mail application that asks only for the username and password. Prior to access, a simple Web form could be used to submit the information into a database.

First, the file name is "header". Hey, we're using ColdFusion, so let's tidy the code up and make things simple. This is the code for the WML header and the entire contents of header.cfm.




"http://www.wapforum.org/DTD/wml_1.1.xml">



File extension .cfm? Yes, we still use .cfm. The CFCONTENT tag does the rest of the work provided the Web server's MIME types are set up correctly as Internet information servers (IIS) (see Table 1).

You also have to add mapping to IIS.

wml = C:\CFUSION\Bin\ISCF.DLL

The application file is simple; see the complete code below:


 name="Wap_email_example"
 clientmanagement="Yes"
 sessionmanagement="Yes"
 setclientcookies="no">




The login.cfm page is a .cfm file, but it doesn't have to be. It's a .cfm file because the file contains a cfinclude statement that requires processing not only by the Web server, but also by the ColdFusion server; otherwise .wml would have been okay. With that mapping ColdFusion processes the WML file as a .cfm file, which in
itself could be useful. I never use that function; I guess old habits die hard. I just prefer to use the .cfm extension (see Listing 1).

This creates the URL variables username and password. The param username is used to locate the user's record in the database, which has a table called users and is set in columns (see Table 2).

When the Web server requests the template logging_in.cfm, several things are expected. The variables url.username and url.password are constant across this small application. Read Listing 2 to see what happens.

You may have noticed, but if not, I'm going to make this point now: anything under the CFCONTENT tag will generate white space.  White space is very bad. Excessive white space in Nokia phone (7110) browsers causes an error - it stops the page from being displayed. The query looks only for a username, then generates a record count that's used in processing further down the template. Without the record count or with a record count greater than one, the application can't function correctly and falls to failure mode (card OPPS).

Tip: Add the title to the links; it looks better in UP .Browser phones and the Nokia phones don't mind.

Listing 3 provides the code to query the POPserver that relies on information in the database. Once again we query the database. Why? Because I don't trust client or session variables in WML/CFM code. While I don't have any proof, I had some problems with variables and just assumed they wouldn't work beyond the page they're set in. Querying the database appears to be the best way to go since it won't fail!

We now have the buffer template. If there's no mail, you're told that. In the template that Listing 3 was cut from, there was more advanced error control and CFIF statements that included or excluded the options according to the number or lack of messages. Please take note of the output modifier XMLformat and make use of it in your WAP applications. It will change strings into XML-acceptable output. This saved me from writing a CF_ tag to do the same job. I was just about to do that when a colleague pointed out that I really didn't need to.

This template has several options (provided e-mail is received). You can drill down on mail or write it. The reason to buffer like this is that the potential for errors is high when receiving mail. It's wiser simply to take a count and offer the choice either to read (in the event of new mail being there) or to write mail. Bear in mind that the most useful feature in a WAP e-mail application is the ability to see if a new mail message has arrived. Chances are that replying to that e-mail using a handheld device isn't very high on the list of frequently used functions. Perhaps a quick "I read it" note (a default option maybe) could be coded in or requested from an additional field in the database table. This is a feature in the much larger application I'm currently working on.

Now we have to make a choice. Let's assume in Listing 4 that  my localhost is a POPserver and has an e-mail message for me. The next code insert would display a list of the headers I've removed, sorting code (by time and last message number first) because it's not required in a listing. However, in the "larger" application the
sorting is done first by the sender. Users then drill down to a new card. The title is the sender's name sorted by date under the assumption that a user would be drilling down expecting an e-mail from only one person.

Note: A limit of 10 e-mails is hard-coded in; however, there are better ways to limit data size. This can be done with loop and CFSET statements. You can request the startrow for the CFPOP query to be 10 less than the header query, and the maxrow to be the record count and loop backwards to the first e-mail. If you offered users the next 10, it would appear to be going forward; however, it would actually be going backward. Meanwhile, it would be delivering the most useful information first - the most recent e-mails. I suggest taking the e-mail, putting it in a database, and manipulating the information from there. Advanced sorting and filtering can be done faster that way.

Now we can either drill down and view that message that was "on" my localhost or write a message. I'm not going to explain how to output a mail message. The ability to do so is obviously there and the code examples you have here serve as an excellent blueprint to expand on. It's easy anyway. Simply change the CFPOP action to GETALL, carry the message number across as a URL variable, and output the variable url.ID (as coded in a previous example) as the CFPOP
message number. Just remember to run some serious filters on it. I ran the custom tags, CF_notags and CF_popdate (which requires some editing, such as default param for null date value and correction of 1999 setting), and of course the XMLformat. I strongly suggest that you write code that detects in the e-mail body. If is found, a warning is given to the user before he or she is allowed to proceed. Some people insist on sending out HTML mail messages - for
example, the e-groups mailing lists. Of course, if the final string of message.body is output like this - #XMLFormat(message.body)# - all the error-causing HTML tags will be rendered harmless and it creates an unreadable mess. I'm not planning on writing a decent filter for some time yet; I think users are aware of the difference between an HTML and plain text e-mail and will accept (if told) that an e-mail won't display correctly.

Now to send an e-mails.Again I exercised restraint and didn't code a visual nightmare. In fact, the code is simple (see Listing 5).

The placement of the tags in such a manner is not normally recommended. If you were to read the back of the 4.5 Language Reference Manual, you'd find that this practice is directly referred to as "not a good development practice." However, I've run into errors that were solved by using it, however unprofessional it may seem to be. Those errors were caused by this type of code:

 
href="sendmail.cfm?username=#url.username#&password=
#url.password#&t

o=#XMLformat(message.from)#&subject=#XMLformat(message.subject)#&msg
=RE:#XMLformat(message.body)#"
title="Reply">Reply

Passing variables through URLs is the wet paper bag version  of security. There are better ways. When users e-mail, account passwords are involved. There's a better approach. Using SQL, the password for the POPserver could be safely stored in the database. I'd like to remind all potential CF developers of the WAP platform that it's unreasonable to expect users to enter larger amounts of information via a key pad. This, of course, limits the application in some respects. However, it also means that new challenges await us all. WAP is taking off in a big way. CEOs love to tell their board members they can now get their e-mail using their mobile phones. Trust me, I witnessed the hype firsthand this morning.

For references relating to ColdFusion as WAP, Allaire has a forum as does Nokia (limited in information). The best resource for WML I found is the WMLProgramming list at egroups.com. The list is heavily moderated, so be warned. You can get banned for advertising. Messages that have questions based on lack of research are frequently nuked before reaching the list. Read the FAQ at www.allnetdevices.com/ faq/. It should answer many if not all of your questions and provide an excellent language reference to boot.

CFPOP Tag

CFPOP is a tag with some nasty habits such as huge memory (RAM) leakage. At the time of this writing, Allaire had announced that its Tag gallery would release a true freeware and well-performing replacement developed in Delphi C++ by a man named Paul Vernon (paul.vernon@e-cruitnow.com). I advise all readers to
please consider using CFX_pop2 as a replacement for CFPOP as it will solve many of the problems you'll encounter. Please refer to the Allaire Forums thread at http://forums.allaire.com/devconf/Thread.cfm?&Thread_ID=189290.

About Nigel Wade
New Zealander Nigel Wade, WBT's ColdFusion
editor, left high school - before finishing - for
college to study applications programming, but quit after one term because he hated being a poor
student. In 1999 he followed his new wife to
Finland and a job at an intra/extra and Internet applications developing company, Ch5Finland.com. He currently develops WAP applications in the
ColdFusion platform as well as CFM, WML,
and SQL applications.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Latest Cloud Developer Stories
DX World EXPO, LLC, a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the ...
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, an...
SYS-CON Events announced today that Conference Guru has been named “Media Sponsor” of the 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. A valuable conference experience generates new contacts, sales leads, potentia...
DevOps is under attack because developers don’t want to mess with infrastructure. They will happily own their code into production, but want to use platforms instead of raw automation. That’s changing the landscape that we understand as DevOps with both architecture concepts (Clo...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enter...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021



SYS-CON Featured Whitepapers
ADS BY GOOGLE