Rust: Structuring and handling errors in 2020 (from Nick Groenen)

Everything I’ve built with Rust so far has been tiny in both scope and size, so writing out my error handling code by hand hasn’t been much of a hassle. However, I’ve been meaning to look into some of the popular error handling crates so I don’t have to write a ton of boilerplate every time I want to introduce a new type of error in my applications.

Nick Groenen covers two such crates in his blog post on error handling in Rust: https://nick.groenen.me/posts/rust-error-handling/

This reddit thread has further suggestions: https://www.reddit.com/r/rust/comments/gj8inf/rust_structuring_and_handling_errors_in_2020/

Week of 25 May, 2020

  • America is burning. India has been burning for months. Unable to contribute much to what’s going on, I’m educating myself. The only thing I really know how to do is read and write, so I’m reading. Maybe one day I will write.
  • I cooked a giant pot of creamy, buttery dal bukhara and I’m unreasonably proud of this achievement. I’d make a great house-husband.
  • Darkest Dungeon was free for the weekend, so I’ve spent the last two days gleefully getting my ass kicked by eldritch horrors. I’ve been wanting to play this game for months, and I’m happy to report that it lives up to the hype.
  • Tehanu is incredible. You can tell within the first few pages that Le Guin was an entirely different person by the time she got around to writing it.
  • Work has been frustrating. I’ve been spinning my wheels trying to build a thing that should be straightforward, but isn’t. It’s been making me not want to even look at my IDE. I’m close to a solution now, so hopefully this period of reduced productiveness will only last a few more days.
  • Charli still on repeat.

Basic Garlic Hummus

There are tons of recipes for hummus online, but this is a super basic one that I like to use.

If you feel like eating something fancier, you can try adding red chili powder, roasted cumin powder, beetroot, black pepper, or spicy ground beef/lamb to this hummus.

Ingredients

  • 1 cup dry chickpeas
  • 6-8 large cloves of garlic
  • 1 cup olive oil (1/4 cup for the tahini, 3/4 cup for the hummus)
  • 1/2 cup sesame seeds
  • 1.5 tablespoon salt
  • A lemon

Recipe

  1. Soak the chickpeas in water for 8-10 hours.
  2. Rinse the chickpeas and put them in a pressure cooker with 3.5 cups of fresh water. Add a tablespoon of salt and pressure cook for 12-15 whistles. Let the pressure settle on its own.
  3. While the chickpeas are cooking, heat a pan on medium heat. Spread 1/2 cup of sesame seeds evenly on the pan and roast them until they’re golden and fragrant. Make sure the seeds are evenly roasted.
  4. Let the seeds cool for a few minutes and transfer them to a blender. Add 1/4 cup of olive oil and blend until the seeds form a paste. You can reduce the amount of oil if you want a thicker, dryer tahini.
  5. Open the pressure cooker and separate the chickpeas from the water using a colander. Save the water for later.
  6. Put the chickpeas in the blender with 6-8 cloves of garlic, 3/4 cup olive oil, 2 tablespoons of tahini, juice from half a lemon, and some of the drained chickpea water. Blend until the chickpeas form a paste, slowly adding more of the saved water if necessary.
  7. Taste the hummus and add more salt if necessary. You can also add another tablespoon of tahini and more lemon juice according to taste.
  8. Put the hummus in the fridge and serve it when it’s slightly cool.

Week of 18 May, 2020

  • I found the first Earthsea book to be dry and stilted, but Le Guin’s world and its inhabitants are getting more complex, more diverse, and more human as the series goes on. I finished The Tombs of Atuan and got halfway through The Farthest Shore this week, and I can’t wait to start Tehanu. I can already anticipate the emptiness I’ll feel when I finish all the books in the series, when I’ll be forced to say goodbye to Ged, Tenar, and all the other denizens of Earthsea.
  • Champaca has started delivering books across the country, so I got myself all three books from N.K. Jemisin’s Inheritance trilogy. I now have my eyes on Becky Chambers’ Wayfarers series and Liu Cixin’s Remembrance of Earth’s Past series. This is going to be a good year for reading SFF.
  • Charli is still on repeat. Anthems should be the official anthem of the quarantimes.
  • For the last few weeks I’ve been working with a client who wants to create tooling for developers building machine learning models. Every time I step back to look at the work I’m doing I feel immensely proud of what I’ve accomplished, and there’s no greater joy in the world than that. In the middle of this pandemic I at least have my work to keep me grounded and contented. I’m immensely grateful for this.
  • From 2009 to 2011 I ran a personal blog not too different from this one. It was served from a cheap shared hosting box, which I lost because reasons. I thought it was gone for good until I looked for it on the Wayback Machine and found that it had been backed up there in its entirety. I spent a large part of the week migrating posts from the backup to this current blog, which means my archives now extend back to 2009. That’s more than a decade of blog posts! You can read a particulary juicy one that went viral here, and you can see the whole archive here.
  • I fired up Factorio over the weekend because I was bored. After four hours of messing around with belts, I’m ready to pour my entire life into this game. I’d forgotten the sense of wonder and discovery that I got from city building and simulation games when I was a kid. Console gaming is fun, but you can’t control a game like Caesar, Rollercoaster Tycoon, or Constructor without a mouse and keyboard. I’m now tempted to build a PC so I can play modern incarnations of these games. Somebody stop me.

PS: as an experiment, I’m allowing comments on all my new posts. I’ll disable them if it turns into too much work, but I’m willing to try this out for a little bit. Be kind.

