Thursday, October 28, 2021

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,

Monday, September 27, 2021

scripts to copy publicly available files from Alfresco

There was a requirement to back up all the files in an Alfresco repository to a filesystem. A google shared drive mounted using rclone was used in this case. 

Caveat - rclone mounted gdrive is excruciatingly slow when there are a large number of files in the destination folder, even when using your own client id. It's much better to use some other remote mount like a remote local drive or something like that, and then upload from there to google drive. 

Anyway, the scripts and sql used in this case are listed at https://github.com/hn-88/bashDLalf
which uses the grep -v method to remove lines containing specific substrings.

(We did not use these bulk scripts because only a sample "site" was configured on our installation. And this Alfresco Bulk Export tool needed the Alfresco war file to be modified etc, which I was hesitant to do.)

Edit: 5 May 2022 - Got an email from Google, "OAuth out-of-band (OOB) flow will be deprecated on October 3, 2022, to protect users from phishing and app impersonation attacks." ... "Apps using OOB in testing mode will not be affected." ... etc. 

The client ID I had created for rclone was indicated in the email. So, I deleted that client ID, since I'm currently not using it. 

Sunday, September 26, 2021

mysql timeouts with DBeaver

When doing custom queries on a remote MySQL server, DBeaver was timing out and I would need to "Invalidate/Reconnect" the connection every time. Found this old discussion about it, in my case the solution was to change the timeout from 20000 to 2000000 in the menu item
Database -> Driver Manager -> MySQL -> Driver properties tab



Tuesday, September 07, 2021

website connection issues - most probably client-side DNS misconfiguration

One of our websites was not responding when trying to connect with Chrome incognito tab from offices behind a Sophos network security appliance. Interestingly, the error message shown was "xx.yy.zz.kk refused to connect" with the relevant IP address being an Airtel address and not a github/cloudflare address as it should be, since the website was hosted on github with cloudflare proxying. 

Most probably this was due to some sort of misconfigured DNS, I guess, since V reported that it was working after the alt DNS IP 8.8.8.8 was added along with cyberoam's IP address (which was primary DNS) in the wireless router.

But the fact that only incognito tabs had this issue was interesting. Maybe due to this - in incognito mode, Chrome seems to be connecting to dns in a different manner, which seemed to have the issue - https://blog.google/products/chrome/more-intuitive-privacy-and-security-controls-chrome/

Friday, September 03, 2021

fresh moodle installation

Earlier, I had just duplicated moodle installations by backing up and restoring. Now a fresh install, for which:

  1. Set up the moodle files using git as in my previous post.

  2. Logged on to the database server, and created the required database and user as mentioned in the documentation - not as a single command, which doesn't seem to work, but as separate commands. Since the user is not on localhost, it is currently set up as 'username'@'%'
    mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    mysql> CREATE USER moodleuser@'%' IDENTIFIED BY 'yourpassword';
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@'%';



  3. Caveat - must log in as root with mysql -u root -p before doing the above, since other mysql users don't have all the required permissions. In this case, the root user's password was similar to the other user's password.

  4. Ran the installation from the CLI. The first time I ran it, www-data user could not write to that directory. So, changed the permissions to allow group write -
    chmod g+w the_git_dir
    cd the_git_dir
    sudo -u www-data php admin/cli/install.php

    This took quite a while - around 5 minutes - for all the database table creation etc. So, probably it would have been wiser for me to do this in a screen session. 

  5. Then made the site available via apache, with a letsencrypt certificate:
    cd /etc/apache2/sites-available
    sudo cp anothersite.conf thissite.conf
    sudo nano thissite.conf
    sudo a2ensite thissite.conf
    sudo systemctl reload apache2
    sudo certbot --apache


delete a user in mysql

I had created a user in mysql but was unable to run scripts as that user. Reason was that special characters were present in the password, which we should avoid. So, deleted and re-created. 

mysql -u root -h servername.tld -p mysql
SELECT User,Host FROM mysql.user;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'whicheveruser'@'localhost';
DROP USER 'whicheveruser'@'localhost';

Sunday, August 29, 2021

cloudflare proxied self-signed web server issues

There was a problem with one of our websites set up with a different domain, where another site was being served up instead of the site configured with relevantdomain.conf virtualhost in apache. Turned out the issue was due to the way in which we had set up cloudflare proxying and SSL.

The apache server had been set up with a self-signed certificate, cloudflare was using flexible SSL mode, and a page rule had been applied in cloudflare for http to https redirection. But the web server had been configured with the self-signed cert for another domain. Maybe this was the reason for cloudflare to serve up the default.conf domain instead of the relevantdomain.conf.

