Tuesday, December 15, 2009

Flex, AR and speed improvement

I am working on an AR project for a client when I ran into major performance issues.  It drove me batty because I tested out a bunch of stuff and couldn't get the performance up.  For starters, I am using a dae file (standard stuff), then I load it in using collada, and that's where the crap started bottoming out.  I tried multiple ways to fix it, testing whether it was my app, the dae, the AR, or what!  I even connected w/ ARToolworks and Eric Socolofsky.  They made some suggestions, like using Windows to take advantage of FP10.1.5's newest drivers which are great on the graphics card (but don't help me because I'm on a Mac).  Instead, after countless hours and angry griping, I happened upon a small discovery, the rendering engine in Papervision.  This little sucker is rendering my dae and making my 3D model work.  Well, it was using Quadrant, which was eating up about every resource to make my model look nice and smooth.  Once I switched that to Lazy, I got a huge performance boost (going from 1-2 fps up to 10-11 fps).

Thursday, December 10, 2009

Who works in a corporate environment and is allowed to use FB4 yet?

FB4 - oh how I pine for you!

Actually, I wanted to create my latest project in FB4, utilizing the pleasures of the vector class in FP10, but alas, my compatriots managed to convince me that the upgrade isn't necessary yet. 

Is there anyone out there who's corporate policy is banning them from using the beta product to develop apps?  If they do, how do you get to play (aside from on your own time?)

Tuesday, December 1, 2009

Dreamweaver and CS4 killing performance

Is Dreamweaver running slow for anyone else who does Flex development.  I'm not on a great machine, but I'm running a MacBook 13" w/ a 2.16 GHz Core 2 Duo, and 2 GB of Ram, but I do love my MacBook, and get quite frustrated by the fact that when I open up most of my CS4 products, my computer can come to a grinding halt.  Actually, it's mostly just Dreamweaver, which I'm using for reading, writing and editing C#.  I've thought about running my XP partition, then running visual studio for the coding, but that'd take up just about as much resources as me running Dreamweaver.  What I don't understand (and maybe it comes from being spoiled by a wonderful Eclipse community), but why is Dreamweaver so unwieldily and ugly and hard to use?  I'm happy that I can edit multiple languages with it, but frankly, I would've been happier if netBeans or even Eclipse let me work on it.  It's annoying!  But regardless, I'm trying to figure out what is killing my cpu?  I do know and have configured my Eclipse for larger memory management (I believe I set the min at 84, and the max at 1024), but I'm almost never using all of that.  Aside from a few smaller apps (read: iTunes, Adium, Thunderbird), I'm at a loss for such inefficiency. 

Friday, November 27, 2009

Recruiters and Pricing one's services

Recruiters - I enjoy when you call to discuss things, but seriously, please don't contact me when it's about something I haven't done in 5-10 years. And don't get offended when I have fun at your expense for responding w/ ridiculous information, like absurd rates…Honestly, I don't want your gig, that's why I stopped doing it what I did. And don't get mad because you're spamming me that I shouldn't just respond w/ a bit of wit. If you actually take it seriously, then the problem is you.

However if you want to pay me that much, then I might reconsider :)

And why not pay me that much? Most companies are willing to pay other companies that much for consulting on something (for example, look what any of the big consulting or management consulting or accounting firms charge). I should be paid that much to consult as well, right? Wrong? While it would be nice to charge that much, and companies always feel they get more bang for their buck at the higher price (I mean, who wouldn't want bragging rights about spending top dollar to get the best - it happens all the time regarding MBAs and other degrees, and just because you have more people with accolades doesn't mean you'll get a better resolve). For example, look at the financial companies in dire straits (only as an example). They claim they have 10 (or 20 or 100) of the brightest minds working to solve the problems. Yet it's like saying I have 10 (or 20 or 100) copies of the "special report". No copy is better than the other, yet there is a belief, a horrible misconception, that if you gather enough bright minds of the same ilk, you'll get superior results. And for that, you get to charge bucko bucks.

Yet nobody stops to ask, "What difference is all this making for me?" Large companies, time and time again, say they want to cut costs, improve efficiencies, and grow the bottom line. Yet they normally farm out work to contractors and consultants, almost all of whom (except the rare exceptions of really brilliant people - not just smart, but those that actually can figure things out for themselves) use Google, Bing, YouTube, Twitter, and whatever other technological device to help themselves learn from what everyone else has done and use their examples.

People can learn quickly, and those that are the most profitable should make good money. But companies that charge buckets for their services, when they aren't necessarily the best game in town (most often they rely on normal people because nobody is a superhero - unless you are Jonny Lee - then I'll make an exception). But even so, most people aren't that brilliant, and companies don't have a lot of brilliant people in them, so why should they get to charge so much and I can't? Brand recognition? Paint? Logo? What?

