Thursday, March 26, 2020

Apple Watch Workout Sync

I have an Apple Watch problem. I'm obsessed. I can't not close my rings. Every challenge, accepted.

So the March Challenge is 31 workouts - no problem. I double up a couple days just to be sure.

Then it's the 26th and I look at my progress - wait, 13? It's not counting all my workouts!!

But when I look at the Workouts tab on the iPhone Activity app, sure enough, they're all there.

Googled around, nothing jumped out at me, so I started a chat with Apple.

To make a long story short, they had me unpair and re-pair my watch and my phone, which was kind of time consuming but not a big deal.

And the problem was fixed! March Challenge completed!!

Now if this happens to you - even if you just have to unpair/re-pair your watch and phone for any reason - here are some things to keep in mind:

1. by the end of the day, my watch battery was super low. if you're going to unpair/re-pair, you might want to put it on the charger while you do so.

2. I got to the grocery store to discover that my credit cards weren't there anymore. you have to go into the Watch app on iPhone and re-add your cards, which is just a couple of clicks, BUT you do have to know your cards' PIN codes.

Wednesday, August 28, 2019

Homemade Taco Seasoning

I haven't made this yet, but I don't want to lose it

https://gimmedelicious.com/2018/03/16/the-best-homemade-taco-seasoning/


Wednesday, July 31, 2019

EXIF metadata with a Promise

I had occasion to use exiftool recently, but instead of a callback, I'd rather use promises.

This is what I came up with:

const exif = require('exiftool');
const util = require('util');

const exif_metadata = function (data) {
    return new Promise((resolve, reject) => {
        exif.metadata(data, (err, metadata) => {
            if (err) {
                reject(new Error(err));
            } else {
                resolve(metadata);
            }
        });
    });
};


Worked great!

const fs_readFile = util.promisify(fs.readFile);
 

Promise.resolve()
  .then(() => {
    return fs_readFile(path);
  })
  .then(data => {
    return exif_metadata(data);
  })
  .then(metadata => {
    console.log('metadata: %O', metadata);
  })
  .catch(error => {
    res.send(error.toString());
  });

Saturday, July 27, 2019

Add Port to UFW

I'm running UFW (uncomplicated firewall) to restrict traffic into my Linux system.

And while being super restrictive is generally a good thing, there are times when you have to poke a new hole and connect from another system inside the house.

Usually it's a new app running on a new port and since I never remember the command to allow this, here it is:

$ sudo ufw allow from 192.168.1.0/24 to any port 3100

You're welcome, future self!

Saturday, July 20, 2019

The DX-M04 Shelving System

My dad bought a DX-M04 shelfy thing and I was tasked with its assembly.


I don't think a nicer set of shelves can be had at any price. And do you see the little screwdriver pictured in the instructions? YES, the DX-M04 really does come with a screwdriver!! And the bottom panel (part #3) has feet. Yes, they really did think of everything.

If I could make one suggestion:

At step three, you might want to leave the bottom a little loose, so when, in step four, you insert the back, you can wiggle it into the groove in the bottom. Then after you've installed the top in step five, you can go back and tighten the bottom.

If you need some shelves, you can't go wrong with the DX-M04. No, no idea where you'd buy them, but for the right price, I can put my hands on a really well assembled set.

Friday, July 19, 2019

MySQL CRAZIES

Did you install a new MySQL and things just aren't working the way you're used to?

WHAT?? ME TOO!!

In this case, I'm inserting just a few columns, and there are non-specified columns without default values.

In my other database it just works - I know, not correct behavior, but it's what I'm used to.

In my new database I get this error:

ERROR 1364 (HY000): Field 'xxx' doesn't have a default value

So what's the difference?

STRICT MODE

Thanks, documentation!!

Before, strict mode. Giving me an error...

mysql> select @@GLOBAL.sql_mode;

+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode                                                                                                                         |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


After, non-strict mode. Working like my other database!

mysql> SET GLOBAL sql_mode = '';
Query OK, 0 rows affected, 1 warning (0.00 sec)

Tuesday, May 14, 2019

MySQL Passwords

I'll never remember this unless I write it down here. And hey, maybe it will help somebody else.

Problem:

  • MySQL version 8+
  • github.com/go-sql-driver/mysql
  • db, err = sql.Open("mysql", "username:password@/database")
    (no error)
  • query, err := db.Query("SELECT * FROM TABLE")
    this authentication plugin is not supported

Solution:

mysql> alter user 'username'@'localhost' identified with mysql_native_password by 'password';

See also: https://github.com/go-sql-driver/mysql/issues/785