Tony Scida
Archive About Also on Micro.blog
  • Adapting iPhone views to Dynamic Type Sizes

    I’m still making progress towards getting my app, Scale Shuffle, ready to submit to the App Store. (The app displays a random scale as a music practice tool.) Today I spent some time making sure it looks good (or at least ok) at various text scaling sizes. This required changes to every screen. At first I thought I was going to have to lose the icons on the Resources screen, and then my friend Ben pointed me towards the documentation for the Dynamic Type Size environmental variable.

    → 4:55 PM, Jan 23
  • Because this tripped me up, even though it’s maybe obvious to everyone else. There are two Property List options that mention encryption, and if you want the prompt in App Store Connect about encryption exporting to go away, you need the second one.

    → 4:19 PM, Jan 16
  • Django {% regroup %} and dictsort

    I ran into an issue using Django’s {% regroup %} template tag where sometimes a group would be shown twice. It turns out that I needed to use the dictsort filter on the object list, as noted in the documentation, becasue I didn’t have the model ordered by the property I was grouping on.

    Here’s the example from the documentation:

    {% regroup cities|dictsort:"country" by country as country_list %}
    

    In my case, I needed to filter by a property of the related model:

    {% regroup employee.request_set.year|dictsort:"request_type.name" by request_type as type_list %}
    
    → 1:27 PM, Jan 8
  • Getting the unique years from a Django query

    For the same project I previously posted the custom model manager for, I needed to get a list of just the years for all the entries in a queryset. After a bit of experimentation and going down a few dead alleys, I found my answer in the excellent Django documentation, with the .dates() method.

    → 12:29 PM, Jan 3
  • Automatic Database Backups to S3 from Dokku Postgres

    For a Django web app I run, I wanted to set up more-frequent backups of the database to S3 storage. It turned out to be simpler than I thought, because the site runs on Dokku and the database plugin supports encrypted backups to S3. Initially, I looked at the write-up in this post, but quickly found a few mistakes in the example code and instead looked at the examples in the database plugin’s excellent documentation. Thanks Thom as well for the advice on configuring the S3 bucket.

    The short version of the steps to set it up is:

    # Authenticate with AWS
    # <service> is the name of the database service you created
    # and linked to your app
    dokku postgres:backup-auth <service> AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
    
    # Encrypt backups
    # I used 1Password to create and store the passphrase
    dokku postgres:backup-set-encryption <service> <passphrase>
    
    # Create a backup to make sure it works
    # <bucket-name> is the bucket you created in the AWS dashboard
    dokku postgres:backup <service> <bucket-name>
    
    # Schedule reguluar backups
    # The <schedule> is a crontab expression wrapped in quotation marks, 
    # like "0 0 * * *" for every day at midnight
    dokku postgres:backup-schedule <service> <schedule> <bucket-name>
    
    → 9:48 AM, Dec 22
  • Putting Email on Blast

    One of the things I need to find a better way to communicate to clients is that, every time they send an email to their list, they are going to get some unsubscribes. It’s not necessarily a bad thing and doesn’t mean your list can’t be growing overall. A person may no longer be interested. Or they’ve left that job (and therefore email address) and it gets removed for a hard bounce. But, it’s always a balance between getting your message out to people and not wearing out your welcome. The lens I like to look at a potential email “blast” (as clients like to call them) is: is this important enough to lose subscribers over? But I struggle sometimes to help clients understand that sending the same email out three or four times is counterproductive.

    → 1:07 PM, Dec 21
  • Delete and Move in Logic Pro

    One of the things that was frustrating to me working in Logic Pro, having more familiarity with other DAWs and with Premiere Pro for video editing was having to move track segments around when I wanted to remove a portion of a track. Recently I came across a tip to assign a shortcut to Delete and Move. Because for some reason most Logic Pro tips are burried in long YouTube videos, I figured I’d pull this one out and save it, in case I need it again in the future. This still isn’t as easy simply hitting the apostrophe key to delete a selection from a timeline in Premiere Pro, but it at least helps keep the track you’re working on more manageable. 

    Logic Pro Delete and MoveLogic Delete and Move

    → 10:23 PM, Dec 14
  • Year Based Filtering of a Django Model

    I’m working on a Django app for a client so their staff can more easily submit vacation requests and track their amount used/remaining. Because their time off resets at the end of the calendar year, I needed a good way to filter requests by year. I ended up creating a custom Model manager (with some tips from my friend Ben) that would automatically filter to the current year, yet allow filtering by a given year.

    class YearManager(models.Manager):
        def year(self, year=None):
            year = year or timezone.now().year
            return super(YearManager, self).get_queryset().filter(start_date__year=year)
    

    This lets me get the current year’s items with MyModel.objects.year() or a given year with MyModel.objects.year(year=2021).

    → 1:34 PM, Dec 14
  • Trying Something New

    In the spirit of David Smith’s Design Notes Diary series, I thought I would start posting about some of the things I’m working on day-to-day, including design or coding challenges I’ve solved or questions I have. Because it didn’t really seem to fit into anything else I had going, I decided to set up a new micro.blog.

    → 1:13 PM, Dec 14
  • RSS
  • JSON Feed
  • Surprise me!