DynamoGeek

    I was recently writing a bit of code where I needed to find the number of occurrences of many different substrings in a long string. Think finding a three to five word phrase in an entire book. After some profiling and fixing a few other issues, it became apparent that calling substr_count a hundred thousand times was eating the lion's share of the execution time.


    So I started looking into it a bit. I didn't quite know where to look, what with a native PHP function generally being the fastest way to do things. After trying a couple things that didn't pan out, I thought "well, I've tried everything else, might just as well check to see how a regex compares". And to my significant surprise, preg_match_all is far faster when finding substring occurrences in longer strings.


    As an example, a test script I wrote shows that using preg_match_all instead of substr_count takes about one fourth the time. If you'd like to see the test script, it's part of my PHPPerformanceExamples repo on

    Read More

    I've decided to share the source of the spreading of all this anti-vaxxer non-sense (we definitely should not be vaccinating ourselves or our kids). It's the death industry.


    Fewer than a dozen companies control the majority of the death industry in America (with many more profiting slightly less directly, like 1-800-Flowers), and they continue to lose business with all this "vaccination" crap. I mean, humans can just make more humans to replace the ones who die. Why do we need to be preventing death all the time?


    As an example, Influenza and pneumonia, and Tuberculosis were the leading causes of death in the 1900's1. Between 1900 and 2010, the death incidence from these two diseases has fallen from a combined ~396 per 100,000 people in 1900 to ~16 per 100,000 in 2010.


    The Tuberculosis vaccine was released (and subsequently used, because stupid people not wanting to die and shit) in 19212. This lead to a sharp reduction in tuberculosis up until it fell right off the list of

    Read More

    Hello again, my DynamoGeek friends!


    I'm going to forego most of the time consuming fancy words today and just dump some (hopefully) useful information.


    I had need to access a website via cURL through a VPN using PHP. Though my specific current VPN of choice is NordVPN, theoretically this information could be applied to any SOCKS based VPN service that requires authentication.


    To help out those in the back of the room, and the search engines, I'll summarize what I did more concisely. I wrote some spiffy PHP code that proxies requests for webpages through NordVPN using cURL.


    Read More

    When reading part 1 of why You are Insignificant you may rightfully determine it to be a little nihilistic. Life is meaningless, so why try? While I do admit that, by itself, it does end a bit glumly, it only tells half the story. The other half is filled with much more of what some may consider "feel good non-sense". However, I feel it's actually "feel good sense", as it's quite sensical, and I've applied it to great effect in my own life.


    Life isn't meaningless, but it does only have the meaning we give it. We get only one life, and we spend so much of it being concerned with trivial decisions. We spend so much more of it being concerned with what others think about us and the trivial decisions we make. The truth is, even the teeny fraction of our daily decisions that matter only matter to a tiny number of people, and often only to ourselves.


    Everything I've written so far is to illustrate just how meaningless life is when lived only for others. If nothing you do really matters,

    Read More

    You are insignificant. The world doesn't care about you. You are forgettable. Barely anything you do truly matters. These are good things.


    When it comes to the universe at large, you are an insignificant speck riding on an insignificant speck that's orbiting an insignificant speck that is, itself, an insignificant speck in a galaxy, which, as large as it is, is an insignificant speck in a whole universe of similar insignificant specks. The odds of you doing something that affects even our galaxy, let alone the universe, are incalculably small. This is a good thing.


    If we bring the scale down a bit to just our world, since that's where we all live, we're still extraordinarily insignificant. Since the beginning of humanity, it's estimated around 108 billion humans have been born, including the ~7.5 billion currently alive. You are one of them. One. Singular. An individual member of the species. The number of notable individuals within that number is extremely small. If we assumed

    Read More

    Recently my team at work spent some time looking into the performance of our PHPUnit test suite. One of the things we wanted to improve was the rather lengthy code coverage execution time, as the suite recently crossed the 12 minute code coverage execution time threshold on our local machines. When it takes this long to generate a code coverage report, you just really don’t want to wait every time you have a feature to commit. As I’m sure you’re much more interested in how to decrease that coverage time, I’ll get right to it.


    We did two things to decrease the execution time:

    • Updated to PHPUnit 7.4
    • Used a new feature available in PHPUnit 7.4 to offload the file whitelist to XDebug
      • This uses a feature that is only available in XDebug 2.6+

    If you’re currently using PHPUnit7.4+ and XDebug 2.6+, or can upgrade to them, you can probably save a solid chunk of time.


    Starting with PHPUnit 7.4, a couple great improvements were made related to code coverage execution time. First, they made

    Read More

    It's a good question, really. Where did the ol' computer virus go, and what's all this new crap people are talking about? Honestly, the term 'computer virus' has been so overloaded and misunderstood in the last decade that it doesn't really mean much anymore. In the same way, the method of doing nefarious things with people's computer has also changed pretty drastically in the last decade. Where we used to have a generic 'computer virus' we now have many different naughty programs exploiting people, depending on the purpose of naughty program. Not only that, with the improvements in antivirus software and operating system security, (please queue any dramatic music you happen to have nearby) we're the ones infecting our own computers.


    That is correct! Given the current nature of the world, most of the computer problems we have are self inflicted. Not in the 'well you shouldn't have gone to that site' sort of way. In the 'you specifically downloaded and installed a program that is bad

    Read More

    Awhile back I purchased a pretty spiffy laptop. I got it for a good price at Best Buy. It was thin, light, looked nice, and was an all around awesome ultrabook. Except for one thing. One, ridiculously ridiculous thing. How the Lenovo Yoga 910 got out of the design stage with this issue is beyond my comprehension. However, before I tell you about the horror that is the issue, we'll Tarantino this a bit and talk about the good things the laptop has going on.


    First, the screen is beautiful. The model I got came with a 4K screen. No bright spots, no annoying bezel that catches all the dirt, just an all around excellent screen (it even supports touch, but not the kind you need to draw real pretty, such as you can with the Surface series of convertibles). Of course, I wouldn't expect less from a convertible laptop with 4K resolution. It performs more than adequately with anything I do, from gaming to movies to web browsing. No complaints. I'm very happy with the screen. Though, something

    Read More

    "Tact is the ability to tell someone to go to hell in such a way that they look forward to the trip." ~ Winston Churchill, among his alcoholic ramblings (just kidding, that's not true).


    Exceptional application of tact to a situation is quite nearly magic. The phrasing of your incantation could abruptly devolve a conversation to fisticuffs, or it could convince the other person to give you the shirt off their back, and be glad for the opportunity. Okay, that might be a bit much, but tact can, and often does, make all the difference when it comes to getting what you're aiming for. You'll reduce the defensiveness of others, improve the likelihood of them considering your ideas, and increase the chances of people going out of their way to help you.


    When you're having a conversation (written or verbal), aside from being kind and ensuring your tone is appropriate, there are a few things that can help you shift conversations in a positive direction, and help you and your team be as

    Read More

    Over the years I've flip flopped quite a bit between different technologies. Windows versus Mac OSX, laptop versus desktop, Android versus iOS. I've developed quite a number of preferences over the years, but few of them remain unwavering. One such unwavering preference is for mechanical keyboards. Some of my fellow nerds will expound upon the response time, the force actuation, and any number of other things that won't effect people who aren't typing all day, or playing games at an elite level. For me, mechanical keyboards just feel better to type on.


    So, what's the difference between mechanical keyboards and a 'normal' keyboard? It all boils down to what actually causes the keyboard to send the signal to the computer that a key was pressed. With a standard 'rubber dome' keyboard, a contact is made by a collapsing rubber dome. As you press down on the key, the bottom of the key presses down on a dome of rubber which deforms until it eventually collapses downward. As the top of the

    Read More