Thursday, February 16, 2017

TREK-NOLOGY: Tech Devices Predicted by Star Trek

For a generation of nerds (and I use that term affectionately, for they are my people) growing up in the late 60’s, 70’s, and 80’s, Star Trek was essential viewing.  Every week, Gene Roddenberry’s most famous creation brought us a vision of a hopeful future: a progressive, highly-evolved environment, where mankind has grown up and defeated racism, broken through social barriers, and explored the universe in the name of peace.  On the surface, the show was a sci-fi Space Western. However, it has always been about social issues and bold statements, cleverly hiding behind a veil of popcorn entertainment. While the complex social issues were lost on many of us young viewers, the cool gadgetry was not. Everyone in my neighborhood held toy pistols backward, pretending it was a classic Starfleet phaser. And who didn’t dream about using a Transporter to get somewhere in an instant?  It’s easy to see that modern examples of technology can trace their lineage back to Star Trek. One glance around the world of science and technology, and it’s easy to spot Star Trek’s unquestionable influence.  Here are ten modern technological marvels that we sometimes take for granted, but were predicted decades ago in Star Trek.

iPad    
When Steve Jobs took to the stage in 2007 and unveiled the iPad, he cemented Apple’s grip on technology must-have items.  There was a certain “cool factor” in using the iPad, which, like the iPhone that preceded it, had a slick interface, groovy apps, and flexibility as a work tool, toy, and multimedia device.  It was for many the neatest new item. Thing is, it wasn’t a new concept, with early examples in the original series (TOS in fan-speak), and especially later in The Next Generation, bearing a strong resemblance 20 years prior to Apple’s entry. 


Universal Translator
How do you travel across the cosmos and understand races from other worlds? Star Trek solved the problem of speaking to alien races across the universe by the Universal Translator trope.  Everyone carries a device capable of understanding an alien’s speech, and translating it for humans in real-time (I’m still curious as to why their lips don’t move out of sync like on Kung Fu Theater, but I digress).  The technology seemed light-years ahead in 1966, but is now a reality.  Both Google and Waverly Labs are working hard to disrupt the market first with real-time translation devices (Templeton, 2016), capable of allowing the wearer to communicate with native speakers in French and other languages. No word on how long we’ll have to wait until travelers can speak to a Klingon.

Replicator
This one might be a small stretch, but it is worth mentioning.  We may be a few years away from ordering earl grey tea, hot, but the ability to build small items with 3D printing technology is becoming more common, and cheaper than ever.  For a little as $267, budding entrepreneurs and generally bored artists can fabricate small items, normally out of high-impact polystyrene or other thermoplastic media (Hoffman, 2017).


Tricorder
 In the future, according to Star Trek, humans who were sick or injured were just a few minutes away from the best in high-tech treatment.  Starfleet physicians like Dr. McCoy and Dr. Crusher would quickly scan a patient and receive a diagnosis as well as an X-ray scan with a medical tricorder.  We may not have to wait for the 23rd century for a similar device, thanks to Scanadu’s Scout health sensor.  While it is not nearly as advanced as something you might see on Star Trek, it does claim to provide accurate data on heart rate, core body temperature, blood pressure, and respiratory rate in a painless, efficient manner (Williams,2015).

Natural Language Processing
One optimistic feature seen since the inception of Star Trek is the ability to speak to a computer and retrieve information.  While efforts to achieve this have been underway since the early days of computer science, the greatest leap has occurred in the last few years.  Advances in language processing algorithms have made it easier for computers to grasp the very difficult lexical variations of how humans express themselves. Amazon Echo and Google’s Pixel are two competing examples of NLP research tools that employ keywords for activation (Bhartiya, 2017).  Instead of saying “Computer, dim the lights”, users say “Echo, dim the lights”.

Planet Scanners
A trope virtually invented by Star Trek is the ship-scans-the-planet trope, in which our intrepid crew scans for life signs, planetary conditions, or other details to move the story along.  The technology is no longer the stuff of science fiction, however.  Since the late 1980’s researchers have planned to use earth-based scanners to observe the NIR spectra of light reflected from asteroids to determine their composition, surface minerology, and lithology, and claim that the technology can be used to make the same observations of other planetary bodies (Burns, 1989).

Video Conferencing
As difficult as it is to imagine now, video conferencing has not been ubiquitous for long.  Video conferencing has been around since at least 1982 ("Video ConferencingTimeline," 2015), when Compression Labs commanded $1,000 per hour for the service.  The technology, while extremely pricey, was not a new idea, appearing on Star Trek from day one.