So back to my original rant, if someone's willing to pay it, shouldn't I oblige them?

Sunday, November 15, 2009

Flex Builder Recursion Variable?

Wouldn't it be nice if Flex allowed us to have some kind of global that would let us know (especially when building, testing, and debugging) what level we're at when working w/ a recursive loop?  I created some XML a bit back that involves recursion, and the trick to it was knowing how I built it, but what about times when you have something that Flex makes - such as the simpleXMLEncoder - which is simple, but only works on basic Flex objects and provides really lame tags…In the simpleXMLEncoder/Decoder, their own code runs recursion, and it would be nice to have a way of tracking what level in which we are working.

My own projects have used recursive Data Transfer Objects to drill through and build up external complex data sets.  However, when debugging and working through it, I can't easily nail down what level I'm at and how to go backwards.  Sometimes the debug window can hold up to a few locations where I can click and view my location and progress, but it would be much simpler to have some kind of level tracking, especially in recursion.

This flexplitive rant is brought to you by a recursive loop that is brought to you by a recursive loop that is brought to you by a recursive loop that is…well you get the idea :)

Friday, November 13, 2009

Not Flex directly, but html, Outlook 2007, and the evil colSpan

During a current project, one of the requirements is being able to send an email from a Flex application to one or more recipients.  To accomplish this, through an amalgam of remote services, flex, and an email server, we are able to send out the emails.  The Flex side is quite easy, and using fluorine, we were able to quickly generate the c# code for the backend.  However the problem lies in QA'ing these emails for recipients and ultimately from the various email clients available.  While it would be nice to send a .swf in an email (like an html email) and allow it to play as soon as one opens the email, I can imagine how that could negatively impact a lot of users - think of a user who unwittingly opens an email that has a swf (which now wants to import and open up inside of your email client all of its components).  This could bog down the email client considerably, but more important, isn't email meant to be for simple text and images?  Leave the swf to the browser, right?  Well, I think it would be awesome if thunderbird allowed you to read .swf's in your email, and run flash right there…regardless, I digress.

What I'd like to get at is the complexity we've had in testing an html email template that all clients would read (i.e. gMail, Outlook 07 and 03, thunderbird, aol, yahoo, etc.)  There are tons of clients, but most business savvy users are on the Outlook clients.  So how do I, running on a mac, without access (nor desire) to Outlook, test this?  Well, our handy QA team is doing that for me, and they've noticed some really annoying *flexplitive here* things w/ Outlook.  Namely, the absence of support for colSpan inside a table.  C'mon mang, colspans are the bread and butter of making a table work right, otherwise I'm stuck putting a bunch of 's inside of the 's which just makes my life really, really complicated.  the easy trick we figured out is that to avoid col spans, you can put multiple 's next to eachother, then put those in a row, and finally, to avoid the colspan, just move the items that you wanted to span, move them into a table above or below the table that has the row w/ the multiple columns.  This essentially makes your table have multiple columns, but only one row, or multiple rows.  This is extremely annoying, yet useful, if you have multiple columns, want someone to see your email in html, and send it to anyone using outlook 07. 

Anyways, that's just my annoyance, so this flexplitive rant really isn't much about Flex and more about html and how much Outlook 07 really stinks...


During this project I’ve learned that it is important to try and limit the number of calls back to the server.  I understand it is important to make sure any progress is saved, but it is even more important that the system not constantly rely on asynchronous calls to make future progress. While small calls might not bring down the system, it is important, in my experience, that the fewer calls made to the back-end, the better.

This rant is brought to you by the remoting services of Flex, Fluorine, and WebOrb.  All three have their benefits, which are documented on their respective sites.  However there doesn’t seem to be a list of best practices for using them.  It is true that a RIA should be Rich, connect to the Internet, and be an Application.  But that connection to the Internet shouldn’t happen every turn of the page or every mouse click. In my experience, you can achieve a better user experience if a whole bunch of miniscule calls can be tracked by the app, then uploaded when truly required.  Interaction with the backend is important, don’t get me wrong, Flex can only do so much. Yet the code shouldn’t beat a dead horse, like this blog post, with too many of the same calls.

Thursday, November 12, 2009


