Search
Feeds
May 8 2008

.NET and ColdFusion: Yes, We Can Work Together!

While working on a ColdFusion project, you might find a library someone has made that does exactly what you need and will save you lots of development time and money, but it’s written in .NET. Problem right? Not with ColdFusion 8. You can now access .NET assemblies as easily you can other ColdFusion components.

Take a look at the following C# class:

using System;
using System.IO;
using System.Text;

namespace Sanative
{
public class TempFolder
{
private string tempPath = Environment.GetEnvironmentVariable("TEMP");
private DirectoryInfo tempDirectory;

         public TempFolder()
{
tempDirectory = new DirectoryInfo(tempPath);
}

         public long GetSize()
{
return GetSize(tempDirectory);
}
        
         public long GetSize(DirectoryInfo directory)
{
long size = 0;
foreach (FileInfo file in directory.GetFiles())
            {
            	size += file.Length;
            }
            foreach (DirectoryInfo dir in directory.GetDirectories())
{
size += GetSize(dir);
}
            return size;
}
}
}

Whenever GetSize() is called in the code, it will look at the folder that is set in the TEMP system variable in Windows and then return the amount of space on the disk that its files and folders take up.

This class will need to be compiled into a DLL so ColdFusion can access it. I compiled it to “F:\assemblies\TempFolder.dll”. It’s probably a good idea to keep your .NET assemblies in a central location outside of your webroot.
As you can see in the following ColdFusion code it’s very easy to consume the TempFolder class.

<cfscript>
tempFolder = CreateObject(".NET","Sanative.TempFolder",
"F:\assemblies\TempFolder.dll");
Writeoutput(tempFolder.getSize());
</cfscript>

The argument for the object type can either be “.NET” or “dotnet”. The second argument, for the class name, must include the namespace for the class or an exception will be thrown. The last argument is the full path to the assembly which contains the class. (Note: you can reference more than one assembly, if needed, separated by commas. Also, if you need to access any of the .NET core classes, such as “System.Environment” core classes, or any classes that are contained in assemblies in the global assembly cache, you do not need to specify the assembly argument.)

The first time a .NET class is called, ColdFusion will generate proxy Java classes to use with its built in Java/.NET bridge. The .NET Integration service will need stopped if any updates need to be made to the assembly.

There are some data conversion gotchas as well as some limitations because of going back and forth from Java to .NET. Full information about them as well as how to call .NET classes and assemblies that are located on a different server can be located on the Adobe ColdFusion 8 Livedocs at http://livedocs.adobe.com/coldfusion/8/htmldocs/dotNet_01.html

Sample Files

0 comments - Posted by Jeff Anderson at 4:23 PM - Categories:

May 8 2008

SysToast: A System Tray Notifier for AIR Applications

EverythingFlex has an excellent SysTray notification class called NativeAlertWindow. What it does is create a ‘toast’ window in the bottom right corner of your screen. When an event happens, a window will pop up, literally like toast, on your screen next to the system tray. This is very similar to what MSN Messenger, Norton, McAfee, and countless other programs do.


The problem with NativeAlertWindow is it is part of a SWC (a precompiled Flash file that is not editable) called everythingflexairlib. So you aren’t able to look at the code or change things easily if you need to. This is a very basic replica of NativeAlertWindow but not compiled in a SWC. It will get you started on creating toast windows. Extending it is up to you.

Copy the SysToast class file to the appropriate location in your project. The following is all that is needed in your MXML file.

import net.sanative.SysToast;
    public function callToast():void
    {
        var mytoast:SysToast = new SysToast("mymessage", "mytitle", mydelay, 
            mywidth, myheight, mylifetime, "mychrome", "mytype", mygap);
    }



