220 results for "":
Day 4 (Advent of Code 2022)
Part 1
Let’s tackle the day 4 challenge!
In this one, we get an input like this:
2-4,6-8
2-3,4-5
5-7,7-9
2-8,3-7
6-6,4-6
2-6,4-8
Each line has two ranges: the first line has ranges containing 2, 3, 4, and 6, 7, 8. We must count how many pairs have ranges where one fully contains the other.
In Rust, we can express this with “inclusive ranges”
(std::ops::RangeInclusive),
and those implement Iterator, so we can do:
Request coalescing in async Rust
As the popular saying goes, there are only two hard problems in computer science: caching, off-by-one errors, and getting a Rust job that isn’t cryptocurrency-related.
Today, we’ll discuss caching! Or rather, we’ll discuss… “request coalescing”, or “request deduplication”, or “single-flighting” - there’s many names for that concept, which we’ll get into fairly soon.
Day 14 (Advent of Code 2020)
It’s time for the Day 14 problem!
After the hassle that was Day 13, I hope this time we’ll have a relatively chill time. And, at least for Part 1, that is true.
Our input looks something like this:
mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X
mem[8] = 11
mem[7] = 101
mem[8] = 0
mem is our memory. Our addresses are 36-bit wide, but as you’ll see, that
doesn’t matter much.
Day 9 (Advent of Code 2022)
The Advent of Code is not a sprint: it’s a marathon: sometimes you’ve got to stop and smell the roses.
I… what? That’s not.. have you done a marathon before?
No, and I haven’t taken any creative writing classes either, I think you can tell. Anyway: Day 8 was a bit aggravating for me. In 2020 I gave up AoC after Day 14 I think, and then I skipped a year. It doesn’t help that it overlaps some holidays and stuff, but!
Crafting ICMP-bearing IPv4 packets with the help of bitvec
So. Serializing IPv4 packets. Easy? Well, not exactly.
IPv4 was annoying to parse, because we had 3-bit integers, and 13-bit integers, and who knows what else. Serializing it is going to be exactly the same.
Right now, we don’t have a way to serialize that.
Let’s take the version and ihl fields, both of which are supposed
to take 4 bits, together making a byte. We could serialize them like this:
Frustrated? It's not you, it's Rust
Learning Rust is… an experience. An emotional journey. I’ve rarely been more frustrated than in my first few months of trying to learn Rust.
What makes it worse is that it doesn’t matter how much prior experience you have, in Java, C#, C or C++ or otherwise - it’ll still be unnerving.
In fact, more experience probably makes it worse! The habits have settled in deeper, and there’s a certain expectation that, by now, you should be able to get that done in a shorter amount of time.
S-exps in your browser
The front end of the pool
I’ve been interested in reactive JavaScript for a while. At memoways, we strive to build snappy user interfaces for clients who like to interact with their data with as little latency as possible.
In the past two years, I learned front-end development on-the-fly, as the needs of the clients required it. Two years ago, I was still using jQuery. Then, I discovered space-pen thanks to my colleague Nicolas. It was nice to have proper ‘view’ objects, and use jQuery’s event system to have messages propagate throughout a hierarchy.
Cleaning up and upgrading third-party crates
The bleeding edge of rustc and clippy
Typically, you’d want a production application to use a stable version of Rust. At the time of this writing, that’s Rust 1.65.0, which stabilizes a bunch of long-awaited features (GATs, let-else, MIR inlining, split debug info, etc.).
For every Rust release, Mara makes a wonderful recap thread on Twitter, on top of the official announcement.