Kotlin and Android Development featuring Jetpack – Covers a vast array of Kotlin features, with a good focus on Jetpack. This may have been the most difficult read I’ve ever encountered, but I started it with almost no understanding of app development with Kotlin, never mind Jetpack. I highly recommend this book to anyone currently…(Continue Reading)
Month: April 2022
Firebase addOnSuccessListener() and addOnFailureListener() to a .setValue() call in Kotlin
When the record write succeeds, I want to show them a “purchase complete” fragment, and if the record is not created, I want to at least warn them with an error code.
Use Care in Kotlin when Calculating Future Dates with Epoch Times
So, I’m left for my sage advice of the moment: “Use care in Kotlin when calculating future dates with epoch times”. Make sure any amounts you add to an epoch time are of the Long data type, just in case you edit the code later and forget to change it.
Easy Perl Dispatch Tables with Security Levels
The vast majority of Perl scripts that I write are for managing information via HTML forms. The script will generate the form, and then process the results when the user hits submit. In order to keep track of what form the user is submitting data for, I’ve generally used a hidden form variable named “state”.…(Continue Reading)
Firebase Database paths must not contain ‘.’, ‘#’, ‘$’, ‘[‘, or ‘]’
I’m trying to minimize the amount of data downloaded for subscriber accounts. I’d like to store all of my subscribers in the path /subscribers/[emailAddress]/ on my Firebase Database. If I can’t use the email address as part of the path, I’ll be forced to download the entire list of subscribers and then search through the…(Continue Reading)
pd.cut()
pd.cut() is a handy way of converting a linear set of values into categorical values. First, let me point out that pd is not a standard python command. It a common way of referring to the pandas library. You need to import it, and while we are at it, lets import NumPy as well: import…(Continue Reading)
Replicate a Firebase Real-Time Database with a simple Perl script
Here is a very simple script to replicate data from one Firebase RTD to a backup RTD. Just be sure to modify the array of root keys (@firebaseBackupKeys) to reflect your database. This version can be called from a web browser, or via a cron job. #!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); print ‘Content-type: text/html’, “\n\n”; use…(Continue Reading)
Install Firebase Perl module with Bitvise SSH
Connect to your web host, then click the “New Terminal Console” button. 2. Type “cpan” at the command prompt: 3. If cpan requires configuration, select “local::lib” by pressing enter, or sudo if you have permission for the server. In my instance, my web host does not allow sudo. 4. Once cpan finishes configuration, note the…(Continue Reading)
postValue() not working from MainActivity.kt
I have a View Model named “subsViewModel” that I’m storing subscription details for use by various fragments and MainActivity.kt. When a user authenticates with Google Firebase authentication, I want to store the user’s details into subsViewModel as shown below: Authenticate, Store Firebase User Information // Authenticate users: auth = Firebase.auth if (auth.currentUser == null){ //…(Continue Reading)
java.text.ParseException: Unparseable date: “”
Logcat Fatal Exception caused by: subscription?.nextExpirationAsEpoch = SimpleDateFormat(“MM/dd/yyyy”).parse(subscription?.nextExpiration).time
When reading subscription records from a firebase realtime database.
Fatal Exception when iterating over firebase real-time database keys caused by a blank secondary database key. Possible fixes included ensuring the secondary key and the date string are not null, as well as logging errors with a toast.