That is all that is needed to create a toast window. The ‘my’ variables would be replaced with actual values according to your application.

 

  •     mymessage (Required) (String) - Message to display in the toast window. Default is null.
  •     mytitle (String) - Text to display in the title of the toast window. Default is 'Alert'.
  •     mydelay (Number) - Amount of delay between the time the toast was called until it is created. This is a millisecond number value. 1000 = 1 second. Default is 0.
  •     mywidth (Number) - Width of the toast window. This is a pixel number value. Default is 200.
  •     myheight (Number) - Height of the toast window. This is a pixel number value. Default is 100.
  •     mylifetime (Number) - Time that the toast window will be visible for. This is a millisecond number value. 1000 = 1 second. Default is 8000.
  •     mychrome (String) - System chrome to use for the toast window. Possible values are 'none' and 'standard'. Default is 'standard'.
  •     mytype (String) - Type of window the toast window will be considered. Possible values are 'lightweight', 'normal', and 'utility'. NOTE: 'lightweight' ONLY works with 'none'. Default is 'normal'.
  •     mygap (Number) - Gap between the bottom and right side of the screen to position the toast window. This is a pixel number value. Default is 10.

As I stated before, this is a very basic class. We will update the class over time to eliminate some of the limiations and make it full-featured. That being said here are the current limitations:

  •     This is not a toast window manager. This means that it can only show one toast window at a time for each variable reference.
  •     Each toast window created is placed in the bottom right corner.
  •     It does not apply stacking for better viewing.
  •     There are no transition in or out effects. Windows Vista has its own native window open and close effect which fakes a transition effect for me in the mean time.
  •     Toast windows cannot be minimized, maximized, or resized. More than likely this will not change. Allowing those defeats the purpose of a toast window.
  •     Icons and/or images are not utilized in the titlebar or on the toast itself.
  •     The style of the text cannot be changed with CSS unless it is changed in the class itself.

If you have recommendations or suggestions please feel free to drop us an email!

SysToast Files

0 comments - Posted by David Freerksen at 3:23 PM - Categories: Adobe AIR

Jan 3 2008

Sanative Sponsors Northern California Flex and AIR Pre-release with Adobe's Ryan Stewart

Flex 3 and AIR are getting close to launch and in preparation, Ryan Stewart from the Adobe Flex/AIR product team is traveling to select cities to show off the great new features and help prepare us for this exciting launch. Ryan Stewart will be in Sacramento to speak on January 23rd at 6:30 PM.

Flex 3 is a feature-packed release, adding new UI components like the advanced datagrid and improved CSS capabilities; powerful tooling additions like refactoring; and extensive testing tools including memory and performance profiling, plus the addition of the automated testing framework to Flex Builder.

Adobe AIR is game-changing in so many ways, extending rich applications to the desktop, enabling access to the local file system, system tray, notifications and much more. Now you can write desktop applications using the same skills that you’ve been already using to create great web apps including both Flex and AJAX.

Read more about the event, and RSVP, at the NorCal Flex User Group website. All are welcome, the event is casual and there will be food and drink provided by Adobe and Sanative!

0 comments - Posted by TJ Downes at 11:52 AM - Categories: Adobe AIR | Cool Stuff

Jan 3 2008

Sanative Develops Desktop Widget for LiveCoordinator.com

Sanative has launched a desktop application utilizing Adobe® AIR for LiveCoordinator.com. Live Coordinator, which launches later this month, is an integrated communication solution for real estate transactions. It allows all team members who work together in completing a transaction to coordinate and communicate more efficiently than ever before.

Sanative worked with the Live Coordinator team to develop the widget based on an existing AJAX application. Using the Live Coordinator widget, a user can receive status updates directly on their desktop, in real-time. Home buyers and sellers will now be able to know what is going on with the escrow process every step of the way, as it happens. This unique capability is something not done before, and Sanative is excited to be part of the process.

Since the application is built utilizing Adobe AIR, the application will run seamlessly on Windows or Mac, and, very soon, Linux desktops as well. The application will automatically upgrade as new versions are released, removing confusion from the upgrade process for Live Coordinator users. Since the core of the application is based on AJAX technology, the LiveCoordinator development team does not need to have any knowledge of Adobe AIR. Updating their existing AJAX widget also updates the core components of the desktop widget. This unique capability lowers the cost of supporting a desktop widget for Live Coordinator.