Anyway, tidying up by using
certbot-auto --apache
and installing letsencrypt certificates for all the domains on that server fixed up the issue. The usual caution - when doing automatic http validation, turning cloudflare proxying off may be required. But for renewing the domains, this doesn't seem to be necessary, as tested with 
certbot-auto renew --dry-run

Later set up automatic renewal with 
45 2 * * 6 cd /etc/letsencrypt/ && ./certbot-auto renew && /etc/init.d/apache2 restart

Thursday, August 19, 2021

clear the contents of an iframe

 Referencing this issue, "clear error mesg when starting a new search" - 

one possible solution might be to clear the contents of the iframe, some good methods are listed at https://stackoverflow.com/questions/1785040/how-to-clear-the-content-of-an-iframe

Tuesday, August 17, 2021

not booting after timeshift restore

An upgrade from Linux Mint 19.3 to 20 did not end well. dpkg got stuck with some circular dependencies, probably because I had not removed all "foreign" packages before the upgrade. Then tried a fresh install of Linux Mint 20.1 and and upgrade to 20.2. Unfortunately, there seems to be a regression for Macbook support - the screen becomes corrupted after suspend and wake up. 

So, I tried to restore the timeshift backup I had made before the upgrade. That took a couple of hours, since I had backed up 40+ GB of home directory also. But then the system wouldn't boot into that restored partition.
Error message:  Alert: UUID=<whatever> does not exist, dropping to a shell. 



After looking at many places like here and here, finally I thought of checking the refind file boot/refind_linux.conf since I was booting with refind. That immediately showed up the issue. The boot/refind_linux.conf on the relevant partition, /dev/sda3 in this case, was pointing to a different UUID compared to the UUID reported by 
sudo blkid

So I just had to boot into another working Linux installation, edit this file boot/refind_linux.conf on /dev/sda3 with the correct UUIDs, and save it. The next boot worked fine. 

Friday, August 13, 2021

making a book readable on the Kindle from a set of articles

There are some pages with links to a large number of articles, like this one. Looking around for easily converting all those articles into a single book readable on an e-ink reader like the Kindle, my first trial was with Calibre and its News feature. Just adding that html page as the source did not work - the created ebook only had that page and nothing else.

Next, trying creating an RSS feed with fivefilters and giving that feed to Calibre - limited to 5 links, so not sure how it would work with the hundreds of old articles. 

Trying HTTrack to download pages - was taking a long time due to downloading CSS, images, etc. And we were not really interested in images.

So, used DownloadThemAll, choosing to download only *.htm and *.html linked from the index page, created a table of contents html page as noted in the FAQ. But Calibre complained of broken image links and stopped the conversion. 

Then tried converting all the html to txt using html2text - did not work, maybe my commandline piping was incorrect? Next, tried converting all the html to txt using HtmlAsText, running it as 
wine HtmlAsText.exe
This worked without a hitch. Then, made another table of contents html file with all the html files replaced by the txt files in the table of contents. But that conversion too ended up with only the table of contents being added to the ebook. 

Next, tried
cat *.txt > combinedfile.txt
and converted the combinedfile.txt. This created a combined ebook, but with ugly hard line-breaks every other line. Then, chose to enable heuristics processing with all options, and converted again. This time, got good results. With heuristics processing, the conversion takes longer, around 5-6 minutes for a 3 MB text file.  

So, to sum up - 
  • DownloadThemAll
  • HtmlAsText
  • cat
  • Calibre with heuristics enabled.


Thursday, August 12, 2021

assigning roles to users on Moodle

On one of our Moodle installations, there was a request to change permissions of a couple of users - to assign the "manager of course category" status of one user to another. Though Moodle has an easy way to make a user a manager of the entire site, Site Administration -> Users -> Assign system roles - this particular permission assignment was a bit more tricky to navigate. One solution turned out to be:

  1. Navigate to a course for which this user has manager status as an Admin or Manager
  2. Choose Course "Actions Menu" (Gear icon on right corner with the Moove theme)
  3. Choose "More" -> Users tab -> "Check permissions"
  4. Filter for the user whose permissions you want to change, click to select and click "Show this user's permissions"
  5. In this case, it showed, among other things, Manager in Category:TheRelevantCourseCategory
  6. Clicking on Category:TheRelevantCourseCategory, then again the "Actions Menu" (Gear icon on right corner with the Moove theme), Assign Roles
  7. That gives us a clickable table to assign roles (like Manager) in that particular category.