Thursday, May 26, 2011

AS3 Signals - Faster Messages in AS3

AS3 signals are free , very fast and relaible messaging tool, i have been using them from last 6 months , below are some features of Signals which are more superior than Events

Dowload it from https://github.com/robertpenner/as3-signals/wiki/

Signal's Salient Features

Remove all event listeners : signal.removeAll();

Retrieve the number of listeners : signal.numListeners

Listeners can be added for a one-time call and removed automatically on dispatch:

signal.addOnce(theListener); // result: signal has one listener
signal.dispatch(theEvent); // result: theListener is called, signal now has no listeners

A Signal can be initialized with value classes that will validate value objects on dispatch (optional):

// A Signal that will dispatch a String and an integer:
progress = new Signal(String, int);
//later:
progress.dispatch(); // will throw ArgumentError
progress.dispatch('The Answer'); // will throw ArgumentError
progress.dispatch('The Answer', 42.5); // will throw ArgumentError
progress.dispatch('The Answer', 42); // will succeed


Varun Rathore

Wednesday, May 25, 2011

Adobe AIR - Opening Main Appllication from Child Window

Hi, I was trying to make the Main Application open and dock from a child window, here is the simple code to do this, it check if the Main application is not docked, if not if put that to front.

if(FlexGlobals.topLevelApplication.stage.nativeWindow.visible == false)
{
FlexGlobals.topLevelApplication.stage.nativeWindow.visible = true;
FlexGlobals.topLevelApplication.stage.nativeWindow.orderToFront();

}
FlexGlobals.topLevelApplication.stage.nativeWindow.orderToFront();


-Varun Rathore

Tuesday, May 17, 2011

Increasing Java Heap Size - Posting Bigger Files in Apache SOLR

In some cases we need to post bigger xml file in SOLR server for indexing, if you post the file directly you get OutOfMemoryExceptions to avoid such failure, we need to change the max memory size that the heap can reach for the JVM

Here is the Command by which we can increase the heap size
java -Xms128m -Xmx8192m - jar

So in order to post bigger files now we use
java -Xms128m -Xmx8192m - jar post.jar <*.xml>

The -Xmx argument defines the max memory size that the heap can reach for JVM.
The -Xms argument sets the initial heap memory size for the JVM.

-Varun Rathore

Apache SOLR , Deleting-Removing all data at one Go

If we need to remove/delete the indexed data from SOLR server here is a simple one line command which does the magic for you.

java -Ddata=args -jar post.jar "<delete><query>*:*</query></delete>"

-Varun Rathore

About Me