PostgreSQL Data Checksums

If you use SQL Server, you’re used to the database doing page verification for you as the sensible default. If you want SQL Server to not verify data, you have to do a bit of extra work. Naturally, I would’ve assumed that this was the case with other databases since, after all, having good data on disk is important. [caption id="attachment_1065” align="alignright” width="300”] Not quite a check sum, but delicious enough.

How I Computer

I figured it would be fun to document the hardware and software that I use to get everything done on a regular basis. Even if it’s for nobody but future me, this should be a fun post to review later. [caption id="attachment_1062” align="alignright” width="300”] Pictured: the computer I actually need.[/caption] The Desktop I built the desktop computer myself, so it’s more of a parts list than a computer and it’s definitely overkill.

A Multi-Column Index - How Should I Design This?

Design problems are fun. It’s a chance to build something that lasts and do it right. Plus, those bad decisions are going to hang around forever. This is our chance to make the right decision. [caption id="attachment_1059” align="alignright” width="300”] Who needs design?[/caption] Our Feature We’re building a system to store events that have occurred in an our application. This is going to be the back end for an event sourcing system.

Rust Doc Days Follow Up

A few weeks ago, I mentioned Rust Doc Days. This was an event where the Rust community made a conscious effort to improve Rust’s documentation. Throughout this blog post, “we” refers to the quasi-official Rust docs team. How did it go? The first Rust Doc Days was, we felt, a successful event. We deliberately kept the event low key to try to work the kinks out. Over the two days, a few pull requests with new documentation were made.

Writing Documentation in Rust

Documentation is important. It’s also easy to do. Rust ships with tools to help developers create documentation for their libraries. Code Comments The main way that many developers write documentation is through source code comments. A single-line comment in Rust is started with //. Many programming languages should already use this construct, so it’s probably not surprising to you. Equally unsurprising, multi-line comments start with /* and end with */. Many Rustaceans (that’s what Rust developers call themselves) prefer single-line comments.

Hijacking stderr in Rust

[caption id="attachment_1034” align="alignright” width="300”] Liberate your output pipes from the tyranny of programmatic control![/caption] Let’s say you have to work with OS processes - you’re building tools for automation and you need to capture the output of a command with your Rust program. You might need to process the command’s output and do something with it, but you also need to send that output back to the usual location (usually stderr or stdout).

Talking About Rust's Traits

We previously talked about The Basics of Rust structs. That was some pretty cool stuff - we learned how to structure data and how to attach functionality to that data by using impl. A struct defines what data we have, but what if we want to define how that data should function? [caption id="attachment_1031” align="alignright” width="300”] Using the traits Rusting and Broken at the same time.[/caption] Enter Rust’s Traits A trait lets us define how data will behave.

The Basics of Rust Structs

[caption id="attachment_1026” align="alignright” width="300”] Pretty structs, as far as the eye can see…[/caption] structs are one of the basic building blocks in Rust. A struct lets us create more complex data types of our own. Instead of having to jump through naming hoops to make our own data structures, we can create whatever we want. Our First Rust struct Let’s look at creating a simple struct for a to do application.

Staying Active

Staying active is important. It helps keep you limber. I do two things to stay active. [caption id="attachment_1021” align="alignright” width="300”] This is active, right?[/caption] Physical Activity I try to go to the gym 5 times a week. I’m in good shape unless you’re comparing me to Silly Putty, but going to the gym 5 times a week helps me work on staying alive and healthy for as long as I can.

Error Handling in Rust

I’ve been doing some programming in Rust recently. First was a flake generator and then the second is a rudimentary implementation of the ls command (dir to Windows people) - I submitted a pull request to uutils/coreutils: a replacement for the UNIX coreutils suite of software. Error handling plays a big role in both of these chunks of code - making sure users don’t get a nasty surprise requires making sure you let them know when things go wrong.