Naming Names

We have all heard that good variable names are important for creating readable programs — advice that will serve you well when you come back to your code two years later, or even twenty. Sometimes, when you are so deep in the zone and begin to question a variable name that you made three levels up the calling hierarchy, it can be helpful to take a step back and review your variable naming conventions. The wikipedia article on computer program naming conventions is a good starting point, where you can dig into the nitty gritty of Hungarian notation like bFlag, case separated names like camelCase, and so on. But sometimes you have to go meta, and need names to describe the names themselves.

For example, in everyday usage the terms parameter and argument are often used interchangeably. But strictly speaking, a parameter is a placeholder, the variables in a function declaration for example (see image above). An argument is the actual value itself, say the number 50.334 in the example.

We recommend that units of measure should always be clearly specified in your comments, perhaps even in the variable names if you’re mixing different systems in the same program. At Hackaday we prefer to use SI units, check out NIST SP 330 if you’re interested. But invariably, there are going to be exceptions for years to come. We like to deal with those at the edges during I/O if possible, thus keeping a consistent set of units in the core of the program.

What about the terms number and value? We like to think of a number as being a kind of value. For example, a function’s return value could be a number, say a velocity. Or it could return an enumeration or a boolean. Sometimes the perfect meta-name for something will collide with a reserved keyword in your programming language, names like string or data for example. In these cases you have to be creative and find suitable synonyms, perhaps text and payload.

Using consistent and precise language can be tedious, but it can be just as helpful as good commenting and variable naming practices. Do you have any examples where precise terminology such as this has been been helpful or perhaps tripped you up? If so, share in the comments section below.

 

 

Inflatable Hospital Isolation Wards

The continued spread of Covid-19 has resulted in a worldwide shortage of hospital beds. A temporary hospital isolation ward (translated) was co-developed by the Korea Advanced Institute of Science and Technology (KAIST) and the Korea Institute of Radiological and Medical Sciences (KIRAMS) to help alleviate this problem. We’re not familiar with the logistics and expense of installing traditional temporary hospital facilities, but the figures provided for this inflatable building approach to the problem seem impressive. It takes 14 days to produce one module, a process which presumably could be pipelined. Being 70% lighter and smaller than their rigidly-constructed counterparts, they can be more easily stored and shipped where needed, even by air.

Once on-site, it takes one day to inflate and outfit it with utilities such as electricity, water, and communications. One of these modules, which look like really big inflatable Quonset huts, contains an intensive care unit, four negative-pressure rooms, a nursing station, staff area, changing and bathrooms, and storage. All this in a 450 m2 building 30 m long and 15 m wide. That works out to be almost 2-stories tall, which is confirmed by the photo above.

Now that the design is finished and a functional unit constructed, the goal is to put it into production as soon as possible. Of course, physical hospital facilities are not the only thing in short supply these days — doctors, nursing and support staff, medical supplies, not to mention the vaccinations themselves, are all needed. But hopefully the success of this project can contribute to the global effort of saving lives and getting control of the virus sooner rather than later. The video below is in Korean, but the automatic English subtitles aren’t too bad.

Continue reading “Inflatable Hospital Isolation Wards”

Death Of The Serial Squid: When Do You Give Up?

While searching for a connector recently, I revisited an old project of mine called the Serial Squid. This was to have been my first open-source hardware design. After completing the entire design, PCB, BOM, and preparing for a crowd-funded campaign, I eventually gave up for reasons discussed below, I’ve always thought of this as a failure, but on further reflection I see it in a new light. There were some good lessons learned along the path to abandonment.

When do you let go?  When should you push through? Continue reading “Death Of The Serial Squid: When Do You Give Up?”

South Korea Blankets Country With Free WiFi On All Public Transit

Wrapping up a multi-year project to provide free WiFi on all public transportation, South Korea’s Ministry of Science and Information and Communications Technology (MSIT) announced that a total of 35,006 buses had been equipped nationwide.

Previously, subscriber-based WiFi had been installed on subways and in subway stations. It was provided privately by two phone carriers and free only for their subscribers. The coverage was spotty and slow, and in 2017 the government took over and implemented a better system. With this announcement, the whole public transportation system is now covered with stable and free WiFi.

