Please help contribute to the Reddit categorization project here

    DrWhatNoName

    + friends - friends
    74,933 link karma
    28,139 comment karma
    send message redditor for

    [–] Stupid kids DrWhatNoName 30 points ago in memes

    Raise the table until the kid grows up to the point of hitting the corners again, then drop the table back down.

    Knock their baby teeth out. Get those adult teeth in quick.

    [–] What’s 2x5 again? DrWhatNoName 13 points ago in memes

    Hard drive is hard, brain isnt.

    Also, have you read the paper about how much data the brain must process on the everage day.

    Spoiler, its 4x the susposed capacity.

    Your brain is constantly storing and forgetting information and you dont even notice, because 99% of it is useless trash. Like basic math.

    [–] The Rise of the Duck. DrWhatNoName 2 points ago in memes

    Google: stop, get some help

    Bing: Ill help you!

    Duck: Ohh yeaaa, sooo hot *fap fap fap fap*

    Ducks are weird dude, have you seen 2 male ducks trying to fuck a female duck. Yikes dude.

    [–] Meanwhile... DrWhatNoName 9 points ago in memes

    Are you really tho?

    [–] He’s right you know DrWhatNoName 5 points ago in memes

    Agree'd, thats an it

    [–] I Need Another Rock! DrWhatNoName 93 points ago in memes

    thats not how it works

    [–] He’s right you know DrWhatNoName 9 points ago in memes

    Your giving them too much credit calling them a smart ass.

    they're a dumb ass.

    [–] *flashbacks* DrWhatNoName 1 points ago in memes

    The google one should be manipulating, filtering, blocking and promoting policital views.

    Read more: https://www.projectveritas.com/2019/06/26/blacklisted-leaked-youtube-doc-appears-to-show-election-interference/

    It wasnt facebook manipulating the 2016 elections, it was google.

    [–] Ohhh, nice DrWhatNoName 1 points ago in memes

    Reddit memean*

    [–] Top tier is going 10.3 lads DrWhatNoName 0 points ago in Warthunder

    Am i reading this right???

    China will have T-80U, M1A1 AND 2A5 WTH!!!

    [–] Wouldn't generics make implementing the Repository pattern a lot easier? DrWhatNoName -1 points ago * (lasted edited 3 days ago) in PHP

    Yes, because then you could do

    $config = new Config<Json>('path/to/file.json');
    $database = new DatabaseConnector<Mysql>($config);
    $user = new Respository<User>($database);
    $user = $user->where('username', 'user')->fetch<AssocResults>();
    $cache = new Cache<Redis>($config);
    $cache->store($user, 60);
    

    You would still have classes for each repo, but the point is to lower the call chain.

    Look up some C++ examples, they use it often because its really is useful.

    A really good example is PDO valueBind.

    $sth->bindParam(':calories', $calories, PDO::PARAM_INT);
    will be
    $sth->bindParam<int>(':calories', $calories);
    

    Generics work in a simular way that traits work. They expand on a class functionality. But not hard coded. Instead of a a classing have a set trait and not being able to change traits.

    Here is a full-ish example based on my old query database class.

    <?php
    interface LoaderInterface {
        public static function load(string $path): string;
    }
    
    class Json implements LoaderInterface {
        public static function load(string $path): string {
            return json_decode(file_get_contents($path));
        }
    }
    
    class Config {
        protected $config;
        public function __construct<LoaderInterface T>(string $path) {
            $this->config = T::load($path);
        }
    
        public function get(string $key) {
            return $this->config[$key];
        }
    }
    
    interface DatabaseInterface {
        public function getLastError();
        public function query();
    }
    
    class Mysql implements DatabaseInterface {
        protected $connection
        public function __construct(Config $config) {
            $this->connection = new PDO("mysql:dbname=". $config->get('mysql.database') .";host=". $config->get('mysql.host'), $config->get('mysql.username'), $config->get('mysql.password'))
        }
    
        public function getLastError() {
            return $this->connection->errorInfo();
        }
    
        public function query<Model>($query, $params) {
            $statement = $this->connection->prepare($query);
            $result = $statement->execute($params);
            return $result->fetchAll<PDO_CLASS>(Model::class);
        }
    }
    
    class DatabaseConnector {
        protected $instance;
        protected $builder;
        public function __construct<DatabaseInterface T>(Config $config) {
            $this->instance = new T($config);
            $this->builder = new QueryBuilder\{T};
        }
    
        public function getLastError() {
            return $this->instance->getLastError();
        }
    
        public function select($columns) {
            $this->builder->select($columns)
        }
        ... Skip bunch of example builder methods
    
        public function all<Model>() {
            $query = $this->builder->getQuery();
            $params = $this->builder->getParameters();
            return $this->instance->query<Model>($query, $params);
        }
    }
    

    [–] Redis is getting TLS! DrWhatNoName 4 points ago in PHP

    While a good addition, I dont know anyone who uses a remote redis server who requires TLS. As the network latency + encryption speed would negate the benifits of using redis in the first place.

    Everyone i have worked with run a local redis instance on the server.

    [–] Voice of the elephant podcast timeline counts 00-60 seconds in a minute. DrWhatNoName 1 points ago in PHP

    This triggered me when I was listening to the podcast and I noticed the counter tick upto 60, then tick over the 00.

    60: https://imgur.com/iHdhHfO

    00: https://imgur.com/Zf40kMI

    Argh, My brain is nuts right now. Theres 61 seconds in a minute

    [–] PSA: Bushes can obscure your thermal signature. DrWhatNoName 1 points ago in Warthunder

    Yes, but be real. In a match you wouldnt spot that and think "enemy spotted"

    [–] *Reality is often disappointing* DrWhatNoName 2 points ago in memes

    even then its safer, because they will take you into a dark 2x2 box where no one knows where you are for the rest of your life.