Tuesday, July 02, 2024

Microsoft Teams for new users

One of our institutions wanted to add a large number of new users to Microsoft Teams. Initial plan was to create email ids in Google Workspace and then add them as Guest users in Microsoft Admin console. But then, it would be much easier for the users, and also retain all the functionality of sharing meeting id via email etc if the users were created within Microsoft Admin console instead. So, finally, that was the way it was done. 



 

Saturday, June 29, 2024

Azure - Update firewall configurations to allow Logic Apps IP addresses

We got an email from Microsoft Azure, asking us to update firewall configurations to allow Logic Apps IP addresses by 28 September 2024.

Verified in all our accounts that the only logic apps we used were the VM automatic start/stop apps which are currently disabled. So, no action to be taken for this.

Friday, June 28, 2024

quaternion tutorial

https://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#how-do-i-create-a-quaternion-in-c-

It turned out that I did not need to include glm etc, as in the page above, since simple linear interpolation followed by normalization was sufficient for my use case. Apparently linear interpolation is close, though not exact - this discussion.

Wednesday, June 26, 2024

unable to see old assets after email change

One of our websites had an issue, described as below:

... User was accessing the system using old@gmail.com. She had some issues with that id and she edited her profile on CMS and changed it to new@gmail.com While the system allows her to login using her new email address, she is unable to see the assets assigned to her as editor in the new id. Even when she creates an asset, even though she logs in with her new email, the asset gets created under her old email id ...
Solution was:

In the users table of the Postgres database, only the "email" field is editable by users - now updated the "username" field to
new@gmail.com
from
old@gmail.com

(The updating of username field by users is not enabled since back-end changes to the CMS data sheet are needed when such a change happens.)

additional spam protection for forms using Cloudflare turnstile

One of our forms, which had first level protection using a hidden field, occasionally got bursts of spam submissions. Added Cloudflare turnstile as an additional layer of protection.

In the <head> section of the web page which had the form, 

<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" defer></script>

Inside the form,

<div class="cf-turnstile" data-sitekey="0x4OUR-SITE-KEY0-"></div> 

and in the done function, handling the "failed captcha" situation - 

 $.ajax({
                        method: "POST",
                        url: url,
                        data: user
                    }).done(function (msg) {

                        // When the request is successful
                        if(msg=="Success") {
                        $('span').html('<strong>Thank you for submitting your details. We will get back to you shortly, in a week or so.</strong>');
                        $("form").trigger("reset");
                        }
                        if(msg=="Failed captcha.") {
                            $('span').html('<strong>Please resubmit after the captcha loads, checking the box to confirm you are human if necessary.</strong>');
                        }
                    }).fail(function (err, textstatus, error) {
                        $('span').text(textstatus);
                    });

              

Then, we need to add some back-end code. Since we're using Google Apps Scripts, this looked like:

