View Posts for Software Engineering

  • SvelteKit Team decides to Break Its Router for Nominal Gain

    |
    Updated at

    No longer using Sapper for this site or SvelteKit for any new projects. Instead I am using lit.dev and fastify, which have higher performance. Good bye Svelte Sapper whatever! Here's a starter repo: https://github.com/normano/web-starter for high performance, low maintenance web apps.


    TL;DR Fuck SvelteKit snce 1.0.0-next.406. Pick HTML/CSS/JS for simplicity and quick dynamic work. Should've listened to our elders about the complexity of frameworks and the value-less decisions framework maintainers tend to ma...

  • Typescript 4.7 Supports SubPath Exports and Imports

    |
    Updated at

    You ever wonder how other libraries exposed their library's internal paths with shorthands: @namespace/pkg/subpath? I did when this I had to expose ESM CJS modules so I could use SvelteKit and use some of my libraries in both ESM world and CJS world. Remember, using pkg/subpath/file.js meant you were forced to use a specific path, so you were forced to use CJS paths for broadest support. It's a pain the the rear with Typescript until now.


    Modify your package.json as usual: https://nodejs.org/api/packages.htm...

  • RocksDB Merge Operations

    |
    Updated at

    Check out my rust rocksdb crate helping to make operations like this a breeze.RockSolid: An ergonomic persistence layer over RocksDB, offering Column Family support, transactions (CF-aware), batching, merge routing, value expiry, and performance tuning.


    I've been an in memory database fan for a long time. They are easy to work with. Hell, SQLlite is used in browsers and mobile apps because relational DBMS are powerful. RocksDB is a powerful key/value store and is used on the server side and embedded devices....

  • MessagePack JS doesn't Fully Support Int64

    |
    Updated at

    The MessagePack Protocol supports 64bit Integers, but for whatever reason msgpack for js still decided not to fully support 64 bit ints. Javascript supports 64 bit integers through arbitrary bit precision bigint, so it is insufficient to say the language does not fully support the protocol.

    So fuck em, I'm forking it and adding support for my own purpose. I've no confidence that the protocol will support 128bit integers anytime soon. Not that that matters to me since UUIDs and ULIDs are serialized to uint8 a...

  • Learning about Paxos and CASPaxos

    |
    Updated at

    Paxos is regarded as a complicated consensus algorithm much like how Kubernetes is seen as a complicated system. That doesn't mean you should not  be curious and take some learnings and insight from them. I don't shy away from complex algorithms or systems for long though Paxos is one of those algorithms that has eluded me for some time.

    I learned about Raft and implemented the leader election part for systems I was building which worked out really well long ago.A log was too heavy for what I required in th...

  • Why Flutter is Designed the Way it is

    |
    Updated at


  • Dart's import_of_legacy_library_into_null_safe is annoying and how to disable it

    |
    Updated at

    Flutter/Dart, whatever you want to associate null-safety with. Why is this lint error a thing? The official solution is to migrate the imported library. Lol, I don't believe it is my problem that the library is not "null safe".

    This null safety change is just a syntactical sugar change. It moves all existing types to nullable opt-in. This assumes that all libraries are opted-in to nullable types while any libraries compiled with new dart versions are opted-out of nullable types by default.


    For example, assume...

  • Best Way to Represent Boolean in MySQL

    |
    Updated at

    This is an elegant solution that I quite appreciate because it uses zero data bytes:

    some_flag CHAR(0) DEFAULT NULL
    

    To set it to true, set some_flag = '' and to set it to false, set some_flag = NULL.

    Then to test for true, check if some_flag IS NOT NULL, and to test for false, check if some_flag IS NULL.

    (This method is described in "High Performance MySQL: Optimization, Backups, Replication, and More" by Jon Warren Lentz, Baron Schwartz and Arjen Lentz.)


    I can't say it is good for ORMs though.

  • 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...