Sunday, March 28, 2021

Notes on locally mounting Windows NTFS drive on dual boot Linux

In order to make the partition visible as a separate entry on the side bar, move mount point to /media/windows1 or something like that - 
https://forums.linuxmint.com/viewtopic.php?t=300597

https://www.google.com/search?q=umask+needed+to+make+vfat+drive+writable+by+all+users+on+linux

umask=0 for writable by all.

visual studio offline installer

Wanted a way to create an offline Visual Studio installer - found it is possible, but have to run Windows to go through the process at this link.

Adding google search to Firefox on Linux Mint

Linux Mint has removed Google from the search engines available by default, and we have to follow a "Microsoft-esque" convoluted procedure to make Google search available from the address bar or the search box - following https://www.techbrown.com/add-google-default-search-engine-firefox-linux-mint/

  • Go to https://linuxmint.com/searchengines.php
  • Scroll down to the bottom of the page and click on the Google logo
  • The page which loads up then has instructions to right-click on the address bar and add Google search from the context menu. 
  • Then we can choose to make Google the default search from the search box from the "Change search settings" gear icon under the search box also. 

Restoring Linux after Windows install

Following the instructions from https://forums.linuxmint.com/viewtopic.php?t=92409

"Boot from a LIVE DVD (in my case Linux Mint booting from USB key drive)

If you don't know the location of the linux partition, you can determine the partition that Mint is installed on by:
Open terminal and run
sudo gparted
Look for the large EXT4 partition and make a note of what it says on the far left such as sda6
Close gparted

In terminal enter:
sudo mount /dev/sda6 /mnt (replace sda6 with whatever is appropriate for your system)
sudo grub-install --root-directory=/mnt /dev/sda (note there is a space between mnt and /dev and do not put a number after sda)

Restart the computer and you should have your grub menu available again."

But in order to boot from a different medium when Windows 10 is installed, we may need to go through some hoops, as mentioned in this post.

Friday, March 26, 2021

customizing Moodle theme per course

Replying to a request of adding blocks to some courses on one of our Moodle servers - 

https://moodle.org/mod/forum/discuss.php?d=256667

Site administration>Appearance>Themes>Theme settings - can set it to allow course themes. 

Then I went to an example test course I created,

  • Turned editing on,
  • clicked on the gear icon,
  • clicked on Edit settings,
  • Scrolled down to Appearance, opened up the Appearance section,
  • and in the appearance section, chose
  • Force Theme : Boost.
  • After doing that, I'm able to add blocks as per this video,
    https://www.youtube.com/watch?v=uByp1qqcWt8

But please note, not all types of blocks are supported on mobile - please see the list of supported blocks below.

https://docs.moodle.org/310/en/Moodle_App_Block_support

In this way, you can set your own look and feel for only some courses as per the method above, without disturbing the look and feel of the rest of the site.

finding and listing files without extensions in Linux

This post - 
https://askubuntu.com/questions/337964/list-all-files-that-do-not-have-extensions
uses ls to list all files without extensions.

Then there is the technique using find,
https://unix.stackexchange.com/questions/47151/how-do-i-list-every-file-in-a-directory-except-those-with-specified-extensions
to list those files other than those with specific extensions, which I used like

find nameofdirectory ! '(' -name '*.mp3' -o -name '*.docx' -o -name '*.zip' ')'

find nameofdirectory ! '(' -name '*.*'  ')'
lists directories also.

find nameofdirectory -type f ! '(' -name '*.*' ')' | wc -l 
for counting the total.

Thursday, March 25, 2021

file transfer using remote desktop - RDP

Transferring a single zip file is much much faster than transferring a large number of small files. Another issue with transferring a large number of files this way is that some extra files are created - "which indicate that the file originated from the network". Zone Identifier files as explained in this post - https://apple.stackexchange.com/questions/378438/what-are-these-extra-zone-identifier-files-created-during-windows-remote-deskto

To enable file transfer from the Remmina RDP client, check the shared folder and enable a folder to share, in the Basic tab, and Sound Local in Advanced tab



Macbook not charging

Resetting the SMC - System Management Controller - is supposed to cure many issues related to battery etc. In my case it did not help - maybe because the Applecare person has removed the bulged battery?

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

"with non-removable battery" - 

Hold down Shift + Ctrl + Opt , then hold down power button also, for 10 sec.

Release all, then press power button to turn on.

creating webview android apps, and angular to apk

Some links, tutorials etc for easily creating webview-based Android apps - 

Edit: 25 Dec 2021 - For another version of webview with upload support, 
https://github.com/delight-im/Android-AdvancedWebView

Wednesday, March 24, 2021

changing the name of an Android app

1. From https://stackoverflow.com/questions/5443304/how-to-change-an-android-apps-name

By changing the android:label field in your application node in AndroidManifest.xml - Please make sure that you change label:

android:label="@string/title_activity_splash_screen"

in your Splash Screen activity in your strings.xml file. It can be found in Res -> Values -> strings.xml

2. change the package name - from

https://stackoverflow.com/questions/16804093/rename-package-in-android-studio

  • In your Project pane, click on the little gear icon
  • Uncheck the Compact Empty Middle Packages option
  • Your package directory will now be broken up into individual directories
  • Individually select each directory you want to rename, and:
  • Right-click it, Select Refactor, Click on Rename
  • In the pop-up dialog, click on Rename Package instead of Rename Directory
  • Enter the new name and hit Refactor
  • Click Do Refactor in the bottom
  • Allow a minute to let Android Studio update all changes
  • Note: When renaming com in Android Studio, it might give a warning. In such case, select Rename All

