Tuesday, December 13, 2011

Adobe Flex is now Apache Flex

As all of us know that Adobe is donating Flex SDK to Apache Foundation and Spoon project. Adobe says it still contributes to Flex SDK but it also want all of us who work on & use Flex to start contribute to the Flex SDK now.

Click here for the Spoon project.

Adobe is presently (at time of writing this post) conducting an flexsummit with some key partners to discuss the future of flex and explain their commitment(!!!!!) to flex technology and how they want to take Flex forward with help of community. Spoon Project is posting some live comments on the ongoing flexsummit here.

follow @SpoonProject, @iamdeepa on twitter for further latest updates.

Friday, August 5, 2011

Know File System using Flex/AIR in a Win Machnie

Below is a small code snippet to know File System info in a Windows Machine using Flex/AIR.

var ta1:TextArea = new TextArea();

protected function getFS(event:MouseEvent):void
{
try
{
ta1.text = '';
var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();

var commands:Vector. = new Vector.();
commands[0] = "fsinfo";
commands[1] = "statistics";
commands[2] = "c:";

processInfo.arguments = commands;
processInfo.executable = new File('C:/WINDOWS/system32/fsutil.exe');

process = new NativeProcess();

process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutPutProgress, false, 0, true);

process.addEventListener(NativeProcessExitEvent.EXIT, handleExit2);
process.start(processInfo);
}
catch(e:Error)
{
Alert.show(e.message,"Error");
}
}

protected function handleExit2(event:NativeProcessExitEvent):void
{
if(event.exitCode == 0)
{
var str:String = ta1.text;
str = str.split('\n')[0];
str = StringUtils.removeExtraWhitespace(str);
str = str.substr(str.lastIndexOf(' '), str.length);
Alert.show('File System of C drive: ' + str);
}
else
{
Alert.show('Unable to get File System details');
}
}


protected function onOutPutProgress(event:ProgressEvent):void
{
ta1.text += process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable);
}


fsutil (C:/WINDOWS/system32/fsutil.exe) is a utitlity/exe which gives a lot of info on file system in a windows machine. I used this only to extract some file system info but you can know more about 'fsutil' from here and explore more options yourself.

This code snippet uses some Flex AIR API's like NativeProcessStartupInfo and this code can be tested only after generating an executable (exe).