Sea of Tranquility
I like talking about sci-fi, space, robotics, linux, anti-fascism and democratic socialism. 🇩🇪☮️
(SeaOfTranquility
on libera.chat)
If the drone could fly around the city autonomously, I would use it to digitize my city and get a personal Google Street View on steroids. I already use drone shots for structure-from-motion projects, but it would’ve to be autonomous for such a large-scale operation
There are a few approaches to implementing OOP in C. The language doesn’t give you any constructs to implement this out of the box, so it’s up to the developer to do it. Since there is no definite way to do it, let me just give you some examples and you can decide how to use it in your project:
class Parent:
def __init__(self):
self.__hidden_state = "properties"
def __private_method(self):
print("private method")
def public_method(self):
print("public method")
@staticmethod
def static_method():
print("static method")
class Child(Parent):
def __init__(self):
super().__init__()
self.__hidden_state = "child properties"
I would split the C code for this into header and source files:
(header.h)
There are a many approaches to implementing OOP in C. Since C doesn’t give you any language constructs to implement this out of the box, it’s up to you to do it in a consistent and understandable manner. Since there is no definite way to do it, let me just give you an example of how I would translate a Python file, and you can decide how you implement it from there:
--------------
class Parent:
def __init__(self, param1: str, param2: int):
self.__param1 = param1
self.__param2 = param2
def __private_method(self):
print("private method")
def public_method(self):
print("public method")
@staticmethod
def static_method():
print("static method")
@property
def param1(self):
return self.__param1
class Child(Parent):
def __init__(self):
super().__init__("param1", 2)
--------------
I would split the C code for this into header and source files:
(header.h)
--------------
#pragma once
/// Parent Class ///
typedef struct Parent_obj {
char* param1
unsigned int param1_len
int param2
} Parent_obj_t;
void Parent_init(Parent_obj_t* self, char* param1, unsigned int param1_len, int param2);
void Parent_public_method(Parent_obj_t* self);
void Parent_static_method();
void Parent_param1(Parent_obj_t* self, char* out, unsigned int max_len); // property method with upper bound string length
void Parent_del(Parent_obj_t* self); // destruct object (similar to __del__() in python)
/// Child Class ///
typedef struct Child_obj {
Parent_hidden_state_t* super
char* param
unsigned int param_len
} Child_obj_t
void Child_init(Child_obj_t* self, Parent_obj_t* super);
void Child_del(Child_obj_t* self);
--------------
(source.c)
--------------
#include "header.h"
/// Parent Class ///
// private methods
void Parent_private_method(Parent_obj){...}
// public methods
void Parent_init(Parent_obj_t* self, char* param1, unsigned int param1_len, int param2){...}
void Parent_public_method(Parent_obj_t* self){...}
void Parent_static_method(){...}
void Parent_param1(Parent_obj_t* self, char* out, unsigned int max_len){...}
void Parent_del(Parent_obj_t* self){...}
/// Child Class ///
// public methods
void Child_init(Child_obj_t* self, Parent_obj_t* super){...}
void Child_del(Child_obj_t* self){...}
--------------
Modules and namespaces can be modeled using folders and prefixing your structs and functions.
Peter F. Hamilton is the reason I got into Love, Death & Robots. The first episode is a short story from A Second Chance at Eden.
He literally got blue-pilled… The greatest fear of these guys😂
I’ve heard that a lot of people have trouble with updating and maintaining nextcloud but I personally never had those issues and my instance is running for over 5 years now. I would agree with other people here, that something like docker makes everything easier if you want to selfhost. I personally followed this guide with a custom dockerfile that looks something like this. Once you have a functional docker image and a docker-compose file, updating your instance is as easy as typing:
docker compose stop
docker compose rm -f
docker compose build --pull
docker compose up -d
If you chose to go down that route as well, you might want to change the config files in your docker image since some of the values might not suit your instance. I, for example, have added the following for the PHP config:
RUN sed -i "s/\(opcache\.interned_strings_buffer*=*\).*/\148/" /usr/local/etc/php/conf.d/opcache-recommended.ini
RUN sed -i "s/\(opcache\.memory_consumption*=*\).*/\1256/" /usr/local/etc/php/conf.d/opcache-recommended.ini
I mean… everybody involved knew that the original budget wasn’t even close to the required amount. Large government-backed projects like this one (especially ones that include so many countries) will always be late and over budget because that’s how politics works. I’m astonished that people still write articles making a sensation out of this fact.