Saturday, October 28, 2023

moodle site registration issue and fix

There was a problem with site registration, saying "your site is already registered". This is probably because we had copy-pasted the database from an existing site. 
 
This discussion 
suggests deleting the entry in the registration_hubs table in the database to allow us to register.

I have done that now, and that allowed the site to be registered.

request for new font in Moodle instance

Following a request to install a new font in a Moodle instance, I did a local install with

sudo mkdir -p /user/share/fonts/googlefonts 
cd /usr/share/fonts/googlefonts
sudo unzip -d . ~/Tangerine.zip
sudo fc-cache -fv
Links - Using web fonts -
Using local installation -

 
But then it was reported that this font is not seen as one of the options when editing an element in the custom certificate plugin.
 
Certificate builder needs fonts in a separate format?
 
Tried purging cache, purging cloudflare cache etc, but still not seen. 
 
Not the manual method, but this plugin method in the up-to-date docs.


Finally, trying the TCPDF fonts plugin
As screenshot shows,
Dashboard - Site Administration - Server - TCPDF Fonts
 
After initialization and adding the font that way, works fine - did not have to purge caches etc.
 
 

Thursday, October 26, 2023

find version and other details of installed package with apt

 Via Check version of Installed Package on Ubuntu / Debian | ComputingForGeeks

sudo apt show nameofpackage

more reading about prototype pollution - even front-end can have vulnerabilities

Checking to see how critical are prototype pollution vulnerabilities for front-end code, apparently they are:

javascript - Is prototype pollution only exploitable on the back end? - Information Security Stack Exchange


google photos links sent by email, not working on iPhone

I had shared some google photos albums using the sharing link, which is of the form https://photos.app.goo.gl/<id> and A said that they could not see the album. 

My reply was, 

those links are probably not opening in your iPhone because your phone's Apple Mail is not configured to use Safari or Chrome browser to open links.

It might work if you long press on the link, choose "Copy", and paste the link in Safari or Chrome browser in your phone.
And that seemed to work.

Mongodb pros and cons

One of the many sites which list Mongodb vs Postgres comparisons, 

https://www.knowledgenile.com/blogs/pros-and-cons-of-mongodb#DisadvantagesofMongoDB

Transaction-safety and joins etc are what mongodb doesn't offer, while sharding is its strength.

Wednesday, October 25, 2023

Amazon firestick not recognizing a USB drive - issue was with partitioning

There was one drive which was being recognized, and another drive which was not. The drive which was being recognized had the original 16 GB FAT32 partition, while the one which was not being recognized had been used as a Linux Mint installation disk, and had been later reformatted as FAT32 using the "Disks" utility on Linux Mint.

Both show in "Disks" on Linux Mint the following info:
 
 

Suspecting that block size might be the issue, to show the block size,

 
stat -f shows  8192 for the non-working drive and 16384 for the working drive. Tried to see if reformatting would work -

(trying 32k size instead of 16k)
 sudo mkfs.fat /dev/(device name from above) -s 64 -F 16
 

Changed label using
Disks --> Edit Filesystem --> it prompts for the label.
 
But that didn't seem to work - copying a test file seemed to take ages. 

Then, tried GParted. GParted showed the partition to be of type iso9660! 

Unmounted, Deleted the partition, recreated partition table with device -> create partition table (msdos), formatted as msdos, then the Firestick recognizes it OK even though the block size is 8K as shown in 

 stat -f /media/mac/LM
  File: "/media/mac/LM"
    ID: 83100000000 Namelen: 1530    Type: msdos
Block size: 8192       Fundamental block size: 8192
Blocks: Total: 1951116    Free: 1318805    Available: 1318805
Inodes: Total: 0          Free: 0


 

Sunday, October 22, 2023

upload artifact from github actions build

Create a Release and Upload Artifacts with GitHub Actions | Thomas Stringer (trstringer.com)


Easy way to publish artifacts - 

https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-publish-GitHub-Actions-artifacts-example

Just add the following, and it will create a zip file with the path -

- name: Upload Artifact
      uses: actions/upload-artifact@v2
      with:
        name: artifact-of-build
        path: platforms/android/app/build/outputs/

linux on ipad

In case someone wants to do some serious work on the ipad with a keyboard etc - installing alpine linux, python etc

https://www.youtube.com/watch?v=ntRfrjw0tzQ

app for new Moodle instance - several options

There was a request for an app for a new Moodle instance. My response was, in part,

There are several options. 

1. Option within the same app - We could push out an update to our customized Moodle app which would enable users to choose between the two Moodle sites - this is fairly easy to implement.