To change the build package name, change
File > Project Structure > Modules > Default config > Application ID

A commit with the name change is here.

Tuesday, March 23, 2021

ASP .NET memory usage

An ASP .NET web app under development was using a lot of memory. Googling, found this resource from Microsoft to check - https://docs.microsoft.com/en-us/troubleshoot/aspnet/high-memory-level

Monday, March 22, 2021

send a post request with curl

https://github.com/thephpleague/oauth2-server/tree/master/examples

https://gist.github.com/subfuzion/08c5d85437d5d4f00e58

Since the default is application/x-www-form-urlencoded, the shortest would be
curl -d "param1=value1&param2=value2" -X POST http://localhost:3000/data

or with a data file,
curl -d "@data.txt" -X POST http://localhost:3000/data

Saturday, March 20, 2021

some post install changes needed for moodle

I had made a test moodle server by copying over the database, moodledata and /var/www/html/moodleinstalldirectory to a different server. Additionally, the following changes needed to be made.

  • Had to set up the cron job. The instructions given at MoodleDocs were to create it as the www-data user, crontab -u www-data -e 

    First ran it on the command-line to test that it works, running it as the www-data user with
    sudo -u www-data /usr/bin/php   /var/www/sssvv/admin/cli/cron.php
    - that took 2 minutes to run the first time, but later runs finished in a second or so.

    But on this Ubuntu 20.04 machine, a cron set for www-data did not work - probably as a security feature - though it did have a file in /var/spool/cron/crontabs as a comment on this page mentions. So, made a cron job as root, but running as www-data as per this post.
    * * * * * su www-data -s /bin/bash -c "/usr/bin/php /var/www/sssvv/admin/cli/cron.php"

  • Had to increase the php file upload limit
    sudo nano /etc/php/7.4/apache2/php.ini
    ( Ctrl+w to find and change post_max_size
    Ctrl+w to find and change upload_max_filesize
    Ctrl+w to find and change max_execution_time  - set to 600 for now.)
    sudo apachectl restart

  • Make the disk mount permanent by editing /etc/fstab - had to find the UUID of the partition using
    lsblk -f
    sudo blkid

    and then in /etc/fstab, added the line at the end,
    UUID=<uuid found using blkid>   /datadrive/mount/path   ext4   defaults,nofail   1   2
    Doing a umount and then a mount -a would mount it from fstab, so that we can correct errors if any. 

Linux Mint Workspace size

In order to disable extra workspaces on Linux Mint,
https://forums.linuxmint.com/viewtopic.php?t=280563

Ctrl+Alt+Up Arrow to enter the workspaces mode, select each unwanted workspace and choose to close.

Then my recurrent issue on Linux Mint installs on a Macbook - the workspace size seems to be much bigger than the screen size. Menu - Preferences - Display - found that two screens were enabled - disabled one to solve the issue.




delete a service on Windows server

One of our servers had an issue with RAM being used up. Found that it was due to a second instance of Mysqld being created as a service as seen in the screenshot. 



The two instances of Mysql were conflicting with each other, and causing mysqld to continuously use up RAM and CPU. I deleted the 2nd instance of mysqld, following this procedure.

  • Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services key with regedit
  • Select the key of the service you want to delete and choose Edit menu - Delete

Thursday, March 18, 2021

Moodle layout - removing the footer

This page has a discussion about hiding the footer in Moodle where Boost theme is used - 
https://moodle.org/mod/forum/discuss.php?d=349625

The idea of hiding a section with something like
footer#page-footer {display: none;}
in the custom scss box is useful. 

In the Moove theme, there is the option to not display the footer, as noted elsewhere in the thread. 

Wednesday, March 17, 2021

removing android app splash screen

Quite an involved process to remove the splash screen, and many places where things can go wrong - 
https://stackoverflow.com/questions/48239602/how-to-remove-splash-activity-from-an-existing-project/482396

Probably just easier to customize the splash screen with our graphics, and reduce its time interval. For example,
val SPLASH_TIME_OUT = 5000
in  PYF-SmartWebView-3.5

Tuesday, March 16, 2021

install parse failed no certificates error for Android apk

It turns out that this is some sort of catch-all error, and various things which can cause this
Installation error: INSTALL_PARSE_FAILED_NO_CERTIFICATES
for Android apk files are discussed at
https://stackoverflow.com/questions/2914105/what-is-install-parse-failed-no-certificates-error

My issue turned out to be an incorrect signing configuration as in the top answer. 

Saturday, March 13, 2021

warning in firefox for mixed content

Copy-pasting from a long explanation I had sent to someone:

The reason why Firefox shows the warnings and Chrome doesn't is because Chrome automatically checks for https links for mixed content, and automatically serves the https link instead of the http link in case it works.

You can find out which particular links are serving the mixed content (http links on a https page) by choosing inspect element when you right-click on the page, and seeing the console output.

Looks like Firefox will display the warning even if the http link is redirected to an https link - 

https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content

"To fix this type of error, all requests to HTTP content should be removed and replaced with content served over HTTPS. Some common examples of mixed content include JavaScript files, stylesheets, images, videos, and other media.

Note: The console will display a message indicating if mixed-display content is being successfully upgraded from HTTP to HTTPS  (instead of a warning about "Loading mixed (insecure) display content")."

So even with cloudflare proxying set to strict https, Firefox would show this warning (as of March 2021).

Then, if you want this to be fixed, ask whoever has access to the web server to change all http requests to https - 

https://themify.me/blog/mass-replace-urls-https-wordpress-database


Friday, March 12, 2021