Rust module system

I’ve been writing small programs in rust as a way to learn the language. While trying to organize one of the application, I realized I didn’t fully understand how the module system worked. The official docs say that if you have your code organized in a single rs file, you can just split up the module into different files and the same rules apply. Without understanding how the module system actually works, you might be mislead into making false assumptions and hence run into errors that you might not understand how to solve....

January 27, 2020 · 7 min · Bilal Durrani

A bit of rust

While killing some time online, I can into a blog post that explained the origins of some weird numbers by looking at the hex data and converting that to strings. This gave me something to try in rust. Specifically, taking the bit of python code that converted strings into unsigned 32-bit and 16-bit integers and porting that to rust. I started by converting a string to bytes. 1 2 3 let raw_bytes_slice = command....

January 19, 2020 · 3 min · Bilal Durrani

PSA: You can keep using your original Doxie with Windows 10

This is more of a reminder for me than anything else. I’ve had my doxie original for a number of years now. With Windows 10, they stopped supporting the driver. After some investigation, turns out an original Doxie is actually a DocketPORT467. If you still want to keep using your original Doxie, but you’re ok with going without the other Doxie software, just grab the drivers from the docucap website...

December 25, 2019 · 1 min · Bilal Durrani

Using find/map/reduce with javascript iterators

I come from the .NET world, where I’m used to using LINQ for massaging collections of data in a clear functional way. ES6 added lots of useful functions to Array that lets me write code like 1 [1,2,3,4].filter(x => x ===3).map(x => x *2); I like this style because it avoids deep nested loops and makes the intention of the code very clear. To my surprise, I learnt that I can’t write code like this for other data structures like Map....

March 23, 2018 · 6 min · Bilal Durrani

Mocha tests hanging with Timers

When setting up unit tests for a specific JS class, I noticed that even though the mocha based unit tests was always passing, the test process would never actually exit. Here is what the class looked like, in it’s pared down form. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 class Blah { constructor() { this.stopCleanup = false; const interval = 1000; const run = () => { this....

February 21, 2018 · 3 min · Bilal Durrani

Highlight optional meetings in outlook

I find that Outlook calendar (I currently use the 2016 version) doesn’t highlight optional meeting invites very well. You have to read the fine print of the invite or dig around in the Scheduling assistant in the Calendar view. One trick I found on stack overflow lets you change the color of any meetings on the calendar where you were an optional invite. Right click on the calendar Select View Settings Select Conditional formatting Add a new rule, give it a name and a colour of choice Select Condition and then Advanced Click Field, select All appointment fields and then Optional attendees Set the condition to includes and the value to your name....

February 7, 2018 · 1 min · Bilal Durrani

Running node http in the background

This is something simple I needed to do, but had to dig around a bit to figure it out since I’m a Windows guy. I just wanted to run http-server as a background job in linux. 1 npm run server > http.log 2>&1 & Redirect stderr (the 2) to http.log, referred to by &1. The & at the end just means run in the background.

January 24, 2018 · 1 min · Bilal Durrani

VMVare and Windows 10

I recently upgraded by developer machine to Windows 10. After the upgrade, VMWare would fail to start any image with an error about disabling Hyper-V. Specifically this was the error 1 VMware Workstation and Hyper-V are not compatible. Remove the Hyper-V role from the system before running VMware Workstation After many cycles of uninstalling and reinstalling VMWare and Hyper-V, turns out the problem is actually related to something called Device Guard....

January 22, 2018 · 1 min · Bilal Durrani

Moving to Hugo

I’m trying to bring this blog back to life. I realized one of the things that was preventing me from updating more often was the fact that Jekyll is really complicated to set up on Windows. I would take a break from writing anything, come back and try to set up the toolchain, only to discover that something had updated and the existing toolchain broke on Windows. Hugo is easy. There is a single executable I can download annd run....

January 18, 2018 · 1 min · Bilal Durrani

Inline assembly in C#

I was working on trying to figure out how sqeeze out some more speed for some calculations, which involved the following bit of math. The language of choice was C# with Visual Studio 2013 for a 64-bit process. One idea was to try and use SSE to improve the throughput of the computation. Unfortunately the .NET framework currently (as of .NET 4.2) does not generate SSE instructions as part of its JIT compiler....

October 1, 2015 · 16 min · Bilal Durrani