Version 0.5.0 is released! This is a pretty big one, focussed around ergonomics. There are new macros to make drawing and positioning primitives and text much less noisy, as well as changes to the
Drawing trait to remove the explicit
.into_iter() call when passing objects to it.
I maintain the Repositive website which uses React for the frontend and a server that supports server side rendering for the speed and SEO benefits of SSR. I’m currently in the process of porting it over to Typescript which is kickass, but the type checker kept borking on the XML tags used in the sitemap component. What follows is a quick “note to self” on how to fix that error. There might be much better solutions out there, but this is the one that worked for me.Continue Reading
Embedded graphics 0.4.7 has been released, along with a new sister crate, tinybmp! TinyBMP aims to parse BMP-format image data using no dynamic allocations. It targets embedded environments but can be used in any place a small BMP parser is required. Thanks to TinyBMP, Embedded Graphics now supports loading this simple image format. The header photo was made using Embedded Graphics and the SSD1331 driver in pure Rust. In this post, I’ll talk through how the BMP file is parsed in no_std environments with nom and how to get BMP images working with embedded_graphics.Continue Reading
I’ve recently been working on a Rust project at work which requires compiling for Linux (GNU), Linux (musl - for Alpine Linux) and macOS. I use Linux Mint nearly all the time, so building for macOS targets has required asking very nicely to borrow a spare Macbook Air. This is naturally a bit crap, so I set out to find a Linux-only solution to cross compile for macOS using osxcross. A weekend of pain later, and I have the following post. Hopefully it spares you a weekend of your own pain.Continue Reading
Rust (and LLVM) are really good at optimising things.Continue Reading
In my other post about creating properly typechecked helper functions in Typescript, I missed something out from the examples that’s present in the real code: default parameters! There’s a function,
createEvent, that returns an object with a dynamically generated UUID value in it. It also includes the current timestamp. This is great from the programmer’s point of view as there’s no need to wire up these values manually, but it sucks for unit tests because the values always change! The solution is to use default parameters to keep the ergonomics of a clean public API, but still support unit testing and special cases gracefully.
I’ve been working on toasting a lot of our tech debt at Repositive recently. We use an event driven microservice architecture which has various benefits, but some drawbacks concerning what data is sent where due in part to the liberal use of
any in our Typescript codebases. During my refactoring rampage, I encountered some places where event objects were missing fields or otherwise weren’t being generated properly. To this end, I set out to create a type-checked solution to this problem.
Office 365 mail, calendar and notifications in Linux Mint 19Continue Reading
As part of the weekly driver initiative, myself (@jamwaffles), @therealprof and @scowcron have been working on a Rust driver for the common as mud SSD1306-based OLED display modules. This little chip is found in the majority of inexpensive OLED display modules found on Ebay and AliExpress. It supports either an SPI or I2C interface, both of which the driver supports.Continue Reading
I’ve been developing an embedded Rust app (yay!) on Windows (blegh) recently. The Rust team have put incredible effort into making Rust itself work great in Windows environments, but the tooling around it can be difficult to get working correctly. My current problem was making GDB load a
.gdbinit file from the current projecting when doing
xargo run. Here’s how I fixed it in
So. Elm. It’s been an interesting experience for me, coming from a procedural language (JS) background. The learning curve is steep, but the functional nature of Elm, along with its compile time type safety really pays off. One of the (few!) problems I’ve found as a newcomer however, is that the documentation can be really frustrating sometimes. In this post, I hope to remedy that slightly by providing a newcomer’s perspective on a little bit of data processing in Elm.Continue Reading
Cloning a private Github repo using SSH auth in Rust has proved to be a pretty gnarly problem (for my anyway), so I thought I’d share this quick tutorial to help anyone else out that might be struggling with the same issue. I’m using git2-rs which has good interface documentation, but very few pieces of example code, so I set out to fix that somewhat with this post.Continue Reading
One of my main responsibilites at TotallyMoney was to take care of the in-house analytics/event logging framework. Like lots of companies, understanding what users do and how they interact with a product is to get good insight on. In this regard, people reinvent the logging wheel with various krimskrams attached, me being no exception. What I want to show in this post is how to integrate an event logging framework into a React/Redux application in a way that’s scaleable and testable. Unit testable logging is important when the rest of the business relies heavily on the events and the data in them like many companies do.Continue Reading
In between watching the rain and emptying all the shmoo out of my air compressor (long overdue), I decided to try my hand at some impromptu scraping this weekend. Matters were complicated somewhat due to me not owning a scraping tool, but I worked with what I have to make what I think are some satisfctory results. This post will be a short log of what went down and will hopefully demonstrate that one can achieve reasonably good (i.e. flat) results without having a real scraper.Continue Reading
Here’s a quick one; I’m making a Christmas display out of a bunch of serially controllable APA106 RGB LEDs, but how do I turn a value of
0 – 255 into a glorious RGW (Red Green White) struct with the correct colour, and the correct wrapping rules?
I’m fascinated by Rust for it’s safety and speed, but also because it’s simple to write low level code in what feels like a high level language. To that end, I’ve been working on a small Rust project at TotallyMoney.com (where I work) for the last week or so to see if it’s viable for production use. It’s a simple service that polls a Logentries endpoint for JSON, parses it and saves some values in a Postgres database. It’s not a very complicated task, but I saw this as a good opportunity to try Rust in a production-ish role.Continue Reading
Disclaimer: This is an article for an airsoft gun only. None of this pertains to real firearms.Continue Reading
Quick tip: if you’re looking for higher maximum speeds with your bipolar stepper motors, try wiring the windings in parallel instead of series. According to a short National Instruments article, it can increase torque at higher speeds, reducing the chance that the motor will stall during fast rapids.Continue Reading
Huanyang branded VFD drives are ubiquitous on eBay and other sites like AliExpress. I bought one some time ago with a 1.5KW spindle and have been controlling the speed manually with the difficult to use control panel on the front. It is, however, possible to control the VFD from within LinuxCNC using the
M5 commands (I haven’t been able to get
M4, reverse rotation, working yet). What’s also neat is we can get the machine to wait for the spindle to come up to speed before moving to the next line of GCode.