UTF-8 brain lifting weights

Nic Barker Explains ASCII, Unicode, And UTF-8

Over on YouTube [Nic Barker] gives us: UTF-8, Explained Simply.

If you’re gonna be a hacker eventually you’re gonna have to write software to process and generate text data. And when you deal with text data, in this day and age, there are really only two main things you need to know: 7-bit ASCII and UTF-8. In this video [Nic] explains 7-bit ASCII and Unicode, and then explains UTF-8 and how it relates to Unicode and ASCII. [Nic] goes into detail about some of the clever features of Unicode and UTF-8 such as self-synchronization, single-byte ASCII, multi-byte codepoints, leading bytes, continuation bytes, and grapheme clusters.

[Nic] mentions about UTF-16, but UTF-16 turned out to be a really bad idea. UTF-16 combines all of the disadvantages of UTF-8 with all of the disadvantages of UTF-32. In UTF-16 there are things known as “surrogate pairs”, which means a single Unicode codepoint might require two UTF-16 “characters” to describe it. Also the Byte Order Marks (BOM) introduced with UTF-16 proved to be problematic. Particularly if you cat files together you can end up with stray BOM indicators randomly embedded in your new file. They say that null was a billion dollar mistake, well, UTF-16 was the other billion dollar mistake.

tl;dr: don’t use UTF-16, but do use 7-bit ASCII and UTF-8.

