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?v=BhQWOv10Oag

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?v=JH68wBXO5j0 . But then we can only have discrete dim levels, and probably the light will just cut out completely at some point. 

Using duct tape, parchment paper etc we can physically block the light and thus dim it too,
 
But in our case, creating a motorized mask like the above seems more difficult than just buying some "dimmable" LEDs. So the next step might be to explore such products.  

Edit: my post about using "smart lamps" for this is at
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

Canara bank was fined for non-compliance, and is now planning to overhaul its IT infrastructure. Something similar might be needed for LIC also soon. Some points from my recent experience with the LIC, their customer portal and phone-based customer service - 
    1. Money was credited to my account. But no intimation about which policy etc. Digging around in the portal showed one of the policies' "survival benefit" processed 2 months ago - that seems to have been credited now. 
      2. Asking by email or via phone support about which policy credited the amount - no reply to email, and phone support wanted me to enter policy number, but gives too short a time to enter the 9 digit number! Tried without entering the number, but the agent said I have to enter the number for them to help me. Phone support also pointed me to the wrong section on website for checking which policy credited the amount. Instead of Premier Services -> Policy Claim History, the agent on the phone was guiding me towards Basic Services -> Claim Status. The latter seems to show maturity etc in the future, while the former shows the past credits, which is what I had asked for.
        3. "Service request" - OTP kept being rejected "Wrong OTP..." on Edge browser. Finally tried Chrome browser, that works. Phone support initially asked me to email portalsupport at licindia dot com, no reply. I filled up a new ticket as mentioned on the home page of their new portal, again no reply. 
          4. After going through all those hoops, "Could not connect to server, try again later".
            5. Luckily, when I tried again the next day, it worked. This "try later" business is applicable to the "Jeevan Saakshya" app also. Sometimes it just doesn't work. Trying again later, after a few hours or days - it may then work. 
              6. Some of their warnings to policy holders given on the website seem to be at odds with the instructions given to the people in their offices. A random person rang up me up saying that he's an agent, and I could send the policy to him so that the survival benefit could be credited to me! This, in spite of the NEFT registration already done on the portal for that policy. Finally, their office rang me up, clarifying that it is their policy to inform "good agents"(!) about maturing policies so that users can re-invest. Anyway, I could send an email to them with the form they wanted me to to fill up, along with a picture of the policy, and though they said that the money would be credited the next day, it actually took a week.

              Maybe this sort of bad IT infrastructure is not limited to Govt-run undertakings - TCS comes to mind with their terrible websites in the past. Hopefully improving now. 

              Just a random link about issues with govt offices, which are much much worse than their online systems - https://old.reddit.com/r/Kerala/comments/rbvpue/what_are_some_of_the_worst_experiences_youve_had/
               
              Edit: August 2023 - Credit where credit is due. Calling / emailing the "customer zone" at Kozhikode for LIC gave a very different experience. The person taking the call / answering the emails was very helpful, was ready to give a printout of the required amount credited details, gave all the details I asked for by email when I said I was out of town. Probably this is a direct employee of LIC, as against the contract workers manning the toll-free number.

              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

              When attempting to upgrade Moodle via git, upgrading from 401_STABLE to 402_STABLE caused the error message ! Exception - syntax error, unexpected '|', expecting variable (T_VARIABLE) !

              "
              is usually an issue with having a moodle version trying to run under a version of PHP that is too high or low.

              See the chart @
              "

              so probably we will upgrade the OS and then upgrade Moodle from 4.1 to 4.2 - 4.1 has security support till 2025.

              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/awesome-blender#ai-powered-

              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 status bitnami
              showed httpd and mysqld running, and with that, could restart the service etc.
              sudo systemctl restart bitnami



              Thursday, July 06, 2023

              resurrecting a zebronics wireless mouse

              There was a Zebronics wireless mouse with a USB dongle which was deemed to be "not working" since the LED would go off 2 seconds after inserting a new battery. Poking around to see if it would work, I saw a jumper location at the bottom, which was left open. I thought that maybe that jumper had fallen out and hence it was not working, so googled, and found this - 

              So, I tried holding down the scroll wheel and the right-click button for a few seconds - nothing happened - and then inserted the dongle into a USB port. It took a few seconds, but after that, the mouse started working again. So, maybe the scroll wheel and the right-click button did something, or maybe it just needed the dongle to be plugged in before lighting up the LED at the bottom. 

              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

              Cloudflare has the new feature of bulk redirects -

              There is a redirect creation wizard which makes the creation of redirects very simple -

              I've now created redirect rules for

              If any other redirect is needed, like
              or something like that, it should be possible.

              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.