I am trying to get started on debugging my Polymer application. I have hand crafted it by copying what I think the PolymerCLI Polymer init does.
I am not sure what is loading service worker. The default one for development just does a console.info() call saying its been disabled for development.
When I use Polymer serve to serve my application on localhost: 8080, I get the console.info message, despite there being nowhere where I actually load the file service-worker.js . Because the application is much more complex (and I am trying to use http/2) I have my own node based server as well. When I run that and then fetch my application in the browser, service-worker.js does not get loaded and run.
What is Polymer serve doing to enable it?
It could be that a different application which used the same source (e.g. localhost:8080) registered and installed a service worker.
Open up the Application panel in Chrome Canary to inspect / delete the service worker.
If you can't access Chrome Canary, open chrome://serviceworker-internals, find the scope that matches your app, and click Unregister. There's also an option at the top of serviceworker-internals which lets you open a DevTools window and pause JS on the SW. Enable that option and you'll be able to see which SW is running.
Related
I've not been able to find straight forward instructions on how to avoid caching problems when developing a js app with vue cli.
For example, when we deploy a new version of the app with npm run build, we can see that a new app.xxxxx.js is deployed, where the xxxxxx part is a new hash that I guess webpack is generating.
We host this in an Windows 2012 IIS Server.
Now when I tell my customer we have solved the latest issues that have been found in the app, it seems that they have caching problems, as they still have the previous version, even if they close and reopen the browser.
Is there any way to avoid this behaviour?
Try to follow the below steps which help you to disable the cache in iis.
1)Open iis manager.
2)Select the site and click on the "HTTP response header feature".
3)Click on the set common header link from the action pane.
4)click the checkbox "expire web content" and select "immediately" radio button.
You could also set output caching in iis:
Configure IIS Output Caching
On a former project I was working on there was a manifest.json file while allowed the app to be a progressive web application.
However even now on different projects I can see that my browser is requesting the service-worker.js file from the backend ie:
GET /service-worker.js 404 557.926 ms
How can I turn this off within my browser so I don't see these errant logs come through my app?
You need to unregister the service worker like such:
https://www.codementor.io/#himank/how-to-unregister-service-workers-n8mzf5jce
In case the link should stop working, these are the steps for Chrome.
open the dev console
click "Application" tab
click "Service Workers"
click "Unregister"
I tried out your new feature "xedbug on demand". I stuck to these guides (https://www.jetbrains.com/help/phpstorm/2016.3/configuring-xdebug.html and https://blog.jetbrains.com/phpstorm/2016/06/xdebug-on-demand-for-cli-php-scripts-in-phpstorm-2016-2-eap/).
I see that in the php Server menu when I add the path to the xdebug that PhpStorm recognizes it (the label switches from "not installed" to "XDebugger 2.4.1").
So everything seems to be fine but when I use the debugger via the bug-icon, it never attaches/stops for the breakpoint.
I activated the xdebug-Logfile, but it stays completely empty.
Furthermore I commented everything xdebug-related out in the php.ini.
The xdebug-port is still on 9000 (default).
Any ideas what I can do about it?
Update: I'm using the debugger via phpStorm's "PHP Web Application" and the debug-icon. I'm debugging php files which are executed via an apache vHost.
PS: Checked IntelliJ forum and Stack posts, didn't find anything helpful though...
"Xdebug in demand" option works for CLI debugging only (Run/Debug Configuration of "PHP Script" type; will also work for other CLI-mode configs, e.g. "PHPUnit") be it local or remote.
Quote from the aforementioned introduction blog post:
To use the great new feature, first, you need to disable Xdebug for command line PHP scripts.
That option does not work for web pages served via web browser (e.g. Apache/nginx/IIS) or when just listening for any incoming debug connections (Zero-config approach) where actual debug is initiated outside of IDE.
The reason is very simple: when launching debugger for CLI script, IDE launches your php executable (your configured PHP Interpreter, e.g. php.exe on Windows) with additional parameter (-z: check php --help output or here) that can load such additional extension.
But when you debugging a web page then whole PHP is not controlled by PhpStorm: it's your web server (Apache/nginx/IIS/etc) that communicates with PHP .. and you cannot pass such arguments at this stage.
I am trying to follow the instructions from here to enable offline support (Service worker) in my polymer starter kit clone.
However, after making the changes in gulpfile.js, index.html and elements.html, I keep getting the following error whenever I refresh the page.
Also if I change the throttling setting to offline in Chrome Developer Tools and refresh, the page comes back with the "Unable to connect to the Internet" message so clearly the caching isn't working.
Is there anything else that I need to do?
Update: Just decoded the url (i.e. http://localhost:5000/bower_components/platinum-sw/platinum-sw-register.html&clientsClaim=true&skipWaiting=true&version=1.0) in the error message and ran it in Chrome and got a 404 error. If I remove everything after .html then the file can be found though.
I was having the same issue and turned out it's because the platinum-sw-cache is set to disabled in the dev development, which means service worker will not work if you run
gulp serve
So to test the PSK offline, you need to call
gulp serve:dist
You can also ignore that ERR_FILE_EXISTS error as explained by #pirxpilot.
I'm using the "b-g" Processing build system for Sublime Text 2 (link) which works perfectly fine.
It's using the following command to initiate the build via the processing-java executable (I'm on Windows btw):
"cmd": ["processing-java", "--sketch=$file_path", "--output=$file_path/build-tmp", "--run", "--force"]
This will open the Processing application in a Java Environment.
Since I am targeting mobile devices I'd like to use JavaScript Mode though (the Processing IDE will fire up a server listening to some strange port serving a web page that you can access using any browser when exporting a sketch that way).
As I would like to avoid having to use the Processing Editor (usage of "foreign" editors has apparently been disabled in v2) I was wondering if I could trigger that behavior via my build system / the CLI?
Unfortunately I cannot find any information on that at all on the web and $ processing-java --help doesn't mention export modes as well.
No, but you can concatenate your .pde files into one source file, and then run that through the "processing-helper" for processing.js. If you clone the Processing.js repo (links on https://github.com/processing-js/processing-js) then you can load the ./tools/processing-helper.html in a browser (ideally from localhost, not file), and then just paste in your code, hit "convert", and out comes the compiled JS source.
That said, there's not all that much benefit to precompiling, since Processing.js is a browser technology. It's not "an editor", a sketch running using Processing.js is just a webpage, and all mobile devices support web pages.