Skip to main content

Posts

Showing posts from April, 2020

How to export a MySQL query result

MySQL (or these days, MariaDB) holds a lot of the data found on today’s web apps, and this data can be invaluable. Typically, web apps are made such that the important data is displayed in a useful and actionable way for the various users of the app. However, it’s not uncommon that a request may come in where you want the result of a specific query, something that isn’t available out of the box, and where you need to manually go in and run.To run a query in MySQL, you can do so by simply logging in from a console terminal using the app’s username, selecting your database, and inputting your SQL query like this:$ mysql --user=myapp -p > USE mydb; > SELECT * FROM mytable; The textbook wayThis is the most basic example of how to run a SELECT query. Of course, if you have millions of results, you may want to export them. This can be done using the INTO OUTFILE option. In order to properly have the above query saved in a CSV file so it can be opened in a spreadsheet appli…

Should our email services be silently bouncing emails?

Like many others who have been using the Internet for a very long time, I have a lot of email addresses. From the well known cloud provides like Google and Microsoft, to my own self-hosted Postfix server. In order to maintain my sanity and keep my emails to a single location, I use a complex array of forwarding rules from one email to the next so that all my messages end up in one place, regardless of what address people use to contact me. But as a result of this, I came up with some interesting observations.It’s well known that cloud email services use block lists and patterns in order to identify spam, that’s why we have junk folders. But I found out that some services will also silently drop emails. Apple iCloud seems particularly bad at this. Because I’m running my own server and forwarding emails to iCloud, I see the log files and routinely spot this type of entries:Nov 28 05:49:16 gwendis postfix/smtpd[4181]: 83A0B1842186: client=mta.e.walmart.ca[199.122.120.20] Nov …