Access GM_getValue outside of script - tampermonkey

Basically the question title. It would greatly benefit me. I want to be able to access GM_getValue outside of my userscript for debugging purposes, or, at the very least, the values and names themselves.
I am in Chrome on Windows 10.

Latest Tampermonkey beta (and eventually normal Tampermonkey) displays the GM values in its dashboard script editor in Storage tab.
Visual method: use Storage Area Explorer extension:
Open the Tampermonkey dashboard page and invoke devtools by F12 or CtrlShifti
In Storage Area Explorer panel scroll to the bottom to find the #uid# of your script by name, then find its data in #st# key with that UID:
Dumping in the console:
One-time setup: add a new code snippet in devtools - Sources - Snippets subpanel and save it:
function dumpGM_data(scriptName) {
chrome.storage.local.get(null, data => {
const UID = Object.keys(data).find(k => k.startsWith('#uid#') &&
data[k].value == scriptName);
if (UID)
console.log(data[UID.replace('#uid', '#st')].value.data);
});
}
Open the Tampermonkey dashboard page and invoke devtools by F12 or CtrlShifti
open and run that snippet: CtrlEnter - it'll be usable until you close the dashboard page
invoke it in the console:
dumpGM_data('SE Preview on hover')
Inspect/dump/edit the database file directly:
Use any LevelDB tool you can find (or compile one yourself) on the ldb database file under Chrome user profile directory in Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo or Local Extension Settings/gcalenpjmijncebpfijmoaglllgpjagf for Tampermonkey beta.

Related

Images in Google data studio dashboard working for editor but not working for viewer