Take a peek at Live Coordinator and see how the Internet is changing real estate and mortgage industries!

1 comments - Posted by TJ Downes at 10:29 AM - Categories: Adobe AIR | Site Launches

Oct 2 2007

Taking Your Website to the Next Level

The Internet, as a business platform, has spread faster than any other medium. The ability to reach a global or targeted audience has become relatively inexpensive (compared to traditional methods of marketing) and easy. Just about every company can benefit in some way from having an Internet presence.

You have your website. It's really well designed and you receive glowing comments on how nice it looks.  It has the typical contact information, some information about your organization's services/mission and maybe news about your organization. But really, is your website working for you?

When we collaborate with clients on building a new website a focus is not just how well the site looks, but also on how well the site serves your organization. Think about your current business processes, how you work with your clients, members or vendors. What processes do you do manually that can be done automatically over the Internet? What type of communications do you have with your clients, and how much time do these communications consume? Is there a way to streamline these processes that will free up valuable staff time for something else?

Often our experience is that streamlining processes such as event registrations, data collection or report generation can alleviate some of the tediousness of a staff member's daily duties, giving them more time to focus on the part of their job they like to do. In turn, this can lead to enhanced employee productivity. The end result offers considerable benefits:

  • Tedious tasks normally handled by humans are now completely automated
  • Removes the element of human error from the process
  • Interactions with members, clients and vendors happen faster, providing a sense of better service
  • Faster and more efficient collection of data
  • Reports and metrics are more easily generated
  • Attracting new clients or members based upon tools or features available to them
  • Increased productivity

With such a high number of benefits it is easy to understand how building these applications quickly pay off.

So how do you start?

We generally recommend that you have an idea of all those business processes that you perform in your day-to-day business which involve interaction with your members, clients, vendors or even remote offices. Also take a note of existing processes which happen via your website but require a significant amount of manual intervention to complete. Once you have documented these things talk to an application development consultant about what could be automated, or better automated. Generally, a good web application developer can identify aspects of your business processes which can be enhanced with a web application.

One last thing to note is that developing a long-term relationship with your consultant is important. The more they know and understand about your business and industry the more recommendations they can make which will improve your business.

0 comments - Posted by TJ Downes at 8:23 AM - Categories: Technical Articles

Aug 12 2007

Adobe Flex for Web Applications

In a few of our articles we have discussed Rich Internet Applications and Adobe Flex. In this post we will get more in-depth with Flex and give you a better idea of what Flex is, how it works, and why we feel it is an excellent solution to build your web applications.

Simply put, Flex allows developers to create applications that offer a rich user interface and a host of multimedia capabilities on the Adobe Flash platform. Most internet users are used to Flash as the pretty intro movies to websites, or flashy sites that offer smooth animations and sound. For example, if you have Flash installed and browse to Adobe's website homepage you will notice a very nicely done header with clean animations, video, audio or a combination of all three. This is an example of using the Flash platform to create rich multimedia experiences that run on any operating system and browser supported by Flash. Since Flash is installed on over 90% of desktop computers worldwide it has become a widely accepted format for delivering content.

Now, leveraging the Flash platform, developers can also build applications which allow us to create very user friendly interfaces that are fast and visually appealing. Additionally, displaying multimedia assets such as video and audio are quick and easy and the developer no longer has to worry about plugins and platform support.

A good example of this are the backend tools we built for the Roxie Cinema. The Roxie Cinema had a need to have a tool to manage the data which published movie information and showtimes to the site.


Additionally, they wanted to be able to publish multimedia assets such as audio, video and images without the worry of plugin support. As part of the requirement editors had to be able to preview these assets after uploading them. Utilizing Flex and Flash we would build an integrated solution without the need for expensive third-party tools and develop these tools quickly and at a relatively low cost to the client. The result has been a tool that allows management of all the website data via a single attractive user interface that is very responsive.

Additionally Flex easily integrates with many back-end technologies including ColdFusion, PHP, Java and .NET. Because of this it has become rapidly adopted by developers of many disciplines.

