Skip to main content

Posts

Showing posts from September, 2012

Terminating a run or test in Scala Build Tool (SBT)

When running a program or test in SBT, if you want to exit from it (and not from SBT) try adding following lines in your build.sbt file: fork := true To directly add forking in an SBT session, type set fork := true This will not detach and open a new consule from the original sbt console. But, users can kill this separately. The way to do this in Max OS or Windows is to search a Java process with command line having sbt-launch in Activity Monitor / Windows Task Manager, and end it. In Unix, try grepping a process with sbt-launch in a new terminal, and kill it. Command to do that is: kill -9 `ps -h | grep java | grep -v sbt-launch | grep -v grep | awk '{print $1}'` By default, the run or test tasks run in the JVM as sbt. Forking can be used to run these tasks in a child process. By default, a forked process uses the same Java and Scala versions being used for the build and the working directory and JVM options of the current process. SBT documentation page discusse

Eclipse crashing and not starting

Problem: After restarting Eclipse, it crashes immediately and asks me to check C:\Users\username\Adobe Flash Builder 4.6\.metadata\.log In log it shows following error: !ENTRY org.eclipse.osgi 4 0 2013-02-13 11:53:46.760 !MESSAGE Application error !STACK 1 org.eclipse.swt.SWTError: Cannot initialize Drop     at org.eclipse.swt.dnd.DND.error(DND.java:266)     at org.eclipse.swt.dnd.DND.error(DND.java:227)     at org.eclipse.swt.dnd.DropTarget. (DropTarget.java:142)     at org.eclipse.ui.internal.EditorSashContainer.addDropSupport(EditorSashContainer.java:542)     at org.eclipse.ui.internal.EditorSashContainer.createControl(EditorSashContainer.java:534)     at org.eclipse.ui.internal.EditorAreaHelper. (EditorAreaHelper.java:41)     at org.eclipse.ui.internal.WorkbenchPage.init(WorkbenchPage.java:2507)     at org.eclipse.ui.internal.WorkbenchPage. (WorkbenchPage.java:653)     at org.eclipse.ui.internal.tweaklets.Workbench3xImplementation.createWorkbenchPage(Workbench3xImple

Preserving open nodes in AdvancedDataGrid with HierarchicalCollectionView

My dataProvider is an ArrayCollection, which is populated using XML. var initXML:XML = <items>    <item id="News" label="News" value_1="unchecked" value_2="unchecked" value_3="checked"/>    <item id="BBC" label="The Web" value_1="unchecked" value_2="unchecked" value_3="checked">        <item id="BBC1" label="BBC Homepage" value_1="unchecked" value_2="unchecked" value_3="checked">       <item id="YouTube" label="YouTube" value_1="unchecked" value_2="unchecked" value_3="checked"/>       <item id="GoogleMaps" label="Google Maps" value_1="unchecked" value_2="unchecked" value_3="checked"/>       <item id="MSN" label="MSN" value_1="unchecked" value_2="unchecked" valu

Flash trace log file in Windows 7

In my recent project, I need to look at the Trace output from the Flex application outside Flash Builder. I have Windows 7 as my operating System. Following are the steps to setup trace log file: Download and install Flash player debug version. Check at www.flashplayerversion.com for the version details. Create a new file named mm.cfg in your home directory. To figure out home directory open a command wondow and type echo %HOMEDRIVE%     TraceOutputFileEnable=1     ErrorReportingEnable=1     MaxWarnings=500     TraceOutPutFileName=C:\Users\(username)\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt Last line is optional if you are fine with the output file location. Open web browser and your Flash application.4. Use a tool like baretail to check the log file.

Deploying swc library in repository and adding maven artifacts for that

We can either deploy the swc file on a web server or a local Maven repository. To deploy xyz.swc on a webserver, the command is (in the folder containing xyz.swc): mvn deploy:deploy-file -Dfile=xyz.swc -Durl=file:///path/to/repository -DgroupId=com.abc -DartifactId=xyz -Dversion=1.01 -Dpackaging=swc This deploys the xyz.swc file to /path/to/repository (using the groupId, artifactId, version). Users then can refer to this Web URL (by defining a repository in their Maven project) and use xyz as a dependency in their Maven projects. To deploy the swc in a local Maven repository, we can execute (in the folder containing xyz.swc): mvn install:install-file -Dfile=xyz.swc -DgroupId=com.abc -DartifactId=xyz -Dversion=1.01 -Dpackaging=swc -DgeneratePom=true -DcreateChecksum=true Users then can add the dependency in the pom.xml file under <project> tag as:     <dependencies>         <dependency>             <groupId>com.abc</groupId>             <artifactId

Spark TextInput for Currency values

In my project, I wanted to have an spark TextInput to show currency values. While formatting it should show unformatted number. The way I did it is by creating a new CurrencyTextInput class extending spark TextInput. Code for the component is (CurrencyTextInput.as): package com.abcd.component {     import flash.events.Event;     import flash.events.FocusEvent;     import spark.components.TextInput;     import spark.formatters.CurrencyFormatter;     public class CurrencyTextInput extends TextInput     {         public function CurrencyTextInput()         {             super();             formatter = new CurrencyFormatter();             formatter.currencySymbol = "£";             formatter.fractionalDigits = 2;             formatter.useGrouping = true;             formatter.useCurrencySymbol = true;             formatter.negativeCurrencyFormat = 1;             formatter.trailingZeros = true;         }         public var formatter:CurrencyFormatter = null;         publ