We also noticed that the government has released the details of the 220,000 WiFi access points to the public. This includes the location, IP address, and RSSI data for use by people and companies wanting to develop location-based services. What is the state of free WiFi access points in your region, and does it extend to public transportation? Do you find it reliable, or do you use your data plan when out and about?

Hands-Free Page Turning

For people who can’t lift a finger to turn the page on their ebooks, a solution is at hand. Seoul based technology company Visual Camp has adapted their eye tracking algorithms to an ebook reader. (Video, embedded below.) Reportedly this is the first time an ebook reader has been so equipped.

If your eye lingers on the page turn button, it will turn the page. While this particular application seems innocuous, some of the other applications being touted seem a little contrived if not invasive. For example, applying gaze analysis while you are reading a book, they claim to be able to make targeted recommendations for other books.

We’ve discussed eye tracking devices before, but they have utilized hardware. Visual Camp claims their AI-based technology only requires a color camera and can be integrated into existing camera-equipped devices, such an this ebook reader. They also offer a SDK for developers who want to add eye tracking control into their apps. Eye tracking is hard, though, and the devil is in the details. It’d be neat to see what they’re up to.

Continue reading “Hands-Free Page Turning”

AI On The Highway

A couple of announcements caught our attention last week regarding AI-controlled cars. South Korea’s Kakao Mobility and local startup Autonomous A2G launched a limited self-driving taxi service in Sejong City this month, made possible by enabling legislation passed in May. For now, the service is restricted to government employees, and the AI driver will be backed-up by an engineer who is there to monitor the systems and take over in an emergency. The companies plan to expand the fleet and service areas this year, although no details are given.

Another announcement comes from the Ministry of Land, Infrastructure and Transport about the on-going successes of the semi-autonomous truck platooning program. This is a collaboration between the Korean Expressway Corporation, Kookmin University in Seoul, and Hyundai Motors. Previously restricted to a designated test road called the Yeoju Smart Highway, the program is now being tested on public roads at speeds up to 70 kph. This year the program will expand to platoons of 4 trucks running at 90 kph. We’ve always thought that long-haul trucking and freight industries would be an early adaptor AI technologies, and one which AI could offer significant benefits.

Continue reading “AI On The Highway”

Number Bases Stretch The Mind

Some of us might solve crossword puzzles or Sudoko games to exercise our minds, but [Nathan Nichols] plays with exotic number systems to keep the brain cells in shape. He wrote the Hanoi C99 library while in high school, implementing several of his favorites.

We have all been using decimal (base 10) and duodecimal (base 12, as in clocks) since before grade school. Us computer geeks are also adept at various computer-friendly systems like binary, octal, and hexadecimal. The true nerds among us will be familiar with systems like vigesimal (base 20 Mayan numerals) and sexagesimal (base 60 Babylonian numbers). We ourselves espoused the virtues of seximal (base 6) a couple of years ago. But if you really want to stretch your mind, take a dive into the weird number systems that [Nathan] has been exploring.

Negabinary (base -2)

The lowest level of weirdness in the group, this one is almost normal. Its the same as binary, except the bit weights have alternating signs: { 1, -2, 4, -8, ... }.

Binarions (base -1+i)

Or base -1+j if you studied electrical engineering. The use of complex numbers as radices was proposed by Donald Knuth way back in 1955. We find it really hard to imagine this one being helpful.

Fibonacci base

Numbers can also be represented by the summation of a sequence of Fibonacci numbers. Using this system, a number can sometimes be represented more than one way, so watch out.

Stern-Brocot tree

A number is represented by its path down the Stern-Brocot tree. One feature of this system is that numbers can be exact. For example, the Stern-Brocot tree representation of one-third has a finite number of digits.

While [Nathan]’s library only performs conversion at input or output, we wonder if someone will take this further and implement an arithmetic unit inside an FPGA. Besides being a fun exercise, it would baffle someone casually trying to reverse engineer your secret calculations. Let us know of any strange number systems you have used or encountered.