can we write a file to appication directory in FLEX? - apache-flex

how to write a file to File.applicationDirectory in flex. i am getting security filewrite resource error.

You can't use File.applicationDirectory in pure flex , it is ment to be used only in air applications.
in flex you can use Filereference.save() which opens a dialog box where user can select the folder to save the file in.

Related

How to read a text file in Flex stored on a webserver

I have a text file stored on a webserver (Tomcat). This file get updated daily by a different program.
Now, I want my flex application to read from that file and show the data in one of the compnenets for example DataGrid , Text box. Is there a way to do this?
I think there are two options:
1) Flex app resides in tomcat container (or another Java EE container).
So you could use an blaze ds scheme and access to text file with Java app, and Flex invoque the Java app through Remote Object methodology
2) Flex app is external to tomcat container
The solution that I could use is develope a single Java webservice that returns the content of the text file.
So the Flex app invoque webservice and return the content with HttpService methodology

ASP.NET Sound Resource not publishing

So I created an ASP.NET 4 application in VS2010, that needs to play sound to the end user, and it is working perfectly in my local development environment. The problem is the sound resource nor the Resources.resx is not being published to the server. Any idea why?
What I did:
1) Under Project  Properties  Recources I added my sound resource called: soundbyte (containing soundbyte.wav). I noticed this creates a Resource folder with the wav file and under my project a Resources.resx file referencing the file
2) In my code I play the file as follows:
Dim audioFile = My.Resources. soundbyte
Dim player = New Media.SoundPlayer(audioFile)
player.Load()
player.Play()
In the Visual Studio Solution Explorer right-click on Resources.resx and select Properties. Build Action. Set to content.
EDIT: The following resource might also help.
http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx
Ultimately, I found a way to play the sound to the client browser (as opposed to the server the asp app is running on) was to follow the techniques in this example: http://www.vbdotnetheaven.com/UploadFile/scottlysle/PlaySoundsInASPX09032006083212AM/PlaySoundsInASPX.aspx
But I found an even better way in my case was to use Javascript, which doesnt' require the Resources technique.
simply embed the sound on the page after the tag:
<embed src="Sounds/jump.wav" autostart=false width=1 height=1 id="sound1" enablejavascript="true">
Then in javascript setup the function:
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Play();
}
Finally play the sound in the browser as needed in Javascript:
EvalSound('sound1');

How to open a particular file with my QT application on Mac when i double click the file?

I'm finding no way how to open a specific file format which can be opened by my Qt app automatically(when i double click the file).Please let me know how to do this.
Thanks!
You need to set up your Information Property List file (Info.plist) in your application bundle to identify files that can be opened by your app. See http://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Introduction/Introduction.html
Specifically, set the CFBundleDocumentTypes key: add items, the file extension and the role of your application (does it edit, view, etc the file).
After you have done this, finder will need to reload the plist. Then you will be able to choose to open files of that type with your application.
In your application, you will need to subclass QApplication and set up a response for QEvent::FileOpen. More information on doing that was given in Qt Quarterly Issue 18.

how to detect changes to a folder in asp.net

I have a folder lets call it ComponentsFolder, it has already some components inside it. If some one inserts a new component, when i start the application it should recognize that a new component has been added and it should extract its path and file size and add to the database (sql server 2005). How can i accomplish this ?
I'm using C# in vs2008.
Take a look at the file watcher class which can detect changes to a file or directory:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
Use a Windows Service to monitor the folder non-stop:
http://msdn.microsoft.com/en-us/library/aa984074%28v=vs.71%29.aspx

Check Folder as Write access,Air app ,Flex

how to know the folder as write permission in air application..in my application i am saving txt file in folder,so that i need to test that folder as write permission...
var file:File = File.desktopDirectory.resolvePath("TxtFolder/DataFile.txt");
i need to check "TxtFolder" has write permission...? before saving the file(DataFile.txt)..how can i do it in flex Air as3
Thanks In Advance...
You can handle ioError event which FileReference dispatches when you don't have permissions to write into directory.
Run the AIR app as administrator and you can even write inside system32 folder of windows. That means anywhere, just anywhere.
You can write to a file with AIR only if the file is under "applicationStorageDirectory".
This is the only folder that has write permision.
If some know more please correct me.

Resources