Oh, and as we’re here, and talking about Unicode, did you know that you can support The Unicode Consortium with Unicode Adopt-a-Character? You send money to sponsor a character and they put your name up in lights! Win, win! (We noticed while doing the research for this post that Jeroen Frijters of IKVM fame has sponsored #, a nod to C#.)

If you’re interested in learning more about Unicode check out Understanding And Using Unicode and Building Up Unicode Characters One Bit At A Time.

Continue reading “Nic Barker Explains ASCII, Unicode, And UTF-8”

STL Editing With FreeCAD

[Kevin] admits that FreeCAD may not be the ideal tool for editing STL files. But it is possible, and he shares some practical advice in the video below. If you want to get the most out of your 3D printer, it pays to be able to create new parts, and FreeCAD is a fine option for that. However, sometimes you download an STL from the Internet, and it just isn’t quite what you need.

Unlike native CAD formats, STLs are meshes of triangles, so you get very large numbers of items, which can be unwieldy. The first trick is to get the object exactly centered. That’s easy if you know how, but not easy if you are just eyeballing it.

If you use the correct workbench, FreeCAD can analyze and fix mesh problems like non-manifold parts, flipped normals, and other issues. The example is a wheel with just over 6,000 faces, which is manageable. But complex objects may make FreeCAD slow. [Kevin] says you should be fine until the number of faces goes above 100,000. In that case, you can decimate the number of faces with, of course, a corresponding loss in resolution.

Once you are satisfied with the mesh, you can create a real FreeCAD shape from the mesh. The resulting object will be hollow, so the next step will be to convert the shape to a solid.

That still leaves many triangles when you really want flat surfaces to be, well, flat. The trick is to make a copy and use the “refine shape” option for the copy. Once you have a FreeCAD solid, you can do anything you can do in FreeCAD.

We’ve run our share of FreeCAD tips if you want more. There are other ways to tweak STLs, too.

Continue reading “STL Editing With FreeCAD”

Block Devices In User Space

Your new project really could use a block device for Linux. File systems are easy to do with FUSE, but that’s sometimes too high-level. But a block driver can be tough to write and debug, especially since bugs in the kernel’s space can be catastrophic. [Jiri Pospisil] suggests Ublk, a framework for writing block devices in user space. This works using the io_uring facility in recent kernels.

This opens the block device field up. You can use any language you want (we’ve seen FUSE used with some very strange languages). You can use libraries that would not work in the kernel. Debugging is simple, and crashing is a minor inconvenience.

Another advantage? Your driver won’t depend on the kernel code. There is a kernel driver, of course, named ublk_drv, but that’s not your code. That’s what your code talks to.

Continue reading “Block Devices In User Space”

The Windows Interface You Didn’t Like, For Linux

If you were asked to pick the most annoying of the various Microsoft Windows interfaces that have appeared over the years, there’s a reasonable chance that Windows 8’s Metro start screen and interface design language would make it your choice. In 2012 the software company abandoned their tried-and-tested desktop whose roots extended back to Windows 95 in favor of the colorful blocks it had created for its line of music players and mobile phones.

Consumers weren’t impressed and it was quickly shelved in subsequent versions, but should you wish to revisit Metro you can now get the experience on Linux. [er-bharat] has created Win8DE, a shell for Wayland window managers that brings the Metro interface — or something very like it — to the open source operating system.

We have to admire his chutzpah in bringing the most Microsoft of things to Linux, and for doing so with such a universally despised interface. But once the jibes about Windows 8 have stopped, we can oddly see a point here. The trouble with Metro was that it wasn’t a bad interface for a computer at all, in fact it was a truly great one. Unfortunately the computers it was and is great for are handheld and touchscreen devices where its large and easy to click blocks are an asset. Microsoft’s mistake was to assume that also made it great for a desktop machine, where it was anything but.

We can see that this desktop environment for Linux could really come into its own where the original did, such as for tablets or other touch interfaces. Sadly we expect the Windows 8 connection to kill it before it has a chance to catch on. Perhaps someone will install it on a machine with the Linux version of .net installed, and make a better Windows 8 than Windows 8 itself.

BASIC On A Calculator Again

We are always amused that we can run emulations or virtual copies of yesterday’s computers on our modern computers. In fact, there is so much power at your command now that you can run, say, a DOS emulator on a Windows virtual machine under Linux, even though the resulting DOS prompt would probably still perform better than an old 4.77 MHz PC. Remember when you could get calculators that ran BASIC? Well, [Calculator Clique] shows off BASIC running on a decidedly modern HP Prime calculator. The trick? It’s running under Python. Check it out in the video below.

Think about it. The HP Prime has an ARM processor inside. In addition to its normal programming system, it has Micropython as an option. So that’s one interpreter. Then PyBasic has a nice classic Basic interpreter that runs on Python. We’ve even ported it to one or two of the Hackaday Superconference badges.

Continue reading “BASIC On A Calculator Again”

Arnis Brings The World To Minecraft: Bedrock Edition

A couple of years ago, we covered a project called Arnis, created by [Louis Erbkamm], which allowed you to generate any portion of Earth into Minecraft blocks and maps. It was already impressive, but since we last checked in the open source project has made some incredible progress.

When we first covered Arnis, it was stuck on the Java edition of Minecraft. But now the project has been updated to support the more modern Bedrock Edition, meaning you can put your home into any device’s version of Minecraft!

Beyond Bedrock version support, the actual tool has improved with proper elevation generation using data provided from NASA. This allows you to view the Alps or the Himalayas in all their voxel glory, or explore an entire map of the Moon. Perhaps what’s even more impressive is that the generation is accurate enough to be used in an actual research study involving flood mitigation education.

All of this has been made possible with help from a passionate community who have volunteered their time to assist [Louis] with the project — a testament to the power of open source.

What Happens When A Bug Rears Its Head At Mach Two?

While some may see amateur rocketry as little more than attaching fins to a motor and letting it fly, it is, in fact, rocket science. This fact became very clear to [BPS.space] when a parachute deployed on a rocket traveling at approximately Mach 1.8. 

The rocket design is rather simple — essentially just 3D printed fins glued onto a motor with a nose-cone for avionics. A single servo and trim tab provide a modicum of roll control, and a parachute is mounted in the nose along with a homing beacon for faster recovery. Seemingly, the only thing different about this flight is properly validated telemetry and GPS antennae.

After a final ground check of the telemetry and GPS signal quality, everything is ready for what seems like a routine launch. However, somewhere around Mach 1.8, the parachute prematurely deploys, ripping apart the Kevlar rope holding together the three rocket sections. Fortunately, the booster and avionics sections could be recovered from the desert.

Continue reading “What Happens When A Bug Rears Its Head At Mach Two?”