Get outta my namespace

June 27, 2007

In FlexBuilder, the default project output folder is “bin”.  And, so it follows that often the default deployment folder is called “bin”.  And there’s this little checkbox in FlexBuilder which says “Copy all non-embedded items to bin folder” or something like that.  Which means, copy the folders, the graphics, anything within arms reach which was not included in the build.  And so it follows that the default deployment contains a lot of unnecessary stuff, and it all goes into the bin folder.

I suppose I don’t have to say how this irritates me.  But I will say it.  This irritates me.  Why?  Because default behavior is often what gets deployed.  How many pale blue halo themed Flex apps do you have to see to know that?  Do you remember VisualBasic, and the default Form layout?  Many other examples come to mind, as I try fervently to shut them out of that very same mind.  Default behavior can be aesthetically displeasing visually.  But that’s preferable to having a maintenance disaster in the making.

No need to wait for that, though.  Trouble can sometimes arrive on the express train.  ASP dot Net (Microsoft) also has designs for the “bin” folder.  On IIS, the bin folder is hidden by default, if ASP.Net (version?) is installed.  And it is hidden in an atypical way, so get ready for hours of fun trying to figure out what went wrong if deploying bin on this kind of infrastructure.  The die hard bit twitcher will find:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET]
“StopBinFiltering”=dword:00000001

And announce that the problem has been “fixed”. Well, that’s just great. Hurry up and have the congratulations party quickly, because there isn’t much time before the next problem hits.

Why did Microsoft hide that folder, anyway? Because of a security issue. ASP dot Net uses the “bin” folder for compiled executables and other DLL’s.

The simplest solution is to not use the default behavior for Flex builder. The resulting swf’s should go in some other deployment folder, which may even be served up programmatically, and not be in the web document structure.

Advertisements

MVC Framework for AS3

June 27, 2007

The Cairngorm framework has proven exception in providing a simple, lightweight methodology for Flex development, but its strength rested on application to database communications. Intense visual development was left without much support, or overuse of the Singleton ModelLocator, creation of ViewManagers and other constucts. PureMVC Diagram

I have been reading up on this framework, Pure MVC, which looks like it offers a complementary approach to Cairngorm for Flex/AS3 development. It’s possible elements of this could be adapted for use in Cairngorm framework implementations, and vice versa, but I’ll need to try it on its own first, and see. It’s definitely worth a look: http://www.puremvc.org


The next killer IDE?

June 26, 2007

Well, I did not think that they would be this agressive about putting their foot in the ring with the Java IDE’s.  But, following up their RIA initiative Silverlight, is the IDE tour de force that would have made Microsoft Bob proud:
Visual Studio 2008 Shell

http://msdn2.microsoft.com/en-us/vstudio/bb510103.aspx


ColdFusion 7.02 profiling with Netbeans 5.5

June 26, 2007

