The NEXT thing to try!!

Icon

Random rants and tips about NETCF, WinCE, Emacs, Powershell etc.

Flex compiler options

Inspired by the post on JVM Settings, I have came up at the list of mxmlc/compc options available.

Here is the link. For scripting folks[:)], such a list can be easily generated by running the following script.

After writing this I was wondering if it is possible to know with what options a swf/swc was compiled. I am not sure about other use cases but one use case could be while working with swfs of different versions. If I want to load a swf using SWFLoader I need to know its version (it is possible using swfdump, but that is too much of work to do I think).

Advertisements

Filed under: flex

Upgrading to Gutsy Gibbon

Succeeding Feisty Fawn, the new release of Ubuntu 7.10 i.e Gutsy Gibbon will be out in coming October (scheduled data is 18th October 2007).
This week alpha release of “Tribe 5” is already out and the countdown for the final release has begun.

As usual the process of upgrading is simple. You just need to issue following commands to upgrade.

sudo replace feisty gutsy - /etc/apt/source.list
sudo apt-get update
sudo apt-get dist-upgrade

It will download some 570 MB to upgrade and you are done. So far I have not faced any issues.

There is always a way to do the same using UI also. Follow the instructions here to achieve this.

Jono Bacon has also made the announcement for the Gutsy Gibbon’s successor, Ubuntu 8.04, Hardy Heron which has been scheduled for release in April 2008.

 

 

"Everyone is welcome to participate,
everyone is welcome to get involved,
and everyone is welcome to
help shape the form of the Hardy Heron."

One can add their specifications/ideas to https://blueprints.launchpad.net/ubuntu.

Filed under: ubuntu

Try Win-Get!!

If you are one of those Debian/Ubuntu users who just loved apt and now you miss it on windows then you should give win-get a try.

Win-Get could be called as scaled down version of apt which provides an automated install system similar to apt on Windows. When invoked it connects to the repository, request the required package (downloads it using wget) and presents you with the installer (Ya, I know this is still painful to keep pressing next to complete the installation).  

The default repository has got good collection of utilities/applications which could be seen and browsed here.

Filed under: ubuntu

Using Flex™ 2.0.1 Language Reference offline

After playing with HTML Help Workshop for some time I have managed to compile the Flex™ 2.0.1 Language Reference in CHM format (CHM files are extensively used for documentation and help files).

This is similar to Help Window we get with the Flex Builder. FlexBuilder has a limitation that it doesnt allow using help unless FlexBuilder is open. This is where such a CHM is useful. It also has got search functionality and thus serves the purpose. Here are the steps to create a CHM file:

  1. Download Flex Language Reference from livedocs or alternatively take the zip from {Flex Builder installed location}/plugins/doc.zip (thanks to Sreenivas for pointing out this) and unzip it.
  2. Say the docs are located on PATH/flexapi.
  3. Download HTML Help Workshop from the following link and install it.
  4. Open HTML Help Workshop and go to File -> New and select Project. It will start a wizard.
  5. Give a name (say flex2.0.1_asdoc ), when asked for name of the project file.
  6. After clicking next, select HTML files checkbox (because we already have our doc created)
  7. In the next dialog box, press Add and give path of the index.html (PATH/flexapi/index.html)
  8. Click Finish to finish the wizard

Press Save to save the project and compile the project and click View Compile file button on the toolbar. You will find that the file created is broken because it has not included all the files. So we need to fix this. Actually HTML Help workshop has a limitation that it doesn’t pick files specified in CSS stylesheets and javascripts. Follow these steps to fix this:

  1. Close the project. And go to the project folder and open the .hhp file in any editor. You will find a [FILES] section in the file with index.html listed.
  2. Just do a find to find all the class-list.html files in the PATH/flexapi/ folder and add all those class-list files (with full path) after index.html
  3. Save this template.html file in the PATH/flexapi/ folder.
  4. Add template.html also to the list of [FILES] in .hhp file.

Now open the project again and re-compile the project. Use the CHM created when you are offline and not using FlexBuilder.

Here is a screenshot of CHM file I got. You can also take advantage of the search functionality and here is a screenshot for this.

Filed under: actionscript, flex

Using Autoinserting(emacs) for actionscript

