217 results for "":

Day 11 (Advent of Code 2020)

Another day, another problem.

This time the problem looks suspiciously like Conway’s Game of Life, or, I guess, any old Cellular automaton.

We have a map like so:

L.LL.LL.LL LLLLLLL.LL L.L.L..L.. LLLL.LL.LL L.LL.LL.LL L.LLLLL.LL ..L.L..... LLLLLLLLLL L.LLLLLL.L L.LLLLL.LL

And for each iteration:

  • L symbols turn into # if there’s no # in any of the 8 adjacent cells

FFI-safe types in Rust, newtypes and MaybeUninit

It’s time to make sup, our own take on ping, use the Win32 APIs to send an ICMP echo. Earlier we discovered that Windows’s ping.exe used IcmpSendEcho2Ex. But for our purposes, the simpler IcmpSendEcho will do just fine.

As we mentioned earlier, it’s provided by IPHLPAPI.dll, and its C declaration is:

IPHLPAPI_DLL_LINKAGE DWORD IcmpSendEcho( HANDLE IcmpHandle, IPAddr DestinationAddress, LPVOID RequestData, WORD RequestSize, PIP_OPTION_INFORMATION RequestOptions, LPVOID ReplyBuffer, DWORD ReplySize, DWORD Timeout );

The case for sans-io

The most popular option to decompress ZIP files from the Rust programming language is a crate simply named zip — At the time of this writing, it has 48 million downloads. It’s fully-featured, supporting various compression methods, encryption, and even supports writing zip files.

However, that’s not the crate everyone uses to read ZIP files. Some applications benefit from using asynchronous I/O, especially if they decompress archives that they download from the network.

Day 5 (Advent of Code 2020)

Time for another day of Advent of Code 2020.

For Day 5, we’re going to have to do…

Cool bear

Let me guess: more parsing?

Amos

Correct!

So there’s an airline that uses binary space partitioning when referring to seats - there’s 128 rows and 8 columns. The first 7 characters are either F (Front, for the lower half) and B (back, for the upper half), and the last 3 are L (Left, for the lower half) or R (Right, for the upper half).

Android development with rock 0.9.5

rock 0.9.5 is out! It’s the meanest, slimmest, baddest rock release yet.

To update, run git pull && make rescue as usual. To install from scratch, clone the repo, cd into it, and run make rescue from there - it’ll download the latest bootstrap, compile itself from C, then recompile itself from ooc.

Running rock -V should print this happy little version line:

Day 1 (Advent of Code 2022)

Two years ago, I did part of Advent of Code 2020 using the Rust language. It was a lot of fun, so let’s try it again!

The problem statement

Our input looks something like this:

1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

Each group of lines separated by an empty line is a list of food items an elf is carrying: each line corresponds to the number of calories in that food.

Day 17 (Advent of Code 2022)

Advent of Code gets harder and harder, and I’m not getting any smarter. Or any more free time. So, in order to close out this series anyway, I’m going to try and port other people’s solutions from “language X” to Rust. That way, they already figured out the hard stuff, and we can just focus on the Rust bits!

Sounds good? Good. Let’s proceed.

Deploying at the edge

Disclaimer:

Although I no longer work for the company my website is hosted on, and this article is written in way that mentions neither my previous or current hosting provider: at the time of this writing, I don’t pay for hosting.

One thing I didn’t really announce (because I wanted to make sure it worked before I did), is that I’ve migrated my website over completely from a CDN (Content Delivery Network) to an ADN (Application Delivery Network), and that required some architectural changes.

Lies we tell ourselves to keep using Golang

In the two years since I’ve posted I want off Mr Golang’s Wild Ride, it’s made the rounds time and time again, on Reddit, on Lobste.rs, on HackerNews, and elsewhere.

And every time, it elicits the same responses:

  • You talk about Windows: that’s not what Go is good at! (Also, who cares?)
  • This is very one-sided: you’re not talking about the good sides of Go!

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: