Saturday, October 30, 2021

login with google

This post describes login with google using MySQL and PHP - 
https://www.w3jar.com/login-with-google-account-using-php-mysqli-source-code/

Taking that as the starting point, we could implement in our code where the db and users already exist in postgresql. 

Thursday, October 28, 2021

javascript error and resolution

There was a page which had our google app script embedded, but on which the app only showed a spinner instead of loading up on Firefox. Checking the error on the browser console, found
Uncaught SyntaxError: invalid range in character class common.js:10:54

Finally found that this was due to a hyphen not being escaped in the common.js file - the hyphen should be escaped, or else it becomes a range from the previous char (.) to the next char (+), which gives an "Invalid range" error, preventing the loading of the entire js file, leading to the function w3_open() not being found.

           if (!element.value.match(/^[0-9a-zA-Z @,.-+]+$/)) {
was to be replaced by 
            if (!element.value.match(/^[0-9a-zA-Z @,.\-+]+$/)) {
   

zoom vs meet vs bbb vs teams

Came across this detailed video comparison of teaching with zoom vs meet vs bbb vs teams. But it ignores one factor which is crucial for us, which is cost.

Tuesday, October 26, 2021

git pull Moodle upgrade

The steps to do a command-line upgrade using git are summarized at
https://moodle.org/mod/forum/discuss.php?d=403666

While doing the upgrade, git complained that changes have been made, so it was aborting the pull. As discussed in this page - 
https://moodle.org/mod/forum/discuss.php?d=228497
I tried 
git stash
git pull

That worked. 

Sunday, October 24, 2021

one-time download from GDrive - and a library to parse URLs

An interesting implementation of a temporary download link from Google Drive using Google Apps Script - https://github.com/tanaikech/One_Time_Download_for_Google_Drive

And a library to parse URLs - URI.js linked from https://googleappscripting.com/working-with-urls/ 

concurrent user limits for google apps script

User Tanaike has answered this question also on stackoverflow with testing details - the answer seems to be less than 30 concurrent calls to a google apps script, though if calls are separated by one second, more users can use the script. 

Wednesday, October 20, 2021

difference in parsing csv - Google Sheets and Drive vs LibreOffice Calc

One of our google apps scripts did not work properly when data was copy-pasted into its source Google sheet by opening the data in a csv file from LibreOffice Calc, but worked when data was copy-pasted from Google Drive's csv preview. 

Apparently some fields had been interpreted differently by Calc and Google, and some fields had changed places - probably due to commas within fields, or maybe due to newlines within fields. 

Monday, October 18, 2021

User rate limit exceeded in Google Apps Script

API call to drive.files.insert failed with error: User rate limit exceeded
- there are various mitigation strategies mentioned in this page, but what I usually use are calls to Logger.log - that seems to take the amount of time sufficient for staying within the 10 calls per second rate.

Wednesday, October 13, 2021

exporting Odia html text as Google doc

Exporting a set of Oriya (Odia) language html files stored inside a database to google docs using the usual technique which I had used for English, viz - 

var ablob = Utilities.newBlob(assethtml, MimeType.HTML, "asset.html");
var AssetGDocId = Drive.Files.insert(
{ title: data_array[i][8] + ' temp', // Column I is Asset title
mimeType: MimeType.GOOGLE_DOCS, parents: [{"id": destFolderID}] }, ablob).id;

Did not work. Reason was that the Odia files did not specify the encoding, and consisted of content like


When "good" Odia content was created using Google's phonetic Odia keyboard provided by Google Input Tools, the exported html looks like this, 


The current workaround is to just export the database contents to HTML instead of converting to GDoc. Then, by saving the database contents as a html file, installing the relevant font, opening in LibreOffice Writer (or MS Word, I guess) and then saving as pdf, correctly rendered Odia text is obtained. 


Wednesday, October 06, 2021

removing an app from the Android App Store (Play Store)

The video at https://www.youtube.com/watch?v=bqEOQzg_kp8 has the current steps - 

  • Go to play.google.com/console
  • Click on app
  • On left menu, scroll down to Setup, under which click on Advanced Settings
  • Choose Unpublish.

Sunday, October 03, 2021

moving files and folders to shared drives in Google Workspace

For non-Admin users to move entire folders to Shared Drives in Google Workspace (formerly GSuite), the admin has to set suitable permissions - from admin.google.com, Admin Roles -> Create new role, call it something like Shared Drive Admin or whatever, and give that role the permission under Services > Drive and Docs > Settings > Move any file or folder into shared drives

After that, assign this admin role to whichever user needs it. Then, that user can drag and drop folders also into shared drives as below. (If this is not done, only files can be dragged and dropped into shared drives, folders have to be manually re-created.)

Dragging and dropping files from My Drive to a Shared Drive - walkthrough video below - 


This could be a good option if some users on Google Workspace are running out of disk space due to files in Drive. Another option would be to move the files to another google account. This video's second half shows how to transfer files from one account to another using MultCloud. The first part of the video is inaccurate, since the file owner is not changed even if moved from Shared with Me to another folder. If not using MultCloud, the method to transfer a file from one account to another is:

  1. Share the file from account1 with account2 as Editor.
  2. Choose to make account2 the owner by clicking the "Make Owner" option as in the screenshot below.




  3. Account2 gets an email saying that this item appears in My Drive of account2
  4. Move file to suitable folder by signing in with account2
This is quite cumbersome, so I must try out MultCloud and see if it makes things easier.
 
Edit 17 Jun 2022 - There is another tool called Drive Migrator also,