I've been a big fan of probabilistic filters such as Bloom , and (more so) Cuckoo filters for a while now. I've put them to great use in my personal projects, as well as in major data processing projects at work. They fall into a neat class of data structures that let you trade certainty for performance. They are wildly useful for membership checks without loading the entire set into memory in…
Foreword : Please note this falls firmly into "nitpick" territory rather than shining light onto any sort of major issue. I just thought it was an interesting gotcha and wanted to share. TL;DR : To fully implement the PSR-16 specification as defined, an implementation MUST be contravariant of the defined interface in its accepted parameters when implementing v2 or later. I work on an application…
With the introduction of Apple Silicon, macOS became much stricter about running unsigned binaries. It even refuses to execute them in the Terminal. This can be frustrating as many precompiled tools, once easily downloadable from sources like GitHub, may no longer work as expected. By default, if you try to run an unsigned binary in Terminal, you will see an error like: Apple could not verify…
Go's new Iterators were released on August 13th with Go 1.23 . They're pretty useful. They've had just a minute to marinate. In some parts of the community they've been an unpopular addition, however I don't particularly mind them. The old alternatives seem a little more "Go" to me, but the new iterators are fine. One thing however I am mildly disappointed about is that there isn't just a generic…
I've been working as a developer for almost twenty years now. In that time I have had the pleasure of helping many developers, and helping them debug code. Some were new to the field, had vastly more experience than me. While some are naturally somewhat gifted at debugging, it's important to understand that the skill can be learned. In fact, even very experienced developers can struggle with it…
A minimal functional language, maybe similar to Excel equations for sharing logic between unrelated languages. Share the same logic between a Go or PHP backend and a JavaScript front end. mtpl minimum viable template language - like mustache but with less gotchas A pkg.go.dev style service for PHP / composer packages. Materialized JSON Parser - generate parsers ahead of time for specific JSON…
For basically as long as I can remember, I have been a staunch defender of permissive licenses over the more copyleft variety. I want you to use things I've written. On top of that I don't believe it's my place to force you to then open source things you have written that expand upon my source code. Hence my extensive use of the MIT License. The MIT License is very simple. It basically says you…
The tl;dr is this: You can fix the problem by replacing number with ReturnType<typeof setTimeout> Similarly you can replace number with ReturnType<typeof setInterval> if you are seeing the problem with setInterval . If you want to know more about it, read on. I've run into this problem a number of times where I'm developing frontend TypeScript and after I import a package, I suddenly find…
I have been playing with WebAssembly since Go added support for it in 2017. For a very long time now, I've been wanting to be able to accept files from an end user and process them with Go on their local machine. Basically I just want to read files from file inputs . I knew it had to be possible, but could not in all this time find a good walkthrough online. A couple nights ago I set my mind to it…
tl;dr I recommend every developer turn off automatic garbage collection in git. It's one of the first things I do setting up a new machine - and you should do so too. For a happier life, go to your terminal right now and run: $ git config --global gc.auto 0 I promise you won't regret it. The full story Turn off garbage collection? Surely, I must be crazy, right? Automatic garbage collection is…
Go has a problem. Go modules place a strange naming requirement on modules version 2 or greater. Module names on modules v2+ must end in the major version ala …/v2 , and communication of this rule has been weak. It's non-obvious, and the community at large does not understand it. I have seen many very large projects including Google owned projects get it wrong. I brought the issue up at my local…
Go currently lacks any sort of heredoc or similar syntax, and it's backtick syntax cannot contain backticks. This can make correctly encoded creating go strings, particularly for large strings that contain many backticks, a bit of a challenge. Here's a tool to safely encode any given input to Go string. It's written in Go using Go's own string encoder and compiled with WASM. The code as well as a…
Update August 17 2021 : I've got the tool working in Chrome and Firefox by launching it a standalone new window instead of loading in an iframe. It is still broken in Safari for unknown reasons. It's not ideal, but until the whole SharedArrayBuffer debacle settles down, it's probably the best I can do right now. Update October 17 2022 : The mp4's should now always be compatible with QuickTime.…
Update October 2nd 2024 : This was updated to include Go versions all the way up to 1.23 In 2013 I wrote an unintentionally inflammatory post: Go Binary Sizes Are Growing out of Control . I had imagined no one would read it, but it took off. I wrote it because I noticed my binaries getting larger as I upgraded versions of Go and found it curious. Much has changed since then; biggest of all there…
A little under a year ago I wrote a walkthrough: Set up a Self Signed Certificate on macOS's Built in Apache . Recently a new tool showed up called mkcert has come and made life way easier. It's a wonderful tool that instead of building Self-Signed Certificates, sets your local machine up with a certificate signing authority and creates valid certificates. You can read more about how it works at…
Update It would appear that the latest version of Xcode has removed the macOS_SDK_headers_for_macOS_10.14.pkg file. I am currently searching for alternative solutions. While trying to compile PHP extensions after installing macOS Mojave, I was butting up against a ton of missing header file errors including php.h and zlib. After several hours of beating my head against my desk and Googling/Stack…
Update 2019-01-29: A much simpler method using a tool called mkcert has come along and I have an updated walkthrough you may want to use instead. I would recommend the mkcert method unless you have a reason you explicitly need a self signed certificate. I recently purchased a .app domain for a side project; .app domains are interesting as they require SSL at all times . I like to set up my dev…
Update 2018-04-19 - GitHub has implemented some rules around retiring "namespaces". To prevent developers from pulling down potentially unsafe packages, we now retire the namespace of any open source project that had more than 100 clones in the week leading up to the owner’s account being renamed or deleted. This is a decent half step but I'd still love to see either permalinks or every namespace…
I am someone who spends large portions of their time working in weakly typed languages. Namely, PHP and JavaScript. I argue that static analysis is a must-have when working with any weakly typed language. It is nearly impossible to make reliable code without it. Static analysis makes up for the missing type system and allows you to scale. I recently got in an argument with another developer over…
Much of my professional work for the last 10+ years has revolved around handling, importing and exporting CSV files. CSV files are frustratingly misunderstood, abused, and most of all underspecified. While RFC4180 exists, it is far from definitive and goes largely ignored. Partially as a companion piece to my recent post about how CSV is an encoding nightmare , and partially an expression of…
UPDATE 2019-01-16 : In the three years since this article was written, parts of the article, in particular talking about UTF-8 are thankfully no longer accurate. It would appear in a recent update Microsoft has added support for safely reading and writing UTF-8 CSVs to Excel. There is a new format in the save dialog CSV UTF-8 (Comma delimited) which is distinct from Comma Separated Values which is…
tl;dr Do not depend on App Store Apps, Apple can and will pull the carpet out from under you. Reading Hacker News today there is an article about how OS X Installers stopped working on February 14th, 2016. This is due to an expired certificate Apple used to sign the binaries with. In that same time range I had a handful of Apps purchased from the App store suddenly and mysteriously stop working.…
I have a quite large iTunes library, and I’m rather anal about keeping my metadata clean and up to date. In an earlier release of iTunes 12 there was a bug. Every so often after a song played, the Play Count would fail to increment, but the Last Played would update. Searching my library, I found 74 tracks that had this issue. I found this irritating and inaccurate, so I set forth finding a way to…
There's been a fair deal of hubbub in the community about version numbers, including what is and isn't Semantic Versioning , what qualifies as a breaking change and how to use version numbers. Underscore.js released a second digit "minor update" that was actually a breaking update for some people. They argue it was minor because not very many people would be affected. The community however was…
Update : CIEDE2000 support added to the existing CIE94 support. It would seem that very similar but non -identical colors seem to pop up often in CSS files of any reasonable age, and I became sick of them. This started as a little script to help me find them in a stylesheet, and grew into this full-fledged tool. This tool will scan CSS and CSS-like files like Sass, Less, etc and find colors…
Should you run into errors related to missing php.h or other .h files, you should check out my post on fixing missing headers on macOS Mojave . These directions are for working with the native installation of PHP . Your results may vary if you are using a brew, MAMP or otherwise installed version of PHP - I do not recommend this for those cases. Important : As you are altering the built-in version…
Every time I would upgrade OS X it took probably 45 minutes of fiddling with my Apache configuration to get it working properly. I'm writing this article in the hopes of saving myself and others some time. The Setup For the following examples, {username} represents your username. Firstly, if you don't already have a Sites folder, create one in your home directory. $ mkdir ~/Sites Create or update…
I previously showed you how to Load a Github Gist with Composer, but sometimes you need to install code that isn't isn't even in a public facing VCS. I for instance wanted to use a library only distributed by Zip. It's actually fairly easy! In your composer.json file, you simply add a repositories section to the root. You will want to update the url section to point at the remote zip you intend to…
Update July 8, 2019 : Added more graceful pipe | and backslash \ handling. While doing code reviews on GitHub I find myself profiling a lot of SQL queries, getting EXPLAIN output into a markdown format for GitHub became very important, and was a huge pain to do by hand. While there were tools out there, nothing I could easily copy and paste tab seperated query results into, so I created this. The…
This is just a small collection of Bookmarklets I personally find useful. To use them simply click and drag them into your Bookmarks bar. Disable HTML 5 Validation Clicking this will disable html5 validation for all form elements on the page. Useful for testing server side validation while leaving HTML 5 validation in place. Element Count Clicking this will provide a count of the number of…
Lost in the shiny new features (see: namespaces and closures ) PHP 5.3 also added the __invoke method. While not plainly apparent, it is secretly an amazingly useful 'magic method' . If you're not taking advantage of __invoke , you should be . Why? It provides a uniform execution points for objects that have a doPrimaryAction() style method. What do I mean by this? Many simple, single…
Over the weekend I went to a talk on Scala. The speaker said variety of harsh , inflammatory, and mostly wrong things about PHP and the PHP community. One such example: The PHP community doesn't care about things like lambdas, they just care about getting a site up as fast as possible. This is just rubbish. PHP got the lambda treatment in 2009, while Java received it only months ago . The speaker…
A little over a year ago I wrote a post about using Beyond Compare on Mac via Wine. A native version is now in beta and open to everyone! If you haven't tried Beyond Compare, I suggest you do. If you have you already know how awesome it is. I've been testing the Alpha for many months now and thought I'd throw together some instructions for getting it going with git. You can download the beta here:…
Update 2019-07-17: I have released a follow up post Go Binary Sizes Are Relatively Stable which speaks on what's happened in the time since this was published. Note: This is not intended as a "Go Sucks" post. I love Go. I am not saying the developers are lazy or dumb or any of the things Reddit has implied. I am not implying I could build a better compiler. Rob Pike and the Go team are geniuses…
Composer is amazing for pulling in packages, but what if you find a Gist that isn't Composer aware? Fear not, as Composer has the magical ability to pull in repositories not explicitly set up in Packagist by defining them in the "repositories" section. But what if you wanted to load a single class from a git gist? You can add the following repositories section to your composer.json file, adjusting…
⚠️ Warning: These instructions are outdated This article was written for OS X Mavericks and should not be followed on modern versions of macOS. It remains available for historical reference only. For development on modern macOS, use a Homebrew-installed version of PHP. shivammathur/php is a good place to start. Do not disable System Integrity Protection. Doing so weakens macOS security and may…
If you are running OS X El Capitan or newer you will need to disable System Integrity Protection to modify system files and directories. To disable System Integrity Protection, boot into recovery mode by restarting and then holding ⌘R as you hear the startup chime. Then start the Terminal from the Utilities menu. Run the following command $ csrutil disable Then reboot. You are good to go. If you…
CoffeeScript is a programming language that compiles to JavaScript. Its mission is to "expose the good parts of JavaScript in a simple way". I've heard a lot of interest in it lately from various channels. After a coworkers departure, I inherited maintenance on our deployment bot, and it was written in CoffeeScript. While trying to make some small modifications, I ended up getting unexpected…
I fell in love with a dead keyboard layout. A decade or so ago while helping a friends father clean out an old building, we came across an ancient Sun Microsystems server. We found it curious. Everything about it was different from what we were used to. The command line was black text on a white background, the connectors strange and foreign, and the keyboard layout was bizarre. We never did much…
Update 12/26/2013: The Mac Beta is now available and there is no reason to use WineBottler anymore. Instructions and an updated post are here ! I switched from Windows to Mac for work a little over a year ago (I've been using Macs at home for years) and there is one program I still could not live without - Scooter Software's wonderful Beyond Compare . I've tried every single diff tool available…
In my professional work, we have a system that utilizes __call and __callStatic for caching of certain method calls. We have been running into a problem where calling an undefined method via :: within the class itself will trigger __call rather than the expected __callStatic . The Problem The following code example illustrates the issue. <?php class foo { function __call($name, $args){ echo…
Working on a class in our application, I discovered that it was being included before a number of constants it used for its members were even defined. Puzzled on how this had never been a problem I started to experiment; echoing the member at the bottom of the class file after the class closed showed the expected CONSTANT_NAME . I was very confused at runtime the value of the member in the…
As Lead Developer at my previous company I interviewed many Developers. I wanted to provide some advice to Developers on how to come off more positively. For the purposes of this post I , me and all other pronouns referring to myself refer to a hiring professional. Some Basics Up Front Google yourself. Google your email address, I will! There will be lots of Googling before you're hired. I am well…
Donations If you appreciate this tool, please consider a donation. It truly helps me out. PayPal : GitHub : Ko-Fi : Playing Minecraft, I like making circular things. I used a chart while I was building, but wanted to be able to make variable size ovals which is something I couldn't find a decent chart of or generator capable of, so I created this! Go Fullscreen Show Old Generator Fork my source on…
A hierarchy is a common structure, especially for structuring pages in web development. A problem with hierarchies is they often need to be flattened to be stored in a relational database, and then expanded again after being pulled out. An Example Hierarchy Top level item Sub Item Sub Sub Item Sub Sub Sub Item Sibling of "Sub Item" Top level as well A common and simple way to store them is with a…
So yesterday I was bored and asked my friend what I should do. She replied "I don't know, draw ASCII art or something!" and sitting there with the terminal open I kind of wondered what it would take to write one of those image to ASCII scripts. 20 minutes later I had the following PHP Shell Script! It works by simply sampling the saturation of every X th pixel and mapping that saturation to a…
Update 2023-10-17 The script has been verified to work in macOS Sonoma. When I switched from an older MacBook Pro to a MacBook Air the backup from my old MacBook Pro was corrupted and unmountable. However, I had preserved a backup of my Photo Booth Photos and wanted the Photo Booth application to recognize them. This is just a matter of creating a Recents.plist , an ordered list of the image…
It would seem there is a fair deal of call for an updated version of my PhpED dark theme from colleagues as well as random folks on the internet who’ve seen screenshots of my PhpED installation. I previously had my Dark Theme for 5 linked on my Review of PhpED, but I figured I could have a page dedicated to it. Screenshots Download and Installation The first step is to download the proper version.…
Update: 2026-07-18 Fixed a small bug in the luminance math I unintentionally caused by transposing some digits while converting my original PHP version to Go. All "Analglyph" types should appear slightly more vivid now. Convert MPO to JPEG This tool converts MPO files from devices like the Nintendo 3DS, Fujifilm FinePix Real 3D, or other 3D cameras that support MPO files, into more usable images.…
Today I decided to spruce up a VB.Net application I wrote in college and still use almost daily. In the process of converting it from .Net 2 to .Net 4 I wanted to add a splash of Windows 7 goodness; there were some very simple operations I wanted to add to JumpLists. The problem I ran into with all the examples I could find is that they either called entirely different applications (the Microsoft…