2. Separate app - Having a separate app is certainly do-able. If we just change the name of the app, URL and (if necessary) the splash screen and icon, we could have a separate app. If you want that, please let me know the name of the app you wish to have, and if you want any changes to the splash screen and icon.

3. Web app - If you don't want the hassle of maintaining another app, we can use a technique like this,
and have a qr code which students can scan, and then install the site as a web app to their home screen.

(Since the courses on this site are supposed to be interactive, some elements may not work on the mobile app, but might work on the web app. Comparison table is at
The difference would be that the web app will save downloaded files outside the app, in the downloads folder.)

Edit - Option (1) was chosen.

Saturday, October 21, 2023

optimizing github actions build using cache

When I was poking around the github actions tab, saw the cache side-bar link, and thought I'd check it out. 

When added to this msbuild action, the OpenCV caching brought down the total build time from 5-8 minutes to just 1.5 minutes - the download and untar from cache happens in 25 seconds instead of the download and unzip from github releases which would take 6 minutes or so.

More references:

Need to order the named jobs so that the cache comes first - https://github.com/actions/cache#skipping-steps-based-on-cache-hit

Friday, October 20, 2023

folder permissions for webserver on Apache

 https://www.internalpointers.com/post/right-folder-permission-website - Good solution is to chown -R all files and folder to yourusername:www-data - so that the web server and you can access, and then chmod 750 for all files / folders - "read, write and execute (7) for the owner (i.e. you), read and execute (5) for the group owner (i.e. the web server), zero permissions at all (0) for others."

(But when we want Moodle to be able to update plugins with the web interface, we've used 775 instead.)

Wednesday, October 18, 2023

Travis deploy to Github releases - requires classic personal access token

OCVWarp deployment from Travis-CI to Github Releases failed because the token had expired. When creating a new token, I tried a fine-grained token with write permissions to releases on that repo alone. But that did not seem to work. A "classic" personal token with "repo" scope worked fine. 

https://github.com/settings/tokens

Sunday, October 15, 2023

migrating from Android to iPhone


How to migrate your WhatsApp data from Android to iPhone | WhatsApp Help Center

 Though this method was followed, only the photos and media were transferred from whatsapp, not the chat history. Probably that was because whatsapp had been earlier installed on the iphone, though it was then removed with "delete all data"?

https://faq.whatsapp.com/1195710084347483?helpref=faq_content

then, to transfer music, move content manually from your Android device to your iPhone,

https://support.apple.com/en-gb/HT205063

Friday, October 13, 2023

playing local video from firestick without internet

While setting up the Firestick, we wanted to create a new dedicated account for it, but it asked for a unique phone number - so we just used my account.

We found VLC player was stuttering with our 4K videos on USB, but MXPlayer works with hardware acceleration, and plays them perfectly. To access MXPlayer without internet, via Quora,

Settings --> “Applications” --> “Manage installed applications” --> "MXPlayer" --> "Launch"

And it looks like there is no "shutdown" option - we just press "home" to come out of MXPlayer, and then turn off power to the device.


Maybe this will? Long press centrebutton + play for 10 sec

Our Firestick runs FireOS 6.4, but we did not have to do any ADB commands to use FAT32 formatted USB memory. The ADB commands in this pdf may be useful for increasing system usable memory, installing apps and so on, but not needed for us.

As recommended in this troubleshooting video, when connecting for the first time, doing so from the "home" screen might be beneficial.

How to play our own content from USB on Amazon Firestick

We can't just connect the firestick to a computer and transfer files to its internal memory - MTP does not work with Firestick 4k

Can probably use adb pull


But far simpler to just use a removable USB drive.


Thursday, October 12, 2023

error updating snapd

Investigating unresponsive server behaviour on one of our servers,

grep -i error /var/log/syslog

showed some lines with WALinuxAgent - this is Azure's agent, I guess, as well as snapd.

 snapd[63805]: stateengine.go:149: state ensure error: cannot query the store for updates

 To check if we can remove snapd


snap list
 
shows lxd, which might be needed - 

How to remove LXD from my system - LXD - Linux Containers Forum

So I left it alone, and tried a manual update with

 sudo snap refresh

which indicated all packages were up to date. So maybe the error was a temporary error.

issue with one of our Linux servers

One of our Linux servers was becoming unresponsive around 2-5 pm daily over 2-3 days. Checked the logs as in my earlier post but did not find anything except the usual SSH brute-forcing attacks. Changed the port from 22 to something else by
sudo nano /etc/ssh/sshd_config
sudo service sshd restart

And opened the new port on Azure portal Networking screen. 

This seems to have worked.