31 October 2008

Reducing Images in Photoshop CS4 and Maintain Quality

For best results, sharpen your images before reducing them in size (Image > Image Size). Set Resample Image dropdown to Bicubic Sharper. After the reduction, apply a slight Smart Sharpen.

22 October 2008

Refresh a Flex DataGrid

To force a Flex DataGrid to refresh its data (say, after you've updated it), you can call the invalidateDisplayList() method. This causes Flex to in turn execute the component's updateDisplayList() method. This came in handy while writing an image-upload app; after the image is uploaded, I needed the DataGrid's selectedItem to show the image it was associated with; in the overridden set data() method of the itemRenderer, there's code to do a load() of the image from the server.

21 October 2008

Variable row height in Flex DataGrid

Here's an easy way to have your DataGrid's rows adjust to fit the height of each row's contents:
<mx:DataGrid id="myGrid" variableRowHeight="true"
wordWrap="true">....</mx:DataGrid>
You need to use the variableRowHeight and wordWrap properties to get the job done.

Flash Player Settings Manager

Here's an online tool for managing your Flash player's settings.

17 October 2008

AutoCommit in Java

Just spent some time debugging my Java code to figure out why the MySQL update statements weren't committing to the database; in fact, they were waiting to be committed and thus causing the table to appear to be locked. The problem was in the code I'd copied from a friend; it had this line in it,

conn.setAutoCommit(false);

This was put in to only commit a transaction when it was successful. Important safety tip: Either turn the false to true in the above code, or include conn.commit() statement after your DML statement to the database.

14 October 2008

Emerging Technologies Conference at UNC?

Hi, all. How do you feel about having an "Emerging Technologies" conference at UNC? Please post comments here and vote on the poll on the left. Some topics to get us started in the discussion include,
  • Rich Internet App tools/tech (AJAX, Flex, Curl, JavaFX, JBoss Seam)
  • Cloud computing (providing technology-enabled services over the Internet -- "in the cloud")
  • Mobile devices: Web access, development, etc.
  • Web 2.0 (social networking sites, blogs, wikis) -- though many of these are already established tech and not so much "emerging" anymore
  • Semantic search technology
Who would we contact to have such a conference? Are there companies and organizations that can help?

10 October 2008

InfoWorld Review of Flex Builder 3

From earlier this year, InfoWorld gave a glowing review to Flex Builder 3.

Adobe "Thermo" Announced

Adobe has a new tool under development to enable quick app UI prototyping, called Thermo. From the Adobe Thermo Labs site,
"Thermo" is an upcoming Adobe product that makes it easy for designers to create rich Internet application UIs. Thermo allows designers to build on familiar workflows to visually create working applications that easily flow into production and development.
Should be a great tool.

07 October 2008

Java and PNG File Uploads

I've run into an issue where a Java 1.4 servlet is having trouble with some PNG files: If the memory size of the image (not the disk size) is greater than 5MB, it gives a codecLib error when trying to read it during an upload. The IrfanView image utility came in handy for this (Image > Information). Haven't found any info on this.

One solution: Use the FileUpload object's size property to at least ensure the disk size is below 1MB; perhaps this will prevent those images with even bigger memory sizes from hitting the server until a better solution is found.

03 October 2008

Flash Security and the crossdomain.xml File

If you run into security errors with Flash while trying to fetch data, a handy little tool is the crossdomain.xml file on your server. This article talks about that.

How to Validate an Entire Flex Form

Flex doesn't have a way of validating an entire form; rather, it validates individual fields. To handle the form validation, Wheeler Street Design has come up with a cool and easy technique to do this. The source of the ValidateForm custom object is available by right-clicking the example Flex app.

Solution to Flex itemRenderer Recycling

Thanks to a friend, the solution to the itemRenderer recycling issue has been found. In the event handler for the button click, set a custom property on the datagrid's selectedItem,

dgMyGrid.selectedItem.UploadFileName = "myFile.jpg";

The custom property in this case is the UploadFileName. Also note that the data object, which would contain the row's values, is out of scope here. Perhaps this is because we're calling the function from inside the itemRenderer. So instead, we use the datagrid. However, the data object has that custom field set anyway so it can be accessed from the itemRenderer.

Then in the itemRenderer, we override the set data function,

override public function set data(value:Object):void {
super.data = value;

if (data.UploadFileName == undefined){
txtPhoto.text = "";
}
else {
if(data.UploadFileName == null || data.UploadFileName == ""){
txtPhoto.text = "";
}
else {
txtPhoto.text = data.UploadFileName;
}
}
}

02 October 2008

How to Display HTML in Blogger Posts

If you've ever tried posting HTML/XML to a blog, you'll notice that in most cases, it won't display. Here's a simple way to show HTML in Blogger posts. Convert the <> to their ASCII codes (&lt; and &gt;).

Curly Braces in Flex Control Properties

Curly braces can make a huge difference in your Flex components' properties. Found out the hard way. I had the following in a custom validator, and wondered why it kept getting passed as a string and not being processed as a function,

<myutil:FileExtensionValidator id="fileNameValidator"
errorMessage="You can only upload JPG, JPEG, GIF, and PNG files."
validExtensions="{new Array('.jpg','.jpeg','.gif','.png')}"
source="{fileName}" property="text" required="true" />

Note the curly braces in validExtensions; without it, no array was being created. Rather, the value was passed as a string. Ted's post helped with figuring out property binding. Duh!