Federal Farmer

Rogue programmer. Yeoman homesteader. I hate the antichrist.

Articles in the Tutorials 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 …

  • Eat Zee Chickenz

    When my wife and I decided to shift from hobby homesteading to "real farming" in 2020, we knew our focus would be on animal-derived fats and proteins as opposed to market gardening.

    Give me meat

    Don't get me wrong, gardens are great, but the Agenda 2030 crowd isn't gunning for your zucchinis - it's meat they're after. And if based boomer Joel Salatin has taught me anything, it's that rotational grazing is the ideal method to raise happy, healthy animals and build great soil in the process.

    So naturally, we built a chicken tractor:

    PVC chicken tractor

    The idea behind a chicken tractor is simple: You raise …

  • Back up your Substack

    A lot of deplatformed content creators have been flocking to Substack of late.

    I can see why: It's an easy-to-use blogging platform that allows for simple monetization of your content. It even comes with mailing list functionality. That's a big deal to those on the "fringe" - it's tough for wrongthinkers to make a living on the New Normal Internet.

    Bad boys and girls lose access to their Patreon, after all. The particularly naughty ones might not even be allowed on mailing list software, let alone Twitter or YouTube.

    Substack solves a lot of problems for these people.

    Because while Substack …

  • 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 …

Social Links

My Projects