This is my post second post in this series. After spending some time in lisp, I have managed auto-insert to work for actionscript.

Emacs has got Autoinserting which allows putting some predefined code in a file when you create it first time. This is a familiar concept for people who use IDEs like FlexBuilder for coding.

In flex builder when we create a class first time, it asks for the classname and other information like base class, interfaces and dump some code for the first time. Autoinserting is the answer to achieve such a functionality in emacs.

It works as follows:

  1. When you create a new file with .as extension, it prompts for the base class name
  2. Pressing ENTER will imply no base class otherwise it will insert the required code (import statement and extends string in the template)
  3. After that it asks for package name, again pressing ENTER will mean default (i.e top level package) otherwise package name given will be taken.
  4. It repeatedly keeps asking for the interfaces that you plan to implement, unless you press ENTER

Here is the required code you need to add to your .emacs file.

P.S :=> Don’t forget to set the flex-home variable

(auto-insert-mode t)
(setq auto-insert-alist
      (append '(((actionscript-mode .  "Actionscript Mode") . insert-as-template))
              auto-insert-alist))

(defvar flex-home "C:/flex/sdk/framework/src")

(defun get-dot-seperated (file-name)
  (interactive)
  (setq file-name (substring file-name 1 )) ;; Get rid of the first /
  (setq parts (split-string file-name "/")) ;; split string into parts based on /
  ;;Start creating . seperated import string
  (setq file-dot-path "")
  (while parts
    (setq token (car parts))
    (setq file-dot-path (concat   file-dot-path "." token))
    (setq parts (cdr parts)))
  (substring file-dot-path 1))