Has anyone ever read a Harvard Business Review?  Or what about a case study?  Or anything business related that talks about efficiencies, sales relationships, processes, etc?  I’ve read several of them over the last decade, and one of the most important lessons I’ve learned from them is the balance a company must strike between internal and external resources. I’ve learned (oft the hard way) that sales people are happy to go and sell anything and everything to everyone and anyone.  However it must be understood that without their efforts, a company probably wouldn’t survive (so what if Beta was better than VHS, their sales team sucked).  So in that vein, I also must say that resources that support sales, or develop products that the sales team is responsible for selling, must also be understood.  Regardless of product, there is a symbiotic relationship between the two sides, and the most successful organizations are the ones that realize that.  The companies that insist on superstar R&D folk, or only go after rockstar sales people often learn the hard way that success isn’t from them.  It is from being able to continuously improve a product that customers like, while at the same time increasing the breadth and depth of understanding that the people who interact with the product have.  If it means that the Sales department take some time to learn more about the product, then they should.  If the other departments want to learn more about the sales process, or management, or what not, then they should, in order to understand why success is defined through teamwork and understanding. 

This long rant is brought to you by too angry Sales and R&D  staffers.

Tuesday, November 10, 2009

Flex Embedded Fonts, Images, and Compile Times

A couple of recent projects that I've worked on have had the requirement to add special fonts, and generally this means adding them via CSS, and every time I clean or build my project for testing, the compile speed becomes horrendous (read - compile times went from just a few seconds up to a minute in some cases).  This was horrible, especially if all I did was change something simple in the app, like spacing between labels.  Other problems included running out of memory in my eclipse environment and CPU consumption.  For my own efficiencies, that was just too annoying and aggrevating to deal with.

I dug around the internet and found a few resources that made some suggestions.  Two I found here.   They include changing the heap size of Eclipse and turning off auto-spell checking.  While this didn't alleviate everything, it at least has kept my MacBook from freezing up and my workbench from vomiting everywhere.

The next option I found comes from axelscript.  His suggestion to improve compile time by getting the font (and possibly images - although he admittedly didn't have time/nor need to test) into a separate project, then compiling it into a swf that would build into the current project's folder.  This helps compile times, but it does require a few extra steps and maybe a good look at Flex's StyleManager.

One more option I found very convenient (especially if you pre-initialise a few fonts or want to lazy-load some fonts) comes from this Russian site.  It provides an excellent loader that allows you to load fonts dynamically (although again, nothing about embedding images) from anywhere, locally or remotely.  The setup is extremely easy and can be incorporated dynamically add fonts at runtime.

What I would really like to know from Adobe is why compile times turn horrendous when adding new fonts.  And why do they need to be included in every build, shouldn't there be a simple way to introduce and embed multiple fonts without bloating an app and without killing my compile times?  Nothing in Jira points to this as being a bug, just a standard feature.  Will these same problems exist in FB4, Catalyst, or FP10?

Monday, November 9, 2009

TCPProxy and Grinder

I recently was working on a project and it was necessary to see what I was sending across the wire. Without having done much in the past w/ reading my data while in transit (go figure, I normally only worry about the end results), I needed to know if Flex or my backend was regurgitating my data because the transmission was garbled or what. To watch what was happening, I started using Grinder. Grinder's a really easy to use tool: you just download the zip, unzip it, then from a command line, simply type:

java -cp Downloads/grinder-3.2/lib/grinder.jar net.grinder.TCPProxy -console

My java from the command line is horrendous, but from what I understand, the first part tells the command line it's a java file to look for, the second part says what it is about to search for, the third part says where, the fourth part says what operation should be invoked, and -console says when you run the engine, pop-up the console (for mac users like me, this last part was crucial because shy of shutting down the terminal, I have no other way of telling the Grinder engine to stop grinding.

It was also important that I set my browser's proxy configuration to run through 8001, so I made my changes to the settings and now, every page loaded horrendously slow, but grinder was spitting out all the data I needed.  (I tried to upload the image, but couldn't get it out...sorry).

Now I had access to everything I was posting across the wire and what it looked like.  Grinder has many other important features than just watching your internet traffic.  It can help you record user actions to make test scripts for testing network traffic.  It comes w/ an awesome library of test scripts (and if you look hard enough can find some really funny comments)

Anyways, before I completely sign off on Grinder as being the only tool to use, I'll mention briefly another tool (you have to pay for) that is quite nice.  It's called Charles, and I must say it does a pretty good job of telling me what resources are being called too often, and does a pretty good job of interpreting AMF.  It isn't perfect, doesn't have all the flexibility of Grinder, but again, I didn't pay for it, I just tested it out.