I am in the position of needing to check out what is going on in the memory of the JVM instance running a particular process. I need to see if it’s being release properly (no memory leaks), and get an idea of when the process will top out (how many requests). So, I tried out FusionReactor, and that gave me a decent picture of things (http://www.fusion-reactor.com). And I decided to give JFluid a whirl. There are lots of good blogs, and pages by Sun on this, so have a look around, if you are planning to set this up. Here are a couple of links that were helpful to me:

I had some difficulty before getting JFluid to run (links later) and didn’t have a pressing need. But now I really wanted to have a good look. And when I did look, I found that JFluid had been "promoted" – the once experimental package had been packaged for NetBeans, the old pages for JFluid forwarding to the new pages. The package is now officially known as NetBeans Profiler (http://profiler.netbeans.org/index.html) It supports JVM 1.42, which is what we are running CF 7.02 on, so it will work well. It also supports JVM 1.41, 1.5, but each flavor with a different manner of support. In addition to the JVM version support having nuanced differences, the Netbeans platforms each have their own specific packages (Netbeans 4.1, 5.0, 5.5, 5.51 ). I run Netbeans 5.5 right now, so that’s what I got, in three downloads, the three parts to the package. One part is a modified jvm.dll for JVM 1.42 (Windoze) or .so for Unix platforms, amidst caveats that Sun does not support the 1.42 build, that it is presented "as is." Another part is the profileattach.dll’s (or .so) for attaching the profiler to the jvm. And lastly there is the runtime. Read Sun’s page carefully, as it’s easy to miss something. I did not get dynamic attachment working, but rather, Direct Attachment, which is actually better for what I am doing. I have to launch the Coldfusion server from the command line, but I see the system out messages. Netbeans has "wizard" for setting up the profiling, which presents these options. At the end I had these instructions:

Step 1. Add the profiler native libraries to the Path, e.g. using   

SET Path=C:Program Filesnetbeans-5.5profiler1libdeployedjdk142windows;%Path%   

Step 2. Setup the server to run on modified Profiler 1.4.2 JDK, which can be found in   

C:Documents and Settingshoward.netbeans5.5modulesprofiler-ea-vm   

This typically means changing system/environment variable JAVA_HOME as follows:   

SET JAVA_HOME=C:Documents and Settingshoward.netbeans5.5modulesprofiler-ea-vm   

Step 3. When starting the server, provide extra startup option to the java command:   

-Xrunprofilerinterface:"’"C:Program Filesnetbeans-5.5profiler1lib’"",5140   

Step 4. The JVM will start, but will not proceed with server execution until you connect the profiler to it.

Note: I had to remove the -XX:UseParallelGC setting before it would run. Once these changes have been made, I can launch the CF Server with "jrun -start cfusion" and it will pause, waiting for the profiler to attach. In netbeans, I attach the profiler, and I start seeing info. Netbeans Profiler Screenshot Sure looks pretty, but it doesn’t do much for me unless I can interpret the data, and explain what it means. So, the first step is getting some baseline measures on processing and proceed from there. (continued) Netbeans Profiler Screenshot


Under the hood, it’s all ones and zeros

June 21, 2007

  It’s an old as the hills format, really. The Portable Document Format. PDF. For the basic things, there isn’t all that much to it. We have come to respect using the right tools for the right job, and this is a good thing. However, every once in a while, you need to reach down from the tractor drivers seat, and reach into the dirt and pull out a root. Farmers, they got dirt. Me, I get ones and zeros. Sure it’s messy, but in fact, *someone has to do it*. These specifications don’t appear on their own. Following is an excerpt from the Ver 1.4 reference of the Adobe Specification. It is "Hello World" written in the Adobe "Language" PDF. If you want to go deeper, here’s the link: http://www.adobe.com/devnet/pdf/pdf_reference.html

  • Example G.2 is the classic “Hello World” example built from the preceding example. It shows a single line of text consisting of the string Hello World, illustrating the use of fonts and several text-related PDF operators. The string is displayed in 24-point Helvetica; because Helvetica is one of the standard 14 fonts, no font descriptor is needed.
  • Table G.2 lists the objects present in this example.
  • TABLE G.2 Objects in simple text string example OBJECT NUMBER OBJECT
  • TYPE 1 Catalog (document catalog) 2 Outlines (outline dictionary) 3 Pages (page tree node) 4 Page (page object) 5 Content stream 6 Procedure set array 7 Font (Type 1 font)
  • Example G.2
%PDF−1.41 0 obj    
>    
endobj    
2 0 obj    
>    
endobj    
761    
3 0 obj    
>    
endobj    
4 0 obj    
>    
>>    
>>    
endobj    
5 0 obj    
>    
stream    
BT    
/F1 24 Tf    
100 100 Td    
(Hello World) Tj    
ET    
endstream    
endobj    
6 0 obj    
[/PDF /Text]    
endobj    
7 0 obj    
>    
endobj    
762    
xref    
0 8    
0000000000 65535 f    
0000000009 00000 n    
0000000074 00000 n    
0000000120 00000 n    
0000000179 00000 n    
0000000364 00000 n    
0000000466 00000 n    
0000000496 00000 n    
trailer    
>    
startxref    
625    
%%EOF


Flex 3 is in beta

June 20, 2007

I see that I never posted the conclusion of the coming soon post, after Ted’s whacky teasers before he got shifted over to evangelizing for Max.

 No, the thing that had my eyes pop out was the tiny article at the bottom.  The exact specification I’ve been waiting for:

Adobe ActionScript Virtual Machine 2 (AVM2) Overview (PDF, 400K)

The AVM2 Overview describes the instructions, associated data structures, and file format supported by the AVM2.

The doors swing open to a myriad of possibilities, and no, not just another version of Open Laszlo, or Generator.  Think semantic web.


Matrices in Java and Flash (Flex)

June 20, 2007

Ran into an interesting detail concerning differences between Flex and Java, having to do with their matrix representations.  If you are unfamiliar with Matrices, as I am, you can review Matrices and Transformations in Flash at http://www.senocular.com/flash/tutorials/transformmatrix/.  The detail is this:  Java and Flash have their second and third at the opposite to each other.  So, for example, in this matrix:

Matrix Picture

In Flash, you would say:

matrix = new Matrix(a, b, c, d, tx, ty);

and in Java, it look like:

matrix = new Matrix(a, c, b, d, tx, ty);

(Well, their matrix is spelled a little differently.  See the javadoc page at : http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/AffineTransform.html

[  m00  m01  m02  ] 

[  m10  m11  m12  ]

 This was one thorny detail on top of the rest of the great fun of the iText library.  The other interesting piece is that the y coordinates are reversed.  The PDF was designed for print media, so the y starts at the bottom of the page, with increasing values as it goes up.  In Flash, it is the opposite.  The y origin is at the top of the screen, increasing in value as you go downward.  This is all in general, and default.  It is possible to apply a transformation to the PDF to reverse the Y values, and likewise with the Flash.

With the PDF, you can apply the following transofmation:

matrix(1.o, 0.0, 0.0, -1.0, 0.0,  h*)

using concatCTM most likely.  The d value reverses the direction of the y axis, and the h* is a special value which is on the overall height of the page.   Because once you reverse the y value, it is still originated at the bottom left.  But when it increases it goes off the page into oblivion.  The h* value moves the origin to the upper left hand corner of the page.