Tag Archives: code

Flex Formatter

Flex Builder 3, an eclipse~ IDE for flex and actionscript based project development lacks few primary code indentation and refactoring functionalities by itself.

Searching for some other technical requirement drove me to Flex Formatter, a third party project on source! Cheers, its BSD license! 🙂

This tool is really small but very essential and useful plugin

Flex Formatter tools

Flex Formatter tools

Many times it happens that code is written in hurry to achieve some short term goal. Either some efforts need to invest to refactor and indent the code, or else go for Flex Formatter.

Built in capability to generate ASDoc is also impressive! However, I suppose, all these features, of flex formatter have been covered with Flash Builder 4.

Masking with customized / polygon shape

A typical requirement to create custom closed shape was a big pain till now at my workplace. Many were working to create some run time changeable shape and through that, mask an image. I achieved this; finally, after visiting a blog and a forum for Flash programming. Also, my colleague Mayur helped to organize once I was ready and I explained like Proof of Concept.

For custom shape, you will require a reference to public property of any DisplayObject / UIComponent – that is graphics (flash.display.Graphics)

Now is the real crux.

The next steps work just like you draw something on paper (or Canvas)

// Create and initialize Sprite object
var spriteObj:Sprite = new Sprite();

// Clear graphics
spriteObj.graphics.clear();

// Define style of line (border of the shape)
spriteObj.graphics.lineStyle(1, 0xff00ff);

// Start filling with a selected color
spriteObj.graphics.beginFill(0x00ff00);

// Move to a position to start from (without actually drawing)
spriteObj.graphics.moveTo(x, y);

// Draw a line / curve or anything that is supported by graphics
// This may be used in a loop or recursive manner to draw lines / curves passing through n points
for(...;...;...)
{
	spriteObj.graphics.curveTo(handlerX, handlerY, x, y);
}

// End filling process, just like you put pen aside!
spriteObj.graphics.endFill();

// Define a new canvas and initialize it
var canObj:Canvas = new Canvas();

// Add the just created Sprite object as a raw (not direct UIComponent child) child
canObj.rawChildren.addChild(spriteObj);

// Use over image as a mask, if required
imgComp.mask =  canObj;

Setting up Subversion under windows

Prerequisites:

  1. Subversion Binary (http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91)
  2. TortoiseSVN (http://tortoisesvn.net/downloads)
  3. SVN Service Wrapper for Windows (http://www.lw-works.com/files/svnservice/svnservice-1.0.0.msi) – svnservice

Alternate to 1 & 2 – download 1 Click Setup (http://svn1clicksetup.tigris.org/)

Step 1

  1. Install Subversion binary.
  2. Make sure that the bin directory of Subversion is under PATH environment variable.
  3. Set any text Editor’s path as SVN_EDITOR environment variable. (e.g. c:\windows\notepad.exe)

Step 2

  1. Create code / document repository (the main destination or data centre!!)
svnadmin create "d:\codeRepo"
               Alternatively, you may also use explorer’s context menu to add selected folder as repository using TortoiseSVN.
  1. Go to the repository folder (e.g. codeRepo)
    1. Edit /conf/svnserve.conf file

Uncomment following:

                               [general]
                               anon-access = read
                               auth-access = write
                               password-db = passwd
    1. Edit /conf/passwd file

Uncomment following / specify allowed username & passwords:

                               [users]
                               harry = harryssecret
                               sally = sallyssecret
                               harit = harit’s password

Step 3

  1. Start svnservice
               svnserve --daemon --root "d:\codeRepo"
  1. Add new Project directory by
               svn mkdir svn://localhost/myproject
  1. Provide correct username & password (that is configured earlier)

Otherwise, use SVN repository browser to browse SVN repos. Right click provides rich set of options like adding new files/folders, delete, etc. etc. Use svn://localhost/myproject or similar as URL to browse.

Optional options!

  1. Setup svn-service to start at startup
               svnservice -install --daemon --root "d:\codeRepo"
               sc config svnservice start= auto
               net start svnservice
  1. Bind windows user for authentication (see source link 1 – http://www.stanford.edu/~bsuter/subversion-setup-guide/#svnserve-windows-user)

Please make sure that the svnservice is running correctly. Use Control Panel > Administrator Options > Services > Subversion (or whatever you named it) to verify. If the service is not running, it is the root of many problems.

This setup also works on network. You can access this repo through other machines connected through network. Each time you modify the files and commit, subversion will do authentication based on username and commit new version.

Major advantage of subversion – old (and deleted) files remain there in repository and can be retrieved back, so is perfect backup solution for code!

Sources for more advanced setup:

  1. http://www.stanford.edu/~bsuter/subversion-setup-guide/
  2. http://blogs.vertigosoftware.com/teamsystem/archive/2006/01/16/Setting_up_a_Subversion_Server_under_Windows.aspx
  3. http://blog.excastle.com/2005/05/31/mere-moments-guide-to-installing-a-subversion-server-on-windows/
%d bloggers like this: