when using multiple domains (sites) in piwik the entered URL doesnt show up in "show code" block on sites administration. Instead it uses the current URL from which the page is called. e.g. http://testserver:8010/ instead http://example.org/
when we prepare the website localy and deploy it to the production server we must use the final domain e.g. example.org instead of testserver:8010 .
This causes a problem on the testserver as the tracking is accessing the production server instead.
IMHO js should just call the /piwik/ js&php scripts on the current server.
If somebody needs it on a different server there should be other config possibility.
I think you're assuming Piwik logging will run on the same web server as the web sites being tracked -- that's not necessarily true for everyone.
"show code" just gives you the basic tracking code to be used on the pages you want to track. You'll need to edit it to access more advanced tracking options.
You might want to consider using server-side include files for your web sites. This makes it rather trivial to swap out testing and production-specific settings. You could extend the idea to auto detect whether in a testing or production mode/environment at runtime and configure itself accordingly.