One of the most exciting capabilities of the Flex platform is the ability to push data to the user with LiveCycle Data Services. A good example of this might be an application which allows remote users to collaborate in real time on a document.

Let's say Kyle and Stan are working on a document that outlines a fundraiser event for Kenny's family, who's home was destroyed by Mecha-Streisand. Kyle has been grounded by his parents and is not allowed to leave the house, but he can access the internet. Using his super-secret password he gains access to Stan's website and loads the fundraiser document into his web browser. As he works on the document Stan will see Kyle's changes in real time. Stan notices that Kyle has a few typographical errors and decides to edit Kyle's work. While he is editing Kyle's document is updated in real time to reflect the changes. This can occur because the server realizes that the document has been changed and pushes those changes to all users who are working on that document.

There are many applications that this can prove invaluable for, such as providing real-time updates to news and information widgets without the need to refresh the page, or providing timed requests to the server. Real-time collaboration between you and your clients and vendors becomes an affordable and realistic application, even through your website.

Hopefully we have perked your interested in Flex. If you would like more information about Flex please give us a shout. If you are interested in seeing some Flex applications in use take a look at the showcase examples on Flex.org or contact us for a demo of applications we have developed.

0 comments - Posted by TJ Downes at 9:39 AM - Categories: Technical Articles | Cool Stuff

May 10 2007

Why Use ColdFusion?

This month we are going to focus on ColdFusion. There seems to be a lot of confusion about ColdFusion, what it does, and how it can actually save your organization time and, most importantly, money.

ColdFusion is a web application server. What does that mean? Simply put, ColdFusion allows you to dynamically publish information to and from a database or other source to make your site or applications interact in real-time with your organization's data. This can include something as simple as a contact form on your website or something as complex as a Customer Relationship Management system.

Many people argue against ColdFusion because it is not free. They argue that PHP, ASP, .NET and JAVA are all free and therefore are much lower cost than ColdFusion. True, the initial cost of ColdFusion, $1299 for Standard and $5999 for Enterprise, is not something to cough at. So why should you choose ColdFusion over any of the other previously mentioned languages?

For starters, ColdFusion has a very easy syntax, allowing entry-level developers to start making basic applications very quickly. It also allows more advanced developers to code their applications in record time because ColdFusion includes many of the tools developers often have to hand-code or integrate manually. ColdFusion code runs on many platforms, and very few changes ever need to be made in the source code to move an application from Windows to Linux to Solaris. 

ColdFusion is also based on the Java platform, giving it the power of Java as well as access to the underlying Java platform and custom objects written by your own staff or third parties. For instance, you may have existing Java objects which run your business rules. ColdFusion developers can leverage these existing objects in their ColdFusion apps with very little effort, rather than rewriting them entirely for their own applications.

ColdFusion has a slew of built in tools which enhance it's capabilities including XML processing, easy file uploading, Flash integration, ability to quickly and easily consume web services, PDF integration and publishing, charting tools, SMS and other gateway integration. There is a huge list of these features available on Adobe's website.

ColdFusion also integrates with many Rich Internet Application technologies very easily. Flex (a Flash-based application development platform) and ColdFusion work together seamlessly to provide some of the fastest development cycles for large scale applications we have seen, with some awesome user interfaces. AJAX and ColdFusion work well together, allowing websites to be updated in real-time without the need for slow page refreshes.

Recently, with the acquisition of ColdFusion by Adobe, many of Adobe's Enterprise level products, such as LiveCycle and Acrobat, now integrate seamlessly with ColdFusion and allow ColdFusion developers to leverage these tools to provide solutions which have been difficult to accomplish without extensive Java development. With the release of ColdFusion 8 in mid-2007, developers will see even more integration to Adobe's products, making development of document management systems, presentation and comunication tools faster than ever before possible.

If you would like to learn more about ColdFusion please contact Sanative for a free one hour demonstration of the product and how it can solve problems which exist in your organization.

0 comments - Posted by TJ Downes at 6:34 PM - Categories: Technical Articles | Cool Stuff