Is it possible to upload a complete directory structure with Flex? - apache-flex

Is it possible to upload a complete folder with subdirectories and files (in the subdirectories) in Flex?
I am using a Flex / BlazeDS / Spring application. The question is not how to transfer the data to the server. The question is: if it is possible to get access to the files and subfolders (recursive) with Flex?

If you're working with AIR, then yes. Look a the File class. It is a reference to either a file or directory. You can tell if it is a directory using the isDirectory attribute. You can use getDirectoryListing to get a list of all files and subdirectories in a directory.
As far as I know, you'll then have to upload things one by one to the server, though.
If you are using Flex in a web based app, I do not believe what you're trying to accomplish is possible.

No, not if you are talking about a Flex app running in a web browser. In an AIR application it is probably possible, but not in Flash Player in a browser.
The security sandbox doesn't give that kind of file system access, files are only available when selected by a user, via some user action like clicking a button. And then you only get a reference to the file, so it can be read or uploaded, there is no mechanism to for example get the local path to the file as a string or such, and no way to check for subfolders (unless it's an app for the AIR runtime).

Related

ASP.NET Web Site Project with User Uploaded Files

I have an ASP .NET Web Site Project that is being moved into TFS. There is a folder that is used for user uploaded files (e.g., company logos, excel spread sheets, etc.) that need to be kept. I'm trying to figure out a good way to manage these files without placing the folder in TFS (it's really big), and make it easy for new developers to grab the folder structure to their local machines for development.
I was thinking of doing the following and was wondering if this is a good way of doing it, or if there are better alternatives:
Create a script which will, when executed, create the folder structure of the storage folder. This would be placed in source control.
New developers could grab this file and execute it on their local machine.
To make sure the folder is added to source control, get the developer to remove it from their local project.
Store the folder on a NAS - no need for the files to be part of the source-controlled code.

Distributable extensions (modules) for mobile app in Adobe Flex/AIR

I am creating an mobile app in flex 4.6 which will have some default embedded content.
I need to be able to extend this app with modules (additional content libraries) let's say up to 35MB each, the client wants these modules as separate positions(packages) on the app store. How to approach such project in Flex? Is it possible to create mobile Flex app with separately purchasable extensions?
Yes, its possible. Copy over your assets from your Application directory to user directory or application storage directory(if you want to update them). Now use you can write a module or a native app to go and update/copy these files that your app will use.
Keep in mind your Application Directory is write only and protected well. You will not be able to go edit/delete files at least for flex. From what I understand you cannot do this with IOS on the application storage directory, Apple don't like that-
http://blogs.adobe.com/airodynamics/tag/file-applicationstoragedirectory/
http://blogs.adobe.com/simplicity/2010/01/api_tip_dont_abuse_fileapplica.html
You should be able to detect these files and automate whatever you need. With the user directory there is a chance that your sensitive material may be accessible to the technically savvy.

Where should I place resources.resx in a ASP.NET web application?

I'm a newbie with ASP.NET web applications. When I create an ASP.NET web app project, there's a file called resources.resx in the folder My Project. Working in my computer I can access this file and its content without any problem. But when I deploy the application I can't access this file. I've tried copying the file seperately, and the folder (My Project) seperately, with the file in it, but no luck. Is there a way to achieve this?
PS: I've read something about implicit localization and explicit localization but I'd like to know if it can be done this way.
It's embedded into your DLL when you build (compile). So you can't change it when it's deployed.
If you want to see it in your DLL, you'll have to use a tool like Reflector, dotPeek, etc.
You can read more on resources here, starting from the 'Compiling Resources into Assemblies' title (as you know how to use them by now).
Well my suggestion is to use global and local resources.
In production you'll have resx file stored in:
App_GlobalResources: available in all application
App_LocalResources: one for each folder you want resources.
They are XML files visibile and editable.
I use it to allow me to modify string localization resources without recompiling and deploying.
And you can also give a web interface to the end user to allow him to self translate and localize strings at runtime.

How to make an SQLite database as part of the build process - iPhone SDK

I have created a Core Data application in iPhone Simulator. Now when I am testing it on a device, my SQLite database is empty. I have some preloaded settings which I want to deploy when the application is installed.
How can I achieve that?
I have seen a few questions on Stack Overflow, but they don't exactly answer my question.
If you have an existing sqlite-store file you just add it to the app bundle just like you would any resource e.g. images, audio, etc.
If it is read only, you just use the NSBundle commands to supple a path to it inside the readonly app bundle. If you want it writable, you copy the store file from inside the app bundle to one of the writable app directories e.g. Documents or Library, and then open it there as you normally would.

Optimize loading an XAP file with an asp.net website

I've been developing a game using Silverlight 4 and silversprite (http://silversprite.codeplex.com/)
This game is HEAVILY content dependent, using a lot of audio and images. My content folder is around 90 mbs worth of stuff.
And because of that, my XAP file is around 60 MB, and takes 5 minutes to download from the website before any user can start playing.
I am using Visual Web Developer 2010 to create my site and load the XAP. Is there a way where I can take content out of my XAP and put it in my ASP.net site project? Or perhaps upload my content files to the site's storage?
This would make my XAP file much quicker to download.
Anyone have suggestions?
Thanks!
Yes, include in your XAP only content you need for the initial screen. Place other content you need in other XAPs (if you need to and understand the manifest xml) or just plain zip files would do. Perhaps a Zip for each "Level" or whatever.
You can download the Zip with WebClient and then use StreamResourceInfo and Application.GetResourceStream to access content in the zip file.
This blog although aging a little now still carries the basic idea and is still fundementally the current technique to use.
Absolutley its called Application Library Caching. Ive used it very successfully its now a standard operating procedure, particularly nice is its application with resource assemblies.
straight from msdn ...
Resource files are typically any non-executable data file used by your application, such as image, audio, and video files. A resource file can also have specific meanings in certain contexts. For example, in the context of application localization, resource files refer to .resx files, which you can deploy in localized satellite assemblies.
it continues with some really useful info
With Silverlight, you can deploy
resource files in the following ways:
•As individual files in the
application package.
•As individual files that you retrieve
on demand.
•As files embedded in an assembly in
the application package.
•As files embedded in an assembly in
an external library package.
•As files embedded in an assembly that
you retrieve on demand.
which is what is suggested in the other answer(s)

Resources