Backing up your SaaS data with Google Takeout
Keeping backups is extremely important.
Losing important files can feel like a far-off problem, but the chance of misplacing a drive, theft, drive failure, accidental deletion, house fire, flood, etc., is much greater than we may think. The benefits outweigh the cost of backups, for files that matter at all. So everyone should make regular backups of data that they care about and that can’t be replaced.
Even among people who regularly make backups, there is one area many of us neglect: all of that data on various online services, also called software as a service or SaaS: Google Drive, Apple iCloud, Microsoft OneDrive, Dropbox, Box, etc.
It’s true, the most volatile files are the ones sitting in a single location on your laptop or thumb drive, not those on Google, WordPress, or iCloud servers. The danger of losing files is not nearly as present with SaaS. You can’t drop Google on the floor and lose a couple terabytes of data, like you can a hard drive, but you can be locked out of your account, accidentally delete files, and lose data by missing a notice about a service shutting down. Not to mention the possibility that your SaaS provider is hacked and loses …
!-->backups saas
Aligning monospace font text columns with an old Unix tool
Photo by Garrett Skinner
A blast from 1990: column
A while back I learned of a nice old Unix command-line tool called column
. It first appeared in 4.3BSD-Reno, released in July 1990. (This is not to be confused with the different, even older Unix tool col
.)
column
formats plain text into nice columns based on the width of the input separated by tabs or groups of spaces.
For example, take this mess found in a server’s /etc/fstab
file defining filesystem mount points. It is a real example lightly redacted to remove business details. You may need to scroll right to see the end of the fairly long lines:
/data3/customer_uploads /home/interch/htdocs/shared/customer_uploads none rw,bind 0 0
/data3/customer_images /home/interch/htdocs/shared/customer_images none rw,bind 0 0
/data3/images/items home/interch/htdocs/images/items none rw,bind 0 0
/data3/images/thumb home/interch/htdocs/images/thumb none rw,bind 0 0
/data3/upload_images /home/interch/upload_images none rw,bind 0 0
/data3/design /home/interch/htdocs/shared/design none rw,bind 0 0
/data3/design_temp /home/interch/htdocs/shared/design_temp …
tips tools vim vscode intellij-idea
Middleware: Is that still a thing?
The simple answer to the question in the title is simply, yes! Despite the term being many decades old and well past its hype peak, middleware is still very much a thing and has become a key part of the technical landscape that is critical in day-to-day functioning of systems.
So there are still some questions to be answered: What is middleware? What does it do? And maybe most importantly: Why do we care?
What is it?
In its simplest meaning, middleware is an application that sits between other applications and shuffles data between them. There is normally one system requesting the information and the middleware figures out where to get that requested data and makes the request to another system.
An easy example of this is buying something at a retail store using your credit or debit card. When you swipe your card, the business makes a request to a service (some middleware) to ask if there’s enough room on the card for that purchase. Then that system makes a request to the appropriate bank or card holding company to ask the same question. The bank or card holding company replies with either a yes or no and that answer is then relayed back to the terminal where you swiped …
!-->development integration architecture api
Docker and containers boot camp
In the modern landscape of web development, it’s almost impossible to avoid seeing or using containers: isolated, virtualized, user space for programs to run in. Containers make it easy to develop and deploy various components of applications without respect to the specific system and dependencies they run on.
If that’s confusing, worry not; this post and the tutorials in this boot camp aim to clarify things for new developers and experienced developers who haven’t gotten around to using containers yet.
Linux containers are all based on the virtualization, isolation, and resource management mechanisms provided by the Linux kernel, notably Linux namespaces and cgroups.
—Wikipedia, OS-level virtualization
Introduction
The terminology surrounding containers can get pretty confusing, but the basic idea is this: A container is just a sandboxed process which is limited by the operating system in its ability to see and interact with other processes and parts of the system. This can:
- provide security benefits (e.g. a container may only be given access to certain parts of the filesystem),
- help with performance (e.g. by limiting the amount of RAM or CPU given to a …
docker containers
EditorConfig: Ending the Spaces vs. Tabs Confusion
Photo by Garrett Skinner
Varieties of text formatting
Most everyone who has worked on a software development project with a group of other people has encountered the problem of source code being formatted in different ways by different text editors, IDEs, and operating systems.
The main variations go back to the 1970s or earlier, and include the questions:
- Will indentation be done by tabs (an ASCII control character) or spaces?
- If indentation is done by spaces, how many spaces are used for each indentation level?
- What will indicate the end of each line (EOL)? The choices are:
- a line feed (LF), used by the Unix family including Linux and modern macOS
- a carriage return (CR), used by old pre-Unix Macintosh and some now-obscure operating systems
- both together (CRLF) used by Windows and most Internet protocols
- Which character set encoding will be used? Common choices are:
- Unicode UTF-8 encoding, used by Linux, macOS, and most other Unixes, and standard on the Internet
- Unicode UTF-16 encoding (with either little-endian or big-endian encoding), used by modern Windows
- legacy ISO-8859 and Windows “code page” encodings in older documents and codebases
Editor …
development tips intellij-idea vim emacs
Formatting SQL code with pgFormatter within Vim
Photo by Garrett Skinner
Sometimes a little, seemingly simple tip can make a world of difference. I’ve got enough gray hair these days that it would be pretty easy for me to start thinking I’d seen an awful lot, yet quite frequently when I watch a colleague working in a meeting or a tmux session or somewhere, I learn some new and simple thing that makes my life demonstrably easier.
Luca Ferrari recently authored a post about using pgFormatter in Emacs; essentially the same thing works in Vim, my editor of choice, and it’s one of my favorite quick tips when working with complicated queries. I don’t especially want to get involved an editor war, and offer the following only in the spirit of friendly cooperation for the Vim users out there.
As Luca mentioned, pgFormatter is a convenient way to make SQL queries readable, automatically. It’s easy enough to feed it some SQL, and get a nice-looking result as output:
$ pg_format < create_outbreaks.sql
INSERT INTO outbreak
SELECT
nextval('outbreak_id'::regclass),
extract('year' FROM now())::text || '-' || nextval( …
tips open-source tools postgres vim
Visualizing Data with Pair-Plot Using Matplotlib
Pair Plot
A pair plot is plotting “pairwise relationships in a dataset” (seaborn.pairplot). A few well-known visualization modules for Python are widely used by data scientists and analysts: Matplotlib and Seaborn. There are many others as well but these are de facto standards. In the sense of level we can consider Matplotlib as the more primitive library and Seaborn builds upon Matplotlib and “provides a high-level interface for drawing attractive and informative statistical graphics” (Seaborn project).
Seaborn’s higher-level pre-built plot functions give us good features. Pair plot is one of them. With Matplotlib you can plot many plot types like line, scatter, bar, histograms, and so on. Pair-plot is a plotting model rather than a plot type individually. Here is a pair-plot example depicted on the Seaborn site:
Using a pair-plot we aim to visualize the correlation of each feature pair in a dataset against the class distribution. The diagonal of the pairplot is different than the other pairwise plots as you see above. That is because the diagonal plots are rendering for the same feature pairs. So we wouldn’t need to plot …
python matplotlib visualization data-science
Perl Web Frameworks
CGI
When I started programming, back in the day, CGI (the Common Gateway Interface) was still widely used. Usually the Apache webserver would just execute a script or a binary with some environment variables set and serve whatever the executable sent to the standard output, while keeping the standard error in the logs.
This simple and straightforward mechanism can still be used for small programs, but larger applications usually want to save the start-up time and live longer than just a single request.
At that time Perl was used far more often than now, and it had (and still has) the CGI.pm module to help the programmer to get the job done.
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use CGI;
my $q = CGI->new;
print $q->header;
my $name = 'Marco';
print $q->p("Hello $name");
print "\n";
And it will output:
./cgi.pl
Content-Type: text/html; charset=ISO-8859-1
<p>Hello Marco</p>
Here the script mixes logic and formatting and the encoding it produces by default tells us that this comes from another age. But if you want something which is seldom used and gets executed on demand without persisting in the machine’s memory, …
!-->cgi perl mojolicious catalyst dancer interchange