The Python documentation for str.strip().

Faster String Processing With Bloom Filters

At first, string processing might seem very hard to optimize. If you’re looking for a newline in some text, you have to check every character in the string against every type of newline, right? Apparently not, as [Abhinav Upadhyay] tells us how CPython does some tricks in string processing.

The trick in question is based on bloom filters, used here to quickly tell whether a character possibly matches any in a predefined set. A bloom filter works by condensing a set of more complex data to a couple of bits in an array. When an element is added, a bit is set, the index of which is determined by a hash function. To test whether an element might be in the filter, the same is done but by testing the bit instead of setting it. This effectively allows a fast check of whether an element might be in the filter.

CPython doesn’t stop optimizing there: instead of a complicated hash function, it simply uses the lowest 6 bits. It also has a relatively small bit array at only 64 bits which allows it to avoid memory all together, which in turn makes the comparisons much faster. [Abhinav] goes far into more detail in his article, definitely worth a read for any computer scientists among us.

Nowadays there is ever increasing amounts of talk about AI (specifically large language models), so why not apply an LLM to Python to fix the bugs for you?

Altoids Tin Spy Radio Goes Solid State

[Helge Fykse (LA6NCA)] has a type, as they say. At least as far as radios are concerned, he seems to prefer elegant designs that keep the BOM to the minimum needed to get the job done. And Altoids tins — he really seems to like putting radios in Altoids tins.

This QRP transceiver for the 60-meter amateur radio band is a perfect example of that ethos. For the unfamiliar, QRP is Morse code shorthand for decreased power, and is generally used when hams are purposely building and operating radios that radiate very little power, typically below a watt. For this transceiver, [Helge] chose to use modern components, a marked but interesting departure from his recent tube-powered spy radios. The design is centered on a custom oscillator board he designed using an Arduino Pro Mini and an Si5351 oscillator chip. Other components include an ADE-1ASK frequency mixer, an antenna tuner module that can be swapped out for operating on different bands, a receiver that’s little more than a couple of op-amps, and a Darlington pair for an RF power amplifier. Everything fits neatly on a piece of copper-clad board inside the tin box.

As is his tradition, [Helge] was on the air in the field with this radio almost before the solder had time to cool. His first contact was a 240-km shot to a friend, who reported a fine signal from this little gem. And that’s with just powering it off a 9-volt battery when it’s designed to the typical 12-volt supplies hams favor; he estimates this resulted in a signal of about 200 mW. Not too shabby.

Honestly, we’d love to learn more about that oscillator board [Helge] used, and maybe get a schematic for it. We found a little bit about it on his web page, but not the juicy details. If you’re out there, [Helge], please share the wealth.

Continue reading “Altoids Tin Spy Radio Goes Solid State”

You Can Use An Old Tape Deck As A Distortion Pedal

Distorted guitars were a big part of the rock revolution last century; we try to forget about the roll. As a youth, [David Hilowitz] couldn’t afford a loud aggressive amp, a distortion pedal, or even a proper electric guitar. This experience ended up teaching him that you can use random old audio hardware as a distortion effect.

[David’s] guitar journey started when he found a classical guitar on a dumpster. He learned to play, but longed for the sound of a proper electric guitar. Family friends gifted him a solitary pickup, intending he build a guitar, but he simply duct-taped it to his steel-strung classical instead. The only thing he lacked was an amp. He made do with an old stereo system and a record pre-amp. With his his faux-electric guitar plugged into the microphone input, he was blessed with a rudimentary but pleasant distortion that filled his heart with joy.

[David] goes on to explain the concepts behind distorted guitar sounds, and how his home hi-fi was able to serve as a passable starter amp when he was young and couldn’t afford better. He then goes on the hunt for more old gear at a local Goodwill store, finding a neat old tape deck that similarly produced some nice warm distorted tones. In [David’s] experience, old hi-fi gear with microphone inputs can generally do a decent job in this role, with electric guitar pickups typically overloading the preamps which expect a lower-level signal. It’s different to what you’d get from a Big Muff or Boss DS-1, but it’s a neat sound nonetheless.

We’ve looked at distortion effects before, including rolling your own and putting it into production. Video after the break.

