Mostly work related stuff which I would've entered into my "Log book". Instead of hosting it on an intranet site, outsourcing the hosting to blogger!
Friday, July 28, 2023
Tuesday, July 25, 2023
problem with dimming LED lights
We purchased a cheap dimmer off Amazon which advertised "suitable for LED", but when we hooked up some of the lights we have, the lights started flashing instead of dimming. Dimming worked OK for incandescent bulbs. Looking around for solutions, found these videos which gave some good info.
The problem with dimming AC LED bulbs - https://www.youtube.com/watch?
Apparently the issue is that those LEDs which are sold as "not dimmable" (or in our case which specifically don't say "dimmable") contain an SMPS with a capacitor across it, so the pulse width modulation of the dimmer circuit causes it to flash instead of dim.
Apparently we can dim such bulbs using a capacitor - https://www.youtube.com/watch?
https://hnsws.blogspot.com/2023/08/fade-in-and-fade-out-lights-using-smart.html
Monday, July 24, 2023
finding created time of a file on linux commandline
Following the different methods given at https://kodekloud.com/blog/file-creation-time-linux/#
On one of our Azure Ubuntu 20.04 servers, only the debugfs solution worked.
sudo debugfs -R 'stat /path/to/our/file.txt' /dev/root
... etc
crtime: 0x64afbcf8:ea7086a8 -- Thu Jul 13 08:59:36 2023
-----------------------------------------
ls -l --time=birth ourfile.txt
ls: invalid argument ‘birth’ for ‘--time’
Valid arguments are:
- ‘atime’, ‘access’, ‘use’
- ‘ctime’, ‘status’
--------------------------------------
stat additionalplugins.txt
... etc ...
Change: 2023-07-24 05:00:13.991923547 +0000
Birth: -
Saturday, July 22, 2023
gripes about online services from Govt-run undertakings
deleting lots of files - ftp vs Plesk
Bulk deleting all files on a website - found that deleting via Filezilla ftp client was taking a long time, since each file delete command was being sent via ftp. Logged on to Plesk, chose the directories to delete and chose the Remove button, opting to not move to Recycle bin - this went much faster, since Plesk would just use the OS command to delete the entire folder and all files in it.
linux mint upgrade from 21.1 to 21.2
The upgrade from Linux Mint 21.1 to 21.2 went surprisingly easily. For a change, I just clicked on the graphical update manager / system reports prompt which said that a new version is available. I did read through the release notes as prompted, but overall, the upgrade did not force me to take a timeshift backup etc. I just started the process and continued working on Firefox - the upgrade went on in the background, and finished after an hour or so. It took an hour because (a) my internet speed was limited to 4 Mbps and (b) the machine is an old Macbook Pro.
After a reboot, the only thing removed by apt autoremove was "vera backgrounds". I went into Update Manager, changed to local mirrors, and then via View -> Linux Kernels -> Remove Kernels , removed the 5.19 kernel in favour of the installed 6.2 kernel. After going through the menu again, removed 5.15 kernel too.
Thursday, July 20, 2023
W3Schools Spaces for testing out static html pages
I've been trying out test html pages on W3Schools' new free offering, https://spaces.w3schools.com/
Useful for quick tests of css/html changes. Easier than setting up a web server on every local machine I work on.
exposed git repo risks
Recently I got an automated email from reporter at repo-lookout.org warning of an exposed git repo on one of our sites. According to this,
https://iosentrix.com/blog/git-source-code-disclosure-vulnerability/
I fixed it using the method for Apache 2.4
<DirectoryMatch "^/.*/\.git/">
Require all denied
</DirectoryMatch>
Wednesday, July 19, 2023
LIC premier services application
If we log out after printing the generated application form, we can either wait for a week for the application form to get reset, or go to Service Requests Tracker, where the application form is noted as incomplete, which we can then resume. Perhaps this is shown only after a day or so. (Phone support asked me to email portalsupport at licindia.com but there was no response from them.)
Edit: As noted in the other post about issues with the website etc, had a good experience with LIC's customer zone, Kozhikode, via telephone. Very helpful, unlike the toll-free phone support.
Monday, July 17, 2023
dipping my toes into Google Sheets functions
So far, I'd been manually adding up numbers for total number of visitors and so on. Today, I tried out using some formulas, via https://productivityspot.com/google-sheets-sumifs-date-range/
=SUMIFS('2023'!F3:F,'2023'!A3:A,">="& E131, '2023'!A3:A,"<="& EOMONTH(E131,0) )
This is one of the formulas - here,
- SUMIFS is the conditional sum function
- '2023'!F3:F is the range over which we want to sum - the sheet name is within single quotes to convert the number to a string
- & concatenates two strings to make another string - here, E131 contains a date, first day of the month, and the condition is >={the date}
- EOMONTH returns the last day of the month of the date specified in the first argument, with an offset of n months where n is the second argument.
Google sheets function list is here.
Interestingly, another function I've used for the same chart has a different syntax.
=COUNTIFS('2023'!F2:F,">1",'2023'!A2:A,">="& E131, '2023'!A2:A,"<="& EOMONTH(E131,0))
COUNTIFS does not have the same number of parameters as SUMIFS, so we can't just copy-paste formulas and just change SUM to COUNT. Here,
- all the parameters have to come in pairs - so I've just added a ">1" condition to the first range.
- all the ranges must have the same number of rows and columns.
Sunday, July 16, 2023
github action to build an opencv project on Windows
After lots of trial and error, worked out a github actions yml file for building on Windows using Github actions instead of Appveyor. Working appveyor yml file is at appveyor.yml
Working github actions build on Windows is at msbuild.yml
All the trial and error can be seen from the commit history.
Main points -
- We need to use the env definition instead of setx, because refreshenv does not work
- The default shell seems to not have wget, for downloading files, the working option is
powershell -c "Invoke-WebRequest -Uri 'https://the.url' -OutFile 'thefile.exe'" - The default build configuration seems to be Win32 and not x64, so that also needed to be configured manually in the msbuild call
- Documentation and examples are sorely lacking.
- There are other actions like this one for cross-platform downloading and unzipping, but I'll just run separate actions for now.
Edit: Another option for installing OpenCV might be through vcpkg -
https://github.com/microsoft/vcpkg#quick-start-windows
Friday, July 14, 2023
created a txt file with list of additional plugins to copy
In order to automate - or minimise errors in - the upgrade process for the Moodle git upgrade mentioned at
https://hnsws.blogspot.com/2023/07/moodle-42-requires-higher-version-of.html
https://hnsws.blogspot.com/2021/08/detailed-steps-for-moodle-upgrade-using.html
created a txt file with commands like
cp -R ../site_learning/theme/moove ./theme
etc with the correct paths, including the newly installed plugins. Got the list of "additional plugins" via the Moodle Site Administration -> Plugins -> Plugins Overview page, which lists plugins like mod_customcert indicating the path to the plugin would be something like mod/customcert
Another option would be to not copy over the plugins, but to later install the plugins from the web console after the upgrade is completed, which would be listed as "Missing on disk". Maybe this technique is slightly riskier?
Thursday, July 13, 2023
Moodle 4.2 requires higher version of PHP and MySQL
why some old stream urls fail
There was a query about old apps linked to our old stream urls failing.
Copy-pasting from my reply -
The earlier stream urls like
http://stream.radiosai.org:8000 etc do still work, but since they are http and not https, many browsers like Chrome may block those links. Also, the earlier radiosai apps (both official as well as unofficial) used the http links and not https, so as and when Android / iOS upgrade their security practices, they may block those urls.
Additionally, may BSNL routers do http hijacking for ads. This also would disrupt http streaming, while https would be fine.
As things stand now, if someone wishes to bookmark the streams, they can use the following:
https://stream.sssmediacentre.org/asia - for Prasanthi Stream
https://stream.sssmediacentre.org/bhajan - for Bhajan Stream
https://stream.sssmediacentre.org/discourse - for Discourse Stream
https://stream.sssmediacentre.org/telugu - for Telugu Stream
Additionally, there were some queries about using the streams with Google Home devices, Google Assistant actions etc.
As far as I could make out, Google has stopped support for "Conversational Actions" - so, the way to listen to those streams via Google Home devices etc might be to create a Chromecast enabled web app, and to use that to stream. Or perhaps this Custom Web Receiver. This might require registering for the SDK or something like that. Or maybe it will work with a Chrome plugin like this one? Or this one for Firefox?
Sunday, July 09, 2023
github actions upload artifact - needs relative path or absolute path - and cvui - opencv header only cross-platform ui
The working-directory setting does not work for github actions upload artifact, apparently. We can't write something like this either.
PATH_TO_ARTIFACT: $GITHUB_WORKSPACE/build/pan2fulldome
...
path: ${{env.PATH_TO_ARTIFACT}}
## This does not work.
A relative path like this works.
path: build/nameofexecutable
## This works
Edit: I'm not using
Dovyski/setup-opencv-action: Github Action to download and setup OpenCV
in my Github actions and am instead using a pre-built opencv artifact, since the action above takes more than 20 minutes for each build, building opencv every time. But cvui linked from that action seems to be nice, "A (very) simple UI lib built on top of OpenCV drawing primitives."
I'm trying it out for pan2fulldome.
Saturday, July 08, 2023
video upscaling tools
Very interesting AI powered upscaling tools - some of which work without GPU, but slowly - https://github.com/agmmnn/
Microsoft 365 - adding a domain where admin was unknown or lost password
There was an issue adding a domain to our Microsoft365 non-profit tenant - that domain had been added (probably by mistake) to another tenant thedomainonmicrosoft.com
The admin for that domain was not known, or the people involved had forgotten, and also forgotten the password for the admin login.
Since I was a global admin for the target tenant, first tried adding, then tried "domain takeover" which did not work, powershell - 'Connect-MsolService' is not recognized as the name of a cmdlet - Stack Overflow
then contacted Microsoft support as mentioned in admin.microsoft.com domain console.
I had set my preferred method of contact as email, but the request was passed on to Microsoft's Data Protection team (who guard against scams and illegal takeovers) who had to call me to verify etc. Then they emailed the admin of the domain to verify, and they emailed back saying they have lost the password, and that this domain move should be done. But the Data Protection team does not do domain removals - they called and verified the admin contact, and then reset the password for the admin contact. Once that was done, they themselves could remove the domain from the onmicrosoft.com tenant and I could add it to the non-profit tenant.
The whole process took a week, because of the multiple verification requirements, and because the various people were available only during some hours of the day. But the experience was not unpleasant, since the support people took the time to understand the issue and resolve it without simply ignoring it - as it happens sometimes with issues raised with Google.
qt project build with github actions - example
https://medium.com/@TomRvr/continuous-integration-for-a-qt-project-with-github-b19a33b39980
(I've not tried this yet - as of now only using tinyfiledialogs and not qt
Friday, July 07, 2023
bitnami moodle instance non-standard scripts
On one of our bitnami moodle EC2 instances, found that
/opt/bitnami/ctlscript.sh status
reported mariadb, apache and php-fpm not running.
sudo systemctl restart bitnami
Thursday, July 06, 2023
resurrecting a zebronics wireless mouse
changing SSL certificate from lego+LetsEncrypt to Cloudflare origin certificate
Due to the issues with certificate renewal for Bitnami Moodle images for Cloudflare proxied servers as mentioned at
https://hnsws.blogspot.com/2022/08/letsencrypt-certificate-renewal-issue.html
changed two more servers to use Cloudflare origin certificate instead, as at
https://hnsws.blogspot.com/2022/11/cloudflare-origin-server-certificate.html
and commented out their certificate renewal crons.
bulk redirects on Cloudflare
Wednesday, July 05, 2023
cohort query on moodle
There was a request to identify each user in some courses and the status of course completion, where the users were part of a cohort in Moodle.
My reply was something like this.
We can search for users by cohort in
Site Administration --> Users --> (use a filter) Cohort ID contains -- <name of our cohort>
Then we get the list of the 28 users in that cohort.
I have copy-pasted that list to the
"CohortTR2023001" sheet of a Google spreadsheet,
where you can find that 16/28 of them have never logged in.
Progress of the other 12 can be found by filtering the "activity completion report" of the relevant courses to include only the users in the "Cohort TR2023001" sheet, like I have done for the t3 course in a Google sheet - but for the t3 course, none of this cohort seem to have completed any of the activities
Link dump:
https://moodle.org/mod/forum/discuss.php?d=345963
led to
https://docs.moodle.org/32/en/ad-hoc_contributed_reports#Cohorts_by_user
https://www.youtube.com/watch?v=JceuROs6b1w
(seems to have course completion as report source, which we don't have)
How to set up course completion
https://www.youtube.com/watch?v=WItBsqLLlyg
(OK for at least one course of this cohort of ours)
So, that shows Course Completion as part of the reports in the course.
For T3, there is "Activity Completion"
Downloading that as csv, then filter by cohort users in google sheets?
Because according to
https://moodle.org/mod/forum/discuss.php?d=418752
"cohorts isn't one of the filters specfied in the documentation"
More about cohorts - how to add a cohort
https://www.youtube.com/watch?v=RSe3UsE5TaA
Site Admin - Users - Cohorts - Assign button for our cohort => list of users.
But can't copy from there.
https://moodle.org/mod/forum/discuss.php?d=244963
"Cohort is one of the ways you can filter by"
filtering a google sheet with data from another sheet
Tried out this technique,
https://webapps.stackexchange.com/questions/114399/google-sheets-filter-multi-column-list-with-another-list-using-a-function
but found no results. Maybe that was because our data was like that.