Where to put application data and temp files on Windows, Linux and MAC if java-application is being lauched using JWS - app-config

Can we allow user to set and save application data and temp data using Java-Application that has beenrun/launch using JWS ? Does it make sense ?
We would like to know if user run JNLP directly then can user save preferences settings on local so when he/she run again JNLP he/she could find his/her last saved settings again.
Where to put application data i.e configuration files, properties file. user download path etc.. and where to put temp files i.e.. logs etc.. on Windows, Linux and MAC if java-application is being launched using JWS ?

I often use java.util.prefs.Preferences, but javax.jnlp.PersistenceService is available to Java Web Start applications. Both represent abstractions that are cross-platform.

Related

WPF app won't run in kiosk mode

I have a WPF application that is designed for a touchscreen kiosk. Users will not have access to a keyboard or mouse. The application runs fine when started normally from the program icon in windows. However, when it is set up to run automatically at startup (by replacing the Windows shell using a registry key), the application does not function properly.
The application reads an XML file that lists available videos, then displays buttons to show the videos. When run in "kiosk mode," it does not seem to have access to the files in its media directory (the XML file and presumably the videos as well). I suspect that because the application is running in place of the windows explorer, it is missing resources it needs for file access that are normally loaded by windows explorer.
I have not been able to find any info on this - there is plenty of info on how to get an app to run at startup, but not much on how to make sure it will actually function in that environment. The PC is running Windows 7 Professional.
Is my assumption about the problem correct, or is it likely something else (e.g. permissions - we checked the permissions, but maybe they operate differently when you replace the windows shell?) If it is because needed resources are not loaded, does anyone have pointers on how to make sure my app loads them?
Perhaps you have file access occurring via a file dialog? This might explain a bit further. What is the minimum functionality needed to create Shell Replacement for Windows?
because you have stopped windows default running explorer.exe , your program can not get access to default xml directory therefore you should specify the complete path for example like below:
stream = File.Open(#"C:\x86\Debug\xml.xml", FileMode.OpenOrCreate);

Access a local file in Silverlight

I want to get the string from a local file (probably a Csharp file), which is attached to current project and its build action was set to Compile. Is there any way to do that. I cannot set the files' build action into Resource.
Regards,
Jawahar
I'm not clear which of these two questions you're asking:
Question 1) Can I get the text of a source file used during compilation, after compilation?
Answer 1) You'd need to set the build action to Content or Resource to do that, but realize that means you'd be shipping your source with your xap, so make sure that's what you want to do (i.e. most employers probably wouldn't like this).
You can have the file added to the xap twice by using "Add -> Existing Item -> (pick the file) -> Add As Linked Item (the little drop-down arros next to Add buton)" and set one to Compile and one to Content/Resource to accomplish this.
Question 2) Can I access a local file on the hard drive of a user of the Silverlight application?
Answer 2) Yes, by using OpenFileDialog and having the user choose the file.
Or, if you're in a Trusted Out of Browser Application (SL4 and above), then you can use the System.IO APIs to access files in My Documents, My Pictures, My Videos or My Music (on Windows an Mac) without needing to prompt the user.
Or, if you're in a Trusted OOB app, running on Windows, you can use COM and access the full file system (up to what the user can see permission-wise), again without prompt.

"Out of browser" web application running at Start-Up?

I've become familiar with the new concept of "out of browser" web applications, supported in the recent Silverlight, JavaFX, Adobe AIR etc.
Listening recently to a podcast on the subject by Scott Hanselman, I've become aware that one of the purposes behind these new architectures is to allow for "desktop-application-feel". Also, I understand some (or all) of these allow for some offline access to a sandbox of resources. This really sounds as if these frameworks could be an alternative to "real" desktop applications, as long as the application does not require messing with the user's machine (i.e. access to peripherals, certain file IO, etc).
I have a very specific question. My application needs to run at start-up. Is it possible to do so using such a framework without requiring the user to download and run a certain executable?
For example, I could always direct the user to download a small EXE that will put a .lnk file in the start-up directory, but I want to avoid such a patch.
To summarize: is it possible to have an out-of-browser web application setup itself to run at start-up without requiring file download?
To further clarify, this question does not come from an "evil" place, but rather from trying to decide whether "out-of-browser" frameworks are indeed a proper alternative to a desktop application, for my specific requirements.
The BkMark example here shows how to start an application on startup using Adobe Air. So, yes it is possible.
So, here's the deal: web apps in general will have a security context around them, and by default won't have access to write to the filesystem (outside of a temp files), access the registry, etc.
One way is, as you said, have the user run something or configure it so the lnk is executed on startup.
Another way, and I think, more in line of what you want, is that the user can run the program himself, click some button in the application, and it's configured.
I know with Java you could do this, but the user has to allow full access to their system, because your app would need to change System configuration. Then you could just configure it (by writing a lnk to your WebStart JNLP in the Startup folder)
For Internet Exploder, Javascript apps do have write access to the disk.
For other (better-secured) browsers you will either need to have a download, or Adobe AIR.
Assuming you are building for Windows, launching an executable at startup can be done several ways.
For user session startup, you can achieve this either by putting a lnk file in the appropriate folder, or with a registry entry. For operating system startup, you can achieve this with a registry entry. There are several permutations:
run application once on boot (UI not allowed)
run application every boot (UI not allowed)
start service every boot according to policy set in registry
run application once on user session start
run application every user session
Since an out of browser application has UI I expect you mean run application every user session and in this case you may as well put an LNK file in the user's startup folder.
I just created a shortcut for an SL4 OOB application, and this was the Target of the shortcut:
"C:\Program Files (x86)\Microsoft Silverlight\sllauncher.exe" 2635882436.localhost
A search of my disk revealed that location 2635882436.localhost is a folder.
C:\Users\<mylogin>\AppData\LocalLow\Microsoft\Silverlight\OutOfBrowser\2635882436.localhost
I rather doubt an OOB app of any type could place a shortcut in the Startup folder unless you somehow obtained Full Trust.

How do I find the database file on an Android virtual device?

My plan is to prepopulate a database on a virtual device and then include database in the distribution of my app.
However, I can't find the database file.
Is it on my hard disk some where?
How do I get it?
I tried connecting using adb, I did an "ls" and then got really scared by this obscure list of directories:
sqlite_stmt_journals
cache
sdcard
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
Even when I cd over to /data/data/your.package.here/databases I still do not have access to the actual database file. I can't use sqlite3 or do a pull on it. Is there a way to change permissions?
This works fine on my emulator, but fails on the actual device
adb pull /data/data//databases/mydb.db .
It should be in /data/data/your.package.here/databases, where your.package.here represents the package associated with your application, as defined in your AndroidManifest.xml file.
If you want to navigate to your database (which is located /data/data/your.package.here/databases), make sure you are a root user while navigating shell. To do so, type "su" once you enter the command prompt. When you are a root user, you can navigate wherever you want.
The blog post below gives a good solution of how to find and access your database. The post talks about using busybox, which provides useful utilities at the command line, to find your database and gives a few useful examples on how to use sqlite3 to access the DB and tables.
http://davanum.wordpress.com/2007/12/11/android-how-to-poke-around-the-sqlite3-databases/

Icons from remote files

I have started coding an FTP client application (for fun). I’m trying to represent remotely hosted files with icons. For example, let’s say I’m browsing the root folder of an FTP server (/) and want to display the Backup.zip file with the icon association from that client operating system. On some systems, this may be the windows compression icon and other operating systems this may be WinZip or WinRAR icons.
I have the client browsing local files with the SHGetFileInfo() function. This works great with files that are local, however, this function requires the physical file in order to retrieve the associated icon. So, this will not work with remotely hosted files. I have found some samples of loading icons given a file extension, and this is really where the question comes in... What would be the best strategy to get icons associated to remote files?
Go to the registry every time and look up extension to icon associations
Create 1 byte files with each extension and use the SHGetFileInfo() function for remote files (using local 1 byte files as association for remote files)
Other strategies???
What would a professional software company creating an FTP client do?
Thank you for your time.
-Jessy Houle
I suggest that you don't go to the registry every time: go if you need to, but if you've already been for a given filetype then remember/cache that result (within your program) and reuse it.
Use the procedure here from a previous Stack Overflow question on the same idea and uses the registry instead of an actual file.
How can I get the filetype icon that Windows Explorer shows?

Resources