View Posts for Software Engineering

  • Today I Learned about Server Sent Events

    |
    Updated at

    Started making a "real time" API for my productivity software. I wanted to figure out what is a good way to notify a user's browser that something happened or new popped up so that it would update the UI appropriately. Automations occur on the backend without user input, so the UI needs to know about those updates so it can give the user the latest information.

    Two ways to go about it: Websockets or Server Sent Events. I have lots of experience with Websockets. It is bi-directional and requires a little more...

  • Today I Learned about Typescript Decorators

    |
    Updated at

    Beginning of back to normalcy I think. Back to writing more about Software Engineering and less about the dark road of fascist-like politics and conspiracies.


    Technically the idea of decorators for node was first introduced with ES6 Decorators which took off. Not sure what happened with it though. Proposal rejected? Anyway.

    The idea of decorators comes from annotations in Java where you can use reflection to get the annotation and get the associated metadata and then use that to construct what you wanted to c...

  • Fixing Gradle Javadoc task failure when using Java Modules

    |
    Updated at

    You may be familiar with this shitty error probably using Gradle 6.7:

    Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.List (java.lang.String and java.util.List are in module java.base of loader 'bootstrap')

    You likely have this in your afterEvaluate block:

    javadoc {
      inputs.property("moduleName", moduleName)
      doFirst {
        options.addStringOption('-module-path', classpath.asPath)
      }
    }

    You can fix it with:

    javadoc {
    inputs.property("moduleName", moduleName)
    o...
  • One of the Reasons I Love Rust Macros

    |
    Updated at

    You just can't beat this feature.


    use ::phf::{Map, phf_map};
    
    static MAP: Map<char, &'static str> = phf_map! {
        'a' => "apple",
        'b' => "bear",
        'c' => "cat",
    };


    Makes it so easy to create a very fast constant static hashmap at build time. You just can't beat it.. you just can't.

  • One Way How Javascript Bundling is Stupidly Complex

    |
    Updated at

    Anyone heard of any other language where there are "module" specs? You know specs for how your library will be bundled up in order to expose your library for consumption.

    AMD, CJS, UMD, ESM, SystemJS, GGJS, HYZM and whatever acronyms out there

    Why the fk do these things exist? Oh right, because Javascript left the idea of library importing out. It wasn't conceivable that people would need to do this in the browser until they did. I guess other language designers figured people share code and that company fron...

  • CRDTs are Interesting

    |
    Updated at

    It has been a while since the last time I looked into CRDTs or Conflict-free Replicated Data types. The name is pretty descriptive in that you want data types that replicate in a conflict free manner such as distributed counters, sets and maps.

    I found a really good resource on learning about CRDTs from a fundamental standpoint, which could help in building your own CRDTs that no one has. Lars Hupel's CRDTs

    The way it talks relates abstract math to how certain CRDTs work is very easily read. 'Here is a lattic...

  • When to use NPM's Peer Dependencies

    |
    Updated at

    I'll keep it short. First tech related post in a while too.

    I never used peer dependencies because I did not understand the point. It never installed the library I wanted! So it made no sense to me.

    I kept running into a problem with certain libraries that require use of a singleton instance that caches data. When multiple dependencies use the same library then they will all have their own version of the library which obviously causes unforeseen issues.

    There are libraries out there like Class Transformer that...

  • Updated Blog for 2020

    |
    Updated at

    Every year I try to see what I can do for my blog. This year, I decided not to change the layout. I think the layout is simple enough.

    Instead, I updated the font to use Inter and updated infrastructure. There are some kinks to work out.

    Styling and Font

    The inter font (https://rsms.me/inter/) is a very legible and dynamic font. I intend to use this on all my web properties. It just makes sense for the eyes.

    - Another legible and easy on the eyes font is called Lexend (https://www.lexend.com/), which I could sw...

  • "Why do Go articles so often have no syntax highlighting?"

    |
    Updated at

    https://news.ycombinator.com/item?id=23308644

    "Rob Pike, one of the 3 original Go architects, has stated in the past he doesn’t like syntax highlighting"

    https://groups.google.com/forum/#!msg/golang-nuts/hJHCAaiL0so/kG3BHV6QFfIJ

    "Syntax highlighting is juvenile. When I was a child, I was taught
    arithmetic using colored rods
    (http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I
    use monochromatic numerals.

    -rob"

    Believe it and that's why I can say Fuck Go Lang and its shit author. Early decisions...

  • MySQL Binary Log Pub/Sub

    |
    Updated at

    MySQL's Binary Log is nice to have, but not easiest to use. Change data capture (CDC) is the primary reason why I have to do it. When a user performs and action that causes an INSERT/UPDATE/DELETE, I want to know about it.

    Typical way is to plug it into your application, but that is prone to issues when your CDC statement doesn't run because fatal error caused your application to quit in the middle of the data manipulation statement. The entry was written to MySQL and its Binary Log though!

    I've always read ...