Federal Farmer

Rogue programmer. Yeoman homesteader. I hate the antichrist.

Articles in the Programming category

  • SQLite Database Migration Woes

    Whenever I'm starting a new database-backed project, I usually default to using SQLite instead of networked databases like MySQL or Postgres.

    lain_connected

    SQLite is a flat file masquerading as a database, so it's very easy to get up and running with. It's part of the Python standard library. And contrary to popular belief, it's highly scaleable if you understand its limitations.

    If your site or app is getting less than 500k hits/day with ~100k of those touching the database, you're well within SQLite's capabilities.

    Migrations still suck, though.

    I feel like they suck in any relational database model and they're …

  • Managing Cached Javascript Files Without Babel

    Despite beginning life as a simple scripting language, modern Javascript (ES6+) has to be transpiled to run in the browser.

    Compilers like Babel take in ES6 and spit out a jumbled mess of ES5-spec JS that's comprehensible to the client side. This is basically how all modern front-end JS frameworks operate.

    soyjack_babel

    It's a silly and needlessly complex workflow. You could even call it a devolution, as Javascript's transformation from a high-level scripting language to a compiled language certainly feels like a step backwards.

    But that's not what this article is about.

    When you write ES6+ spec JS using a front-end …

  • Adding PWA Support to Flask Applications

    Progressive Web Applications (PWAs for short) are a growing trend in web app development, and for good reason.

    lain_connected

    No longer do programmers have to build, bundle, and ship separate mobile and desktop applications using kludgy bloatware like Electron or React Native. PWAs enable web apps to run in a native-like manner without having to write any additional code. Simply add some Javascript to your existing project and users can "install" your app on any major OS straight from their browser!

    Not only does this significantly reduce development requirements for multi-platform support, it also allows developers to bypass the app store …

  • Tutorial: Using Flask-SQLAlchemy Outside A Flask App

    Developers using the Flask microframework will often lean on the popular Flask-SQLAlchemy ORM when working with databases.

    Datastonks

    Flask-SQLAlchemy is a great alternative API to the original SQLAlchemy, as it handles a lot of potential nastiness that can arise when managing database sessions with multiple concurrent connections as is common in web apps.

    Since Flask-SQLAlchemy ties every database session or connection with the request/response cycle directly, it makes it really hard to accidentally leave sessions active in the same worker thread to throw unexpected errors. This makes Flask-SQLAlchemy ideal for working with a database-driven web app.

    There's a catch, however …

  • Revolt Against the Modern Web

    When it comes to writing web applications, my go-to framework is usually Flask.

    JSfags like Express. PHPbros swear by Laravel. They're both wrong. You should be using Flask.

    Flask Life

    On a serious note, Flask is an ideal framework if you're just getting started with web app development. Since Flask is a microframework and doesn't come with "batteries included", it forces you to make decisions about its extensibility and architecture on your own.

    Need a database? Pick one - Flask doesn't force MySQL, Postgres, or Mongo on you. Want to manage user accounts? Feel free to use session-based authentication or JWT. Building a …

  • Tutorial: Creating Custom Themes With Pelican

    Pelican is a static site generator written in Python.

    In this blog post, you'll learn how to create your first Pelican site and how to style it using a custom theme. This tutorial assumes you have a good grasp on HTML, CSS, and basic command line input. Familiarity with the Jinja2 templating engine is not required but nice to have.

    Despite being written in Python, Pelican only forces you to interact with Python via its config file - so aside from using pip and setting up a proper venv (which we'll cover in this tutorial), you don't really have to know …

  • Hello Dystopia

    Obligatory Hello World post. Welcome to my blog!

    I'm a software developer and yeoman homesteader who's come to understand that there are no political solutions to the technocratic dystopia now facing the Western world. This website is an anthology of how I'm dealing with that reality, and moreover, how I feel these two particular skillsets (homesteading and software development) are uniquely poised to navigate our current societal, spiritual, and monetary predicaments.

    Of course, they're not the only two skillsets capable of altering the trajectory of mankind's rapid descent into despotism. But they're the ones I'm most familiar with, so that's …

Social Links

My Projects