Skip to content

Categorizing Personal Email Contacts with AI

For years I’ve wanted to send out a yearly update (digital Christmas card of sorts) email to friends, both new and old. One of the problems is I don’t have a good address book that indicates who is a personal or work contact. I’ve been playing with datasette and I thought it would be fun to index all of my past emails and have AI categorize if they are a work, personal, or vendor contact. Importing Emails The first step is importing your emails from gmail into a local database. The easiest way to do this is to use a combination of Google takeout and a datasette plugin (note that it’s easiest to use my fork of the datasette plugin, the original package is dead)…

Continue Reading

Choosing the right Ubuntu AMI for EC2

As part of setting up an app on an EC2 instance on AWS I wanted to try out Amazon Linux. Picking the latest compatible Amazon Linux AMI using CDK is easy: However, Amazon Linux isn’t always the right choice. What is Amazon Linux? It’s not Ubuntu, it’s Fedora (also, Amazon Linux 2 is older than 2023): Why? I have no idea. I’ve done a lot of random stuff in my time as a developer, and running into Fedora is not one of them. When I ran my ansible scripts against the gravitron fedora box it immediately failed: I was attempting to use ansible-dokku with Amazon Linux 2023, which explicitly is not supported. Gravitron-supported OS are listed here and included Ubuntu, so it was time to use an Unbuntu image…

Continue Reading

Passing Environments Variables to EC2 Instances using AWS CDK

I was updating an older project that ran using dokku and hosted an Elixir/Phoenix application with a postgres database. Uptime and other normally important things didn’t matter, so I just wanted to host the database and application on a small EC2 instance. However, the application got complex enough (SQS queues, some lambdas, etc) that I wanted to pass the SQS endpoints automatically to the EC2 instances via environments. Should be easy, right? This feels like a very common use case. I struggled to find a solution to this problem that Just Worked…

Continue Reading

Deploying Nodejs on AWS Lambda using NodejsFunction

I wanted to deploy a node lambda on AWS using CDK. The NodejsFunction seemed like an improvement over using the standard Function construct: the CDK SDK would bundle your code for you, in a docker container running the same version of node used in the lambda. Instead of defining a code param you define an entry file that is used for the compilation process. This seems like a great improvement over copy/pasting your local nodejs application (including the local node_modules!) into the lambda…

Continue Reading

Notes on Locked Records in NetSuite

In NetSuite, records can be "locked". This is a special state that is poorly documented and introduces some very strange behavior. Hopefully, some of these notes save someone banging their head against the wall to solve this problem! Records can be locked in NetSuite in one of two ways: (1) the accounting period the transaction is in can be locked (2) or the record can be explicitly locked. You cannot determine if the accounting period is locked directly from the record. You’ll need to pull the associated AccountingPeriod posting_period object reference. You cannot "explicitly" lock a transaction in NetSuite via the API. I have not found a way to do this through the GUI either. A workflow can lock a record in NetSuite…

Continue Reading

Depositing Transaction Records in NetSuite

Moving transactions in NetSuite from "Not Deposited" to "Deposited" is not straightforward when using NetSuite SuiteTalk. You need to ensure that undocumented requirements for each record type are met. After you’ve validated that your records are properly configured, you can include them in a new deposit using the following structure: Note that you don’t need doc, type, or any of the other fields available on the a DepositPayment item. It’s also important to note that the other fields on the DepositPayment don’t actually effect how NetSuite handles the referenced transaction record. deposit, id, and payment_amount are the only fields that matter when referencing a NetSuite transaction on a deposit.

Continue Reading

Using Browser Sync with Rails and Local SSL

I’ve always been a fan of LiveReload since I first saw it years ago. However, the rack-livereload gem hasn’t been updated in a long while, and the livereload parent project seems to have died out too. rack-liveload doesn’t support reloading on local HTTPS connections, which was a requirement on a recent project—I needed a new tool. BrowserSync came to the rescue. In most cases, using BrowserSync’s proxy mode to reverse proxy a rails app running via a *.dev pow domain works well. For this particular project, there were a couple of specific issues: Many pages on the project force HTTPS…

Continue Reading

Using HTTPS Locally: Pow, SSL, Rails, and Apache

Using HTTPS local development or testing environments is a hassle. A common practice is to disable SSL in development, but I’ve had too many cases of minor bugs creeping in when routing works differently between environments. I also don’t like manually having to let my browsers know that a self-signed certificate is valid. Here’s the configuration that I use to easily add https support on my development machine to any application served—or proxied—through port 80. Pow I use Pow as my development rails server. However, because I often work with other languages as well, I run Apache (you could just as easily use nginx) and reverse proxy Rails application requests to Pow. To do this, you’ll need Pow to bind to a port that is not port 80…

Continue Reading

Determine Deposited Status of CustomerRefunds in NetSuite

Most payment and refund records in NetSuite have a straightforward way to determine if they’ve been deposited or not. The CustomerRefund is one exception: there is no way to determine from the GUI, or from the SuiteTalk API response for a CustomerRefund, if a given CustomRefund has been linked to a deposit record. However, you can search for CustomerRefunds which are deposited or undeposited using a couple poorly documented search filters:

Continue Reading