I have a report that is generated by ColdFusion that assists our department with account maintenance on our AD network. It looks for a certain set of accounts, then looks up the account of the employee who “requested” or “authorized” the creation of each account to ultimately get verification from that employee that this network account is still needed. If you don’t respond and indicate you still need the support account, it is tagged for removal when we do our system account cleaning.
The system ran perfectly in the past several years, but yesterday it started dying on one of the LDAP calls with the error: “java.lang.OutOfMemoryError: unable to create new native thread”.
The kicker is that the error only occurs on the production server, even though my development box is hitting the same server and running the exact same JVM and is on the same version of ColdFusion 8. And it isn’t failing on the first LDAP call.
Running short on time, I finally discovered a clunky solution: I would call <cfthread action=”sleep” duration=”750″ /> to give the system a “break” before it made the LDAP call that would always fail. Oddly, this worked. Setting it to 100ms still caused it to crash (although it took longer), so I just went long at 750ms.
My only explanation as to why this works is that Java and/or ColdFusion may not be disposing of the LDAP calls quickly enough to avoid having them pile up and eventually cause an overflow and run out of memory.
I am open to someone describing a more appropriate way to handle this. But in the meantime, this is just a scheduled task that can stand to run a little more slowly. I just hate solutions that feel clunky like this, though.
I was improving the CSS of an old intranet web app (written in early 2001) to be closer to standards-compliance (getting it to just look good in Firefox and Safari would be good enough for me). While I was working on that, I noticed a whole bunch of my CSS that was being completely ignored. As it turns out, all of the code in a separate CSS file that was being imported with @import was not being rendered.
FireBug showed me that the CSS wasn’t being applied to the elements that it should have been applied to. Hmm. Then I used the “Net” tab of FireBug to see that Firefox wasn’t even attempting to load the external CSS file.
The solution is simple. My @import directive was surrounded by other CSS instructions. Whereas IE tolerates this, the actual W3C spec declares that @import directives should appear before any other CSS instructions, and Firefox honors this restriction.
Thus, my @import directive was being ignored. I moved it to the top of the file and everything started working.
The lessons? Don’t abuse @import directives. Ideally, they should be used only to have a single CSS file that imports several smaller functional CSS files as a means to provide some organization to the CSS. I was using @import mixed in with my other CSS instructions, which is not ideal.
It wasn't readilly apparent to me how to loop through some datagrid rows in Flex. Finally, I came across Abdul Qabiz's DataGridDataExporter class, which basically does just that.
The key is to set up a cursor that will loop through the Data Provider for the datagrid.
Something like this:
ACTIONSCRIPT:
-
var dp:Object=MyDG.dataProvider;
-
var cursor:IViewCursor=dp.createCursor();
-
while( !cursor.afterLast )
-
{
-
// Access each column field like: cursor.current.MyFieldName
-
trace(cursor.current.MyFieldName);
-
// Obviously don't forget to move to next row:
-
cursor.moveNext();
-
}
That's all there is to it.
This is old news now, but it's worth noting that AppleInsider released a 3-part series of articles about Flash. Check them out here:
Whether you love Flash, hate Flash, love Adobe, hate Adobe, or are neutral with the whole thing, this series is disturbingly prejudicial and biased. Comments on the posts even say as much. This is certainly disappointing, because I like AppleInsider, Apple, Adobe, and Flash. But these articles have a predisposition that results in negative interjected commentary in what would otherwise have been an interesting consideration of the history of Flash.