Bluetooth
In early TOS episodes, it was not unusual to see a rogue robotic entity come along and steal data from computers, change settings, or sabotage systems through a wireless connection.  While it must have seemed like sorcery in 1966, and an easy plot device, this could be construed as an early depiction of Bluetooth technology, decades before it became standard fare with wireless headphone enthusiasts.  In fact, Uhura’s earpiece is another prime example of wireless audio, rendered via Bluetooth-style technology. 

Hypospray
According to Star Trek’s optimistic future, painful needles will be a thing of the past.  If a character needed to be inoculated after a brush with an alien disease, a quick shot of Bones’s hypospray would do the trick.  No longer the stuff of science fiction, hypospray technology, or painless injection without breaking the skin, has actually been available since 2012 (Humphries, 2012).

Augmented Vision Glasses
We take our vision for granted. Patients who are legally blind struggle with the most basic tasks.  In the future, perhaps that will no longer be the case.  In Star Trek: The Next Generation, Geordi La Forge, a blind character, saved the day many times, partly due to his extraordinary vision thanks to his hi-tech visor.  His character showed that even people who were disabled in some way can be an integral part of the crew, thanks to innovative tools.  The concept has inspired developers who have introduced eSight, a visor that corrects genetically malformed retinas in patients with no central vision (Fox News, 2015).  The tool is helping people who have been blind since birth to see for the first time.  Similarly, Oxford Scientists created Smart Specs, a visor that captures real-time imagery and heightens the contrast, assisting legally blind users in everyday life (Matchar,2015). Plus, they just look insanely cool.
                                       
Conclusion
For many, the show impacted the career choices of many an astronaut, pilot, or scientist. I myself have been fortunate enough to study engineering and computer science, inspired in no small part by Trek.  The show has impacted our culture in profound ways, perhaps more so than any science fiction franchise.  For most of us die-hard fans, the optimism of the series lives on.  Perhaps in some small way, our modern hi-tech tools can help usher in an era of peace depicted in classic Trek, and take us where no gadgets have gone before.

About the author:

Dax Bradley is an author with non-fiction books on movies and technology, and can be found at Amazon.com and Indyplanet.com. Visit his Facebook page on B-movies and say hi!

Wednesday, February 15, 2017

C++ Tips: Two Approaches to Find an Average of Numbers

by Dax Bradley

On occasion, I will drop notes on programming some basic code here and there.  In this entry, we examine how to use C++ to prompt the user to enter a set of positive integers and average them up.  The code is pretty straightforward, when you have a fixed number of integers pre-determined.  For example, you might know you have 20 numbers to add up and average out. 

However, it would be more useful to be able to specify how many numbers you need to add up and discover the average for.  Here are two methods.  The first is not using Dynamic Memory Allocation, and the 2nd one does use it.  I'll explain the difference.

Dynamic memory allocation is crucial if there is a chance you could enter a null value, such as a negative number by mistake, or possibly that you use so much memory with your data that you crash the program.  The second example below will address that, with a few comments thrown in for good measure (Denoted by the /*...*/ symbols).

Find the Average of n Integers 
(without Dynamic Memory Allocation)

#include <iostream>
using namespace std;
int main()
{
   int n, count;
   float sum, avg;
   sum = 0;
   cout << "How many numbers?  ";
   cin >> n;
   int a;
   for (count=1; count<=n; count++) {
        cout << "Enter Number:  ";
        cin >> a;
        sum = sum + a;
   }
   cout << "The sum is " << sum << endl;
   avg = sum / n;
   cout << "The average is  " << avg << endl;
   return 0;
 }



Online compiler: C Shell

And finally, here is another version with a little more code in it, and some comments that highlight the need for pointers and other tidbits...

Find the Average of n Integers 
(with Dynamic Memory Allocation)
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
int main ()
{

int sum=0, avg, i;
int how_many;
int *p;
printf ("Enter number of values you want to input: ");

scanf ("%d",&how_many);
/* This next block uses malloc dynamic memory pointer to make sure the pointer value is not null*/
p = (int *)malloc(how_many * 4);
if (p == NULL)   
      
{
printf(" Out of memory!\n");
printf ("Press any key to close.");
exit(0);
}

for (i=0;i<how_many;i++)

     /*printf returns the number of characters written or a negative value if an error occurs*/

printf ("Enter value of %dth integer: ",i+1);

     /*scanf returns data items successfully assigned a value, like the opposite of printf*/

scanf ("%d",&p[i]);

     /* %d is a format specifier that stands for Signed Decimal integers */

sum = (sum + p[i]);
}

     avg = (sum / how_many);
     printf ("Sum = %d\n\n",sum);
     printf ("Average = %d\n\n",avg);
     free (p);

/* where malloc allocates memory, free needs to be at the end to free up the memory */

     printf ("press any key to close.");

}

Did I get anything wrong? See something you'd do differently? Drop me a note, leave a comment in the comment section, and let me know. Let's do some coding!