29 November 2008

Some Cool Tools for Your Flex Apps, Part I

Came across a few cool tools for Flex/Flash,

24 November 2008

Saving Money for the UNC System via IT

Hi, all. What are some ways that we can help the UNC University System save money via Information Technology in these challenging times? I've started the list but please chime in.
  • Sharing information and learning on IT. If you've found a free tool or some creative way to accomplish a task, more than likely others can benefit from it.
  • More cooperation among the UNC system institutions on IT projects; why not share code and ideas on projects? We're all working for the betterment of the State of North Carolina. But obviously, for such sharing to occur, there needs to be some form of state-wide communication among the IT departments of UNC schools.
What are your thoughts? What have you done to save money in your IT department (or because of your IT department)?

Build Flex Apps from within Visual Studio 2008

A new product from Ensemble and Adobe enables .NET developers to build (and debug) Flex apps from within Visual Studio 2008. The tool is free and holds great promise.

21 November 2008

LDAP Browsing

If you do web dev against an LDAP (Active Directory, Open Directory, etc.) and need to peer into the depths of this mysterious beast, try the free Softerra LDAP Browser. Ensure that you have at least read permissions to the LDAP, get the path, and fire up the browser. You can do filters/searches and do LDIF exports.

Free Alternative to WinZip

Tired of the Windows built-in Extract utility? Download the great freeware 7-Zip. I've used it for a few months and can say nothing but good things about it.

Run Multiple IE's on the Same PC

If you've ever needed to test your web apps on multiple versions of Internet Explorer, here's a neat utility that'll let you do just that: MultipleIEs. It lets me run IE 7, 6, 5.5, and 5.01 on the same machine.

Make Your Sites Come Alive!

You can add animated characters to your site to speak customized text and provide custom help to users. The technology's been around for awhile, but it's gotten progressively more sophisticated. Take a look at the SitePal.com option. This article outlines the benefits and the companies that offer the technology.

Great (and Free) SFTP/FTP Client for Windows

A friend told me about this great, freeware SFTP client for Windows called WinSCP. For an RIA project that resides on a Solaris box, this tool came in quite handy, with drag-and-drop capabilities from WinXP Pro. Lots of cool built-in features, including the ability to set permissions on uploaded files. Very useful when uploaing to a Unix box; even lets you set the permissions in octal.

20 November 2008

Adobe CS4 - Master Collection

Just got the CS4-MC and the box itself is beautifully designed. From Adobe: Provide an integrated venue for social networking, collaboration, inspiration, and improved productivity.

Services available at launch:
  • ConnectNow: Free real-time online collaboration from CS4 applications for up to 3 people
  • Adobe Community Help: Community based learning and information sharing in CS4
  • kuler: Color sharing and exploration online and in app
  • InContext Editing service: Direct web page editing (beta at launch)
  • Resource Central: Up-to-date information

Actionscript 3 Cryptography Library

For those who need to encrypt/decrypt information using common algorithms (RSA and MD5), then the as3crypto is the answer.

19 November 2008

What is an RIA?

Next time you wonder, check out this great page from Adobe.

Free CS4 Curricula from Adobe

Adobe has some excellent higher education resources for learning everything from the CS4 suite to RIA technologies.

Flex Data Models

One of the powerful features of Flex is the <mx:model> tag. You can bind fields and variables to it; when a user updates a value in a TextInput, if that field is bound to a model, the value in the model will be updated too. You can then pass the model object to your server-side technology. Recently, I needed to pass some search parameters to an HTTPService:

<mx:model id="serviceModel">
<root>
<searchid>{this.searchID.text}</searchid>
<description>{this.searchDescription.text}</description>
<searchtype>{this.searchType}</searchtype>
</root>
</mx:model>

The above model object came in handy. It's basically an XML object with whatever structure you'd like to give it. Note the first two nodes off of <root> are bound to TextInput fields; the last is bound to a private variable. When the value of the variables change, so do their values in the model.

Then when I'm calling the HTTPService, I simply pass the model object to it:

serviceGridReader.send(this.serviceModel);

When You're Stuck...

When you're a Flex developer, you will run into questions; it's inevitable. You'll exhaust Google (if that were possible!), and wonder where to turn to next. Adobe's Flex Forums are great. But don't forget the FlexCoders Yahoo Group. There seem to be experts on there 24/7 answering questions. Lots of Flex heavyweights are helping folks on a regular basis.

Amy's Flex FAQ - Lifesaver!

Here's an FAQ of common Flex issues/questions. It should be a must-read for Flex developers, beginners and experts. Thanks, Amy, for this great resource :)

11 November 2008

Setting a Flex Label to a Special Character

When setting a label's text property dynamically, you can't use the ASCII code for special characters; you must use the HEX value instead. For example, the following will not have the desired effect,

var date:Date = new Date();
lblFooter.text = "&#169; " + date.fullYear.toString() + " MyOrganization.";

This will produce the following result:

&#169; 2008 MyOrganization.

To correct this, use the HEX value instead,