I use google form to collect images. The images are stored in a folder in google drive. The folder is shared publicly so that all the photos within the folder are also public if the link is available. The responses are stored in google sheet and converted to a accessible file that i.e. change from "https://drive.google.com/open?id=" to "https://drive.google.com/uc?id=" so that images are directly accessible. The google sheet is connected with google data studio. I need to show these images in the data studio dashboard. What I could find as solution was to create a table with the image URLs. Using a table, I've tried to do the following
Created a new field in google data studio and added image function with a link as mentioned above.
Instead of creating a new field, changed the type of image URL column to URL as well as image.
Both above are working for me as an editor (during edit or view as shared in below images. But when I share the dashboard as a link and view it in incognito mode, it is not working. I hope I'm able to explain.
Google Form Link: https://forms.gle/FFjX7cV8tJUSx5GW9
Google sheet where data is collected : https://docs.google.com/spreadsheets/d/1glpAId0LHgTUUtVk3RwakDr-H1KUXk3WtA-SE50HKXQ/edit?usp=sharing + also Embedded in google data studio
Google Data Studio link: https://datastudio.google.com/s/oaCN4EO-J4c
Its working for me as editor, but as a viewer in above link, its not working as visible in above data studio link
But as a viewer (incognito mode) images are not visible.
Actually, the images work for any user logged into its own Google account. The problem is really experienced when the dashboard is open with no logged user.
Diving into the problem, it seems to be related with the number of redirects that Google Drive need to access the image. Reproducing your dashboard I was able to see the error ERR_TOO_MANY_REDIRECTS in browser's Dev Mode.
Steps in logged mode:
Access https://drive.google.com/uc?id=[id]
302 Redirect to https://*.googleusercontent.com/docs/
The image is returned
Steps in non logged mode:
Access https://drive.google.com/uc?id=[id]
302 Redirect to https://*.googleusercontent.com/docs/...
302 Redirect to https://docs.google.com/nonceSigner?...
The image is returned
If you look into Dev Mode, it is possible to note that the URL ended with "/nonceSigner" is accessed dozens of times when not logged (the same does not happen when logged). This means that Data Studio start a loop trying to access the image, which triggers a "retry" operation when it sees a double redirect.
Curiously, this does not happen when using the standard Image control (instead of table chart, that reads from a DataSource), so it seems to be a bug in the Table chart component.
So you're out of luck. My suggestion is to use Cloud Storage instead of Google Drive, since it seems you're using some undocumented features and they'll surely break at some time.
Another option is to report this bug to DataStudio team (report here). There are Data Studio developers that activelly answer questions in StackOverflow (like Minhaz Kazi), so try to drive their attention to this issue.
I was having a related issue here - a colleague was not able to view images in a data studio dashboard, even though he was able to view the same files directly in Drive. It turned out to only be a problem using the Brave browser! I can't figure out what exactly was going on, but posting here in case it helps someone else.

How to migrate an online angular script to local server?

Hi I'm trying to make an offline version of this page:
https://u-he.com/tools/microtuning/ the script is writtin with Angular JS how do I do that?
I saved the page control-s and copied the file to the local server I'm running.
And then I browsed the local ip. the page opened but I get repeated notes ng-repeat shows up as multiple boxes instead of 1 box that edits the same note but in different octaves.
How do I solve this problem please.
You can inspect the front-end code in your browser console. In Firefox it's in the section called "Debugger", in Chrome it's called "Sources". If you use Safari, you need to enable Developer mode first.
Once you have the appropriate view, just click on u-he.com -> tools/microtuning/ -> index
Hopefully it goes without saying that you shouldn't use large swaths of another person's code without at least giving appropriate credit, or better yet getting the developer's permission, unless there is an explicit open-source license.

base64 pdf is not showing in IE 11 browser [duplicate]

I receive (from a webservice I don't manage) a string with the content of a pdf file.
On client's side, I use this function:
window.open('data:application/pdf;base64,'+encodeURI(TheStringWithThePdfContent));
As usual, it works in every browser but IE (11 in my case), which shows an alert with the message: "Do you want to allow this website to open an app on your computer?"
If I say no, an empty white page is opened.
If I say yes, it tries to open a "data" file (as it reads from the protocol in window.open, I guess) and, as it doesn't find any application to do that, sends me to the Microsoft application store, which just suggests me to download "iMusic"
Completely useless, of course.
I've changed all the Internet Options I've guessed could help, none works.
Any suggestion?
Thanks in advance,
I found the solution and I want to share anyone who has the same problem. You can see the demo here :
https://jsfiddle.net/quangminh_ln/hy36tnt6/
'use strict';
var data = "...Your PDF base64 string...";
var fileName = "your_file_name";
if (window.navigator && window.navigator.msSaveOrOpenBlob) { // IE workaround
var byteCharacters = atob(data);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
window.navigator.msSaveOrOpenBlob(blob, fileName);
}
else { // much easier if not IE
window.open("data:application/pdf;base64, " + data, '', "height=600,width=800");
}
The link that I saw for my solution : https://viethoblog.wordpress.com/2016/08/30/loaddisplay-pdf-from-base64-string-bonus-ie-workaround/
Update Reader or Acrobat
Adobe releases free security updates quarterly. Make sure you update your version of Reader or Acrobat to the latest release. The updates often include fixes to common problems. Download the latest free update.
Open Reader or Acrobat.
Choose Help > Check for Updates.
Acrobat 9 and earlier: If a new update is available it installs automatically.
Acrobat X and XI: Click Update and then click Install.
Acrobat DC: Continue to the next step.
Check for updates
When the Updater dialog box appears, click Download.
Update Acrobat
After download is complete, click the Acrobat install icon. In the Acrobat Updater window, click Install.
Update is Ready
After installation is complete, restart your computer and test the PDF again to see if you can view it.
PDF solutions
Refresh or reload the page
Often, just refreshing the page in your browser allows the PDF to load fully.
Hold down the Shift key and press the Refresh or Reload button in the browser.
Try to view a different PDF
Try viewing a different PDF. For example, see if this sample form displays in your browser. If Acrobat or Reader can open the sample form, then the other PDF could be damaged or the web server could be having problems. If possible, contact the individual or company who manages the website.
Try to view a PDF on your hard drive
Determine if your web browser can open a PDF from your local hard drive rather than from the web. For this test, you need a PDF saved on your computer.
In your web browser, do one of the following:
Mac OS: Choose File > Open (or Open File).
Windows: Press Control+O.
Click Browse.
(Windows only) From the Files Of Type menu, choose All Files.
Choose all files
Locate a PDF on your computer, select it, and then click Open.
If the PDF opens, the website you were viewing could have a problem. Contact the individual or company who manages the website.

App Engine - How to create project in region us-central

I need to create a new project on Google App Engine in the region "us-central" since my SQL database is located in this region and I can not connect projects from other regions to the SQL database.
If I create a new project, it is located by default in EU. There is no option to choose the region during project creation. See the attached screenshot. Is there a way to create a project in "us-central"?
From Setting the server location:
When you create your project, you can specify the location from
which it will be served. In the new project dialog, click on the link
to Show Advanced Options, and select a location from the pulldown
menu:
But it seems the documented project region selection procedure is changing, as the Show Advanced Options link is, as you observed, nowhere to be seen anymore.
Empirically I have discovered the following method. But being undocumented it may change at any time, so YMMV.
Just click on the CREATE link in the screen you're showing.
You'll see a screen asking you to choose the app language (the popup is a bit flakey, I had to reload the page to actually be able to make the selection):
After you select the language you'll see the location selection screen:
It seems the app created sequence is now persisted, you'll also be automatically directed to the correct screen if, at any time, you attempt to go to the GAE app settings for the newly created app.

Access Specific PDF Page in WPF WebBrowser Control

I have a webbrowser control in my application that is used to display pdf files that have been created in iTextSharp and are stored locally on the hard drive.
I would like to be able to navigate the file (next, previous, first, last, toc) from my application rather than using the inbuilt nav of the reader in the browser.
I have seen that you can navigate to specific pages by using
Browser.Navigate("filename.pdf#page=?);
This works the first time but when trying to navigate to a different page, it makes the browser disappear completely with no errors. However, I can reload the file without problem if I don't have the #page=? suffix on the file url though. Any ideas on this?
Alternatively, is there anyway in iTextSharp of adding something to the file to allow for it to be navigated from an external command?
All the official parameters that can be used to navigate through a PDF using parameters in the query string after the ? character are listed in a document published by Adobe: Parameters for Opening PDF Files
You already mentioned the page parameter. Another option could be using named destinations: nameddest=destination. In this case, you need to add the anchor with name destination to the file using iTextSharp.
Note that not all viewers implement these parameters. Adobe supports them in Adobe Reader and in the Adobe Reader plug-in, but there is no guarantee that they will work in pdf.js (Firefox), Pdfium (Google Chrome),... If your browser disappears when using an open parameter, you may have hit a bug in the browser or the viewer plug-in that causes the browser to crash. iTextSharp nor iText can crash a browser ;-)
There are no other ways you can navigate a PDF from an external application. The only thing you can do, is to add JavaScript to the PDF so that it always opens at the same page. This is done using an open action. I don't think this solves your problem as it would mean that you have to change the PDF file every time you want it to open at a different page.

Resources