I'm writing application that you can find here.
It has function that I use to obtain changelog list:
def getChangeLog():
"""
This function downloads changelog from our repository.
:return:
list of change strings
"""
return [change.decode().rstrip() for change in urlopen(
'https://raw.githubusercontent.com/Acmpo6ou/PyQtAccounts/master/change.log')]
Then I can use this list to display changes that are added to my application, all I need to do after making changes and committing them to repository is to update change.log file, so when user will open my application, dialog will be displayed and it will contain changelog.
But for some strange reason urlopen always downloads old change.log file.
Suppose that I have this in my change.log:
Some fixes.
Something is added.
Then suppose that I made some changes, for example serialization standard is changed. So I update my change.log to this:
Changed serialization standard.
When user opens up my application getChangeLog function will obtain change.log file and then it will show dialog with this changelog to user, so user will see something like this:
Changelog for v2.3.6:
* Changed serialization standard.
But for some strange reason this is what will be displayed:
Changelog for v2.3.6:
* Some fixes.
* Something is added.
It displays old change.log
I tried my getChangeLog function in python console and it realy returns the old change.log, I even tried to use urlopen by itself to obtain change.log file and it still obtains the old one.
Most interesting is that if I will call getChangeLog for a few times it starts returning new change.log
I'm absolutely confused, can someone explain me how to fix this?
Probably the reason is that I always call my getChangeLog function, which downloads changelog, at startup. And since I test my app a lot - I launch it a lot, and getChangeLog is called a lot and we download changelog a lot.
So OS thinks: if we download the changelog so often (and it actually changes rarely), then why don't we perform some caching? And instead of actually download changelog OS provides its cached version.
Then, when changelog actually changes OS still provides its cached version and if I call my getChangeLog function a few times the cache expires and it shows new changelog!
I think this is the problem because when I tried to update on my other machine, which I use not so often and hence where I launch my app not so often, and I saw there new changelog.
Mystery solved.
Related
I have a JSON file I use to store dialogue for a game. However, the changes I make to this JSON file are sometimes not reflected in my game even after hard reloads (I've been doing ctrl+shift+r or shift+F5 for this). I have made sure the changes to the JSON file are saved.
I have this.load.json('dialogue', 'assets/dialogue.json'); in preload(), and this.dialogue = this.cache.json.get('dialogue'); in create().
When I try copy+pasting the contents to a new different file (e.g. dialogue-2.json), and update my this.load.json() to reflect the new file name, the changes do get loaded.
The problem is that phaser doesn't automatic start the loading files, except in the preload function.
If you want to load files in other functions you need to call the start method of the LoadPlugin. Here the link to the official documentation.
The code should look something like this:
function create(){
// some code here ...
this.load.json(/* key and file...*/);
// start the loading of the enqueued files
this.load.start();
// some code here...
}
..., than the files should get loaded.
Update (copied form comments):
to check (and as a tempoary quickfix) if your problem, is a caching issue from the Webserver or browser or ..., you can load the file with a "dynamic" Url.
Just a load the file with a questionmark and random number added to the url, so that each call to the json uses aunique Url.
For Example like this:
this.load.json('dialogue', 'assets/dialogue.json?' + Math.random());
If this solves the problem, there is a caching problem. It could be in the browser, or simply caused by serviceworker or on the webserver.
I have updated my check_mk from 1.6.x to 2.0.x
My custom omd-plugins got messed up and so I started to refactor them for the new 2.0 API with the help of this article.
However, when the time for testing came, I got this:
OMD[my_omd]:~$ cmk --detect-plugins=my_plugin -vI my_host.my_company.de
Error in plugin file /omd/sites/my_omd/local/share/check_mk/checks/my_plugin: "'__name__' not in globals"
I was using sym-links.
For source-control, I have a git-repo. I had put sym-links pointing from the old checks-directory back to the plugin-file in that repo. Starting through the above mentioned guide, I created a new sym-link from the new local/lib/check_mk/base/plugins/agent_based/. Adding the required .py suffix in the process. So now I have 2 sym-links pointing to one piece of code, which I had modified in-place.
Turns out: If you do not delete the plugin from the old location, you will always test the old plugin. With sym-links, you will test the new code in the old environment, giving you that error.
Notice the path in the error-message!
As for the __name__ error itself: It seems to come from doing relative imports import .something. Notice the leading dot. It means "in the same directory as this file". Somehow the old environment was not able to cope with that.
I just downloaded this report called Analyzing and Visualizing Data with F# and am having a hard time just running the first example. This should probably be expected since the report is 7 years. I am running the first script which is as follows.
#load "packages/FsLab/FsLab.fsx"
open FSharp.Data
open XPlot.GoogleCharts
let wb = WorldBankData.GetDataContext()
wb.Countries
I get an error message that reads
Response from http://api.worldbank.org/country?per_page=1000&format=json&page=1:
{ "statusCode": 404, "message": "Resource not found" }
It looks like the url is broken because it seems that the worldbank has updated its api. When I use the url http://api.worldbank.org/v2/country in my browser it works. I noticed when I went to the source code that they have the base url hard coded in, so I was thinking I would just need to add "v2/" to it and it would work, but I am unfamiliar with how to load a edited library into my script.
Yes, your investigation is correct, even banks sometimes change their APIs :)
As for adding the library to your script, it depends on how your environment looks like, but basically you can fix the problem locally and/or globally.
For the local solution, once you compile your downloaded library with modified url, you can load or reference it as described here.
For the global solution, send a pull request that fixes the link in this file, Tomáš Petřiček (the repo owner) is generally active and should merge it. And you will improve the world a little bit.
I note that when cygwin's setup.exe installs packages now, it looks for a file named "setup.zst.sig" first. What's the content and format of this binary file? How to produce a valid "setup.zst.sig"?
This must have been a recent change. Previously it looked for "setup.exe.sig" first. I use the feature (to detect whether "setup.exe.sig" changed) to decide whether my cygwin installation needs to be updated. See also this for an application example.
EDIT: #matzeri:
setup.zst.sig is not yet used.
The "zst" functionality was introduced in the program to eventually replace the
previous compression methods of setup.ini and the packages
const std::string setup_exts[] = { "zst", "xz", "bz2", "ini" };
For checking the update of setup-ARCH.exe you need to use the standard signature.
https://cygwin.com/setup-x86.exe.sig
https://cygwin.com/setup-x86_64.exe.sig
The pop up you shows seems to happen only on FTP mirror server, the HTTP servers
do not produce it.
It is clearly a bug in setup
https://cygwin.com/ml/cygwin/2019-02/msg00153.html
According to the documentation, the .sig files carry a SHA-512 hash of the respective file without that extension, signed with the private key available only to Cygwin the company.
https://www.cygwin.com/faq.html#faq.setup.install-security
Our application uses embedded xulrunner. We override the default PromptService to provide custom dialogs for alert, prompt, etc by
componentRegistrar.RegisterFactory (PROMPTSERVICE_CID, aClassName, aContractID, MyPromptServiceFactory);
where,
PROMPTSERVICE_CID is "a2112d6a-0e28-421f-b46a-25c0b308cbd0"
CONTRACT_ID is "#mozilla.org/embedcomp/prompt-service;1"
When using XULRunner 1.9.* versions, this works perfectly and the call comes to MyPromptSerivceFactory. But, this doesn't work on newer XULRunner versions (>= 4.0)
I have modified the PROMPTSERVICE_CID to "7ad1b327-6dfa-46ec-9234-f2a620ea7e00" (copied from nsPrompter.manifest). While registering the factory I get the error NS_ERROR_FACTORY_EXISTS.
If I continue to use the old PROMPTSERVICE_CID, then nsIPromptService2 is not used instead nsIWindowCreator2.CreateChromeWindow2 is used to display alerts and prompts.
I have googled on this, but I couldn't find a solution to either fix the NS_ERROR_FACTORY_EXISTS error or for MyPromptServiceFactory to be used.
Any help/suggestions?
It would probably be better to use the existing prompt service the way Firefox does it rather than replace it. If you look at nsPrompter.openPrompt(), before opening a modal dialog it will try to locate and call a JavaScript function getTabModalPrompt() in the window containing the browser. It expects to get a promptBox element back and will call methods appendPrompt() and removePrompt() on it. Obviously, you don't have to give it a promptBox element, just something that behaves similarly - and displays a message any way you like.
But if you really want to replace system components, you shouldn't duplicate prompter's CID - use your own one but #mozilla.org/prompter;1 as contract ID (the old contract ID is for backwards compatibility only).