I am building a simple CEF3 based browser. I want the cache to be removed/deleted after the user closes/ends all the sessions. First I have tried to store the cache on the hard drive by using Cefsettings.cache_path but the folder is empty.
Here is my code:
CefSettings settings;
const char* path = "E:\\test\\Cefclient\\cache";
//store cache on hdd
CefString(&settings.cache_path).FromASCII(path);
The cache folder is empty, also this path: C:\Users\user\AppData\Local\CEF\User Data, which was generated before I changed the path is empty. What could be the problem? And what method do I use to clear/delete this cache?
you can delete the cache path after you called CefShutDown,
you can also confirm you cache path by "chrome://version"
Related
I need to retrieve the proxy settings on Windows. They have been set by an admin, so they reside in the registry at locations:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
ProxySettingsPerUser = 0x00000000 (0)
This entry is giving the information whether the proxy settings need to be read from HKCU(ProxySettingsPerUser=1) or HKLM(ProxySettingsPerUser=0).
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
ProxyEnable = 0x00000001 (1)
ProxyServer = Host:Port
When I try to read them directly, the default value/string is returned (i.e. not the actual contents of the variable):
Code:
#define HKLM_INTERNET_SETTINGS_KEY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"
//[...]
QSettings regHKLM( HKLM_INTERNET_SETTINGS_KEY, QSettings::NativeFormat );
QString read = regHKLM.value( "ProxyServer", "default" ).toString();
logDebug(QString("ProxyServer %1").arg(read));
Other entries in the same location, such as CodeBaseSearchPath = "CODEBASE" or WarnOnIntranet = 0x00000001 (1), can be read without a problem.
THe second approach tried was to read the proxy settings by using the MSDN functions ::WinHttpGetIEProxyConfigForCurrentUser and ::WinHttpGetProxyForUrl. The code is working fine when trying to read HKCU settings (given both manually host-port or as pac file). But when the settings need to be retrieved from HKLM, the following error is returned:
ERROR_WINHTTP_AUTODETECTION_FAILED
12180
Returned by WinHttpDetectAutoProxyConfigUrl if WinHTTP was unable to discover the URL of the Proxy Auto-Configuration (PAC) file.
Is there another approach to retrieving the HKLM proxy settings?
If the approaches described above should have worked, is there a special condition/privilage that needs to be fulfilled before the settings can be read? (in the first approached, the application already has elevated the privilage level to maximum possible, and the manifest file is set to level "asInvoker")
Best regards,
Kornrade
Basically, the hash on the cache busting file is not updating.
class S3PipelineStorage(PipelineMixin, CachedFilesMixin, S3BotoStorage):
pass
PIPELINE_JS = {
'main.js': {
'output_filename': 'js/main.min.js',
'source_filenames': [
'js/external/underscore.js',
'js/external/backbone-1.0.0.js',
'js/external/bootstrap-2.2.0.min.js',
]
}
}
When I first ran the collectstatic command, it properly created a cache busting file named "main.min.d25bdd71759d.js
Now when I run the command, however, it is failing to overwrite that cached file (and update the hash) during the post process phase.
It keeps updating "main.min.js", such that main.min.js is current with my filesystem. A new cached file, however is not created. It keeps the same old hash even though the underlying main.min.js file has changed.
When I manually delete the cached file on AWS, I get the following message from running collectstatic with verbosity set to 3:
Post-processed 'js/main.min.js' as 'js/main.min.d25bdd71759d.js
settings.DEBUG is set to False
Why won't the hash update?
Try using the manifest storage instead:
class S3PipelineManifestStorage(PipelineMixin, ManifestFilesMixin, S3BotoStorage):
pass
According to the django docs here https://docs.djangoproject.com/en/1.11/ref/contrib/staticfiles/#cachedstaticfilesstorage it's not recommended to use CachedStaticFilesStorage.
Your files names for your static files are probably getting cached. So use the manifest one.
CachedStaticFilesStorage isn’t recommended – in almost all cases ManifestStaticFilesStorage is a better choice. There are several performance penalties when using CachedStaticFilesStorage since a cache miss requires hashing files at runtime. Remote file storage require several round-trips to hash a file on a cache miss, as several file accesses are required to ensure that the file hash is correct in the case of nested file paths.
Note this is also documented at django-pipelines http://django-pipeline.readthedocs.io/en/latest/storages.html#using-with-other-storages
I have the following directory structure:
| SITES_FOLDER
|___ WEBSITE1
|___ WEBSITE_CFC
|___ CFC_DIR
WEBSITE1 contains an Application.cfc and some pages. Then I have a component ShoppingCart.cfc inside the WEBSITE_CFC directory that is instantiated on session start using this code:
createObject("component","WEBSITE_CFC.ShoppingCart").Init() />
This works.
Now I move ShoppingCart.cfc to the CFC_DIR directory and change my instantiate code to:
createObject("component","CFC_DIR.ShoppingCart").Init() />
Obviously this does not work because ColdFusion searches for a "CFC_DIR" directory under the root directory "WEBSITE1" and doesn't find it.
I thought this problem would be solved by using mappings so I go to the CFIDE administrator. Server Settings > Mappings.
Logical path: "CFC_DIR"
Directory path: "C:\some\folders\SITES_FOLDER\CFC_DIR"
No luck. So then I tried in Application.cfc:
<cfset THIS.mappings["/CFC_DIR"] = "C:\some\folders\SITES_FOLDER\CFC_DIR" />
This did not work either!
EDIT:
Maybe I understand: if I try to create the CFC from a cfm template, it works.
The error comes up when I try to create it inside the OnSessionStart Application.cfc's method:
Ensure that the name is correct and that the component or interface
exists. Message Could not find the ColdFusion component or interface
C:\some\folders\SITES_FOLDER\WEBSITE1|WEBSITE_CFC\ShoppingCart.cfc.
In other words, it keeps looking for it in the wrong dir.
WHY?
If you're changing the file to /CFC_DIR but it's still using /WEBSITE_CFC it sounds like the cache needs clearing.
Clear the Cache in CF Admin
Clearing the cache can be done manually in the ColdFusion Administrator. After login, the third item in "Server Settings" is "Caching". Scroll to the bottom of the page for buttons to clear the cache.
For development purposes you may want to consider disabling the various caching options on this page entirely - they can be useful for performance improvement on live servers, but are generally an unnecessary hindrance on your development machine.
Clear the Cache Programmatically
If you have an automated deployment, you don't want to have to login to the CF Admin on remote servers and press buttons. Fortunately, you can also clear the cache programmatically:
<cfscript>
createObject("Component", "cfide.adminapi.administrator")
.login("**replace with admin password**");
RuntimeService = createObject("component", "cfide.adminapi.runtime");
// Clear whole cache:
RuntimeService.clearTrustedCache();
// Clear cache for individual files:
RuntimeService.clearTrustedCache("/path/to/file1.cfm,/path/to/file2.cfm");
// Clear component cache:
RuntimeService.clearComponentCache();
</cfscript>
(Code adapted from Charlie's blog entry.)
The API for the Admin Runtime component can be found at http://www.cfexecute.com/admin-api-documentation/runtime-cfc/
I'm pretty new to AppFabric and what I'm trying to understand is how to stipulate that I want data to go into the Distributed cache as well as the Local Cache
I read the post here which is doing this based on config. I am not using any XML config but rather creating my objects with configuration programmatically. I am playing around with the following code:-
// Declare array for cache host(s).
List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>();
servers.Add(new DataCacheServerEndpoint("SERVER1", 10023));
servers.Add(new DataCacheServerEndpoint("SERVER2", 10023));
servers.Add(new DataCacheServerEndpoint("SERVER3", 10023));
DataCacheLocalCacheProperties localCacheConfig;
TimeSpan localTimeout = new TimeSpan(0, 5, 0);
localCacheConfig = new DataCacheLocalCacheProperties(10000, localTimeout, DataCacheLocalCacheInvalidationPolicy.TimeoutBased);
// Setup the DataCacheFactory configuration.
DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
factoryConfig.Servers = servers;
factoryConfig.SecurityProperties = new DataCacheSecurity(DataCacheSecurityMode.None, DataCacheProtectionLevel.None);
factoryConfig.LocalCacheProperties = localCacheConfig;
DataCacheFactory factory = DataCacheFactoryExtensions.Create(factoryConfig);
DataCache dataCache = factory.GetCache("MyCache");
dataCache.Put("myKey", "MyValue");
Am I right to assume that because I have added the local cache config to the factoryConfig object that my cached item will be automatically added to local cache as well as the distributed cache?
And therefore if I want items only cached to distributed cache do I just need to drop off adding the local cache config to the factoryConfig object?
Or do I need two separate factory config objects - one for each cache?
You can see here that, yes, the object will be stored in the local cache, if the local cache is enabled:
When local cache is enabled, the cache client stores a reference to the object locally.
The instructions for "enabling the local cache" are exactly as you've done -- basically just using the DataCacheLocalCacheProperties (although the local cache can also be enabled using app.config settings instead).
So it's exactly as you say -- to use the distributed cache only, without the local, then use a DataCache object taken from a DataCacheFactory that does not use DataCacheLocalCacheProperties.
Note also that items in the local cache can be evicted depending on the policies configured:
The lifetime of an object in the local cache is dependent on several factors, such as the maximum number of objects in the local cache and the invalidation policy.
I've looked at several objects in the "root\virtualization" name space but I have not been able to find where Hyper-V stores the path to the config file for a given virtual machine. I need to get this file path programmatically or at least just the home path of a given virtual machine would be fine as well. What WMI object and field stores the path to a given virtual machine (hint it's not Msvm_ComputerSystem) ?
Get the DefaultExternalDataRoot property of Msvm_VirtualSystemManagementServiceSettingData to get the vm root, and append the Name property of Msvm_ComputerSystem (guid) and ".xml". Even if the VM is created in a non-default location, you'll see a symlink in the default external data root directory referencing the config file.
This is not completely true. In WSS2008R2, when changing default VM data root, nothing is written in the system data root. To find the data root of a single VM, you need to look in Msvm_VirtualSystemGlobalSettingData, search for SystemName property matching your VM GUID and look in ExternalDataRoot and SnapshotDataRoot properties to see the VM related folders.