
A patient boy

life, coding, technology, outdoors, photography
Recently, I went down a rabbit hole attempting to learn how to generate interesting looking maps for games (insert mind-blown-gif here). While Iām not going to be using Voronoi diagrams anytime soon,Ā I am still interested in attempting to generate Civilization-like maps.
Most map generation algorithms rely on perlin noise. I wanted to go a different route.
So far, these are the rules that Iāve come up with for my algorithm:
1. Create a grid of some given size (e.g., 100 x 50). Set all tiles to āoceanā.
2. Randomly pick 8 tiles (variable) across the map to seed as ālandā.
3. Now iterate across all tiles on the map and build an array of tiles that are āoceanā tiles but have a land tile N/W/S/E of them.
4. Once you have this array, randomly pick a single value. Flip it from āoceanā to ālandā
5. Repeat step 3 until a given number of tiles have been filled across the grid (e.g., for an āEarth-like planetā, 30% of tiles will be land).
6. Now, to add some additional randomness ā iterate across all tiles and build an array containing all ālandā tiles next to water (N/W/S/E).
7. Randomly pick 1, flip from land to ocean.
8. Repeat step 6 a given number of tries (e.g., 100).
9. Done! (Maybe)
Height maps, biomes and all that can come later. To quote Amit, whom I linked to earlier:
The most realistic approach would have been to define elevation first, and then define the coastline to be where the elevation reaches sea level. Instead, Iām starting with the goal, which is a good coastline, and working backwards from there.
Anyway, itās been kind of neat to figure out.
Another example map, created using the above rules:
Ā
TL;DR After a lot of testing and isolating devices, Iāve determined that the RK G68 RF receiver for my swanky new mechanical keyboard causes my Windows 10 machine to wake up immediately after putting it to sleep. And Iām not sure how to fix it.
Join me on an epic journey of heartbreak, anger, loss, triumph and sadness as I try to diagnose some sleep issues.
ā-
So, the issue is that if I manually put my computer to sleep (Start Menu -> Power -> Sleep
), the machine goes to sleep, fans turn off, and all that. Sweet! Then, after about 5 seconds, it wakes right back up. Uh, what?
Iāve done a number of debugging and testing steps which Iāll outline below (hopefully, this helps some folks in the future).
Letās do a couple of finger stretches, put on our hacker pants, and open up PowerShell (with admin access). We can run a nifty command called powercfg /requests
I see the following output:
DISPLAY: None. SYSTEM: None. AWAYMODE: None. EXECUTION: None. PERFBOOST: [DRIVER] Legacy Kernel Caller Power Manager ACTIVELOCKSCREEN: None.
Great! But not really super helpful. We visit our friend, Google, and I see that there is a command to disable this:
powercfg -requestsoverride Driver "Legacy Kernel Caller" System
You havenāt lived until youāve copy and pasted random commands from the Internet into your terminal. Letās do it! I run that and make the computer go to sleep again. Monitor turns off, fans spool down. Yes! Yes?
Obviously, it immediately wakes up. No dice.
Ah, ha! Maybe read the command first, dude? The issue here is that the Legacy Kernel Caller is in the PERFBOOST category, not SYSTEM category. Thatās easy to fix.
ā¦but it isnāt.
Of course, you canāt actually disable the driver for items in the PERFBOOST category. Of course.
Hey, Googleā¦
Next up: A suggestion to check waketimers. I have no idea what that is, but sure: powercfg -waketimers
There are no active wake timers in the system.
Okay.
Yo, Goooooooogleā¦ again!
Ah, another command! powercfg -lastwake
Now weāre getting somewhere. We see that this is a USB device that is waking the computer:
Wake History Count - 1 Wake History [0] Wake Source Count - 1 Wake Source [0] Type: Device Instance Path: USB\VID_25A7&PID_FA70\8&e5ec113&0&4 Friendly Name: Description: USB Composite Device Manufacturer: (Standard USB Host Controller)
Butā¦ how do we determine what it is? Looking at the path, we see VID and PID. That means:
Vendor ID: 25A7
Product ID: FA70
Letās Google those: It turns out, the vendor is Areson Technology Corp
and it looks like they make RF receivers for various input devices, such as wireless mice. Interesting! No hits for the product ID. Thatās fine, thereās probably more types of RF receivers on planet Earth than there are people.
But that gives me a starting point.
I decide to start unplugging various devices and put my computer to sleep.
IT DOESNāT WAKE BACK UP!!!!
Victory. Party dance. Switch out the hacker pants for party pants. Now weāre getting somewhere!
I plug the receiver back in and open device manager. I go to the keyboard section (randomly, there are like 4 different devices listed there). I open the properties dialog box for each of them, go to the Power Management
tab and uncheck āAllow this device to wake the computer.
ā
I got you now, pesky sleep problems! :blow-smoke-off-gun-gif-dot-com-dot-net:
I put the computer to sleep.
IT IMMEDIATELY WAKES BACK UP!
Iāll be honest. There was a lot of screaming, kicking, swearing. My dog got up and left the room (he never does that). I almost knocked over a coffee cup onto my keyboard and I DIDNāT CARE.
Okay, fine.
No big deal, really. Iām not okay, youāre okay.
On a hunch, I expand the Universal Serial Bus controllers
section inside the device manager. Sure enough, there are a bunch of things that say USB Composite Device.
You might remember from earlier (but probably not), that a āUSB Composite Deviceā was called out using the --lastwake
command.
If you open up the properties for each USB Composite Device and go to the events tab, you will see the device ID in the information section. Keep looking until you find the device ID that was called out: USB\VID_25A7&PID_FA70\8&e5ec113&0&4
Click. Close. Click. Close. Click. FOUND IT!
Device USB\VID_25A7&PID_FA70\8&e5ec113&0&4 was configured. Driver Name: usb.inf Class Guid: {36fc9e60-c465-11cf-8056-444553540000} Driver Date: 06/21/2006 Driver Version: 10.0.19041.488 Driver Provider: Microsoft Driver Section: Composite.Dev.NT Driver Rank: 0xFF2003 Matching Device Id: USB\COMPOSITE Outranked Drivers: Device Updated: false Parent Device: USB\VID_0BDA&PID_5411\7&b8f002b&0&2.
Sweet, now to just open up the Power Mā¦. THERE IS NO POWER MANAGEMENT TAB.
My dog came back. He immediately left again. You can probably guess why.
Back to Google again:
āEnsure drivers are updatedā.
Okay. Sure. Blah, blah. But maybe itāll work. It wonāt though. I already know. Who am I kidding?
The best drivers for your device are already installed.
Fine. Iāll just uninstall the driver.
Oh, cool, now my keyboard doesnāt work.
BUT YOU KNOW WHAT?! MY COMPUTER STAYS ASLEEP!
Head, meet Desk. Desk, meet Head.
ā-
A few other things to note.
(I do care. Deeply. I just canāt right now.)
What a fantastic book about a horrible family.
The first half of the book is a true rags-to-riches story, following the life and rise of Arthur Sackler and his brothers. The son of an immigrant, he came of age during the Great Depression. This man could hustle and there was nothing that could stop him.
The second half is about the pharmaceutical company they purchased and ran. In the 90ās, they created a ridiculously powerful pain killer (OxyContin). In an effort to maximize profit, they pushed the drug onto unsuspecting patients and physicians despite knowing (and hiding) how addictive and dangerous it was.
The damage is jaw dropping. And like most crimes involving the ultra rich, the family members who ran the company (and used it as their personal piggy bank) got away with it.
At first glance, this book seems to be a biography of Jennifer Doudna, a biochemist and one of the pioneers of CRISPR research.
While there is some focus on her upbringing and the things that may have driven her to become a fantastic scientist, the book is really about the wide range of characters who helped discover CRISPR DNA sequences and their potential applications in modern medicine.
Iāve heard CRISPR and CRISPR-based technology mentioned in various things Iāve read and how it is something that could potentially revolutionize medicine. But thatās really all I know about it.
This book digs into how Jennifer and her team of researchers discovered the CRISPR process ā essentially duplicating the way that bacteria has fought off viruses for eons ā and how it could ultimately be used for various therapies, treatments and even diagnoses.
The book briefly mentions its use in the Moderna and Pfizer vaccines for COVID-19 as well as some of the more controversial and ethically questionable uses ā editing the genes of a fetus, for example, to choose certain traits (which will then be passed down to its own children).
This was an enjoyable and informative read and it covered all sorts of things from the science of CRISPR, legal issues related to patents, and the use cases for CRISPR based technologies today.
Quick summary: Washed up author (Jake) teaching a writing workshop finds out a former student of his (Evan) ā who had an amazing idea for a story that was guaranteed to be a best seller ā suddenly died without publishing or apparently sharing his story with anyone.
Jake helps himself to the idea and ends up publishing a best selling book. Onlyā¦ some Internet troll knows the truth and is sending him some anonymous, threatening letters. And so begins a wild goose chase.
I definitely enjoyed this. It starts off a bit slow, but as the story goes on the pace picks up and I couldnāt put it down
Iāll be honest: I *knew* there was going to be a plot twist around a certain character the moment we met them. I just knew it. But the deviousness of it still surprised me and I really wasnāt prepared for how things went down.
That said, some of the threats the anonymous person was making toward Jake felt a bit hollow. Knowing what we knew this person probably did, they couldnāt really threaten Jake without exposing their own crimes. So, that whole thing was kind of strangeā¦
But we find out that it actually doesnāt matter, because there is a longer game at play and Jake is merely a pawn.
Itās crazy.
A few years ago, I read Conn Igguldenās Conquerer series, a fictional account about the rise of Genghis Khan (nĆ©e Temujin) and his exploits across Eurasia. It was a fascinating book and made me curious to learn more.
I picked this one up recently. While I enjoyed it, I often found myself thinking about how hard it must be to write a book about someone who lived amongst a nomadic tribe about 800 years ago.
The source material for this book is based upon notes found within a tome of (sometimes mythical) knowledge that was written shortly after Genghis Khan died ā simply called The Secret History of the Mongols. It was written by an anonymous author and then passed down through the ages where the only remaining copy is a translation created some 200 years after his death.
The book is rarely critical of Genghis Khan, his followers (this is more of an āends justify the means), and the sometimes ruthless actions they took to subdue a population.
That said, some of the most fascinating aspects of this story were how progressive the Mongols were when it came to improving the lives of the people they ruled: public schooling, accounting, trade, and communication. The book contains a fascinating comparison that puts his accomplishments in perspective:
āIn American terms, the accomplishment of Genghis Khan might be understood if the United States, instead of being created by a group of educated merchants or wealthy planters, had been founded by one of its illiterate slaves, who, by the sheer force of personality, charisma, and determination, liberated America from foreign rule, united the people, created an alphabet, wrote the constitution, established universal religious freedom, invented a new system of warfare, marched an army from Canada to Brazil, and opened roads of commerce in a free-trade zone that stretched across the continents.ā
Overall, this was an interesting (if skewed) story about an infamous character in history that many of us might have just misunderstood.
ā ā ā ā ā
This book is about the horrific, yet little known 1921 Tulsa race riot. The 100th anniversary of this tragedy and reflections on it reminded me about a book that Iāve had on my to-read list.
I first heard about this incident while reading Sam AndersonāsĀ Boom Town, about the founding and growth of Oklahoma City. It briefly mentioned the Tulsa riot and how a white mob had destroyed an entire African American neighborhood.
Eager to learn more, I searched for a book about these riotsā¦ but then never followed up reading about them.
Set against a tapestry of racism, violence and resentment, this was a tinderbox waiting to explode (and these sorts of race riots had broken out in other parts of the country around this time as well).
I couldnāt believe the violence that was carried out, simply to put āblack people in their place.ā Looking at photos of the aftermath, the level of destruction is akin to photos of San Francisco after the 1906 earthquake and fire. Nothing is left standing. Thousands of houses destroyed, hundreds (!) of people dead.
And yet, the story was swept under the rug. It literally took decades before people started talking about it and publicly acknowledging that it happened.
My biggest takeaway was how easy it was for us human to become straight up barbaric animals when blinded by hatred.
Toward the later half of the book, the story recounts a young journalist who visited an internment center where people fleeing the violence (or were captured) were sent.
She found an older black woman crying, because she lost everything and had no idea where her family was. Eventually, the reporter asked, āhow could this happen?ā
āHow could this not happen?ā replied the old black woman.
The Burning: Massacre, Destruction, and the Tulsa Race Riot of 1921 by Tim Madigan
ā ā ā ā ā
Andy Weir has clearly found a formula that works. A brilliant lone scientist stuck in space, who must overcome calamity after calamity in order to survive and hopefully get home.
This time, the story involves space fungi that are eating our sun (technically, itās more like a space algae, but whatever). The nations of Earth band together and launch a mission to the stars in order to turn the tide on this interstellar parasite.
Our narrator wakes from a coma and doesnāt remember a thing. Where is he? How did he get there? What is his name?
Like Mark Watney before him in the Martian, our narrator is going to have to āscience the shitā out of his situation in order to answer all the questions above, and also hopefully, maybe save Earth, too.
Oh, and sprinkle in a bit of first contact as well. Mark Watney never found himself a sidekick while he was on Mars.
Some parts were overly verbose, other parts were cringe-worthy and corny, but this was still an entertaining story I tore through in about 3 days.
If you liked The Martian, youāre going to like this book. If you didnāt, well, sorry. This book is more of that and then some.
Story of my life lately.