Avatar of Daniel James a.k.a. thzinc

I’m Daniel James. I write things here when I feel like it. Find me on Twitter, GitHub, LinkedIn, or a myriad of other sites.

Newest Posts

Using Excel to make changes to GTFS feeds

In my work at GMV, I’ve had need to inspect and edit General Transit Feed Specification (GTFS) feeds on numerous occasions. A GTFS static feed is simply a ZIP file containing several CSV-formatted text files that describe the routes and schedules of a transit agency. Because GTFS is a specification...

New housing for RadioShack 22-810 15-Range Digital Multimeter

I was tired of fiddling with the fold-up case that my RadioShack 22-810 multimeter (photo not mine) came in. The probes were a pain to fit into the case properly and I also wanted to have the option to use wires with Dupont connectors to play nicely with my breadboard....

mRNA Vaccine Visualization (and cute frame for my vaccination record card)

I grew up with my mom telling me stories about chicken pox, and then a few of my friends caught it. I avoided catching the pox and I was able to be vaccinated against it. Now I’m an adult with a significant protection against shingles! I think vaccines are fantastic...

Things I write about

More Posts

How I turned my Levoit Core 300 air purifier into a fume extractor

For multiple reasons–my asthma, air quality, and COVID-19–I run several air purifiers throughout my home. I run a whole Levoit Core 300 air purifier on top of my desk, which typically is useful for collecting my cat’s dander in addition to putting clean air out close to my face. However,...

I tried to make a watering device for my cat

My cat has an addiction to drinking directly from the tub’s faucet. We’ve tried to get him nice water dishes and electric pump water fountains, but he just craves that good, good tub water. (And is extremely vocal about when he wants to drink.)

How I Built a Twitter Bot Using Auth0 Webtasks and Data.gov

I wanted to build something small, fun, and socially-engaging. I have been following Darius Kazemi (@TinySubversions) and the community of bot makers at Botwiki (@Botwikidotorg), and I decided a Twitter bot was the way to go. I have also been following the US Executive Order 13792 pretty closely. The order...

MQTT, Mono, and ARM

I wrote a .NET program to test building and cross-compiling an application to run on a Sierra Wireless AirLink RV50 gateway.

Think LINQ – .SequenceEqual()

Up until March 26, I had come up with a number of crazy concoctions to test whether one IEnumerable<> was equal to another. Some of them chained together .Intersect() with .Count(), comparing the count of the elements in the intersected set with the count of the elements in each of...

Think LINQ – .Skip() and .Take()

Needing to page through a collection is nothing new, and LINQ handles this nicely with two different methods: .Skip() and .Take(). The .Skip() method will skip over a specified number of items in an IEnumerable<>. The .Take() method will iterate over a specified number of items of an IEnumerable<> and...

Think LINQ – .Any() and .All()

“I just want to know if there’s anything in this List.” “Do any of the strings in my array start with ‘q’?” “How can I be sure all of the Rectangles in my IEnumerable<> have a width of 10?” These are the types of questions .Any() and .All() can answer....

Think LINQ – .SelectMany()

I recently came across a beautiful example of .SelectMany() used to find all types that implement a particular interface in all currently loaded assemblies. With minor alterations, here is how I used it:

Think LINQ – .ToLookup()

There is an class in the .NET generic collection framework that is often overlooked: Lookup<>. In effect, a Lookup<> functions like a Dictionary<> whose value is an IEnumerable<>. Though Lookup<T,U> is an implementation of IEnumerable<IGrouping<T, U>>, it functions with a similar efficiency to Dictionary<T,IEnumerable<U>>. Part of the LINQ extension methods...

Think LINQ – .ToDictionary()

There are a number of reasons to use Dictionary<> objects. Aside from the obvious name-value pair uses, Dictionary<> can also be used to essentially “index” an IEnumerable<> of objects. In testing with my colleague, Ryan Davis, we found that for IEnumerable<> collections that we intended to search through on a...

Think LINQ – .Cast()

Personally, I find that .Cast() is an often overlooked part of LINQ. Of course, .Cast() is handy when casting each element of an IEnumerable<> from one type to another. However, one detail in its method signature brings to light a much more interesting use: .Cast() extends IEnumerable, the non-generic interface,...

Think LINQ – The Wonder of IEnumerable<>

Language INtegrated Query, or LINQ, is a .NET feature that makes possible a powerful and extensible query on objects and collections thereof. LINQ is really a combination of a few key components: extension methods and generic collections. Understanding these two key components makes it much easier to “Think LINQ” when...