var date:Date = new Date();
lblFooter.text = "\u00A9 " + date.fullYear.toString() + " MyOrganization.";

which gives you,

© 2008 MyOrganization.

Note that the HEX code must be 4 digits. If, as in this case, the code is only 2, you'd precede it with 0's. To look up the codes, go here.

07 November 2008

Search a Folder for a File in Java

Java has some powerful mechanisms to search your server folders for files. I recently had a project where files were created on the server with partially random names, such as ABCD123__199518631844.jpg, where the ABCD123__ was the known portion of the filename. Later, I needed to find and delete these files. Some research revealed the FilenameFilter interface which contains an accept() method, returning a Boolean to indicate if the file meets a certain condition. In my case, I needed to have the filename begin with a specified string,

import java.io.FilenameFilter;
import java.io.File;

public class FileFilter implements FilenameFilter
{
private String _namePortion = "";

public boolean accept(File dir, String name)
{
return (name.startsWith(_namePortion));
}

public void setNamePortion(String value)
{
_namePortion = value;
}
}

I added the setNamePortion() method to set the string that will be tested. Then in the servlet, I added the following code to find and delete the file(s) that met the criteria,

File directory = new File(uploadDir);
filter.setNamePortion(aString + "__");

File fileList[] = directory.listFiles(filter);
String filePathToDelete = "";
File f = null;

for (int i=0; i < fileList.length; i++)
{
filePathToDelete = fileList[i].getAbsolutePath();
f = new File(filePathToDelete);
f.delete();
filePathToDelete = "";
}

06 November 2008

Kap Inspect - Cool Tool Is Like X-Ray Glasses for Your Flex App

The free Kap Inspect tool from Kap IT, enables Flex developers to take a peek inside the workings of their Flex app. After installation, you hit Ctrl-Alt-F12 to get a popup containing the inner workings of your Flex app -- the styles, components, structure, etc. It's similar to the Web Developer Toolbar or Firebug in Firefox.

Degrafa for Flex Enables Control of Background Images

If you've ever wrestled with background images for Flex components, there's a powerful library to make your life easier: Declarative Graphics Framework (Degrafa). I'd implemented a paging mechanism for an AdvancedDataGrid; then I added a background image to the Application container,

<mx:Style>
Application {
background-image: Embed("global/media/flower.png");
}
</mx:Style>

The height property on the AdvancedDataGrid was set to 100% and the variableRowHeight="true"; however, this was giving me grief: For whatever reason, the record at the bottom of the grid was cut off. And the scrollbar stopped a few steps before it could completely reach it. After some trial-and-error, two solutions emerged:
  1. Take the height property off completely and keep variableRowHeight="true".
  2. Or set the rowHeight to some value and set variableRowHeight="false". The trouble was, this meant all the rows would be the same height. Not very aesthetically pleasing.
I opted for the first solution. But with this choice, it caused the grid to expand and contract as you paged through the records (the rows have different height values depending on their content). Not a big issue for the grid to resize vertically; but it was also causing the application's background image to grow and shrink as you paged the records. Again, not very pretty.

Some research led me to this great blog by Brendon Wildbore. The solution was to use his code example along with the Degrafa SWC file in the project's lib folder. Instructions on downloading and installing the SWC can be found on the Degrafa web site. Following Brendon's example, I changed the CSS to look like this,

<mx:Style>
Application {
background-image: Embed("global/media/flowers.png");
background-repeat: repeat;
background-position: center;
background-blend: normal;
borderSkin: ClassReference("com.degrafa.skins.CSSSkin");
}
</mx:Style>

And the problem disappeared. The image now stays the same size. However, the image was too dark; a check of the values and it was clear that the background-blend: multiply; was the culprit. Changed it to normal and all is well.

The Degrafa library allows for much more than this. Check out their site to see the capabilities.

04 November 2008

Wireshark - Must-have Utility for All Flex Developers

I was wrestling with a very subtle problem today: The Flex app was passing some variables to a Java servlet via an HTTPService,

var params:Object = new Object();
params.ServiceType = "INITIALIZE";
params.SearchID = searchID.text;
params.Description = searchDescription.text;
serviceGridReader.send(params);

Using the Wireshark tool, I filtered the capture to only give me the packets for my server. I noticed that the above params data was being sent to the server as XML. Hmm. I had the following further up in the code,

serviceGridReader.contentType = "application/xml";

I created a simple HTML page with a form and a submit button, passing the same data in hidden fields. Lo and behold -- the servlet worked fine with that. Using Wireshark, I noticed the data was being passed in this format from the HTML form,

Description=&ServiceType=INITIALIZE&SearchID=PANUNC

Once I commented out the line setting the contentType, the servlet was happy with a simple request.getParameter("ServiceType").

Java String Comparison

One little gotcha in Java is the string comparisons: Using the equality check == will tell you if the two variables are referencing the same object, not whether their string values are the same. To do a string comparison, use something such as this,

 if (string1.equalsIgnoreCase(string2)) {
//... do something
}

Otherwise you'll be wondering why your code isn't working ;)