Wednesday, April 07, 2021

signing release build apk files in android studio

The procedure to sign apk files - if you just click on Generate Signed Bundle / APK, the wizard prompts you to create a keystore (or use an existing one) and create the signed build. We have to save that keystore safely, since we will need it for signing any updates to the app on Google's Android Play store (app store). 

But that is not enough - the apk would not install. We've also got to set the signing configuration in the Project Structure, check both v1 and v2 signature versions, and also look for any of the issues which are listed at this page. Mainly, as in this link
Project Structure - Modules - Signing tab - add a configuration, and under Build types tab, release build, under signing config, choose the one which we have added. 

loading software on a few hundred tablets

There was some discussion about loading software on some Android devices which were to be shipped to schools. 

Initial thought was to create ids like
OurPrefix.TAB.2021.01@gmail.com
to log on to the play store for the tablet which has asset id OurPrefix-TAB-01 etc.

We could then print out the password and put it in the box for the teachers to change if necessary.

This is required, since this is not a factory install, and factory install process is very different from manual install :) For a manual install, we have to log on to the play store with a particular account, etc etc. 

If we are to not create such ids, installing and then logging out of the account used to install can work for our free apps, but with the drawback that the apps will not update. For updates, the users would have to uninstall and reinstall. 

The next idea was to install all these apps using pre-downloaded APK files, so that the internet connection would not be a bottleneck in the prep process which was planned to be done on a single day for several hundred devices - taking the help of a score or more of volunteers. This too had the drawback of the apps not updating automatically from the Play store. 

Finally the idea of links to the Play store was mooted. 

  • Connect via USB cable to the computer, Choose the "File transfer' USB usage preference, copy the tabletslinks.txt file to the Download directory on the tablet. 
  • Navigate to the txt file using Google Files on the tablet, click on it and choose to open with Chrome. 
  • Copy each line (each link), open a new tab in Chrome, paste in Chrome, hit Enter (while offline)
  • Click the three vertical dots on the right hand side of the Chrome address bar, choose "Add to Home Screen"
  • Write an appropriate short link title like Pdf for the adobe pdf reader link, Office for the office link, Teams/Meet/Zoom for the respective links.
  • Drag and drop the link to the home screen.
The whole process was timed at less than 5 minutes from the time the tablet was booted up. And this was the final solution chosen.


Saturday, April 03, 2021

Android studio Git checkout

For checking out at a specific commit - 
https://stackoverflow.com/questions/36517118/how-do-i-checkout-an-old-git-commit-in-android-studio

right-click relevant commit on the Git tab's history, choose 'Checkout revision <hash>'

keeping Windows and Linux dual-boot times correct

This 2011 post has the Kubuntu 10 way, and for current machines running systemd, the way to do it is, if choosing to make Linux use the hardware clock as local time, 
timedatectl set-local-rtc 1

Thursday, April 01, 2021

fixing Filezilla error about LC_CTYPE environment variable

As described on this page, the solution was

sudo nano /usr/share/applications/filezilla.desktop

Find  the line
Exec=filezilla
and replace it with
Exec=env LC_ALL=en_US.UTF-8 filezilla


Tuesday, March 30, 2021

how to identify if a DLL is a debug or release build

Needed to check if one of our servers was gobbling up RAM due to a debug DLL, so checked and found this SO conversation about identifying debug / release builds DLLs. One of the replies mentions '.NET Assembly Information' by Rotem Bloom - https://github.com/jozefizso/AssemblyInformation and a more recent fork at https://github.com/tebjan/AssemblyInformation

Also a quick and dirty solution, "One way that could work for most people is to simply open the DLL/EXE file with Notepad, and look for a path, for example search for "C:\" and you might find a path such as "C:\Source\myapp\obj\x64\Release\myapp.pdb", the "Release" shows that the build was done with Release configuration."

Monday, March 29, 2021

repairing boot after installing windows

For Ubuntu and Ubuntu-based distros like Linux Mint, running the graphical boot-repair tool from a live CD / USB is a good option. In my case, I had to choose to boot with advanced startup and restart in Windows 10, or else the BIOS screen was not visible for me to boot from USB.

creating Windows installer USB drive from ISO - on Linux with woeusb

The usual route using unetbootin would need the USB drive to be partitioned as FAT32 (using gparted, the Disks utility on Linux Mint doesn't do it - and have to mount with Disks utility after gparted does the reformatting). But then the Windows 10 installation ISO contains a file installer.wim which is 5 GB, so it can't be written to the FAT32 volume. So we have to use ntfs - 
https://askubuntu.com/questions/162174/how-do-i-use-unetbootin-to-make-a-bootable-windows-usb-installer
or use woeusb.

(Detailed steps:

woeusb ppa gives error on install,
The following packages have unmet dependencies:
 woeusb : Depends: libwxgtk3.0-0v5 (>= 3.0.4+dfsg) but it is not installable
E: Unable to correct problems, you have held broken packages.

woeusb 
needs https://wimlib.net/

sudo apt install build-essential
./configure

gave
No package 'libxml-2.0' found

sudo apt install libxml2-dev

Cannot find libntfs-3g

sudo apt install ntfs-3g-dev

error: Cannot find libfuse

sudo apt install libfuse-dev

sudo ./woeusb-5.1.0.bash --device /home/path/Win10_20H2_v2_EnglishInternational_x64.iso /dev/sdb

wimlib-imagex: error while loading shared libraries: libwim.so.15: cannot open shared object file: No such file or directory

Solution was to run ldconfig, as found in
https://wimlib.net/forums/viewtopic.php?t=240

sudo ldconfig -v

)


Visual Studio publish and deploy ASP .NET Core app to IIS

This link has the basics on how to do the setup, and also some do's and don'ts for ASP .NET apps on IIS - https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.0&tabs=visual-studio

Sunday, March 28, 2021

run explorer as Administrator

On Windows server, there is no "Run As Administrator" directly available for File Explorer. So, we can go to C:\Windows with File Explorer, and then right-click on explorer.exe and Run As Administrator. 

sql query to replace a substring

We needed to replace some Windows paths in a MySQL database. Following 
https://www.mysqltutorial.org/mysql-string-replace-function.aspx/

update tablename set tablename.MediaSource = REPLACE(tablename.MediaSource,
        m4a,
        mp3)
WHERE
    tablename.MediaSource like '%Dashboard%1%1%2%1%2.m4a';

and if we wanted to be more specific, the '\' in the Windows paths need to be escaped as four backslashes - following https://stackoverflow.com/questions/14926386/how-to-search-for-slash-in-mysql-and-why-escaping-not-required-for-wher - 

select * from tablename where tablename.MediaSource like '%Dashboard%1%1%2\\\\1\\\\2.m4a';

And the syntax for a count statement was like

select count(*) from (select * from tablename where tablename.MediaSource like '%Dashboard%m4a') myqueryname;

finding mysql data size

According to 

https://support.microfocus.com/kb/doc.php?id=7019203#

we can find the data directory from my.ini which would be in server directory in program files - the datadir line in my.ini

But on our install, it was in c:\programdata\mysql

and data was also there.

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.