I'm building a tool in nw.js.
The user can preview his creation, which opens a new nw.js window.
I would like to save temporary files somewhere for this preview.
Is the recommended place to save them in nw.App.dataPath + '/Cache/[userPreview]', where [userPreview] is a name I make up?
For versions >= 0.13.x, I've been saving user-specific files to the directory right above nw.App.dataPath. nw.App.dataPath returns the path in the user's profile folder, including the Default profile (from Chromium's point of view) folder. So, I've been stripping off the Default from the path and using that.
For versions < 0.13.x, I just use the equivalent of nw.App.dataPath, since Chromium at those versions doesn't include the new profile folder (Default, by default).
If you follow this convention, you might want to also create another folder in that location to help delineate that it is the Preview folder where all the preview files are located. For example (for version >= 0.13.x): nw.App.dataPath.replace('/Default', '/Preview/[userPreview]').
I honestly don't know what the best practice is, but I hope that helps.
Related
I have Website configured in CQ5 AEM. I am trying to move some files to a folder on the same location. I have large count of files, each and every i should select and click on move to move files.
Any suggestion to move multiple files to a folder in the same location in adobe experience manager. In spent 1 day to send 150 files to a folder. I have almost 10000 files to move. Please suggest me to reduce my work.
I got some reference
http://docs.adobe.com/content/docs/en/cq/5-6-1/wcm/page_create_edit.html
but it is showing for 1 single file using move option.
Appreciate and Thanks in advance. It helps me alot.
If it is really about files, then you can try to connect to cq instance via WebDav and operate with files like in any file manager (but it does not work for me with pages and some other node types).
Otherwise, I would suggest to create package in package manager with all files (you want to move), download it, unzip, move required files to another folder, pack it back to package, upload and install. After that you can delete files in old location.
In second case, you, probably, will have to modify filter.xml according to new files' location.
I have a web-app(browser based) which needs to access a folder full of icons that resides outside the web folder.
This folder MUST be outside the web folder, and would ideally exist outside the project folder all together
however, when specifying the path to the folder neither "../" or making use of a symlink will work
when the page attempts to load the image I always get
"[web] GET /Project|web/icons/img.png => Could not find asset Project|web/icons/img.png."
however I set the image source to "../icons/img.png"
how can i get dart to access this file properly
PS: I attempted a symlink to another part of the filesystem (where the images would be kept ideally) however this did not work either.
The web server integrated into DartEditor or pub serve only serves directories that are added as folders to the files view. When you add the folder to DartEditor you should be able to access the files. This is just for development.
You have also to find a solution for when you deploy your server app. It would be a hazardous security issue when you could access files outside the project directory. Where should the server draw the line? If this would be possible your entire server would be accessible to the world.
Like #Robert asked, I also have a hard time imaging why the files must not be in the project folder.
If you want to reuse the icons/images between different projects you could create a resource package that contains only those images and add them as a dependency to your project.
If you want a better answer you need to provide more information about your requirements.
If you wrote your own server (by using the HttpServer class) it may be possible to use the VirtualDirectory to server your external files.
Looking at look the dartiverse_search example may give you some ideas.
You could put them in the lib directory and refer to them via /packages/Project/...
Or in another package, in which case they would be in a different place in the file system. But as other people have said, your requirement seems odd.
Is there a recommended way to initialize the data in Isolated Storage for Windows Phone 7 application before it is run for the first time? Right now the best solution I can think of is putting a flag in IsolatedStorageSettings and checking for its presence on in the application Launching event. If the flag is not present I initialize several objects in code and save them to Isolated Storage and set the flag so they are not set the next time the application is run. Is there a better way to do this? Should I add the objects in serialized state as some kind of resource or it is acceptable to initialize them in code? I expect that they would require like a thousand lines of code.
Well if you can create your files and add them to the project. And if you are sure that you will not be editing your files than just keep them like that. The files will go into your installation folder.
Or if you think that you are going to edit them and want to keep the changes saved, than copy them from the installation folder to the application storage folder.
Here is a link in which a database which was added as a reference to the project is copied from installation folder to storage folder of the app.
http://msdn.microsoft.com/en-us/library/hh286411(v=vs.92).aspx
Do the same for your files and everything will be fine.
The second part of your question. Well after this just check for one file/folder in the app storage folder and if it says yes it is there than do not copy your files from installation folder to application storage folder.
And if you are trying to make the files when the application launches than just add a check before the creation code is run. Where you will search for a file/folder existence. And if it exists do not run the file creation code.
It is possible to export settings from one project and import them in another.
However, it seems that only "include Paths" and "Symbols" can be moved to a new project this way.
Is there any reliable way to copy all settings? Particularly I would like to copy the linker settings for my embedded ARM project.
I do not want copy the settings manually, as this is something that will have to be done often by at bunch of people.
The easiest way I've discovered to duplicate the settings for a project is to use another workspace. It takes a few steps to set up but you should only need to do it once.
1. Start a 2nd copy of eclipse and select or create a new workspace.
2. Import your baseline code.
3. Rename the project to something generic like NewProject
4. If your project has files you don't want to be imported into new projects delete them. I find it helpful to keep a few (like main.cpp)
Now back to your original workspace.
1. File->Import->Existing Projects into Workspace Next button
2. Use Browse... to go to your newly created workspace and select NewProject.
3. Check the Copy projects into workspace checkbox.
4. If you have warnings about the project already existing try clicking the Refresh button and make sure you don't have a folder in the current workspace with the same name. [ You can delete a project but not remove it from the hard disk so you have to make sure the intended folder name is not in use. ]
5. Rename the project to your desired name.
6. Start coding...
All the toolchain settings, include paths and library paths should be intact. It seems like a lot of work, but once you do it once its not too bad (as long as you can keep duplicating that one project).
This can be done in simple steps. Useful if you do not want to create new workspaces.
Open the project in the workspace.
Click on project and copy.
On the project tab area, paste the project.
Eclipse asks for a name, rename it to a new project.
Click Ok.
My requirement is,In my project,i maintained a folder which have set of images which are uploaded by user.but user can upload same named image n number of times.to overcome this overhead i planned to maintain versioning to each image which are same (same named). please advice me right solution –
There is no right solution for all purposes. You can build version control yourselg, renaming old files ans moving them to separate subdirectory, or you can tap existing version control systems like git / svn / cvs / rcs / ccss / mercurial - some of them have java libraries available and they all suck to different extent. Just pick one that you like.
Another alternative would be to use some CMS system, but usually they suck ever more.
Why do you need to keep track of older versions anyway?
How about indexing them all using the database (if you have one)?
When an user uploads the file, save it with some scrambled name like funnycat-12345timestamp12345.jpg. Then store the upload date, original name and file name in the database. Now, whenever you need a file with name "funnycat.jpg", you do a query SELECT * FROM files WHERE original_name='funnycat.jpg' ORDER BY upload_date DESC, and you have whole revision history for that file.