(defun insert-as-template ()
  (interactive)
  (let ((baseclass (read-file-name "[]base class?" flex-home))
        (package (read-string "[]Package?" ""))
        ;;(title (substring (file-name-nondirectory buffer-file-name) 0 -3))
        (title (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
        (tab "t"))

    (insert (concat
             "package " package "n"
             "{n"))

    (setq hasBaseClass (not (or (= (length baseclass) 0)
                   (equal buffer-file-name baseclass))))

    (when hasBaseClass
      (setq foo (length flex-home))
      (setq base-class-name (substring baseclass foo ( - (length baseclass) 3))) ;;get /mx/controls/Datagrid from full path
      (insert (concat "import " (get-dot-seperated base-class-name) ";n")))

    (setq point-for-imports (point))

    (insert (concat "public class " title))

    (if hasBaseClass
        (insert (concat " extends " (file-name-sans-extension (file-name-nondirectory baseclass)))))

    (setq point-after-class (point))

    (insert (concat
             "n"
            "{n"
            "n"
            tab "//--------------------------------------------------------------------------n"
            tab "//n"
            tab "//  Constructorn"
            tab "//n"
            tab "//--------------------------------------------------------------------------n"
            "n"
            tab "/**n"
            tab "*  Constructor.n"
            tab "*/n"
            tab "public function " title "()n"
            tab "{n"
            tab tab "//Start from heren" tab tab))

   ;;bookmark this point, so that we can place the cursor here when finished
    (setq point-beginning (point))
    (insert (concat
            "n"
            tab "}n"
            "}n"
            "}n"
            )))

  (setq imports-for-interfaces "")
  (setq implements-string "")
  (setq base-class-path "")
  (setq prompt t)
  (while prompt
    (let ((interface (read-file-name "[]implements?" flex-home)))

      (when (not (or (= (length interface) 0)
                     (equal buffer-file-name interface)))

        (setq foo (length flex-home))
        (setq interface-name (substring interface foo ( - (length interface) 3))) ;;get /mx/controls/Datagrid from full path
        (setq imports-for-interfaces (concat imports-for-interfaces "import " (get-dot-seperated interface-name) ";n"))
        (setq implements-string (concat implements-string (file-name-sans-extension (file-name-nondirectory interface-name)) ",")))

      (if (or (= (length interface) 0)
              (equal buffer-file-name interface))
          (setq prompt nil))))

  (when (> (length implements-string) 0)
    (setq implements-string (substring implements-string 0 (1- (length implements-string))))
    (goto-char point-after-class)
    (insert (concat "nt" "implements " implements-string))
    (setq point-beginning (+ point-beginning (length implements-string))))

  (when (> (length imports-for-interfaces) 0)
    (goto-char point-for-imports)
    (insert (concat imports-for-interfaces "n"))
    (setq point-beginning (+ point-beginning (length imports-for-interfaces))))

  (goto-char point-beginning))

As a result I get this as my start file:

package src
{
import mx.controls.Tree;
import mx.controls.treeClasses.ITreeDataDescriptor;
import mx.collections.IViewCursor;

public class MyTree extends Tree
	implements ITreeDataDescriptor,IViewCursor
{

	//--------------------------------------------------------------------------
	//
	//  Constructor
	//
	//--------------------------------------------------------------------------

	/**
	*  Constructor.
	*/
	public function MyTree()
	{
		//Start from here

	}
}
}

Filed under: actionscript, emacs

Using Imenu (emacs) for actionscript

If you use emacs as your editor while programming in actionscript, then this tweak could be really useful for you.

Emacs has got Imenu facility which allows finding major definitions in a file/buffer. In the context of actionscript this includes class definitions, private/protected/public variables, getters/setters and ofcourse functions. Thus, using Imenu you can bind your keys so that it jump on the definition of a function when those keys are pressed. When you change the contents of the file, you can press

*Rescan*

to make it re-read the buffer and generate a new indexing of the file contents. You can also set

'imenu-auto-rescan'

to a non-nil value so that it automatically scans your file, everytime you make any changes. Here is screenshot of the Imenu:

actionscript-mode is already available for emacs and thus by using the mode you can get all sort of code-coloring. After adding actionscript-mode to your mode-list, you need to add this code to your .emacs to get the desired functionality.


(add-hook 'actionscript-mode-hook 'imenu-add-menubar-index)
(add-hook 'actionscript-mode-hook 'actionscript-init-imenu)
(defun actionscript-init-imenu ()
  (interactive)
  (setq imenu-generic-expression as-imenu-as-generic-expression)
  (global-set-key [mouse-3] 'imenu))(defvar as-imenu-as-generic-expression
  ` (
    ("variables"
     ,(concat
       "^"
        "[ t]*(public|protected|mx_internal|private)"
        "[ t]+var"
        "[ t]+([a-zA-Z_][a-zA-Z0-9_]*)"     ; match function name
        "[ t]*:([a-zA-Z_][a-zA-Z0-9_]*)"        ), 2)

    ;; Getters
    ("Getters"
     ,(concat
       "^"
       "[ t]*(override[ tn]+)?"
        "[ t]*(public|protected|mx_internal|private)"
        "[ t]+function"
        "[ t]+"
        "(get[ t]+([a-zA-Z_][a-zA-Z0-9_]*)[ t]*)()"
       ) 3)

    ;;setters
    ("setters"
     ,(concat
       "^"
       "[ t]*(override[ tn]+)?"
        "[ t]*(public|protected|mx_internal|private)"
        "[ t]+function"
        "[ t]+"
        "(set[ t]+([a-zA-Z_][a-zA-Z0-9_]*)[ t]*)"
        "("
        "([a-zA-Z_][a-zA-Z0-9_]*):([a-zA-Z_][a-zA-Z0-9_]*)[ tn]*"
        ")"
       ) 3)

;; Class definitions
    (nil
     ,(concat
         "^"
         "((public|protected|mx_internal|private)[ t]+)?"
         "(class|interface)[ t]+"
         "("                                ; the string we want to get
         "[a-zA-Z0-9_]+"                      ; class name
         ")"
         "[ tn]*"
         "(extends [ tn]*[a-zA-Z0-9_]+)?"
         "[ tn]*";;[:{]"
         "(implements [ tn]*([a-zA-Z0-9_]+[,][ tn]*)*[a-zA-Z0-9_])?"
         "[ tn]*";;[:{]"
         ) 4)

;; General function name regexp
    (nil
     ,(concat
       "^"
       "[ t]*(override[ tn]+)?"
        "[ t]*(public|protected|mx_internal|private)"
       "([ t]+static)?"
        "[ t]+function"
        "[ t]+([a-zA-Z_][a-zA-Z0-9_]*)"     ; match function name
        "[ t]*("
        "[^)]*)"
       ) 4)
    )
  "Imenu generic expression for C++ mode.  See `imenu-generic-expression'.")

Attached is my .emacs file

Filed under: actionscript, emacs

Goobuntu? Oh gr8!!

Yesterday, I visited google office and when i was roaming around in the office and my eyes fell on a familiar logo GOOOBUNTU (Google + Ubuntu). Later when I searched about it I learned that google uses this Google OS which is based on Ubuntu and Gnome. As of now, they are using it for their internal purposes and I think in future they may have plans to distribute it publicly as well.

Goobuntu

I have been using Ubuntu from last 3 years and I find it as the best distro I have came across. If google launches it then I think it will be a huge step for Ubuntu Project.

Google has confirmed it is working on a desktop linux project called Goobuntu, but declined to supply further details, including what the project is for. […] Perhaps Google will have to think of a new name for the system before they launch it to the wider public

More information on wikipedia for Goobuntu.

Filed under: linux, ubuntu

A must-see blog post

James Ward has published a really awesome benchmark application which compares different ways of loading data into Rich Client Applications(AJAX and Flex).

One can tryout the benchmarks at http://www.jamesward.org/census.

In the next release, he would be including Laszlo also in the game. Along with that he also intends to build richer benchmark applications including Datagrids in AJAX also. Let’s wait for the next release of this beautiful work to come up.

Filed under: flex

<mx:ResizableTitleWindow>

ResizableTitleWindow Component Code is now available at the following link.

Resizable Title Window

Install instructions and the documentation is also there with the code.

Feel free to use and drop in your feedback.

Filed under: flex, flex component

Flex is now Open source

The news is available on labs.

The official Press release can be found here.

Adobe has recently made a great announcement of open sourcing the Flex under the MPL license (the same license under which Action Script VM was open sourced).

Along with Flex SDK (whose source is available already), this also includes the source code of ActionScript and MXML compiler, ActionScript debugger and core ActionScript libraries of SDK.

FlexLogo

The immediate plans (summers 2007) are to post daily builds of Flex SDK and to have a public bugbase. After the Moxie release, there will be publicly accessible Subversion repository which can be accessed/used/modified by “trusted” developers. To start with, these “trusted” developers will include the internal teams. As the process gains momentum, external contributors may be granted commit privileges to the core SDK. External contributors may also be granted access to manage “sub projects” of the SDK.

In words of David Wadhwani, the vice president of product development for Flex

“Initially people will be able to contribute code by attaching it to a bug or enhancement request in the public bug database and we’ll clearly state our development philosophies at this time. After a few months we’ll start looking for external committers. We’ll look for individuals who have been active contributors of high quality code that most closely maps to our development philosophies.”

Flex has already got a great adoption in the RIA community and now with the strength of open source community Flex surely has a great future ahead. Developers will be able to access, modify and contribute to the source code for the Flex compiler, components and application framework. This will also allow other open-source projects to leverage full capabilities of the Flex Framework.

Just after the Microsoft’s announcement for SilverLight (which created a lot of chaos in the RIA community), this news is giving an indication that the war has begun. As an answer to Microsoft’s “we’re doing that too, but better!”, Adobe has seemingly tightened their belts sayin “Let’s see!!!”.

In context of Microsoft I found a nice discussion here which says:

Jeffrey Hammond, an analyst with Forrester, said he sees the battle unfolding between Adobe with Apollo and Flex versus Microsoft with its Silverlight and XAML (Extensible Application markup Language). Additionally, Hammond said he believes the platform ubiquity of Microsoft’s WPF (Windows Presentation Foundation) versus the potential ubiquity of open source should be a real test of classic models versus new business models in software.

Hammond also said that until Adobe announced its open-source plans for Flex, “it was one proprietary technology against another, so there was no reason for the standards-based crowd to join either side. Now, the standards crowd has some interesting reasons to join the Adobe camp.”

Flex SDK and other Flex products will also be available under the existing commercial licenses thus allowing both new and existing partners and customers to choose the license terms that best suit their requirements.

Filed under: flex

About the author

avatar
25, Male, living in Hyderabad Mobile Developer, working for Microsoft IDC

View Nisheet Jain's profile on LinkedIn

RSS Mobile Dev Blog

  • An error has occurred; the feed is probably down. Try again later.