How to check out code from old version with Google docs add-on script - google-apps-script

I made an add-on that worked on 05/21.
At some point between then and now it broke.
The old code is no longer in the revision history which only goes back to 05/22.
I have tested version 1, and it works, which means it's using the right code.
I can run this working version, but I don't know how I can re-open the code for it.
How do I view the code for version 1 of my add-on?
EDIT
From #BryanP's comment, I've been informed that there is an existing request for this here.

It's a bit round the houses, but you could:
Create a test project
include the older version of your library
Use the debugger to step into the older version of the code and then copy and paste it somewhere safe.
I use this technique to poke around in the libraries I'm using.

Related

VS Code change link for marketplace

I have before worked with Python extensions and configured PIP to point to our artifactory in my company, now I would like to do the same with VS Code.
I would like to be able to change the path of where VS Code downloads its extensions, to our own artifactory.
We want to control what users have which extensions, and don't want them to be able to download freely.
Can anyone please help me to which file or configuration I can make to point it to another site?
This is not possible at the moment. There is already an issue concerning this feature https://github.com/Microsoft/vscode/issues/21839 .
You can however disable the Gallery as mentioned by Thally by removing the "extensionsGallery" part from VSCode\resources\app\product.json.
And offer the vsix you want your users to have via any differnt path for selfservice or even just preinstall them under %USERPROFILE%\.vscode\extensions.
VSIX can be downloaded from the store for offline use as Mentioned by t3chb0t in his answer to how-to-install-vscode-extensions-offline
If you are still running into this, an updated answer is to use https://github.com/LOLINTERNETZ/vscodeoffline
So far it has worked well for us in a completely offline environment. The only gotcha that we have run into is that some extensions attempt to reach out and download additional things from github or elsewhere when first run which does not work if you are offline like in my situation. However, if you are online and simply want to control which extensions are available, I think this project will do the trick for you.
Anyway, by adding a product.json file to their user directory or setting env vars, your coworkers will be able to change the marketplace again: https://github.com/VSCodium/vscodium/pull/674

Can't get Hello world example to work as a web-app

