• 2 Posts
  • 177 Comments
Joined 5 years ago
cake
Cake day: May 26th, 2021

help-circle










  • Would self-hosting a Nextcloud instance locally without an internet connection be viable?

    Yes, that should be no problem. Some nextcloud plugins might require a domain name and/or a https connection. If you can’t use your own DNS server you can change the clients hosts-file. Iirc docker and snap versions of nextcloud will auto-generate self signed ssl certificates and you can use a reverse-proxy if they don’t. (e.g. use caddy, it will automatically generate certificates) You won’t be able to update regularly, so you should only let trusted users into your network.

    Idk about gitlab, but I’m sure you can run gitea offline, if you don’t need any of the fancy gitlab features. (It’s faster too+ you can set up gitea to login with the nextcloud account.)






  • Germany closed down all their nuclear plants

    That’s wrong: 3 plants are still running (probably) until the end of this year.

    the end result was that they just started using more fossil fuels.

    This is true, but the reason isn’t the lack of alternatives but incompetent and corrupt state and federal government. They sabotaged the domestic solar sector, they made running private (roof-) solar plants unnecessarily complicated, they made building new (on-shore) wind parks basically impossible and they blocked the extension of the electrical grid. (And thats just the stuff I remember from the top of my head)


  • You need to figure out the variant before you can access any fields.

    let x = match p1 {
      Coordinates::Point1 { x, .. } => x, // .. means "I don't care about the other fields"
      Coordinates::Point2 { x, .. } => x,
    };
    

    or if you only need to do stuff on one type of point

    if let Coordinates::Point1 { x, _y } = p1 {
      // Do stuff with x or y here
      // _y (prefixed / replaced with _) means "I won't use that variable"
    }
    

    However it looks like what you want is a struct that contains an enum and the coordinates.

    enum CoordinateKind {
      Point1,
      Point2,
    }
    
    struct Point {
      kind: CoordinateKind,
      x: i32,
      y: i32,
    }
    
    fn main() {
      let p = Point {
        kind: CoordinateKind::Point1,
        x: 0,
        y: 45,
      };
    
      let x = p.x;
    }