[SOLVED] Generate a Stack Trace in an Flex/AIR Release Build

This has been a source of frustration for such a long time, I had to share the solution. Credit for this one goes to Martin McBrearty, and there are a few other blogs out there that support this method.

Important Disclaimer: This method does not appear to be officially supported, and is not guaranteed by me or anyone else to work. Use at your own risk!

[More]

App of the Week: Aldiko Brings Free E-Books to Android

First things first: Aldiko is not the only app to offer free e-books to Android users. Amazon's Kindle app has been available for a while now, offering access to a wide range of free and paid literature. Overdrive serves up content through a partnership with many public libraries, allowing patrons to virtually borrow books. There are also a number of other e-book readers easily found by searching the Android Market. But many are restricted by proprietary delivery systems and digitally copyrighted content. Aldiko is a different breed.

[More]

App of the Week: TeamViewer Lets You Control Your PC From Anywhere

Have you ever left the house in a hurry, only to realize you need an important document from your desktop PC? If only there was an elf standing by, able to email it to you... TeamViewer is that elf.

[More]

[Fixed] ListBase TypeError #1010

Today I spent hours tracking down a bug related to inserting and/or deleting data from a Tree control. In certain circumstances, an update to the underlying dataProvider would cause the following to be reported:

TypeError: Error #1010: A term is undefined and has no properties.
at mx.controls.listClasses::ListBase/makeRowsAndColumnsWithExtraRows()

After a bit of Googling, I found that I am not alone. Other folks have the same issue with Tree. Even more common, it looks like people are getting the same error when manipulating data in an AdvancedDataGrid, in which case it is reported as:

TypeError: Error #1010: A term is undefined and has no properties. at mx.controls.listClasses::AdvancedListBase/makeRowsAndColumnsWithExtraRows()

After drilling down into the Flex Framework source and exploring the makeRowsAndColumnsWithExtraRows function, I added some watch expressions in the Flash Builder Debug pane. (The debug features are really, really useful for this kind of thing.) The culprit? The value for verticalScrollPosition was being reported as -1, causing a line of code to look for an array element at index -1. This array element was in turn undefined, so the error message suddenly makes perfect sense.

The real puzzler here is that verticalScrollPosition could ever be less than zero. This is the logical equivalent of scrolling to the top of the list, then scrolling up one more spot, which is of course impossible. In any case, I have decided to assume that -1 is invalid at all times, and that -1 really means 0. I hope that is a safe assumption!

So, the solution is simple. In my case I had already subclassed the Tree control. If you're using the stock control from the framework, you'll need to subclass it and simply add the following:

override public function get verticalScrollPosition():Number
{
return Math.max(0, super.verticalScrollPosition);
}

All it does is intercept any request for verticalScrollPosition and guarantee that it is greater than or equal to zero. In brief testing, the error has disappeared and I have seen no side effects.

Like anything else on this blog, use this fix at your own risk, since I can't guarantee it won't have any negative impact.

Happy coding!

Modularizing a Cairngorm Project - A Debriefing

I recently took on the task of a major refactor of an AIR project. The application had grown into a monolithic beast with lots of conceptually related but logically disparate functionality. Management of the code was becoming a challenge. Packages were poorly structured. It was a mess.

The real catalyst for change, though, was the compile time. It had gradually crept up from a few seconds to 30+ seconds. In an effort to return to acceptable levels, I broke out chunks of UI into modules within the main project. I pulled graphics and sounds assets into a separate library SWC. But there was no appreciable effect.

The plan of attack was to break out at least two sections of the application, which are essentially mini-applications on their own. They share only a few common aspects of the main application, such as a common model and server connection manager, and are otherwise self-sufficient. Luckily, the project is built on Cairngorm principles, meaning that these items are already more or less detached from the view components.

What follows is a set of principles for successfully breaking down a large Flex application into separate, manageable module-based projects. These techniques seemed to have worked for me, although of course it is still a work in progress and there is much optimizing left to do. Really, this post is probably more for me as a future reference than anything else, but if it can help someone else, that would be terrific. Your mileage may vary, and if it does, leave me a comment to let me know what you've done differently!

[More]

[Fixed] Flash Builder CSS Warning

If you're looking for a solution to the Flex 4.0 compiler warning "The style 'dropShadowVisible' is only supported by type 'mx.controls.List' with the theme(s) 'spark'.", here it is (see the comment from Carlos Bonilla): http://bugs.adobe.com/jira/browse/SDK-25720

The fix is a one-liner, and just requires going into the SDK and commenting out a line in a CSS file.

I ran into this issue months ago with a Flex 4.0 project and applied a workaround, which basically consisted of ignoring all CSS-related warnings in the Flash Builder compiler. This didn't feel quite right, but I didn't have time to keep screwing with it.

Fast-forward to last week, and a separate project, and here it was again. I like to have a clean "Problems" view when I'm working in a project, so I found this menacing. I needed a proper fix once and for all.

The solution is posted in the Adobe Forums for the world to see, but it took me a while to find it. The only reason for this post is the hope I can spare some poor soul out there the frustration of tracking it down.

Happy Coding!

Ripoff Report: HDMI Cables

As I wandered around an electronics store the other day on my lunch break, I was reminded of a disturbing price-gouging scam that seems to be so widely accepted that it has become status quo. I'm talking about cables; specifically, digital A/V cables like HDMI, DVI, optical TOSLINK, etc.

Big-box stores are expoliting confusion about the differences between analog and digital signals, and the effect that small changes in the signal quality might have on the picture you see on your TV or the sound from your audio receiver. See, in the dark ages (up until a few years ago), A/V signals were commonly transmitted in an analog format, which turns out to be remarkably inefficient in comparison to digital. Another downfall of analog signals, more pertinent to this discussion, is that they are susceptible to a number of adverse distorting effects caused by loss of signal strength.

You've seen the effects that moderate to severe interference or attenuation can have on an analog TV signal - snowy, ghost-like or rolling images, rendering your favorite shows unwatchable. You've also seen the effects of minor signal interference, which can typically be ignored but are annoying nonetheless. Cable manufacturers have a rich history of fighting against common causes for analog signal weakening. Many household devices produce some level of electromagnetic interference, so manufacturers introduced magnetic shielding. These higher-end cables made a real, perceivable difference in picture clarity.

The time of battling the shortcomings of analog signals has passed. Today, digital video and audio devices are the standard, Digital signals are based on a simple protocol that consists of 1s and 0s. There is very little room in a digital signal for errors. Either the picture appears on your TV, or it doesn't.

Expensive brands like Monster Cable want you to believe there is a difference in the signal carried by their product. This just isn't true. So please, if you're looking for an HDMI cable to hook up your new 52-inch plasma, don't spend more than $10.

I use monoprice.com (unsolicited plug!) They carry quality products and their prices are second to none. Try them or another online retailer, and save 80% of your hard-earned money.

I Am So Idiot

Today I found myself chasing my tail for a bit. This function threw an exception at runtime, which indicates that the argument passed in does not match the designated cfargument type. I spent a half hour finding different ways to verify that both inputs, Group_ID and Max_Allowed, were indeed of type Numeric.

[More]

Hair-Trigger

I spent most of my morning chasing a sneaky little bug. Basically, once upon a time one of our tables contained a column (to protect the innocent, let's say it was called Meaningless_Data). Several months ago, my team removed the column from the DB schema as well as all references to it in the code.

I grabbed the changes and continued on my merry way... until today, which apparently is the first time I've tried to use a function that touches that particular table. I kept getting an error:

Type: Database
Message: Error Executing Database Query.
Detail: Invalid column name 'Meaningless_Data'.

So it's looking for the column and not finding it. Not surprising, since we deliberately deleted it a long time ago. I triple-checked the code, but couldn't find a single reference to Meaningless_Data in any SQL statement (or anywhere else in the codebase, for that matter).

I drove myself batty for way too long before copying the query straight from CFCATCH.SQL and manually running it against my local DB. Same error. Okay, it's not a Coldfusion issue...

Then I ran it against the DB on our development server. Worked like a charm. Getting warmer...

I generated SQL scripts for the table on each machine and diffed them, and the culprit was revealed. A trigger was pointing to the missing column, and was firing every time I touched the table. The other developer had updated the triggers on his local DB and the dev server, but when I grabbed the schema and code updates, I didn't think to look there.

File under lessons learned.

Shady McShadingtons, Exhibit A: Experts-Exchange.com

As a web developer, I often find myself in need of professional help. (Don't we all?) Sometimes all that stands between me and a completed project is a quick Coldfusion, SQL, or Actionscript example. At times like these, I turn to Google.

Much of the time I can find what I need in the first few search results. A code example here, a syntax clarification there. One site that used to bug me, however, was Experts-Exchange.com.

[More]

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner