Saturday, April 24, 2021

Android 11 and Google Photos Permissions

 Got me a OnePlus 9 yesterday, which already comes with Android 11 installed. Migration of apps over there was rather smooth, many thanks again for LastPass, taking care of easily getting authenticated in all those newly (re-)installed apps.

Even moving those apps who are supposed to run on one device only, was quite easy this time. I'm speaking of authenticator apps (Microsoft and RSA) and the Banking apps.

What kept surprising me was that whenever I wanted to delete a photo in Google Photos I had to answer an additional "Allow Google Photos to ...".

I googled around and found that this was a side-effect of the new Android Scoped Storage that they finally implemented to get some more fine grained control over apps accessing the filesystem.

There is a nice article over at XDA Developers detailing this "issue" and the remedy.

OnePlus Gallery app is the owner of the photo storage area ("System Gallery") and not Google Photos (except on Pixel phones of course), but you can change that and make Google Photos the owner. 

The TL;DR: go to your pc, connect the phone and get out the adb.

adb shell cmd role add-role-holder android.app.role.SYSTEM_GALLERY com.google.android.apps.photos

Did the trick for me.

Monday, January 04, 2021

ISO compliant year-week function in DB2

 I've already shown how to create a year-month function in DB2, which - when it comes to date arithmatic - is quite straightforward, because very year (in ISO/Gregorian) calendar starts with the first month.

Some systems argue whether this should have the ordinal 1 or 0, but thats the usual 0/1 issue in programming.


Weeks however, are far more complex, because not every year starts with the begin of a week (whether this is Sunday or Monday in your preference / area).

It might just start with a Thursday... WOW.

So for that ths ISO 8601 standard set a definition on what is to be considered week 1 of a year:

The ISO 8601 definition for week 01 is the week with the first Thursday of the Gregorian year (i.e. of January) in it
Luckily, DB2 has a function for that - WEEK_ISO.

So let's just try that with a 

rtrim(char(year(TS))) || right(digits(week_iso(TS)),2)

Takes the year (need to rtrim it) and adds 2 digits week to it (you might want to insert a "w") between them.

However, this leeds to e.g. 2021-01-03 being in week 53, because week 1 start on 2021-01-04.

the yearweek for 2021-01-03 therefore should be 2020-53 not 2021-53 as the above formular would yield.

Now we need to make sure that if we get a week 53 and its January we return the previous year... Only for January, because some days in December might also be week 53, and we need to keep the year there.

Voila:

create function yearweek_iso(TS timestamp)
returns varchar(6) no external action deterministic 
return    
CASE

     WHEN (week_iso(TS)=53 AND month(TS)=1) Then
             
rtrim(char(year (TS)-1)) || right(digits(week_iso(TS)),2)   
     ELSE
              rtrim(char(year(TS))) || right(digits(week_iso(TS)),2)
END


The results now match whatever java.time package might do with week parsing. In order to get the first day of this week back (in Java, where I needed it), you parse as follow:

new DateTimeFormatterBuilder()
            .appendValue(IsoFields.WEEK_BASED_YEAR, 4)
            .appendValue(IsoFields.WEEK_OF_WEEK_BASED_YEAR,2)
            .parseDefaulting(WeekFields.ISO.dayOfWeek(), 1)
            .toFormatter();

Saturday, May 09, 2020

Windows 10 Folder Shortcuts

I have to admit, I did not know about that:

The shell: command can be used to open a special folder directly from the Start, Search menu or from the Run dialog. For example, the command shell:sendto opens the SendTo folder (%userprofile%\sendto) of your user profile. To launch the Documents folder of your user profile, you’d type shell:Personal. Below is a complete shell: commands listing for Windows 10/8/7/XP/Vista. The entire listing is stored in the following registry key in Windows Vista and higher:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\FolderDescriptions
So e.g. Windows-R and "shell:startup" opens the startup folder.
I used to play around with "%appdata%" etc etc where I knew there was an environment variable for it, but the shell: shortcut enables a lot more.

Found - amongst others - here 
and of course on superuser.com

Wednesday, January 08, 2020

How do I stop my Firestick from optimizing?

Well, the other day I noticed that my USB charging cable for my Amazon Fire Stick was broken. So I just dug into my USB cable carton and get the next best USB micro charger and replaced the broken one.
Done.

I thought.

A couple of days later I found the stick busy  "Optimizing systems storage and applications...", letting me know "This will take approximately 10 minutes to complete.".
Fair enough... You do your thing then...

Well, it never completed, Even rebooting did not help.

Image result for have you tried turning it off and on again

So I googled, and found a bunch of useless videos, that show you the stuck message for minutes and complain about the stick being stuck... and that not even Alexa would work.  No sh$t, Sherlock.


Oddly enough, the cause (as those google searches revealed) was related to me changing the power supply/cable. Shouldn't have picked the cheapest one.
Went back to the USB cable box, took a more expensive looking cable, and - voila - after completing the optimization the stick is now back running as it should.

And I just saved you half an hour of your life watching those not-really-helping videos.
You're welcome.

Tuesday, October 29, 2019

Google .new shortcut for Calendar

Just found this on engadget.

If you type in cal.new or meeting.new in the address bar (sorry, awesomebar, or whatever it is called these days), it will directly re-direct you to the page/dialog to create a new calendar entry for your google calendar.

Seems to have been around for google docs for a while now, but I don't really create a lot of them, compared to calendar entries.

Nice use of TLDs ;)


Saturday, February 02, 2019

Google Photos from OnePlus Camera

The latest update on my OnePlus 5T (to Android P) make OnePlus Gallery the app that opens when you click on the gallery/image icon at the lower right corner.


Just setting Google Photos as the default app does not change that...
You have actually disable the Gallery app.

To do this, go to the phone's settings, and the applications menu there.
Find the Gallery app, and click on the Disable button.


From then on, the camera will open the default app for photos, which you should make sure to set to Google Photos.

Saturday, December 15, 2018

Finally LastPass Autofill on iOS

I have to admit that I don't know how long this has been there, I just noticed it last week.
iOS (on my iPad) can finally use LastPass
(my favorite password manager) in addition to it's own keychain.

All you have to do (besides of course having a LastPass account and having the LastPass app installed on your device) is the following.

Go to the Settings menu, and find the section "Passwords & Accounts".
There you will see the item "AutoFill Passwords". Touch on the arrow to the right to get to the next step.

.

You should see all installed AutoFill applications there, in my case Keychain and LastPass.



All you need to do here, is select the check mark to the right to enable it.

Depending on your LassPass vault and settings, on the next Login (app or web-page), you will be given a choice to select the credentials from your LastPass account. In my case I have to provide a fingerprint first... but that's it.



Pretty cool. Essentially the same as with Keychain, just accross platforms. That's why I use LastPass.