I am a total newbie to google-apps-script, but I can't believe the problem I'm having. I can't even get the Hello World! example to work as a web-app.
I have copied and pasted code from google's documentation website, and I still can't get it to work. (I tried more complicated stuff first, but then I started trying simpler and simpler code until I bottomed out with the below problem.)
When I publish the following code as a web-app:
function doGet() {
return ContentService.createTextOutput('Hello, world!');
}
Instead of seeing "Hello, world!" in the browser, I get the following error message:
The script completed but did not return anything.
I'm really at a loss here. I don't know how to try anything simpler, and again, the code snippet above was copied and pasted directly from the Content Service documentation page (https://developers.google.com/apps-script/reference/content/).
Any help with this problem is greatly appreciated.
Thanks in advance.
Thanks for the response Alan.
I created a new project and pasted the Hello world code into it, and it worked. I'll just work from this new project going forward.
...
Now that I have a few more minutes of experience, I think my problem was with version control. I thought that when I made a change in my code and updated the current version, then the current version published as a web app would reflect this change in my code. However, it seems that you have to create a new version of your code in order for your newly-published web-app to reflect the most recent changes in your code. My problem was that I was not creating new versions as I changed my code, so I kept accessing the old code which was always the same as when that version was first created.
(Using the Test web app for your latest code link (located in the Deploy as web app dialog which is accessed from the Publish menu) did reflect my most recent changes, but this was not adequate for my testing purposes since I was sending arguments to my web app url. (The latest code link only calls your web app with a read-only version of your web app url that has no arguments appended to it.) In order to properly test the web app with all arguments appended to the url, I needed to re-publish the new code under a different version number in order for those changes to be reflected in the web app that was published. Only then I could access this url that pointed to my latest code with all of my arguments appended.)
Again, just hitting the Update button in the Deploy as Web App dialog without specifying a new version does not actually update the current version with your new code. In order for your latest/newest code to be deployed you have to create a new version of your code that will reflect your latest changes. In order to create a new version, you first have to choose Manage versions... from the File menu and then save a new version that reflects your most recent code changes by hitting the Save New Version button. Once you have done this, you can choose to publish this new version in the Deploy as Web App dialog. The url for your web app will then access whichever version of your code that you last deployed/published.
I know that everyone on here probably already knows this, but I thought I'd clarify what my problem was (problem understanding the work-flow of the code-publish cycle) in case any newbie in the future also runs into this problem.
<<<<<UPDATE>>>>>
See the answer from Serge below about how to use the dev version of your web app url with parameters appended to it. In many cases, this can alleviate the need to create new (exec) versions of your web app as I described above if/when you are making only incremental changes to your code.
In order to get hold of your dev url in the browser address bar so you can copy it for further use (instead of getting the script.googleusercontent.com... url that is used to temporarily serve the content/output of your web app) just call an undefined function in your web app code. Then use the Test web app for your latest code link to call the dev version of your web app. This will cause an error page to be returned, and your dev url will then be available for copying in the browser address bar.
Following these steps I was able to get the Hello World Script to run:
Go to script.google.com
Paste your above code into the script area.
Save as Hello World.
Publish as version 1.0.
Go to the url it generates and "Hello, world!" is now displayed.
You can now also test the web app with the latest code when publishing.
Your statement that the .dev url is not able to support parameters is not exactly true (The latest code link only calls your web app with a read-only version of your web app url that has no arguments appended to it). Actually it does just like the exec one but you can only call this url directly from the browser (and not from another app) because only you can access the app using this special url.
demo code :
function doGet(e) {
var valToReturn = ContentService.createTextOutput('the parameter was '+e.parameter.val).setMimeType(ContentService.MimeType.TEXT);
return valToReturn;
}
The test .dev url with parameters goes like this :
https://script.google.com/macros/s/AKfycb___vWxs/dev?val='test'
and the return you get in your Browser is :

How to disable Google Chrome source compression "?body=1"?

I'm trying to debug some JavaScript for a Rails project and its incredibly frustrating to go line by line when the source code is compressed in the Sources developer tab.
I know this compression is done by Chrome through the body variable. What I want to know is if there is any way to stop Chrome from compressing files in source view, i.e:
\application.js?body=1 --> \application.js
Thank you for your time.
Compression is being done by Rails. Disable it in your configuration:
# config/production.rb (or whatever environment you're in)
config.assets.compress = false
You might want to investigate a new feature in Chrome called Source Maps.
Source Maps allows Chrome to map the compressed source code it receives to the uncompressed original, which in turn means that you can debug the code, even though it's been compressed.
This feature should help you get around this kind of problem without having to change the compression settings on your server.
You can read more about it here: http://blog.mascaraengine.com/news/2012/4/16/sourcemap-support-in-chrome-greatly-improves-debugging.html
I believe this feature is still in test and not yet in the final release version of Chrome. I'm sure it will arrive in due course, but for the time being you may need to install the "Canary" version of Chrome, ie the pre-release version that includes all the forthcoming features that they're still working on.

Problem using Appmobi XDK!

plz anyone can tell me how to open our project at Appmobi XDK. i am facing a problem that i have install it but its not allow me to open projects. when i tried to open my project a message comes unable to open a project.
now i need your help guys.
Thanks
The very first thing you need to do is to go to xdk.appmobi.com (in google chrome) and download/install our xdk. (Need Java installed also)
During the install you will need to set a default appmobi directory. This is where your app files will be stored.
Create a new app from within the XDK. You can then click the edit the source code button in the tool bar to edit your code. Here you can update the file with your own code.
You can check out a video that explains the xdk at http://www.youtube.com/watch?v=MWV8kOJlGmc Some things might have changed visually with the current version of the XDK, but essentially its the same.
Some things have changed/moved around the screen since we made the video, but essentially its functionally the same.
Check it out as it will give you tips/how To's to using the XDK.
Also, posting in our forums (forums.appmobi.com) will get your questions answered sooner!

Google Maps API non-minified/obfuscated

Does Google provide non-minified / non-obfuscated versions of their various javascript API's?
For example, I'm using their LocalSearch control and getting a cryptic error "a is null". Setting a breakpoint in Firebug is not very helpful because I'm 3 levels deep in minified code.
There isn't a non-obfuscated version of the API (it isn't an open source project). If you post a link to the page in question, we might be able to help debug the issue?
I have seen the "a is null" message many times and each time have been able to track down the issue eventually.
As mentioned, there isn't a way to get the original version with real (helpful) variable and comments since it's not open source
But! There's a new(ish?) feature in Google Chrome Dev Tools where you can de-minify code ("make minified code human readable")
https://developers.google.com/web/tools/chrome-devtools/javascript/reference#format
should at least help a bit with debugging