Cooking (North) Indian Food

While health officials have said that COVID-19 doesn’t spread through food, especially if you heat it properly before consuming, I haven’t felt comfortable ordering food from restaurants since the government announced the lockdown in March. This means Ankush and I have been cooking all our own meals for the last two months.

I’ve cooked for myself in some capacity since I moved to Bangalore seven years ago, but this is the first time I’ve been forced to cook nearly every single meal myself. In the process, I’ve learned a few things. They may be familiar to folks who have been cooking for years, but each one of these tips made a huge difference to the quality of my cooking:

  • Ghee can make everything taste like it was cooked by the spirit of a dead Mughal chef, but it can also overpower all the other flavors in your food. I used to use a ton of ghee in all my cooking, but I now prefer using a neutral oil for most dishes.
  • Most North Indian recipes call for a 1:2 ratio of onions to tomatoes in the curry, but I like to use a bit of extra tomato to add some tang to the gravy. If I don’t have a small tomato lying around, I add a tablespoon of packaged tomato puree.
  • Using ginger-garlic paste, whether homemade or packaged, always results in tastier gravies compared to using chopped ginger and garlic.
  • The slower you brown your onions, the better your gravies end up tasting. About twenty minutes on a medium flame works great, but I’ve cooked them for even longer with good results.
  • You want to put either jeera powder or dhania powder in your gravies, but usually not both.
  • You want to put either jeera seeds or mustard seeds into your tadka, but usually not both.
  • Hing is a very potent spice, use it with care.
  • It can take a really long time to cook peas. I’ve boiling them in water for a few minutes before putting them into gravies, because sometimes they end up staying raw even when all the other ingredients in a dish are cooked through.
  • If you’re cooking chana or rajma in a pressure cooker, don’t forget to add salt. If you pressure cook them without salt, the resulting dish will taste bland even if you later add enough salt to the gravy.
  • If you don’t use up your rice fast enough, you’ll sometimes see small black bugs appear on the grains after a few weeks. These are rice weevils, and their eggs are invariably present on your rice even if you buy the really fancy brands. You can get rid of these eggs by putting the rice in the freezer for a few days before using it.
  • Common grains in descending order of cooking times are: white chana > rajma > toor daal > moong daal and basmati rice > masoor daal.

The Weird Web

In the vast desolation of the modern Web β€” now controlled entirely by billionaires, venture capitalists, and media conglomerates β€” there still exist a few noble souls who are keeping alive the spirit of the weird, creative, and human Web of the late nineties and early noughties.

No maps will lead you to the Old Web, but these hyperlinks might light your way:

  • Wiby – a search engine for the Old Web.
  • BoardReader – a search engine that only searches forum threads.
  • Million Short – a search engine that lets you exclude the world’s biggest websites from your search results.
  • HrefHunt – a curated collection of creative websites by real humans.
  • NeoCities – like GeoCities, but re-imagined for the modern era. Their sites directory is what you want to look at.
  • IndieWeb – a community of people building technology that lets you own everything you create, while also being able to participate in Big Tech’s social platforms.
  • πŸ•ΈπŸ’ – an IndieWeb webring. You want to start by clicking on one of the websites in the directory.
  • IndieWeb.xyz – an IndieWeb aggregator.

I’m always looking to add to this list. If you know of a website that belongs here, please get in touch over email or twitter.

Week of 11 May, 2020

  • I got the air-conditioning fixed! It’s amazing what a few nights of sleeping in 24ΒΊC can do for your anxiety. My mood is better, I feel more energetic, and I’m able to do things around the house again.
  • I’ve given up on the reading list I set for myself and decided to just read fiction for the rest of this year, or until the COVID-19 situation gets better. Reading fiction doesn’t do much to fix my anxiety, but it’s easier to read than non-fiction and distracts me from what’s going on in the world.
  • Talking of fiction, I’ve been completely obsessed with The Dispossessed lately. It’s not just the idea of an anarchist society that excites me, but also the fact that this is one of the few SF stories I’ve read that talk about what a better world than ours might look like. A lot of SF tends to lean towards dystopias, but The Dispossessed attempts to imagine a new, better future.
  • Continuing my Ursula K. Le Guin binge, I’ve also been reading the Earthsea series. I can’t say I’m enjoying it very much yet, but I plan to stick with it.
  • The new Charli XCX album is one of those era-defining pieces of work that people will still be talking about a decade from now. The only pop record I like better than how i’m feeling now is EMOTION, which is really saying something.
  • This also happens to be the week I discovered Griselda Records. I’m not a huge fan of the classic NY boom-bap sound, but there’s something about how Griselda approaches it that makes all their records very listenable. The individual tracks on Westside Gunn’s Pray for Paris and Conway the Machine’s No One Mourns the Wicked kind of blend into each other, but the albums as a whole are really solid.
  • For the last year I’d been trying to get myself into the habit of listening to music without any distractions. I used to be able to do it four or five years ago, but these days it’s hard to keep my brain focused on just the music. I now prefer scrolling through Instagram or Reddit as I work my way through a new album. I doubt I can force my brain to change β€” trust me, I’ve tried β€” so I’m just making peace with this. Listening to music is supposed to be fun, and I’m going to do whatever feels most comfortable.
  • RTJ4 dropping on June 4! Killer Mike and El-P are the reason I’m still here today, so to say I’m excited would be the understatement of the year.