Saturday, December 22, 2018

Continuing the Markeen-inspired project

With some time on my hands now, I'm looking at the projects I left in progress. One was to create a Keen 5 level pack by starting from random Markeen-generated levels. I previously finished five levels but got stuck on a particularly large one. Yesterday and today I chipped away at it by fixing incomplete platforms and smoothing out the structure. That's nearly done now; the next phase is to make it playable.

Thursday, December 20, 2018

Mod demos on Keen Modding Live

I've been corresponding with another PCKF user about using the Keen Modding Live platform to host demos of mods. This will make it possible to embed demos on web sites like the KeenWiki. It will require some special considering from KML since uploading an entire mod doesn't fit the "user level plus standard episode package" model. I don't plan to deeply integrate the two kinds of players. The one for mod demos will probably not be linked at all on the main site; it'll just be for embedding.

Sunday, December 16, 2018

Creating an object with New-Object -Property won't preserve property order

A convenient way to create PowerShell objects with a given set of properties and values is to make a psobject with New-Object and supply the data in a hashtable literal to the -Property switch. But since hashtables are unordered, this will add the properties to the object in a jumbled order. For example, New-Object psobject -Property @{'a' = 1; 'b' = 2; 'c' = 3; 'd' = 4} produces:

c d b a
- - - -
3 4 2 1

If you're going to display the objects raw and want a nice order to their properties, you need to create a plain psobject and add the properties one at a time in the desired order with Add-Member.

Tuesday, December 11, 2018

Volley's retry mechanism works better than manual retry

I recently discovered Volley's setRetryPolicy feature to automatically retry requests that time out. I had previously been restarting the web request in the error callback up to a certain number of times, which worked but was messy. When I replaced that logic with Volley's mechanism, I found that my app became more likely to successfully get the data. In my testing, I've almost never needed to use the UI's retry feature anymore.

Saturday, December 8, 2018

onCreateOptionsMenu can be called before onCreate

Today I investigated a NullPointerException crash inside an activity's onCreateOptionsMenu. It was strange because the reference that was null is always initialized by onCreate. Apparently, onCreateOptionsMenu can be called first, though apparently that's not usually the case. I was able to trigger it by opening the activity in question, switching to the Settings app, revoking a permission from my app, and switching back to my app.

Friday, December 7, 2018

Volley can automatically retry timed-out requests

I had previously added some logic to my app to try a Volley request a few times if it failed due to a timeout. Today I learned that Volley can handle this automatically. Request objects have a setRetryPolicy method that takes a RetryPolicy, probably a DefaultRetryPolicy specifically.

Monday, December 3, 2018

Export-PfxCertificate won't export non-exportable private keys

Upon import to the certificate store, private keys can be marked as non-exportable. A commenter on Super User pointed out that PowerShell's Export-PfxCertificate cmdlet fails on such certificates. That makes sense, though I had hoped the non-exportability restriction was only enforced by UI. There are unofficial/unsupported ways to get around this by using tools like Mimikatz.