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
Quartz Scheduler as a Service
Photo by Mat Brown from Pexels
Quartz Job Scheduler
“Quartz is a richly featured, open source job scheduling library that can be integrated within virtually any Java application — from the smallest stand-alone application to the largest e-commerce system.” (Quartz Scheduler overview)
Besides its advanced features, most basic and frequently used feature is job scheduling and job execution. Some frameworks like Spring Scheduler have their integration practice using Quartz Scheduler which allows using its default scheduling method.
In this post I am going to tell you a different approach to show how we can use Quartz Scheduler to schedule our jobs. We actually still will be using the existing scheduling mechanism of Quartz but we’re going to show how we can manage the scheduled and unscheduled jobs online. This way you can manage all the available jobs or create new ones on the fly.
Quartz Scheduler as a Service
Previously I led development of an enterprise “Business Service Management” software to replace IBM’s TBSM product at a major telco company in Turkey. This was a challenging project and found a solid place in the customer environment after …
java development automation
Job opening: VisionPort support engineer (western U.S.)
This position has been filled. See our active job listings here.
We are looking for an engineer to join the End Point Immersive and Geospatial Support (I+G) Team—a small, multidisciplinary team that supports our company’s clients with their VisionPort systems incorporating Liquid Galaxy technology. VisionPort hardware consists of large-panel HD TVs within a curved panoramic environment, supported by a server stack with power, video, audio, and network connections and equipment.
The candidate will be based out of a home office in the western United States (Washington, Oregon, California, Idaho, Utah, Nevada, Arizona, Montana, Wyoming, New Mexico, and Texas). The engineer will be asked to travel to, perform, and supervise system installations, in addition to day-to-day remote support work from a home office.
Occasional evenings and weekend on-call shifts are shared amongst the team.
This is a great entry-level opportunity for people already familiar with light audiovisual, server room, and/or installation handiwork to get experience with all aspects of production computer systems and their deployment. More experienced individuals will have the opportunity to work directly in feature development on production systems and possibly assist with …
jobs-closed visionport
On Shapefiles and PostGIS
Partial map of the voyage of the Endurance, from “South”, by Ernest Shackleton
The shapefile format is commonly used in geospatial vector data interchange, but as it’s managed by a commercial entity, Esri, and as GIS is a fairly specialized field, and perhaps because the format specification is only “mostly open”, these files can sometimes be confusing to the newcomer. Perhaps these notes can help clarify things.
Though the name “shapefile” would suggest a single file in filesystem parlance, a shapefile requires at least three different files, including filename extensions .shp
, .shx
, and .dbf
, stored in the same directory, and the term “shapefile” often refers to that directory, or to an archive such as a zipfile or tarball containing that directory.
QGIS
QGIS is an open-source package to create, view, and process GIS data. One good first step with any shapefile, or indeed any GIS data, is often to take a look at it. Simply tell QGIS to open the shapefile directory. It may help to add other layers, such as one of the world map layers QGIS provides by default, to see the shapefile data in context.
GDAL
Though QGIS can convert …
tips open-source tools gis maps postgres