Continue reading “You Can Use An Old Tape Deck As A Distortion Pedal”

3D Printed Robot Wants To Be Your Pet

Robots are cool. Robots you build yourself are cooler, especially ones that use stuff you have lying around already. Snoopy is a new open-source robot that uses an Arduino as a brain but with a 3D printed body and a short list of parts that can probably be sourced from the junk drawer. It’s still being developed, but it looks like a cool project heading in the right direction to produce an interesting robot.

It’s based on a new robot software platform called Kaia.ai that is built on top of the Robot Operating System 2 (ROS2), but with a more friendly and beginner-focused interface. Currently, the Snoopy project includes enough to get up and running with a printed frame and the electronics to install an Arduino running ROS2 that controls it. That’s an excellent place to start if you want to get into robotics, but without diving straight into the technical challenges of working with real-time operating systems.

It is also interesting that the previous project from the creator (called Kiddo) fell into the complexity trap, where you keep adding features and create an overly complex design that is a pain to build. Hopefully the designers have learned from Kiddo and will keep Snoopy simple.

We’ve covered plenty of other robot projects here at Hackaday, from ones that venture into nuclear reactors to ones that write your thank-you notes for you or give you hugs. We’ve even looked at how to give your robots a personality. Combine all those together with Snoopy and you could build a hugging, compassionate robot that has nice handwriting and can repair a nuclear reactor. And if you do, write it up and send it to our tips line!

Illustrated Kristina with an IBM Model M keyboard floating between her hands.

Keebin’ With Kristina: The One With The Busy Box Macro Pad

Well, I must admit that Google Translate completely failed me here, and thus I have no real idea what the trick is to this beautiful, stunning transparent split keyboard by [illness072]. Allegedly, the older tweets (exes?) hold the key to this magic, but again, Google Translate.

Based on top picture, I assume that the answer lies in something like thin white PCB fingers bent to accommodate the row stagger and hiding cleverly behind the keys.

Anyone who can read what I assume is Japanese, please advise what is going on in the comments below.

Continue reading “Keebin’ With Kristina: The One With The Busy Box Macro Pad”

Ballistic BMW Blocks Both Bullets And Booms

Maybe you like to live dangerously. Like, James Bond dangerously. Well, we won’t judge, but we will pass this along — BMW has created the ultimate driving machine for shootouts and war zones.

Rather than having aftermarket anti-ballistic bits and bobs attached at a later date, this BMW 7 Series is born anti-ballistic and explosion-resistant, built from the ground up with armor steel. They call this the BMW Protection Core.

By building it this way, there are many advantages like more cabin space, lower curb weight, and better handling, which is exactly what you’d want if you were under these types of attacks.

For starters, the car has chunkier A-pillars and door/window frames meant to withstand the damage pictured here. The car has special armoring in the roof and undercarriage to withstand explosions. And the fuel tank is self-sealing, so you have a chance at getting out of there if the thing takes a bullet.

Can’t afford this ballistic-grade beast? You could always roll your own armored vehicle.

Books You Should Read: David Macaulay’s Architecture Series

For a lot of us, there’s a bright line separating the books we enjoyed as children from the “real” books of our more mature years. We all eventually age out of the thin, brightly illustrated picture books we enjoyed in our youth, replacing them with thicker, wordier volumes with fewer and fewer illustrations, until they become so dense with information that footnotes and appendices are needed to convey all the information, and a well-written index is a vital necessity to make use of any of it.

Such books seem like a lot less fun than kids’ books, and they probably are, but most of us adjust to the change and accept the fact that the children’s section of the library doesn’t hold much that’ll interest us anymore. But not all the books that get a “JUV” label on their spines are created equal. Some are far more than picture books, even if the pictures are the main attraction. The books of British-born American author David Macaulay come to mind, particularly the books comprising his Architecture Series.

Macaulay’s books were enormously influential in developing my engineering sensibilities, and are still a pleasure to thumb through these many years later. I still learn something about the history of construction and engineering when I pull one of these books off the shelf, which makes them Books You Should Read.

Continue reading “Books You Should Read: David Macaulay’s Architecture Series”