I want to change disk cache directory path for PhantomJS. It's required for my product.
When I'm using --disk-cache=true --max-disk-cache-size=1024 option in phantomJS command line.
It works perfectly. But cache is saved to this below directory. I want to change it to my specified directory.
C:\Users\Administrator\AppData\Local\Ofi Labs\PhantomJS to my_dir
Is it possible or not?
This seems only possible by compiling the code yourself with the necessary changes.
The method writableLocation in the file qstandardpaths_win.cpp handles the paths. There you can set your own path and compile it for your platform.
I suggest to implement it dynamically to add a command line flag for this and create a pull request so that it will be merged back into the project. I see you already opened an issue there.
It has been implemented recently, and in phantomjs v2.1.1 or newer you can use --disk-cache-path=...
https://github.com/ariya/phantomjs/commit/c9e30ebafdeb42efe33900da7823142e146b0a1d
Related
We currently have a legacy solution (on Windows) where the source code cannot be changed, and it is hard-coded to use paths in a specific location \\Server1\folderA for example on really old servers where data-content is stored.
We now have new servers that we want to use instead to hold our data content, but cannot update the hard-coded paths in the legacy solution to use these directly.
Is there anyway to use an alias, or a redirection from one fileserver to another, so that when something tries to get data content from path \\Server1\folderA it gets redirected over to \\Server2\folderB for example and therefore uses the files on the new server?
Thanks
I think I have found a solution to my own problem:
Open a Command Prompt with Administrator privileges and use the following command:
mklink /d \\Server1\folderA \\Server2\folderB
Title. It's only allowed to save to a certain directory, but is there a way of making an executable made with it update itself? I've got the code to check if it's out of date (HttpGet), but not sure how to intall the newer update.
Main reason is people are complaining about having to repeatedly redownload my RPG. Would it be easier to package it with a C# auto-Updater they can run?
You can not make the .love file "update itself". That is not possible, unless you use the operative system's package manager or something similar (apt-get in Ubuntu, the app store on mac, and whatever microsoft uses, if it has it).
If you don't want to do that, then the second best way to make that work would be making your love2d executable a "shell"; an "empty game" that simply downloads stuff from the internet, and later on it executes some function that initializes everything, including the proper game.
As jpjacobs says, you can download stuff from the web using LuaSocket (which is already included in LÖVE 0.7). For example, this is how you download a png (I've copied the code from here):
if not love.filesystem.exists("expo.png") then
local http = require("socket.http")
local b, c, h = http.request("http://love2d.org/w/images/e/e3/Resource-AnalExplosion.png")
love.filesystem.write("expo.png", b)
end
There's also a way to uncompress data using the GNU unzip algorithm using pure lua. It's implemented by the /AdvTiledLoader/external/gunzip.lua file in Kadoba's Advanced TileLoader.
So I guess you can make a game that:
Starts by reading a file called version.lua, and comparing it to a file in your server (http://www.your-server.com/latest-version-number). That file simply contains a number, like "48".
If no file and server could not be contacted, then error "could not download game".
If no file, or current version < latest version from the server, download zip file from server (http://www.your-server.com/latest.zip)
If latest.zip downloaded successfully, erase everything inside the /latest directory and uncompress latest.zip on the new latest. Update version.lua with the new version (return 48)
Detect when you are working offline - If could not download latest.zip or version, but there's already a version.lua and latest folder, give just a warning, not an error.
Require the file that contains the real game; probably something like require 'latest.main'
Notes:
I'm not familiar with luasocket. It is possible that there's a way to get the 'last updated' date from http://www.your-server.com/latest.zip, so you can simply get rid of the latest-version-number stuff.
I haven't used gunzip.lua myself. I don't know how it handles multiple files, or directories.
My first guess would be using LuaSocket. You can have a small file containing the current version number, have that downloaded on startup, and then decide whether an upgrade is necesarry or not.
I have installed Firefox extension by double clicking abc.xpi file. Now I want to know where those files are copied, so that I can delete them. Or any other way to uninstall an extension except by going to Addons & then uninstalling it manually. I want to uninstall it programmatically.
The files created as part of the extension installation process are stored within the Firefox profile which you were using at the time. If you aren't aware of setting up more than one profile, you're probably using the "default" one which you got when you installed Firefox. Messing around with stuff within the profile directory can be extremely unwise, but if you want to try it you might want to think about:
locating the profile directory - this will depend on your operating system, but looking under the directory specified in the environment variable USERPROFILE would be a good start
finding the id for the extension you wish to remove
removing the subdirectory corresponding to the extension id under the extensions directory within the profile
remove the reference to the extension from the extensions.ini file
possibly remove the extensions.rdf file completely, to allow it to be regenerated
I am currently unaware of an automated way of doing this from the command line, if you don't want to do it yourself, but there might be tools out there to do it for you.
I am using Xcode as part of my build for OS X, but since it is not the only IDE used, files may be added from the file system directly.
As far as I can tell, there are two ways of adding folders:
Folder reference picks up all the changes on the file system but does not register any of the files as sources.
Recursive copy allows for the files to be built but I need to constantly maintain the file structure
I am wondering if there was a way to setup Xcode to build all of the files that are a part of the folder reference or failing that, if there is a quick script to automagically fix file system discrepancies.
I came up with proof-of-concept solution that works, but will require some work to use in production. Basically, I set up a new "External Target", which compiles all source files in a given directory into a static library. Then the static library is linked into the Main Application.
In detail:
Create a directory (lets call it 'Code') inside your project directory and put some source code in it.
Create a Makefile in the Code directory to compile the source into a static library. Mine looks like this.*****
Create an External Target (lets call it 'ExternalCode') and point it to the Code directory where your source and Makefile reside.
Build the ExternalCode and create a reference to the compiled static library (ExternalCode.a) in the Products area of your project. Get Info on the reference and change the Path Type to "Relative to Built Product".
Make sure ExternalCode.a is in the "Link With Binary Libraries" section of your main target.
Add the ExternalCode target as a dependency of your main target
Add the Code directory to your "User Header Search Paths" of your main target.
Now when you drop some source files into 'Code', Xcode should recompile everything. I created a demo project as a proof of concept. To see it work in, copy B.h/m from the 'tmp' directory into the 'Codes' directory.
*Caveats: The Makefile I provided is oversimplified. If you want to use it in a real project, you'll need to spend some time getting all the build flags correct. You'll have to decide whether it's worth it to manually manage the build process instead of letting Xcode handle most of the details for you. And watch out for paths with whitespace in them; Make does not handle them very well.
Xcode's AppleScript dictionary has the nouns and verbs required to do these tasks. Assuming your other IDE's build scripts know what files are added/deleted, you could write very simple AppleScripts to act as the glue. For example a script could take a parameter specifying a file to add to the current open project in Xcode. Another script could take a parameter to remove a file from the current project. Then your other IDE could just call these scripts like any other command line tool in your build script.
I'm not aware of any built-in functionality to accomplish this. If you need it to be automatic, your best option may be to write a Folder Action AppleScript and attach it to your project folder.
In all likelihood it would be a rather difficult (and probably fairly brittle) solution, though.
It's not pretty, and I think it only solves half your problem but... If you recursively copy, then quit xcode. Then you delete the folders, and replace them with simlinks to the original folders, you at least have files that are seen as code, and they are in the same files as the other IDE is looking at... You still will need to manually add and remove files.
I sort of doubt that there's a better way to do this without some form of scripting (like folder actions) because xcode allows you to have multiple targets in one project, so it's not going to know that you want to automatically include all of the files in any particular target. So, you're going to have to manually add each file to the current target each time anyway...
One way to import another file from add/existing file:
and set your customization for new file that added .
see this
I've got a Setup & Deployment Project in VS2005. One of the files that i'm installing is a SQLite data file.
I'm about to release a new version for the software, but i found that if i run the update on existing installation it overwrites the data file.
I've got an updated data file in the setup project so it's newer than already installed, but i don't want to overwrite it.
I've tries setting the Permanent property for that file to True, but to no avail.
Any suggestions?
Ok, here's a workaround that i've used:
In my setup project I've renamed my blank database file from Database.db to Database-blank.db.
In my app i'm checking if Database.db is missing and copying Database-blank.db to Database.db if it is.
then just load existing Database.db
This way i can ensure the local copy of the data file (Database.db) does not get replaced by newer versions of the software.
In MSI, the best way would be to make a record in the Upgrade table, determining whether this is an upgrade installation, and setting a property if it is. Then put the data file in a component, and place a condition on the component. Alternatively, make an entry in the AppSearch table, checking for the presence of the file (through the DrLocator table).
I don't know whether a Setup & Deployment project supports any of this. So as a fallback, install the file with a different name, and then create a custom action that copies over the file conditionally.
Because VS2005 setup when upgrading a program first it remove the original installed instance
and then install a new one, so for that the file will be removed every time.
to avoid replacing or overwriting the file I suggest the following:
1- mark the file as readonly in the setup project.
2- mark the file as permanent in the setup project.
now after upgrading the file it will not be overwriten, but your application can't deal with this file because it's readonly, so in the startup of your application check if the datafile is readonly uncheck it.