RSSAmplifier

Blog

Sean M. Collins

Formerly known as Technically Sound

seanmcollins.comRSS feed ↗10 posts

Latest posts

JetZig Transportation Management System project - view layer

Writing a view in Jetzig was very similar to writing views in other frameworks like Rails or Django. The delivery_orders view manages DeliveryOrders , and inherits from the main layout for templating by declaring a layout variable that Jetzig picks up. The main request object that Jetzig passes as a parameter to view functions, includes a .repo field that is used to connect to the database and…

JetZig Transportation Management System project - database layer

About a year ago, I got the itch to start trying to program in Zig, after 15 years of using Python. I wanted to try a language that was closer to the hardware and Zig seemed to be simpler than Rust. I had a friend that was involved in the trucking industry, so I decided to create a project in Zig to help me learn the language while doing a practical exercise. After using Tokamak for a couple…

Managing Static Assets With Zig Build

I’m continuing to experiment with building a web application in Zig, and one of the things that any lazy back-end software engineer will reach for when it comes time to build an HTML frontend. However, I don’t really care to pull in all of nodejs and npm in order to manage bootstrap. So I thought, why not try and see if I can manage it via Zig’s built in build system? The first thing was to fetch…

Managing solar power and accumulators in Factorio

Another interesting programming challenge that I found in Factorio, was how to utilize the Accumulators that I had installed in my base on Vulcanus . Solar panels are very efficient on Vulcanus, getting a 400% boost compared to Nauvis and the day/night cycle is shorter. Having huge fields of Accumulators can help store solar energy during the night cycle, however they take up a lot of room on the…

Zig Http Chunked Responses

Playing around with Zig, trying to get my arms around calling REST APIs and parsing the json. So, I figured why not use the GitHub REST API since it is pretty straight forward. Request my SSH keys and parse the resulting JSON. pub fn main () ! void { var gpa = std . heap . GeneralPurposeAllocator ( . {}){}; defer _ = gpa . deinit (); const allocator = gpa . allocator (); var client = std . http .…

Zig Http Client Learning

Did some programming tonight, just learning more Zig and playing around with the std.http.Client It may be that I’m still learning my way around but I do find the documentation to still be a little on the sparse side. Maybe I’m just spoiled by requests because I do also remember the bad old days of Python and using urllib and urllib2 directly and those were pretty awful APIs too. pub fn main () !…

Zig Serialization Followup

So, the critical piece that I forgot is that while Zig does have better memory management than C, you are still own your own when it comes to managing that memory and understanding the memory model. As @cztomsik pointed out in my question I posted . This code doesn’t work fn regionDetail ( conn : zqlite . Conn , id : i64 ) ! Region { const query = "select * from Regions where RegionID=?" ; if (…

Tokamak JSON serialization oddness

I’ve started poking around in the Zig programming language and I came across a strange issue. I created a small function that pulls a row from sqlite and returns a struct . fn regionDetail ( conn : zqlite . Conn , id : i64 ) ! Region { const query = "select * from Regions where RegionID=?" ; if ( try conn . row ( query , . { id })) | row | { defer row . deinit (); return Region { . RegionID = row…

Programming Space Platforms in Factorio

I have recently relapsed into my Factorio addiction with the introduction of the new Space Age DLC . Originally, my addiction focused around building train networks to move resources around my factory and resupply my artillery outposts. With the new Space Age DLC there are whole new worlds to explore, and a whole new set of programming challenges to master. Anane is my primary space platform that…

Using Ansible & Netbox to build datacenters

The most tedious and unpleasant task in building a network, is the management of IP addresses and subnets and ensuring that the work done in the design phase is properly carried over into the live router configurations. One of the worst ways to go about this, is to ensure that all of your design and configuration is spread across as many disparate systems as possible. Put all your IP subnetting…