<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>neatFilm.com</title>
	<atom:link href="http://www.neatfilm.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.neatfilm.com</link>
	<description></description>
	<lastBuildDate>Tue, 10 Feb 2009 08:35:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flex Interface Design with Scale9Grid Bitmap Class, another approach</title>
		<link>http://www.neatfilm.com/2009/02/10/flex-interface-design-with-scale9grid-bitmap-class-another-approach/</link>
		<comments>http://www.neatfilm.com/2009/02/10/flex-interface-design-with-scale9grid-bitmap-class-another-approach/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 07:07:43 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=381</guid>
		<description><![CDATA[Recently I changed my job to part time, so got some spare time in my own project and some researches on Flex developments. I&#8217;m happy with that as I found more and more solutions in these days when I&#8217;m not pressed by full-time tasks as a major/lead developer and the only senior/firefighter for a team.

What [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I changed my job to part time, so got some spare time in my own project and some researches on Flex developments. I&#8217;m happy with that as I found more and more solutions in these days when I&#8217;m not pressed by full-time tasks as a major/lead developer and the only senior/firefighter for a team.</p>

<p>What I get most excited is getting some more ideas on interface design methods for Flex/AIR applications. I&#8217;m not a designer, most of my time focus on Flex/Flash coding and I constantly feel bad especially interface design in Flex. Not only Flex itself has no good work flow yet designers can easy to work, also it very hard for team/companies to find a really good designer for Flex projects.</p>

<p>Ok, I&#8217;m talking here is another optional approach in interface design for Flex. See follow I did in my own Flex/Air project:</p>

<p><img class="aligncenter" title="Scale9Bitmap" src="http://www.neatfilm.com/post_images/09Jan/bitmap_result.png" alt="" width="224" height="142" /></p>

<p>Have you seen somewhere like this? Well, I don&#8217;t have designer on my own project, but like good designs when I write codes and testing, so I &#8216;borrowed&#8217; some graphics from CS4 for use temperorily. It looks beautiful isn&#8217;t it? I hate any bad ugly designs in development, man, it&#8217;s <strong>Flash platform</strong>. I like beauties when I&#8217;m working and that&#8217;s why I choose to work as my career.</p>

<p><span style="color: #000000;"><strong>Requirements to make it?</strong></span></p>

<p>The example above I used three images:</p>

<ul>
    <li>left highlight skin image</li>
    <li>right skin image</li>
    <li>dropdown button image</li>
</ul>

<p>Scale9Grid bitmap class, you can get from <a href="http://www.bytearray.org/?p=118">bytearray.org</a>. (I made some small modifications so its Scale9Bitmap class in this example. May write a new UIComponent-based class myself from scratch later when have time.)</p>

<p><strong>How to make it?</strong></p>

<p>The example above is the dock header, each one is a single object based on UIComponent. I show here how to make the right skin inside that component.</p>

<p>createChildren function, load bitmap with url:</p>

<p><img class="aligncenter" title="scale9 create children" src="http://www.neatfilm.com/post_images/09Jan/createChildren.png" alt="" width="517" height="280" /></p>

<p>Complete handler:</p>

<p><img class="aligncenter" title="scale9 complete" src="http://www.neatfilm.com/post_images/09Jan/complete_handler.png" alt="" width="505" height="160" /></p>

<p>updateDisplayList function:</p>

<p><img class="aligncenter" title="scale 9 update display" src="http://www.neatfilm.com/post_images/09Jan/updateDisplay.png" alt="" width="482" height="128" /></p>

<p>The component wouldn&#8217;t create bitmap until loader complete, then insert into bottom layer as its the background image. (In this example I put another skin image above so it will be inserted into layer 1 when the bottom layer has already added, that&#8217;s why I use a flag _rightSkinLoaded.)</p>

<p>The bitmap wouldn&#8217;t renderer until invalidation display list is called, which make maximum performance based on Flex framework. In updateDisplayList function, two skin images will be scaled with scale9Grid rectangles, that&#8217;s where the magic happens.</p>

<p>There&#8217;s one more thing, to get best result in my example, scale 9 bitmaps works better when positioning in pixels, I use int(xx) as followed:</p>

<p><img class="aligncenter" title="bitmap scale 9 pixel" src="http://www.neatfilm.com/post_images/09Jan/bitmap_pixel.png" alt="" width="488" height="123" /></p>

<p><strong>Discussion</strong></p>

<p>There already lots of approaches for interface design/skinning, like Flex/CS4 skinning kits, Degrafa. These approaches &#8216;work&#8217; but I myself much like use scale9grid bitmap inside component directly. Here&#8217;s what I think:</p>

<ul>
    <li>Any designer can make graphics design, can support developers easy to use this approach, in case of scale 9 grid can work perfect (I think most standard interface components?).</li>
    <li>Degrafa can be hard to &#8216;code&#8217; graphics result what designer expect, but image with scale9 rectangle easy.</li>
    <li>Less code (code lines after compiling) and better performance. If there&#8217;s tons of components in your application, you have to take care of performance. If you can, don&#8217;t use CSS skins for highly reused components.</li>
    <li>Bitmap don&#8217;t need to be embedded, which make less size of application and less compiling time if there&#8217;s many bitmaps.</li>
</ul>

<p>Of course, this is just an optional approach for Flex interface design, as scale 9 slices may not work in some designs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/02/10/flex-interface-design-with-scale9grid-bitmap-class-another-approach/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQLite as Service in AIR (Flash/Flex)</title>
		<link>http://www.neatfilm.com/2009/01/23/sqlite-as-service-in-air-flashflex/</link>
		<comments>http://www.neatfilm.com/2009/01/23/sqlite-as-service-in-air-flashflex/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 17:01:55 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash CS4]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=337</guid>
		<description><![CDATA[I introduce here is my approach (not fully complete framework), to use SQLite like an external service in AIR, in most simple way.

The following code is how it to be used in Flash/Flex application:



That simple? Sure it is.

Don&#8217;t forget, in AIR applications, using SQLite we MUST use asynchronous connections for user experiences. The framework will [...]]]></description>
			<content:encoded><![CDATA[<p>I introduce here is my approach (not fully complete framework), to use SQLite like an external service in AIR, in most simple way.</p>

<p>The following code is how it to be used in Flash/Flex application:</p>

<p><img class="aligncenter" title="SQL code" src="http://www.neatfilm.com/post_images/09Jan/sqlite_code.png" alt="" width="449" height="201" /></p>

<p>That simple? Sure it is.</p>

<p>Don&#8217;t forget, in AIR applications, using SQLite we<strong> MUST use asynchronous connections</strong> for user experiences. The framework will do rest hard jobs for you.</p>

<p>Framework Features:</p>

<ul>
    <li>SQLConnection instances reused.</li>
    <li>SQLStatement instances reused.</li>
    <li>Statements executed in queue automatically, no extra control required.</li>
    <li>Dealing with SQLite locks inside framework.</li>
    <li>Feedback(result/fault) functions can be reused, similar with pureMVC&#8217;s handleNotifications.</li>
    <li>Support to run feedback functions not original object, i.e. a view sent a query then closed, after query complete, run feedback function in another object/view.</li>
    <li>All statement/connection objects managed and resources can be cleaned.</li>
</ul>

<p><img class="aligncenter" title="Sqlite workflow" src="http://www.neatfilm.com/post_images/09Jan/workflow.png" alt="" width="441" height="235" /></p>

<p><strong>SQLite Performance Best Practices
</strong></p>

<p>It&#8217;s important to get benefit of maximum performance of database, SQLite has its own specifications. One of them, Adobe has already documented, is the cached statements, cached statements can be reused and increase performance largely.</p>

<p>The second one, I didn&#8217;t see anyone mentioned it (maybe I missed), is the lock system of SQLite.</p>

<p>SQLite has a special lock system, have a look the figure followed:</p>

<p><img class="aligncenter" title="Sqlite lock" src="http://www.neatfilm.com/post_images/09Jan/sqlite_lock.png" alt="" width="476" height="303" /></p>

<p>Here&#8217;s several important rules about SQLite lock system:</p>

<ul>
    <li>A connection can have only one transaction (working statement) at a time.</li>
    <li>SQLite can have multiple read transactions(read statement) and one single write transaction(write statement) at the same time.</li>
    <li>When the write transaction working or waiting, no more new connections can work.</li>
    <li>The waiting write transaction will be executed only after all other read transactions complete.</li>
</ul>

<p>The third one, using SQLTransactionLockType.IMMEDIATE for write transaction can improve performance when necessary.</p>

<p>My solution implement first and second, the last one I didn&#8217;t find a good solution to use it in <strong>asynchronous connection mode</strong>, will talk it later.</p>

<p><strong>Framework Structure</strong></p>

<p><img class="aligncenter" title="SQLite framework structure" src="http://www.neatfilm.com/post_images/09Jan/structure.png" alt="" width="359" height="266" /></p>

<p>The framework include three major classes:</p>

<ul>
    <li>SQLManager</li>
    <li>ConnectionPool, manage and reuse connections for statements.</li>
    <li>StatementManager, add/remove statements.</li>
</ul>

<p><img class="aligncenter" title="SQLite classes" src="http://www.neatfilm.com/post_images/09Jan/classes.png" alt="" width="371" height="226" /></p>

<p>These object classes/interface used by the framework:</p>

<ul>
    <li>SQLiteStatement, after an operation finished, it run feedback based on caller and function(string). Feedback function can be different to the original view(object).</li>
    <li>SQLiteConnection</li>
    <li>CachedStatement, statement cannot to be run immediately will be cached as a CachedStatement in waiting list.</li>
    <li>ISQLResponder, optional interface for caller view/object.</li>
</ul>

<p><strong>Framework workflow</strong></p>

<ul>
    <li>Create instance for a database file (file can not exist even)</li>
    <li>Add statements when needed, statements will be initialized.</li>
    <li>View call for execute one or several statements with statement_id, set result/fault function, and flag whether need to ignore fault (if ignore, sqlite will continue to run waiting statements)</li>
    <li>SQLManager get statement instance, or cache your request to a waiting list if already used.</li>
    <li>SQLManager ask ConnectionPool to apply a SQLiteConnection for statement to execute.</li>
    <li>Statement try to execute, if SQLConnection not connected, waiting for that connection and execute.</li>
    <li>Statement completed/fault, call feedback function with statement_id (if asked), and execute next waiting statement if exist.</li>
</ul>

<p>The framework keep minimum instances of SQLConnection and SQLStatement, and easy to be removed as they&#8217;re managed for garbage collection.</p>

<p>I&#8217;m not going to publish source code right now as it&#8217;s not a complete framework yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/01/23/sqlite-as-service-in-air-flashflex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MenuBar Skinning</title>
		<link>http://www.neatfilm.com/2009/01/19/menubar-skinning/</link>
		<comments>http://www.neatfilm.com/2009/01/19/menubar-skinning/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 07:25:40 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=325</guid>
		<description><![CDATA[The default menubar looks quite bad, I used half day to google and skin it. Ok, the result looks not too bad.




    Take out top menu item background.
    Add filter to top item label.
    Change top item rollover background.
    Set minimum width for [...]]]></description>
			<content:encoded><![CDATA[<p>The default menubar looks quite bad, I used half day to google and skin it. Ok, the result looks not too bad.</p>

<p><img class="aligncenter" title="MenuBar" src="http://www.neatfilm.com/post_images/09Jan/menubar.png" alt="" width="511" height="238" /></p>

<ul>
    <li>Take out top menu item background.</li>
    <li>Add filter to top item label.</li>
    <li>Change top item rollover background.</li>
    <li>Set minimum width for top item.</li>
    <li>Set minimum width for drop down menu.</li>
    <li>Skinning for dropdown menu in CSS.</li>
</ul>

<p>Full example source code download <a href="http://www.neatfilm.com/flash/download/MenuBarSkin.zip">here</a>.</p>

<p>File list:</p>

<ul>
    <li>MenuBarSkin.mxml, with menu style and menuBar style especially fillColors, fillAlphas.</li>
    <li>AppMenuBar.as, extend MenuBar class, getMenuAt() to set minimum width for drop-down menu, updateBackground() was to remove the background.</li>
    <li>AppMenuItem.as, extend MenuBarItem, set top item label dropshadow filter and set minimum width for top item.</li>
    <li>MenuItemSkin.as, replace default up/down/over halo skin.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/01/19/menubar-skinning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Flash CS4-style Docking in Flex</title>
		<link>http://www.neatfilm.com/2009/01/08/simple-flash-cs4-style-docking-in-flex/</link>
		<comments>http://www.neatfilm.com/2009/01/08/simple-flash-cs4-style-docking-in-flex/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 00:37:21 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[flash flex docking]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=299</guid>
		<description><![CDATA[Inspired by Degrafa, I spent couple of days to build a quick docking manager. It can add any component/containers into the list dynamically.

Full source code download here.



My working project with this docking manager:


]]></description>
			<content:encoded><![CDATA[<p>Inspired by Degrafa, I spent couple of days to build a quick docking manager. It can add any component/containers into the list dynamically.</p>

<p>Full source code download <a href="http://www.neatfilm.com/flash/download/DockExample.zip">here</a>.</p>

<p style="text-align: center;"><img class="aligncenter" title="Docking" src="http://www.neatfilm.com/post_images/09Jan/dock.png" alt="" width="290" height="443" /></p>

<p style="text-align: left;">My working project with this docking manager:</p>

<p style="text-align: center;"><img class="aligncenter" title="Docking" src="http://www.neatfilm.com/post_images/09Jan/dock2.png" alt="" width="421" height="384" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2009/01/08/simple-flash-cs4-style-docking-in-flex/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AIR Mac-only Crashes</title>
		<link>http://www.neatfilm.com/2008/12/10/air-mac-only-crashes/</link>
		<comments>http://www.neatfilm.com/2008/12/10/air-mac-only-crashes/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 05:14:55 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=290</guid>
		<description><![CDATA[The team I recently working with mainly developing AIR application on Windows Vista, our designers using Macs though. AIR can be run both on Windows and Mac, but we experienced several Mac-only crashes.

We have several Flex developers, I have to use some of my time review code for other developers even rewriting some of buggy [...]]]></description>
			<content:encoded><![CDATA[<p>The team I recently working with mainly developing AIR application on Windows Vista, our designers using Macs though. AIR can be run both on Windows and Mac, but we experienced several Mac-only crashes.</p>

<p>We have several Flex developers, I have to use some of my time review code for other developers even rewriting some of buggy code. The designer working on Flex Builder for skinning will run the application on his Mac a few days a month, until he ran Flex Builder we knew the application got crash on Mac. I had to use several hours to find and fix the problem. A month and more later he opened his FB again and the application crash again.</p>

<p><strong>Crash Reasons?</strong></p>

<p>Totally three Mac-only crashes I fixed. Now I work remotely at home and using my own Macbook so there will no more &#8217;silent&#8217; Mac-only crash will happen. Here&#8217;s reasons I found which caused Mac-only crashes:</p>

<ul>
    <li>SQLite database object AMF3 <em>deserialization</em>, in a special case of object serialized with a single object to be stored several times into database table.</li>
    <li>A fault application menu was added.</li>
    <li>SQLite database, a write transaction was added into a function which has several read transactions running in parallel. Also, it seems several &#8217;select all&#8217; read transactions at the same time cause occasionally crash as well.</li>
</ul>

<p><strong>Avoid Mac-only Crashes</strong></p>

<ul>
    <li>If application need to be run on Mac, <strong>have at least one developer working on Mac</strong>.
Fixing a Mac-only bug after several weeks is hard than regular bugs. For agile development, bug should be find as soon as possible, if a month later find application cannot be run on Mac, a senior developer have to use at least several hours if unlucky.</li>
    <li>Be careful when working on <strong>SQLite database</strong>.
The first crash was because of an unsafe usage of reference, reuse a single object reference sometime cause unknown issues like this; for 3rd crash, although SQLite can have a single write transaction to be run at the same time of several read transactions, as &#8216;writer&#8217; will wait for an exclusive lock until all &#8216;readers&#8217; complete, SQLite engine inside AIR might not handler it correctly, at least on Mac.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/12/10/air-mac-only-crashes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR 1.5, SQlite now encrypted.</title>
		<link>http://www.neatfilm.com/2008/11/17/air-15-sqlite-now-encrypted/</link>
		<comments>http://www.neatfilm.com/2008/11/17/air-15-sqlite-now-encrypted/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 16:59:28 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=277</guid>
		<description><![CDATA[I have a long time searching for security on SQLite database, as far as I know encryption was a commercial extension for SQLite and not sure whether Adobe will implement it for AIR SQlite engine. It really a great news now Adobe AIR 1.5 support encrypted SQLite database. Thanks, Adobe AIR team.

Using encryption with SQL [...]]]></description>
			<content:encoded><![CDATA[<p>I have a long time searching for security on SQLite database, as far as I know encryption was a commercial extension for SQLite and not sure whether Adobe will implement it for AIR SQlite engine. It really a great news now Adobe AIR 1.5 support encrypted SQLite database. Thanks, Adobe AIR team.</p>

<p><a href="http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS8AFC5E35-DC79-4082-9AD4-DE1A2B41DAAF.html">Using encryption with SQL databases</a></p>

<p><a href="http://www.adobe.com/devnet/logged_in/rchristensen_lpolanco_air_1.5.html">Introducing Adobe AIR 1.5</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/11/17/air-15-sqlite-now-encrypted/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Usability is so Important, Please</title>
		<link>http://www.neatfilm.com/2008/11/07/usability-is-so-important-please/</link>
		<comments>http://www.neatfilm.com/2008/11/07/usability-is-so-important-please/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 17:46:55 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=268</guid>
		<description><![CDATA[I got a hard time to realize a team to develop a large RIA desktop application, not only myself should understand how important usability is, but also other team members even juniors and bosses.

New Feature Requests

We all understand application development change very often. It happens for every team, bosses will add new features never discussed [...]]]></description>
			<content:encoded><![CDATA[<p>I got a hard time to realize a team to develop a large RIA desktop application, not only myself should understand how important usability is, but also other team members even juniors and bosses.</p>

<p><strong>New Feature Requests</strong></p>

<p>We all understand application development change very often. It happens for every team, bosses will add new features never discussed before and marked as &#8216;very important&#8217;. Problem is, for a desktop application, new features usually means redesign at least some parts of UI, also can break user experience if no enough usability discussion and clearly understand what user will expect (which very often is different with the new feature defined), not only designer but also developer have to change a lot. For example, add some new feature without enough space on UI, new behavior in one component which UI should update other relative components at the same time. Not only we need time for new features, bad definition can result arguments between team members and boss, which actually conflict between what boss expect and what user expect in real application.</p>

<p><strong>Designer and Usability</strong></p>

<p>Designers has a good feeling of usability, problem is designers not the person produce the application, and usually designers can design single UI but not the running UI, so it quite often developers have to feedback some design problems. For me I will try to discuss thoroughly before write code, understand what designers want and what will happen in real application that can affect user experiences. Discussion of user experiences between designer and developer should be as early as possible.</p>

<p>Also, designer have to test application from time to time, to find usability problem early and try to fix it.</p>

<p><strong>Junior Developer and Usability</strong></p>

<p>Juniors usually need time to learn and get improved, thinking about usability also hard for them. Problem is user experience is about whole application not parts which experienced developers working on, without fix major usability problems, application can never give anybody good user experiences. Try to ask new developers to catch up more tasks than what they can without fix enough usability problem, is a disaster for the whole application sadly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/11/07/usability-is-so-important-please/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Obfuscation and Decompiler Test</title>
		<link>http://www.neatfilm.com/2008/09/27/as3-obfuscation-and-decompiler-test/</link>
		<comments>http://www.neatfilm.com/2008/09/27/as3-obfuscation-and-decompiler-test/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 21:22:47 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash CS4]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=225</guid>
		<description><![CDATA[Shocked by Doug Mccuue&#8217;s post, I decided to have a test on obfuscation and decompiler together, to see how safe my own Flex/Air code bases.

SWF Encrypt

For a long time I was impressed by SWF Encrypt, although it&#8217;s not a real encryption, should be something interest if it can obfuscate code well for me.

Sothink Decompiler

In AS2 [...]]]></description>
			<content:encoded><![CDATA[<p>Shocked by <a href="http://dougmccune.com/blog/2008/09/27/if-you-steal-source-code-dont-ask-for-help-fixing-it/">Doug Mccuue&#8217;s post</a>, I decided to have a test on obfuscation and decompiler together, to see how safe my own Flex/Air code bases.</p>

<p><strong><a href="http://www.amayeta.com/software/swfencrypt/">SWF Encrypt</a></strong></p>

<p>For a long time I was impressed by SWF Encrypt, although it&#8217;s not a real encryption, should be something interest if it can obfuscate code well for me.</p>

<p><strong><a href="http://www.sothink.com/product/flash-decompiler-for-mac/index.htm">Sothink Decompiler</a></strong></p>

<p>In AS2 days I used to use the free <a href="http://www.nowrap.de/flare.html">Flare</a> written by Igor Kogan, it was a great tool to help to search where co-workers hide their code inside FLA files. But now I need a AS3 version it no longer support. I read a post by Lee Brimelow <a href="http://theflashblog.com/?p=391">about Sothink decompler</a> several months before, so I would like to give it a try.</p>

<p><strong>Test</strong></p>

<p>SWF Encrypt trial version let me try 25 times, I made a secure swf from my AIR swf file.</p>

<p>Sothink Decompiler can read my origin AIR swf file easily, include almost all assets and code packages. Unfortunately the trial version do not let me check source code.</p>

<p>I found code structure in Sothink quite clear and accurate matching my own code base. I decided to buy it as the price not a problem $79.</p>

<p><strong>Result</strong></p>

<p>From my original AIR swf file, Sothink can read almost all my code, that&#8230;.hell!</p>

<p>From secure AIR swf file, Sothink again, read most of my code, only several properties and function names hide.</p>

<p><strong>Conclusion</strong></p>

<p>First, the dark side, our code is definitely not safe.</p>

<p>Second, I do not feel SWF Encrypt doing its own job, I hope it can at least change my property/function names so even decompilers can take out all code, still hard to understand. SWF Encrypt really hide several properties/function names, but only very few of them.</p>

<p><span style="text-decoration: line-through;">Third, I found Sothink useful. Flex framework itself is a giant code base, Sothink decompiler code give some other code we cannot see and realize in MXML files.</span></p>

<p>Update: finty is right. I forgot Flex compiler can generate source code itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/09/27/as3-obfuscation-and-decompiler-test/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>AIR Application Syslog with SQLite</title>
		<link>http://www.neatfilm.com/2008/09/01/air-syslog-with-sqlite-source-code/</link>
		<comments>http://www.neatfilm.com/2008/09/01/air-syslog-with-sqlite-source-code/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 02:38:35 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=190</guid>
		<description><![CDATA[In AIR (Flex/Flash) application, syslog support might be very useful for QA/developers also can be helpful for end user as well. I wrote some fast code for my personal project Dailytasks on this (and another more complex SQLite database with transaction manager) during this long weekend.

You can download source code from here. (Need some tweaks [...]]]></description>
			<content:encoded><![CDATA[<p>In AIR (Flex/Flash) application, syslog support might be very useful for QA/developers also can be helpful for end user as well. I wrote some fast code for my personal project <a href="http://dailytasks.net/">Dailytasks</a> on this (and another more complex SQLite database with transaction manager) during this long weekend.</p>

<p>You can download source code from <a href="http://www.neatfilm.com/flash/download/sqlite_log.zip">here</a>. (Need some tweaks to fit your own application for sure.)</p>

<p>Here&#8217;s how it works:</p>

<ul>
    <li>(Run once and comment it out) Create syslog database file and table. (I use some code to create and run once only, when I need update my table structure, rebuild database again.)</li>
    <li>Initialize SyslogService instance in preinitialize process of application. (it will open SQLConnection and compile statement to be used later.)</li>
    <li>Call static function from any points, i.e.:
<ul>
    <li><code>SyslogService.log(SyslogLevel.INFO, 'Application start.');</code></li>
</ul>
</li>
    <li>If statement is executing, push log data into stack and insert after.</li>
</ul>

<p>Update (September 3):</p>

<p style="padding-left: 30px;">I don&#8217;t have time to test completely. If you got database open error, just add open listener before execute the statement. Code is just simple like this.</p>

<p style="padding-left: 30px;"><code>if(!sqlConnection.connected)</code></p>

<p style="padding-left: 60px;"><code>sqlConneciton.addEventListener ...</code></p>

<p style="padding-left: 30px;">Because the connection and statement will be reused all the time, you need to detect only once.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/09/01/air-syslog-with-sqlite-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite Notes</title>
		<link>http://www.neatfilm.com/2008/06/13/sqlite-notes/</link>
		<comments>http://www.neatfilm.com/2008/06/13/sqlite-notes/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 18:56:45 +0000</pubDate>
		<dc:creator>george</dc:creator>
				<category><![CDATA[AIR Runtime]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex 3]]></category>

		<guid isPermaLink="false">http://www.neatfilm.com/?p=72</guid>
		<description><![CDATA[Execute statement

Every statement has an associated connection object, a statement represents a single &#8216;compiled&#8217; SQL statement. There&#8217;re two methods to execute SQLStatement instance in AIR, one execute a single statement each time, another use .begin() .commit() to execute multiple statements, as a transaction. For SQLite engine, they both transaction, the single statement operates in autocommit [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Execute statement</strong></p>

<p>Every statement has an associated connection object, a statement represents a single &#8216;compiled&#8217; SQL statement. There&#8217;re two methods to execute SQLStatement instance in AIR, one execute a single statement each time, another use .begin() .commit() to execute multiple statements, as a transaction. For SQLite engine, they both transaction, the single statement operates in autocommit mode by default.</p>

<p>SQL statement execution process:
<code> Statement+SQL -&gt; Compilation -&gt; Byte Code (with parameters) -&gt; execution -&gt; Finalization</code></p>

<p>Use parameters for statements is highly recommended. One important benefit Adobe might not documented: SQLite takes care of escaping the string values binding to parameters, helping avoid syntax errors and SQL injection attacks, i.e, it will convert &#8216; to &#8221;.</p>

<p><strong>Transaction and Locks</strong></p>

<ul>
    <li>Multiple read transactions (SELECT), one single write transaction (INSERT/UPDATE/DELETE) at a time.</li>
    <li>When write transaction is writing (exclusive locked), no new transactions can connect.</li>
    <li>Write transaction will wait for any running read transactions to finish before writing.</li>
</ul>

<p>Each transaction (or SQLStatement execution in autocommit mode) transit from one state to another state.</p>

<p>A default SELECT statement run in path as followed:
<code>Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked</code></p>

<p>Two SELECT statements grouped with .begin() and .commit() in a single transaction:</p>

<p><code>Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked</code></p>

<p>Two SELECT statements run in turn:</p>

<p><code>Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked -&gt; Pending -&gt; Shared -&gt; Unlocked</code></p>

<p>A write transaction (i.e. UPDATE) by default (autocommit mode):</p>

<p><code>Unlocked -&gt; Pending -&gt; Shared -&gt; Reserved -&gt; Pending -&gt; Exclusive locked(commit) -&gt; Unlocked</code></p>

<p>A write transaction with &#8216;BEGIN IMMEDIATE&#8217;:</p>

<p><code>Reserved -&gt; Pending -&gt; Exclusive locked(commit) -&gt; Unlocked</code></p>

<p>The &#8216;Reserved&#8217; state is a tricky state that may a place to improve performance. It actually store modifications in a memory cache, and create a rollback journal file for possible crash recovery. In this state the write transaction get real work done without affecting other read transactions. That&#8217;s how &#8216;multiple reader, one writer&#8217; works.</p>

<p>After the write transaction get it work done, it begins trying get a Pending lock to move to Exclusive commit state, where (Pending) no more new read/write transactions (they have to wait in queue), the write transaction need to wait any other transactions still working to finish. Only after anything else cleared, this transaction enter into Exclusive state.</p>

<p>The &#8216;Exclusive&#8217; state is to flush the modifications from cache to database file.</p>

<p>SQLConnection has a property cacheSize that affect write transaction. In &#8216;Reserved&#8217; state if page cache fills up, it have to move to &#8216;Exclusive&#8217; state before finish its own task. The bigger cacheSize the more modified pages can store and minimize the time to be used in &#8216;Exclusive&#8217; state. (sqlite_analyzer can dump detailed statistics helpful for adjusting cacheSize)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neatfilm.com/2008/06/13/sqlite-notes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
