News for hackers. Stuff that matters.

WakiMiko

Re:Difftastic, the fantastic diff on Wednesday September 07, 2022 @06:24AM (#32748784)
difftastic doesn't show whitespace or formatting changes
Printers are way worse
Re:The Stacks 2.0 blockchain implementation in Rust on Monday February 14, 2022 @12:36PM (#30335022)
Lol
Re:Mess with DNS on Wednesday December 15, 2021 @01:53PM (#29570120)
Very cool project!

It's interesting to see how different DNS providers cap the maximum TTL.

Google uses 21600s

Quad9 uses 43200s

Cloudflare does not cap at all!

And my personal unbound uses 86400s (which is the default)

Re:Learning Rust via Advent of Code on Monday February 04, 2019 @03:55PM (#19080542)
I quite like this tuple approach.

And yeah, I meant Ord (and the required other Traits), I edited my post. Thanks for pointing this out.

Re:Learning Rust via Advent of Code on Monday February 04, 2019 @01:58PM (#19079436)
For sorting sequential fields you can chain comparisons with .then():

    struct Date {
        year: u32,
        month: u32,
        day: u32,
    }
    
    let mut vec: Vec<Date> = Vec::new();
    
    vec.sort_by(|a,b| {
       a.year.cmp(&b.year)
        .then(a.month.cmp(&b.month))
        .then(a.day.cmp(&b.day))
    });
Alternatively you can derive PartialEq, PartialOrd, Eq and Ord for your struct, which will produce a lexicographic ordering based on the top-to-bottom declaration order of the struct's members:

    #[derive(PartialEq, PartialOrd, Eq, Ord)]
    struct Date {
        year: u32,
        month: u32,
        day: u32,
    }
Re:Go 2, here we come on Thursday November 29, 2018 @03:25PM (#18563628)
Rust has a `usize` which is 32 or 64 bits depending on the platform and also serves as the native index type for arrays and such.
Re:Matt Parker – Standup Mathematician on Saturday October 06, 2018 @12:49PM (#18155987)
Does it cover the Parker Square?