I'm building an application that is targeting Windows, Mac and Linux soon. I was wondering where should I keep application data such as settings, etc.
Application's installation folder is the easiest choice, but I think that might be a problem with new Vista security model. Besides, users might want different settings.
Is it C:\Documents and Settings\username\MyApp good for both Vista and XP?
Is it /home/username/.MyApp good for Linux and Macs?
Any ideas and/or links to best practices much appreciated.
Thanks!
Juan
Each platform has its own API for finding the user's home folder, or documents folder, or preferences folder.
Windows: SHGetFolderPath() or SHGetKnownFolderPath()
Mac OS X and iPhone OS: NSSearchPathForDirectoriesInDomains()
Unix: $HOME environment variable
Don't hardcode specific paths or just tack a prefix and suffix on the user's name. Also, try to follow whatever conventions there are for the platform for naming the files.
In regards to best practices, Jeff posted an article on polluting user space that you might find useful: Don't Pollute User Space
As a general point, I'd recommend abstracting the implementation of your settings into a 'Settings Provider' and provide different providers for each platform. That way, you can implement the storage of the settings in the manner that best suits the target platforms (for example, a file on Linux or the Windows Registry).
Don't simply adopt the 'lowest common denominator'. Where you have content that must be explicity stored in files, have your settings provider expose the platform-specific location for those files.
I'm not :)
I'm using USERPROFILE in Windows and HOME in Mac/Linux. But even so, I need to know that those are the right places.
Thanks!
In windows you need to go another level deep than just the user profile. Use the Application Data folder.
On Windows I use APPDATA,and on Linux I use HOME.
For Linux/BSD/Solaris:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Never, ever store user data in the application folder. It's just a bad idea.
Most operating systems have a $HOME (or %HOME%) environment variable. That would be the first place to look.
If you want to cleanly support multiple operating systems, though, you're going to have to have some OS-specific code for each that figures out exactly where things need to go. (~/Library for Mac OS, ~/.config for GNOME-based systems, %HOME%/Application Data for Windows, etc.).
What language are you planning to use? Java, for example, has a dedicated Preference API.
Related
So I have this bit of a project planned for Windows Store and Android. Basically, a networking multi-tool coupled with a scripting engine to implement protocols and behavior. Ideal uses being things like "my embedded device uses this simplistic network protocol. I'd like to quickly prototype a way to control it from my tablet".
It's my understanding that the Android market should have no problem with this. However, the Windows Store policy includes a vague clause concerning remote code execution
3.9 All app logic must originate from, and reside in, your app package Your app must not attempt to change or extend the packaged content
through any form of dynamic inclusion of code or data that changes how
the application interacts with the Windows Runtime, or behaves with
regard to Store policy. It is not permissible, for example, to
download a remote script and subsequently execute that script in the
local context of your app package.
Of course, the scripting engine will be sandboxed and such and should be "safe"(completely intepreted, no reflection), but does it violate this policy?
If you build in your scripting engine, and only run local scripts, you will be good. However, if you were thinking to have a repository of scripts that could be downloaded and subsequently run, that would be in violation of the policy as we understand it.
Unfortunately I don't think anyone but someone on that team can answer that (or someone with direct experience in that) because of the closeness to the legal language. Have you tried the Windows Store Appl Publishing forum at: http://social.msdn.microsoft.com/Forums/en-US/windowsstore/threads
In the context of scripting engine example given, unless the app modifies the scripting engine after deployment on user's system such that the representation of protocol/behavior (the script artifact's format) is made to change then it'll be policy violation. Its as if you submit Python interpreter, and at some point in time it abruptly moves onto interpreting ecmascript.
I've recently been exporting my settings from my various IDE's to share with friends. I plan to put them in a shared public location, so I was wondering if IntelliJ exports any sensitive information (saved password hashes, etc) that I should be aware of. If it matters, I'm using the GitHub add-on and the Scala plugin, and the most recent IntelliJ Community Edition.
The reason I ask is (as a new IntelliJ user and longtime Studio user) I know that Studio warns you of possibly sensitive information when you export settings, and excludes it by default. I saw no such warning in IntelliJ and I'm wondering if that's because there's nothing to be worried about, or...
Thanks in advance!
Good question.
I wanted to check it as well, so I exported my settings to look around there. I didn't find any passwords or credentials information there, but there were some things that could be considered "personal":
File header templates - mine for example contained my email there.
Last opened project location path.
Recently opened projects - for "Reopen" dialogue.
RECENT_DIR_STRINGS setting - not sure what are these used for, but it contained around 25 paths of code directories in my file system.
So to sum of - unless you were working on some secret projects on the side, it seems like it's safe to share it with colleagues and friends. Would be careful about releasing the settings to a public domain.
I think this feature is designed to use with their configuration server - a free (if you have the Ultimate edition) service that allows a developer to migrate their settings from one machine to another.
So it probably isn't designed for public sharing.
Is it possible to have an extension read/write to/from the local file system in chrome os?
Thanks in advance?
Yes - you can read/write with the File API:
http://www.html5rocks.com/en/tutorials/file/filesystem/
and you can even hook up your extension to the file system. I've wrote about it: http://greenido.wordpress.com/2011/06/02/chrome-apps-web-store-and-the-new-chromeos-file-api/
It sounds like you want to access the root parent directory. In order to do that you'll have to put your chromebook into developer mode, and when signing in enable debugging options. That will give you the option to view and edit chromeos system files. Just be careful and make sure you create a recovery disc first.
Sure, you can use the standard File API, but chrome provides its own proprietary fileSystem API which, in my opinion, is much easier: https://developer.chrome.com/apps/fileSystem
I'm trying to find a decent standalone webserver that I can load up on a jump drive.
My wife is a photographer, and I'd like to present the clients with their images on usb. When they plug it in, I'd like a web page to load up, and run some jQuery magic to show them a nice carousel of all there images.
So far, this is all fine since it can all be done client side and doesn't need a server at all.
The problem I'm facing is that I'd like some server-side code to be able to read the images out of the directory so that once the interface is built, I don't need to manually create all of the <img /> tags.
If it was primarily going to be used in a Windows environment, I'd have no problem going with IIS Express, since I'm mainly a .NET MVC developer and this would be perfect for me... However, the fact of the matter is that a large amount of our client base is also OS X users.
I did find this Java one jlHttp, and I also found this thread here on SO, but I don't think I understand enough about either one of them to accomplish what I'm looking for.
Thanks in advance for your suggestions.
I'm looking for the same thing, and the two best options I've found were Flying Ant cd web server and Stunnix. Of the two, Flying Ant is cheaper, and I've tested it with success on my project.
I found Mongoose very convenient for this exact purpose. It's crossplatform, lightweight and requires minimum configuration. You may be interested in this project that uses Mongoose to display pictures in a folder tree or FTP directory.
How about Node.js
It says it runs on Linux, OS X, and Windows.
My current role requires me to setup environment which mimics the customer's and perform various checks to replicate and then analyze the problem.
Chances are, I often find working with Windows environments such like XP, Server 2003, Server 2008 is a bit painful without having the handly linux-based shell and some command-line progamming languages such as Perl.
Of course I can just install everything onto the new system and then start working, but it is a bit time-consuming and boring.
So I am wondering which is a better way of working around this?
I can for sure use Qemu to create a portable linux image which doesn't require any host system interference, even without the need of rebooting so to use it. The weakness of this is I have to figure out a way to transfer the files between hosting Windows and embedded Linux. The good part is that I can use all the weapons in Linux's arsenal.
Or I can start looking for a proper portable progamming language such like Movable Python, some variant of Perl or even Lua as a embedded language. Pros: familiar with the language; Cons: have to use scripts to do everything.
My day-to-day activities envolves but not limit to :
Checking the text logs and/or xml.
Grepping important sections from logs for further analysis.
some automate process like application server configuration etc...
automated functional testing - and result comparison
some system admin's job, networking diagnostics, checking process and services, etc...
Any good ideas? Thanks a lot in advance!
While I am a die-hard Linux fan I would recommend in your case to look at Cygwin, preferably on a USB drive or similar. It can live in a single directory, be started with a simple script and end up with (almost) all the Unix goodness, but still being able to access all of the host platform resources.
There are the usual warts related to / vs \ and even worse the case insensitive but case preserving filenames with lot's of spaces in them, but that's equally obnoxious on any other command line.
There is also Mingw but it's scope is more limited I found. It works exceedingly well in a couple of selected target areas, but less so for a GP wide unix-like environment.
I have had a cygwin folder on all my windows machines (and the ones I had to use/repair/maintain) for a very long time now.