function doPost(e) {

var scriptProperties = PropertiesService.getScriptProperties();
var myKey = scriptProperties.getProperty('SECRET_KEY');
.....
const siteresponse = e.parameter['cf-turnstile-response'];
.....
var verifyurl = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
var formData = {
'secret': myKey,
'response': siteresponse
};
var options = {
'method' : 'post',
'payload' : formData
};

var responsetositeverify = UrlFetchApp.fetch(verifyurl, options);
var verifydata = JSON.parse(responsetositeverify.getContentText());


if (!verifydata.success) {
// do the rest of the processing only if verification returns success.
return ContentService.createTextOutput().append('Failed captcha.');
}
 
 

 


Monday, June 17, 2024

problem and workaround for Youtube api calls from Google Apps script

When trying to implement the earlier solution to one of our channels, the script would fail, complaining that the user was not authorized for live streams. Interestingly, when using google api explorer, it asks whether to use the google account or the youtube brand name. If we choose the latter, it works.

The issue and its solution are discussed at  

Accordingly, started work on a script of our own, based on this blog post, but paused development since manual creation of broadcasts was preferred due to the complicated setup which depends on GDrive service which would fail at least once a month as my previous experience with Drive service shows.

The one take-away from this exercise seemed to be that the 'consent screen' needs to be set to 'Production' for this workaround to work, otherwise the Oauth doesn't proceed.

Sunday, June 16, 2024

Missing Site UUID or Hub Secret error in Moodle

One of our Moodle sites was presenting users with this error, "Missing Site UUID or Hub Secret. Please check your Hub registration".

Apparently the fix is to change a setting, as mentioned at
https://h5p.org/node/1472461

"uncheck the option "Use H5P-hub. mod_hvp | hub_is_enabled" in the H5P settings in Moodle (.../admin/settings.php?section=modsettinghvp"

But that setting says, "It's strongly encouraged to keep this option enabled. The H5P Hub provides an easy interface for getting new content types and keeping existing content types up to date. In the future, it will also make it easier to share and reuse content. If this option is disabled you'll have to install and update content types through file upload forms."

There is also an option to "Register an account with H5P hub" just below that.

I have now tried entering some data into the "register an account" part, for one of our Moodle sites.

Hopefully this resolves the issue.

Sunday, June 02, 2024

closed Airtable and SendinBlue (now Brevo) accounts

Since I'm no longer using their services, closed Airtable and Brevo (formerly Sendinblue) accounts. For Airtable, I copy-pasted a table I had made into a Google Sheet, deleted collaborators from it, and then deleted my account. 

Saturday, June 01, 2024

VP9 codec for 4K video on Raspberry Pi4 - stutters

Tested a video encoded with VP9 - very good quality 4K video - only 2.5 GB file size for a 24 minute 4K video - but playback on Kodi running on Raspberry Pi 4 stutters for high complexity scenes. x265 is the way to go, for now. 

Tuesday, May 28, 2024

Zoom in from Milky Way to Puttaparthi

The scripts and settings used to generate this 4k fisheye fulldome video are shared at https://github.com/hn-88/openspace-scripts 


The following script was used,
https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/zoom-out-psn-to-galaxy4.osrectxt

where the motion is actually backwards, zooming out, in order to give a more controlled zoom travel. 

ffmpeg and blender were used to render the screenshot image sequences into video, forward and backwards. Blender could be used to fine-tune the video by speeding up parts of the video without much action and so on. 

ffmpeg to reverse a frame sequence - https://stackoverflow.com/questions/40475480/ffmpeg-convert-image-sequence-to-video-with-reversed-order

The zoom-in (reversed frames) have been uploaded and made available at archive.org using the x265-lossless codec under a Public Domain licence.

https://archive.org/details/zoom-in-to-psn-lossless

react app in docker vs native

Relative performance etc - via
which is hosted on vercel, https://gitachapsummwtel.vercel.app/

Hosting next.js on our own server -

Performance of docker -

Apparently nearly as good as native.

Monday, May 27, 2024

ffmpeg lossless for archive.org and reverse order of frames

Archive.org did not accept zip files containing frames for uploading 4K content, but lossless codecs were accepted.

ffmpeg - Best Lossless Video Codec for 8 bpc RGB image sequences? - Super User

seems to indicate that the best seems to be x265,

and commandline
 
ffmpeg -i input.mp4 -c:v libx265 -x265-params lossless=1 output.mp4 

And for reversing the frame order (backwards video),

 
- first bulk rename to - (minus) for the numbers prefix.

Saturday, May 25, 2024

github importer, for making a copy of a repository from the web interface

For testing a reported opencv bug

 
I wanted to make a copy of one of my repositories. Instead of cloning to a local directory etc, I wanted to do it from github's web interface. The solution seemed to be to use github importer. 
 
At the upper-right corner of any page, click the plus sign, and then click Import repository
 

making google great again

A follow-up to my post about the beginning of the end of Google -

https://askleo.com/why-ive-stopped-using-google-search/

and a temporary band-aid fix to get better search results from google,

https://tedium.co/2024/05/17/google-web-search-make-default/

- just add &udm=14 to the end of the search query url. 

Tuesday, May 21, 2024

Fly through Mars valley and Grand Canyon - generated with OpenSpace

The scripts and settings used to generate these 4k fisheye fulldome videos are shared at https://github.com/hn-88/openspace-scripts


 

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/setupgrandcanyon.osrectxt

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/grandcanyonflyin5.osrectxt

(default profile, Window options fisheye 4k as at
https://github.com/hn-88/openspace-scripts/blob/main/config/single_fisheye-4k.json )

Link to 4096x4096 video at archive.org -  https://archive.org/details/grand-canyon5

Flying 5 km (3 miles) above a valley on Mars, near Valles Marineris


https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/marsvalley2setup2.osrectxt

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/marsvalley2upfrombeginning3.osrectxt

(this recording is played in reverse at the beginning of the video.)

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/marsvalley2.osrectxt

Link to 4096x4096 video at archive.org - https://archive.org/details/mars-fly-into-valley0001-6940

The 4k frames are available with me, and can be made available. I'll also see if I can upload them to archive.org - Edit - apparently zip files with jpg frames can't be uploaded to archive.org, so I have added links to the 4K movie files uploaded to archive.org above.

Monday, May 20, 2024

Microsoft's answer to brute force mitigation - $$$

 How to avoid successful SSH Brute Force Attack - Microsoft Q&A

mentions Just-in-time access usage. But that

https://learn.microsoft.com/en-us/azure/defender-for-cloud/just-in-time-access-usage

requires Defender for Cloud Plan 2

https://learn.microsoft.com/en-us/azure/defender-for-cloud/plan-defender-for-servers-select-plan#plan-features

which costs nearly $15 per month per server!

https://azure.microsoft.com/en-us/pricing/details/defender-for-cloud/

Indian income tax e-filing - validation failed

When filling up the ITR2 income tax return, one of the "validation failed" messages said:

In Schedule CG, Sl. No. B4a LTCG u/s 112A is not equal to total of Col. 14 of Schedule 112A

This is probably because of rounding errors, I think. The numbers in the quarter-wise table in Schedule CG (Capital Gains) must add up to the numbers in Schedule 112A. So we should manually add and check, and make small one rupee adjustments to make the quarterly numbers add up to the total in Schedule 112A.

Another couple of points to note when there are "brought-forward losses" -
(1) in that case, the maximum amount of the BFL has to be applied - we can't apply a lower amount of the total losses to cover only part of the profits of this financial year
(2) and the numbers in the quarterly numbers should then add up to zero (if the losses completely cover the profits.)

Monday, May 13, 2024

making a copy of a wordpress blog and setting it up on another domain

What I should have done:

Probably I should have used wp-cli to deactivate all plugins before the migration. And apparently, the whole thing could have been done far easily with wp-cli - https://rocketgeek.com/basics/using-wp-cli-to-migrate-copy-your-site/
https://guides.wp-bullet.com/migrate-wordpress-site-new-server-wp-cli/

Steps taken:

0. Ran all commands inside screen.

1. https://wordpress.stackexchange.com/questions/75135/how-to-export-import-wordpress-mysql-database-properly-via-command-line
says a normal mysqldump should suffice.

2. Mysqldump complained about permissions -
Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespacesldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces

So, https://dba.stackexchange.com/questions/271981/access-denied-you-need-at-least-one-of-the-process-privileges-for-this-ope

SHOW GRANTS for someuser@localhost;.

To add the global privilege use the SQL command
GRANT PROCESS ON *.* TO someuser@localhost;

That solved the issue. In our case, I was running the SQL commands from the SQL console of dbeaver.

3. Created a new db as root, granted permissions for the relevant user as per https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

4. mysql -u theuser -p thenewdb < wpdevelbackup.sql to populate the new db.

5. Copied over the directory with cp -a to retain permissions as well as do a recursive copy - https://unix.stackexchange.com/questions/44967/difference-between-cp-r-and-cp-a
sudo cp -a olddirectory newdirectory

6. After that, need to update the wp_options table in the new database. option_value like '%public_html%' showed all the required changes to be made after siteurl -
siteurl
home
astra_sites_recent_import_log_file
recently_edited
astra_sites_recent_import_log_file
fs_active_plugins
duplicator_package_active
uagb_downloaded_font_files
_transient_dirsize_cache

(Had to copy paste to text editor and find and replace for the multiple instances of the old path in some of these fields.

the _transient field was very big. Since anyway it would be recreated, deleted its value instead of changing the path to the new path for that value.)

7. Have to edit wp-config file also, since the site was redirecting back to the old url. https://www.sitepoint.com/how-to-migrate-a-wordpress-site-to-a-new-domain-and-hosting/
Had to add the
define('WP_HOME','https://oursite.com');
define('WP_SITEURL','https://oursite.com');

at the end of wp-config file also, since I had not de-activated the plugins before doing the migration. Or maybe just a caching problem with firefox which I used for testing. Site was working at this point, when tested with another browser. (I had done the editing of /etc/apache2/sites-available etc beforehand.)

Wednesday, May 08, 2024

Schedule Page date listing much in advance

 PB wanted to verify that the schedule created for a few days in advance loads OK on the schedule page. But only a few days were visible. This was because

the code checks if the schedule data txt file is available, and then updates the dropdown, but only up to 5 days in advance -


while (dtimems < dateplus5ms) {
addifscheduledataavailable(dtimems);
dtimems += 24 * 60 * 60 * 1000;
}

It may be possible to see the schedule of other dates by changing your system date to the future.

And indeed, PB confirmed that he could check the published playlists for future dates by changing the system date.